import { Observable, Subject, BehaviorSubject, Subscription } from 'rxjs'; import * as _cometchat_chat_sdk_javascript from '@cometchat/chat-sdk-javascript'; import { CometChatSettings, FlagReason } from '@cometchat/chat-sdk-javascript'; import * as _angular_core from '@angular/core'; import { PipeTransform, TemplateRef, OnDestroy, Signal, InjectionToken, WritableSignal, DestroyRef, EventEmitter as EventEmitter$1, AfterViewInit, QueryList, ElementRef, OnChanges, SimpleChanges, OnInit, ChangeDetectorRef, NgZone, ApplicationRef, EnvironmentInjector, AfterViewChecked, DoCheck, Renderer2, Injector, EffectRef } from '@angular/core'; import { Config } from 'dompurify'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { CometChatCardThemeMode, CometChatCardThemeOverride, CometChatCardActionEvent, CometChatCardAction } from '@cometchat/cards-angular'; import { ControlValueAccessor } from '@angular/forms'; /** * Interface for localization settings configuration. */ interface LocalizationSettings { /** The language code to use (e.g., 'en-US', 'es', 'fr') */ language?: string; /** Fallback language if the requested language is not available */ fallbackLanguage?: string; /** Timezone for date/time formatting (e.g., 'America/New_York') */ timezone?: string; /** Disable automatic language detection from browser */ disableAutoDetection?: boolean; /** Disable date/time localization (use en-US format) */ disableDateTimeLocalization?: boolean; /** Custom translations to merge with built-in translations */ translationsForLanguage?: Record>; /** Calendar object for custom date formatting */ calendarObject?: CalendarObject; /** Handler called when a translation key is missing */ missingKeyHandler?: (key: string) => void; } /** * Interface for calendar date formatting configuration. */ interface CalendarObject { /** Format for today's date (e.g., 'h:mm A') */ today?: string; /** Format for yesterday's date (e.g., '[Yesterday] h:mm A') */ yesterday?: string; /** Format for dates within the last week (e.g., 'dddd h:mm A') */ lastWeek?: string; /** Format for all other dates (e.g., 'DD/MM/YYYY') */ otherDays?: string; /** Relative time configuration */ relativeTime?: RelativeTimeConfig; } /** * Interface for relative time formatting. */ interface RelativeTimeConfig { /** Format for "1 minute ago" (use %d for the number) */ minute?: string; /** Format for "X minutes ago" (use %d for the number) */ minutes?: string; /** Format for "1 hour ago" (use %d for the number) */ hour?: string; /** Format for "X hours ago" (use %d for the number) */ hours?: string; } /** * The `CometChatLocalize` class handles localization for the CometChat Angular UIKit. * * It provides functionality to: * - Detect the user's browser language settings * - Set and switch the application's language at runtime * - Translate keys to localized strings * - Format dates with localization support * - Add custom translations * * @example * // Initialize with settings * CometChatLocalize.init({ * language: 'es', * timezone: 'Europe/Madrid' * }); * * // Get a translated string * const text = CometChatLocalize.getLocalizedString('conversation_chat_title'); * * // Switch language at runtime * CometChatLocalize.setCurrentLanguage('fr'); */ declare class CometChatLocalize { /** Current active language */ private static language; /** Fallback language when translation is not found */ private static fallbackLanguage; /** Current timezone for date formatting */ private static timezone; /** All available translations */ private static translations; /** Current localization settings */ private static localizationSettings; /** Calendar object for date formatting */ private static calendarObject; /** Whether a custom global CalendarObject was explicitly set by the developer */ private static customCalendarObjectSet; /** Language-specific default CalendarObjects */ private static languageCalendarDefaults; /** Whether to disable automatic language detection */ private static disableAutoDetection; /** Whether to disable date/time localization */ private static disableDateTimeLocalization; /** Default timezones for each language */ private static defaultTimezones; /** * Initializes the localization service with the provided settings. * * @param settings - The localization settings to apply * * @example * CometChatLocalize.init({ * language: 'es', * timezone: 'Europe/Madrid', * fallbackLanguage: 'en-US', * disableAutoDetection: false * }); */ static init(settings: LocalizationSettings): void; /** * Adds custom translations to the existing translations. * * @param resources - Object containing language codes as keys and translation objects as values * * @example * CometChatLocalize.addTranslation({ * 'en-US': { 'custom_key': 'Custom Value' }, * 'es': { 'custom_key': 'Valor Personalizado' } * }); */ static addTranslation(resources: Record>): void; /** * Returns the browser's preferred language. * * @returns The browser language code (e.g., 'en-US') */ static getBrowserLanguage(): string; /** * Translates a key to the localized string in the current language. * * @param key - The translation key to look up * @returns The translated string, or empty string if not found * * @example * const title = CometChatLocalize.getLocalizedString('conversation_chat_title'); * // Returns "Chats" in English */ static getLocalizedString(key: string): string; /** * Gets the current active language. * * @returns The current language code */ static getCurrentLanguage(): string; /** * Sets the current language and reinitializes with the new language. * * @param language - The language code to set * * @example * CometChatLocalize.setCurrentLanguage('fr'); */ static setCurrentLanguage(language: string): void; /** * Gets the default language based on settings or browser detection. * * @returns The default language code */ static getDefaultLanguage(): string; /** * Gets the language to use for date localization. * * @returns The language code for date formatting */ static getDateLocaleLanguage(): string; /** * Gets the current timezone. * * @returns The current timezone string */ static getTimezone(): string; /** * Gets the calendar object for date formatting. * Returns: custom CalendarObject if explicitly set, else language-specific default, else empty object. * * @returns The calendar object configuration */ static getCalendarObject(): CalendarObject; /** * Sets the global CalendarObject at runtime. * Marks the CalendarObject as explicitly set so language switching won't override it. * * @param calendarObject - The CalendarObject to set globally * * @example * CometChatLocalize.setGlobalCalendarObject({ * today: 'HH:mm', * yesterday: '[Yesterday]', * lastWeek: 'dddd', * otherDays: 'DD/MM/YYYY' * }); */ static setGlobalCalendarObject(calendarObject: CalendarObject): void; /** * The default timezone for the active language. * * Keyed by base language like the calendar table, so a region-tagged code * resolves instead of dropping straight to UTC. * * @returns An IANA timezone identifier */ private static resolveDefaultTimezone; /** * Gets the default timezone based on language or system detection. */ private static getDefaultTimeZone; /** * Formats a date using a given pattern with localization support. * Delegates to the standalone helper in localize-helpers.ts. */ private static formatDateFromPattern; /** * Formats a Unix timestamp based on the provided calendar configuration. * * @param timestamp - Unix timestamp in seconds * @param calendarObject - Calendar configuration for formatting * @returns Formatted date string * * @example * const formatted = CometChatLocalize.formatDate(1640000000, { * today: 'h:mm A', * yesterday: '[Yesterday] h:mm A', * lastWeek: 'dddd h:mm A', * otherDays: 'DD/MM/YYYY' * }); */ static formatDate(timestamp: number, calendarObject: CalendarObject): string; /** * Whether the integrator set a global CalendarObject explicitly. * * `getCalendarObject()` falls back to the per-language defaults, so its * return value alone cannot tell a deliberate override from a default. * Components that merge their own format with the global one need that * distinction, or the language default silently wins over their format. * * @returns True when `setGlobalCalendarObject` (or an init-time CalendarObject) was used */ static hasCustomCalendarObject(): boolean; /** * Derives a CalendarObject from the platform's own data for a locale the kit * has no entry for. * * `Intl` knows the conventions of every locale the browser supports, so a * region-tagged code with no base-language entry — `en-AU`, `en-NZ` — still * gets its own field order and clock instead of falling back to US English. * * @param locale - BCP 47 language tag * @returns The derived defaults, or null when the platform cannot format the locale */ private static readonly derivedCalendarCache; /** * Turns `Intl` date parts into a pattern string. * * Literal parts are wrapped in brackets so the formatter treats them as text. * Without that, a locale whose separator contains a letter — `bg-BG` ends its * date with ` г.` — would have that letter parsed as a date token. * * @param parts - Formatted parts for a sample date * @param monthToken - The token to substitute for the month part * @returns A pattern usable by formatDate */ private static patternFromParts; /** * Whether the platform has its own data for a locale. * * For a tag it does not know, Intl silently formats in the runtime's default * locale instead — so the result would follow the device, not the configured * fallback language. */ private static isLocaleSupportedByPlatform; private static calendarDefaultsFromIntl; /** * The date pattern for a locale with the month written as a name. * * Message separators read better as "22 Nov, 2026" than "22/11/2026", and the * month name is already localized. Only the field order needs deriving. * * @returns A pattern such as `DD MMM YYYY`, or null when the platform cannot format the locale */ private static monthNameDatePattern; /** * The calendar defaults for the active locale. * * The browser reports a region-tagged code (`de-DE`, `fr-FR`, `pt-BR`), and * the kit adopts it verbatim via `setCurrentLanguage(getBrowserLanguage())`. * `LANGUAGE_CALENDAR_DEFAULTS` is keyed by base language, so a direct lookup * misses and — before this resolver existed — both pattern getters fell * straight through to the hard-coded en-US values. German users saw * `MM/DD/YYYY` and a 12-hour clock, so 04/05 read as the wrong day. * * Order: exact tag, then base language, then the platform's own data for the * tag, then the fallback language, then en-US. * * The platform is consulted before `fallbackLanguage` on purpose. The * fallback exists to decide which *strings* to show when a translation is * missing; it says nothing about how the reader writes a date. For `en-AU` * there is no `en` entry, so deferring to a fallback of `en-US` would hand an * Australian reader `MM/DD/YYYY`, while the platform correctly says * `DD/MM/YYYY`. * * @returns The defaults to build time and date patterns from */ private static resolveCalendarDefaults; private static readonly resolvedCalendarCache; /** * The active locale's calendar defaults, with the "yesterday" label taken * from the translations rather than the table. * * The table's label is tied to the *date* locale, but the word is UI text. * With `disableDateTimeLocalization: true` the date locale is pinned to * `en-US`, so a German UI rendered "Yesterday" beside "Sonntag". * * Cached, because the pattern getters run inside template getters on every * change-detection pass and this would otherwise allocate each time. * * @returns Calendar defaults safe to hand to formatDate */ private static localizedCalendarDefaults; /** * Gets the time-of-day pattern the active locale writes clock times with. * * Most locales use a 24-hour clock ('HH:mm'); `en-US` and `hi` use a 12-hour * clock with a meridiem ('hh:mm A'). Components that need a date *and* a time * should build their pattern around this instead of hard-coding 'hh:mm A', * which rendered "19:17" as "07:17 午後" in Japanese. * * @returns The locale's time pattern * * @example * const pattern = `DD MMM, ${CometChatLocalize.getTimePattern()}`; */ static getTimePattern(): string; /** * Gets the numeric date pattern the active locale writes full dates with, * e.g. 'MM/DD/YYYY' for `en-US`, 'DD.MM.YYYY' for `de` and 'YYYY/MM/DD' for `ja`. * * Components that need an explicit fallback for older dates should use this * rather than hard-coding 'DD/MM/YYYY', which shows every locale one country's * field order. * * @param style - 'numeric' for 22/11/2026, 'monthName' for 22 Nov 2026 in the locale's order * @returns The locale's date pattern */ static getDatePattern(style?: 'numeric' | 'monthName'): string; /** * Formats a duration in the active locale. * * Uses `Intl.NumberFormat` unit formatting rather than translation keys so * that each language gets its own plural form: 2 minutes reads "2 minutes" * in English, "2 minutos" in Spanish and "2分" in Japanese. * * @param seconds - The duration in seconds; negative and non-finite values count as 0 * @param style - 'long' for "2 minutes 30 seconds", 'short' for "2 min 30 sec" * @returns The localized duration string * * @example * CometChatLocalize.formatDuration(150); // "2 minutes 30 seconds" * CometChatLocalize.formatDuration(3723, 'short'); // "1 hr 2 min 3 sec" */ static formatDuration(seconds: number, style?: 'long' | 'short'): string; /** * Gets all available language codes. * * @returns Array of available language codes */ static getAvailableLanguages(): string[]; /** * Checks if a language is available. * * @param language - The language code to check * @returns True if the language is available */ static isLanguageAvailable(language: string): boolean; } /** * Helper function to get a localized string. * Shorthand for CometChatLocalize.getLocalizedString() * * @param key - The translation key * @returns The translated string */ declare const getLocalizedString: (key: string) => string; /** * Offline support settings, passed through unchanged to the Chat SDK's * `AppSettingsBuilder.setOfflineConfig()`. * * Declared structurally so the kit's public types never depend on an SDK * release that has offline support. It lists exactly the options the SDK's * `OfflineConfig` has, with no catch-all, so a misspelled option (for example * `enable` for `enabled`) is a compile error instead of leaving offline off. * Offline support needs a Chat SDK with offline support (4.3.1 or later); on an * older SDK, 4.3.0 included, this setting has no effect. * Leaving it unset keeps offline support off. */ interface CometChatOfflineConfig { enabled?: boolean; cacheDurationDays?: number; maxStorageSize?: number; maxMessagesPerConversation?: number; maxConversations?: number; maxPendingMessages?: number; autoSendPendingOnReconnect?: boolean; pendingQueueOverflowPolicy?: string; mediaCaching?: string; maxMediaCacheSize?: number; maxSnapshotQueries?: number; snapshotTtlDays?: number; encryption?: boolean; encryptionFailureBehavior?: string; debugTracing?: boolean; } /** * Represents the settings required to initialize the CometChat UIKit. * Use `UIKitSettingsBuilder` to create an instance of this class. * * @example * const settings = new UIKitSettingsBuilder() * .setAppId('YOUR_APP_ID') * .setRegion('us') * .setAuthKey('YOUR_AUTH_KEY') * .build(); * * CometChatUIKit.init(settings); */ declare class UIKitSettings { appId?: string; region?: string; subscriptionType?: string; autoEstablishSocketConnection: boolean; authKey?: string; roles?: string[]; adminHost?: string; clientHost?: string; storageMode: CometChat.StorageMode; /** * Whether calling features (voice/video) are enabled. * When `false` (default), the Calls SDK is not initialized and * call buttons are hidden across all components. * @default false */ callingEnabled: boolean; /** * Custom CallAppSettings to use when initializing the Calls SDK. * If not provided, the UIKit builds default settings from appId and region. * Typed as `any` because `@cometchat/calls-sdk-javascript` is an optional dependency. */ callAppSettings?: any; /** * Offline support settings handed to the Chat SDK at init. Absent by * default, which leaves offline support off. */ offlineConfig?: CometChatOfflineConfig; /** * Creates a new UIKitSettings instance. * Prefer using UIKitSettingsBuilder for a fluent API. */ constructor(builder?: UIKitSettingsBuilder); static fromBuilder(builder: UIKitSettingsBuilder): UIKitSettings; getAppId(): string | undefined; getRegion(): string | undefined; getRoles(): string[] | undefined; getSubscriptionType(): string | undefined; getAuthKey(): string | undefined; isAutoEstablishSocketConnection(): boolean; getAdminHost(): string | undefined; getClientHost(): string | undefined; getStorageMode(): CometChat.StorageMode; isCallingEnabled(): boolean; getCallAppSettings(): any | undefined; getOfflineConfig(): CometChatOfflineConfig | undefined; } /** * Builder class for creating UIKitSettings instances. * Provides a fluent API for configuring CometChat UIKit settings. * * @example * const settings = new UIKitSettingsBuilder() * .setAppId('YOUR_APP_ID') * .setRegion('us') * .setAuthKey('YOUR_AUTH_KEY') * .build(); */ declare class UIKitSettingsBuilder { appId?: string; region?: string; subscriptionType?: string; roles?: string[]; autoEstablishSocketConnection?: boolean; authKey?: string; adminHost?: string; clientHost?: string; storageMode?: CometChat.StorageMode; callingEnabled?: boolean; callAppSettings?: any; offlineConfig?: CometChatOfflineConfig; build(): UIKitSettings; setAppId(appId: string): UIKitSettingsBuilder; setRegion(region: string): UIKitSettingsBuilder; setAuthKey(authKey: string): UIKitSettingsBuilder; subscribePresenceForAllUsers(): UIKitSettingsBuilder; subscribePresenceForFriends(): UIKitSettingsBuilder; subscribePresenceForRoles(roles: string[]): UIKitSettingsBuilder; setRoles(roles: string[]): UIKitSettingsBuilder; setAutoEstablishSocketConnection(autoEstablish: boolean): UIKitSettingsBuilder; setAdminHost(adminHost: string): UIKitSettingsBuilder; setClientHost(clientHost: string): UIKitSettingsBuilder; setStorageMode(storageMode: CometChat.StorageMode): UIKitSettingsBuilder; /** * Enables or disables calling features (voice/video). * When `true`, the Calls SDK is initialized after login and call buttons * become visible in components like MessageHeader and CallLogs. * @default false */ setCallingEnabled(enabled: boolean): UIKitSettingsBuilder; /** * Sets a custom `CallAppSettings` object to use when initializing the Calls SDK. * If not set, the UIKit builds default settings from `appId` and `region`. * * Build the settings using `CometChatUIKitCalls.CallAppSettingsBuilder`. * * @example * import { CometChatUIKitCalls } from '@cometchat/calls-sdk-javascript'; * * const callAppSettings = new CometChatUIKitCalls.CallAppSettingsBuilder() * .setAppId('APP_ID') * .setRegion('REGION') * .build(); * * const settings = new UIKitSettingsBuilder() * .setAppId('APP_ID') * .setRegion('REGION') * .setCallingEnabled(true) * .setCallAppSettings(callAppSettings) * .build(); */ setCallAppSettings(callAppSettings: any): UIKitSettingsBuilder; /** * Turns on the Chat SDK's offline support (cached reads, a durable outbox, * catch-up sync) and the kit's offline UI. The config is passed to the SDK * as is. Requires a Chat SDK with offline support; on an older SDK it is * ignored and the kit behaves as before. * * @example * new UIKitSettingsBuilder() * .setAppId('APP_ID') * .setRegion('REGION') * .setOfflineConfig({ enabled: true }) * .build(); */ setOfflineConfig(config: CometChatOfflineConfig): UIKitSettingsBuilder; } declare class CometChatSoundManager { static audio: string | null | HTMLAudioElement; static Sound: Sounds; /** * Plays the sound for an incoming message. * @param {string|null} customSound - The custom sound URL or null to use the default. * * @example * // Trigger the audio sound for an incoming message * CometChatSoundManager.onIncomingMessage(); * * @example * // Trigger the audio sound of your choice for an incoming message * CometChatSoundManager.onIncomingMessage("MP3_FILE_ASSET_PATH"); */ static onIncomingMessage: (customSound?: string | null) => void; /** * Plays the sound for an incoming message from another user. * @param {string|null} customSound - The custom sound URL or null to use the default. * * @example * // Trigger the audio sound for an incoming message from another user * CometChatSoundManager.onIncomingOtherMessage(); * * @example * // Trigger the audio sound of your choice for an incoming message from another user * CometChatSoundManager.onIncomingOtherMessage("MP3_FILE_ASSET_PATH"); */ static onIncomingOtherMessage: (customSound?: string | null) => void; /** * Plays the sound for an outgoing message. * @param {string|null} customSound - The custom sound URL or null to use the default. * * @example * // Trigger the audio sound for an outgoing message * CometChatSoundManager.onOutgoingMessage(); * * @example * // Trigger the audio sound of your choice for an outgoing message * CometChatSoundManager.onOutgoingMessage("MP3_FILE_ASSET_PATH"); */ static onOutgoingMessage: (customSound?: string | null) => void; /** * Plays the sound for an incoming call. * @param {string|null} customSound - The custom sound URL or null to use the default. * * @example * // Trigger the audio sound for an incoming call * CometChatSoundManager.onIncomingCall(); * * @example * // Trigger the audio sound of your choice for an incoming call * CometChatSoundManager.onIncomingCall("MP3_FILE_ASSET_PATH"); */ static onIncomingCall: (customSound?: string | null) => void; /** * Plays the sound for an outgoing call. * @param {string|null} customSound - The custom sound URL or null to use the default. * * @example * // Trigger the audio sound for an outgoing call * CometChatSoundManager.onOutgoingCall(); * * @example * // Trigger the audio sound of your choice for an outgoing call * CometChatSoundManager.onOutgoingCall("MP3_FILE_ASSET_PATH"); */ static onOutgoingCall: (customSound?: string | null) => void; /** * Contains mappings of sound types to their respective handler functions. * * The handlers are functions that trigger the playback of sounds for different events. * * @type {Object} * @property {Function} incomingCall - Handler function for playing the incoming call sound. * @property {Function} outgoingCall - Handler function for playing the outgoing call sound. * @property {Function} incomingMessage - Handler function for playing the incoming message sound. * @property {Function} incomingMessageFromOther - Handler function for playing the incoming message from other sound. * @property {Function} outgoingMessage - Handler function for playing the outgoing message sound. */ static handlers: { incomingCall: (customSound?: string | null) => void; outgoingCall: (customSound?: string | null) => void; incomingMessage: (customSound?: string | null) => void; incomingMessageFromOther: (customSound?: string | null) => void; outgoingMessage: (customSound?: string | null) => void; }; /** * Plays a predefined sound based on the provided sound type. * @param {"incomingCall" | "incomingMessage" | "incomingMessageFromOther" | "outgoingCall" | "outgoingMessage"} sound - The sound type to play. * @param {string|null} customSound - The custom sound URL or null to use the default. * @returns {boolean} - Returns false if the sound handler is not found. * * @example * // Play the sound for incoming messages * CometChatSoundManager.play("incomingMessage"); * * @example * // Play a custom sound for outgoing messages * CometChatSoundManager.play("outgoingMessage", "MP3_FILE_ASSET_PATH"); */ static play(sound: 'incomingCall' | 'incomingMessage' | 'incomingMessageFromOther' | 'outgoingCall' | 'outgoingMessage', customSound?: string | null): false | void; /** * Pauses the currently playing sound and resets its position. * * @example * // Pause the ongoing audio sound * CometChatSoundManager.pause(); */ static pause(): void; /** * Checks if the user has interacted with the page. * @returns {boolean} True if the user has interacted, false otherwise. */ static hasInteracted(): boolean; } interface Sounds { incomingCall?: 'incomingCall'; incomingMessage?: 'incomingMessage'; incomingMessageFromOther: 'incomingMessageFromOther'; outgoingCall?: 'outgoingCall'; outgoingMessage?: 'outgoingMessage'; } /** * Result interface for CometChatUIKit.init() method. * Represents the initialization result containing the logged-in user if available. */ interface InitResult { /** * The logged-in user if a user was already authenticated during initialization, * or null if no user is currently logged in. */ user: CometChat.User | null; } /** * Result interface for CometChatUIKit.logout() method. * Represents the logout result containing a success message. */ interface LogoutResult { /** * Success message returned by the CometChat SDK after logout. */ message: string; } /** * Log level enum defining verbosity levels. * Ordered from least verbose (none) to most verbose (debug). */ declare enum LogLevel { none = 0, error = 1, warn = 2, info = 3, debug = 4 } /** * Centralized logging utility for the CometChat UIKit. * All internal logging goes through this class so consumers can control verbosity. * * @example * // Set log level during app initialization * CometChatUIKit.setLogLevel(LogLevel.debug); * * @example * // Or directly * CometChatLogger.setLogLevel(LogLevel.error); * * @example * // Usage inside services * CometChatLogger.error('ConversationsService', 'Error fetching conversations:', error); * CometChatLogger.debug('MessageListService', 'handleReceipt called', { messageId }); */ declare class CometChatLogger { private static currentLevel; /** * Sets the active log level. Only messages at this level or below will be output. * @param level - The desired log level. */ static setLogLevel(level: LogLevel): void; /** * Returns the current log level. * @returns The active LogLevel value. */ static getLogLevel(): LogLevel; /** * Logs an error message if the current level permits. * @param tag - The source identifier (e.g. service or component name). * @param message - The log message. * @param args - Additional arguments forwarded to `console.error`. */ static error(tag: string, message: string, ...args: unknown[]): void; /** * Logs a warning message if the current level permits. * @param tag - The source identifier (e.g. service or component name). * @param message - The log message. * @param args - Additional arguments forwarded to `console.warn`. */ static warn(tag: string, message: string, ...args: unknown[]): void; /** * Logs an informational message if the current level permits. * @param tag - The source identifier (e.g. service or component name). * @param message - The log message. * @param args - Additional arguments forwarded to `console.info`. */ static info(tag: string, message: string, ...args: unknown[]): void; /** * Logs a debug message if the current level permits. * @param tag - The source identifier (e.g. service or component name). * @param message - The log message. * @param args - Additional arguments forwarded to `console.debug`. */ static debug(tag: string, message: string, ...args: unknown[]): void; } /** * Types and interfaces for CometChatUIKit service. */ /** * Interface for the CometChat UIKit window object. * Registered on window.CometChatUiKit for SDK identification. */ interface CometChatUiKitWindow { name: string; version: string; } declare global { interface Window { CometChatUiKit: CometChatUiKitWindow; } } declare global { interface Window { CometChatUiKit: { name: string; version: string; }; } } /** * `CometChatUIKit` provides a dual-API architecture for Angular applications. * * Enables SDK initialization and interaction both before Angular bootstraps * (via static methods in `main.ts`) and within Angular components (via DI). * * @example * // Static usage in main.ts * CometChatUIKit.init(settings).then(() => bootstrapApplication(AppComponent)); * * @example * // Injectable usage in components * constructor(private uiKit: CometChatUIKit) { * this.uiKit.loggedInUser$.subscribe(user => CometChatLogger.info(user)); * } */ declare class CometChatUIKit { private static _uiKitSettings; private static _loggedInUser; private static _conversationUpdateSettings; private static _themeMode; /** * Parsed `cometchat-settings.json` captured when the kit was initialized via * `initFromSettings()`. Non-null only on the AI agent / skills path — it is * what tells `initCalling()` to route the Calls SDK through its own * `initFromSettings()` so `integrationSource = "ai-agent"` propagates to the * Calls SDK the same way it already does for the Chat SDK. */ private static _cometChatSettings; static SoundManager: typeof CometChatSoundManager; static Localize: typeof CometChatLocalize; static callingReady: Promise; static get uiKitSettings(): UIKitSettings | null; static set uiKitSettings(value: UIKitSettings | null); static get conversationUpdateSettings(): CometChat.ConversationUpdateSettings; static set conversationUpdateSettings(value: CometChat.ConversationUpdateSettings); static get themeMode(): 'light' | 'dark'; static set themeMode(value: 'light' | 'dark'); static get loggedInUser$(): Observable; get loggedInUser$(): Observable; static getLoggedInUser(): CometChat.User | null; getLoggedInUser(): CometChat.User | null; static init(uiKitSettings: UIKitSettings | null): Promise | undefined; init(uiKitSettings: UIKitSettings | null): Promise | undefined; /** * File-based init for AI agent skills. * Accepts a parsed `cometchat-settings.json` object and delegates to the * Chat SDK's file-based init, which internally sets * `integrationSource = "ai-agent"` for telemetry. The same settings object is * retained so that, when calling is enabled, the Calls SDK is initialized via * `CometChatCalls.initFromSettings()` and reports the same source. * * This method is independent of `init()` — it does NOT call `init()`. * It builds UIKitSettings internally so login/createUser/updateUser keep working. * * Offline support works the same as on `init()`: pass `offlineConfig` (the * config `UIKitSettingsBuilder.setOfflineConfig()` takes) and it reaches the * SDK as `chatSDK.offline`, replacing any value in the settings file. Without * it, the file's `chatSDK.offline` reaches the SDK unchanged. * * @param settings - The parsed cometchat-settings.json object. * @param offlineConfig - Optional offline support settings for the Chat SDK. * @internal — excluded from public API docs */ static initFromSettings(settings: CometChatSettings, offlineConfig?: CometChatOfflineConfig): Promise; static isInitialized(): boolean; isInitialized(): boolean; static setLogLevel(level: LogLevel): void; setLogLevel(level: LogLevel): void; static isCallingEnabled(): boolean; isCallingEnabled(): boolean; private static initiateAfterLogin; private static initCalling; static login(uid: string): Promise; login(uid: string): Promise; static loginWithAuthToken(authToken: string): Promise; loginWithAuthToken(authToken: string): Promise; static getLoggedinUser(): Promise; getLoggedinUser(): Promise; static logout(): Promise; logout(): Promise; static checkAuthSettings(): boolean; static createUser(user: CometChat.User): Promise; createUser(user: CometChat.User): Promise; static updateUser(user: CometChat.User): Promise; updateUser(user: CometChat.User): Promise; static sendTextMessage(message: CometChat.TextMessage): Promise; sendTextMessage(message: CometChat.TextMessage): Promise; static sendMediaMessage(message: CometChat.MediaMessage): Promise; sendMediaMessage(message: CometChat.MediaMessage): Promise; static sendCustomMessage(message: CometChat.CustomMessage): Promise; sendCustomMessage(message: CometChat.CustomMessage): Promise; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare class CometChatUIKitConstants { static MessageCategory: Readonly<{ message: string; custom: string; action: string; call: string; interactive: string; agentic: _cometchat_chat_sdk_javascript.MessageCategory.AGENTIC; card: "card"; }>; static moderationStatus: Readonly<{ pending: _cometchat_chat_sdk_javascript.ModerationStatus.PENDING; approved: _cometchat_chat_sdk_javascript.ModerationStatus.APPROVED; disapproved: _cometchat_chat_sdk_javascript.ModerationStatus.DISAPPROVED; unmoderated: _cometchat_chat_sdk_javascript.ModerationStatus.UNMODERATED; }>; /** * UI Kit-owned message metadata keys for the multi-attachments feature. * `batchId` is the render-time grouping key shared across all messages produced by one * send; `audioType` disambiguates an attached audio file from a recorded voice note. */ static MetadataKeys: Readonly<{ batchId: "batchId"; audioType: "audioType"; }>; /** * Values for the `audioType` metadata key. A recorded voice note is explicitly tagged * `voice_note`; audio WITHOUT the tag (attached files, legacy audio) is a normal audio * message — absence never means voice note. * * `legacyVoiceNote` is the camelCase value this kit wrote before aligning with the * React/iOS/Android kits. It is READ for backward compatibility but never written, so * voice notes already in a conversation keep rendering as waveforms. */ static AudioType: Readonly<{ voiceNote: "voice_note"; legacyVoiceNote: "voiceNote"; }>; static MessageTypes: Readonly<{ text: string; file: string; image: string; audio: string; video: string; delete: "delete"; edited: "edited"; groupMember: "groupMember"; form: "form"; card: "card"; customInteractive: "customInteractive"; scheduler: "scheduler"; assistant: string; toolArguments: string; toolResults: string; }>; static ExtensionTypes: Readonly<{ poll: "extension_poll"; sticker: "extension_sticker"; whiteboard: "extension_whiteboard"; document: "extension_document"; }>; static ComposerAttachmentOption: Readonly<{ image: "image"; video: "video"; audio: "audio"; file: "file"; poll: "polls"; collaborativeDocument: "collaborative-document"; collaborativeWhiteboard: "collaborative-whiteboard"; }>; static groupMemberAction: Readonly<{ ROLE: "role"; BLOCK: "block"; REMOVE: "remove"; JOINED: string; LEFT: string; ADDED: string; BANNED: string; UNBANNED: string; KICKED: string; INVITED: string; SCOPE_CHANGE: string; }>; static MessageReceiverType: Readonly<{ user: string; group: string; }>; static userStatusType: Readonly<{ online: string; offline: string; }>; static MessageOption: Readonly<{ editMessage: "edit"; deleteMessage: "delete"; replyMessage: "reply"; replyInThread: "replyInThread"; threadSubscription: "threadSubscription"; organise: "organise"; pinMessage: "pinMessage"; unpinMessage: "unpinMessage"; saveMessage: "saveMessage"; unsaveMessage: "unsaveMessage"; translateMessage: "translate"; reactToMessage: "react"; messageInformation: "info"; flagMessage: "flagMessage"; copyMessage: "copy"; shareMessage: "share"; forwardMessage: "forward"; sendMessagePrivately: "sendMessagePrivately"; replyMessagePrivately: "replyMessagePrivately"; markAsUnread: "markAsUnread"; /** Offline support: retry a failed own message. */ retryMessage: "retryMessage"; /** Offline support: remove an own message that has not been sent. */ discardMessage: "discardMessage"; }>; static GroupOptions: Readonly<{ leave: "leave"; delete: "delete"; viewMembers: "viewMembers"; addMembers: "addMembers"; bannedMembers: "bannedMembers"; }>; static GroupMemberOptions: Readonly<{ kick: "kick"; ban: "ban"; unban: "unban"; changeScope: "changeScope"; }>; static groupMemberScope: Readonly<{ owner: "owner"; admin: string; participant: string; moderator: string; }>; static UserOptions: Readonly<{ block: "block"; unblock: "unblock"; viewProfile: "viewProfile"; }>; static ConversationOptions: Readonly<{ delete: "delete"; }>; static GroupTypes: Readonly<{ private: string; password: string; public: string; }>; static liveReaction: Readonly<{ timeout: 1500; }>; static messages: Readonly<{ MESSAGE_DELIVERED: "onMessagesDelivered"; MESSAGE_READ: "onMessagesRead"; MESSAGE_DELETED: "onMessageDeleted"; MESSAGE_EDITED: "onMessageEdited"; MESSAGE_SENT: "messageSent"; TEXT_MESSAGE_RECEIVED: "onTextMessageReceived"; MEDIA_MESSAGE_RECEIVED: "onMediaMessageReceived"; CUSTOM_MESSAGE_RECEIVED: "onCustomMessageReceived"; TRANSIENT_MESSAGE_RECEIVED: "onTransientMessageReceived"; INTERACTIVE_MESSAGE_RECEIVED: "onInteractiveMessageReceived"; DELIVERY: "delivery"; READ: "read"; APP_SYSTEM: "app_system"; MESSAGE_REACTION_ADDED: "onMessageReactionAdded"; MESSAGE_REACTION_REMOVED: "onMessageReactionRemoved"; }>; static details: Readonly<{ primary: "primary"; secondary: "secondary"; }>; static calls: Readonly<{ meeting: "meeting"; ongoing: string; ended: string; initiated: string; cancelled: string; rejected: string; unanswered: string; busy: string; activecall: "cometchat:activecall"; default: string; grid: string; single: string; spotlight: string; tile: string; }>; static goalType: Readonly<{ allOf: _cometchat_chat_sdk_javascript.GoalType.ALL_OF; anyOf: _cometchat_chat_sdk_javascript.GoalType.ANY_OF; anyAction: _cometchat_chat_sdk_javascript.GoalType.ANY_ACTION; none: _cometchat_chat_sdk_javascript.GoalType.NONE; }>; static requestBuilderLimits: Readonly<{ reactionListLimit: 10; reactionInfoLimit: 10; messageListLimit: 30; usersLimit: 30; groupsLimit: 30; }>; static radioNames: Readonly<{ conversations: "conversations"; users: "users"; groups: "groups"; changeScope: "changeScope"; groupMembers: "groupMembers"; }>; static mimeTypes: Readonly<{ audio: "audio/*, .aac, .aif, .aiff, .caf, .mp3, .mp4, .wav, .m4a, .wma, .flac, .alac, .oga, .ra, .ram, .mid, .midi, .mka, .opus, .ac3, .amr, .ape, .dts, .wv, .tta, .pcm, .snd, .au, .cda, .vox, .m4b, .m3u, .pls, .ogg"; video: "video/*, .mov, .mp4, .m4v, .avi, .mpg, .mpeg, .m2ts, .mts, .3gp, .3g2, .flv, .wmv, .vob, .ts, .webm, .f4v, .f4a, .f4b, .swf, .rm, .rmvb, .divx, .xvid, .mxf, .asf, .amv, .smv, .avchd, .qt"; image: "image/*, .heic, .heif, .jpg, .jpeg, .png, .gif, .bmp, .tiff, .tif, .psd, .svg, .ico, .raw, .dng, .eps, .webp, .jfif, .jp2, .jpf, .jpx, .jpm, .mj2, .hdr, .exr, .pbm, .pgm, .ppm, .pnm, .tga, .dds, .svgz, .djvu, .ai, .cdr"; }>; static shimmerList: readonly number[]; static streamMessageTypes: Readonly<{ run_started: string; text_message_start: string; text_message_content: string; text_message_end: string; run_finished: string; tool_call_start: string; tool_call_end: string; tool_call_args: string; tool_call_result: string; }>; } /** * Angular pipe for translating keys to localized strings. * * This pipe uses the CometChatLocalize service to translate keys * to the current language. It's marked as impure to update when * the language changes at runtime. * * @example * // In your template: * * // Outputs: "Chats" (in English) * * @example * // With parameters (using string interpolation): * {{ 'add_n_members' | translate:{ n: 5 } }} * // Outputs: "Add 5 Members" */ declare class TranslatePipe implements PipeTransform { /** * Transforms a translation key to its localized string value. * * @param key - The translation key to look up * @param params - Optional params object for string interpolation * @returns The translated string with parameters replaced */ transform(key: string, params?: Record): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵpipe: _angular_core.ɵɵPipeDeclaration; } /** * Angular pipe for formatting dates with localization and relative time support. * * This pipe extends Angular's built-in DatePipe functionality by adding: * - Relative time formatting ("5 minutes ago", "Yesterday") * - Localized day and month names * - Configurable calendar patterns * * @example * // Basic usage with Unix timestamp (seconds): * {{ message.sentAt | calendarDate }} * // Outputs: "5 minutes ago" or "Yesterday" or "Monday" or "15/01/2024" * * @example * // With custom calendar configuration: * {{ timestamp | calendarDate:customCalendar }} * * @example * // In component: * customCalendar: CalendarObject = { * today: 'h:mm A', * yesterday: '[Yesterday at] h:mm A', * lastWeek: 'dddd [at] h:mm A', * otherDays: 'MMMM D, YYYY' * }; */ declare class CalendarDatePipe implements PipeTransform { /** * Transforms a timestamp to a formatted date string. * * @param value - Unix timestamp in seconds, milliseconds, Date object, or date string * @param calendarObject - Optional custom calendar configuration * @returns Formatted date string */ transform(value: number | Date | string | null | undefined, calendarObject?: CalendarObject): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵpipe: _angular_core.ɵɵPipeDeclaration; } /** * Simplified calendar date pipe for conversation list timestamps. * * Uses a compact format suitable for conversation list items. */ declare class ConversationDatePipe implements PipeTransform { private calendarDatePipe; /** The compact conversation-list format, in the active locale. */ private get conversationCalendar(); transform(value: number | Date | string | null | undefined): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵpipe: _angular_core.ɵɵPipeDeclaration; } /** * Calendar date pipe for message timestamps. * * Uses a format suitable for message bubbles with time display. */ declare class MessageDatePipe implements PipeTransform { private calendarDatePipe; /** The message-bubble format, in the active locale. */ private get messageCalendar(); transform(value: number | Date | string | null | undefined): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵpipe: _angular_core.ɵɵPipeDeclaration; } /** * CometChatActions is a pre-defined structure for creating actions * that the user can perform on a message, with properties to customize * the appearance and behavior of the action. * It is used in CometChatActionsIcon and CometChatActionsView components. */ declare class CometChatActions { /** * Unique identifier for the message action. * @type {string} */ id: string; /** * Heading text for the message action. * @type {string} */ title: string; /** * Asset URL for the icon to symbolize a message action. * @type {string | undefined} */ iconURL?: string; /** * Creates an instance of CometChatActions. * * @param {Object} options - Options to initialize the action. * @param {string} options.id - Unique identifier for the message action. * @param {string} options.title - Heading text for the message action. * @param {string} [options.iconURL] - Asset URL for the icon to symbolize a message action. */ constructor(options: { id: string; title: string; iconURL?: string; }); } /** * CometChatActionsIcon is a pre-defined structure for creating actions * that the user can perform on a message with an icon representation. * It is used in CometChatContextMenu, CometChatMessageBubble, CometChatMessageList components. */ declare class CometChatActionsIcon extends CometChatActions { /** * Function invoked when the user clicks on the message action. * @type {(id: number) => void} */ onClick: (id: number) => void; /** * Nested actions, rendered as a flyout when the user opens this item. * * An item with children is a GROUP: it opens its own list rather than * performing an action, so its `onClick` is never called. Used to gather * related actions — "Organise ▸" holding Pin and Save — without lengthening * the top-level menu. * * One level only. A child carrying its own children is not rendered as a * further flyout, because a menu that nests arbitrarily is unusable with a * keyboard and impossible to place on a small screen. * * @type {CometChatActionsIcon[] | undefined} */ children?: CometChatActionsIcon[]; /** * Creates an instance of CometChatActionsIcon. */ constructor(options: { /** * Unique identifier for the message action. * @type {string} */ id: string; /** * Heading text for the message action. * @type {string} */ title: string; /** * Asset URL for the icon to symbolize a message action. * @type {string} */ iconURL: string; /** * Function invoked when the user clicks on the message action. * This function should handle the action related to the provided message id. * @type {(id: number) => void} */ onClick: (id: number) => void; /** * Nested actions. Supplying these makes the item a group that opens a * flyout instead of performing an action. * @type {CometChatActionsIcon[]} */ children?: CometChatActionsIcon[]; }); } /** * CometChatActionsView is a pre-defined structure for creating actions * that the user can perform on a message with a customized UI view representation. * It is used in AI module, CometChatMessageBubble, CometChatMessageComposer, CometChatMessageList components. */ declare class CometChatActionsView extends CometChatActions { /** * User-defined template to customize the action view for each option in the template. * In Angular, we use TemplateRef instead of JSX.Element. * @type {TemplateRef | ((callbacks: Record) => TemplateRef) | undefined} */ customView?: TemplateRef | ((callbacks: Record) => TemplateRef); /** * Creates an instance of CometChatActionsView. */ constructor(options: { /** * Unique identifier for the message action. * @type {string} */ id: string; /** * Heading text for the message action. * @type {string} */ title: string; /** * Asset URL for the icon to symbolize a message action. This is optional and can be omitted. * @type {string} */ iconURL?: string; /** * User-defined template to customize the action view. This is optional and can be omitted. * @type {TemplateRef | ((callbacks: Record) => TemplateRef)} */ customView?: TemplateRef | ((callbacks: Record) => TemplateRef); }); } /** * CometChatMessageComposerAction is a pre-defined structure for creating an attachment option * in the CometChatMessageComposer component that the user can perform in addition to composing a message. * It is used in AI module, CometChatMessageComposer component and Poll extension. */ declare class CometChatMessageComposerAction { /** * Unique identifier for the attachment option. * @type {string} */ id: string; /** * Asset URL for the icon to symbolize an attachment option. * @type {string} */ iconURL: string; /** * Function invoked when the user clicks on the attachment option. * @type {(() => void) | null} */ onClick: (() => void) | null; /** * Heading text for the attachment option. * @type {string} */ title?: string; /** * Creates an instance of CometChatMessageComposerAction. * * @param {Partial} props - Partial properties to initialize the action item. */ constructor(props: Partial); } /** * Defines an option for message actions like edit or delete. * Allows customization of text, icon, and click behavior. * It is used in CometChatConversations, CometChatGroupMembers, CometChatGroups, CometChatUsers components. */ declare class CometChatOption { /** Unique identifier for the option. */ id?: string; /** Text label for the option. */ title?: string; /** URL of the icon representing the option. */ iconURL?: string; /** Function to be called when the option is clicked. */ onClick?: () => void; /** * Creates a new CometChatOption instance. * @param {Partial} props - Properties to initialize the option. */ constructor(props: Partial); } /** * Represents a single emoji with its character representation. * It is used in CometChatEmojiKeyboard component. */ interface CometChatEmoji { /** The emoji character. */ char: string; /** Keywords for search filtering. */ keywords?: string[]; } /** * Represents a category of emojis with its metadata and emoji collection. * It is used in CometChatEmojiKeyboard component. */ interface CometChatEmojiCategory { /** Unique identifier for the emoji category. */ id: string; /** Localization key for the category name. */ name: string; /** Icon URL for the category tab. */ symbolURL: string; /** * Object map of emojis keyed by emoji name. * Note: Uses 'emojies' to match React UIKit naming convention. */ emojies: Record; } /** * Media Attachment Data Structure * * Represents a media attachment (image or video) extracted from a CometChat.MediaMessage. * This interface normalizes the attachment data for consistent handling across components. * * @remarks * Used by CometChatImageBubbleComponent and CometChatVideoBubbleComponent to process * and display media attachments from messages. * * @see Requirements 1.7, 1.8, 1.9, 1.10 */ interface MediaAttachment { /** The URL of the media file — always the full-quality original */ url: string; /** * The display URL for the thumbnail preview in the bubble. * When the CometChat Thumbnail Generation extension is enabled, this is the * compressed low-quality URL (url_medium for images, url_small for videos). * Falls back to `url` when no extension thumbnail is available. * The fullscreen viewer always uses `url` (full quality), never `displayUrl`. */ displayUrl?: string; /** The type of media (image or video) - required for fullscreen viewer gallery mode */ type?: 'image' | 'video'; /** The filename for download purposes (optional) */ name?: string; /** The thumbnail URL (primarily for videos, optional for images) */ thumbnail?: string; /** The width of the media in pixels (optional) */ width?: number; /** The height of the media in pixels (optional) */ height?: number; /** The duration in seconds (for videos only) */ duration?: number; /** The file size in bytes (optional) */ size?: number; /** The MIME type of the media (optional) */ mimeType?: string; /** * The file an unsent (queued) own message still holds; it has no `url` yet. Set only on the * offline path, and replaced by an object URL in `url`/`displayUrl` when the bubble resolves it. * @internal */ file?: Blob; /** The original attachment object from CometChat SDK */ raw?: CometChat.Attachment; } /** * Layout Type * * Defines the layout configuration for displaying multiple media attachments. * * @remarks * - 'single': Display one attachment at full size * - 'grid': Display 2-3 attachments in a grid layout * - 'grid-2x2': Display 4 attachments in a 2×2 grid * - 'overflow': Display first 3 attachments + overflow indicator for >4 attachments * * @see Requirements 2.1, 3.1, 3.2, 4.1 */ type MediaLayoutType = 'single' | 'grid' | 'grid-2x2' | 'overflow'; /** * Event Emitter * * A simple event emitter that can be used to listen to and emit events. * Adapted from WaveSurfer library for Angular compatibility. * * @see Requirements 14.1, 14.2 */ type GeneralEventTypes = { [EventName: string]: unknown[]; }; type EventListener = (...args: EventTypes[EventName]) => void; /** A simple event emitter that can be used to listen to and emit events. */ declare class EventEmitter { private listeners; /** Subscribe to an event. Returns an unsubscribe function. */ on(event: EventName, listener: EventListener, options?: { once?: boolean; }): () => void; /** Unsubscribe from an event */ un(event: EventName, listener: EventListener): void; /** Subscribe to an event only once */ once(event: EventName, listener: EventListener): () => void; /** Clear all events */ unAll(): void; /** Emit an event */ protected emit(eventName: EventName, ...args: EventTypes[EventName]): void; } /** * Base Plugin * * Base class for WaveSurfer plugins. * Adapted from WaveSurfer library for Angular compatibility. * * @see Requirements 14.1, 14.2 */ type BasePluginEvents = { destroy: []; }; type GenericPlugin = BasePlugin; /** Base class for wavesurfer plugins */ declare class BasePlugin extends EventEmitter { protected wavesurfer?: WaveSurfer; protected subscriptions: (() => void)[]; protected options: Options; /** Create a plugin instance */ constructor(options: Options); /** Called after this.wavesurfer is available */ protected onInit(): void; /** Do not call directly, only called by WavesSurfer internally */ _init(wavesurfer: WaveSurfer): void; /** Destroy the plugin and unsubscribe from all events */ destroy(): void; } /** * DOM Utilities * * Helper functions for creating DOM elements. * Adapted from WaveSurfer library for Angular compatibility. * * @see Requirements 14.1, 14.2 */ type TreeNode = { [key: string]: string | number | boolean | CSSStyleDeclaration | TreeNode | Node; } & { xmlns?: string; style?: Partial; textContent?: string | Node; children?: TreeNode; }; declare function createElement(tagName: string, content: TreeNode & { xmlns: string; }, container?: Node): SVGElement; declare function createElement(tagName: string, content?: TreeNode, container?: Node): HTMLElement; declare const dom_createElement: typeof createElement; declare namespace dom { export { dom_createElement as createElement, createElement as default, }; } /** * Player * * HTMLMediaElement wrapper for audio playback. * Adapted from WaveSurfer library for Angular compatibility. * * @see Requirements 14.1, 14.2 */ type PlayerOptions = { media?: HTMLMediaElement; mediaControls?: boolean; autoplay?: boolean; playbackRate?: number; }; declare class Player extends EventEmitter { protected media: HTMLMediaElement; private isExternalMedia; constructor(options: PlayerOptions); protected onMediaEvent(event: K, callback: (ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void; protected getSrc(): string; private revokeSrc; private canPlayType; protected setSrc(url: string, blob?: Blob): void; protected destroy(): void; protected setMediaElement(element: HTMLMediaElement): void; /** Start playing the audio */ play(): Promise; /** Pause the audio */ pause(): void; /** Check if the audio is playing */ isPlaying(): boolean; /** Jump to a specific time in the audio (in seconds) */ setTime(time: number): void; /** Get the duration of the audio in seconds */ getDuration(): number; /** Get the current audio position in seconds */ getCurrentTime(): number; /** Get the audio volume */ getVolume(): number; /** Set the audio volume */ setVolume(volume: number): void; /** Get the audio muted state */ getMuted(): boolean; /** Mute or unmute the audio */ setMuted(muted: boolean): void; /** Get the playback speed */ getPlaybackRate(): number; /** Check if the audio is seeking */ isSeeking(): boolean; /** Set the playback speed, pass an optional false to NOT preserve the pitch */ setPlaybackRate(rate: number, preservePitch?: boolean): void; /** Get the HTML media element */ getMediaElement(): HTMLMediaElement; /** Set a sink id to change the audio output device */ setSinkId(sinkId: string): Promise; } /** * Types for WaveSurfer — options, events, and color helpers. */ type WaveSurferColor = string | string[] | CanvasGradient; type WaveSurferOptions = { /** Required: an HTML element or selector where the waveform will be rendered */ container: HTMLElement | string; /** The height of the waveform in pixels, or "auto" to fill the container height */ height?: number | 'auto'; /** The width of the waveform in pixels or any CSS value; defaults to 100% */ width?: number | string; /** The color of the waveform */ waveColor?: WaveSurferColor; /** The color of the progress mask */ progressColor?: WaveSurferColor; /** The color of the playback cursor */ cursorColor?: string; /** The cursor width */ cursorWidth?: number; /** If set, the waveform will be rendered with bars */ barWidth?: number; /** Spacing between bars in pixels */ barGap?: number; /** Rounded borders for bars */ barRadius?: number; /** A vertical scaling factor for the waveform */ barHeight?: number; /** Vertical bar alignment */ barAlign?: 'top' | 'bottom'; /** Minimum pixels per second of audio (i.e. the zoom level) */ minPxPerSec?: number; /** Stretch the waveform to fill the container, true by default */ fillParent?: boolean; /** Audio URL */ url?: string; /** Pre-computed audio data, arrays of floats for each channel */ peaks?: Array; /** Pre-computed audio duration in seconds */ duration?: number; /** Use an existing media element instead of creating one */ media?: HTMLMediaElement; /** Whether to show default audio element controls */ mediaControls?: boolean; /** Play the audio on load */ autoplay?: boolean; /** Pass false to disable clicks on the waveform */ interact?: boolean; /** Allow to drag the cursor to seek to a new position */ dragToSeek?: boolean | { debounceTime: number; }; /** Hide the scrollbar */ hideScrollbar?: boolean; /** Audio rate, i.e. the playback speed */ audioRate?: number; /** Automatically scroll the container to keep the current position in viewport */ autoScroll?: boolean; /** If autoScroll is enabled, keep the cursor in the center of the waveform during playback */ autoCenter?: boolean; /** Decoding sample rate. Doesn't affect the playback. Defaults to 8000 */ sampleRate?: number; /** Render each audio channel as a separate waveform */ splitChannels?: Array & { overlay?: boolean; }>; /** Stretch the waveform to the full height */ normalize?: boolean; /** The list of plugins to initialize on start */ plugins?: GenericPlugin[]; /** Custom render function */ renderFunction?: (peaks: Array, ctx: CanvasRenderingContext2D) => void; /** Options to pass to the fetch method */ fetchParams?: RequestInit; /** Playback "backend" to use, defaults to MediaElement */ backend?: 'WebAudio' | 'MediaElement'; /** Nonce for CSP if necessary */ cspNonce?: string; /** iframe document for iframe context support */ iframeDocument?: Document; /** iframe window for iframe context support */ iframeWindow?: Window; }; type WaveSurferEvents = { /** After wavesurfer is created */ init: []; /** When audio starts loading */ load: [url: string]; /** During audio loading */ loading: [percent: number]; /** When the audio has been decoded */ decode: [duration: number]; /** When the audio is both decoded and can play */ ready: [duration: number]; /** When visible waveform is drawn */ redraw: []; /** When all audio channel chunks of the waveform have drawn */ redrawcomplete: []; /** When the audio starts playing */ play: []; /** When the audio pauses */ pause: []; /** When the audio finishes playing */ finish: []; /** On audio position change, fires continuously during playback */ timeupdate: [currentTime: number]; /** An alias of timeupdate but only when the audio is playing */ audioprocess: [currentTime: number]; /** When the user seeks to a new position */ seeking: [currentTime: number]; /** When the user interacts with the waveform (i.g. clicks or drags on it) */ interaction: [newTime: number]; /** When the user clicks on the waveform */ click: [relativeX: number, relativeY: number]; /** When the user double-clicks on the waveform */ dblclick: [relativeX: number, relativeY: number]; /** When the user drags the cursor */ drag: [relativeX: number]; /** When the user starts dragging the cursor */ dragstart: [relativeX: number]; /** When the user ends dragging the cursor */ dragend: [relativeX: number]; /** When the waveform is scrolled (panned) */ scroll: [visibleStartTime: number, visibleEndTime: number, scrollLeft: number, scrollRight: number]; /** When the zoom level changes */ zoom: [minPxPerSec: number]; /** Just before the waveform is destroyed so you can clean up your events */ destroy: []; /** When source file is unable to be fetched, decoded, or an error is thrown by media element */ error: [error: Error]; }; /** * WaveSurfer * * Main WaveSurfer class for audio waveform visualization. * Adapted from WaveSurfer library for Angular compatibility. * * @see Requirements 14.1, 14.2, 14.3 */ declare const defaultOptions: { waveColor: string; progressColor: string; cursorWidth: number; minPxPerSec: number; fillParent: boolean; interact: boolean; dragToSeek: boolean; autoScroll: boolean; autoCenter: boolean; sampleRate: number; }; declare class WaveSurfer extends Player { options: WaveSurferOptions & typeof defaultOptions; private renderer; private timer; private plugins; private decodedData; protected subscriptions: Array<() => void>; protected mediaSubscriptions: Array<() => void>; protected abortController: AbortController | null; static readonly BasePlugin: typeof BasePlugin; static readonly dom: typeof dom; /** Create a new WaveSurfer instance */ static create(options: WaveSurferOptions): WaveSurfer; constructor(options: WaveSurferOptions); private updateProgress; private initTimerEvents; private initPlayerEvents; private initRendererEvents; private initPlugins; private unsubscribePlayerEvents; /** Set new wavesurfer options and re-render it */ setOptions(options: Partial): void; /** Register a wavesurfer plugin */ registerPlugin(plugin: T): T; getWrapper(): HTMLElement; getWidth(): number; getScroll(): number; setScroll(pixels: number): void; setScrollTime(time: number): void; getActivePlugins(): GenericPlugin[]; private loadAudio; load(url: string, channelData?: WaveSurferOptions['peaks'], duration?: number): Promise; loadBlob(blob: Blob, channelData?: WaveSurferOptions['peaks'], duration?: number): Promise; zoom(minPxPerSec: number): void; getDecodedData(): AudioBuffer | null; exportPeaks({ channels, maxLength, precision }?: { channels?: number | undefined; maxLength?: number | undefined; precision?: number | undefined; }): Array; getDuration(): number; toggleInteraction(isInteractive: boolean): void; setTime(time: number): void; seekTo(progress: number): void; playPause(): Promise; stop(): void; skip(seconds: number): void; empty(): void; setMediaElement(element: HTMLMediaElement): void; exportImage(format: string, quality: number, type: 'dataURL'): Promise; exportImage(format: string, quality: number, type: 'blob'): Promise; destroy(): void; } /** * Audio Attachment Data Structure * * Represents an audio attachment extracted from a CometChat.MediaMessage. * This interface normalizes the audio attachment data for consistent handling * across audio-related components. * * @remarks * Used by CometChatAudioBubbleComponent to process and display audio attachments * from messages. Includes audio-specific metadata like duration. * * @see Requirements 1.4 */ interface AudioAttachment { /** URL of the audio file */ url: string; /** Display name of the audio file */ name: string; /** File size in bytes */ size: number; /** MIME type (e.g., 'audio/mpeg', 'audio/wav') */ mimeType: string; /** File extension (e.g., 'mp3', 'wav') */ extension: string; /** Duration in seconds (if available from metadata) */ duration?: number; /** The original attachment object from CometChat SDK (optional) */ raw?: CometChat.Attachment; } /** * Audio State Data Structure * * Tracks the state of an individual audio player instance. * Used internally by CometChatAudioBubbleComponent to manage * playback, loading, and download states for each audio attachment. * * @see Requirements 5.1, 5.2, 7.1, 13.1 */ interface AudioState { /** WaveSurfer instance for this audio */ waveSurfer: WaveSurfer | null; /** Whether audio is currently playing */ isPlaying: boolean; /** Whether audio is loading/decoding */ isLoading: boolean; /** Whether audio failed to load */ hasError: boolean; /** Current playback time in seconds */ currentTime: number; /** Total duration in seconds */ duration: number; /** Whether download is in progress */ isDownloading: boolean; /** Download progress (0-100) */ downloadProgress: number; /** AbortController for canceling downloads */ abortController: AbortController | null; } /** * It is used for specifying the position of the auxiliary buttons. * It is used in CometChatMessageComposer component. */ declare enum AuxiliaryButtonAlignment { left = 0, right = 1 } /** * It is used for specifying the function of enter button * It is used in CometChatMessageComposer component. */ declare enum EnterKeyBehavior { SendMessage = "sendMessage", NewLine = "newLine", None = "none" } /** * It is used for describing the position of the element on the UI. * It is used in CometChatContextualMenu, CometChatMessageBubble, CometChatUsers and CometChatGroupMembers components. */ declare enum Placement { top = "top", right = "right", bottom = "bottom", left = "left" } /** * It is used for specifying the alignment of the message list. * It is used in CometChatMessageList component. */ declare enum MessageListAlignment { left = 0, standard = 1 } /** * This is used for specifying the position of the message bubble. * It is used in various components where the message bubbles are used. */ declare enum MessageBubbleAlignment { left = 0, right = 1, center = 2 } /** * This is used for specifying the position of the document icon. * It is used in Decorators like CallingExtension, CollaborativeDocument, CollaborativeWhiteboard. */ declare enum DocumentIconAlignment { left = 0, right = 1 } /** * This is used to specify the alignment of the tabs. * It is used in CometChatTabs and CometChatContacts components. */ declare enum TabAlignment { top = 0, bottom = 1, left = 2, right = 3 } /** * This is used to specify the status of the message delivery. * It is used in components related to messages. */ declare enum MessageStatus { inprogress = 0, success = 1, error = 2, cancelled = 3 } /** * This is used to specify the types of the read receipts for the message. * It is used in Bubbles, CometChatMessageInformation components. */ declare enum Receipts { wait = 0, sent = 1, delivered = 2, read = 3, error = 4 } /** * This is used for specifying the position of the title. */ declare enum TitleAlignment { left = 0, center = 1 } /** * It is used to specify the mode of selection for the list of items. * It is used in components where there is a list of items involed, like users/groups etc. */ declare enum SelectionMode { single = 0, multiple = 1, none = 2 } /** * This is used to specify the states of the operation on the UI. * It has options like: * loading: to be used while waiting for a particular operation, * empty: when there is nothing to be displayed, * error: when an error occurs in the operation, and * loaded: when the operation is completed. */ declare enum States { loading = 0, empty = 1, error = 2, loaded = 3 } /** * This is used to specify the position for the time-stamp. * It is used in CometChatMessageList component. */ declare enum TimestampAlignment { top = 0, bottom = 1 } /** * This is used to specify the alignment for the icon button. * It is used in CometChatTabs, CometChatOutgoingCall components. */ declare enum IconButtonAlignment { top = "column", bottom = "column-reverse", left = "row", right = "row-reverse" } /** * It is used to specify the type for the recording. * It is used in CometChatMessageComposer component. */ declare enum RecordingType { audio = 0, video = 1 } /** * It is used to specify which tabs should be visible amongst user and group. * It is used in CometChatContacts component. */ declare enum TabsVisibility { usersAndGroups = 0, users = 1, groups = 2 } /** * This is used to specify the type of the call. * It is used in CometChatCallLogs, CometChatOngoingCall components. */ declare enum CallWorkflow { defaultCalling = 0, directCalling = 1 } /** * This is used to provide the alignment for the panel. * It is used in CometChatMessageList component and AI module components. */ declare enum PanelAlignment { composerHeader = 0, messageListHeader = 1, messageListFooter = 2, messages = 3 } /** * It is used to provide the alignment for the labels. */ declare enum LabelAlignment { top = "column", bottom = "column-reverse", left = "row", right = "row-reverse" } /** * It is used to specify the type of the UI element. * It is used in modal components. */ declare enum ElementType { label = "label", text = "textInput", dropdown = "dropdown", checkbox = "checkbox", radio = "radio", button = "button", singleSelect = "singleSelect", dateTime = "dateTime" } /** * It is used to specify what action a button should perform. * It is used in InteractiveMessageUtils function and in modal components. */ declare enum ButtonAction { apiAction = "apiAction", urlNavigation = "urlNavigation", custom = "custom" } /** * It is used to specify the type of the http request call. * It is used in InteractiveMessageUtils function and APIAction inside modals. */ declare enum HTTPSRequestMethods { POST = "POST", PUT = "PUT", PATCH = "PATCH", DELETE = "DELETE" } /** * It is used to select the mode for date time picker component. * It is used in DateTimePickerElement component. */ declare enum DateTimePickerMode { date = "date", dateTime = "dateTime", time = "time" } /** * It is used for specifying the type of user/members list. * It is used in CometChatMessageComposer and CometChatUserMemberWrapper components. */ declare enum UserMemberListType { users = 0, groupmembers = 1 } /** * This is used to specify the source for mouse event with mentions information. * It is used in CometChatMentionsFormatter util. */ declare enum MouseEventSource { mentions = 0 } /** * It is used to describe the mode for previewing message. * It is used in CometChatMessageComposer component. */ declare enum PreviewMessageMode { edit = 0, none = 1 } /** * It is generally used for formatting the text by providing the required data. * It is used in CometChatConversations, CometChatTextFormatter and CometChatMentionsFormatter. */ declare enum MentionsTargetElement { textinput = 0, textbubble = 1, conversation = 2 } /** * It is used for providing the value for the mentions visibility. * It is used in CometChatMentionsFormatter component. */ declare enum MentionsVisibility { usersConversationOnly = 0, groupConversationOnly = 1, both = 2 } /** * Specifies the scope of the search functionality. * * @remarks * - `Conversations`: Limits the search to conversations only. * - `Messages`: Limits the search to messages only. * */ declare enum CometChatSearchScope { Conversations = "conversations", Messages = "messages" } /** * Specifies the filters available for the search functionality. * * @remarks * - `Messages`: Filters to search within messages. * - `Conversations`: Filters to search within conversations. * - `Unread`: Filters to search for unread messages. * - `Groups`: Filters to search within groups. * - `Photos`: Filters to search for photo messages. * - `Videos`: Filters to search for video messages. * - `Links`: Filters to search for links shared in messages. * - `Documents`: Filters to search for document files. * - `Audio`: Filters to search for audio messages. */ declare enum CometChatSearchFilter { Messages = "messages", Conversations = "conversations", Unread = "unread", Groups = "groups", Photos = "photos", Videos = "videos", Links = "links", Documents = "files", Audio = "audio" } interface ComposerId { parentMessageId: number | null; user: string | null; group: string | null; } /** * Mention type enumeration for styling purposes. * Used to determine which CSS class to apply to a mention in text bubbles. * * @remarks * - `self`: Mention of the current logged-in user * - `other`: Mention of another user * - `channel`: Channel mention (@all) * * It is used in CometChatTextBubble and CometChatMentionsFormatter components. * @see Requirements 5.1, 5.2, 5.3, 5.4 */ declare enum MentionType { /** Mention of the current logged-in user */ self = "self", /** Mention of another user */ other = "other", /** Channel mention (@all) */ channel = "channel" } /** * Selection state interface for tracking item selections in list components. * Emitted via selectionChange event from CometChatConversations, CometChatUsers, * CometChatGroups, and CometChatGroupMembers components. * * @remarks * This interface provides a standardized way to track selection state across * all list components in the UIKit. It includes the current selection mode, * the set of selected item IDs, and the ID of the last selected item. * * @example * ```typescript * // Handling selection change event * handleSelectionChange(state: SelectionState) { * console.log('Mode:', state.mode); * console.log('Selected IDs:', Array.from(state.selectedIds)); * console.log('Last selected:', state.lastSelectedId); * } * ``` * * @see Requirements 9.1, 9.2 */ interface SelectionState { /** Current selection mode (none, single, or multiple) */ mode: SelectionMode; /** Set of selected item IDs */ selectedIds: Set; /** ID of the last selected item, or null if no item was selected */ lastSelectedId: string | null; } /** * Model class that maps tool function names to handler functions for the AI Assistant. * This is a plain model class — NOT an Angular service. */ declare class CometChatAIAssistantTools { [key: string]: unknown; private readonly actions; constructor(actions: Record unknown>); /** * Returns the handler function for the given tool name, or undefined if not registered. */ getAction(name: string): ((...args: unknown[]) => unknown) | undefined; /** * Returns a shallow copy of the internal actions map. * Mutations to the returned object do not affect this instance. */ getActions(): Record unknown>; } /** * Conversation Slots Interface * * Defines fine-grained customization points for individual UI elements * within a conversation item. This enables slot-based customization where * developers can override specific elements without affecting others. * * @module interfaces/conversation-slots * @see Requirements 5.1 - Slot-Based Granular Customization */ /** * Context object passed to all slot templates. * * Contains the conversation object and relevant state information * that templates can use for rendering decisions. * * @example * ```html * *
* *
*
* ``` */ interface ConversationSlotContext { /** * The conversation object (implicit context variable). * Available as `let-conversation` in templates. */ $implicit: CometChat.Conversation; /** * The conversation object (explicit named variable). * Available as `let-conv="conversation"` in templates. */ conversation: CometChat.Conversation; /** * Whether this conversation is currently active/selected for viewing. */ isActive: boolean; /** * Whether this conversation is selected in selection mode. */ isSelected: boolean; /** * The number of unread messages in this conversation. */ unreadCount: number; /** * Whether someone is currently typing in this conversation. */ isTyping: boolean; } /** * Interface defining all available slots for conversation item customization. * * Each slot corresponds to a specific UI element within the conversation item. * Providing a template for a slot will override only that element while * keeping default rendering for all other elements. * * The slots are organized into three sections: * - **Leading section**: avatar, statusIndicator, groupTypeIcon, typingIndicator * - **Body section**: title, subtitle, subtitleReceipt * - **Trailing section**: timestamp, unreadBadge, receipt, contextMenuTrigger * * @example * ```typescript * // Define custom slots * const customSlots: Partial = { * avatar: myCustomAvatarTemplate, * unreadBadge: myCustomBadgeTemplate, * }; * * // Use in component * * ``` * * @see Requirements 5.1 - THE ConversationSlots interface SHALL define slots for: * avatar, statusIndicator, groupTypeIcon, typingIndicator, title, subtitle, * subtitleReceipt, timestamp, unreadBadge, receipt, contextMenuTrigger */ interface ConversationSlots { /** * Custom template for the avatar element. * * Receives the base ConversationSlotContext. * * @example * ```html * * * * ``` */ avatar?: TemplateRef; /** * Custom template for the user status indicator (online/offline). * * Receives ConversationSlotContext extended with the current status string. * * @example * ```html * * * * ``` */ statusIndicator?: TemplateRef; /** * Custom template for the group type icon (public/private/password). * * Receives ConversationSlotContext extended with the group type string. * * @example * ```html * * * * ``` */ groupTypeIcon?: TemplateRef; /** * Custom template for the typing indicator animation. * * Receives the base ConversationSlotContext. * * @example * ```html * *
* * * *
*
* ``` */ typingIndicator?: TemplateRef; /** * Custom template for the conversation title (user/group name). * * Receives ConversationSlotContext extended with the title string. * * @example * ```html * *

{{ title }}

*
* ``` */ title?: TemplateRef; /** * Custom template for the conversation subtitle (last message preview). * * Receives ConversationSlotContext extended with the subtitle string. * * @example * ```html * *

{{ subtitle }}

*

typing...

*
* ``` */ subtitle?: TemplateRef; /** * Custom template for the receipt indicator in the subtitle area. * * Receives ConversationSlotContext extended with the receipt status string. * Receipt status can be: 'sent', 'delivered', 'read', 'wait', 'error'. * * @example * ```html * * * * ``` */ subtitleReceipt?: TemplateRef; /** * Custom template for the timestamp display. * * Receives ConversationSlotContext extended with the timestamp number. * * @example * ```html * * {{ timestamp | date:'shortTime' }} * * ``` */ timestamp?: TemplateRef; /** * Custom template for the unread message count badge. * * Receives ConversationSlotContext extended with the count number. * * @example * ```html * * * {{ count > 99 ? '99+' : count }} * * * ``` */ unreadBadge?: TemplateRef; /** * Custom template for the message receipt indicator in the trailing section. * * Receives ConversationSlotContext extended with the receipt status string. * Receipt status can be: 'sent', 'delivered', 'read', 'wait', 'error'. * * @example * ```html * *
* *
*
* ``` */ receipt?: TemplateRef; /** * Custom template for the context menu trigger button. * * Receives the base ConversationSlotContext. * * @example * ```html * * * * ``` */ contextMenuTrigger?: TemplateRef; } /** * Message List Interfaces * * Defines interfaces and types for the MessageListService configuration, * callbacks, and data structures. * * Note: ErrorCallback type is imported from message-composer.service.ts * to avoid duplication. Use the shared ErrorCallback type from services. * * @module interfaces/message-list * @see Requirements 1.1, 1.4 - Service Architecture and Initialization */ /** * Configuration options for the MessageListService. * * This interface defines all configurable options that can be passed * to the MessageListService to customize its behavior for different * conversation types and use cases. * * @example * ```typescript * // Configuration for a 1-on-1 conversation * const userConfig: MessageListConfig = { * user: currentUser, * hideGroupActionMessages: false, * }; * * // Configuration for a group conversation * const groupConfig: MessageListConfig = { * group: currentGroup, * hideGroupActionMessages: true, * }; * * // Configuration for thread mode * const threadConfig: MessageListConfig = { * group: currentGroup, * parentMessageId: 12345, * }; * * // Configuration for jumping to a specific message * const jumpConfig: MessageListConfig = { * user: currentUser, * messageId: 67890, * }; * ``` */ interface MessageListConfig { /** * User for 1-on-1 conversations. * * When set, the service will fetch and display messages * for the conversation with this user. * Mutually exclusive with `group`. */ user?: CometChat.User; /** * Group for group conversations. * * When set, the service will fetch and display messages * for this group conversation. * Mutually exclusive with `user`. */ group?: CometChat.Group; /** * Parent message ID for thread mode. * * When set, the service will only fetch and display * messages that are replies to this parent message. */ parentMessageId?: number; /** * Custom messages request builder. * * Allows overriding the default MessagesRequestBuilder * with a custom configuration for advanced use cases. */ messagesRequestBuilder?: CometChat.MessagesRequestBuilder; /** * Hide group action messages. * * When true, group action messages (member joined, left, etc.) * will not be displayed in the message list. * @default false */ hideGroupActionMessages?: boolean; /** * Message ID to fetch around (for jumping to specific message). * * When set, the service will fetch messages around this * specific message ID, enabling "jump to message" functionality. */ messageId?: number; } /** * Result of a fetch operation. * * Returned by fetchPreviousMessages() and fetchNextMessages() methods * to provide the fetched messages and pagination information. * * @example * ```typescript * const result: FetchResult = await messageListService.fetchPreviousMessages(); * * if (result.hasMore) { * // More messages available, can fetch again on scroll * console.log(`Fetched ${result.messages.length} messages`); * } else { * // Reached the beginning of the conversation * console.log('No more messages to load'); * } * ``` */ interface FetchResult { /** * Messages fetched in this operation. * * Array of BaseMessage objects returned from the SDK. * For fetchPreviousMessages, these are older messages. * For fetchNextMessages, these are newer messages. */ messages: CometChat.BaseMessage[]; /** * Whether more messages are available. * * True if there are more messages to fetch in the same direction. * False if the beginning (for previous) or end (for next) has been reached. */ hasMore: boolean; } /** * Message update payload for real-time updates. * * Used internally by the service to communicate message updates * to subscribers and for event handling. * * @example * ```typescript * // Handling a new message * const addPayload: MessageUpdatePayload = { * message: newTextMessage, * updateType: 'added', * }; * * // Handling an edited message * const editPayload: MessageUpdatePayload = { * message: editedMessage, * updateType: 'edited', * }; * * // Handling a deleted message * const deletePayload: MessageUpdatePayload = { * message: deletedMessage, * updateType: 'deleted', * }; * * // Handling a reaction update * const reactionPayload: MessageUpdatePayload = { * message: messageWithNewReaction, * updateType: 'reaction', * }; * ``` */ interface MessageUpdatePayload { /** * The message that was updated. * * Contains the full message object with the latest state. */ message: CometChat.BaseMessage; /** * Type of update that occurred. * * - `added`: A new message was added to the conversation * - `edited`: An existing message was edited * - `deleted`: A message was deleted (soft delete) * - `reaction`: A reaction was added or removed from a message */ updateType: 'added' | 'edited' | 'deleted' | 'reaction'; } declare var CometChatUIKitCalls: any; /** * ConnectionStateService * * A single, root-level service that owns exactly ONE CometChat ConnectionListener * for the entire application. All components and services that need to react to * WebSocket connect/disconnect events should inject this service instead of * registering their own listeners. * * Why one listener? * - The SDK fires the same event to every registered listener simultaneously. * Having N listeners (one per list component) causes N parallel refetches on * reconnect, which is wasteful and can cause race conditions. * - A single shared signal/observable lets any part of the UI (e.g. a * "reconnecting…" banner) read connection state without extra wiring. * * Three streams, and they answer different questions: * - {@link connected} (signal) and a `toObservable` of it: "what is the state, and when does it * change?" Use it to paint. * - {@link reconnected$}: "did the connection come back after it was reported down?" Use it to * refetch a list that already holds server content. * - {@link connects$}: "is the connection up now?", on every connect, change or not. Use it where * nothing has loaded yet and the connect is the only chance to load, because the two streams * above can both stay silent across a real outage - see {@link connects$}. * * Usage in services: * ```typescript * private connectionState = inject(ConnectionStateService); * * constructor() { * this.connectionState.reconnected$ * .pipe(takeUntilDestroyed(this.destroyRef)) * .subscribe(() => this.refresh()); * } * ``` * * Usage in templates: * ```html * @if (connectionState.connected() === false) { *
Reconnecting…
* } * ``` */ declare class ConnectionStateService implements OnDestroy { private readonly _connected; /** Current connection state as a read-only signal. */ readonly connected: _angular_core.Signal; /** * Observable that emits `true` every time the WebSocket reconnects. * Skips the initial `null → true` transition that happens at app startup * (that is not a reconnect, it is the first connect). */ readonly reconnected$: Observable; /** * Every connect the SDK reports, whether or not a disconnect was reported before it and * whether or not it changes {@link connected}. * * Both of the streams above answer "did the state change?", and across one real outage * neither does. The SDK fires `onDisconnected` only when the socket closes while its status * is neither DISCONNECTED nor CONNECTING (`CometChat.ts`, WS ready-state CLOSED), so a drop * inside a connect window - the launch connect, or a reconnect attempt - is never reported. * The signal then still holds the `true` of the connect before it, the connect that follows * sets `true` over `true` (no change, so a `toObservable` of it emits nothing) and * `disconnectedSinceConnect` is still false (so `reconnected$` emits nothing either). A screen * waiting on the connection to load for the first time saw neither and stayed on its offline * error until it was reopened (ENG-57333). * * Android reloads from `onConnected`, once per connection, for the same reason * (`MessageListOfflineSync.kt:60-73`). */ readonly connects$: Observable; private readonly listenerId; /** * A reconnect is a connect that follows a disconnect, taken straight from the SDK events. * It is not read back from the signal: a disconnect and a reconnect delivered back to back * (a laptop waking, a throttled tab) reach a signal-based observable as one unchanged value, * and the reconnect would be lost. */ private readonly reconnects; private readonly connects; private disconnectedSinceConnect; constructor(); ngOnDestroy(): void; /** Record a connect: the state, the reconnect bookkeeping, and {@link connects$}. */ private reportConnected; private browserListenersAttached; /** * The browser's own connectivity events, as a backstop under the SDK's. * * The SDK stays silent about a socket that closes while it is still connecting (see * {@link connects$}), and the browser does not: it reports the interface going down and coming * back either way. Neither handler invents state - each one checks the SDK's own status first - * so a browser event that disagrees with a live socket changes nothing. */ private watchBrowserConnectivity; /** * The interface went down. When the SDK is not connected either, this is the disconnect it * will not report, so it is recorded here: without it the connect that follows looks like * "no change" to every consumer of the state. */ private readonly onBrowserOffline; /** * The interface came back. When the SDK's socket is already up, the SDK has nothing left to * report and no `onConnected` will arrive, so the connect is recorded here instead. When it is * not up, nothing is done: the SDK reconnects on its own and its `onConnected` is the signal. */ private readonly onBrowserOnline; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * ChatStateService * * Centralized service for managing active chat state across the CometChat Angular UIKit. * Provides a single source of truth for the currently active chat entity * (User, Group, or Conversation) using Angular Signals with Observable API for RxJS integration. * * Enforces mutual exclusivity: setting a User clears the active Group and vice versa. * * @Injectable providedIn: 'root' */ declare class ChatStateService { private conversationsService; private activeUserSignal; private activeGroupSignal; private activeConversationSignal; /** * Readonly signal for the currently active user. * @example * ```typescript * activeUser = this.chatStateService.activeUser; * // In template: {{ activeUser()?.getName() }} * ``` */ readonly activeUser: _angular_core.Signal<_cometchat_chat_sdk_javascript.User | null>; /** * Readonly signal for the currently active group. * @example * ```typescript * activeGroup = this.chatStateService.activeGroup; * // In template: {{ activeGroup()?.getName() }} * ``` */ readonly activeGroup: _angular_core.Signal<_cometchat_chat_sdk_javascript.Group | null>; /** * Readonly signal for the currently active conversation. */ readonly activeConversation: _angular_core.Signal<_cometchat_chat_sdk_javascript.Conversation | null>; /** * Observable stream for the currently active user. * @example * ```typescript * this.chatStateService.activeUser$.subscribe(user => { ... }); * ``` */ readonly activeUser$: Observable; /** * Observable stream for the currently active group. */ readonly activeGroup$: Observable; /** * Observable stream for the currently active conversation. */ readonly activeConversation$: Observable; /** * Sets the active user and clears the active group (mutual exclusivity). * @param user - The user to set as active, or null to clear */ setActiveUser(user: CometChat.User | null): void; /** * Sets the active group and clears the active user (mutual exclusivity). * @param group - The group to set as active, or null to clear */ setActiveGroup(group: CometChat.Group | null): void; /** * Sets the active conversation and extracts user/group from it. * Automatically calls setActiveUser or setActiveGroup based on conversation type. * @param conversation - The conversation to set as active, or null to clear */ setActiveConversation(conversation: CometChat.Conversation | null): void; /** * Point the conversation list at the chat that is ALREADY open. * * The counterpart to `setActiveConversation`, for the other direction: the * entity was set first — opening the chat a saved message or a search result * belongs to — and only the list's selection is missing. Going back through * `setActiveConversation` would re-announce the user/group, and every message * list treats that as a conversation change and reloads, discarding the jump * the caller had just lined up. */ syncActiveConversation(conversation: CometChat.Conversation | null): void; /** * Gets the current active user (snapshot, non-reactive). * @returns The currently active user, or null */ getActiveUser(): CometChat.User | null; /** * Gets the current active group (snapshot, non-reactive). * @returns The currently active group, or null */ getActiveGroup(): CometChat.Group | null; /** * Gets the current active conversation (snapshot, non-reactive). * @returns The currently active conversation, or null */ getActiveConversation(): CometChat.Conversation | null; /** * Gets the currently active chat entity (User or Group). * Returns User if set, otherwise Group, otherwise null. * @returns The active User, Group, or null */ getActiveChatEntity(): CometChat.User | CometChat.Group | null; /** * Clears all active chat states (user, group, conversation). * Also clears the internal active conversation in ConversationsService. */ clearActiveChat(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * ConversationsService * * Singleton service managing conversation list state and SDK interactions. * Uses Angular Signals for reactive state with Observable API for backward compatibility. * * @Injectable providedIn: 'root' */ declare class ConversationsService { private destroyRef; private ngZone; private connectionState; private offlineHub; private conversationsSignal; private loadingStateSignal; private errorStateSignal; /** * Offline (D84): the offline state ("Connect to load chats" or "Connect to search") is up * because the device was not connected, so the first page loads once by itself when the * connection is back. A non-network error never sets it. */ private reloadOnConnect; /** * Offline (D84 rule 3): the first page was read with no connection and nothing on screen, so the * list shows "Connect to load chats" in place of its error view (the app's own error view still * wins). The error state is set and `error` fires once. Always false with offline off. */ private readonly connectToLoadSignal; readonly connectToLoad: _angular_core.Signal; /** * Offline (D84 rule 7): a list with a search keyword could not be read with no connection and * nothing is saved for it, so it says "Connect to search" (no error state, no `error`). A filter * alone is the plain list. Always false with offline off. */ private readonly connectToSearchSignal; readonly connectToSearch: _angular_core.Signal; private clearOfflineStates; /** * Offline (D83): a first-page load the user or app started failed while conversations were * on screen. The rows stay and no error view shows; this is how the failure reaches `onError`. * Never emits with offline off. */ private readonly keptRowsErrorSubject; readonly keptRowsError$: Observable; private activeConversationSignal; private typingIndicatorsSignal; private allConversationsSignal; /** * The conversation list as the UI should show it: pinned chats first. * * Ordering lives here rather than in the mutation methods so that no insert * path can bypass it — the stored signal stays purely recency-ordered and * this view applies the pin rule once, for every reader. */ readonly conversations: _angular_core.Signal<_cometchat_chat_sdk_javascript.Conversation[]>; readonly loadingState: _angular_core.Signal; readonly errorState: _angular_core.Signal; readonly activeConversation: _angular_core.Signal<_cometchat_chat_sdk_javascript.Conversation | null>; readonly typingIndicators: _angular_core.Signal>; readonly conversations$: Observable; readonly loadingState$: Observable; readonly errorState$: Observable; readonly activeConversation$: Observable; readonly typingIndicators$: Observable>; readonly hasConversations: _angular_core.Signal; readonly isLoading: _angular_core.Signal; readonly hasError: _angular_core.Signal; private hasMoreSignal; readonly hasMore: _angular_core.Signal; private conversationsRequest?; private requestBuilder?; private messageListenerId; private userListenerId; private groupListenerId; private callListenerId; private retryAttempts; /** Guard: only re-fetch on reconnect after the first fetch has completed. */ private initialFetchDone; /** The builder of the last first-page fetch: a reconnect re-runs the request on screen. */ private activeBuilder?; /** * Whether that request is anything but the plain list (filtered, tagged, searched, unread, * pinned-by, agentic). With offline on it follows what the request does, not whether the app * passed a builder: a builder that only sets a limit is the plain list. */ private customRequestActive; /** Offline path: a sync page's resync of a filtered list is running; further sync pages wait for it. */ private resyncInFlight; /** Offline path: bumped per first-page read, so a late page of an older read is dropped. */ private offlineReadGen; /** Offline path: page one's read is still waiting for its server phase (the cached page may already show). */ private firstPageInFlight; /** A load-more asked for while page one was in flight; it runs when that read lands. */ private loadMoreDeferred; /** Set once this list has run an offline-path read; scopes session cleanup. */ private offlinePathUsed; /** An offline read past the cache closed paging; the connection coming back opens it again. */ private pagingClosedOffline; /** * The preview each own pending send replaced, by its local handle: a send the * SDK discards takes its chat's preview back to it. `listed` is false when the * send's chat was not listed before it. */ private previewsBeforeSend; private ccMessageSentSubscription; private ccMessageDeletedSubscription; private callEventSubscriptions; private uiEventSubscriptions; constructor(); /** * Kill switch (UIK-LIFE-03): a preview still showing an un-acked own send * turns failed (direct). The message list, when open, raises the notice. */ private failStrandedPreviews; /** * Offline hub streams. With offline off the hub never emits, so none of * these handlers runs. */ private setupOfflineStreams; /** * After a reconnect (offline on): a load-more the user asked for that was * refused offline closed paging. It opens again and that load runs now: the end * of the list is where the user left it and its scroll trigger already fired. */ private reopenPagingClosedOffline; /** Remember the preview an own pending send is about to replace (once per send). */ private rememberPreviewBeforeSend; /** * A send the SDK discarded was never sent: its chat's preview goes back to the * message before it, in place, instead of showing it as a failed send. A chat * the send itself had listed is removed again. */ private restorePreviewAfterDiscard; /** * Offline path of {@link fetchConversations}: the cached page paints first, the server page replaces it. * `silent` is the kit's own resync of a filtered list: its pages merge into the rows shown * instead (rows below page one stay; only rows its cached phase delivered and the server lacks go). */ private fetchConversationsOffline; /** * Offline path of {@link fetchNextConversations}. A server page that lists no * new row (the reconnect sync already listed them) is not the end: the read * goes on, up to {@link MAX_OFFLINE_READ_ON} pages, or the list would stop * growing with the scroll trigger already spent. A read refused offline closes * paging until the connection is back. */ private fetchNextConversationsOffline; clearError(): void; private setError; setConversationsRequestBuilder(builder: CometChat.ConversationsRequestBuilder): void; setActiveConversation(conversation: CometChat.Conversation | null): void; getConversations(): CometChat.Conversation[]; fetchConversations(builder?: CometChat.ConversationsRequestBuilder, silent?: boolean): Promise; fetchNextConversations(automatic?: boolean): Promise; deleteConversation(conversationWith: string, conversationType: string): Promise; searchConversations(searchText: string): void; removeConversation(id: string): void; findConversation(id: string): CometChat.Conversation | null; updateConversationList(conversation: CometChat.Conversation, message?: CometChat.BaseMessage): void; replaceConversation(newConversation: CometChat.Conversation): boolean; /** * A pin or unpin event (another device, an admin, or this client's own call) puts its pin state * on the row it names. The SDK's event carries a partial conversation (its user or group has no * name or avatar, and it has no last message), so the row is never swapped for it: the row keeps * its user/group, last message and unread count, and the pinned-first view re-sorts it. This * matches the Android UI Kit's `withPinState`. Returns false when no row matches. */ applyPinState(conversation: CometChat.Conversation): boolean; /** * Offline path of a pin or unpin event (UIK-CONV-01). The event may come from * another device, an admin or the reconnect sweep, so it is matched by * (type, with), case-insensitive; a 1:1 event whose peer is the user is * ignored. A chat not on screen is fetched and inserted (dropped if the fetch * fails), except in a filtered list, which only updates rows it shows. */ applyPinEvent(conversation: CometChat.Conversation): Promise; moveConversationToTop(id: string): boolean; insertConversationAt(conversation: CometChat.Conversation, index: number): void; getConversationIndex(id: string): number; updateConversationUnreadCount(id: string, count: number): void; updateConversationReadStatus(id: string, message: CometChat.BaseMessage): void; private handleReceipt; cleanup(): void; removeListeners(): void; private resetState; private setupSDKListeners; private setupSentMessageListener; private setupDeletedMessageListener; private handleNewMessage; private handleMessageUpdate; private handleMessageDelete; /** * A kick, ban or scope change updates the row's preview and order only when * it is newer than the row's last message. A live action always is; one the * offline hub replays after the sync may not be (Android isOlderThan). */ private refreshForGroupAction; private refreshSingleConversation; private handleTypingStarted; private handleTypingEnded; private handleUserStatusChange; private updateGroupOnConversation; private updateUserOnConversation; private removeConversationSilently; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Templates that apply to ALL list components as a fallback. * Component-specific templates take priority over shared templates. */ interface SharedListTemplates { /** Custom loading state template for all lists */ loadingView?: TemplateRef; /** Custom empty state template for all lists */ emptyView?: TemplateRef; /** Custom error state template for all lists */ errorView?: TemplateRef<{ $implicit: Error; }>; } /** * Templates for CometChatConversations. * Includes item-level slots (leading, title, subtitle, trailing) plus state slots. */ interface ConversationTemplates { /** Custom template for the entire conversation item */ itemView?: TemplateRef; /** Custom template for the leading section (avatar, status indicator) */ leadingView?: TemplateRef; /** Custom template for the title section */ titleView?: TemplateRef; /** Custom template for the subtitle section */ subtitleView?: TemplateRef; /** Custom template for the trailing section (timestamp, badge) */ trailingView?: TemplateRef; /** Custom template for the loading state */ loadingView?: TemplateRef; /** Custom template for the empty state */ emptyView?: TemplateRef; /** Custom template for the error state */ errorView?: TemplateRef<{ $implicit: Error; }>; } /** * Templates for CometChatUsers. */ interface UserTemplates { /** Custom template for the entire user item */ itemView?: TemplateRef; /** Custom template for the leading section (avatar) */ leadingView?: TemplateRef; /** Custom template for the title section */ titleView?: TemplateRef; /** Custom template for the subtitle section */ subtitleView?: TemplateRef; /** Custom template for the trailing section */ trailingView?: TemplateRef; /** Custom template for the loading state */ loadingView?: TemplateRef; /** Custom template for the empty state */ emptyView?: TemplateRef; /** Custom template for the error state */ errorView?: TemplateRef<{ $implicit: Error; }>; } /** * Templates for CometChatGroups. */ interface GroupTemplates { /** Custom template for the entire group item */ itemView?: TemplateRef; /** Custom template for the leading section (avatar) */ leadingView?: TemplateRef; /** Custom template for the title section */ titleView?: TemplateRef; /** Custom template for the subtitle section */ subtitleView?: TemplateRef; /** Custom template for the trailing section */ trailingView?: TemplateRef; /** Custom template for the loading state */ loadingView?: TemplateRef; /** Custom template for the empty state */ emptyView?: TemplateRef; /** Custom template for the error state */ errorView?: TemplateRef<{ $implicit: Error; }>; } /** * Templates for CometChatGroupMembers. */ interface GroupMemberTemplates { /** Custom template for the entire member item */ itemView?: TemplateRef; /** Custom template for the leading section (avatar) */ leadingView?: TemplateRef; /** Custom template for the title section */ titleView?: TemplateRef; /** Custom template for the subtitle section */ subtitleView?: TemplateRef; /** Custom template for the trailing section */ trailingView?: TemplateRef; /** Custom template for the loading state */ loadingView?: TemplateRef; /** Custom template for the empty state */ emptyView?: TemplateRef; /** Custom template for the error state */ errorView?: TemplateRef<{ $implicit: Error; }>; } /** * Templates for CometChatCallLogs. */ interface CallLogTemplates { /** Custom template for the entire call log item */ itemView?: TemplateRef; /** Custom template for the leading section */ leadingView?: TemplateRef; /** Custom template for the title section */ titleView?: TemplateRef; /** Custom template for the subtitle section */ subtitleView?: TemplateRef; /** Custom template for the trailing section */ trailingView?: TemplateRef; /** Custom template for the loading state */ loadingView?: TemplateRef; /** Custom template for the empty state */ emptyView?: TemplateRef; /** Custom template for the error state */ errorView?: TemplateRef<{ $implicit: Error; }>; } /** * Templates for CometChatMessageList. * Message list has header/footer instead of leading/title/subtitle/trailing. */ interface MessageListTemplates { /** Custom template for the loading state */ loadingView?: TemplateRef; /** Custom template for the empty state */ emptyView?: TemplateRef; /** Custom template for the error state */ errorView?: TemplateRef<{ $implicit: Error; }>; /** Custom template for the header section */ headerView?: TemplateRef; /** Custom template for the footer section */ footerView?: TemplateRef; } /** * Templates for CometChatSearch. * Search has two result sections (conversations + messages), each with their own * item/leading/title/subtitle/trailing slots, plus shared state views. */ interface SearchTemplates { /** Custom template for the entire conversation item in search results */ conversationItemView?: TemplateRef; /** Custom template for the leading section of conversation items */ conversationLeadingView?: TemplateRef; /** Custom template for the title section of conversation items */ conversationTitleView?: TemplateRef; /** Custom template for the subtitle section of conversation items */ conversationSubtitleView?: TemplateRef; /** Custom template for the trailing section of conversation items */ conversationTrailingView?: TemplateRef; /** Custom template for the entire message item in search results */ messageItemView?: TemplateRef; /** Custom template for the leading section of message items */ messageLeadingView?: TemplateRef; /** Custom template for the title section of message items */ messageTitleView?: TemplateRef; /** Custom template for the subtitle section of message items */ messageSubtitleView?: TemplateRef; /** Custom template for the trailing section of message items */ messageTrailingView?: TemplateRef; /** Custom template for the initial state (before user searches) */ initialView?: TemplateRef; /** Custom template for the loading state */ loadingView?: TemplateRef; /** Custom template for the empty state */ emptyView?: TemplateRef; /** Custom template for the error state */ errorView?: TemplateRef<{ $implicit: Error; }>; } /** * Legacy generic interface kept for backward compatibility. * Prefer the typed interfaces above for new code. */ interface ListTemplates { itemTemplate?: TemplateRef<{ $implicit: T; index: number; }>; loadingTemplate?: TemplateRef; emptyTemplate?: TemplateRef; errorTemplate?: TemplateRef<{ $implicit: Error; }>; headerTemplate?: TemplateRef; footerTemplate?: TemplateRef; } declare class CometChatTemplatesService { private readonly _destroyRef; private sharedTemplatesSignal; private sharedTemplatesSubject; readonly sharedTemplates: _angular_core.Signal; readonly sharedTemplates$: Observable; private conversationTemplatesSignal; private conversationTemplatesSubject; readonly conversationTemplates: _angular_core.Signal; readonly conversationTemplates$: Observable; private userTemplatesSignal; private userTemplatesSubject; readonly userTemplates: _angular_core.Signal; readonly userTemplates$: Observable; private groupTemplatesSignal; private groupTemplatesSubject; readonly groupTemplates: _angular_core.Signal; readonly groupTemplates$: Observable; private groupMemberTemplatesSignal; private groupMemberTemplatesSubject; readonly groupMemberTemplates: _angular_core.Signal; readonly groupMemberTemplates$: Observable; private callLogTemplatesSignal; private callLogTemplatesSubject; readonly callLogTemplates: _angular_core.Signal; readonly callLogTemplates$: Observable; private messageListTemplatesSignal; private messageListTemplatesSubject; readonly messageListTemplates: _angular_core.Signal; readonly messageListTemplates$: Observable; private searchTemplatesSignal; private searchTemplatesSubject; readonly searchTemplates: _angular_core.Signal; readonly searchTemplates$: Observable; private listTemplatesSignal; private listTemplatesSubject; readonly listTemplates: _angular_core.Signal>; readonly listTemplates$: Observable>; constructor(); /** * Sets templates that apply to ALL list components as a fallback. * Component-specific templates take priority over shared templates. */ setSharedTemplates(templates: Partial): void; /** Gets the current shared templates synchronously. */ getSharedTemplates(): SharedListTemplates; /** Clears all shared templates, resetting to defaults. */ clearSharedTemplates(): void; setConversationItemTemplate(template: TemplateRef): void; setConversationLeadingTemplate(template: TemplateRef): void; setConversationTitleTemplate(template: TemplateRef): void; setConversationSubtitleTemplate(template: TemplateRef): void; setConversationTrailingTemplate(template: TemplateRef): void; setConversationLoadingTemplate(template: TemplateRef): void; setConversationEmptyTemplate(template: TemplateRef): void; setConversationErrorTemplate(template: TemplateRef<{ $implicit: Error; }>): void; /** Sets multiple conversation templates at once. */ setConversationTemplates(templates: Partial): void; /** Gets the current conversation templates synchronously. */ getConversationTemplates(): ConversationTemplates; /** Clears all conversation templates, resetting to defaults. */ clearConversationTemplates(): void; setUserTemplates(templates: Partial): void; getUserTemplates(): UserTemplates; clearUserTemplates(): void; setGroupTemplates(templates: Partial): void; getGroupTemplates(): GroupTemplates; clearGroupTemplates(): void; setGroupMemberTemplates(templates: Partial): void; getGroupMemberTemplates(): GroupMemberTemplates; clearGroupMemberTemplates(): void; setCallLogTemplates(templates: Partial): void; getCallLogTemplates(): CallLogTemplates; clearCallLogTemplates(): void; setMessageListTemplates(templates: Partial): void; getMessageListTemplates(): MessageListTemplates; clearMessageListTemplates(): void; setSearchTemplates(templates: Partial): void; getSearchTemplates(): SearchTemplates; clearSearchTemplates(): void; /** @deprecated Use typed methods (setUserTemplates, setGroupTemplates, etc.) instead. */ getListTemplates(): ListTemplates; /** @deprecated Use typed methods instead. */ setListTemplates(templates: Partial>): void; /** @deprecated Use typed clear methods instead. */ clearListTemplates(): void; /** Clears ALL templates (shared + all component-specific), resetting everything to defaults. */ clearAllTemplates(): void; /** * Resolves a template for a specific slot using the priority chain: * Component-specific > Shared > undefined (component uses its default). * * @param componentTemplates - The component-specific templates object * @param slot - The template slot name (e.g. 'loadingView', 'emptyView', 'errorView') * @returns The resolved TemplateRef or undefined */ resolveTemplate>(componentTemplates: T, slot: keyof T & keyof SharedListTemplates): TemplateRef | undefined; private updateConversationTemplates; private _completeAllSubjects; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Types and interfaces for MessageHeaderService */ /** * Error callback type for service error handling * Used to propagate errors from service to component */ type ErrorCallback$1 = (error: CometChat.CometChatException) => void; /** * MessageHeaderService * * Service responsible for managing message header state and SDK interactions. * Implements the Hybrid Approach pattern where service provides defaults * but component @Input properties can override them. * * Uses Angular Signals for reactive state management. * * @Injectable * @see Requirements 14.1, 14.2, 14.3, 14.4, 14.5 */ declare class MessageHeaderService { private userListenerId; private messageListenerId; private groupListenerId; private connectionListenerId; private typingTimeout?; private readonly TYPING_TIMEOUT_MS; private currentTypingEntityId; private currentTypingEntityType; private currentGroupId; private typingUsersMap; private userSignal; private groupSignal; private userStatusSignal; private typingIndicatorSignal; private typingUsersSignal; private groupMemberCountSignal; private lastActiveAtSignal; private connectionStatusSignal; private errorCallback; readonly user: _angular_core.Signal<_cometchat_chat_sdk_javascript.User | null>; readonly group: _angular_core.Signal<_cometchat_chat_sdk_javascript.Group | null>; readonly userStatus: _angular_core.Signal; readonly typingIndicator: _angular_core.Signal<_cometchat_chat_sdk_javascript.TypingIndicator | null>; readonly typingUsers: _angular_core.Signal<_cometchat_chat_sdk_javascript.User[]>; readonly groupMemberCount: _angular_core.Signal; readonly lastActiveAt: _angular_core.Signal; readonly connectionStatus: _angular_core.Signal<"connected" | "disconnected">; private destroyRef; private readonly offlineHub; constructor(); setErrorCallback(callback: ErrorCallback$1 | null): void; private handleError; setUser(user: CometChat.User): void; setGroup(group: CometChat.Group): void; updateUserStatus(status: string): void; updateLastActiveAt(timestamp: number | null): void; setTypingIndicator(typingIndicator: CometChat.TypingIndicator | null): void; updateGroupMemberCount(count: number): void; incrementGroupMemberCount(): void; decrementGroupMemberCount(): void; resetState(): void; setupListeners(entityId: string, entityType: 'user' | 'group'): void; setupUserStatusListener(userId: string): void; setupTypingListener(entityId: string, entityType: 'user' | 'group'): void; setupGroupMemberListener(groupId: string): void; setupConnectionListener(): void; removeUserStatusListener(): void; removeTypingListener(): void; removeGroupMemberListener(): void; removeConnectionListener(): void; private removeAllListeners; cleanup(): void; private handleUserStatusChange; private handleTypingStarted; private handleTypingEnded; private clearTypingTimeout; /** * Apply the group-member actions a catch-up sweep replayed. * * A live action means "one member just joined or left", so the live listener * moves the count by one. A swept action is history, and the conversation * sync has already handed the header the group as the server has it now, * with a count that includes every swept action. Moving by one again drifts * (a repeated or PARTIAL sweep drifts further), so the swept path never * increments: the count the header already shows stands, and the newest * swept action's own snapshot is read only when the header has no count at * all yet. */ private applySweptGroupActions; private handleGroupMemberJoined; /** Decrement count if the event is for the current group. */ private handleGroupMemberLeft; private handleGroupMemberKicked; private handleGroupMemberBanned; private handleMemberAddedToGroup; private handleConnected; private handleDisconnected; private refreshUserStatus; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } type OfflineSendKind = 'text' | 'media' | 'custom' | 'interactive'; /** How the send stands once the SDK has answered the first time. */ interface OfflineSendResult { /** `sending` = accepted and queued: the row keeps the clock; not a failure. */ state: 'sent' | 'sending' | 'failed'; message: CometChat.BaseMessage; error?: unknown; reason?: string; /** Failed without entering the outbox; Retry is a fresh send. */ direct?: boolean; /** Failed only because the session ended (logout or user switch): nothing to report to the user. */ quiet?: boolean; /** * Only with `handOffAtPending`: the send's own answer once there is one (`sent` or `failed`), for a * caller that moved on at pending. Never resolves if the send is never answered (logout). */ final?: Promise; } interface OfflineSendOptions { /** * Answer as soon as the SDK holds the message (pending) instead of waiting for its first real * answer. A staged batch sends this way, as Android does: the outbox keeps the order, and a send * queued behind an unsent message of its chat would otherwise hold the next file for the bound. */ handOffAtPending?: boolean; } /** * Types and interfaces for MessageComposerService */ /** * Error callback type for service error handling */ type ErrorCallback = (error: CometChat.CometChatException) => void; /** * Payload interface for creating a poll via the polls extension API */ interface PollCreatePayload { /** The poll question */ question: string; /** Array of answer options (2-12 items) */ options: string[]; /** Receiver ID (user UID or group GUID) */ receiver: string; /** Receiver type ('user' or 'group') */ receiverType: string; /** Optional quoted message ID for replies */ quotedMessageId?: number; } /** * Payload interface for creating collaborative documents and whiteboards */ interface CollaborativePayload { /** Receiver ID (user UID or group GUID) */ receiver: string; /** Receiver type ('user' or 'group') */ receiverType: string; /** Optional quoted message ID for replies */ quotedMessageId?: number; } /** * Mention suggestion item - can be a user, group member, or special @all mention */ interface MentionSuggestion$1 { /** Unique identifier */ uid: string; /** Display name */ name: string; /** Avatar URL */ avatar?: string; /** Whether this is the @all mention */ isAllMention?: boolean; /** Original user or group member object */ entity?: CometChat.User | CometChat.GroupMember; } /** * MessageComposerService * * Manages message composer state and SDK interactions. * Handles sending text/media messages, editing, typing indicators, * file upload progress, and mention suggestions. * * @Injectable — provided at component level via CometChatMessageComposerComponent providers * @see Requirements 29.1–29.10 */ declare class MessageComposerService { private isSendingSignal; private uploadProgressSignal; private isRecordingSignal; private recordingDurationSignal; private mentionSuggestionsSignal; private isFetchingMentionsSignal; private isFetchingMoreMentionsSignal; private hasMoreMentionsSignal; private mentionsPaginationRequest; private mentionSearchSubject; private mentionSearchSubscription; readonly isSending: _angular_core.Signal; readonly uploadProgress: _angular_core.Signal>; readonly isRecording: _angular_core.Signal; readonly recordingDuration: _angular_core.Signal; readonly mentionSuggestions: _angular_core.Signal; readonly isFetchingMentions: _angular_core.Signal; readonly isFetchingMoreMentions: _angular_core.Signal; readonly hasMoreMentions: _angular_core.Signal; private errorCallback; constructor(); private setupMentionSearchSubscription; /** * A mention fetch failed. Offline, a keyword search has no cache to answer from: that is an * empty list ("no match"), never an error or a "Connect to search" prompt (Android * `TwoPhaseSuggestionFetch`). Anything else is the error as today. */ private mentionFetchFailed; setErrorCallback(callback: ErrorCallback | null): void; private handleError; private readonly threadSubscription; /** * Seed the outgoing copy of a threaded reply as subscribed. * * Sending in a thread subscribes the sender server-side, but the optimistic * bubble is rendered from this object long before any response comes back — * without the stamp its own action sheet would read "Follow thread" on a * thread the user has just joined. Purely local; no server write. */ private seedOutgoingThreadReply; /** * Mirror the auto-subscribe a threaded send earned — Case 4. * * The server has already made the write, so this never calls * `subscribeToThread`: it stamps the confirmed message (whose own flag would * otherwise read `false` on a socket echo) and publishes the flip so the * thread header and every open action sheet agree without a refetch. */ private mirrorThreadReplySent; /** * Offline (ON) path: send a message the composer already built and announced * (`inprogress`), through the offline send helper. The helper reports every * transition, and the public events, through the offline hub, so the caller * emits nothing itself. Resolves once the SDK first answers: `sent`, `sending` * (queued, not a failure) or `failed`. Never rejects. * * @internal */ sendOffline(message: CometChat.BaseMessage, kind: OfflineSendKind, options?: OfflineSendOptions): Promise; sendTextMessage(receiver: CometChat.User | CometChat.Group, text: string, metadata?: Record, parentMessageId?: number, quotedMessage?: CometChat.BaseMessage, message?: CometChat.TextMessage): Promise; sendMediaMessage(receiver: CometChat.User | CometChat.Group, file: File, type: string, metadata?: Record, parentMessageId?: number, quotedMessage?: CometChat.BaseMessage, message?: CometChat.MediaMessage): Promise; /** * Edit a message's text. For a media message the edited value is its CAPTION — sending a * MediaMessage shell carrying only the id + caption, since `setText` is meaningless there. */ editMessage(message: CometChat.BaseMessage, newText: string): Promise; sendStickerMessage(receiver: CometChat.User | CometChat.Group, stickerUrl: string, stickerName: string, parentMessageId?: number, quotedMessage?: CometChat.BaseMessage, message?: CometChat.CustomMessage): Promise; createPoll(question: string, options: string[], receiverId: string, receiverType: string, quotedMessageId?: number): Promise; createCollaborativeDocument(receiverId: string, receiverType: string, quotedMessageId?: number): Promise; createCollaborativeWhiteboard(receiverId: string, receiverType: string, quotedMessageId?: number): Promise; startTyping(receiver: CometChat.User | CometChat.Group): void; endTyping(receiver: CometChat.User | CometChat.Group): void; updateUploadProgress(fileId: string, progress: number): void; clearUploadProgress(fileId: string): void; clearAllUploadProgress(): void; setRecordingState(isRecording: boolean): void; updateRecordingDuration(duration: number): void; searchMentions(searchText: string, group?: CometChat.Group, usersRequestBuilder?: CometChat.UsersRequestBuilder, groupMembersRequestBuilder?: CometChat.GroupMembersRequestBuilder, disableMentionAll?: boolean, mentionAllLabel?: string): void; initializeMentionsPagination(searchText: string, group?: CometChat.Group, customUsersRequestBuilder?: CometChat.UsersRequestBuilder, customGroupMembersRequestBuilder?: CometChat.GroupMembersRequestBuilder): void; fetchMoreMentions(isGroupContext: boolean): Promise; appendMentionSuggestions(suggestions: MentionSuggestion$1[]): void; checkIfSelfMention(userId: string): Promise; clearMentionSuggestions(): void; stopMentionSearch(): void; cleanup(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Rich Text Editor Interfaces * * Type definitions for the custom rich text editor. * These interfaces define the API for the RichTextEditorService. * * @module services/rich-text-editor * @see Requirements 12.1, 12.2, 12.3, 12.4 */ /** * Interface for rich text formatting state * Tracks which formatting options are currently active */ interface RichTextFormatState { /** Whether bold formatting is active */ bold: boolean; /** Whether italic formatting is active */ italic: boolean; /** Whether underline formatting is active */ underline: boolean; /** Whether strikethrough formatting is active */ strikethrough: boolean; /** Whether code (inline) formatting is active */ code: boolean; /** Whether blockquote formatting is active */ blockquote: boolean; /** Whether code block formatting is active */ codeBlock: boolean; /** Whether ordered list formatting is active */ orderedList: boolean; /** Whether bullet list formatting is active */ bulletList: boolean; /** Whether a link is active */ link: boolean; } /** * Interface for mention items */ interface MentionItem { /** Unique identifier */ id: string; /** Display name */ label: string; /** Avatar URL */ avatar?: string; /** Whether this is the @all mention */ isAllMention?: boolean; /** Original entity (User or GroupMember) */ entity?: unknown; } /** * Interface for rich text editor configuration options */ interface RichTextEditorConfig { /** Placeholder text when editor is empty */ placeholder?: string; /** Whether the editor should be editable */ editable?: boolean; /** Whether to autofocus the editor on creation */ autofocus?: boolean | 'start' | 'end' | 'all' | number; /** Initial content for the editor (HTML string) */ content?: string; /** ARIA label for accessibility (defaults to 'Rich text editor') */ ariaLabel?: string; /** Whether to enable rich text formatting (when false, strips all formatting on paste) */ enableFormatting?: boolean; /** Callback when editor content changes */ onUpdate?: (html: string, text: string) => void; /** Callback when editor selection changes */ onSelectionUpdate?: (formatState: RichTextFormatState) => void; /** Callback when editor is focused */ onFocus?: () => void; /** Callback when editor loses focus */ onBlur?: () => void; /** Callback when a link is clicked (for editing) - includes click coordinates */ onLinkClick?: (url: string, text: string, x: number, y: number) => void; /** Callback when @ is typed to trigger mention suggestions */ onMentionStart?: (query: string) => void; /** Callback when mention suggestions should be hidden */ onMentionEnd?: () => void; /** Callback to get mention suggestions - returns items for the suggestion popup */ getMentionSuggestions?: (query: string) => Promise; /** Callback when a mention is selected */ onMentionSelect?: (item: MentionItem) => void; } /** * Interface for rich text message metadata * Included in messages sent with rich text formatting */ interface RichTextMetadata { /** The HTML content of the message */ html: string; /** The plain text content of the message */ plainText: string; /** Whether the message contains rich text formatting */ hasFormatting: boolean; } /** * Context object for text formatters. * Provides additional information that formatters may need during processing. * * @see Requirements 5.1, 5.5 */ interface TextFormatterContext { /** The logged-in user */ loggedInUser?: CometChat.User; /** The group (if applicable) */ group?: CometChat.Group; /** Additional metadata */ metadata?: Record; } /** * Abstract base class for text formatters * * Formatters detect patterns in text and apply formatting transformations. * Text formatters are used to detect and transform patterns in text content, * such as @mentions, URLs, or custom patterns. They can be chained together * to apply multiple transformations in sequence. * * Formatters are applied in order of their priority property (lower = earlier in pipeline). * Each formatter can optionally implement shouldFormat() to conditionally skip processing. * * @abstract * @see Requirements 5.1, 5.5, 21.1-21.7 * * @example * ```typescript * class MyFormatter extends CometChatTextFormatter { * readonly id = 'my-formatter'; * priority = 50; * * getRegex(): RegExp { * return /pattern/g; * } * * format(text: string): string { * return text.replace(this.getRegex(), 'replacement'); * } * * shouldFormat(text: string, message?: CometChat.BaseMessage): boolean { * return text.includes('pattern'); * } * } * ``` */ declare abstract class CometChatTextFormatter { /** * Formatter priority (lower = earlier in pipeline). * Formatters are sorted by priority before being applied. * Default is 100. * * @see Requirements 5.5 */ priority: number; /** * Unique identifier for this formatter. * Used for debugging and to identify formatters in the pipeline. * Subclasses should provide a unique, descriptive id. * * @abstract * @see Requirements 5.1 */ abstract readonly id: string; /** * The original unformatted text * @protected */ protected originalText: string; /** * The formatted text after applying transformations * @protected */ protected formattedText: string; /** * Metadata extracted during formatting (e.g., mentions, URLs) * @protected */ protected metadata: Record; /** * Get the regex pattern for this formatter. * This pattern is used to detect the text patterns that should be formatted. * * @abstract * @returns The RegExp pattern for detecting formattable content */ abstract getRegex(): RegExp; /** * Format the input text by applying transformations. * * Implementations should: * 1. Store the original text in this.originalText * 2. Apply transformations and store result in this.formattedText * 3. Extract any metadata and store in this.metadata * 4. Return the formatted text * * @abstract * @param text - The text to format * @returns The formatted text with transformations applied */ abstract format(text: string): string; /** * Get the formatted text after format() has been called. * * @returns The formatted text, or empty string if format() hasn't been called */ getFormattedText(): string; /** * Get the original unformatted text. * * @returns The original text before formatting, or empty string if format() hasn't been called */ getOriginalText(): string; /** * Get metadata extracted during formatting. * * Metadata can include information like detected mentions, URLs, or other * pattern-specific data that was extracted during the format() operation. * * @returns A record containing formatter-specific metadata */ getMetadata(): Record; /** * Reset the formatter state to initial values. * * This clears the original text, formatted text, and metadata. * Call this method before reusing a formatter instance for new text. */ reset(): void; /** * Check if this formatter should process the given text. * * Override this method to conditionally skip formatting based on * the text content or message properties. By default, returns true * to always apply formatting. * * @param text - The text to check * @param message - The message containing the text (optional) * @returns Whether to apply this formatter (default: true) * @see Requirements 5.1 * * @example * ```typescript * // Skip formatting for very short messages * shouldFormat(text: string, message?: CometChat.BaseMessage): boolean { * return text.length > 10; * } * * // Skip formatting for certain message types * shouldFormat(text: string, message?: CometChat.BaseMessage): boolean { * return message?.getType() !== 'custom'; * } * ``` */ shouldFormat(text: string, message?: CometChat.BaseMessage): boolean; } /** * Types, interfaces, and regex constants for CometChatMentionsFormatter. */ /** * Represents mention metadata extracted from text. */ interface MentionData { /** The unique identifier of the mentioned user */ uid: string; /** The display name of the mentioned user */ name: string; /** The starting index of the mention in the original text */ startIndex: number; /** The ending index of the mention in the original text (exclusive) */ endIndex: number; /** The type of mention (self, other, or channel) */ type?: MentionType; } /** * Formatter for @mentions in text. * * Detects @username patterns and SDK format mentions (`<@uid:{uid}>`, `<@all:{label}>`) * and renders them as styled spans with BEM CSS classes. */ declare class CometChatMentionsFormatter extends CometChatTextFormatter { readonly id = "mentions-formatter"; priority: number; private mentions; private users; private enableAllMention; private allMentionLabel; private loggedInUser; private messageBubbleAlignment; setLoggedInUser(user: CometChat.User | null): void; getLoggedInUser(): CometChat.User | null; setMessageBubbleAlignment(alignment: MessageBubbleAlignment | undefined): void; getMessageBubbleAlignment(): MessageBubbleAlignment | undefined; setUsers(users: (CometChat.User | CometChat.GroupMember)[]): void; setAllMentionConfig(enabled: boolean, label?: string): void; getRegex(): RegExp; getUserMentionRegex(): RegExp; getChannelMentionRegex(): RegExp; format(text: string): string; formatSdkMentions(text: string, mentionedUsers?: (CometChat.User | CometChat.GroupMember)[]): string; extractUserUids(text: string): string[]; extractChannelLabels(text: string): string[]; hasSdkMentions(text: string): boolean; getMentions(): MentionData[]; hasMentions(): boolean; hasAllMention(): boolean; reset(): void; private getMentionType; private buildMentionCssClasses; } declare class RichTextEditor { private element; private contentEditable; private config; private destroyed; private eventListeners; private justAppliedFormatting; private customFormatterTimer; private contentEditableManager; private selectionManager; private formatManager; private historyManager; private listManager; private linkManager; private mentionsFormatter; private customFormatters; private ariaLiveRegion; private _pendingLinkClick; private lastSavedRange; private autofocusTimer; private currentFormatState; constructor(config: RichTextEditorConfig, element?: HTMLElement); private createAriaLiveRegion; private announceToScreenReader; private attachEventListeners; private addEventListener; private handleBeforeInput; private handleInput; private cleanupZeroWidthSpaces; private scrollCursorIntoView; private detectAndConvertMarkdown; private applyMarkdownFormat; private detectAndConvertAutoList; private handleKeyDown; private isInBlockquote; private shouldExitBlockquote; private exitBlockquote; private isInCodeBlock; private shouldExitCodeBlock; private exitCodeBlock; private shouldExitList; private getCurrentListItem; private handleMentionDeletion; private protectMentionsFromFormatting; private convertMentionsToPlainText; private isMentionNode; private findMentionAncestor; private moveCursorToMentionBoundary; private getMentionsInRange; private doesRangeIntersectNode; private extendSelectionToIncludeMentions; private handleSelectionChange; private handleFocus; private handleBlur; private markdownToHtml; private convertInlineMarkdown; private handlePaste; private handleCopy; private handleDrop; private handleClick; private handleMouseDown; private updateFormatState; private emitUpdate; getElement(): HTMLElement; getContentEditable(): HTMLDivElement; isDestroyed(): boolean; getHTML(): string; getText(): string; setHTML(html: string): void; clear(): void; isEmpty(): boolean; focus(position?: boolean | 'start' | 'end' | 'all' | number): void; blur(): void; setCursorPosition(position: 'start' | 'end' | number): void; selectAll(): void; getSelection(): Selection | null; getSelectedText(): string; saveSelection(): any; restoreSelection(state: any): void; getFormatState(): any; applyBold(): void; applyItalic(): void; applyUnderline(): void; applyStrikethrough(): void; applyInlineCode(): void; applyCodeBlock(): void; applyBlockquote(): void; applyOrderedList(): void; applyBulletList(): void; isInList(): boolean; setLink(url: string | null, text?: string): void; isLinkActive(): boolean; getCurrentLink(): string | null; getCurrentLinkText(): string | null; private pushToHistory; undo(): boolean; redo(): boolean; canUndo(): boolean; canRedo(): boolean; insertText(text: string): void; deleteRange(from: number, to: number): void; private getCharacterOffset; private restoreCharacterOffset; insertMention(id: string, label: string, charsToDelete: number, isSelf?: boolean): void; getUniqueMentionUids(): Set; getTextWithMentionFormat(): string; setContentWithMentions(text: string, mentionedUsers: (CometChat.User | CometChat.GroupMember)[]): void; private escapeUserHtmlForEditor; initializeMentionsFormatter(formatter?: CometChatMentionsFormatter): void; setCustomFormatters(formatters: CometChatTextFormatter[]): void; private scheduleCustomFormatters; private applyCustomFormatters; private htmlToMarkdown; destroy(): void; } declare class RichTextEditorService { private formatStateSignal; readonly formatState: _angular_core.Signal; /** Create a new rich text editor instance. @see Requirements 12.1-12.4 */ createEditor(config?: RichTextEditorConfig, element?: HTMLElement): RichTextEditor; /** Destroy an editor instance and clean up resources. */ destroyEditor(editor: RichTextEditor): void; /** Reset the format state signal to default. */ resetFormatState(): void; private getDefaultFormatState; /** Get the current format state for an editor. */ getFormatState(editor: RichTextEditor): RichTextFormatState; /** Toggle bold formatting. @see Requirement 2.1 */ toggleBold(editor: RichTextEditor): void; /** Toggle italic formatting. @see Requirement 2.2 */ toggleItalic(editor: RichTextEditor): void; /** Toggle underline formatting. @see Requirement 2.3 */ toggleUnderline(editor: RichTextEditor): void; /** Toggle strikethrough formatting. @see Requirement 2.4 */ toggleStrikethrough(editor: RichTextEditor): void; /** Toggle inline code formatting. @see Requirement 2.5 */ toggleCode(editor: RichTextEditor): void; /** Toggle code block formatting. @see Requirement 2.6 */ toggleCodeBlock(editor: RichTextEditor): void; /** Toggle blockquote formatting. @see Requirement 2.7 */ toggleBlockquote(editor: RichTextEditor): void; /** Toggle ordered list formatting. @see Requirement 3.1 */ toggleOrderedList(editor: RichTextEditor): void; /** Toggle bullet list formatting. @see Requirement 3.2 */ toggleBulletList(editor: RichTextEditor): void; /** Set or remove a link. @see Requirements 4.1, 4.2 */ setLink(editor: RichTextEditor, url: string | null, text?: string): void; /** Undo the last action. @see Requirement 6.1 */ undo(editor: RichTextEditor): boolean; /** Redo the last undone action. @see Requirement 6.2 */ redo(editor: RichTextEditor): boolean; /** Check if undo is available. @see Requirement 6.1 */ canUndo(editor: RichTextEditor): boolean; /** Check if redo is available. @see Requirement 6.2 */ canRedo(editor: RichTextEditor): boolean; /** Get the HTML content from an editor. @see Requirements 9.1, 9.4 */ getHTML(editor: RichTextEditor): string; /** Get the plain text content from an editor. @see Requirement 9.2 */ getText(editor: RichTextEditor): string; /** Set the content of an editor. */ setContent(editor: RichTextEditor, content: string, _emitUpdate?: boolean): void; /** Set the content with mentions properly formatted. @see Requirements 5.2, 15.5 */ setContentWithMentions(editor: RichTextEditor, text: string, mentionedUsers: (CometChat.User | CometChat.GroupMember)[], _emitUpdate?: boolean): void; /** Clear the editor content. */ clearContent(editor: RichTextEditor): void; /** Insert text at the current cursor position. @see Requirement 9.1 */ insertText(editor: RichTextEditor, text: string): void; /** Delete a range of content from the editor. @see Requirement 9.1 */ deleteRange(editor: RichTextEditor, from: number, to: number): void; /** Check if the editor content is empty. */ isEmpty(editor: RichTextEditor): boolean; /** Check if the content has any rich text formatting. */ hasFormatting(editor: RichTextEditor): boolean; /** Check if the cursor is currently inside a list. @see Requirement 2.17 */ isInList(editor: RichTextEditor): boolean; /** Insert a mention at the current cursor position. @see Requirements 5.2, 5.4, 5.5, 8.1, 8.2 */ insertMention(editor: RichTextEditor, id: string, label: string, charsToDelete: number, isSelf?: boolean): void; /** Convert editor content to CometChat mention format. @see Requirements 5.2, 9.5 */ getTextWithMentionFormat(editor: RichTextEditor): string; /** Get the set of unique mention UIDs. @see Requirement 5.6 */ getUniqueMentionUids(editor: RichTextEditor): Set; /** Get rich text metadata for a message. @see Requirements 9.3, 9.5 */ getRichTextMetadata(editor: RichTextEditor): RichTextMetadata; /** Focus the editor. */ focus(editor: RichTextEditor, position?: 'start' | 'end' | 'all' | number): void; /** Blur the editor (remove focus). */ blur(editor: RichTextEditor): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * MessageUtilsService provides utility functions for message-related operations * in the CometChat Angular UIKit. * * This service is used for: * - Getting action message text (joined, left, kicked, etc.) * - Distributing message options into quick and overflow groups * - Determining options position based on bubble alignment * - Building message bubbles from templates * - Determining user status visibility */ declare class MessageUtilsService { /** * Distributes message options into quick options and overflow options. * * Quick options are shown directly on the bubble for fast access. * Overflow options go into a context menu. * * @param options - The array of message options to distribute * @param quickOptionsCount - Number of options to show as quick options (default: 2) * @returns Object with `quickOptions` and `overflowOptions` arrays */ distributeMessageOptions(options: (CometChatActionsIcon | CometChatActionsView)[], quickOptionsCount?: number): { quickOptions: (CometChatActionsIcon | CometChatActionsView)[]; overflowOptions: (CometChatActionsIcon | CometChatActionsView)[]; }; /** * Gets the CSS class for options positioning based on message bubble alignment. * * - Left alignment (incoming): options on the right side * - Right alignment (outgoing): options on the left side * - Center alignment (action): no options * * @param alignment - The message bubble alignment * @returns CSS class name for options positioning */ getOptionsPositionClass(alignment: MessageBubbleAlignment): string; /** * Determines if the user's online status should be visible. */ getUserStatusVisible(user: CometChat.User | CometChat.GroupMember): boolean; /** * Gets the localized action message text for group action messages. * * Supported actions: ADDED, JOINED, LEFT, KICKED, BANNED, UNBANNED, SCOPE_CHANGE * * @param message - The CometChat action message * @returns Localized action message text */ getActionMessage(message: CometChat.Action | CometChat.BaseMessage): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Interface for message-related events */ interface IMessages { message: CometChat.BaseMessage; status: MessageStatus; /** * Optional parent message ID to scope edit events to a specific thread context. * When set: event originated from a thread composer/list. * When absent/null/0: event originated from the main conversation composer/list. */ parentMessageId?: number | null; } /** An own message's send state on the offline path. */ type MessageSendState = 'sending' | 'sent' | 'failed' | 'discarded'; /** Payload of `CometChatMessageEvents.ccMessageSendStateChanged` (offline support only). */ interface IMessageSendStateChanged { message: CometChat.BaseMessage; state: MessageSendState; /** The SDK's `MessageFailureReason` for `failed` and `discarded`. */ reason?: string; } /** Payload of `CometChatMessageEvents.ccOfflineCacheReset` (offline support only). */ interface IOfflineCacheReset { /** The SDK's `OfflineCacheResetReason`. */ reason: string; /** Unsent messages the reset lost; `null` when unknown. */ pendingMessagesLost: number | null; } /** A user-facing notice; the message list and conversation list render these. */ type OfflineNoticeKind = 'unsent_message_removed' | 'queue_full' | 'file_too_large_offline' | 'messages_not_sent' | 'unsent_messages_lost' | 'unsent_messages_maybe_lost' /** Retry or Delete tapped while the send is under way (R162): try again shortly. */ | 'send_in_flight'; interface OfflineNotice { gen: number; kind: OfflineNoticeKind; count?: number; /** The removed message, for Copy (text only). */ message?: CometChat.BaseMessage; /** * A message the notice is about, when it is about several: it says which list * the notice belongs to (its chat and its thread level) without offering the * single-message affordances `message` carries. */ scopeMessage?: CometChat.BaseMessage; /** Conversation the notice belongs to, when it belongs to one. */ conversationId?: string; } /** * Footer shown when an offline read could not go past the cache. * * @internal */ type OfflineFooterState = 'none' | 'connect_to_load_more'; declare class MessageListService { private destroyRef; private ngZone; private threadSubscription; private offlineHub; private messageListenerId; private groupListenerId; private callListenerId; private connectionListenerId; private ccMessageSentSubscription; private ccMessageEditedSubscription; private messagesSignal; private allMessagesSignal; private loadingStateSignal; private errorStateSignal; private prevMessageIdSignal; private nextMessageIdSignal; private unreadCountSignal; private connectionStatusSignal; private typingUsersSignal; private typingTimeoutsMap; private messageIdMap; private messageMuidMap; private currentUser; private currentGroup; private parentMessageId; /** * The thread's parent message in a thread view, when the caller has it. * * Held as a whole message rather than an id because it is the authority on * whether the thread is followed — a reply arriving over the socket carries no * subscription flag and has to inherit the parent's. */ private parentMessage; private isAgentChatMode; private messagesRequestBuilder; private hideGroupActionMessages; private messagesRequest; private nextMessagesRequest; private errorCallback; private customMessageTypes; private customMessageCategories; private replacedMessageTypes; private replacedMessageCategories; private readonly DEFAULT_MESSAGE_LIMIT; private readonly TYPING_INDICATOR_TIMEOUT; private readonly MAX_RETRY_ATTEMPTS; private readonly RETRY_DELAYS; private fetchGeneration; private retryAttempts; private translationCache; private offlineFooterSignal; /** * `connect_to_load_more` when an offline read could not go past the saved messages. * * @internal */ readonly offlineFooter: Signal; private offlineFooterRetryableSignal; /** * The footer shows and the connection is back: scrolling to that end loads * again, as tapping the footer does (UIK-READ-03). `false` while still offline. * * @internal */ readonly offlineFooterRetryable: Signal; private newestWindowResetSignal; /** * Offline: bumped when a PARTIAL sweep's refresh reset the list to the newest window (README §3.7). * * @internal */ readonly newestWindowReset: Signal; private heldReceipts; private offlinePathUsed; /** See {@link OfflineListContext.offlinePreviousExhausted}. */ private offlinePreviousExhausted; /** See {@link OfflineListContext.offlineBlocked}. */ private offlineBlocked; private connectionWatched; private readonly offlineConnectToLoadSignal; /** * Offline (D84 rule 3): the chat was read with no connection and nothing on screen, so the list shows * "Connect to load messages" in place of its error view (the app's own error view still wins; the error * state is set and `error` fired once). The first page is read once by itself when the connection is * back (rule 8). Always false with offline off. * * @internal */ readonly offlineConnectToLoad: Signal; /** See {@link OfflineListContext.offlineReloadOnConnect}: the same state as {@link offlineConnectToLoad}. */ private get offlineReloadOnConnect(); private set offlineReloadOnConnect(value); private readonly edgeReloadSubject; /** * Offline (D84 rule 9): the connection is back while an edge shows "Connect to load more"; the list * loads that page once by itself. Never emits with offline off. * * @internal */ readonly edgeReload$: Observable; private readonly loadErrorSubject; /** * Offline (D83): a first-page load the user or app started failed while messages were on screen. * The rows stay; the list's `error` output reports it. Never emits with offline off. * * @internal */ readonly loadError$: Observable; /** * Offline (D83): report a failed load over rows on screen (see {@link loadError$}). * * @internal */ reportLoadError(error: unknown): void; private offlineSubscriptions; private applyReceiptToMessage; private buildMessagesRequest; private buildNextMessagesRequest; private getDefaultMessageTypes; private getDefaultMessageCategories; readonly messages: Signal; readonly allMessages: Signal; readonly loadingState: Signal; readonly errorState: Signal; readonly prevMessageId: Signal; readonly nextMessageId: Signal; readonly unreadCount: Signal; readonly connectionStatus: Signal<'connected' | 'disconnected'>; readonly typingUsers: Signal>; readonly messages$: Observable; readonly loadingState$: Observable; readonly errorState$: Observable; constructor(); /** * Subscribe to the offline hub. With offline off the hub never emits, so * none of these handlers runs and the list behaves exactly as before. */ private setupOfflineStreams; /** The SDK rebuilt its offline cache: reload this chat from scratch, two-phase. */ private reloadAfterOfflineReset; /** * Kill switch (UIK-LIFE-03): when offline support has been switched off under * un-acked rows, they turn failed (direct) with one notice. Runs only for a * list that used the offline path. * * @internal */ checkKillSwitch(): void; /** * Watch the connection. Subscribed on the first ON-path operation, so an offline-off list adds * no listener. Two things follow it: * - "The next connection event" of UIK-LIFE-03: the kill-switch check. * - A reconnect (taken from the SDK's connect events): the list's own reconnect handler runs, * which reads the first page once by itself when the error view is up because the device * was offline (D83), and lets a "Connect to load more" footer load on scroll. */ private watchConnection; /** * The realtime connection is back (offline on). A "Connect to load more" row now loads on scroll as * well as on tap (UIK-READ-03), and the page behind it loads once by itself (D84 rule 9): the list * hears {@link edgeReload$} and reads each blocked edge, the older one first. * * @internal */ markOfflineConnected(): void; /** * The edges that show "Connect to load more" (the older one, the newer one, or both). * * @internal */ offlineBlockedEdges(): { previous: boolean; next: boolean; }; /** * Offline (D83), on reconnect: the error view is up because the device was offline, so the * first page is read once by itself. Returns whether that read was started. * * @internal */ reloadAfterOfflineError(): Promise; /** * The edge a tap on "Connect to load more" reads: the older one, unless only the newer one was blocked. * * @internal */ offlineRetryDirection(): 'previous' | 'next'; /** * Retry the "Connect to load more" row's read. With a `direction` (the reload on reconnect, which * reads each blocked edge in turn) the other edge keeps its mark until its own read runs. * * @internal */ retryOfflineRead(direction?: 'previous' | 'next'): Promise; cleanup(): void; private resetState; private regenerateListenerIds; private normalizeMessageId; private removeMessageListener; private removeGroupListener; private removeCallListener; private removeConnectionListener; private removeSentMessageListener; private removeEditedMessageListener; getMessageListenerId(): string; getGroupListenerId(): string; getCallListenerId(): string; getConnectionListenerId(): string; setUser(user: CometChat.User): void; setGroup(group: CometChat.Group): void; clearConversation(): void; setIsAgentChat(value: boolean): void; setParentMessageId(parentMessageId: number | null): void; /** * Hand the list the thread's parent message. Purely for subscription state — * scoping still runs off `parentMessageId`, which the caller derives from the * same message — so this never rebuilds the request. */ setParentMessage(parentMessage: CometChat.BaseMessage | null): void; updateParentMessageIdInPlace(parentMessageId: number): void; setMessagesRequestBuilder(builder: CometChat.MessagesRequestBuilder | null): void; setHideGroupActionMessages(hide: boolean): void; addCustomMessageTypes(types: string[]): void; addCustomMessageCategories(categories: string[]): void; removeCustomMessageTypes(types: string[]): void; removeCustomMessageCategories(categories: string[]): void; setMessageTypes(types: string[] | null): void; setMessageCategories(categories: string[] | null): void; getAllMessageTypes(): string[]; getAllMessageCategories(): string[]; setErrorCallback(callback: ErrorCallback | null): void; private clearMessagesAndState; fetchPreviousMessages(): Promise; fetchNextMessages(): Promise; fetchMessagesAroundId(messageId: number): Promise; /** Returns the current fetch generation — used by fetchWithUnreadPivot to detect stale async calls. */ getFetchGeneration(): number; private deduplicateMessages; private isRecoverableError; private isRecoverableErrorMessage; private getUserFriendlyErrorMessage; private delay; private handleErrorWithRetry; clearError(): void; setLoadingState(value: boolean): void; addMessage(message: CometChat.BaseMessage): void; updateMessageById(messageId: number, message: CometChat.BaseMessage): boolean; updateMessageByMuid(muid: string, message: CometChat.BaseMessage): boolean; deleteMessage(messageId: number): boolean; editMessage(message: CometChat.BaseMessage, newText: string): Promise; removeMessage(messageId: number): boolean; getMessageById(messageId: number): CometChat.BaseMessage | undefined; updateReplyCount(parentMessageId: number, count: number): boolean; updateMessageReactions(messageId: number, reactions: CometChat.ReactionCount[]): boolean; addReaction(messageId: number, emoji: string): Promise; removeReaction(messageId: number, emoji: string): Promise; fetchReactions(messageId: number, builder?: CometChat.ReactionsRequestBuilder): Promise; markAsRead(message: CometChat.BaseMessage): Promise; /** * Clear the conversation's unread count on the SERVER. * * Skipped inside a thread: a thread is not a conversation of its own, and * reading replies must not mark the parent chat read — the same guard React * applies via `parentMessageId`. */ markConversationAsRead(): Promise; markInitialMessagesAsRead(): Promise; updateLocalReadStatus(messageIds: number[]): void; markAsDelivered(message: CometChat.BaseMessage): Promise; getMessagesInRange(startIndex: number, endIndex: number): CometChat.BaseMessage[]; getTotalMessageCount(): number; clearMessages(): void; markAsUnread(message: CometChat.BaseMessage): Promise; private isRetryableError; private setupSentMessageListener; private setupEditedMessageListener; private handleEditedMessage; private handleSentMessage; private updateSentMessageByMuid; private updateSentMessageReplyCount; private setupMessageListener; private isMessageForCurrentConversation; private acceptsSweptRow; handleNewMessage(message: CometChat.BaseMessage): void; /** * Reconcile a realtime reply's subscription flag against the held parent. * * A no-op for anything that isn't a thread reply, and harmless without a * logged-in user — a mention can only match a uid we know. */ private applyIncomingReplySubscription; private isThreadReplyForCurrentConversation; handleMessageEdited(message: CometChat.BaseMessage): void; handleMessageDeleted(message: CometChat.BaseMessage): void; handleReceipt(receipt: CometChat.MessageReceipt, isGroupReceipt: boolean): void; handleReactionEvent(reactionEvent: CometChat.ReactionEvent, action: 'added' | 'removed'): void; private setupGroupListener; private setupCallListener; private setupConnectionListener; setConnectionStatus(status: 'connected' | 'disconnected'): void; handleGroupAction(message: CometChat.Action, group: CometChat.Group): void; handleCallAction(call: CometChat.Call): void; handleReconnection(): Promise; handleTypingStarted(indicator: CometChat.TypingIndicator): void; handleTypingEnded(indicator: CometChat.TypingIndicator): void; private clearTypingIndicator; private isTypingIndicatorForCurrentConversation; translateMessage(message: CometChat.BaseMessage, language: string): Promise; getCachedTranslation(messageId: number, language: string): string | undefined; clearTranslationCache(): void; flagMessage(message: CometChat.BaseMessage, reasonId: string, remark?: string): Promise; } /** * Default message types fetched by the MessageList when no custom * `messagesRequestBuilder` is supplied. Exported so consumers can derive their * own type list (e.g. keep all defaults but drop a single extension): * * const types = DEFAULT_MESSAGE_TYPES.filter(t => t !== 'extension_poll'); */ declare const DEFAULT_MESSAGE_TYPES: readonly string[]; /** * Default message categories fetched by the MessageList when no custom * `messagesRequestBuilder` is supplied. Includes the `action` category, which * the MessageList omits at runtime when `hideGroupActionMessages` is set. */ declare const DEFAULT_MESSAGE_CATEGORIES: readonly string[]; /** * Types for MessageBubbleConfigService. */ /** * Type representing the different parts of a message bubble that can be customized. */ type BubblePart = 'bubbleView' | 'contentView' | 'bottomView' | 'footerView' | 'leadingView' | 'headerView' | 'statusInfoView' | 'replyView' | 'threadView'; /** * Type for message type key combining type and category. * Format: "{type}_{category}" e.g., "text_message", "image_message" */ type MessageTypeKey = string; /** * Map of bubble parts to their view templates. */ interface BubblePartMap { bubbleView?: TemplateRef | null; contentView?: TemplateRef | null; bottomView?: TemplateRef | null; footerView?: TemplateRef | null; leadingView?: TemplateRef | null; headerView?: TemplateRef | null; statusInfoView?: TemplateRef | null; replyView?: TemplateRef | null; threadView?: TemplateRef | null; } /** * MessageBubbleConfigService * * Centralized service for configuring message bubble views globally or per message type. * Maintains two maps: typeViewMap (type-specific) and globalViewMap (global fallback). * Priority: type-specific > global > null (default rendering). * * @Injectable providedIn: 'root' */ declare class MessageBubbleConfigService { /** Type-specific view configurations. Key: MessageTypeKey, Value: BubblePartMap */ private typeViewMap; /** Global view configurations used as fallbacks. */ private globalViewMap; /** Reactive signal that increments whenever any configuration changes. */ readonly configVersion: _angular_core.WritableSignal; /** Observable that emits whenever any configuration changes. */ readonly configChanged$: Subject; constructor(); /** * Sets a bubble view for a specific message type. * * This method allows you to customize how specific parts of the message bubble * are rendered for a particular message type. Type-specific views take priority * over global views when retrieving configurations. * * @param messageType - The message type key (e.g., "text_message", "image_message") * @param partMap - Map of bubble parts to their view templates * * @example * ```typescript * // Customize content view for text messages * this.bubbleConfigService.setBubbleView('text_message', { * contentView: this.customTextContentTemplate, * footerView: this.customFooterTemplate, * }); * * // Customize multiple parts for image messages * this.bubbleConfigService.setBubbleView('image_message', { * contentView: this.imageContentTemplate, * headerView: this.imageHeaderTemplate, * }); * ``` * * @see {@link getView} for retrieving configured views * @see {@link BubblePartMap} for available bubble parts * */ setBubbleView(messageType: MessageTypeKey, partMap: BubblePartMap): void; /** * Sets a global view that applies to all message types. * * Global views serve as fallbacks when no type-specific view is configured * for a particular message type and bubble part. This is useful for applying * consistent customizations across all message types. * * @param part - The bubble part to set (e.g., "footerView", "statusInfoView") * @param view - The template to use, or null to clear the global view for this part * * @example * ```typescript * // Set a global footer view for all message types * this.bubbleConfigService.setGlobalView('footerView', this.customFooterTemplate); * * // Set a global status info view * this.bubbleConfigService.setGlobalView('statusInfoView', this.customStatusTemplate); * * // Clear a global view * this.bubbleConfigService.setGlobalView('footerView', null); * ``` * * @see {@link setGlobalViews} for setting multiple global views at once * @see {@link setBubbleView} for setting type-specific views * @see {@link getView} for retrieving configured views * */ setGlobalView(part: BubblePart, view: TemplateRef | null): void; /** * Sets multiple global views at once. * * This method allows batch configuration of global views, which is more * convenient when setting up multiple customizations at once. The provided * part map is merged with existing global views, allowing incremental updates. * * @param partMap - Map of bubble parts to their view templates * * @example * ```typescript * // Set multiple global views at once * this.bubbleConfigService.setGlobalViews({ * footerView: this.customFooterTemplate, * statusInfoView: this.customStatusTemplate, * leadingView: this.customAvatarTemplate, * }); * * // Clear multiple global views * this.bubbleConfigService.setGlobalViews({ * footerView: null, * statusInfoView: null, * }); * ``` * * @see {@link setGlobalView} for setting a single global view * @see {@link setBubbleView} for setting type-specific views * @see {@link getView} for retrieving configured views * */ setGlobalViews(partMap: BubblePartMap): void; /** * Gets the configured view for a specific message type and bubble part. * * This method implements the priority logic for view resolution: * 1. First, check if a type-specific view is configured for the given message type and part * 2. If not found, fall back to the global view for that part * 3. If neither is configured, return null (component should use default rendering) * * @param messageType - The message type key (e.g., "text_message", "image_message") * @param part - The bubble part to retrieve (e.g., "contentView", "footerView") * @returns The configured TemplateRef for the specified part, or null if not configured * * @example * ```typescript * // Get content view for text messages * const contentView = this.bubbleConfigService.getView('text_message', 'contentView'); * * // Use in component template * if (contentView) { * // Use custom template * } else { * // Use default rendering * } * ``` * * @see {@link setBubbleView} for setting type-specific views * @see {@link setGlobalView} for setting global views * */ getView(messageType: MessageTypeKey, part: BubblePart): TemplateRef | null; /** * Sets multiple message templates at once. * * This method allows batch configuration of multiple message types in a single call, * which is more efficient and convenient when setting up customizations for multiple * message types at once. Each template in the record is merged with any existing * configuration for that message type. * * @param templates - Record of message type keys to their part maps * * @example * ```typescript * // Configure multiple message types at once * this.bubbleConfigService.setMessageTemplates({ * 'text_message': { * contentView: this.textContentTemplate, * footerView: this.textFooterTemplate, * }, * 'image_message': { * contentView: this.imageContentTemplate, * headerView: this.imageHeaderTemplate, * }, * 'video_message': { * contentView: this.videoContentTemplate, * }, * }); * ``` * * @see {@link setBubbleView} for setting a single message type configuration * @see {@link clearAll} for clearing all configurations * */ setMessageTemplates(templates: Record): void; /** * Clears all configurations (both type-specific and global views). * * This method resets the service to its initial state, removing all configured * views. After calling this method, `getView()` will return null for all * message types and bubble parts until new configurations are set. * * This is useful when: * - Resetting the UI to default rendering * - Switching between different configuration presets * - Cleaning up before applying a completely new configuration * * @example * ```typescript * // Clear all configurations * this.bubbleConfigService.clearAll(); * * // After clearing, getView returns null * const view = this.bubbleConfigService.getView('text_message', 'contentView'); * console.log(view); // null * ``` * * @see {@link clearType} for clearing a specific message type * @see {@link clearGlobalViews} for clearing only global views * */ clearAll(): void; /** * Clears configuration for a specific message type. * * This method removes all view configurations for the specified message type, * while leaving configurations for other message types and global views intact. * After calling this method, `getView()` for the cleared message type will * fall back to global views (if configured) or return null. * * @param messageType - The message type key to clear (e.g., "text_message") * * @example * ```typescript * // Clear only text message configuration * this.bubbleConfigService.clearType('text_message'); * * // Text messages now use global views or defaults * const textView = this.bubbleConfigService.getView('text_message', 'contentView'); * // Returns global view if set, otherwise null * * // Other message types are unaffected * const imageView = this.bubbleConfigService.getView('image_message', 'contentView'); * // Returns previously configured view * ``` * * @see {@link clearAll} for clearing all configurations * @see {@link clearGlobalViews} for clearing only global views * */ clearType(messageType: MessageTypeKey): void; /** * Clears all global views. * * This method removes all global view configurations while leaving type-specific * configurations intact. After calling this method, message types without * type-specific configurations will use default rendering. * * This is useful when: * - Removing global customizations while keeping type-specific ones * - Resetting to type-specific-only configuration * * @example * ```typescript * // Clear all global views * this.bubbleConfigService.clearGlobalViews(); * * // Type-specific views are still available * const textView = this.bubbleConfigService.getView('text_message', 'contentView'); * // Returns type-specific view if configured * * // Global fallback is now null * const audioView = this.bubbleConfigService.getView('audio_message', 'footerView'); * // Returns null if no type-specific view was set * ``` * * @see {@link clearAll} for clearing all configurations * @see {@link clearType} for clearing a specific message type * */ clearGlobalViews(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * FormatterConfigService manages default text formatters (mentions, markdown, URLs). * Singleton by default. Supports custom formatters, additional formatters, and context configuration. * @Injectable providedIn: 'root' * @see Requirements 11.1-11.6 */ declare class FormatterConfigService { private defaultMentionsFormatter; private defaultMarkdownFormatter; private defaultUrlFormatter; private customFormatters; private additionalFormatters; constructor(); /** Get the default text formatters. @see Requirements 11.1-11.3, 11.6 */ getDefaultFormatters(): CometChatTextFormatter[]; /** * Set custom formatters to replace the defaults. * * This method replaces the built-in default formatters (mentions + URLs) * with the provided custom formatters. The custom formatters will be used * by all components that call getDefaultFormatters(). * * To reset to built-in defaults, call resetToDefaults(). * * @param formatters - Array of custom formatters to use as defaults * @see Requirements 11.4 * * @example * ```typescript * // Replace defaults with custom formatters * const customFormatters = [ * new MyCustomMentionsFormatter(), * new MyCustomUrlFormatter(), * new HashtagFormatter() * ]; * this.formatterConfig.setDefaultFormatters(customFormatters); * ``` */ setDefaultFormatters(formatters: CometChatTextFormatter[]): void; /** Add additional formatters to the default set. @see Requirements 11.5 */ addFormatters(formatters: CometChatTextFormatter[]): void; /** Reset to built-in default formatters. @see Requirements 11.6 */ resetToDefaults(): void; /** Get formatters configured with logged-in user and alignment context. @see Requirements 11.2, 11.3 */ getFormattersWithContext(loggedInUser?: CometChat.User, alignment?: MessageBubbleAlignment): CometChatTextFormatter[]; private getBuiltInDefaults; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * HtmlSanitizerService * * Centralized HTML sanitization service using DOMPurify. * Allows only safe HTML tags/attributes, prevents XSS attacks. * Caches up to 1000 sanitized strings (LRU eviction). * Ensures links have target="_blank" and rel="noopener noreferrer". * * @Injectable providedIn: 'root' * @see Requirements 13.1-13.6 */ declare class HtmlSanitizerService { private sanitizationCache; private readonly MAX_CACHE_SIZE; private readonly DEFAULT_CONFIG; constructor(); /** Sanitize HTML with default configuration. Results are cached. @see Requirements 13.1-13.6 */ sanitize(html: string): string; /** Sanitize HTML with custom configuration. Results are NOT cached. @see Requirements 13.1 */ sanitizeWithConfig(html: string, config: Config): string; getDefaultConfig(): Config; /** * Escape HTML entities in raw user text before formatter processing. * Preserves SDK mention patterns (`<@uid:...>` and `<@all:...>`). */ escapeUserHtml(text: string): string; /** * Whitespace-only input short-circuits to ''. Output that becomes * whitespace-only after sanitization (e.g. ' ; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * IncomingCallService * * Injectable service managing incoming call state, sound playback, * CometChat call listener registration, and active call tracking. * * ## Overview * * This service provides a single source of truth for incoming call state. * It registers a CometChat CallListener to receive real-time call events, * manages sound playback for incoming calls, and tracks active calls to * auto-reject with "busy" when the user is already on a call. * * ## Architecture * * - **Signals**: Provide synchronous, fine-grained reactivity for call state * - **CallListener**: Receives real-time call events from CometChat SDK * - **CometChatCallEvents**: RxJS subjects for call lifecycle events * - **CometChatSoundManager**: Static class for sound playback * * ## Usage * * ```typescript * export class MyComponent { * private incomingCallService = inject(IncomingCallService); * * currentCall = this.incomingCallService.incomingCall; * * async accept() { * const call = this.currentCall(); * if (call) { * await this.incomingCallService.acceptCall(call.getSessionId()); * } * } * } * ``` * * @Injectable providedIn: 'root' */ declare class IncomingCallService implements OnDestroy { /** * The current incoming call. * Set when an incoming call is received via CallListener or programmatically. * Cleared when the call is accepted, declined, cancelled, or ended. */ private _incomingCall; readonly incomingCall: _angular_core.Signal<_cometchat_chat_sdk_javascript.Call | null>; /** * The currently active call (ongoing or outgoing). * Used to determine if the user is already on a call. * When set, new incoming calls are auto-rejected with "busy" status. */ private _activeCall; readonly activeCall: _angular_core.Signal<_cometchat_chat_sdk_javascript.Call | null>; /** * When true, incoming call ringtone is not played. */ private _disableSoundForCalls; readonly disableSoundForCalls: _angular_core.Signal; /** * Custom sound URL for the incoming call ringtone. * When empty, the default ringtone is used. */ private _customSoundForCalls; readonly customSoundForCalls: _angular_core.Signal; private readonly listenerId; private subscriptions; constructor(); /** * Sets the current incoming call. * @param call - The incoming call object, or null to clear */ setIncomingCall(call: CometChat.Call | null): void; /** * Sets the active call (ongoing or outgoing). * @param call - The active call object, or null to clear */ setActiveCall(call: CometChat.Call | null): void; /** * Enables or disables the incoming call ringtone. * @param disable - True to disable sound, false to enable */ setDisableSoundForCalls(disable: boolean): void; /** * Sets a custom sound URL for the incoming call ringtone. * @param url - The custom sound URL, or empty string for default */ setCustomSoundForCalls(url: string): void; /** * Plays the incoming call ringtone (looping). * Respects the disableSoundForCalls and customSoundForCalls configuration. * * @see Requirement 2.1 - Play ringtone when call is set and sound is enabled * @see Requirement 2.2 - Use custom sound URL when configured * @see Requirement 2.3 - Skip playback when sound is disabled */ playIncomingSound(): void; /** * Stops the currently playing incoming call ringtone. * * @see Requirement 2.4 - Pause ringtone on accept, decline, cancel, or destroy */ stopIncomingSound(): void; /** * Accepts an incoming call. * * Calls CometChat.acceptCall() with the session ID, emits ccCallAccepted * via CometChatCallEvents, emits ccShowOngoingCall via CometChatUIEvents, * sets the active call, and clears the incoming call. * * @param sessionId - The call session ID * @returns The accepted call object * @throws CometChat.CometChatException on SDK error * * @see Requirement 3.3 - Default accept behavior * @see Requirement 5.2 - Set active call after accept */ acceptCall(sessionId: string): Promise; /** * Declines an incoming call. * * Calls CometChat.rejectCall() with the session ID and "rejected" status, * emits ccCallRejected via CometChatCallEvents, and clears the incoming call. * * @param sessionId - The call session ID * @throws CometChat.CometChatException on SDK error * * @see Requirement 4.3 - Default decline behavior */ declineCall(sessionId: string): Promise; /** * Registers a CometChat CallListener to receive real-time call events. * * @see Requirement 5.1 - Register CallListener on init */ private registerCallListener; /** * Subscribes to CometChatCallEvents for call lifecycle events. * * @see Requirement 5.5 - Clear state on ccCallEnded * @see Requirement 5.6 - Track outgoing call as active */ private subscribeToCallEvents; /** * Handles an incoming call received via CallListener. * * If no active call exists, sets the incoming call and plays the ringtone. * If an active call exists, auto-rejects the new call with "busy" status. * * @param call - The incoming call object */ private handleIncomingCall; /** * Handles an incoming call cancelled by the caller. * Clears the incoming call state and pauses the ringtone. * * @param call - The cancelled call object */ private handleIncomingCallCancelled; /** * Removes the call listener and unsubscribes from all event subscriptions. * * @see Requirement 5.7 - Cleanup on destroy */ ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * OutgoingCallService * * Injectable service managing outgoing call state, sound playback, * and configuration for the outgoing call UI. * * ## Overview * * This service provides a single source of truth for outgoing call state. * It manages sound playback for outgoing calls and exposes reactive signals * for call state and configuration that any component can consume. * * ## Architecture * * - **Signals**: Provide synchronous, fine-grained reactivity for call state * - **CometChatSoundManager**: Static class for sound playback * * ## Usage * * ```typescript * export class MyComponent { * private outgoingCallService = inject(OutgoingCallService); * * currentCall = this.outgoingCallService.activeCall; * * startCall(call: CometChat.Call) { * this.outgoingCallService.setActiveCall(call); * this.outgoingCallService.playOutgoingSound(); * } * * cancelCall() { * this.outgoingCallService.stopOutgoingSound(); * this.outgoingCallService.setActiveCall(null); * } * } * ``` * * @Injectable providedIn: 'root' */ declare class OutgoingCallService { /** * The current outgoing call. * Set when an outgoing call is initiated. * Cleared when the call is accepted, rejected, cancelled, or ended. * * @see Requirement 5.2 - Expose active call as a signal */ private _activeCall; readonly activeCall: _angular_core.Signal<_cometchat_chat_sdk_javascript.Call | null>; /** * When true, outgoing call ringtone is not played. * * @see Requirement 2.3 - Skip playback when sound is disabled */ private _disableSoundForCalls; readonly disableSoundForCalls: _angular_core.Signal; /** * Custom sound URL for the outgoing call ringtone. * When empty, the default ringtone is used. * * @see Requirement 2.2 - Use custom sound URL when configured */ private _customSoundForCalls; readonly customSoundForCalls: _angular_core.Signal; /** * Sets the current outgoing call. * @param call - The outgoing call object, or null to clear * * @see Requirement 5.2 - Signal reflects active call */ setActiveCall(call: CometChat.Call | null): void; /** * Enables or disables the outgoing call ringtone. * @param disable - True to disable sound, false to enable * * @see Requirement 2.3 - Disable sound flag */ setDisableSoundForCalls(disable: boolean): void; /** * Sets a custom sound URL for the outgoing call ringtone. * @param url - The custom sound URL, or empty string for default * * @see Requirement 2.2 - Custom sound URL */ setCustomSoundForCalls(url: string): void; /** * Plays the outgoing call ringtone (looping). * Respects the disableSoundForCalls and customSoundForCalls configuration. * * @see Requirement 2.1 - Play ringtone when call is set and sound is enabled * @see Requirement 2.2 - Use custom sound URL when configured * @see Requirement 2.3 - Skip playback when sound is disabled */ playOutgoingSound(): void; /** * Stops the currently playing outgoing call ringtone. * * @see Requirement 2.4 - Pause ringtone on destroy or call cleared */ stopOutgoingSound(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * CallButtonsService manages call state, call initiation, call listener registration, * event subscriptions, and button disabled state for the call buttons component. * @Injectable providedIn: 'root' */ declare class CallButtonsService implements OnDestroy { private _activeCall; readonly activeCall: _angular_core.Signal<_cometchat_chat_sdk_javascript.Call | null>; private _sessionId; readonly sessionId: _angular_core.Signal; private _buttonsDisabled; readonly buttonsDisabled: _angular_core.Signal; private _showOutgoingCallScreen; readonly showOutgoingCallScreen: _angular_core.Signal; private _showOngoingCall; readonly showOngoingCall: _angular_core.Signal; private _loggedInUser; readonly loggedInUser: _angular_core.Signal<_cometchat_chat_sdk_javascript.User | null>; private _activeUser; readonly activeUser: _angular_core.Signal<_cometchat_chat_sdk_javascript.User | null>; private _activeGroup; readonly activeGroup: _angular_core.Signal<_cometchat_chat_sdk_javascript.Group | null>; private _isGroupAudioCall; readonly isGroupAudioCall: _angular_core.Signal; private _isDirectCalling; readonly isDirectCalling: _angular_core.Signal; private readonly listenerId; private subscriptions; private initialized; /** Initializes the service. Should be called once when the component initializes. @see Requirement 6.1 */ initialize(): void; /** Sets the active user target. Clears active group. @see Requirement 6.3 */ setActiveUser(user: CometChat.User | null): void; /** Sets the active group target. Clears active user. @see Requirement 6.3 */ setActiveGroup(group: CometChat.Group | null): void; /** Initiates an audio call. @see Requirements 2.1, 3.1 */ initiateAudioCall(): Promise; /** Initiates a video call. @see Requirements 2.2, 3.2 */ initiateVideoCall(): Promise; /** Cancels the current outgoing user call. @see Requirement 5.2 */ cancelOutgoingCall(): Promise; /** Resets all call state to defaults. @see Requirement 4.5 */ resetCallState(): void; /** Joins an ongoing group meeting from a call bubble message. */ joinMeeting(sessionId: string, isAudioOnly?: boolean): void; /** * Initiates a user-to-user call. * Creates a CometChat.Call object, calls CometChat.initiateCall(), * stores the returned call, shows the outgoing call screen, and emits ccOutgoingCall. * * @param type - The call type ('audio' or 'video') * @see Requirement 2.1 - Create call object with audio type * @see Requirement 2.2 - Create call object with video type */ private initiateUserCall; /** * Sends a custom "meeting" message for group calls. * Creates a CustomMessage with meeting type, custom data containing * session ID and call type, metadata with incrementUnreadCount, * and emits ccMessageSent events. * * @param callType - The call type ('audio' or 'video') * @see Requirement 3.1 - Group audio call meeting message * @see Requirement 3.2 - Group video call meeting message * @see Requirement 3.3 - Meeting message structure */ private sendCustomMeetingMessage; /** * Registers a CometChat CallListener to receive real-time call events. * * @see Requirement 6.1 - Register CallListener on init */ private registerCallListener; /** * Subscribes to CometChatCallEvents for call lifecycle events. * * @see Requirement 4.3 - Enable buttons on ccCallRejected * @see Requirement 4.1 - Disable buttons on ccOutgoingCall * @see Requirement 4.5 - Reset state on ccCallEnded */ private subscribeToCallEvents; /** * Removes the call listener and unsubscribes from all event subscriptions. * * @see Requirement 6.2 - Cleanup on destroy */ ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * OngoingCallService manages ongoing call session state and configuration. * Handles session ID, call workflow type, call activity status, and call settings. * @Injectable providedIn: 'root' */ declare class OngoingCallService { private _sessionID; readonly sessionID: _angular_core.Signal; private _callWorkflow; readonly callWorkflow: _angular_core.Signal; private _isCallActive; readonly isCallActive: _angular_core.Signal; private _callSettingsBuilder; readonly callSettingsBuilder: _angular_core.Signal | null>; private _isAudioOnly; readonly isAudioOnly: _angular_core.Signal; /** Sets the current call session ID. @see Requirement 1.6 */ setSessionID(sessionID: string): void; /** Sets the call workflow type. @see Requirement 1.6 */ setCallWorkflow(workflow: CallWorkflow): void; /** Sets a custom session settings object. @see Requirement 1.6 */ setCallSettingsBuilder(builder: Record | null): void; /** Sets whether the current call is audio-only. */ setIsAudioOnly(isAudioOnly: boolean): void; /** Builds and returns a v5 SessionSettings plain object. @see Requirements 3.1, 3.2 */ getCallSettings(_sessionID: string, _onError?: Function): any; private _eventUnsubscribers; private _chatCallListenerId; /** Registers v5 granular event listeners for the current call session. */ private registerSessionEventListeners; private removeSessionEventListeners; private removeChatCallListener; /** Starts an ongoing call session. @see Requirements 1.2, 11.1, 11.2 */ startCall(callScreenFrame: HTMLElement, onError?: Function): Promise; /** Ends the current call session (local cleanup only). @see Requirement 1.3 */ endSession(): void; /** Ends the current call and cleans up the session. @see Requirements 1.4, 1.5, 11.3 */ endCall(onError?: Function): Promise; private toCometchatException; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Error callback type for propagating errors to the component. */ type GroupMembersErrorCallback = (error: CometChat.CometChatException) => void; /** * GroupMembersService * * Service responsible for managing group member state and SDK interactions. * NOT `providedIn: 'root'` — instantiated per component instance to avoid * shared state between multiple group member lists. * * Uses Angular Signals for reactive state management. */ declare class GroupMembersService { private membersSignal; /** * Offline support (D83): bumped when a load the kit started itself (a cache-reset or * reconnect reload) has settled, so the component redraws from this service. Never * changes with offline off. */ private readonly offlineSettledSignal; readonly offlineSettled: _angular_core.Signal; /** * Offline (D84 rule 3): the list was read with no connection and nothing on screen, so * the kit shows "Connect to load members" in place of the error view (the app's own error * view still wins). `fetchState` is `error` and `error` fired once. Always false with * offline off. */ private readonly connectToLoadSignal; readonly connectToLoad: _angular_core.Signal; /** * Offline (D84 rule 7): a keyword search could not run with no connection and nothing is * saved for it, so the list says "Connect to search" (`fetchState` is `empty`, no * `error`). Only a real keyword is a search; a filter alone is the plain list. Always * false with offline off. */ private readonly connectToSearchSignal; readonly connectToSearch: _angular_core.Signal; private fetchStateSignal; private hasMoreSignal; readonly members: _angular_core.Signal<_cometchat_chat_sdk_javascript.GroupMember[]>; readonly fetchState: _angular_core.Signal; readonly hasMore: _angular_core.Signal; private groupMembersRequest; private currentGroup; private errorCallback; private userListenerId; private groupListenerId; /** Guard: only re-fetch on reconnect after the first fetch has completed. */ private initialFetchDone; /** * Offline (D84): the offline state ("Connect to load members" or "Connect to search") is up * because the device was not connected, so the first page loads once by itself when the * connection is back. A non-network error never sets it. */ private reloadOnConnect; /** Offline: the server answered a page of the current request (the next read is a "load more"). */ private serverPageRead; /** The next offline read was started by the kit (cache reset, reconnect), not by the user or app. */ private automaticLoad; private connectionState; private destroyRef; /** Offline: logout / user switch clears the list, a cache reset reloads it (UIK-LIFE-01/02). */ private readonly offlineSession; /** What the current request was built from, to rebuild it after a cache reset. */ private lastBuild; private static readonly DEFAULT_LIMIT; constructor(); setErrorCallback(callback: GroupMembersErrorCallback | null): void; /** * Initialize the service with a group and optional custom request builder. * Creates the GroupMembersRequestBuilder and fetches the first page. */ initialize(group: CometChat.Group, builder?: CometChat.GroupMembersRequestBuilder): void; /** * Fetch the next page of group members from the SDK. * Appends results without duplicates. */ fetchNext(): Promise; /** * Search members by keyword. Resets the list and creates a new builder. */ search(keyword: string, searchBuilder?: CometChat.GroupMembersRequestBuilder): void; /** Kick a member from the group. Calls SDK, removes from list, emits ccGroupMemberKicked event. */ kickMember(group: CometChat.Group, member: CometChat.GroupMember): Promise; /** Ban a member from the group. Calls SDK, removes from list, emits ccGroupMemberBanned event. */ banMember(group: CometChat.Group, member: CometChat.GroupMember): Promise; /** Update a member's scope (role) in the group. Calls SDK, updates list, emits event. */ updateMemberScope(group: CometChat.Group, member: CometChat.GroupMember, newScope: string): Promise; removeMember(uid: string): void; updateMemberStatus(user: CometChat.User): void; updateMemberScopeInList(uid: string, newScope: CometChat.GroupMemberScope): void; appendMember(member: CometChat.GroupMember): void; appendMembersWithoutDuplicates(members: CometChat.GroupMember[]): void; attachListeners(groupGuid: string, hideUserStatus: boolean): void; private readonly offlineHubForSweep; private sweptGroupActions; detachListeners(): void; cleanup(): void; /** * Called by ConnectionStateService when the WebSocket reconnects. * Silently re-fetches page 1 without clearing the list or showing shimmer. * Resets hasMore to true so pagination works again from the new first page. */ private handleReconnect; private handleError; private toCometchatException; /** * Offline path of {@link fetchNext}: the cached page paints at once, the * server page then replaces it in place (D83). A failed load with nothing on * screen shows the error view and fires `onError` once; with rows on screen the * rows stay and `onError` fires once for a first-page load the user or app * started (never for a "load more" page, never for a load the kit started). */ private fetchNextOffline; /** Whether the read is a keyword search (D84 addition B): a filter alone is the plain list. */ private isKeywordSearch; private clearOfflineStates; /** Logout / user switch: nothing of the old session stays on screen. */ private clearForSession; /** * Offline on, on reconnect: a list showing the error view because the device was * offline loads its first page once by itself (D83); so does a list whose cached rows * are shown but whose first page never loaded (quietly). A non-network error is not * reloaded. A list that did load refreshes as before. */ private needsOfflineReload; /** The offline cache was rebuilt: read the first page again, cached then server. */ private reloadAfterReset; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * CallLogsService manages call log fetching, pagination, call initiation, * call listeners, and event subscriptions for the CometChatCallLogs component. * Not providedIn: 'root' — each component gets its own instance. */ declare class CallLogsService { private _callLogs; readonly callLogs: _angular_core.Signal; private _state; readonly state: _angular_core.Signal; private _hasMore; readonly hasMore: _angular_core.Signal; private _showOutgoingCallScreen; readonly showOutgoingCallScreen: _angular_core.Signal; private _showOngoingCall; readonly showOngoingCall: _angular_core.Signal; private _activeCallObject; readonly activeCallObject: _angular_core.Signal<_cometchat_chat_sdk_javascript.Call | null>; private _sessionId; readonly sessionId: _angular_core.Signal; private callLogRequest; private callLogRequestBuilder; private loggedInUser; private onError; private readonly listenerId; private subscriptions; private isFetching; /** Sets a custom CallLogRequestBuilder. @see Requirement 2.5 */ setCallLogRequestBuilder(builder: any): void; /** Sets the logged-in user (needed for default request builder). */ setLoggedInUser(user: CometChat.User): void; /** Sets the error callback. @see Requirements 7.1, 7.2 */ setOnError(callback: ((error: CometChat.CometChatException) => void) | null): void; /** Sets the current state. */ setState(state: States): void; /** Fetches the initial page of call logs. @see Requirements 1.1, 1.4-1.6 */ fetchCallLogs(): Promise; /** Fetches the next page of call logs. @see Requirement 1.3 */ fetchNextCallLogs(): Promise; /** Initiates a new call to the specified user. @see Requirements 3.1, 3.3 */ initiateCall(type: string, uid: string): Promise; /** Cancels the current outgoing call. @see Requirement 3.4 */ cancelOutgoingCall(): Promise; /** Initializes call listeners and event subscriptions. @see Requirements 4.1-4.3 */ initialize(): void; /** Removes the call listener and unsubscribes from all event subscriptions. @see Requirement 4.4 */ cleanup(): void; private handleError; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Formatter for URLs in text. * * Detects URL patterns (http://, https://, www.) in text and converts them * to clickable links. URLs are opened in a new tab with security attributes. * * @example * ```typescript * const formatter = new CometChatUrlFormatter(); * * // Format text with URLs * const formatted = formatter.format('Check out https://example.com for more info'); * * // Get detected URLs * const urls = formatter.getUrls(); * // ['https://example.com'] * ``` * * @see Requirements 23.1-23.5 */ declare class CometChatUrlFormatter extends CometChatTextFormatter { /** * Unique identifier for this formatter. * @see Requirements 5.1 */ readonly id = "url-formatter"; /** * Formatter priority (lower = earlier in pipeline). * URLs are processed with priority 10 (before mentions). * @see Requirements 5.5 */ priority: number; /** * Array of detected URLs from the last format() call * @private */ private urls; /** * Get the regex pattern for detecting URLs. * * Matches: * - http:// or https:// followed by non-whitespace characters * - www. followed by non-whitespace characters * * The pattern uses the global and case-insensitive flags. * * @returns RegExp pattern for URL detection */ getRegex(): RegExp; /** * Format the input text by detecting URLs and converting them to links. * * This method: * 1. Stores the original text * 2. Detects all URL patterns * 3. Converts URLs to clickable anchor tags * 4. Stores detected URLs in metadata * 5. Returns formatted text with clickable links * * Links are created with: * - target="_blank" to open in new tab * - rel="noopener noreferrer" for security * - class="cometchat-link" for styling * * @param text - The text to format * @returns The formatted text with clickable links */ format(text: string): string; /** * Get the array of detected URLs from the last format() call. * * @returns Array of URL strings detected in the text */ getUrls(): string[]; /** * Check if the text contains any URLs. * * @returns true if URLs were detected, false otherwise */ hasUrls(): boolean; /** * Reset the formatter state to initial values. * * Clears original text, formatted text, metadata, and detected URLs. */ reset(): void; } /** * Formatter for emoji shortcodes in text. * * Detects emoji shortcode patterns (e.g., :smile:, :heart:) in text and converts * them to their corresponding Unicode emoji characters. * * @example * ```typescript * const formatter = new CometChatEmojiFormatter(); * const formatted = formatter.format('Hello :smile: how are you :heart:'); * // Result: 'Hello 😊 how are you ❤️' * ``` */ declare class CometChatEmojiFormatter extends CometChatTextFormatter { readonly id = "emoji-formatter"; priority: number; private shortcodes; private customEmojiMap; /** Returns the regex pattern for detecting emoji shortcodes. */ getRegex(): RegExp; /** * Formats text by replacing emoji shortcodes with Unicode emoji characters. * Unrecognized shortcodes are left unchanged. */ format(text: string): string; /** Returns detected shortcodes from the last format() call. */ getShortcodes(): string[]; /** Returns true if shortcodes were detected and converted. */ hasShortcodes(): boolean; /** * Adds custom emoji shortcodes. Custom shortcodes take precedence over built-in ones. * @param emojiMap - Record mapping shortcode names to emoji characters */ addCustomEmoji(emojiMap: Record): void; /** Clears all custom emoji shortcodes. */ clearCustomEmoji(): void; /** * Returns the emoji for a specific shortcode (without colons). * @returns The emoji character or undefined if not found */ getEmoji(shortcode: string): string | undefined; /** * Returns true if the shortcode is recognized (built-in or custom). */ isValidShortcode(shortcode: string): boolean; reset(): void; } /** * CometChatMarkdownFormatter * * Formats markdown syntax in text messages to HTML. * Supports bold, italic, underline, strikethrough, inline code, code blocks, * blockquotes, ordered lists, unordered lists, and links. * * Markdown Syntax Supported: * - **bold** → bold * - *italic* → italic * - __underline__ → underline * - ~~strikethrough~~ → strikethrough * - `code` → code * - ```code block``` →
code block
* - > quote →
quote
* - 1. item →
  1. item
* - - item or * item →
  • item
* - [text](url) → text * * @see Requirements 2.1, 2.3, 2.4 */ declare class CometChatMarkdownFormatter extends CometChatTextFormatter { readonly id = "markdown-formatter"; priority: number; /** * Get the regex pattern for markdown detection. * This is a simple pattern that matches common markdown syntax. * @returns RegExp pattern */ getRegex(): RegExp; /** * Format markdown text to HTML * @param text - The text to format * @returns Formatted HTML text */ format(text: string): string; /** * Convert markdown to HTML * @param markdown - Markdown text * @returns HTML text * @private */ private markdownToHtml; /** * Pick the delimiter for tag placeholders: a private-use character absent from the input, * so a placeholder can never collide with user text and contains no markdown syntax. * @param text - The text being formatted * @returns A single character not present in text * @private */ private unusedPrivateUseChar; /** * Format blockquotes - group consecutive lines starting with > into a single blockquote * @param text - Text with markdown blockquotes * @returns Text with HTML blockquotes * @private */ private formatBlockquotes; /** * Format ordered lists with nested indentation support. * Indentation is 4 spaces per nesting level. * Nested ordered lists cycle: decimal → lower-alpha → lower-roman. * @param text - Text with markdown lists * @returns Text with HTML lists * @private */ private formatOrderedLists; /** * Format unordered lists with nested indentation support. * Indentation is 4 spaces per nesting level. * Nested unordered lists cycle: disc → circle → square. * @param text - Text with markdown lists * @returns Text with HTML lists * @private */ private formatUnorderedLists; /** * Check if this formatter should process the given text * @param text - The text to check * @returns Whether to apply this formatter */ shouldFormat(text: string): boolean; } /** * Result of applying the formatter pipeline. * Contains the formatted text and combined metadata from all formatters. */ interface FormatterPipelineResult { /** The final formatted text after all formatters have been applied */ text: string; /** Combined metadata from all formatters */ metadata: Record; /** Array of formatter IDs that were successfully applied */ appliedFormatters: string[]; /** Array of formatter IDs that encountered errors */ failedFormatters: string[]; } /** * Apply a pipeline of text formatters to the given text. * * This function: * 1. Sorts formatters by priority (lower priority number = earlier in pipeline) * 2. Applies each formatter's format() method in sequence * 3. Catches any errors from individual formatters and continues with the next one * 4. Returns the final formatted text along with combined metadata * * Formatters are applied in order of their `priority` property. Each formatter * receives the output of the previous formatter as its input. If a formatter * throws an error, the error is logged and the original text (from the previous * formatter) is passed to the next formatter. * * @param formatters - Array of CometChatTextFormatter instances to apply * @param text - The text to format * @param message - The message containing the text (optional, for context) * @param context - Additional context for formatters (optional) * @returns FormatterPipelineResult containing formatted text and metadata * * @example * ```typescript * const formatters = [ * new CometChatUrlFormatter(), // priority: 10 * new CometChatMentionsFormatter(), // priority: 20 * new CometChatEmojiFormatter(), // priority: 30 * ]; * * const result = applyFormatters(formatters, 'Hello @john :smile: https://example.com'); * // result.text contains formatted HTML with links, mentions, and emoji * // result.metadata contains { urls: [...], mentions: [...], shortcodes: [...] } * ``` * * @see Requirements 5.2, 5.4, 5.6 */ declare function applyFormatters(formatters: CometChatTextFormatter[], text: string, message?: CometChat.BaseMessage, context?: TextFormatterContext): FormatterPipelineResult; /** * Apply a pipeline of text formatters and return only the formatted text. * * This is a convenience function that wraps `applyFormatters` and returns * only the formatted text string, discarding metadata and tracking info. * * @param formatters - Array of CometChatTextFormatter instances to apply * @param text - The text to format * @param message - The message containing the text (optional) * @param context - Additional context for formatters (optional) * @returns The formatted text string * * @see Requirements 5.2, 5.4, 5.6 */ declare function formatText(formatters: CometChatTextFormatter[], text: string, message?: CometChat.BaseMessage, context?: TextFormatterContext): string; /** * Interface defining all global configuration properties. * All properties are optional (undefined means no global override). * * This interface is used with the COMETCHAT_GLOBAL_CONFIG InjectionToken * to provide centralized configuration management for UIKit components. * Components can read these values and apply them using a priority system * where @Input values take precedence over global config values. * * @example * ```typescript * // In app.config.ts or app.module.ts * import { COMETCHAT_GLOBAL_CONFIG, GlobalConfig } from '@cometchat/chat-uikit-angular'; * * export const appConfig: ApplicationConfig = { * providers: [ * { * provide: COMETCHAT_GLOBAL_CONFIG, * useValue: { * hideReceipts: true, * hideUserStatus: true, * showSearchBar: false, * disableSoundForMessages: true * } as GlobalConfig * } * ] * }; * ``` */ interface GlobalConfig { /** Hide read receipts across all components */ hideReceipts?: boolean; /** Hide error states across all components */ hideError?: boolean; /** Hide user online/offline status indicators */ hideUserStatus?: boolean; /** Hide group type badges (public/private/password) */ hideGroupType?: boolean; /** Show scrollbar in list components */ showScrollbar?: boolean; /** Show search bar in list components */ showSearchBar?: boolean; /** Disable sound notifications for messages */ disableSoundForMessages?: boolean; /** Text formatters for message rendering */ textFormatters?: CometChatTextFormatter[]; /** Disable right-click context menu across components */ disableDefaultContextMenu?: boolean; /** Disable sound for incoming/outgoing calls */ disableSoundForCalls?: boolean; /** Custom sound URL for calls */ customSoundForCalls?: string; /** Custom sound URL for messages */ customSoundForMessages?: string; /** Hide avatar across components */ hideAvatar?: boolean; /** * Enable the thread follow/unfollow surfaces — the control in the thread * header and the `Follow thread` option in the message action sheet. * * Defaults to **off**: there is no capability flag on the app settings a * client could feature-detect from, so whether the backend has the threads * endpoints deployed is something only the integrator knows. When off, * neither surface renders and no thread request is made, whatever the * per-component `hideThreadSubscription*` flags say. */ enableThreadSubscription?: boolean; /** * Force the Pin / Save surfaces on or off, overriding the app-level feature * flags the Chat SDK reports. * * Leave unset in production: the SDK's `isPinMessageEnabled()` / * `isSaveMessageEnabled()` read the app's own settings, which is the right * source of truth. This exists because those flags are provisioned * server-side — so before they are turned on for an app there is no way to * develop or demo against the feature at all, and "flag off" is * indistinguishable from "not built". */ enablePinMessage?: boolean; enableSaveMessage?: boolean; /** * Custom session settings object for call components (call buttons, call logs, etc.). * Pass a plain v5 SessionSettings object — the v4 CallSettingsBuilder is no longer used. * @example * { sessionType: 'VIDEO', layout: 'TILE', startAudioMuted: false } */ callSettingsBuilder?: Record; } /** * InjectionToken for providing global configuration at application bootstrap. * * Use this token to declaratively configure CometChat UIKit components * in your application's providers array. The configuration is static * and set once at application startup. * * Priority System: * 1. @Input value (if explicitly set on component) * 2. Global config value (from this token) * 3. Component's internal default value * * @example * ```typescript * // In app.config.ts (standalone) * import { COMETCHAT_GLOBAL_CONFIG } from '@cometchat/chat-uikit-angular'; * * export const appConfig: ApplicationConfig = { * providers: [ * { * provide: COMETCHAT_GLOBAL_CONFIG, * useValue: { * hideReceipts: true, * hideUserStatus: true, * showSearchBar: false, * disableSoundForMessages: true * } * } * ] * }; * ``` * * @example * ```typescript * // In app.module.ts (NgModule) * @NgModule({ * providers: [ * { * provide: COMETCHAT_GLOBAL_CONFIG, * useValue: { * hideReceipts: true, * showSearchBar: false * } * } * ] * }) * export class AppModule {} * ``` * * @example * ```typescript * // Using factory for dynamic configuration * { * provide: COMETCHAT_GLOBAL_CONFIG, * useFactory: (envService: EnvironmentService) => ({ * hideReceipts: envService.isProduction, * showSearchBar: true * }), * deps: [EnvironmentService] * } * ``` */ declare const COMETCHAT_GLOBAL_CONFIG: InjectionToken>; /** * Configuration for focus trap behavior */ interface FocusTrapConfig { /** The container element to trap focus within */ container: HTMLElement; /** Where to set initial focus: 'first' focusable, 'container', or specific element */ initialFocus?: HTMLElement | 'first' | 'container'; /** Whether to restore focus to previous element on deactivate (default: true) */ returnFocusOnDeactivate?: boolean; } /** * FocusTrapService manages focus trapping within modal components. * * Focus trapping ensures that Tab and Shift+Tab navigation cycles within * a container element, preventing focus from escaping to elements outside * the modal. This is essential for accessibility in dialogs, popovers, * and other modal components. * * @example * ```typescript * // In a dialog component * @ViewChild('dialogContainer') dialogContainer!: ElementRef; * * constructor(private focusTrapService: FocusTrapService) {} * * openDialog(): void { * this.focusTrapService.activate({ * container: this.dialogContainer.nativeElement, * initialFocus: 'first', * returnFocusOnDeactivate: true * }); * } * * closeDialog(): void { * this.focusTrapService.deactivate(this.dialogContainer.nativeElement); * } * ``` */ declare class FocusTrapService { private activeTraps; /** * Activates focus trap within a container. * * When activated, Tab and Shift+Tab navigation will cycle within the * container's focusable elements. The previously focused element is * stored for restoration when the trap is deactivated. * * @param config - Configuration for the focus trap */ activate(config: FocusTrapConfig): void; /** * Deactivates focus trap and optionally restores focus. * * Removes the keydown listener and restores focus to the element * that was focused before the trap was activated (if configured). * * @param container - The container element to deactivate the trap for */ deactivate(container: HTMLElement): void; /** * Checks if a container has an active focus trap. * * @param container - The container element to check * @returns boolean - true if the container has an active focus trap */ isActive(container: HTMLElement): boolean; /** * Checks if any focus trap is currently active. * * Useful for parent components (e.g., message list) to determine * whether keyboard events should be suppressed because an overlay * with a focus trap is open. * * @returns boolean - true if at least one focus trap is active */ hasActiveTraps(): boolean; /** * Sets initial focus based on configuration. * * @param container - The container element * @param initialFocus - Where to set initial focus */ private setInitialFocus; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * ARIA live region politeness levels. * * - 'off': No announcements * - 'polite': Announces when user is idle (non-interruptive) * - 'assertive': Announces immediately (interruptive) */ type AriaLivePoliteness = 'off' | 'polite' | 'assertive'; /** * LiveAnnouncerService provides screen reader announcements via ARIA live regions. * * This service creates a visually hidden element that screen readers monitor * for changes. When content is added to this element, screen readers announce * it to users. This is essential for communicating dynamic content changes * that may not be apparent to users who cannot see the screen. * * @example * ```typescript * // In a component * constructor(private liveAnnouncer: LiveAnnouncerService) {} * * onItemDeleted(): void { * this.liveAnnouncer.announce('Item deleted successfully'); * } * * onError(message: string): void { * this.liveAnnouncer.announceError(message); * } * * onStatusChange(status: string): void { * this.liveAnnouncer.announceStatus(`Status changed to ${status}`); * } * ``` * * @usageNotes * ### Politeness Levels * * - Use `'polite'` (default) for non-critical updates that can wait * until the user is idle (e.g., status updates, confirmations) * - Use `'assertive'` for critical information that should interrupt * the user immediately (e.g., errors, warnings) * * ### Best Practices * * - Keep announcements concise and meaningful * - Avoid announcing every minor change * - Use `announceError()` for error messages * - Use `announceStatus()` for status updates * * @see https://www.w3.org/WAI/WCAG21/Understanding/status-messages.html */ declare class LiveAnnouncerService implements OnDestroy { private liveElement; private currentTimeout; /** * Announces a message to screen readers. * * Creates a visually hidden live region element if it doesn't exist, * then updates its content to trigger a screen reader announcement. * * @param message - The message to announce * @param politeness - 'polite' (default) or 'assertive' * @param duration - How long to keep the message (ms), default 1000 */ announce(message: string, politeness?: AriaLivePoliteness, duration?: number): void; /** * Announces an error message to screen readers. * * Uses 'assertive' politeness to ensure the error is announced * immediately, interrupting any current speech. * * @param message - The error message to announce */ announceError(message: string): void; /** * Announces a status update to screen readers. * * Uses 'polite' politeness to announce the status when the user * is idle, without interrupting current speech. * * @param message - The status message to announce */ announceStatus(message: string): void; /** * Clears any pending announcement and removes the current message. */ clear(): void; /** * Creates the visually hidden live region element if it doesn't exist. * * The element is styled to be invisible but still accessible to * screen readers. It uses the 'cometchat-sr-only' class and inline * styles to ensure it's properly hidden across all browsers. */ private ensureLiveElement; /** * Cleanup when the service is destroyed. * * Clears any pending timeouts and removes the live region element * from the DOM to prevent memory leaks. */ ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Configuration for list navigation behavior */ interface ListNavigationConfig { /** Total number of items in the list */ itemCount: number; /** Whether navigation should wrap around at boundaries (default: true) */ wrap?: boolean; /** Callback to check if an item at index is disabled */ isDisabled?: (index: number) => boolean; } /** * ListNavigationService provides keyboard navigation for list components. * * Implements roving tabindex pattern and arrow key navigation for * accessible list navigation. Supports ArrowUp/ArrowDown, Home/End, * and wrap-around behavior. * * @example * ```typescript * // In a list component * private listNavigationService = inject(ListNavigationService); * focusedIndex = signal(0); * * onKeyDown(event: KeyboardEvent): void { * const newIndex = this.listNavigationService.handleKeyNavigation( * event, * this.focusedIndex(), * { itemCount: this.items.length, wrap: true } * ); * * if (newIndex !== -1 && newIndex !== this.focusedIndex()) { * this.focusedIndex.set(newIndex); * this.focusItem(newIndex); * } * } * ``` */ declare class ListNavigationService { /** * Handles keyboard navigation within a list. * Returns the new focused index, or -1 if no navigation occurred. * * @param event - The keyboard event to handle * @param currentIndex - The currently focused index * @param config - Configuration for navigation behavior * @returns number - The new index to focus, or -1 if no navigation */ handleKeyNavigation(event: KeyboardEvent, currentIndex: number, config: ListNavigationConfig): number; /** * Gets tabindex for an item based on roving tabindex pattern. * * @param index - The item's index * @param focusedIndex - The currently focused index * @returns number - 0 if focused, -1 otherwise */ getItemTabIndex(index: number, focusedIndex: number): number; /** * Updates tabindex values for roving tabindex pattern. * Returns a map of index -> tabindex value. * * This is useful when you need to batch-update tabindex values * for all items in a list at once. * * @param itemCount - Total number of items in the list * @param focusedIndex - The currently focused index * @returns Map - Map of index to tabindex value * * @example * ```typescript * const tabindexMap = this.listNavigationService.getRovingTabindexMap(5, 2); * // Returns: Map { 0 => -1, 1 => -1, 2 => 0, 3 => -1, 4 => -1 } * ``` */ getRovingTabindexMap(itemCount: number, focusedIndex: number): Map; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Configuration for grid navigation behavior */ interface GridNavigationConfig { /** Number of rows in the grid */ rowCount: number; /** Number of columns in the grid */ columnCount: number; /** Total number of items (may be less than rowCount * columnCount) */ totalItems: number; /** Whether navigation should wrap around at boundaries (default: true) */ wrap?: boolean; /** Callback to check if an item at index is disabled */ isDisabled?: (index: number) => boolean; } /** * Grid position representation */ interface GridPosition { row: number; column: number; index: number; } /** * GridNavigationService provides 2D keyboard navigation for grid components. * * Implements arrow key navigation for grids like sticker/emoji keyboards, * supporting ArrowUp/Down for rows, ArrowLeft/Right for columns, * Home/End for row navigation, and Ctrl+Home/Ctrl+End for grid navigation. * * @example * ```typescript * // In a sticker keyboard component * private gridNavigationService = inject(GridNavigationService); * focusedIndex = signal(0); * readonly COLUMNS = 4; * * onGridKeyDown(event: KeyboardEvent): void { * const rowCount = Math.ceil(this.stickers.length / this.COLUMNS); * const newIndex = this.gridNavigationService.handleKeyNavigation( * event, * this.focusedIndex(), * { rowCount, columnCount: this.COLUMNS, totalItems: this.stickers.length, wrap: true } * ); * * if (newIndex !== -1 && newIndex !== this.focusedIndex()) { * this.focusedIndex.set(newIndex); * this.focusSticker(newIndex); * } * } * ``` */ declare class GridNavigationService { /** * Converts a linear index to grid position. * * @param index - The linear index * @param columnCount - Number of columns in the grid * @returns GridPosition - The row, column, and index */ indexToPosition(index: number, columnCount: number): GridPosition; /** * Converts grid position to linear index. * * @param row - The row number * @param column - The column number * @param columnCount - Number of columns in the grid * @returns number - The linear index */ positionToIndex(row: number, column: number, columnCount: number): number; /** * Handles keyboard navigation within a grid. * Returns the new focused index, or -1 if no navigation occurred. * * @param event - The keyboard event to handle * @param currentIndex - The currently focused index * @param config - Configuration for navigation behavior * @returns number - The new index to focus, or -1 if no navigation */ handleKeyNavigation(event: KeyboardEvent, currentIndex: number, config: GridNavigationConfig): number; /** * Gets tabindex for an item based on roving tabindex pattern. * * @param index - The item's index * @param focusedIndex - The currently focused index * @returns number - 0 if focused, -1 otherwise */ getItemTabIndex(index: number, focusedIndex: number): number; /** * Calculates row and column from linear index. * Alias for indexToPosition with simplified return type. * * @param index - The linear index * @param columns - Number of columns in the grid * @returns Object with row and col properties */ getRowCol(index: number, columns: number): { row: number; col: number; }; /** * Calculates linear index from row and column. * Alias for positionToIndex. * * @param row - The row number * @param col - The column number * @param columns - Number of columns in the grid * @returns The linear index */ getIndex(row: number, col: number, columns: number): number; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Call type for announcements */ type CallType = 'audio' | 'video'; /** * Call status for announcements */ type CallStatus = 'incoming' | 'outgoing' | 'connected' | 'ended' | 'declined' | 'canceled' | 'failed'; /** * CallAnnouncerService provides screen reader announcements for call events. * * Uses assertive announcements for time-sensitive call events to ensure * screen reader users are immediately notified of incoming calls, * call status changes, and call termination. * * @example * ```typescript * // In an incoming call component * private callAnnouncer = inject(CallAnnouncerService); * * ngOnInit(): void { * this.callAnnouncer.announceIncomingCall(this.callerName, 'video'); * } * * onCallAccepted(): void { * this.callAnnouncer.announceCallConnected(); * } * ``` */ declare class CallAnnouncerService { private liveAnnouncer; /** * Announces an incoming call (assertive - immediate). * * @param callerName - Name of the caller * @param callType - Type of call ('audio' or 'video') */ announceIncomingCall(callerName: string, callType: CallType): void; /** * Announces outgoing call initiation. * * @param receiverName - Name of the call recipient */ announceOutgoingCall(receiverName: string): void; /** * Announces call connected. */ announceCallConnected(): void; /** * Announces call ended. */ announceCallEnded(): void; /** * Announces call declined. */ announceCallDeclined(): void; /** * Announces call canceled. */ announceCallCanceled(): void; /** * Announces call failed with optional reason. * * @param reason - Optional reason for call failure */ announceCallFailed(reason?: string): void; /** * Announces call initiation (starting voice/video call). * * @param callType - Type of call being initiated */ announceCallInitiation(callType: CallType): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Configuration for dialog focus management */ interface DialogConfig extends FocusTrapConfig { /** Element ID for aria-labelledby */ labelledById?: string; /** Element ID for aria-describedby */ describedById?: string; /** Whether to close on Escape key (default: true) */ closeOnEscape?: boolean; /** Callback when Escape is pressed */ onEscape?: () => void; } /** * DialogFocusManager provides focus management for modal dialogs. * * Extends FocusTrapService with dialog-specific features including * ARIA attribute management, Escape key handling, and initial focus * management. Ensures consistent focus behavior across all dialog * components. * * @example * ```typescript * // In a dialog component * private dialogFocusManager = inject(DialogFocusManager); * * @ViewChild('dialogContainer') dialogContainer!: ElementRef; * @ViewChild('closeButton') closeButton!: ElementRef; * * ngAfterViewInit(): void { * this.dialogFocusManager.openDialog({ * container: this.dialogContainer.nativeElement, * initialFocus: this.closeButton.nativeElement, * labelledById: 'dialog-title', * closeOnEscape: true, * onEscape: () => this.close(), * }); * } * * ngOnDestroy(): void { * this.dialogFocusManager.closeDialog(this.dialogContainer.nativeElement); * } * ``` */ declare class DialogFocusManager { private focusTrapService; private activeDialogs; /** * Opens a dialog with focus management. * * Sets ARIA attributes, activates focus trap, and handles Escape key. * * @param config - Configuration for the dialog */ openDialog(config: DialogConfig): void; /** * Closes a dialog and restores focus. * * Removes ARIA attributes, deactivates focus trap, and restores * focus to the previously focused element. * * @param container - The dialog container element */ closeDialog(container: HTMLElement): void; /** * Focuses the first focusable element or close button in a dialog. * * Looks for an element with [data-dialog-close] attribute first, * then falls back to the first focusable element. * * @param container - The dialog container element */ focusFirstOrClose(container: HTMLElement): void; /** * Checks if a dialog is currently active. * * @param container - The dialog container element * @returns boolean - true if the dialog is active */ isDialogActive(container: HTMLElement): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Configuration for type-ahead search behavior */ interface TypeAheadConfig { /** Function to get searchable text from an item */ getSearchText: (item: T) => string; /** Timeout in ms before buffer resets (default: 500) */ timeout?: number; } /** * TypeAheadService provides character-based search for list components. * * Implements type-ahead search pattern where characters typed in quick * succession are collected into a buffer and matched against item names. * The buffer resets after a configurable timeout (default 500ms). * * Supports wrap-around search from current position to find the next * matching item. * * @example * ```typescript * // In a list component * private typeAheadService = inject(TypeAheadService); * focusedIndex = signal(0); * * onKeyDown(event: KeyboardEvent): void { * // Only handle printable characters * if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) { * const newIndex = this.typeAheadService.handleCharacter( * event.key, * this.items, * this.focusedIndex(), * { getSearchText: (item) => item.name } * ); * * if (newIndex !== -1) { * this.focusedIndex.set(newIndex); * this.focusItem(newIndex); * } * } * } * ``` */ declare class TypeAheadService implements OnDestroy { private buffer; private timeoutId; private readonly DEFAULT_TIMEOUT; /** * Handles a character input for type-ahead search. * Returns the index of the matching item, or -1 if no match. * * Characters are collected into a buffer and matched against item names. * The search starts from the current position + 1 and wraps around to * find the next matching item. * * @param char - The character typed by the user * @param items - The list of items to search * @param currentIndex - The currently focused index * @param config - Configuration for search behavior * @returns number - The index of the matching item, or -1 if no match */ handleCharacter(char: string, items: T[], currentIndex: number, config: TypeAheadConfig): number; /** * Clears the type-ahead buffer manually. * * Call this when the list loses focus or when you want to reset * the search state. */ clearBuffer(): void; /** * Cleanup on service destruction. */ ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Types for ListSelectionManager. */ /** * Represents the current state of list selection. * @see Requirements 13.5 */ interface ListSelectionState { /** Current selection mode (single, multiple, none) */ mode: SelectionMode; /** Set of selected item IDs */ selectedIds: Set; /** ID of the last selected item, or null if none */ lastSelectedId: string | null; /** Index used as anchor for shift-select range operations */ anchorIndex: number; } /** * ListSelectionManager Class * * Manages list item selection with keyboard support for accessibility. * Provides methods for single/multiple selection, range selection, and selection state management. * @see Requirements 3.3-3.7, 5.3, 7.3, 9.3, 13.1-13.7 */ /** * ListSelectionManager handles all selection-related operations for list components. * Supports single/multiple selection, range selection, and keyboard navigation. * @typeParam T - The type of items being selected * @see Requirements 3.3-3.7, 5.3, 7.3, 9.3, 13.1-13.7 */ declare class ListSelectionManager { private mode; private getId; private _selectedIds; private _lastSelectedIndex; private _anchorIndex; private _lastSelectedId; /** Count of selected items. @see Requirements 13.6 */ readonly selectedCount: Signal; /** Whether any items are selected. */ readonly hasSelection: Signal; /** Read-only signal exposing the selected IDs set. */ readonly selectedIds: Signal>; constructor(mode: SelectionMode, getId: (item: T) => string); /** Toggles selection for an item (Space key behavior). @see Requirements 3.3, 5.3, 7.3, 9.3, 13.1-13.3 */ toggleSelection(item: T, index: number): boolean; /** Extends selection to include an item (Shift+Arrow behavior). @see Requirements 3.4, 3.5 */ extendSelection(item: T, index: number): void; /** Selects all items between anchor and current index (Shift+Space). @see Requirements 13.4 */ selectRange(items: T[], currentIndex: number): void; /** Selects all items (Ctrl/Cmd+A). @see Requirements 3.6 */ selectAll(items: T[]): void; /** Clears all selections (Escape). @see Requirements 3.7 */ clearSelection(): void; /** Checks if an item is currently selected. */ isSelected(item: T): boolean; /** Checks if an item ID is currently selected. */ isSelectedById(id: string): boolean; /** Gets the current selection state. @see Requirements 13.5 */ getSelectionState(): ListSelectionState; /** Gets the array of selected item IDs. */ getSelectedIdsArray(): string[]; /** Sets the selection mode. Clears selection when switching to single/none. */ setMode(mode: SelectionMode): void; /** Gets the current selection mode. */ getMode(): SelectionMode; /** Sets the anchor index for range selection. */ setAnchorIndex(index: number): void; /** Gets the current anchor index, or -1 if not set. */ getAnchorIndex(): number; /** Gets the last selected index, or -1 if none. */ getLastSelectedIndex(): number; /** Programmatically selects an item without toggling. */ select(item: T, index: number): void; /** Programmatically deselects an item. */ deselect(item: T): void; /** Programmatically deselects an item by ID. */ deselectById(id: string): void; /** Sets the selection to a specific set of items. */ setSelection(items: T[]): void; /** Sets the selection to a specific set of item IDs. */ setSelectionByIds(ids: string[]): void; } /** * Configuration for media playback controls */ interface MediaControlsConfig { /** Current playback position in seconds */ currentTime: number; /** Total duration in seconds */ duration: number; /** Whether media is currently playing */ isPlaying: boolean; /** Seek increment in seconds (default: 5) */ seekIncrement?: number; } /** * Result of handling a media control keyboard event */ interface MediaControlsResult { /** The action to perform */ action: 'play' | 'pause' | 'seek' | 'seekStart' | 'seekEnd' | 'none'; /** The time to seek to (only present for seek actions) */ seekTime?: number; } /** * MediaControlsService provides keyboard controls for audio/video playback. * * Implements standard media keyboard shortcuts: * - Space/Enter: Toggle play/pause * - ArrowRight: Seek forward (default 5 seconds) * - ArrowLeft: Seek backward (default 5 seconds) * - Home: Seek to start * - End: Seek to end * * Also provides helper methods for screen reader accessibility: * - formatTimeForAnnouncement: Formats time for screen reader announcement * - getPlayPauseLabel: Gets aria-label for play/pause button * - getProgressValueText: Gets aria-valuetext for progress slider * * @example * ```typescript * // In an audio bubble component * private mediaControlsService = inject(MediaControlsService); * * onAudioKeyDown(event: KeyboardEvent): void { * const result = this.mediaControlsService.handleKeyDown(event, { * currentTime: this.currentTime(), * duration: this.duration(), * isPlaying: this.isPlaying(), * seekIncrement: 5 * }); * * switch (result.action) { * case 'play': * this.play(); * break; * case 'pause': * this.pause(); * break; * case 'seek': * case 'seekStart': * case 'seekEnd': * this.seekTo(result.seekTime!); * break; * } * } * ``` */ declare class MediaControlsService { private readonly DEFAULT_SEEK_INCREMENT; /** * Handles keyboard events for media playback controls. * Returns the action to perform based on the key pressed. * * @param event - The keyboard event to handle * @param config - Configuration with current playback state * @returns MediaControlsResult - The action to perform */ handleKeyDown(event: KeyboardEvent, config: MediaControlsConfig): MediaControlsResult; /** * Formats time in seconds for screen reader announcement. * Returns a human-readable string like "2 minutes 30 seconds" or "45 seconds", * in the active locale ("2 minutos 30 segundos", "2分 30秒"). * * @param seconds - The time in seconds to format * @returns string - Human-readable time string */ formatTimeForAnnouncement(seconds: number): string; /** * Gets the aria-label for a play/pause button based on current state. * * @param isPlaying - Whether media is currently playing * @returns string - "Pause" if playing, "Play" if paused */ getPlayPauseLabel(isPlaying: boolean): string; /** * Gets the aria-valuetext for a progress slider. * Returns a string like "2 minutes 30 seconds of 5 minutes". * * @param currentTime - Current playback position in seconds * @param duration - Total duration in seconds * @returns string - Human-readable progress text */ getProgressValueText(currentTime: number, duration: number): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Represents a mention suggestion in the autocomplete panel */ interface MentionSuggestion { /** Unique identifier for the suggestion */ id: string; /** Display name for the suggestion */ name: string; /** Optional avatar URL */ avatar?: string; } /** * Callbacks for mentions navigation events */ interface MentionsNavigationCallbacks { /** Called when a suggestion is selected */ onSelect: (suggestion: MentionSuggestion) => void; /** Called when the mentions panel should close */ onClose: () => void; } /** * MentionsNavigationService provides keyboard navigation for mentions autocomplete. * * Implements the combobox pattern with aria-activedescendant for accessible * mentions autocomplete. Supports ArrowUp/Down navigation, Enter/Tab selection, * and Escape to close. * * Uses Angular signals for reactive state management of the highlighted index. * * @example * ```typescript * // In a message composer component * private mentionsService = inject(MentionsNavigationService); * * onComposerKeyDown(event: KeyboardEvent): void { * if (this.isMentionsPanelOpen()) { * const handled = this.mentionsService.handleKeyDown( * event, * this.suggestions(), * { * onSelect: (suggestion) => this.insertMention(suggestion), * onClose: () => this.closeMentionsPanel() * } * ); * * if (handled) return; * } * // Handle other keys... * } * * // In template, use aria-activedescendant * * ``` */ declare class MentionsNavigationService { /** * Signal tracking the currently highlighted suggestion index. * -1 indicates no suggestion is highlighted. */ private highlightedIndex; /** * Handles keyboard navigation in the mentions panel. * Returns true if the event was handled, false otherwise. * * Supported keys: * - ArrowDown: Move to next suggestion (wraps to first) * - ArrowUp: Move to previous suggestion (wraps to last) * - Enter/Tab: Select the highlighted suggestion * - Escape: Close the mentions panel * * @param event - The keyboard event to handle * @param suggestions - Array of available suggestions * @param callbacks - Callbacks for selection and close events * @returns boolean - true if the event was handled */ handleKeyDown(event: KeyboardEvent, suggestions: MentionSuggestion[], callbacks: MentionsNavigationCallbacks): boolean; /** * Gets the currently highlighted index. * * @returns number - The highlighted index, or -1 if none */ getHighlightedIndex(): number; /** * Sets the highlighted index. * Use this to programmatically highlight a suggestion, * for example when the suggestions list changes. * * @param index - The index to highlight (-1 for none) */ setHighlightedIndex(index: number): void; /** * Resets the highlighted index to -1 (no selection). * Call this when closing the mentions panel or when * the suggestions list is cleared. */ reset(): void; /** * Gets the ID for aria-activedescendant attribute. * Returns null if no suggestion is highlighted. * * The returned ID follows the pattern: `{baseId}-option-{index}` * * @param baseId - The base ID for the suggestions list * @returns string | null - The active descendant ID, or null if none * * @example * ```html * *
    *
  • * {{ s.name }} *
  • *
* ``` */ getActiveDescendantId(baseId: string): string | null; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Callback type for formatting a message into subtitle text. * * @param message - The CometChat message to format * @returns The formatted subtitle string */ type SubtitleFormatter = (message: CometChat.BaseMessage) => string; /** * ConversationSubtitleService * * Manages custom subtitle text and icon overrides for conversation items * based on message type/category combinations. * * Developers can register formatters to control the last message text shown * in conversation list items for specific message types, and override the * subtitle icon displayed alongside the text. * * @example * ```typescript * const subtitleService = inject(ConversationSubtitleService); * * // Register a subtitle formatter for location messages * subtitleService.registerSubtitleFormatter('location_custom', (message) => { * const data = (message as CometChat.CustomMessage).getCustomData(); * return `📍 Shared a location`; * }); * * // Register an icon override * subtitleService.registerSubtitleIconOverride('location_custom', 'location-pin'); * ``` * * @Injectable providedIn: 'root' */ declare class ConversationSubtitleService { private subtitleFormatters; private subtitleIconOverrides; /** * Register a subtitle formatter for a message type key. * Re-registration replaces the previous formatter. */ registerSubtitleFormatter(typeKey: MessageTypeKey, formatter: SubtitleFormatter): void; /** * Unregister a subtitle formatter for a message type key. */ unregisterSubtitleFormatter(typeKey: MessageTypeKey): void; /** * Register a subtitle icon override for a message type key. * Re-registration replaces the previous icon name. */ registerSubtitleIconOverride(typeKey: MessageTypeKey, iconName: string): void; /** * Get the formatted subtitle for a message, or `null` if no formatter is registered. * If the formatter throws, logs a warning and returns `null`. */ getSubtitle(typeKey: MessageTypeKey, message: CometChat.BaseMessage): string | null; /** * Get the icon override for a message type key, or `null` if none is registered. */ getIconOverride(typeKey: MessageTypeKey): string | null; /** * Check if a formatter is registered for a given type key. */ hasFormatter(typeKey: MessageTypeKey): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * ThemeService * * Manages light/dark theme for the CometChat Angular UIKit. * * ## Features * - Respects `prefers-color-scheme` OS preference on first load * - Applies `data-theme` attribute to `` via Angular's `DOCUMENT` token (SSR-safe) * - Exposes a reactive `currentTheme` signal for template bindings * - Cleans up the `matchMedia` listener on destroy * * ## Usage * * ### Inject and toggle * ```typescript * export class AppComponent { * themeService = inject(ThemeService); * * toggle() { * const next = this.themeService.currentTheme() === 'dark' ? 'light' : 'dark'; * this.themeService.setTheme(next); * } * } * ``` * * ### Template binding * ```html * * ``` * * ### Initialize from preference on app start * ```typescript * // app.component.ts * export class AppComponent { * constructor() { * inject(ThemeService).initFromPreference(); * } * } * ``` * * @Injectable providedIn: 'root' */ declare class ThemeService implements OnDestroy { private readonly doc; /** Reactive signal reflecting the currently applied theme. */ readonly currentTheme: _angular_core.WritableSignal<"light" | "dark">; private mediaQuery; private readonly onSystemChange; constructor(); ngOnDestroy(): void; /** * Resolves and applies the theme on startup. * * Priority: * 1. OS `prefers-color-scheme` * 2. Fallback: `'light'` */ initFromPreference(): void; /** * Explicitly sets the theme. * * @param theme - `'light'` or `'dark'` */ setTheme(theme: 'light' | 'dark'): void; /** * Toggles between light and dark. */ toggleTheme(): void; private applyTheme; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Represents a single processed AI stream event emitted on messageStream$. * streamedContent carries the accumulated text for text_message_content events. */ interface IAIStreamEvent { message: CometChat.AIAssistantBaseEvent; streamedContent?: string; chatId: string; runId: string; } /** * CometChatAIStreamingService * * Mirrors the React stream-message.service pattern: * - Single global messageQueue processed via concatMap (sequential, no drops) * - Single messageStream$ Subject that all subscribers share * - Per-chatId streaming state via BehaviorSubject * - NgZone.run() wraps all incoming WebSocket events so OnPush CD fires */ declare class CometChatAIStreamingService { private readonly _zone; private readonly _destroyRef; private readonly _messageQueue; private readonly _messageSubject; private _queueSubscription; private _accumulatedText; private _streamingSubjects; private _signalCache; private _activeRuns; private _stoppedChats; private _toolCallName; private _toolCallArgs; private _streamSpeedMs; private _aiTools; /** Observable that emits every processed IAIStreamEvent. */ readonly messageStream$: Observable; constructor(); /** Returns a stable callable+Observable for the given chatId's streaming state. */ isStreamingFor(chatId: string): (() => boolean) & Observable; /** Snapshot: is the given chatId currently streaming? */ isStreamingSnapshot(chatId: string): boolean; /** Returns true if any chatId is currently streaming. */ isAnyStreaming(): boolean; /** Returns accumulated text for a chatId+runId (for late-mounting bubbles). */ getAccumulatedText(chatId: string, runId: string): string; /** * Routes an incoming WebSocket event into the processing queue. * Wraps in NgZone.run() so signal/state updates trigger OnPush CD. */ handleWebsocketMessage(event: CometChat.AIAssistantBaseEvent, chatId: string): void; /** Prepares for a new streaming session: resets state and marks streaming=true. */ startStreamingMessage(chatId: string): void; /** Stops streaming for a chatId and cleans up state. */ stopStreamingMessage(chatId: string): void; setStreamSpeed(ms: number): void; setAIAssistantTools(tools: CometChatAIAssistantTools): void; private _initQueue; private _processEvent; private _getOrCreateStreamingSubject; /** * Completes and removes the BehaviorSubject for a given chatId from the Map. * Called after streaming ends to prevent the Map from growing unbounded * across long sessions with many chat IDs. */ private _cleanupStreamingSubject; /** * Completes and removes all streaming subjects and tears down the queue * subscription. Called by DestroyRef when the service is destroyed. */ private _cleanupAll; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Service managing message search state and SDK queries. * Injected into CometChatSearchMessagesListComponent. */ declare class SearchMessagesService { /** Current message results */ readonly messages: WritableSignal; /** Current fetch state */ readonly fetchState: WritableSignal; /** Whether more pages exist */ readonly hasMoreResults: WritableSignal; /** * Offline (D83): a search the service re-ran by itself on reconnect failed. A search the user or * app started rejects to its caller instead; this is the channel for the one nobody awaits. */ readonly reconnectSearchError$: Subject<_cometchat_chat_sdk_javascript.CometChatException>; /** * Offline (D84 rule 7): the search could not reach the server and nothing saved matches, so the list * says "Connect to search" (`fetchState` is `empty`; no `searchError`). It runs once more by itself * when the connection is back (rule 8). Always false with offline off. */ readonly connectToSearch: WritableSignal; /** * Offline (D84, Android): the search failed with a real error and nothing is shown, inside the search * component. The component decides, once both scopes have answered, whether that is the error view or * the plain empty state (`fetchState` is `empty`; no `searchError` from this scope). Always false with * offline off, and outside the search component. */ readonly searchFailed: WritableSignal; private searchRequest; /** Whether the current search has a keyword (and so has no cache to read). */ private keywordSearch; private isLoadingMore; /** Bumped by every new search and reset: an answer for an older one is dropped. */ private generation; private readonly connectionState; private readonly destroyRef; private readonly failureHold; /** * Offline (D84): "Connect to search" is up because the device was not connected, so the same search * runs once more by itself when the connection is back. A non-network error never sets it. */ private reloadOnConnect; private lastSearch; constructor(); /** Offline on, "Connect to search" up because of no connection: run the last search once more (D84 rule 8). */ private rerunAfterReconnect; /** * Initiate a message search with the given criteria. */ search(keyword: string, filters: CometChatSearchFilter[], uid?: string, guid?: string, customBuilder?: CometChat.MessagesRequestBuilder, alwaysShowSeeMore?: boolean): Promise; /** Filters without a keyword on the offline path: cached then server, newest first, deduped by id. */ private searchTwoPhase; /** Next page of a keyword-less search on the offline path; "load more" never repeats a row. */ private loadMoreTwoPhase; /** * Load the next page of results. */ loadMore(): Promise; /** Reset all state. */ reset(): void; /** * Build a MessagesRequest based on search criteria and filters. */ private buildRequest; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Service managing conversation search state, SDK queries, * and real-time listener lifecycle. */ declare class SearchConversationsService { readonly conversations: WritableSignal; readonly fetchState: WritableSignal; readonly hasMoreResults: WritableSignal; /** * Offline (D83): a search the service re-ran by itself on reconnect failed. A search the user or * app started rejects to its caller instead; this is the channel for the one nobody awaits. */ readonly reconnectSearchError$: Subject<_cometchat_chat_sdk_javascript.CometChatException>; /** * Offline (D84 rule 7): the search could not reach the server and nothing saved matches, so the list * says "Connect to search" (`fetchState` is `empty`; no `searchError`). It runs once more by itself * when the connection is back (rule 8). Always false with offline off. */ readonly connectToSearch: WritableSignal; /** * Offline (D84, Android): the search failed with a real error and nothing is shown, inside the search * component. The component decides, once both scopes have answered, whether that is the error view or * the plain empty state (`fetchState` is `empty`; no `searchError` from this scope). Always false with * offline off, and outside the search component. */ readonly searchFailed: WritableSignal; readonly typingIndicatorMap: WritableSignal>; private searchRequest; private isLoadingMore; /** Bumped by every new search and reset: an answer for an older one is dropped. */ private generation; private loggedInUser; private messageListenerId; private userListenerId; private groupListenerId; private callListenerId; private typingListenerId; private receiptSubscriptions; private readonly connectionState; private readonly destroyRef; private readonly failureHold; /** * Offline (D84): "Connect to search" is up because the device was not connected, so the same search * runs once more by itself when the connection is back. A non-network error never sets it. */ private reloadOnConnect; private lastSearch; constructor(); /** Offline on, "Connect to search" up because of no connection: run the last search once more (D84 rule 8). */ private rerunAfterReconnect; /** * Initiate a conversation search. */ search(keyword: string, filters: CometChatSearchFilter[], customBuilder?: CometChat.ConversationsRequestBuilder): Promise; /** Whether the current search has a keyword (and so has no cache to read). */ private keywordSearch; /** Filters without a keyword on the offline path: cached then server, deduped by conversation id. */ private searchTwoPhase; /** Load the next page of results. */ loadMore(): Promise; /** Next page of a keyword-less search on the offline path; "load more" never repeats a row. */ private loadMoreTwoPhase; /** Attach all real-time SDK listeners. */ attachListeners(loggedInUser: CometChat.User): void; /** Detach all real-time SDK listeners. */ detachListeners(): void; /** Reset all state and detach listeners. */ reset(): void; private buildRequest; private attachMessageListener; private attachUserListener; private attachGroupListener; private attachCallListener; private attachTypingListener; private attachReceiptListener; private handleNewMessage; private handleMessageUpdate; private handleUserStatusChange; private handleTypingStarted; private handleTypingEnded; private handleReceipt; private removeConversationByGroup; private getTypingId; private cloneConversation; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } interface NotificationUnreadCountOptions { /** Filter count by category */ category?: string; /** Polling interval in ms. Default: 30000 */ pollingInterval?: number; } /** * NotificationUnreadCountService * * Injectable Angular service for consuming notification feed unread count. * Provides real-time updates via BehaviorSubject, polling, and WebSocket listener. * * Angular equivalent of React's useNotificationUnreadCount hook. * * NOTE: When used alongside CometChatNotificationFeedComponent, both register * separate NotificationFeedListeners. The ViewModel handles feed item insertion, * while this service handles badge count. Both optimistically update on * onFeedItemReceived — the badge may briefly over-count by 1 until the next * polling re-fetch corrects it (within 1 second). This is by design to avoid * tight coupling between the badge and the feed component. * * @Injectable providedIn: 'root' */ declare class NotificationUnreadCountService implements OnDestroy { /** Current unread count */ readonly count$: BehaviorSubject; /** Whether the initial fetch is in progress */ readonly isLoading$: BehaviorSubject; private pollingInterval; private listenerId; private isFetching; private isStarted; private focusHandler; /** * Start tracking unread count. * Fetches initial count, registers WebSocket listener, and starts polling. */ start(options?: NotificationUnreadCountOptions): void; /** * Stop tracking unread count. * Removes listener, clears polling, removes focus handler. */ stop(): void; /** * Manually refresh the unread count. */ refresh(): Promise; ngOnDestroy(): void; private fetchCount; private registerListener; private removeListener; private stopPolling; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** Arguments for {@link ThreadSubscriptionService.applyIncomingReply}. */ interface IncomingReplySubscriptionArgs { /** The reply that just arrived over the socket. */ reply: CometChat.BaseMessage; /** * The thread's parent message, when the surface holds it (a thread view). Its * `isThreadSubscribed()` is the authoritative state to inherit. Absent in the * main list, where the reply is not displayed. */ parentMessage?: CometChat.BaseMessage | null; /** Logged-in user's uid, for the mention / own-message checks. */ loggedInUserUid: string; } /** * Owns the follow/unfollow behaviour shared by the two subscription surfaces — * the thread header control and the message action sheet. * * The message object is the single source of truth: the server stamps its * per-viewer flag onto every fetched message in a thread, and the kit reads it * with `isThreadSubscribed()`. There is deliberately **no** kit-side cache — the * SDK removed the store this service used to read, and reintroducing one here * would repeat the mistake. What this service owns instead is the write path * (the in-flight lock, the throttle, the optimistic publish and the revert) plus * the local mirroring of the two state changes the client can observe without a * refetch. */ declare class ThreadSubscriptionService implements OnDestroy { /** Optional so the service still works when no toast host is available (e.g. SSR, tests). */ private readonly toast; /** Ids with a request on the wire — at most one per thread. */ private readonly inFlight; /** * Last accepted toggle per thread, for the throttle. * * Pruned on every write (below) so it only ever holds threads toggled within * the window — in practice one or two entries. Without that it would gain a * permanent entry per thread touched and never shrink. */ private readonly lastToggleAt; /** Threads the server answered 403/404 for: the control hides rather than lying. */ private readonly unavailable; /** * Bumped on every login/logout. A response that comes back carrying a stale * epoch is dropped rather than acted on — the surfaces that would hear the * publish belong to the previous session, and their state must not leak into * the next one. */ private sessionEpoch; private readonly sessionSubscription; constructor(); /** * Whether the linked Chat SDK exposes the thread-subscription WRITE API. The * kit's peer range still admits SDK builds that predate it, and calling a * method that isn't there throws synchronously rather than rejecting — so both * surfaces ask this before rendering, and an app on an older SDK simply sees * no control instead of a button that throws. * * The state accessors are deliberately not part of the probe: they are read * off the message and guarded at their own call sites, and what a *control* * needs before it will render is the ability to actually change the state. */ isSupported(): boolean; /** * Whether to render the followed affordance for a message's thread. * * Reads the flag off the message itself — every fetched message in a thread * carries it, so a reply bubble answers for its own thread without consulting * the parent. */ isFollowing(message: CometChat.BaseMessage | null | undefined): boolean; /** True once the server has said this thread is gone or off-limits. */ isUnavailable(parentMessageId: number): boolean; /** * Flip the subscription for a thread — the only path that writes to the * server. * * The write leaves on the **first** tap; a tap within * {@link TOGGLE_DEBOUNCE_MS} of it, or while its request is still on the wire, * is swallowed whole — no publish, no request, nothing queued. That keeps an * impatient double-tap from racing without deferring the request the user * actually asked for, and it is the same guard the React UI Kit applies, so a * double-tap lands on the same state on both platforms. * * @param message the message acted on. A reply resolves to its parent thread. * @returns the state the control should be left in. */ toggle(message: CometChat.BaseMessage): boolean; /** Drop stamps older than the window; they can no longer swallow anything. */ private pruneToggleStamps; /** * Write the flip to the server and reconcile. Both calls are idempotent * server-side, so a duplicate never surfaces an error. */ private send; private handleError; /** * Mirror an auto-subscribe the server already performed — Case 3 (a reply * mentions you) and Case 4 (you reply in a thread). * * Both are server-side truths, so this deliberately does NOT call * `subscribeToThread`: re-issuing the write would be a redundant round-trip, * and the next fetch of the thread confirms the state anyway. All this does is * give the open surfaces immediate feedback. */ mirrorSubscribed(parentMessageId: number, capturedSession?: number): void; /** * A token for the current session. * * Capture it before an await and hand it back to {@link mirrorSubscribed}, so * a mirror belonging to a session that has since ended is dropped rather than * acted on. Callers that publish synchronously do not need it. */ captureSession(): number; /** * Reconcile subscription state when a thread reply arrives in real time. * * A socket-delivered message reads `false` regardless of the truth — the flag * is only populated on responses to fetches that asked for it — so the reply's * own value can't be trusted. This resolves it: * * - **A reply from someone else that @mentions me** subscribes me server-side. * Stamp `true` onto the reply and onto the held parent, and publish the flip * so every mounted surface agrees. * - **Any other reply** doesn't change the subscription, so — when we hold the * parent — inherit the thread's current state onto the reply, correcting the * socket `false`. In the main list (no parent held) the reply isn't * displayed, so there is nothing to stamp. * * A no-op on anything that isn't a thread reply, so calling it on every * received message is safe. */ applyIncomingReply({ reply, parentMessage, loggedInUserUid }: IncomingReplySubscriptionArgs): void; private publish; /** * Login or logout ends the session: a response still on the wire is dropped * rather than acted on, and the guards start clean so the next user is not * throttled by the previous one's taps. */ private resetSession; ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** The four actions this service performs, as the confirm modal names them. */ type PinSaveAction = 'pin' | 'unpin' | 'save' | 'unsave'; /** * Owns pinning and saving for every surface that offers them — the action * sheet, the bubble indicators and both panels. * * The SDK returns the **full updated message** from each call, and pin/save * fields are present-only-when-set, so consumers swap their copy of the message * rather than patching fields. Patching would leave a stale `pinnedAt` behind * on unpin, which is the one mistake the contract calls out explicitly. * * Optimism is deliberate and reverting: the caller confirms, the UI flips * immediately, and a failure puts it back. The server is idempotent, so a * double-pin is harmless — but a permission failure or a hit cap must not leave * the UI claiming something that did not happen. */ declare class PinSaveService implements OnDestroy { /** Optional so the service still works with no toast host (SSR, tests). */ private readonly toast; /** * Targets with a request on the wire, so a double-tap cannot open a second. * * Keyed by message AND family (`42:pin`, `42:save`) rather than by message * alone. Pinning and saving are independent actions that happen to share this * service: keying on the id by itself made an in-flight pin swallow a save of * the same message, and a swallowed action is invisible — no toast, no error, * nothing for the user to retry from. */ private readonly inFlight; /** * Feature-flag answers, resolved once per session. The flags live in the * SDK's app settings, so this is a cached read rather than a network call * per render. */ private pinEnabled; private saveEnabled; private pinConversationEnabled; private readonly listenerId; private listenerAttached; /** Tracked apart from the message listener: one SDK build may have only one of them. */ private conversationListenerAttached; private readonly sessionSubscription; constructor(); /** * Whether the installed Chat SDK exposes the pin/save API at all. The kit's * peer range still admits older builds, and calling a missing method throws * synchronously rather than rejecting — so every surface asks this before * rendering, and an app on an older SDK simply sees no options. */ isSupported(): boolean; /** * The three app-level flags, resolved together and only once. * * Every surface asks before rendering, so a burst of mounting bubbles used to * mean a burst of independent lookups. Concurrent callers now share one * in-flight promise and the answer is cached for the session, mirroring how * the React kit warms these at init. * * Each flag resolves false rather than rejecting: an unavailable setting * should hide an option, not take the surface down with it. */ private featuresInFlight; private resolveFeatures; /** Resolves the app-level pin flag; false on any failure rather than throwing. */ isPinEnabled(): Promise; /** Resolves the app-level save flag; false on any failure rather than throwing. */ isSaveEnabled(): Promise; /** * Whether pinning a CONVERSATION is enabled for this app. * * Separate from the message flag: an app can have one without the other, and * checking only that the SDK exposes `pinConversation` would offer the option * on an app whose plan does not include it. */ isPinConversationEnabled(): Promise; /** * Presence of `pinnedAt` IS the boolean — there is no separate flag, and an * absent value means "not pinned", never an error and never zero. */ isPinned(message: CometChat.BaseMessage | null | undefined): boolean; /** Same rule for saves, but scoped to the viewing user. */ isSaved(message: CometChat.BaseMessage | null | undefined): boolean; /** Who pinned it, or `null`. `app_system` means an admin/global pin. */ pinnedBy(message: CometChat.BaseMessage | null | undefined): string | null; /** True when the pin came from the app rather than a person. */ isSystemPin(message: CometChat.BaseMessage | null | undefined): boolean; /** * Perform one action and return the updated message, or `null` when it failed. * * The flip is applied to the passed message BEFORE the network call so the * indicator responds immediately, then reconciled against the authoritative * copy the SDK returns — the server owns the real timestamps, and re-pinning * rewrites `pinnedBy` to the latest pinner. On failure the pre-call attributes * are restored, so a rejected pin does not leave a pin showing. * * Every step publishes, because subscribers read state off the message object * and would otherwise render the stale one. */ run(action: PinSaveAction, message: CometChat.BaseMessage): Promise; private call; /** * Turn a failure into copy the user can act on. * * The cap named in the toast comes from the app's settings, never from the * rejection: the SDK no longer exposes a way to read a structured limit off * an error, and scraping the number out of the message text guesses at prose * the backend is free to reword. */ private reportFailure; /** The cap message for an action, with the number filled in. */ private limitMessage; /** * The caps the app is configured with, cached for the session. * * `null` means the app settings carry no value for that cap — generic copy is * then correct, rather than guessing a number. */ private pinnedMessagesLimit; private savedMessagesLimit; /** * The configured cap for an action, or null when the app sets none. * * Read once and reused: it is app configuration, not per-message state, and * it is now the only source for the number — both for a rejection's toast and * for disabling a control before the user reaches the cap. */ getConfiguredLimit(action: PinSaveAction): Promise; /** * Announce a confirmed change — an ack, or a realtime frame from the server. * * The ack is published as truth even though the socket usually echoes it a * moment later: the SDK suppresses some of its own-session echoes, so the * acting device cannot rely on hearing about its own write. Both paths are * idempotent for every subscriber, so the overlap is harmless. */ private publishTruth; /** * Announce what this client is *claiming*, before the server has answered. * * `applied` is the resulting state, which is what lets one channel per pair * carry both directions: an optimistic unpin claims `pinned: false`, and the * revert of an optimistic pin claims the same thing. */ private publishOptimistic; /** The state the action is asking for: the additive half of each pair is `true`. */ private intendedState; /** * Bridge the SDK's realtime callbacks onto the kit bus. Pin events arrive for * everyone in the conversation; save events arrive only on this user's own * devices, which is what keeps a save in sync across their sessions. */ private attachSdkListener; /** * Re-register the realtime listener, dropping any earlier registration. * * Attaching used to happen once, in the constructor. This service is provided * in root, so it can be built before the SDK is initialised — and when the * registration threw there, nothing ever tried again. Pin and save then went * silent for the whole session: the person who acted saw their own optimistic * flip, everyone else saw nothing until they reloaded the page. * * Re-attaching also covers a listener that survived into a session it no * longer belongs to, which is why the old one is removed rather than kept. */ private reattachSdkListener; /** Drop both registrations, each guarded — neither is guaranteed to exist. */ private detachSdkListeners; /** Login or logout ends the session: flags and in-flight state are re-resolved. */ private resetSession; ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Conversation event subjects for handling actions related to conversations (e.g., conversation deletion) */ declare class CometChatConversationEvents { static ccConversationDeleted: Subject<_cometchat_chat_sdk_javascript.Conversation>; /** * Emitted when a conversation is updated (e.g., after marking a message as unread). * Subscribers (e.g., CometChatConversations) should refresh the conversation's unread badge. */ static ccUpdateConversation: Subject<_cometchat_chat_sdk_javascript.Conversation>; /** * Publishes a conversation event. * @param {Subject} event - The event to publish. * @param {CometChat.Conversation} conversation - The conversation associated with the event. * @deprecated Use publishConversationDeleted() instead. */ static publishEvent(event: Subject, conversation: CometChat.Conversation): void; static publishConversationDeleted(conversation: CometChat.Conversation): void; static onConversationDeleted(cb: (conversation: CometChat.Conversation) => void, destroyRef?: DestroyRef): Subscription; } /** * Payload for the `ccCardActionClicked` event (Card Messages). * `message` is the owning message — the `CardMessage` for a developer card or * the `AIAssistantMessage` for a nested agent-card block. `action` is the raw * renderer action object, forwarded untouched (the kit performs no behavior). */ interface ICardActionEvent { /** * The owning message — `CardMessage` (developer) or `AIAssistantMessage` * (persisted agent card). `null` only for a card tapped while the agent run is * still streaming (no persisted message exists yet; the persisted bubble that * follows is the source of truth). */ message: CometChat.BaseMessage | null; /** The renderer's raw discriminated action (`CometChatCardAction`) — forwarded untouched. */ action: unknown; /** The renderer element id that emitted the action (for `customCallback`). */ elementId?: string; /** The raw card JSON the action originated from (for `customCallback`). */ cardJson?: string; } /** * Message event subjects for handling actions related to messages (e.g., message sent, edited, deleted, etc.) */ declare class CometChatMessageEvents { static ccMessageSent: Subject; static ccMessageEdited: Subject; static ccReplyToMessage: Subject; static ccMessageTranslated: Subject; /** * Event for message read in message list. * Emitted when a message is marked as read. * @see Requirement 9.1 - Notify conversations component when messages are read */ static ccMessageRead: Subject; static ccMessageDeleted: Subject; /** * Emitted when a user taps an action on a card (developer card or nested * agent-card block). Pure forward — the kit performs no behavior; the app * subscribes once and runs the action. */ static ccCardActionClicked: Subject; /** * Offline support only: an own message's send state changed (`sending`, * `sent`, `failed`, `discarded`), once per transition. Never emitted while * offline support is off. `ccMessageSent` keeps its meaning and still fires. */ static ccMessageSendStateChanged: Subject; /** * Offline support only: the SDK wiped and rebuilt its offline cache, so every * list reloads. `pendingMessagesLost` is `null` when the SDK cannot know. */ static ccOfflineCacheReset: Subject; static onTextMessageReceived: Subject; static onMessageModerated: Subject; static onMediaMessageReceived: Subject; static onCustomMessageReceived: Subject; static onTypingStarted: Subject; static onTypingEnded: Subject; static onMessagesDelivered: Subject; static onMessagesRead: Subject; static onMessagesDeliveredToAll: Subject; static onMessagesReadByAll: Subject; static onMessageEdited: Subject; static onMessageDeleted: Subject; static onMessageReactionAdded: Subject; static onMessageReactionRemoved: Subject; static onCustomInteractiveMessageReceived: Subject; static onFormMessageReceived: Subject; static onCardMessageReceived: Subject; static onSchedulerMessageReceived: Subject; static onAIAssistantMessageReceived: Subject; static onAIToolResultReceived: Subject; static onAIToolArgumentsReceived: Subject; /** @deprecated Use typed publish methods instead (e.g., publishMessageSent). */ static publishEvent(event: Subject, item?: T | null): void; static publishMessageSent(data: IMessages): void; static publishMessageEdited(data: IMessages): void; static publishReplyToMessage(data: IMessages): void; static publishMessageTranslated(data: IMessages): void; static publishMessageRead(message: CometChat.BaseMessage): void; static publishMessageDeleted(message: CometChat.BaseMessage): void; static publishTextMessageReceived(message: CometChat.TextMessage): void; static publishMediaMessageReceived(message: CometChat.MediaMessage): void; static publishCustomMessageReceived(message: CometChat.CustomMessage): void; static publishTypingStarted(indicator: CometChat.TypingIndicator): void; static publishTypingEnded(indicator: CometChat.TypingIndicator): void; static publishMessagesDelivered(receipt: CometChat.MessageReceipt): void; static publishMessagesRead(receipt: CometChat.MessageReceipt): void; static publishMessagesDeliveredToAll(receipt: CometChat.MessageReceipt): void; static publishMessagesReadByAll(receipt: CometChat.MessageReceipt): void; static publishMessageModerated(message: CometChat.BaseMessage): void; static publishOnMessageEdited(message: CometChat.BaseMessage): void; static publishOnMessageDeleted(message: CometChat.BaseMessage): void; static publishMessageReactionAdded(event: CometChat.ReactionEvent): void; static publishMessageReactionRemoved(event: CometChat.ReactionEvent): void; static publishCustomInteractiveMessageReceived(message: CometChat.InteractiveMessage): void; static publishFormMessageReceived(message: CometChat.InteractiveMessage): void; static publishCardMessageReceived(message: CometChat.CardMessage): void; static publishSchedulerMessageReceived(message: CometChat.InteractiveMessage): void; static publishAIAssistantMessageReceived(message: CometChat.AIAssistantMessage): void; static publishAIToolResultReceived(message: CometChat.AIToolResultMessage): void; static publishAIToolArgumentsReceived(message: CometChat.AIToolArgumentMessage): void; static onMessageSent(cb: (data: IMessages) => void, destroyRef?: DestroyRef): Subscription; static onCcMessageEdited(cb: (data: IMessages) => void, destroyRef?: DestroyRef): Subscription; static onReplyToMessage(cb: (data: IMessages) => void, destroyRef?: DestroyRef): Subscription; static onMessageTranslated(cb: (data: IMessages) => void, destroyRef?: DestroyRef): Subscription; static onCcMessageRead(cb: (data: CometChat.BaseMessage) => void, destroyRef?: DestroyRef): Subscription; static onCcMessageDeleted(cb: (data: CometChat.BaseMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnTextMessageReceived(cb: (data: CometChat.TextMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMediaMessageReceived(cb: (data: CometChat.MediaMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnCustomMessageReceived(cb: (data: CometChat.CustomMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnTypingStarted(cb: (data: CometChat.TypingIndicator) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnTypingEnded(cb: (data: CometChat.TypingIndicator) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessagesDelivered(cb: (data: CometChat.MessageReceipt) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessagesRead(cb: (data: CometChat.MessageReceipt) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessagesDeliveredToAll(cb: (data: CometChat.MessageReceipt) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessagesReadByAll(cb: (data: CometChat.MessageReceipt) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessageModerated(cb: (data: CometChat.BaseMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessageEdited(cb: (data: CometChat.BaseMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessageDeleted(cb: (data: CometChat.BaseMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessageReactionAdded(cb: (data: CometChat.ReactionEvent) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnMessageReactionRemoved(cb: (data: CometChat.ReactionEvent) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnCustomInteractiveMessageReceived(cb: (data: CometChat.InteractiveMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnFormMessageReceived(cb: (data: CometChat.InteractiveMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnCardMessageReceived(cb: (data: CometChat.CardMessage) => void, destroyRef?: DestroyRef): Subscription; /** Subscribes to card-action clicks; auto-cleans up when destroyRef is given. */ static subscribeOnCardActionClicked(cb: (data: ICardActionEvent) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnSchedulerMessageReceived(cb: (data: CometChat.InteractiveMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnAIAssistantMessageReceived(cb: (data: CometChat.AIAssistantMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnAIToolResultReceived(cb: (data: CometChat.AIToolResultMessage) => void, destroyRef?: DestroyRef): Subscription; static subscribeOnAIToolArgumentsReceived(cb: (data: CometChat.AIToolArgumentMessage) => void, destroyRef?: DestroyRef): Subscription; } /** * Call event subjects for handling various call-related actions (like outgoing calls, call acceptance, rejections, etc.) */ declare class CometChatCallEvents { static ccOutgoingCall: Subject; static ccCallAccepted: Subject; static ccCallRejected: Subject; static ccCallEnded: Subject; static publishOutgoingCall(call: CometChat.Call): void; static publishCallAccepted(call: CometChat.Call): void; static publishCallRejected(call: CometChat.Call): void; static publishCallEnded(call: CometChat.Call): void; static onOutgoingCall(cb: (call: CometChat.Call) => void, destroyRef?: DestroyRef): Subscription; static onCallAccepted(cb: (call: CometChat.Call) => void, destroyRef?: DestroyRef): Subscription; static onCallRejected(cb: (call: CometChat.Call) => void, destroyRef?: DestroyRef): Subscription; static onCallEnded(cb: (call: CometChat.Call) => void, destroyRef?: DestroyRef): Subscription; } /** * Group event subjects for handling various group-related actions (e.g., group creation, member actions, ownership changes, etc.) */ declare class CometChatGroupEvents { static ccGroupCreated: Subject; static ccGroupDeleted: Subject; static ccGroupMemberJoined: Subject; static ccGroupLeft: Subject; static ccGroupMemberAdded: Subject; static ccGroupMemberScopeChanged: Subject; static ccGroupMemberKicked: Subject; static ccGroupMemberBanned: Subject; static ccGroupMemberUnbanned: Subject; static ccOwnershipChanged: Subject; /** @deprecated Use typed publish methods instead (e.g., publishGroupCreated). */ static publishEvent(event: Subject, group: T): void; static publishGroupCreated(group: CometChat.Group): void; static publishGroupDeleted(group: CometChat.Group): void; static publishGroupMemberJoined(data: IGroupMemberJoined): void; static publishGroupLeft(data: IGroupLeft): void; static publishGroupMemberAdded(data: IGroupMemberAdded): void; static publishGroupMemberScopeChanged(data: IGroupMemberScopeChanged): void; static publishGroupMemberKicked(data: IGroupMemberKickedBanned): void; static publishGroupMemberBanned(data: IGroupMemberKickedBanned): void; static publishGroupMemberUnbanned(data: IGroupMemberUnBanned): void; static publishOwnershipChanged(data: IOwnershipChanged): void; static onGroupCreated(cb: (group: CometChat.Group) => void, destroyRef?: DestroyRef): Subscription; static onGroupDeleted(cb: (group: CometChat.Group) => void, destroyRef?: DestroyRef): Subscription; static onGroupMemberJoined(cb: (data: IGroupMemberJoined) => void, destroyRef?: DestroyRef): Subscription; static onGroupLeft(cb: (data: IGroupLeft) => void, destroyRef?: DestroyRef): Subscription; static onGroupMemberAdded(cb: (data: IGroupMemberAdded) => void, destroyRef?: DestroyRef): Subscription; static onGroupMemberScopeChanged(cb: (data: IGroupMemberScopeChanged) => void, destroyRef?: DestroyRef): Subscription; static onGroupMemberKicked(cb: (data: IGroupMemberKickedBanned) => void, destroyRef?: DestroyRef): Subscription; static onGroupMemberBanned(cb: (data: IGroupMemberKickedBanned) => void, destroyRef?: DestroyRef): Subscription; static onGroupMemberUnbanned(cb: (data: IGroupMemberUnBanned) => void, destroyRef?: DestroyRef): Subscription; static onOwnershipChanged(cb: (data: IOwnershipChanged) => void, destroyRef?: DestroyRef): Subscription; } /** * Interfaces for various group-related events */ interface IGroupMemberScopeChanged { message: CometChat.Action; updatedUser: CometChat.GroupMember; scopeChangedTo: string; scopeChangedFrom: string; group: CometChat.Group; } interface IOwnershipChanged { group: CometChat.Group; newOwner: CometChat.GroupMember; } interface IGroupMemberKickedBanned { message: CometChat.Action; kickedFrom: CometChat.Group; kickedUser: CometChat.User; kickedBy: CometChat.User; } interface IGroupMemberUnBanned { message?: CometChat.Action; unbannedUser: CometChat.User; unbannedBy: CometChat.User; unbannedFrom: CometChat.Group; } interface IGroupMemberAdded { messages: CometChat.Action[]; usersAdded: CometChat.User[]; userAddedIn: CometChat.Group; userAddedBy: CometChat.User; } interface IGroupMemberJoined { joinedUser: CometChat.User; joinedGroup: CometChat.Group; } interface IGroupLeft { userLeft: CometChat.User; leftGroup: CometChat.Group; message: CometChat.Action; } /** * Payload of {@link CometChatThreadEvents.ccThreadSubscriptionChanged}. */ interface IThreadSubscriptionChanged { /** The root message id of the thread whose state changed. */ parentMessageId: number; /** Whether the logged-in user now follows the thread. */ subscribed: boolean; } /** * Thread event subjects, the channel that keeps the two subscription surfaces — * the thread header control and the message action sheet — in agreement without * a refetch. * * The two surfaces are separate components that can be alive at the same time * (the action sheet on the parent message in the main list, the header inside * the open thread). Both publish here on toggle and both listen here, so * following from one flips the other on the next change-detection pass. * * This is the *only* channel: the Chat SDK no longer emits subscription events, * so everything on this subject originates in the kit — a manual toggle, its * revert on failure, or a mirror of an auto-subscribe the server performed (a * reply that mentions the user, or the user replying in the thread). A * subscriber's job on a matching id is to re-render *and* to stamp the flag onto * the message objects it holds, so the source of truth stays coherent. * * This is also the channel an integrator's own thread list should subscribe to: * the UI Kit ships no threads list, so an app that builds one against * `CometChat.ThreadsRequest` needs a way to learn that a row was followed or * unfollowed from one of our surfaces. Note that unfollowing hard-deletes the * row server-side, so a list must remove it rather than re-render it. */ declare class CometChatThreadEvents { /** Emitted whenever this client's view of a thread's subscription changes. */ static ccThreadSubscriptionChanged: Subject; static publishThreadSubscriptionChanged(data: IThreadSubscriptionChanged): void; static onThreadSubscriptionChanged(cb: (data: IThreadSubscriptionChanged) => void, destroyRef?: DestroyRef): Subscription; } /** * Payload of the server-truth channels. Carries the FULL updated message, so a * consumer swaps its copy rather than patching fields — the backend sends the * whole decorated object on both REST and socket, and `pinnedAt`/`savedAt` are * present-only-when-set, so a partial patch would leave stale values behind. */ interface IPinSaveChanged { message: CometChat.BaseMessage; } /** * Payload of the optimistic pin channel. * * `pinned` is the state this client is *claiming*, which is what makes one * channel enough for both directions: an optimistic pin publishes `true`, its * revert-on-failure publishes `false`. */ interface IPinChanged { message: CometChat.BaseMessage; pinned: boolean; } /** Payload of the optimistic save channel. See {@link IPinChanged}. */ interface ISaveChanged { message: CometChat.BaseMessage; saved: boolean; } /** * Payload of the conversation server-truth channels. Carries the FULL updated * conversation, for the same reason the message channels do: the pin attributes * are present-only-when-set, so a consumer swaps its copy rather than patching. */ interface IConversationPinSaveChanged { conversation: CometChat.Conversation; } /** Payload of the optimistic conversation-pin channel. See {@link IPinChanged}. */ interface IConversationPinChanged { conversation: CometChat.Conversation; pinned: boolean; } /** * Pin and save event subjects — the channel that keeps the message bubbles, the * Pinned panel, the Saved view and the panel title counts in agreement without * a refetch. * * There are two tiers, and the split is the point: * * - **Server truth** (`ccMessagePinned` and friends) — a confirmed write or a * realtime frame. Authoritative. * - **This client's optimism** (`ccMessagePinChanged`, `ccMessageSaveChanged`) — * the flip a surface applied before the server answered, and its reversal if * the write failed. Not authoritative, and never treated as such. * * A surface almost always wants *both*: the optimism for immediate feedback and * the truth for correctness. {@link pinned$} and its siblings merge the pair per * direction, so subscribing to one observable per direction cannot drift out of * step with the other tier — prefer those over the raw subjects. * * Pin events are **broadcast**: everyone in the conversation sees a pin change, * because a pin is conversation-wide. Save events are **private** and arrive * only on the acting user's own devices, because a save is per-user — so a save * event says nothing about anyone else's view of that message. */ declare class CometChatPinSaveEvents { /** A message was pinned — conversation-wide. */ static ccMessagePinned: Subject; /** A message was unpinned — conversation-wide. */ static ccMessageUnpinned: Subject; /** The logged-in user saved a message — private, multi-device. */ static ccMessageSaved: Subject; /** The logged-in user unsaved a message — private, multi-device. */ static ccMessageUnsaved: Subject; /** This client's own pin flip, before the server confirms it (or its revert). */ static ccMessagePinChanged: Subject; /** This client's own save flip, before the server confirms it (or its revert). */ static ccMessageSaveChanged: Subject; /** A conversation was pinned — by this user elsewhere, or globally by an admin. */ static ccConversationPinned: Subject; /** A conversation was unpinned. */ static ccConversationUnpinned: Subject; /** This client's own conversation-pin flip, before the server confirms it. */ static ccConversationPinChanged: Subject; /** Pinned, whether claimed locally or confirmed by the server. */ static get pinned$(): Observable; /** Unpinned, whether claimed locally or confirmed by the server. */ static get unpinned$(): Observable; /** Saved, whether claimed locally or confirmed by the server. */ static get saved$(): Observable; /** Unsaved, whether claimed locally or confirmed by the server. */ static get unsaved$(): Observable; /** A conversation pinned, whether claimed locally or confirmed by the server. */ static get conversationPinned$(): Observable; /** A conversation unpinned, whether claimed locally or confirmed by the server. */ static get conversationUnpinned$(): Observable; static publishMessagePinned(data: IPinSaveChanged): void; static publishMessageUnpinned(data: IPinSaveChanged): void; static publishMessageSaved(data: IPinSaveChanged): void; static publishMessageUnsaved(data: IPinSaveChanged): void; static publishMessagePinChanged(data: IPinChanged): void; static publishMessageSaveChanged(data: ISaveChanged): void; static publishConversationPinned(data: IConversationPinSaveChanged): void; static publishConversationUnpinned(data: IConversationPinSaveChanged): void; static publishConversationPinChanged(data: IConversationPinChanged): void; static onMessagePinned(cb: (data: IPinSaveChanged) => void, destroyRef?: DestroyRef): Subscription; static onMessageUnpinned(cb: (data: IPinSaveChanged) => void, destroyRef?: DestroyRef): Subscription; static onMessageSaved(cb: (data: IPinSaveChanged) => void, destroyRef?: DestroyRef): Subscription; static onMessageUnsaved(cb: (data: IPinSaveChanged) => void, destroyRef?: DestroyRef): Subscription; static onConversationPinned(cb: (data: IConversationPinSaveChanged) => void, destroyRef?: DestroyRef): Subscription; static onConversationUnpinned(cb: (data: IConversationPinSaveChanged) => void, destroyRef?: DestroyRef): Subscription; } /** * Class to handle user-related events such as blocking and unblocking users */ declare class CometChatUserEvents { static ccUserBlocked: Subject; static ccUserUnblocked: Subject; /** @deprecated Use typed publish methods instead (e.g., publishUserBlocked). */ static publishEvent(event: Subject, item: CometChat.User): void; static publishUserBlocked(user: CometChat.User): void; static publishUserUnblocked(user: CometChat.User): void; static onUserBlocked(cb: (user: CometChat.User) => void, destroyRef?: DestroyRef): Subscription; static onUserUnblocked(cb: (user: CometChat.User) => void, destroyRef?: DestroyRef): Subscription; } /** * UI event subjects for handling various UI-related actions (e.g., showing panels, modals, dialogs, etc.) */ declare class CometChatUIEvents { static ccHidePanel: Subject; static ccShowPanel: Subject; static ccShowModal: Subject; static ccHideModal: Subject; static ccShowDialog: Subject; static ccHideDialog: Subject; static ccActiveChatChanged: Subject; static ccShowOngoingCall: Subject; static ccOpenChat: Subject; static ccComposeMessage: Subject; static ccMouseEvent: Subject; static ccShowMentionsCountWarning: Subject; static ccActivePopover: Subject; static publishShowPanel(panel: IPanel): void; static publishHidePanel(alignment?: PanelAlignment): void; static publishShowModal(modal: IModal): void; static publishHideModal(): void; static publishShowDialog(dialog: IDialog): void; static publishHideDialog(): void; static publishActiveChatChanged(data: IActiveChatChanged): void; static publishShowOngoingCall(data: IShowOngoingCall): void; static publishOpenChat(data: IOpenChat): void; static publishComposeMessage(text: string): void; static publishMouseEvent(data: IMouseEvent): void; static publishShowMentionsCountWarning(data: IMentionsCountWarning): void; static publishActivePopover(id: string): void; static onShowPanel(cb: (panel: IPanel) => void, destroyRef?: DestroyRef): Subscription; static onHidePanel(cb: (alignment: PanelAlignment | void) => void, destroyRef?: DestroyRef): Subscription; static onShowModal(cb: (modal: IModal) => void, destroyRef?: DestroyRef): Subscription; static onHideModal(cb: () => void, destroyRef?: DestroyRef): Subscription; static onShowDialog(cb: (dialog: IDialog) => void, destroyRef?: DestroyRef): Subscription; static onHideDialog(cb: () => void, destroyRef?: DestroyRef): Subscription; static onActiveChatChanged(cb: (data: IActiveChatChanged) => void, destroyRef?: DestroyRef): Subscription; static onShowOngoingCall(cb: (data: IShowOngoingCall) => void, destroyRef?: DestroyRef): Subscription; static onOpenChat(cb: (data: IOpenChat) => void, destroyRef?: DestroyRef): Subscription; static onComposeMessage(cb: (text: string) => void, destroyRef?: DestroyRef): Subscription; static onMouseEvent(cb: (data: IMouseEvent) => void, destroyRef?: DestroyRef): Subscription; static onShowMentionsCountWarning(cb: (data: IMentionsCountWarning) => void, destroyRef?: DestroyRef): Subscription; static onActivePopover(cb: (id: string) => void, destroyRef?: DestroyRef): Subscription; } /** * Interface for ui-related events */ interface IOpenChat { user?: CometChat.User; group?: CometChat.Group; } interface IShowOngoingCall { child: TemplateRef | CometChat.Call | CometChat.Group | null; message?: CometChat.CustomMessage; } interface IPanel { child?: TemplateRef; configuration?: Record; message?: CometChat.BaseMessage; position?: PanelAlignment; composerId?: ComposerId; } interface IModal { child?: TemplateRef; composerId?: ComposerId; } interface IActiveChatChanged { user?: CometChat.User; group?: CometChat.Group; message?: CometChat.BaseMessage; unreadMessageCount?: number; } interface IDialog { child: TemplateRef; confirmCallback: () => void; } interface IMouseEvent { event: Event; source: MouseEventSource; body?: Record; } interface IMentionsCountWarning { showWarning: boolean; id?: string; } /** * Structured error context emitted when an error is caught. */ interface ErrorContext { /** The original error that was caught */ error: Error; /** Name identifying the source component */ componentName: string; /** Epoch milliseconds when the error occurred */ timestamp: number; } /** * CometChatErrorBoundary wraps child content via `ng-content` and renders * a fallback UI when an error is reported via `handleError()`. * * @example * ```html * * * * ``` * * @example Custom fallback * ```html * * * * *

Error in {{ ctx.componentName }}: {{ ctx.error.message }}

*
* ``` */ declare class CometChatErrorBoundaryComponent { /** Optional custom fallback template rendered when an error occurs */ fallbackView?: TemplateRef<{ $implicit: ErrorContext; }>; /** Name identifying the wrapped component, used in ErrorContext */ componentName: string; /** Emits ErrorContext when an error is caught */ error: EventEmitter$1; /** Whether the component is in an error state */ hasError: _angular_core.WritableSignal; /** The current error context, or null if no error */ errorContext: _angular_core.WritableSignal; /** * Report an error to the boundary. Sets error state, logs the error, * and emits the ErrorContext via the `error` output. */ handleError(err: Error): void; /** * Reset the error state and re-render child content. * Idempotent — calling when no error has no effect. */ retry(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatActionSheet is a composite component used to display a list of action items. * It accepts an array of action items as input and emits an event when any action is clicked. * * @example * ```html * * ``` */ declare class CometChatActionSheetComponent implements AfterViewInit { private elementRef; /** * Array of action items to be displayed in the action sheet. * Each action can be either a CometChatMessageComposerAction or CometChatActionsView. */ actions: (CometChatMessageComposerAction | CometChatActionsView)[]; /** * Emitted when an action item is clicked. * The event payload contains the clicked action item. */ actionItemClick: EventEmitter$1; /** * Emitted when the action sheet should be closed (e.g., Escape key pressed). */ closeSheet: EventEmitter$1; /** * Reference to all action item elements for keyboard navigation */ actionItems: QueryList>; /** * Currently focused action index for keyboard navigation * Starts at -1 so no item is highlighted by default */ private focusedIndex; constructor(elementRef: ElementRef); ngAfterViewInit(): void; /** * Handles click on an action item. * Emits the actionItemClick event with the clicked action. * @param action The action item that was clicked */ onActionClick(action: CometChatMessageComposerAction | CometChatActionsView): void; /** * Handles keyboard events for accessibility * - Arrow Up/Down: Navigate between actions with wrap-around * - Enter/Space: Select action and close sheet * - Escape: Close action sheet * - Tab: Allow natural tab order (no focus trap) */ onKeyDown(event: KeyboardEvent): void; /** * Navigates to the next or previous action item using keyboard utilities * @param direction The navigation direction ('up' or 'down') */ private navigateToIndex; /** * Sets focus to the action item at the specified index * @param index The index of the action item to focus */ private setFocusToIndex; /** * Selects the currently focused action */ private selectCurrentAction; /** * Handles focus event on an action item * Updates the focused index when an item receives focus * @param index The index of the focused item */ onActionFocus(index: number): void; /** * TrackBy function for ngFor to improve rendering performance. * @param index The index of the item * @param action The action item * @returns A unique identifier for the action */ trackByAction(index: number, action: CometChatMessageComposerAction | CometChatActionsView): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatAvatar displays an avatar image or initials derived from a name. * If an image URL is provided, the component displays the image. * If the image fails to load or no image is provided, it shows initials from the name. * * @example * ```html * * ``` */ declare class CometChatAvatarComponent implements OnChanges { /** URL of the avatar image to be displayed */ image: string; /** Name used for displaying initials in the avatar */ name: string; /** Controls image loading strategy. Use 'eager' for above-the-fold avatars. */ loading: 'lazy' | 'eager'; /** Internal state to track if image failed to load */ imageError: boolean; /** * Normalizes null/undefined inputs to their default values. * Prevents NG0100 ExpressionChangedAfterItHasBeenCheckedError. */ ngOnChanges(changes: SimpleChanges): void; /** * Generates initials from the name. * - If name has multiple words: first char of first word + first char of second word (uppercase) * - If name is single word: first two characters (uppercase) * - If name is empty: empty string */ get initials(): string; /** * Determines if the image should be shown. * Shows image only if image URL exists and no error occurred. */ get showImage(): boolean; /** * Generates an accessible label for screen readers. * Describes the avatar content for assistive technologies. * * Falls back to a hardcoded template when the localization service has not * been initialized (e.g., in unit tests) so that the aria-label always * contains the name when one is provided. */ get ariaLabel(): string; /** * Handles image load error by setting imageError flag. * This triggers fallback to initials display. */ onImageError(): void; /** * Resets error state when image input changes. * Called via ngOnChanges or can be triggered manually. */ resetImageError(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatButton is a reusable button component with consistent styling. * Supports text, icon, loading state, and disabled state. * * @example * ```html * * ``` */ declare class CometChatButtonComponent implements OnChanges { /** Button text label */ text?: string; /** Tooltip text shown on hover */ hoverText?: string; /** Icon URL for button icon (uses CSS mask) */ iconURL?: string; /** Disabled state - prevents click events */ disabled?: boolean; /** Loading state - shows loading animation and disables button */ isLoading: boolean; /** Custom aria-label for accessibility (useful for icon-only buttons) */ ariaLabel?: string; /** Icon-only mode - removes default width and padding for compact icon buttons */ iconOnly: boolean; /** Emitted when button is clicked (only when not disabled and not loading) */ buttonClick: EventEmitter$1; /** Path to loading animation SVG (inline data URI for portability) */ readonly loadingIconURL = "data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 22C10.6333 22 9.34167 21.7375 8.125 21.2125C6.90833 20.6875 5.84583 19.9708 4.9375 19.0625C4.02917 18.1542 3.3125 17.0917 2.7875 15.875C2.2625 14.6583 2 13.3667 2 12C2 10.6167 2.2625 9.32083 2.7875 8.1125C3.3125 6.90417 4.02917 5.84583 4.9375 4.9375C5.84583 4.02917 6.90833 3.3125 8.125 2.7875C9.34167 2.2625 10.6333 2 12 2C12.2833 2 12.5208 2.09583 12.7125 2.2875C12.9042 2.47917 13 2.71667 13 3C13 3.28333 12.9042 3.52083 12.7125 3.7125C12.5208 3.90417 12.2833 4 12 4C9.78333 4 7.89583 4.77917 6.3375 6.3375C4.77917 7.89583 4 9.78333 4 12C4 14.2167 4.77917 16.1042 6.3375 17.6625C7.89583 19.2208 9.78333 20 12 20C14.2167 20 16.1042 19.2208 17.6625 17.6625C19.2208 16.1042 20 14.2167 20 12C20 11.7167 20.0958 11.4792 20.2875 11.2875C20.4792 11.0958 20.7167 11 21 11C21.2833 11 21.5208 11.0958 21.7125 11.2875C21.9042 11.4792 22 11.7167 22 12C22 13.3667 21.7375 14.6583 21.2125 15.875C20.6875 17.0917 19.9708 18.1542 19.0625 19.0625C18.1542 19.9708 17.0958 20.6875 15.8875 21.2125C14.6792 21.7375 13.3833 22 12 22Z' fill='%23FFFFFF'/%3E%3C/svg%3E"; /** * Normalizes null/undefined inputs to their default values. * Prevents NG0100 ExpressionChangedAfterItHasBeenCheckedError. */ ngOnChanges(changes: SimpleChanges): void; /** * Handles button click event. * Only emits if button is not disabled and not loading. */ onButtonClick(event: MouseEvent): void; /** * Handles keyboard events for accessibility. * Activates button on Enter or Space key press. * Requirement 11.2: Support Enter/Space key activation */ onKeyDown(event: KeyboardEvent): void; /** * Stops event propagation on mouse down/up to prevent parent handlers. */ onMouseEvent(event: MouseEvent): void; /** * Determines if the button should be disabled. */ get isDisabled(): boolean; /** * Generates accessible label for the button. * Priority: custom ariaLabel > text > hoverText > default */ get accessibleLabel(): string | undefined; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatConfirmDialog is a dialog component for confirmation actions. * It includes a title, description, and action buttons (confirm/cancel). * Can be used for displaying warning, alert, and info popups. * * Accessibility features: * - role="dialog" and aria-modal="true" for screen readers * - aria-labelledby references the dialog title * - Focus trap keeps Tab navigation within the dialog * - Escape key closes the dialog * - Focus is restored to the previously focused element on close * * @example * ```html * * ``` */ declare class CometChatConfirmDialogComponent implements OnInit, AfterViewInit, OnDestroy { /** Dialog title - defaults to localized "conversation_delete_title" */ title: string; /** Dialog message text - defaults to localized "conversation_delete_subtitle" */ messageText: string; /** Cancel button text - defaults to localized "conversation_delete_confirm_no" */ cancelButtonText: string; /** Confirm button text - defaults to localized "conversation_delete_confirm_yes" */ confirmButtonText: string; /** Custom icon URL for the dialog icon. When set, overrides the default delete icon via inline style. */ iconURL: string; /** Emitted when confirm button is clicked */ confirmClick: EventEmitter$1; /** Emitted when cancel button is clicked */ cancelClick: EventEmitter$1; /** Reference to the dialog container element */ dialogContainer: ElementRef; /** Unique ID for the title element for aria-labelledby */ titleId: string; /** Internal loading state - shows loading animation on confirm button */ isLoading: boolean; /** Internal error state - shows error message when true */ isError: boolean; /** FocusTrapService for managing focus within the dialog */ private focusTrapService; /** Keyboard event listener reference for cleanup */ private escapeKeyListener; /** Error message from localization */ get errorMessage(): string; ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; /** * Handles Escape key to close the dialog. * Focus trap Tab cycling is handled by FocusTrapService. */ private handleEscapeKey; /** * Handles confirm button click. * Sets loading state and emits confirmClick event. */ handleSubmitClick(): void; /** * Handles cancel button click. * Emits cancelClick event. */ handleCancelClick(): void; /** * Called by parent to indicate success. * Resets loading and error states. */ setSuccess(): void; /** * Called by parent to indicate error. * Shows error message and resets loading state. */ setError(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Link data interface for add/edit operations */ interface LinkData { /** Display text for the link */ text: string; /** URL for the link */ url: string; } /** * CometChatLinkDialog is a dialog component for adding and editing links in rich text. * It includes input fields for link text and URL, with validation and action buttons. * * @example * ```html * * * * * * ``` */ declare class CometChatLinkDialogComponent implements OnInit, AfterViewInit, OnDestroy { /** @internal Timer references for cleanup */ private pendingTimers; /** * Dialog mode - 'add' for new links, 'edit' for existing links * @default 'add' */ mode: 'add' | 'edit'; /** * Initial text value (for edit mode or pre-filled add mode) */ initialText: string; /** * Initial URL value (for edit mode) */ initialUrl: string; /** * Selected text from editor (used as default text in add mode) */ selectedText: string; /** * Emitted when save button is clicked with valid link data */ save: EventEmitter$1; /** * Emitted when cancel button is clicked */ cancel: EventEmitter$1; /** * Emitted when remove button is clicked (edit mode only) */ remove: EventEmitter$1; /** Reference to the dialog container element */ dialogContainer: ElementRef; /** Reference to the text input element */ textInput: ElementRef; /** Reference to the URL input element */ urlInput: ElementRef; /** Unique ID for the title element for aria-labelledby */ titleId: string; /** Unique ID for the error message element for aria-describedby */ errorId: string; /** Link text value */ linkText: _angular_core.WritableSignal; /** Link URL value */ linkUrl: _angular_core.WritableSignal; /** Validation error message */ errorMessage: _angular_core.WritableSignal; /** Store the previously focused element for restoration */ private previouslyFocusedElement; /** Store all focusable elements within the dialog */ private focusableElements; /** Keyboard event listener reference for cleanup */ private keydownListener; /** URL validation regex */ private urlPattern; ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; /** * Sets up focus trapping within the dialog. * Finds all focusable elements and adds Tab key handling. */ private setupFocusTrap; /** * Handles keyboard events for accessibility. * - Escape key: closes the dialog * - Tab key: traps focus within the dialog * - Enter key: saves the link (if valid) */ private handleKeydown; /** * Restores focus to the element that was focused before the dialog opened. */ private restoreFocus; /** * Validates the URL format */ private validateUrl; /** * Normalizes URL by adding protocol if missing */ private normalizeUrl; /** * Handles save button click. * Validates inputs and emits save event with link data. */ handleSaveClick(): void; /** * Handles cancel button click. * Emits cancel event. */ handleCancelClick(): void; /** * Handles remove button click (edit mode only). * Emits remove event. */ handleRemoveClick(): void; /** * Handles text input change */ onTextChange(value: string): void; /** * Handles URL input change */ onUrlChange(value: string): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Link data interface */ interface LinkPopoverData { url: string; text: string; } /** * CometChatLinkPopoverComponent * * A small popover that appears when clicking on a link in the editor. * Shows "Edit" and "Remove" buttons for quick link actions. * Positioned above the clicked link using viewport coordinates. * * @component */ declare class CometChatLinkPopoverComponent implements OnInit, AfterViewInit, OnDestroy { private hostEl; /** @internal Timer references for cleanup */ private pendingTimers; popoverElement: ElementRef; editButton: ElementRef; removeButton: ElementRef; /** The link URL to display */ url: string; /** The link text */ text: string; /** X coordinate (viewport-relative center of the link element) */ x: number; /** Y coordinate (viewport-relative top of the link element) */ y: number; /** Emitted when the Edit button is clicked */ editClick: EventEmitter$1; /** Emitted when the Remove button is clicked */ removeClick: EventEmitter$1; /** Emitted when the popover should be closed */ closeClick: EventEmitter$1; /** Whether the popover position has been calculated */ isPositioned: boolean; /** Calculated position styles */ popoverTop: number; popoverLeft: number; /** Store the previously focused element for restoration */ private previouslyFocusedElement; /** Keyboard event listener reference for cleanup */ private keydownListener; /** Document click listener for closing on outside click */ private documentClickListener; /** Current focused menu item index (0 = edit, 1 = remove) */ private focusedIndex; constructor(hostEl: ElementRef); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; private handleKeydown; /** * Keeps Tab focus cycling within the popover (dialog focus trap), so the * close button and URL link are reachable instead of Tab closing the popover. */ private trapTabFocus; private focusNextItem; private focusPreviousItem; private restoreFocus; /** * Initial position estimate using link x/y coordinates. * Uses estimated dimensions before the popover has been laid out. */ private positionAboveLink; /** * Fallback positioning: center above the composer element. */ private positionAboveComposer; /** * Refine position after layout using actual popover dimensions. */ private refinePosition; /** * Finds the nearest [data-cometchat-container] ancestor element. * Used to scope positioning to the Storybook story container. */ private findContainerAncestor; /** Handle document click to close popover when clicking outside */ private handleDocumentClick; handleEditClick(): void; handleRemoveClick(): void; handleCloseClick(): void; /** Prevent clicks inside popover from bubbling to document listener */ handlePopoverClick(event: MouseEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Types and interfaces for CometChatContextMenu component. */ /** Type alias for menu item types */ type ContextMenuItem = CometChatActionsIcon | CometChatActionsView | CometChatOption; /** * CometChatContextMenu displays menu data in a required format. * Accepts a data array and topMenuSize to specify how many items are visible by default. */ declare class CometChatContextMenuComponent implements OnInit, OnDestroy, AfterViewInit { data: ContextMenuItem[]; topMenuSize: number; moreIconHoverText?: string; placement: Placement; closeOnOutsideClick: boolean; disableBackgroundInteraction: boolean; useParentContainer: boolean; useParentHeight: boolean; forceStaticPlacement: boolean; /** * Anchor the dropdown to this component's own box instead of to the "…" * button inside it. * * The "…" is the LAST control in a hover column that also holds the quick * options, so anchoring to it opens the dropdown a full column-width away * from whatever the column belongs to. Hosts that sit their column flush * against their content — the message bubble — set this so the dropdown lands * against the content instead, overlapping the quick options rather than * clearing them. */ anchorToHost: boolean; optionClick: EventEmitter$1; /** * Fires when the dropdown opens or closes. A host that renders this menu only * on hover needs it: the dropdown portals to document.body, so reaching for * it moves the pointer off the host, and without this the host unmounts the * menu before anything in it can be clicked. */ openChange: EventEmitter$1; moreButtonRef: ElementRef; subMenuRef: ElementRef; groupFlyoutRef?: ElementRef; menuItemRefs: QueryList>; topMenuItemRefs: QueryList>; showSubMenu: boolean; positionStyle: Record; private positionPreCalculated; focusedItemIndex: number; focusedTopMenuIndex: number; private readonly cdr; private readonly hostRef; private parentViewRef; private resizeTimeoutRef; private boundHandleClickOutside; private boundHandleOtherMenuOpen; private readonly instanceId; constructor(); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; private handleOtherMenuOpen; private boundHandleResize; handleKeydown(event: KeyboardEvent): void; private focusItemAtIndex; private originalSubMenuParent; private closeSubMenu; get topMenu(): ContextMenuItem[]; get subMenu(): ContextMenuItem[]; get shouldShowMoreButton(): boolean; /** * The menu's width before it has been measured. * * Read from `--cometchat-context-menu-menu-width` so the stylesheet stays the * single source of truth: the constant below is only a last resort for when * the property cannot be resolved. Hard-coding it here meant a theme that * retuned the width silently pushed a left-opening menu off by the * difference, with nothing but a comment to catch it. */ private resolveMenuWidth; private handleClickOutside; private handleResize; handleMenuClick(event?: Event): void; onMenuItemClick(item: ContextMenuItem, event?: Event): void; /** Id of the group whose flyout is open, or null. One at a time. */ openGroupId: string | null; hasChildren(item: ContextMenuItem): boolean; childrenOf(item: ContextMenuItem): CometChatActionsIcon[]; /** True when the flyout opens to the LEFT because the right edge has no room. */ groupFlyoutFlipped: boolean; /** * Inline `left` for the flyout, in px from the anchor, when neither side of * the menu can hold it — a narrow window, where flipping just swaps which * edge does the clipping. Null whenever a side fits and CSS can place it. */ groupFlyoutShift: number | null; openGroup(item: ContextMenuItem): void; /** * Flip the flyout to the left when opening right would run off screen. * * Which side has room depends on where the MENU sits, not on how wide the * window is — a menu near the right edge of a wide window overflows exactly * as it would on a narrow one. So this measures the rendered flyout instead * of relying on a width breakpoint, and only flips when the left side can * actually hold it, since flipping into a clipped left edge fixes nothing. */ private alignGroupFlyout; closeGroup(): void; /** Enter and Space activate a child; Escape returns to the parent list. */ onGroupChildKeydown(event: KeyboardEvent, child: ContextMenuItem): void; onMoreButtonMouseEnter(): void; onOverlayClick(event: MouseEvent): void; isActionsView(item: ContextMenuItem): item is CometChatActionsView; getIconStyle(item: ContextMenuItem): Record; getItemId(item: ContextMenuItem): string; getItemTitle(item: ContextMenuItem): string; private getPopoverPositionStyle; private calculatePopoverPosition; /** * Re-anchor the dropdown horizontally to the edge of this component's own box * that faces the content it belongs to. See `anchorToHost`. * * Vertical placement is left exactly as computed — the flip between above and * below still depends on the room available, and only the sideways offset was * ever wrong. */ private applyHostAnchor; private setMenuHeight; getSubMenuItemIndex(item: ContextMenuItem): number; trackByItem(index: number, item: ContextMenuItem): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; static ngAcceptInputType_data: ContextMenuItem[] | null | undefined; } declare class CometChatConversationItemComponent implements OnInit, OnDestroy { private formatterConfig; private htmlSanitizer; private globalConfig; private subtitleService; conversation: CometChat.Conversation; isActive: boolean; isSelected: boolean; isFocused: boolean; tabIndex: number; typingIndicator: CometChat.TypingIndicator | null; loggedInUser: CometChat.User | null; private hideReceiptsExplicitlySet; private hideUserStatusExplicitlySet; private hideGroupTypeExplicitlySet; private disableDefaultContextMenuExplicitlySet; private textFormattersExplicitlySet; private _hideReceipts; private _hideUserStatus; private _hideGroupType; private _disableDefaultContextMenu; private _textFormatters; set hideReceipts(value: boolean); get hideReceipts(): boolean; set hideUserStatus(value: boolean); get hideUserStatus(): boolean; set hideGroupType(value: boolean); get hideGroupType(): boolean; dateFormat?: CalendarObject; set disableDefaultContextMenu(value: boolean); get disableDefaultContextMenu(): boolean; set textFormatters(value: CometChatTextFormatter[]); get textFormatters(): CometChatTextFormatter[]; effectiveHideReceipts: _angular_core.Signal; private readonly presenceHidden; effectiveHideUserStatus: _angular_core.Signal; effectiveHideGroupType: _angular_core.Signal; effectiveDisableDefaultContextMenu: _angular_core.Signal; effectiveTextFormatters: _angular_core.Signal; slots?: Partial; contextMenuOptions?: CometChatOption[]; leadingView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; titleView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; subtitleView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; trailingView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; itemClick: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; itemSelect: EventEmitter$1<{ conversation: CometChat.Conversation; selected: boolean; }>; avatarClick: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; titleClick: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; subtitleClick: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; timestampClick: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; badgeClick: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; contextMenuOpen: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; contextMenuOptionClick: EventEmitter$1<{ option: CometChatOption; conversation: CometChat.Conversation; }>; contextMenuKeyboardOpen: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; readonly Placement: typeof Placement; isHovered: boolean; /** True while this row's context-menu dropdown is open — see the template. */ isMenuOpen: boolean; constructor(formatterConfig: FormatterConfigService, htmlSanitizer: HtmlSanitizerService); ngOnInit(): Promise; ngOnDestroy(): void; get conversationWith(): CometChat.User | CometChat.Group | null; get isUserConversation(): boolean; get isGroupConversation(): boolean; get isAgentConversation(): boolean; get avatarImage(): string; get avatarName(): string; get userStatus(): string; get groupType(): string; get unreadCount(): number; /** * Whether to mark this row as pinned. * * The presence of the timestamp IS the boolean — an unpinned conversation * carries no key at all, so this is never "pinned at 0". `isPinned()` covers * both a personal pin and an app-wide one, and is guarded because an older * Chat SDK build does not expose it. */ get isPinned(): boolean; get lastMessage(): CometChat.BaseMessage | undefined; get lastMessageTimestamp(): number; get isTyping(): boolean; get isLastMessageByMe(): boolean; get hasLastMessage(): boolean; get receiptStatus(): 'wait' | 'sent' | 'delivered' | 'read' | null; /** Offline support only: the own last message failed to send (the preview shows the error mark). */ get previewSendFailed(): boolean; get subtitleText(): string; get subtitleIconName(): string; private getCallIconName; private isMissedCall; private getMeetingIconName; private isURL; private hasMarkdownLink; private formatLastMessageSubtitle; /** Memo for {@link getMediaSubtitle}; both subtitle getters run on every change detection. */ private mediaSubtitleMemo?; /** * Subtitle for an image/video/audio/file message: the type label with an attachment count, and * the caption when there is one — e.g. "3 Images · nice trip". Voice notes read "Voice Note". * * `text` and `isHtml` are produced together and memoized, because `subtitleText` and * `subtitleHasHtml` are independent getters: computing the caption twice risks them disagreeing * about whether the string is HTML, which would render raw markup or escape real markup. */ private getMediaSubtitle; /** * Render arbitrary message text (a text message's body, or a media message's caption) for the * subtitle: rich-text metadata wins, then markdown -> sanitized HTML, else plain text with SDK * mention tags resolved. * * Reports `isHtml` alongside the string instead of leaving callers to re-derive it from the raw * input: a predicate that disagreed with the branch actually taken here would either print markup * as literal text or hand unescaped text to `[innerHTML]`. */ private renderSubtitleSource; /** {@link renderSubtitleSource} for callers that only need the rendered string. */ private formatSubtitleSource; private getFormattersForSubtitle; private hasSdkMentionTags; get subtitleHasHtml(): boolean; private sanitizeSubtitleHtml; private formatPlainMentions; get senderNamePrefix(): string; private getActionMessageText; private getCallMessageText; private getCustomMessageText; private getMeetingMessageText; get slotContext(): ConversationSlotContext; get accessibleLabel(): string; private getPlainSubtitleText; handleClick(): void; handleMouseDown(event: MouseEvent): void; handleAvatarClick(event: Event): void; handleTitleClick(event: Event): void; handleSubtitleClick(event: Event): void; handleTimestampClick(event: Event): void; handleBadgeClick(event: Event): void; handleContextMenuOpen(): void; handleContextMenu(event: MouseEvent): void; handleContextMenuOptionClick(option: CometChatOption): void; onKeyDown(event: KeyboardEvent): void; private openContextMenuViaKeyboard; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; static ngAcceptInputType_hideReceipts: unknown; static ngAcceptInputType_hideUserStatus: unknown; static ngAcceptInputType_hideGroupType: unknown; static ngAcceptInputType_disableDefaultContextMenu: unknown; } /** * Types for CometChatCreatePoll component. */ /** Interface representing a poll option with unique ID and value. */ interface PollOption { /** Unique identifier for the option */ id: string; /** Option text value */ value: string; } /** * CometChatCreatePoll is a modal component for creating poll messages (2-12 options). * @see Requirements 1.1-1.23 */ declare class CometChatCreatePollComponent implements OnInit, OnDestroy, AfterViewInit { private pendingTimers; private messageComposerService; private elementRef; modalContainer: ElementRef; closeButton: ElementRef; private previouslyFocusedElement; private focusableElements; private readonly FOCUSABLE_SELECTOR; onEscapeKey(event: Event): void; onTabKey(event: Event): void; onShiftTabKey(event: Event): void; title?: string; user?: CometChat.User; group?: CometChat.Group; replyToMessage?: CometChat.BaseMessage; defaultAnswers: number; questionPlaceholderText?: string; answerPlaceholderText?: string; answerHelpText?: string; addAnswerText?: string; createPollButtonText?: string; closeClick: EventEmitter$1; pollCreated: EventEmitter$1; error: EventEmitter$1<_cometchat_chat_sdk_javascript.CometChatException>; question: _angular_core.WritableSignal; options: _angular_core.WritableSignal; isLoading: _angular_core.WritableSignal; errorMessage: _angular_core.WritableSignal; canCreate: _angular_core.Signal; isAddDisabled: _angular_core.Signal; limitMessage: _angular_core.Signal; ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; private updateFocusableElements; private handleTabKey; private returnFocusToPreviousElement; private initializeOptions; /** * Generates a unique ID for poll options. */ private generateUniqueId; /** * Handles close button click. * Emits closeClick event. */ onCloseClick(): void; /** * Handles question input change. * @param value - The new question value */ onQuestionChange(value: string): void; /** * Handles option value change. * @param index - The index of the option to update * @param value - The new option value */ onOptionChange(index: number, value: string): void; /** * Updates an option value. * @param index - The index of the option to update * @param value - The new option value */ updateOption(index: number, value: string): void; /** * Adds a new empty option to the poll. * Maximum 12 options allowed. * @see Requirements 1.4, 1.5 */ addOption(): void; /** * Removes an option from the poll. * Minimum 2 options required. * @param index - The index of the option to remove * @see Requirements 1.7, 1.8 */ removeOption(index: number): void; /** * Determines if the remove button should be shown for an option. * Only show remove button when there are more than 2 options. * @param _index - The index of the option (unused, kept for template compatibility) * @returns Whether to show the remove button * @see Requirement 1.7 */ canRemoveOption(_index: number): boolean; /** * Handles create poll button click. * Validates input and creates the poll. * @see Requirements 1.9, 1.10, 1.11, 1.12, 1.15, 1.16, 1.17 */ onCreateClick(): Promise; /** * Converts an unknown error to CometChat.CometChatException * @param error - The error to convert * @returns CometChat.CometChatException */ private toCometchatException; /** * Gets the valid (non-empty) options. * @returns Array of non-empty option values */ getValidOptions(): string[]; /** * Track by function for ngFor optimization. * @param _index - The index of the item (unused) * @param option - The poll option * @returns The unique ID of the option */ trackByOptionId(_index: number, option: PollOption): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } type ContractMessageState = 'sending' | 'sent' | 'delivered' | 'read' | 'failed'; /** * CometChatPaginatedList is a generic, reusable component for infinite scroll lists. * Handles pagination, loading states, empty states, and error states. * Uses IntersectionObserver for efficient scroll detection. */ declare class CometChatPaginatedListComponent implements OnInit, OnDestroy, AfterViewInit, OnChanges { private pendingTimers; private cdr; private listNavigationService; private liveAnnouncer; /** Null/undefined are treated as an empty list (setter keeps T inference for consumers). */ set items(value: T[] | null | undefined); get items(): T[]; private _items; trackByFn: (index: number, item: T) => any; isLoading: boolean; hasMore: boolean; error: Error | null; showScrollbar: boolean; loadingThreshold: number; /** * When true, uses the viewport as the IntersectionObserver root instead of * the list container. Useful when a parent container handles scrolling. */ observeScrollFromViewport: boolean; ariaLabel: string; enableKeyboardNavigation: boolean; isMultiSelect: boolean; emptyStateAriaLabel: string; errorStateAriaLabel: string; hideError: boolean; isItemSelected: (item: T) => boolean; itemTemplate?: TemplateRef<{ $implicit: T; index: number; }>; loadingTemplate?: TemplateRef; emptyTemplate?: TemplateRef; errorTemplate?: TemplateRef<{ $implicit: Error; }>; loadingMoreTemplate?: TemplateRef; loadMore: EventEmitter$1; scrollToTop: EventEmitter$1; scrollToBottom: EventEmitter$1; itemClick: EventEmitter$1<{ item: T; index: number; }>; focusedIndexChange: EventEmitter$1; retry: EventEmitter$1; listContainer?: ElementRef; scrollTopAnchor?: ElementRef; scrollBottomAnchor?: ElementRef; listItemElements?: QueryList>; emptyStateContainer?: ElementRef; errorStateContainer?: ElementRef; isFetchingMore: _angular_core.WritableSignal; focusedIndex: _angular_core.WritableSignal; isEmpty(): boolean; hasItems(): boolean; showLoadingMore(): boolean; private scrollTopObserver?; private scrollBottomObserver?; private previousIsLoading; private previousItemsLength; private previousError; private initialFocusSet; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; ngOnDestroy(): void; private setupIntersectionObservers; private handleLoadMore; private disconnectObservers; handleItemClick(item: T, index: number): void; loadComplete(): void; scrollToTopPosition(): void; scrollToBottomPosition(): void; onListKeyDown(event: KeyboardEvent): void; setFocusedIndex(index: number): void; getItemTabIndex(index: number): number; onItemFocus(index: number): void; onRetry(): void; handleItemDeleted(deletedIndex: number): void; private handleLoadingToLoadedTransition; private handleInfiniteScrollLoad; focusFirstItem(): void; private focusFirstItemWithoutScroll; focusEmptyState(): void; focusErrorState(): void; private scrollItemIntoView; private announceLoadingMore; announceItemsLoaded(count: number): void; announceAllItemsLoaded(): void; announceLoadError(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵcmp: _angular_core.ɵɵComponentDeclaration, "cometchat-paginated-list", never, { "items": { "alias": "items"; "required": false; }; "trackByFn": { "alias": "trackByFn"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "hasMore": { "alias": "hasMore"; "required": false; }; "error": { "alias": "error"; "required": false; }; "showScrollbar": { "alias": "showScrollbar"; "required": false; }; "loadingThreshold": { "alias": "loadingThreshold"; "required": false; }; "observeScrollFromViewport": { "alias": "observeScrollFromViewport"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "enableKeyboardNavigation": { "alias": "enableKeyboardNavigation"; "required": false; }; "isMultiSelect": { "alias": "isMultiSelect"; "required": false; }; "emptyStateAriaLabel": { "alias": "emptyStateAriaLabel"; "required": false; }; "errorStateAriaLabel": { "alias": "errorStateAriaLabel"; "required": false; }; "hideError": { "alias": "hideError"; "required": false; }; "isItemSelected": { "alias": "isItemSelected"; "required": false; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; }; "loadingTemplate": { "alias": "loadingTemplate"; "required": false; }; "emptyTemplate": { "alias": "emptyTemplate"; "required": false; }; "errorTemplate": { "alias": "errorTemplate"; "required": false; }; "loadingMoreTemplate": { "alias": "loadingMoreTemplate"; "required": false; }; }, { "loadMore": "loadMore"; "scrollToTop": "scrollToTop"; "scrollToBottom": "scrollToBottom"; "itemClick": "itemClick"; "focusedIndexChange": "focusedIndexChange"; "retry": "retry"; }, never, never, true, never>; } declare class CometChatSearchBarComponent implements OnInit, OnChanges, OnDestroy { /** Initial/controlled search text value */ searchText: string; /** Placeholder text for the search input */ placeholderText: string; /** Debounce delay in milliseconds (default: 300ms) */ debounceDelay: number; /** Custom aria-label for the search input (overrides placeholderText) */ ariaLabel?: string; /** Emitted when search text changes (debounced) */ searchChanged: EventEmitter$1<{ value: string; }>; /** Emitted when clear button is clicked */ clearClick: EventEmitter$1; /** * Emitted when ArrowDown is pressed to move focus to the first list item. * Parent components should listen to this event and focus the first item in their list. * Requirement 12.3: ArrowDown from search bar moves focus to first list item */ focusFirstListItem: EventEmitter$1; searchValue: string; private searchSubject; private readonly destroyRef; searchInputRef: ElementRef; ngOnInit(): void; ngOnChanges(): void; ngOnDestroy(): void; /** * Handle keyboard events for accessibility * Implements: * - Escape key to clear search (Requirement 12.4) * - ArrowDown to move focus to first list item (Requirement 12.3) */ handleKeydown(event: KeyboardEvent): void; onSearchValueChange(value: string): void; /** @deprecated Use onSearchValueChange instead */ onInputChange(event: Event): void; onClearClick(): void; get showClearButton(): boolean; /** * Get the aria-label for the search input * Uses custom ariaLabel if provided, otherwise falls back to placeholderText */ get searchAriaLabel(): string; /** * Get the aria-label for the clear button using localization * Requirement 6.5: Clear button shall have aria-label for screen reader context */ get clearButtonAriaLabel(): string; /** * Handle keyboard events on the clear button * Requirement 6.6: Clear button shall be activatable via Enter or Space keys */ onClearKeyDown(event: KeyboardEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; static ngAcceptInputType_searchText: string | null | undefined; } declare class CometChatConversationsComponent implements OnInit, OnDestroy { readonly shimmerList: readonly number[]; private cdr; private toast; private pinSave; private conversationsService; /** @internal Offline (D84 rule 7): a list with a search keyword that needs the server says "Connect to search". */ get offlineConnectToSearch(): boolean; /** @internal Offline (D84 rule 3): nothing saved and no connection says "Connect to load chats". */ get offlineConnectToLoad(): boolean; private offlineHubService; /** While mounted, this list shows the cache-reset notices instead of the message list. */ private releaseOfflineNotices; private templatesService; private chatStateService; private formatterConfigService; private liveAnnouncer; private globalConfig; private hideReceiptsExplicitlySet; private hideErrorExplicitlySet; private hideUserStatusExplicitlySet; private hideGroupTypeExplicitlySet; private showScrollbarExplicitlySet; private showSearchBarExplicitlySet; private disableSoundForMessagesExplicitlySet; private textFormattersExplicitlySet; private disableDefaultContextMenuExplicitlySet; private customSoundForMessagesExplicitlySet; private _hideReceipts; private _hideError; private _hideUserStatus; private _hideGroupType; private _showScrollbar; private _showSearchBar; private _disableSoundForMessages; private _textFormatters; private _disableDefaultContextMenu; private _customSoundForMessages; set hideReceipts(value: boolean); get hideReceipts(): boolean; set hideError(value: boolean); get hideError(): boolean; /** Hides the Pin conversation entry from the row menu. */ hidePinConversation: boolean; hideDeleteConversation: boolean; /** * Offline support only: hide the notice shown when the SDK's offline cache * was reset and unsent messages were or may have been lost. Has no effect * while offline support is off. */ hideOfflineNotices: boolean; set hideUserStatus(value: boolean); get hideUserStatus(): boolean; set hideGroupType(value: boolean); get hideGroupType(): boolean; set disableDefaultContextMenu(value: boolean); get disableDefaultContextMenu(): boolean; set showScrollbar(value: boolean); get showScrollbar(): boolean; set showSearchBar(value: boolean); get showSearchBar(): boolean; conversationsRequestBuilder?: CometChat.ConversationsRequestBuilder; activeConversation?: CometChat.Conversation; set textFormatters(value: CometChatTextFormatter[]); get textFormatters(): CometChatTextFormatter[]; selectionMode: SelectionMode; lastMessageDateTimeFormat?: CalendarObject; options?: (conversation: CometChat.Conversation) => CometChatOption[]; set disableSoundForMessages(value: boolean); get disableSoundForMessages(): boolean; set customSoundForMessages(value: string); get customSoundForMessages(): string; slots?: Partial; headerView?: TemplateRef; menuView?: TemplateRef; loadingView?: TemplateRef; emptyView?: TemplateRef; errorView?: TemplateRef; searchView?: TemplateRef; itemView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; leadingView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; titleView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; subtitleView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; trailingView?: TemplateRef<{ $implicit: CometChat.Conversation; }>; listItemTemplate: TemplateRef | null; emptyStateTemplate: TemplateRef | null; errorStateTemplate: TemplateRef | null; loadingStateTemplate: TemplateRef | null; headerViewContent?: TemplateRef; menuViewContent?: TemplateRef; loadingViewContent?: TemplateRef; emptyViewContent?: TemplateRef; errorViewContent?: TemplateRef; searchViewContent?: TemplateRef; itemViewContent?: TemplateRef<{ $implicit: CometChat.Conversation; }>; leadingViewContent?: TemplateRef<{ $implicit: CometChat.Conversation; }>; titleViewContent?: TemplateRef<{ $implicit: CometChat.Conversation; }>; subtitleViewContent?: TemplateRef<{ $implicit: CometChat.Conversation; }>; trailingViewContent?: TemplateRef<{ $implicit: CometChat.Conversation; }>; paginatedList?: CometChatPaginatedListComponent; searchBar?: CometChatSearchBarComponent; dialogOverlay?: ElementRef; selectionControlTemplate?: TemplateRef; itemClick: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; select: EventEmitter$1<{ conversation: CometChat.Conversation; selected: boolean; }>; error: EventEmitter$1<_cometchat_chat_sdk_javascript.CometChatException>; searchBarClick: EventEmitter$1; contextMenuOpen: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; contextMenuClose: EventEmitter$1<_cometchat_chat_sdk_javascript.Conversation>; scrollToTop: EventEmitter$1; scrollToBottom: EventEmitter$1; selectionChange: EventEmitter$1; conversations: Signal; loadingState: Signal; errorState: Signal; activeConversationSignal: Signal; typingIndicators: Signal>; selectedConversations: _angular_core.WritableSignal>; focusedIndex: _angular_core.WritableSignal; showDeleteConfirmDialog: _angular_core.WritableSignal; conversationToDelete: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.Conversation | null>; isFetchingMore: _angular_core.WritableSignal; hasMore: _angular_core.WritableSignal; hasSelection: Signal; selectedCount: Signal; isSelectionModeActive: Signal; shouldShowDeleteDialog: Signal; hasConversations: Signal; isLoading: Signal; hasError: Signal; effectiveHideReceipts: Signal; effectiveHideError: Signal; effectiveHideUserStatus: Signal; effectiveHideGroupType: Signal; effectiveShowScrollbar: Signal; effectiveShowSearchBar: Signal; effectiveDisableSoundForMessages: Signal; effectiveTextFormatters: Signal; effectiveDisableDefaultContextMenu: Signal; effectiveCustomSoundForMessages: Signal; private get _ct(); get effectiveItemView(): TemplateRef | undefined; get effectiveLeadingView(): TemplateRef | undefined; get effectiveTitleView(): TemplateRef | undefined; get effectiveSubtitleView(): TemplateRef | undefined; get effectiveTrailingView(): TemplateRef | undefined; get effectiveLoadingView(): TemplateRef | undefined; get effectiveEmptyView(): TemplateRef | undefined; get effectiveErrorView(): TemplateRef | undefined; loggedInUser: CometChat.User | null; private searchSubject$; currentSearchText: string; private lastSoundPlayedAt; private readonly SOUND_THROTTLE_INTERVAL; private previousConversations; private lastSelectedIndex; activeFormatters: CometChatTextFormatter[]; private typingAnnouncementTimeout; private lastAnnouncedTypingUser; private previousTypingSize; private readonly destroyRef; readonly SelectionMode: typeof SelectionMode; readonly Placement: typeof Placement; constructor(); ngOnInit(): void; ngOnDestroy(): void; /** Offline support: cache-reset notices (unsent messages lost or maybe lost). */ get visibleOfflineNotices(): OfflineNotice[]; offlineNoticeText(notice: OfflineNotice): string; dismissOfflineNotice(notice: OfflineNotice): void; private initializeLoggedInUser; private initializeFormatters; private configureFormattersWithUser; private initializeService; handleLoadMore(): void; handleScrollToTop(): void; handleScrollToBottom(): void; /** State-contract identifiers (data-cc-*): no message text, never read by screen readers. */ contractWith(conversation: CometChat.Conversation): string; contractPreviewState(conversation: CometChat.Conversation): ContractMessageState | ''; handleConversationClick(conversation: CometChat.Conversation): void; handleConversationSelect(event: { conversation: CometChat.Conversation; selected: boolean; }): void; handleContextMenuOpen(conversation: CometChat.Conversation): void; /** * NOTE: `CometChatContextMenu` already invokes the chosen option's `onClick`. * Invoking it again here ran every handler TWICE — invisible for Delete, * which just reopened the same dialog, but it pinned and instantly unpinned a * conversation, so the toggle looked like it did nothing. */ handleSelection(conversation: CometChat.Conversation, event?: MouseEvent): void; selectAll(): void; clearSelection(): void; private selectRange; handleSelectionClick(eventOrConversation: MouseEvent | CometChat.Conversation, conversation?: CometChat.Conversation): void; handleContainerClick(event: MouseEvent): void; isConversationSelected(conversation: CometChat.Conversation): boolean; isConversationActive(conversation: CometChat.Conversation): boolean; handleDeleteConversationClick(conversation: CometChat.Conversation): void; handleDeleteConfirm(): Promise; handleDeleteCancel(): void; handleDialogKeydown(event: KeyboardEvent): void; private setupSearchDebouncing; onSearch(value: string): void; handleSearchBarClick(): void; handleKeydown(event: KeyboardEvent): void; private handleSelectionKeyboard; private extendSelectionTo; private getFocusedConversation; private openContextMenuForFocused; private announceSelectionCount; private announceSelectionCleared; announceSearchResults(count: number): void; announceNewConversation(name: string): void; announceTyping(name: string): void; announceConversationDeleted(): void; /** * Announce a conversation that was not in the list before. * * Scans the whole list for the same reason the sound does: with pinned * conversations sorted to the top, a new conversation does not necessarily * arrive at index 0. */ private detectAndAnnounceNewConversation; private focusItemAtIndex; handleFocusIn(event: FocusEvent): void; /** * Does the installed SDK support pinning a conversation? * * The package's peer range still admits builds without it, and calling a * missing method throws synchronously. Without this check the option renders, * the call rejects, and the user gets an error toast for something that was * never available — the same reasoning as PinSaveService.isSupported(). */ private isConversationPinSupported; /** * The app-level conversation-pin flag, resolved once. * * Starts false so the option never flashes in before the answer arrives — * an option that rejects on click is worse than one that appears a moment late. */ private readonly conversationPinEnabled; getContextMenuOptions(conversation: CometChat.Conversation): CometChatOption[]; /** * Whether this conversation is pinned. * * The presence of `pinnedAt` IS the boolean, exactly as for messages — an * unpinned conversation carries no key at all. `isPinned()` covers both a * personal pin and an admin-global one (`pinnedBy === "app_system"`). */ isConversationPinned(conversation: CometChat.Conversation): boolean; /** * Toggle a conversation's pin. * * The cap is server-owned and arrives in `errorParams.limit`; the SDK's own * typings warn never to enforce it client-side, because it is * tenant-overridable. So a rejection is read, not predicted. */ /** The conversation awaiting unpin confirmation, or null. */ pendingUnpinConversation: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.Conversation | null>; /** * Pinning runs straight away; unpinning asks first. * * A pin is a deliberate arrangement of the list — losing one by a misplaced * click means finding the conversation again to restore it, whereas an * accidental pin is undone from the same menu it was made in. */ requestPinConversation(conversation: CometChat.Conversation): void; confirmUnpinConversation(): void; cancelUnpinConversation(): void; handlePinConversationClick(conversation: CometChat.Conversation): Promise; /** * Tell the user why a conversation pin was refused. * * The number comes from the app's settings. The rejection itself carries no * readable cap — there is no longer an SDK helper for it, and the figure is * tenant-overridable, so generic copy is correct when the setting is absent * rather than a guess pulled out of the error's prose. */ private reportConversationPinFailure; /** The app's configured cap on pinned conversations; read once. */ private pinnedConversationsLimit; private announcePinResult; /** * Play the incoming-message sound for a conversation that just received one. * * Scans the whole list rather than index 0: pinned conversations sort to the * top, so a pinned chat sitting first would otherwise mean no sound ever * played for a message arriving anywhere else. */ private handleSoundNotification; private shouldPlaySound; private isNewMessage; private isMessageFromLoggedInUser; private playMessageSound; /** * The id of the user or group a conversation is with. * * A row rebuilt from the device store can carry a plain `{ uid }` / `{ guid }` object instead * of a `User` / `Group`: it is not `instanceof CometChat.User`, and `getGuid()` is then not a * function (ENG-57814). This is read while the list renders - `trackBy` calls it for every row - * so a throw here failed the whole list. Read the id either way. */ getConversationId(conversation: CometChat.Conversation): string; /** The name of the user or group a conversation is with, or '' when the row carries none. */ getConversationName(conversation: CometChat.Conversation): string; getTypingIndicator(conversation: CometChat.Conversation): CometChat.TypingIndicator | null; getDefaultDateTimeFormat(): CalendarObject; trackByConversation(_index: number, conversation: CometChat.Conversation): string; /** * The conversation a message belongs to. * * For a group that is the receiver. For a 1-1 it is the OTHER party, which * the receiver alone does not give: read events are only ever raised for * messages this user RECEIVED, so the receiver is always this user, and * looking the conversation up by that id finds nothing — the unread badge * then never clears. Groups were unaffected, which is why this only showed * on one-to-one chats. */ private conversationIdOf; private subscribeToMessagesReadEvents; /** * A conversation pin is private to the user but syncs across their devices, * and an admin can pin one globally. Either way the change arrives here rather * than through this component, so the row takes the event's pin state — its own * `isPinned()` is otherwise stale until the next fetch. Only the pin state: the * event's conversation is partial (no name, avatar or last message). * * Subscribes to the merged views, so this also covers a pin made from another * surface in the same app. */ private subscribeToConversationPinEvents; handleRetryClick(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; static ngAcceptInputType_hideReceipts: unknown; static ngAcceptInputType_hideError: unknown; static ngAcceptInputType_hidePinConversation: unknown; static ngAcceptInputType_hideDeleteConversation: unknown; static ngAcceptInputType_hideOfflineNotices: unknown; static ngAcceptInputType_hideUserStatus: unknown; static ngAcceptInputType_hideGroupType: unknown; static ngAcceptInputType_disableDefaultContextMenu: unknown; static ngAcceptInputType_showScrollbar: unknown; static ngAcceptInputType_showSearchBar: unknown; static ngAcceptInputType_disableSoundForMessages: unknown; } /** * CometChatDate is a component for displaying formatted dates. * It accepts a timestamp and a calendar configuration object to format the date * using the CometChatLocalize service. * * Uses OnPush change detection and caches the formatted date to prevent * ExpressionChangedAfterItHasBeenCheckedError when relative time changes. * * @example * ```html * * ``` */ declare class CometChatDateComponent implements OnInit, OnDestroy, OnChanges { private cdr; private ngZone; /** Timestamp of the time to be displayed (Unix timestamp in seconds) */ timestamp: number; /** Configuration for date formatting (optional; falls back to global then hardcoded defaults) */ calendarObject?: CalendarObject; /** * Fallback CalendarObject used when there is no Input and no global CalendarObject. * Built per call rather than held in a static so it follows the active language: * as a constant it pinned every locale to a 12-hour clock and an English "Yesterday". */ private getFallbackCalendar; /** Cached formatted date string to prevent change detection issues */ formattedDate: string; /** Interval ID for updating relative time */ private updateIntervalId; /** Update interval in milliseconds (60 seconds) */ private readonly UPDATE_INTERVAL; constructor(cdr: ChangeDetectorRef, ngZone: NgZone); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** * Resolves the effective CalendarObject using the fallback chain: * 1. Component @Input (highest priority) * 2. Global CalendarObject from CometChatLocalize * 3. The active locale's own defaults (see getFallbackCalendar) */ private getEffectiveCalendarObject; /** * Updates the cached formatted date string. * Called on init, input changes, and periodically for relative time updates. */ private updateFormattedDate; /** * Starts the interval to update relative time display. * Runs outside Angular zone to avoid triggering unnecessary change detection. */ private startUpdateInterval; /** * Stops the update interval. */ private stopUpdateInterval; /** * Returns ISO 8601 formatted datetime string for the time element's datetime attribute. * This provides a machine-readable format for assistive technologies. */ get isoDateTime(): string; /** * Returns an accessible label for screen readers. * Provides full date and time information in a readable format. */ get accessibleLabel(): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare class CometChatEmojiKeyboardComponent implements OnInit, AfterViewInit, OnDestroy { private ngZone; /** @internal Timer references for cleanup */ private pendingTimers; /** Array of emoji categories to display */ emojiData: CometChatEmojiCategory[]; /** Custom ARIA label for the emoji picker dialog */ ariaLabel: string; /** Whether to automatically focus the first tab on open */ autoFocus: boolean; /** Whether to trap focus within the emoji keyboard */ trapFocus: boolean; /** Emitted when an emoji is clicked - emits emoji char */ emojiClick: EventEmitter$1; /** Emitted when Escape key is pressed to close the picker */ closeKeyboard: EventEmitter$1; scrollRef: ElementRef; emojiListRef: ElementRef; emojiItems: QueryList>; private gridNavigationService; private focusTrapService; private liveAnnouncer; private elementRef; emojiDataState: CometChatEmojiCategory[]; activeCategory: string; searchString: string; searchEmojiData: Record; focusedEmojiIndex: number; focusedTabIndex: number; focusedEmojiRow: number; focusedEmojiCol: number; gridColumns: number; private focusableElements; private scrollListener; /** Whether the scroll was triggered programmatically by a category tab click */ private isProgrammaticScroll; constructor(ngZone: NgZone); ngOnInit(): void; ngAfterViewInit(): void; /** * Load default emoji data if not provided via emojiData input */ loadEmojiCategories(): void; ngOnDestroy(): void; /** Attach a scroll event listener to the emoji list container. */ private attachScrollListener; /** Detach the scroll event listener from the emoji list container. */ private detachScrollListener; /** Handle scroll events on the emoji list container. Updates activeCategory based on scroll position. */ private onEmojiListScroll; /** Handle category tab click - scroll to that category section. */ onCategoryClick(categoryId: string): void; /** Handle emoji click - emit the emoji character. */ handleEmojiClick(emoji: CometChatEmoji): void; /** * Filter emojis based on search text by matching against each emoji's keywords array (case-insensitive). * When search is cleared, restores the full emoji category list view. * Announces result count via LiveAnnouncerService for screen readers. */ filterEmojis(input: { value?: string; }): void; /** Scroll to a specific category section. */ scrollToElement(categoryId: string): void; /** Handle horizontal scroll for category tabs with hyper scroll handling. */ onWheel(event: WheelEvent): void; getLocalizedCategoryName(name: string): string; getEmojiData(emoji: CometChatEmoji): string; getEmojiEntries(emojies: Record): [string, CometChatEmoji][]; trackByEmojiName(_index: number, item: [string, CometChatEmoji]): string; trackByCategoryId(_index: number, category: CometChatEmojiCategory): string; /** Handle keyboard navigation for emoji grid. */ onEmojiKeydown(event: KeyboardEvent, emoji: CometChatEmoji): void; /** Navigate within emoji grid using GridNavigationService. */ navigateEmojiGridWithService(event: KeyboardEvent): void; /** Handle keyboard navigation for category tabs. */ onTabKeydown(event: KeyboardEvent, categoryId: string, index: number): void; focusPreviousTab(currentIndex: number): void; focusNextTab(currentIndex: number): void; onKeydown(event: KeyboardEvent): void; getEmojiTabIndex(index: number): number; getTabTabIndex(index: number): number; getRowCount(): number; private getTotalEmojiCount; getEmojiPosition(index: number): { row: number; col: number; }; onEmojiFocus(index: number): void; getFirstEmoji(category: CometChatEmojiCategory): string; getAriaLabel(): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Types and interfaces for CometChatFullScreenViewer component. */ /** * Type of media to display in the fullscreen viewer. */ type FullscreenViewerMediaType = 'image' | 'video' | 'audio' | 'file'; declare class CometChatFullScreenViewerComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy { private cdr; url: string; mediaType: FullscreenViewerMediaType; fileName: string; fileSize?: number; placeholderImage?: string; message?: CometChat.BaseMessage; imageSentAtDateTimeFormat?: CalendarObject; attachments: MediaAttachment[]; startIndex: number; isOpen: boolean; explicitSenderName: string; explicitSenderAvatarUrl: string; prevIconUrl: string; nextIconUrl: string; downloadIconUrl: string; enablePictureInPicture: boolean; pipIconUrl: string; pipExitIconUrl: string; closeClick: EventEmitter$1; indexChange: EventEmitter$1; downloadClick: EventEmitter$1; pipStateChange: EventEmitter$1; closeButton?: ElementRef; viewerContainer?: ElementRef; videoElement?: ElementRef; currentIndex: number; image?: string; isDownloading: boolean; progress: number; videoError: boolean; /** True when the current image can't be decoded/previewed (unsupported type, broken/expired link, 403). */ imageError: boolean; isPipMode: boolean; isPipSupported: boolean; private previouslyFocusedElement; private originalBodyOverflow; private pipEnterListener; private pipLeaveListener; private liveAnnouncer; private focusTrapService; private mediaControlsService; constructor(cdr: ChangeDetectorRef); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; ngOnDestroy(): void; downloadImage(imgUrl: string, attemptCount?: number): void; close(keepPipActive?: boolean): void; handleCloseClick(event: MouseEvent): void; handleCloseKeydown(event: KeyboardEvent): void; handleDocumentKeydown(event: KeyboardEvent): void; handleKeydown(_event: KeyboardEvent): void; handleVideoError(): void; /** The image element failed to load — show the "no preview available" state instead of a broken img. */ handleImageError(): void; getDateFormat(): CalendarObject; get senderName(): string; get senderAvatar(): string; get formattedDate(): string; get progressStrokeDasharray(): string; get formattedFileSize(): string; get fileExtension(): string; get showSenderInfo(): boolean; get currentFileName(): string; get currentFileSize(): string; get currentFileExtension(): string; getLocalizedString(key: string): string; /** Counter label with {current}/{total} substituted — the raw key must never reach the DOM. */ getGalleryPositionLabel(): string; getViewerAriaLabel(): string; getMediaAltText(): string; get isGalleryMode(): boolean; get currentAttachment(): MediaAttachment | null; get canNavigatePrev(): boolean; get canNavigateNext(): boolean; navigateNext(): void; navigatePrev(): void; navigateToIndex(index: number): void; private announceGalleryPosition; private stopCurrentVideo; download(): void; get showPipButton(): boolean; enterPictureInPicture(): Promise; exitPictureInPicture(): Promise; togglePictureInPicture(): void; private setupPipEventListeners; private removePipEventListeners; getPipButtonAriaLabel(): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatListItem is a composite component used to display a list item with avatar, title, subtitle, and customizable views. * It accepts inputs related to the avatar and title, as well as a callback function that is triggered when the list item is clicked. * It supports template projection for leading, trailing, menu, title, and subtitle views. * * @example * ```html * * * ``` */ declare class CometChatListItemComponent implements OnChanges { /** Unique ID for the list item */ id: string; /** URL of the image for avatar */ avatarURL: string; /** Name initials for avatar if URL not provided */ avatarName: string; /** Title text for list item */ title: string; /** Subtitle text for accessibility (used in aria-label) */ subtitle: string; /** * Normalizes null/undefined inputs to their default values. * Prevents NG0100 ExpressionChangedAfterItHasBeenCheckedError. */ ngOnChanges(changes: SimpleChanges): void; /** Template for menu view (shown on hover/focus, replaces trailingView) */ menuView: TemplateRef | null; /** Template for subtitle view */ subtitleView: TemplateRef | null; /** Template for trailing view (right side) */ trailingView: TemplateRef | null; /** Template for custom title view */ titleView: TemplateRef | null; /** Template for leading view (replaces avatar) */ leadingView: TemplateRef | null; /** Stop event propagation on click */ stopEventPropagation: boolean; /** Custom ARIA label (overrides default) */ ariaLabel?: string; /** Whether to disable the tabindex on the list item (when parent manages focus) */ disableTabIndex: boolean; /** Whether the list item is currently focused (managed by parent) */ isFocused: boolean; /** * Keyboard shortcut key for toggling menu visibility. * Set to empty string or null to disable the shortcut. * Default is 'M' (case-insensitive). * Per WCAG 2.1.4, single-character shortcuts must be configurable. */ menuShortcutKey: string | null; /** Emitted when list item is clicked */ listItemClick: EventEmitter$1<{ id: string; }>; isHovering: boolean; isMenuVisible: boolean; isListItemFocused: boolean; trailingViewContainer?: ElementRef; menuViewContainer?: ElementRef; /** * Determines if avatar should be shown. * Shows avatar when avatarURL or avatarName is provided and no leadingView template. */ get showAvatar(): boolean; /** * Determines if trailing view should be visible. * Hides when hovering/focused and menuView is present. */ get showTrailingView(): boolean; /** * Determines if menu view should be visible. * Shows when hovering/focused and menuView template is provided. */ get showMenuView(): boolean; /** * Generates an accessible label for screen readers. * Combines title and subtitle for complete context. */ get computedAriaLabel(): string; /** * Generates unique ID for subtitle element (for aria-describedby) */ get subtitleId(): string; /** * Handles mouse enter event. * Shows menu view and hides trailing view. */ onMouseEnter(): void; /** * Handles mouse leave event. * Hides menu view and shows trailing view. */ onMouseLeave(): void; /** * Handles list item focus event. * Shows menu view when list item receives focus. */ onListItemFocus(): void; /** * Handles list item blur event. * Hides menu view when list item loses focus. */ onListItemBlur(): void; /** * Handles list item click event. * Emits listItemClick event with the item ID. * Only triggers if the click target is the list item itself, not nested elements. */ handleListItemClick(event: MouseEvent): void; /** * Handles trailing view click event. * Stops propagation if stopEventPropagation is true. */ onTrailingViewClick(event: MouseEvent): void; /** * Handles menu view click event. * Always stops propagation to prevent list item click. */ onMenuViewClick(event: MouseEvent): void; /** * Handles keyboard events for accessibility. * Activates list item on Enter or Space key press. * Shows menu on configurable shortcut key (default: M for "Menu"). * Per WCAG 2.1.4, the shortcut can be disabled by setting menuShortcutKey to null/empty. */ onKeyDown(event: KeyboardEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Types and interfaces for CometChatStickersKeyboard component. */ /** * Event emitted when a sticker is clicked */ interface StickerClickEvent { /** URL of the selected sticker */ stickerUrl: string; /** Name of the selected sticker */ stickerName: string; } /** * Represents a single sticker item */ interface StickerItem { /** URL of the sticker image */ stickerUrl: string; /** Name of the sticker set this sticker belongs to */ stickerSetName: string; /** Order of the sticker within its set */ stickerOrder?: number; } /** * Represents a collection of sticker sets */ type StickerSet = Record; /** * Component state enum for managing loading/error/empty states */ type ComponentState = 'loading' | 'loaded' | 'error' | 'empty'; /** * CometChatStickersKeyboard Component * * A component for browsing and selecting stickers from the CometChat stickers extension. * Displays stickers organized by category tabs with a grid layout. * * @example * ```html * * * ``` * * @see Requirements 8.4, 8.5, 8.6, 8.8, 8.9, 8.10 */ declare class CometChatStickersKeyboardComponent implements OnInit, OnDestroy { /** @internal Timer references for cleanup */ private pendingTimers; /** Custom text for error state */ errorStateText?: string; /** Custom text for empty state */ emptyStateText?: string; /** Whether to automatically focus the first tab on open */ autoFocus: boolean; /** Whether to trap focus within the keyboard */ trapFocus: boolean; /** Emitted when a sticker is clicked */ stickerClick: EventEmitter$1; /** Emitted when the keyboard should close (e.g., Escape key pressed) */ closeKeyboard: EventEmitter$1; tabsContainer: ElementRef; private liveAnnouncer; private readonly host; private destroyed; protected componentState: _angular_core.WritableSignal; protected stickerSets: _angular_core.WritableSignal; protected activeCategory: _angular_core.WritableSignal; protected focusedStickerIndex: _angular_core.WritableSignal; protected focusedTabIndex: _angular_core.WritableSignal; protected loadedImages: _angular_core.WritableSignal>; protected categoryNames: _angular_core.Signal; protected currentStickers: _angular_core.Signal; protected readonly gridColumns = 4; protected readonly shimmerTabs: unknown[]; protected readonly shimmerStickers: unknown[]; ngOnInit(): void; /** * Loads pre-provided sticker data directly (bypasses SDK fetch). * * Intended for Storybook/testing scenarios — called by the story wrapper * component to seed sticker data without hitting the SDK. */ loadStickerData(data: StickerSet): void; /** * Overrides the component state directly. * * Intended for Storybook/testing scenarios — called by the story wrapper * to render loading/error/empty states without triggering the SDK fetch. */ setComponentState(state: ComponentState): void; /** * Fetches stickers from the CometChat stickers extension. * Retries once if the first attempt fails (handles SDK not ready after page refresh). * @see Requirements 8.4, 8.14, 8.15 */ fetchStickers(): Promise; /** Applies parsed sticker data to component state after a successful fetch. */ private applyFetchedStickers; /** * Parses the stickers response from the extension API. * Delegates to the pure utility function in cometchat-stickers-keyboard.utils.ts. */ private parseStickersResponse; /** * Handles category tab click * @see Requirements 8.5 */ onCategoryClick(categoryName: string): void; /** * Handles sticker click - emits the sticker selection event and closes the keyboard * @see Requirements 8.7 */ handleStickerClick(sticker: StickerItem): void; /** * Handles retry button click in error state */ handleRetry(): void; /** * Tracks loaded sticker images to swap shimmer placeholders for the real image. */ onImageLoaded(url: string): void; /** * Gets the error state text * @see Requirements 8.10 */ getErrorText(): string; /** * Gets the empty state text * @see Requirements 8.9 */ getEmptyText(): string; /** * Handles keyboard navigation for sticker grid * @see Requirements 8.12 */ onStickerKeydown(event: KeyboardEvent, sticker: StickerItem, index: number): void; /** * Navigates within the sticker grid using arrow keys. * Delegates index calculation to the pure utility function. * @see Requirements 8.12 */ private navigateStickerGrid; /** * Handles keyboard navigation for category tabs */ onTabKeydown(event: KeyboardEvent, categoryName: string, index: number): void; /** Focuses a tab by index */ private focusTab; /** Handles horizontal scroll for category tabs */ onWheel(event: WheelEvent): void; /** Handles global keyboard events for focus trap and Escape shortcut */ onKeydown(event: KeyboardEvent): void; /** Implements focus trap - cycles focus within component */ private handleFocusTrap; /** TrackBy for category list */ trackByCategoryName(_index: number, categoryName: string): string; /** TrackBy for sticker list */ trackByStickerUrl(_index: number, sticker: StickerItem): string; /** Gets the first sticker URL from a category to use as tab icon */ getCategoryIcon(categoryName: string): string; /** Gets the 1-based row index for ARIA grid navigation */ getRowIndex(index: number): number; /** Gets the 1-based column index for ARIA grid navigation */ getColIndex(index: number): number; /** Total number of grid rows for the current category (aria-rowcount). */ getRowCount(): number; /** Roving tabindex for category tabs: only the focused tab is in tab order. */ getTabTabIndex(index: number): number; /** Roving tabindex for sticker cells: focused cell (or first when none) is tabbable. */ getStickerTabIndex(index: number): number; /** Keeps the roving anchor in sync when a sticker cell receives focus. */ onStickerFocus(index: number): void; ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatMediaRecorder records audio with permission handling. * Uses Web Audio API AnalyserNode for real-time waveform visualization. * Uses WaveSurfer for preview playback when paused. * * Keyboard Accessibility: * - Space/Enter: Activate buttons * - Escape: Cancel recording and close recorder * - Tab: Navigate between control buttons */ declare class CometChatMediaRecorderComponent implements OnInit, OnDestroy { private pendingTimers; autoRecording: boolean; closeRecording: EventEmitter$1; submitRecording: EventEmitter$1; recordingError: EventEmitter$1; waveformContainer?: ElementRef; private liveAnnouncer; private cdr; private ngZone; mediaRecorder?: MediaRecorder; isRecording: boolean; isPaused: boolean; mediaPreviewUrl?: string; counter: number; hasError: boolean; permissionState: PermissionState; private readonly WAVEFORM_BAR_COUNT; waveformHeights: number[]; isPreviewPlaying: boolean; previewCurrentTime: number; previewDuration: number; private stream?; private audioChunks; private timerInterval?; private recordedBlob?; private hasInitialized; private pendingInlineSend; private durationAnnouncementInterval?; private readonly DURATION_ANNOUNCEMENT_INTERVAL; private audioContext?; private analyser?; private sourceNode?; private animationFrameId?; private waveSurfer?; ngOnInit(): void; ngOnDestroy(): void; handleEscapeKey(event: Event): void; handleKeydown(event: KeyboardEvent, action: string): void; checkMicrophonePermission(): Promise; setupPermissionMonitoring(): Promise; initMediaRecorder(): Promise; private setupMediaRecorderHandlers; private startWaveformAnalysis; private stopWaveformAnalysis; private resumeWaveformAnalysis; private runWaveformLoop; handleStartRecording(): Promise; handlePauseRecording(): void; handleStopRecording(): void; handleCloseRecording(): void; handleSubmitRecording(): void; handleInlineSend(): void; private initWaveSurferPreview; private wireWaveSurferEvents; togglePreviewPlayback(): void; private stopPreviewPlayback; private destroyWaveSurfer; get previewTimeDisplay(): string; private reset; private clearStream; private startTimer; private pauseTimer; private stopTimer; private clearTimer; private announceDuration; private clearDurationAnnouncementInterval; formatTime(seconds: number): string; get formattedCounter(): string; get recordingStateText(): string; get recordButtonAriaLabel(): string; get recordButtonAriaPressed(): string; /** * The elapsed recording time, announced in the active locale. * Hard-coded English units read "1 minutes 0 seconds" to every language. */ get durationAriaLabel(): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatPopover provides a floating popover positioned relative to a trigger element * with viewport-aware positioning and full accessibility support. */ declare class CometChatPopoverComponent implements OnInit, AfterViewInit, OnDestroy { /** Static registry of all currently open popover instances for mutual exclusivity */ private static openInstances; private cdr; placement: Placement; closeOnOutsideClick: boolean; showOnHover: boolean; debounceOnHover: number; /** * When true, the trigger is inert: click, keyboard, and hover no longer open the * popover. Used to disable trigger controls (e.g. the composer's attachment/sticker * buttons while editing a message) without unmounting them. */ disabled: boolean; content: TemplateRef; disableBackgroundInteraction: boolean; useParentContainer: boolean; useParentHeight: boolean; showTooltip: boolean; trapFocus: boolean; ariaLabel?: string; ariaLabelledBy?: string; ariaDescribedBy?: string; contentStyle: Record; /** * When true (and useParentContainer is true), the popover will not overflow * the parent container horizontally. Use for popovers that must stay within * a bounded horizontal region (e.g. attachment menu in the message composer). */ constrainHorizontal: boolean; /** * When true (and useParentContainer is true), the popover will not overflow * the parent container vertically. Use for popovers that must stay within * a bounded vertical region (e.g. message bubble context menus in the message list). */ constrainVertical: boolean; popoverOpened: EventEmitter$1; popoverClosed: EventEmitter$1; outsideClick: EventEmitter$1; isOpen: boolean; isPositioned: boolean; positionStyle: Record; availablePlacement: Placement; popoverRef: ElementRef; childRef: ElementRef; private hoverTimeout?; private parentViewRef?; private resizeTimeout?; private previouslyFocusedElement; focusableElements: HTMLElement[]; private keydownListener; private contentResizeObserver; private contentResizeFrame; private justOpened; Placement: typeof Placement; popoverId: string; ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; togglePopover(): void; openPopover(): void; closePopover(): void; closePopoverSilently(): void; private openPopoverInternal; private closePopoverInternal; onPopoverMouseEnter(): void; onPopoverMouseLeave(): void; onChildClick(event: MouseEvent): void; onChildKeydown(event: Event): void; handleClickOutside(event: MouseEvent): void; handleWindowResize(): void; handleWindowScroll(): void; handleEscapeKey(): void; getAvailablePlacement(rect: DOMRect, height: number): Placement; getPopoverPositionStyle(): void; calculatePopoverPosition(): void; setPopoverHeight(): void; getTopMostCometChatElement(): HTMLElement | undefined; getPopoverContentStyle(): Record; private saveFocus; private restoreFocus; /** * Re-position when the content changes size. Content that renders after opening (a deferred * block, async data) is measured as 0 high at first, so a top-placed popover would hang below * its trigger once the content grows. */ private watchContentSize; private stopWatchingContentSize; private setupFocusTrap; private cleanupFocusTrap; private handleKeydownForFocusTrap; private focusFirstElement; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * VoiceRecordingCoordinatorService * * Ensures at most ONE composer records a voice note at a time. Several composers can be on screen * together — the main message list and an open thread each render their own composer, their own * recorder and their own microphone stream — so without coordination both can record at once. * * The composer that starts recording claims the slot; whoever held it is asked to stop, which * unmounts their recorder and releases their mic. * * Why not reuse the existing `ccActivePopover` event: it carries only the popover *type*. A composer * receiving `'voiceRecording'` cannot tell whether it came from itself or from another composer, and * the guard that stops it closing itself (`contentToDisplay() !== id`) also stops it closing when a * second composer starts recording. Coordination needs instance identity, which this service adds * without changing that public event's payload. * * Mirrors TrayAudioCoordinatorService (at most one tray audio tile plays at a time). * Internal: not exported from `public-api.ts`. */ declare class VoiceRecordingCoordinatorService { /** The composer currently holding the recording slot, or null when nobody is recording. */ private active; /** How to stop {@link active}. Always cleared together with it. */ private stopActive; /** * Claim the recording slot for `owner`, stopping the previous holder first. * Re-claiming while already the holder only refreshes the stop callback. */ claim(owner: object, stop: () => void): void; /** Release the slot, but only if `owner` still holds it — a stale release is a no-op. */ release(owner: object): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare enum ToastType { success = "success", error = "error", warning = "warning", info = "info" } /** * CometChatToast Component * * A toast notification component for displaying temporary feedback messages. * Supports different types (success, error, warning, info) with auto-dismiss * and manual close functionality. * * Accessibility Features: * - ARIA live regions for screen reader announcements * - Keyboard accessible close button (Enter, Space, Escape) * - Proper ARIA roles based on toast type * - Focus indicators for keyboard navigation * - Does not trap focus (allows navigation to other elements) */ declare class CometChatToastComponent implements OnInit, OnDestroy { /** Toast message text */ text: string; /** Toast type for styling and icon */ type: ToastType; /** Duration in milliseconds before auto-dismiss (default: 3000ms, 0 = no auto-dismiss) */ duration: number; /** Show close button */ showCloseButton: boolean; /** Enable Escape key to dismiss toast (default: true) */ dismissOnEscape: boolean; /** When true, toast uses static positioning (for service-managed container layout) */ inline: boolean; /** Emitted when toast is closed (auto or manual) */ toastClosed: EventEmitter$1; isVisible: boolean; private autoCloseTimeout?; ngOnInit(): void; ngOnDestroy(): void; close(): void; onCloseClick(): void; get iconClass(): string; get toastClass(): string; get iconSvg(): string; /** * Get ARIA role based on toast type * - 'alert' for error and warning (interrupting) * - 'status' for success and info (non-interrupting) */ get ariaRole(): string; /** * Get aria-live value based on toast type * - 'assertive' for error and warning (immediate announcement) * - 'polite' for success and info (wait for pause) */ get ariaLive(): 'assertive' | 'polite'; /** * Handle keyboard events on close button * Supports Enter and Space keys for accessibility */ onCloseKeyDown(event: KeyboardEvent): void; /** * Handle global keyboard events * Supports Escape key to dismiss toast */ onEscapeKey(event: Event): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Configuration options for creating a toast */ interface ToastConfig { /** Toast message text */ text: string; /** Toast type for styling and icon */ type?: ToastType; /** Duration in milliseconds before auto-dismiss (default: 3000ms, 0 = no auto-dismiss) */ duration?: number; /** Show close button */ showCloseButton?: boolean; } /** * CometChatToast Service * * A service for programmatically creating and managing toast notifications. * Supports toast stacking and provides convenience methods for different toast types. * * @example * ```typescript * constructor(private toastService: CometChatToastService) {} * * showSuccess() { * this.toastService.success('Operation completed successfully!'); * } * * showError() { * this.toastService.error('An error occurred', { duration: 5000 }); * } * ``` */ declare class CometChatToastService implements OnDestroy { private appRef; private injector; private toasts; private nextId; private containerElement?; private readonly TOAST_SPACING; constructor(appRef: ApplicationRef, injector: EnvironmentInjector); /** * Initialize the toast container element */ private initializeContainer; /** * Show a toast notification with custom configuration * * @param config - Toast configuration options * @returns The ID of the created toast */ show(config: ToastConfig): number; /** * Remove a toast by ID * * @param id - The ID of the toast to remove */ remove(id: number): void; /** * Remove all active toasts */ clear(): void; /** * Show a success toast * * @param text - The message text * @param options - Optional configuration (duration, showCloseButton) * @returns The ID of the created toast */ success(text: string, options?: Partial>): number; /** * Show an error toast * * @param text - The message text * @param options - Optional configuration (duration, showCloseButton) * @returns The ID of the created toast */ error(text: string, options?: Partial>): number; /** * Show a warning toast * * @param text - The message text * @param options - Optional configuration (duration, showCloseButton) * @returns The ID of the created toast */ warning(text: string, options?: Partial>): number; /** * Show an info toast * * @param text - The message text * @param options - Optional configuration (duration, showCloseButton) * @returns The ID of the created toast */ info(text: string, options?: Partial>): number; /** * Get the count of active toasts * * @returns The number of active toasts */ getActiveCount(): number; /** * Clean up on service destruction */ ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** The pieces of a media preview banner: `[icon] label · caption`. */ interface MediaPreviewParts { iconUrl: string; /** "Image" for one attachment, "3 Images" for several. */ label: string; /** Sanitized HTML for the caption, or '' when there is none. */ captionHtml: string; } /** * Types and interfaces for CometChatMessageComposer component. * * Extracted from cometchat-message-composer.component.ts to keep the * component class focused on UI logic while this file owns all type definitions. */ /** * Upload lifecycle status for a staged attachment tile. * Extends the legacy statuses with the multi-attachment upload states. * - 'failed' : transfer failed (UploadFileListener.onFileFailure) — retryable (show Retry) * - 'rejected' : not retryable (UploadFileListener.onFileError) — show Remove * - 'cancelled' : user cancelled an in-flight upload * * @remarks 'error' is retained as a deprecated alias of 'failed' for backward compatibility. */ type AttachmentTileStatus = 'pending' | 'uploading' | 'uploaded' | 'failed' | 'rejected' | 'cancelled' | 'error'; /** * Tracks a file attachment in the composer's pending attachment list. */ interface AttachmentFile$1 { /** Unique identifier for the file */ id: string; /** The actual File object */ file: File; /** Type of attachment */ type: 'image' | 'video' | 'audio' | 'file'; /** File name */ name: string; /** File size in bytes */ size: number; /** MIME type of the file (e.g. 'image/png'). */ mimeType?: string; /** Upload id. UIKit-generated and passed to the SDK, which echoes it back on every upload event; * it is the tile key from the moment the file is staged. */ fileId?: string; /** Thumbnail URL for preview (local object URL while uploading; attachment URL once uploaded). */ thumbnailUrl?: string; /** Video clip length in seconds, read locally alongside the poster. Drives the tile's duration badge. */ durationSec?: number; /** Upload progress percentage (0-100) */ uploadProgress: number; /** Bytes uploaded so far (UploadFileListener.onFileProgress). */ loaded?: number; /** Total bytes to upload (UploadFileListener.onFileProgress). */ total?: number; /** Current upload status */ status: AttachmentTileStatus; /** Error message if status is 'failed' | 'rejected' (or legacy 'error'). */ errorMessage?: string; /** SDK Attachment, set on onFileUploaded — the object sent via MediaMessage.setAttachments. */ attachment?: CometChat.Attachment; } /** Byte-weighted aggregate progress across staged tiles. */ interface TrayAggregate { loaded: number; total: number; percent: number; } /** * MediaUploadTrayService * * Owns the composer's attachment-staging state machine and wraps the CometChat * SDK multi-attachment upload lifecycle (`UploadFileRequest` + `UploadFileListener`). * * Provided at the **composer** level (not root) so each composer instance — main * and thread — owns an independent tray and its own `UploadFileRequest`, i.e. an * independent batch. `fileId`s are UIKit-generated and only have to be unique * within a batch, so two composers never collide. Internal: not exported from * `public-api.ts`. * * @remarks State is exposed as signals for OnPush components. `canSend` is * single-sourced: enabled only from the SDK `onComplete`, disabled on every new * `stage()` and whenever a cancel/remove empties the tray. */ declare class MediaUploadTrayService implements OnDestroy { /** Set once this tray ran on the offline path; scopes the session cleanup below. */ private offlineUsed; /** * Offline: a logout or user switch lets go of the batch, so no tile of the * previous session stays on screen (UIK-LIFE-01). The SDK keeps the durable * batch itself. A cache reset lets go too, then restores whatever batch the * rebuilt store still holds for this chat. A tray that never ran offline is * untouched, exactly as today. */ private readonly offlineSessionSubscription; private readonly offlineResetSubscription; ngOnDestroy(): void; /** key = fileId (UIKit-generated; the SDK echoes it back on every event) */ private readonly _tilesMap; private readonly _canSend; private readonly _notice; /** Insertion-ordered staged tiles. */ readonly tiles: _angular_core.Signal; readonly hasTiles: _angular_core.Signal; readonly aggregate: _angular_core.Signal; /** Any tile in a terminal error state (failed/rejected). Blocks Send until it's removed. */ readonly hasErrorTile: _angular_core.Signal; /** * Send-gate: all staged tiles uploaded (`_canSend`, set on SDK completion) AND none failed. The * error clause is enforced here rather than in `_canSend` because the SDK's `onComplete` reports * `successful > 0` even for a partial batch — so a mix of uploaded + rejected tiles would * otherwise still enable Send. A failed upload must block sending until the user removes it. */ readonly canSend: _angular_core.Signal; /** Transient localized notice (e.g. attachment-count limit reached). */ readonly notice: _angular_core.Signal; /** The SDK upload request owning this composer's batch; null until the first stage. */ private request; /** Cached app setting (async getter); null until first fetched. */ private maxCount; /** Optional composer-provided validation (mirrors composer @Inputs). */ private allowedFileTypes?; private maxFileSize?; /** Upload recipient (uid/guid + 'user'/'group'), set by the composer before staging. The SDK sends * both in the presign call for role-based access control. */ private receiverId?; private receiverType?; /** Thread parent, when this composer is a thread composer. Sent alongside the receiver in the * presign call so the server scopes the upload to the thread. */ private parentMessageId?; /** Root toast service — surfaces upload/validation errors as a transient toast. * Injected defensively so the service also works when created outside Angular DI (unit tests). */ private readonly toast; /** Dedupe identical error toasts fired in quick succession (e.g. N oversized files). */ private lastToastMessage; private lastToastAt; /** Set client-side validation from the composer (allowedFileTypes / maxFileSize @Inputs). */ setValidationConfig(cfg: { allowedFileTypes?: string[]; maxFileSize?: number; }): void; /** Set the upload recipient — `id` is the uid/guid, `type` is `user`/`group` (CometChat.RECEIVER_TYPE), * and `parentMessageId` marks a thread composer. The SDK sends all three in the presign call for * role-based access control. Changing the destination discards the current batch: a request is * bound to one destination, so its presigns are not valid for another conversation. */ setReceiver(id: string, type: string, parentMessageId?: string | number): void; /** * The composer opened on, or moved to, a conversation (or thread): record the destination and * restore its batch. Offline on, a batch of the previous destination is let go (not destroyed). * Offline off, a live batch is left exactly as today (destroyed by `reset()` / the next * `setReceiver`), and nothing is restored - there is no durable batch to restore. */ syncReceiver(id: string, type: string, parentMessageId?: string | number): void; /** Triple the last restore ran for, so one settled `(receiver, type, parent)` restores once. */ private restoredKey; private restoreScheduled; /** Tiles that came from a restored batch: their retry hands the SDK this tray's listener. */ private readonly restoredIds; private tripleKey; /** * Restore once, after the caller has finished setting the receiver: the composer sets user/group * and the thread parent in separate steps, and only the settled triple may be restored (a thread * composer must never pick up the main chat's batch). Posted with a microtask so it reads the * final value. Nothing is scheduled at all with offline off. */ private scheduleRestore; private restore; /** Best-effort previews from the SDK's own copy of each file (images, and a video's first frame). */ private hydrateRestoredPreviews; /** * Let go of the batch without telling the SDK to drop it (offline on): the tiles, their object * URLs and this tray's request reference go; the SDK's durable batch stays for the next open. */ private detach; /** * SDK listener — built once; maps per-file + completion events onto tiles. Passed with EVERY * `uploadAttachments` call rather than registered once via `addUploadListener`: the SDK creates a * batch's group lazily on the first upload, and `addUploadListener` silently drops the listener * when the group doesn't exist yet, so registering at request-creation time delivered no events at * all. Re-passing the same object is safe — the SDK dispatches per-file events to the file's own * listener and dedupes by object identity, so nothing fires twice. */ private readonly listener; /** * Stage and begin uploading files. Accumulates into the existing upload group * (reuses `muid`). Enforces the max-attachment count (UIKit-side, before the SDK). * * `forcedKind` overrides the MIME-derived category — the "File" picker option stages * everything as `file` regardless of its actual MIME type, so an MP4 chosen through it * sends as a file message rather than a video message. Drag-drop and paste pass nothing * and stay MIME-derived. */ stage(files: File[], forcedKind?: AttachmentFile$1['type']): Promise; /** * The request owning this composer's batch, created on first use. It is bound to the destination * (and thread parent) captured here, which the SDK sends in every presign call; `setReceiver` * tears the request down when that destination changes. * * No listener is attached here — the batch's group does not exist until the first upload, and * `addUploadListener` is a silent no-op before then. Each `uploadAttachments` call carries the * listener instead. */ private ensureRequest; /** Cancel an in-flight upload (and remove the tile). */ cancel(tile: AttachmentFile$1): void; /** Remove a tile (uploaded or rejected). SDK cancel is a safe no-op once uploaded. */ remove(tile: AttachmentFile$1): void; /** * Retry a failed upload. Only a `failed` tile (transfer error — `onFileFailure`) is retryable; * a `rejected` tile (`onFileError`: size/type/permission) can only be removed and replaced, and * `retryAttachment` is a documented no-op for it — so don't flip such a tile back to `uploading` * and strand it in a state nothing will ever resolve. */ retry(tile: AttachmentFile$1): void; /** Release the batch and reset the tray (after send, or on composer close). */ clearAll(): void; /** * Lifecycle cleanup (conversation switch / destroy). Offline off: the batch is destroyed, as * today. Offline on: the tray lets go and the SDK keeps the batch for the next open. */ reset(): void; /** Successfully-uploaded attachments to put on the outgoing MediaMessage. */ getSuccessfulAttachments(): CometChat.Attachment[]; /** * Successfully-uploaded tiles, in display order. Carries the STAGED kind (`tile.type`), * which the picker may have forced away from the file's MIME type — the send path must * group on this, not on `attachment.getMimeType()`. */ getSuccessfulTiles(): AttachmentFile$1[]; /** * The SDK-owned batch id, stamped onto every message of the fanned-out send as * `metadata.batchId` so the list can group them. Null before the first stage. */ getBatchId(): string | null; private dropTile; private patchTile; private fetchMaxCount; /** Max attachments allowed per message (server `getMaxAttachmentCount`), fetched once and cached. */ getMaxCount(): Promise; /** Free slots left before the limit, given what's already staged. Used by the file picker to cap * a selection so the user can't pick more than will fit. */ remainingSlots(): Promise; private localPreview; /** * Kick off first-frame poster + duration extraction for each staged video and patch them onto * the tile. Bounded concurrency (decoding many videos at once can spike memory/CPU, esp. on mobile). */ private hydrateVideoPosters; private revoke; /** * User-facing copy for an upload error: the mapped localized string when we recognise the * failure, otherwise the localized generic message. Never the SDK's own text — that is * English-only, so surfacing it verbatim put English in front of every other locale. */ private uploadErrorMessage; private errorText; /** * Which localization key (if any) to show for an upload error. Prefers the SDK/server `code` via * {@link UPLOAD_ERROR_LOCALE_KEY}; falls back to a message-text heuristic for server errors whose * code isn't statically known (the file-type rejection). Returns '' when nothing matches, so the caller shows localized generic copy. */ private resolveUploadErrorKey; /** Pull the "...of bytes." limit out of the SDK size-exceeded message; null if absent. */ private parseLimitBytes; /** Resolve a key, substituting a `{n}` MB placeholder from `bytes` when the string has one. */ private localizedWithMb; /** * Surface an upload/validation error as a transient error toast (existing toast component, * with its built-in error icon + auto-dismiss). Falls back to a generic localized message * when no text is available, and dedupes identical messages fired within a short window * (e.g. several oversized files failing at once). */ private notifyError; /** inject() the toast service, tolerating a non-DI (manual `new`) instantiation. */ private safeInjectToast; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare const MENTIONS_LIMIT = 10; interface AttachmentFile { id: string; file: File; type: 'image' | 'video' | 'audio' | 'file'; name: string; size: number; thumbnailUrl?: string; uploadProgress: number; status: 'pending' | 'uploading' | 'uploaded' | 'error'; errorMessage?: string; } interface FileSizeError { count: number; fileType: string; limitMB: number; timestamp: number; } declare class CometChatMessageComposerComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit { private messageComposerService; /** Offline: a mentions keyword search needs a connection; the popup says so. */ private threadSubscription; private richTextEditorService; private chatStateService; private formatterConfigService; private htmlSanitizerService; private liveAnnouncerService; private cdr; private hostElementRef; private globalConfig; /** Composer-scoped staging tray for multi-attachment upload (provided above). */ readonly mediaUploadTray: MediaUploadTrayService; /** Root-scoped: keeps this composer's recorder from running alongside another composer's. */ readonly voiceCoordinator: VoiceRecordingCoordinatorService; /** Surfaces errors visually. Injected defensively so the composer still works when constructed * outside Angular DI (unit tests), matching MediaUploadTrayService. */ readonly toast: CometChatToastService | null; private textFormattersExplicitlySet; private disableSoundForMessageExplicitlySet; private customSoundForMessageExplicitlySet; private _textFormatters; private _disableSoundForMessage; private _customSoundForMessage; effectiveTextFormatters: _angular_core.Signal; effectiveDisableSoundForMessage: _angular_core.Signal; effectiveCustomSoundForMessage: _angular_core.Signal; customRichTextEditor: RichTextEditor | null; richTextEditorContainerRef?: ElementRef; richTextFormatState: _angular_core.WritableSignal; isInlineFormattingDisabled: _angular_core.Signal; user?: CometChat.User; group?: CometChat.Group; parentMessageId?: number; placeholderText: string; initialComposerText: string; text: string; maxHeight: number; enterKeyBehavior: EnterKeyBehavior; attachmentOptions?: CometChatMessageComposerAction[]; /** @note kept for future attachment preview/queue support; active flow sends selected files directly. */ maxAttachments: number; /** @note kept for future attachment preview/queue support; active flow sends selected files directly. */ allowedFileTypes?: string[]; /** @note kept for future attachment preview/queue support; active flow sends selected files directly. */ maxFileSize?: number; /** @note kept for future attachment preview/queue support; active flow sends selected files directly. */ showAttachmentPreview: boolean; /** @note kept for future attachment preview/queue support; active flow sends selected files directly. */ enableDragDrop: boolean; hideAttachmentButton: boolean; enableMultipleAttachments: boolean; hideImageAttachmentOption: boolean; hideVideoAttachmentOption: boolean; hideAudioAttachmentOption: boolean; hideFileAttachmentOption: boolean; hidePollsOption: boolean; hideCollaborativeDocumentOption: boolean; hideCollaborativeWhiteboardOption: boolean; hideEmojiKeyboardButton: boolean; hideVoiceRecordingButton: boolean; hideStickersButton: boolean; hideLiveReaction: boolean; hideSendButton: boolean; disableMentions: boolean; disableMentionAll: boolean; mentionAllLabel: string; mentionsUsersRequestBuilder?: CometChat.UsersRequestBuilder; mentionsGroupMembersRequestBuilder?: CometChat.GroupMembersRequestBuilder; enableRichText: boolean; hideRichTextToolbar: boolean; showBubbleMenuOnSelection: boolean; layout: 'single-line' | 'multiline'; disableAutoFocusOnMobile: boolean; disableTypingEvents: boolean; set disableSoundForMessage(value: boolean); get disableSoundForMessage(): boolean; set customSoundForMessage(value: string); get customSoundForMessage(): string; messageToEdit?: CometChat.BaseMessage; messageToReply?: CometChat.BaseMessage; set textFormatters(value: CometChatTextFormatter[]); get textFormatters(): CometChatTextFormatter[]; headerView?: TemplateRef; footerView?: TemplateRef; sendButtonView?: TemplateRef; auxiliaryButtonView?: TemplateRef; secondaryButtonView?: TemplateRef; attachmentIconView?: TemplateRef; voiceRecordingIconView?: TemplateRef; emojiIconView?: TemplateRef; errorView?: TemplateRef; /** * Buttons rendered at the trailing end of the rich-text formatting toolbar, * after the built-in groups and an automatically-inserted separator. * * Intended for controls that drive a custom formatter from `textFormatters` — * the template context carries a `composer` handle so the button can act on the * text being typed. Wrap several buttons in one element. Rendered in both the * toolbar and the selection bubble menu, and only while the rich-text editor * and its toolbar are enabled. */ toolbarTrailingView?: TemplateRef; listItemTemplate: TemplateRef | null; emptyStateTemplate: TemplateRef | null; errorStateTemplate: TemplateRef | null; loadingStateTemplate: TemplateRef | null; hideError: boolean; textChange: EventEmitter$1; sendButtonClick: EventEmitter$1<_cometchat_chat_sdk_javascript.BaseMessage>; error: EventEmitter$1<_cometchat_chat_sdk_javascript.CometChatException>; closePreview: EventEmitter$1; /** @note currently retained for future use; the active file flow sends selected files directly. */ attachmentAdded: EventEmitter$1; /** @note currently retained for future use; the active file flow sends selected files directly. */ attachmentRemoved: EventEmitter$1; mentionSelected: EventEmitter$1<_cometchat_chat_sdk_javascript.User | _cometchat_chat_sdk_javascript.GroupMember>; textInputRef?: ElementRef; fileInputRef?: ElementRef; attachmentButtonRef?: ElementRef; emojiButtonRef?: ElementRef; stickersButtonRef?: ElementRef; voiceButtonRef?: ElementRef; sendButtonRef?: ElementRef; mediaRecorderRef?: CometChatMediaRecorderComponent; bubbleMenuElementRef?: ElementRef; popoverInstances: QueryList; readonly attachmentIconUrl = "assets/add_circle.svg"; readonly attachmentIconUrlActive = "assets/add_circle_fill.svg"; readonly emojiIconUrl = "assets/mood.svg"; readonly emojiIconUrlActive = "assets/mood_fill.svg"; readonly stickerIconUrl = "assets/sticker.svg"; readonly stickerIconUrlActive = "assets/sticker_fill.svg"; readonly voiceIconUrl = "assets/mic.svg"; readonly sendIconUrl = "assets/send_fill.svg"; readonly toolbarToggleIconUrl = "assets/toolbar-toggle.svg"; protected currentUser: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.User | null>; protected currentGroup: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.Group | null>; composerError: _angular_core.WritableSignal; private propsProvided; Placement: typeof Placement; contentToDisplay: _angular_core.WritableSignal<"none" | "ai" | "attachments" | "stickers" | "voiceRecording" | "emojiKeyboard">; composerText: _angular_core.WritableSignal; attachments: _angular_core.WritableSignal; isEmojiKeyboardOpen: _angular_core.WritableSignal; isStickersKeyboardOpen: _angular_core.WritableSignal; isFixedToolbarShown: _angular_core.WritableSignal; isFixedToolbarManuallyToggled: _angular_core.WritableSignal; isFullscreenViewerOpen: _angular_core.WritableSignal; fullscreenViewerIndex: _angular_core.WritableSignal; isAttachmentMenuOpen: _angular_core.WritableSignal; isMentionSuggestionsOpen: _angular_core.WritableSignal; isRecording: _angular_core.WritableSignal; isPollModalOpen: _angular_core.WritableSignal; isLinkDialogOpen: _angular_core.WritableSignal; isLinkPopoverOpen: _angular_core.WritableSignal; linkPopoverUrl: _angular_core.WritableSignal; linkPopoverText: _angular_core.WritableSignal; linkPopoverX: _angular_core.WritableSignal; linkPopoverY: _angular_core.WritableSignal; linkDialogMode: _angular_core.WritableSignal<"edit" | "add">; linkDialogInitialText: _angular_core.WritableSignal; linkDialogInitialUrl: _angular_core.WritableSignal; linkDialogX: _angular_core.WritableSignal; linkDialogY: _angular_core.WritableSignal; private savedLinkSelection; isExtensionLoading: _angular_core.WritableSignal; recordingDuration: _angular_core.WritableSignal; isDraggingOver: _angular_core.WritableSignal; protected bubbleMenuPosition: _angular_core.WritableSignal<{ top: number; left: number; } | null>; private bubbleMenuDebounceTimer; private isMouseDown; protected isBubbleMenuVisible: _angular_core.WritableSignal; protected isMobileView: _angular_core.WritableSignal; protected textSelection: _angular_core.WritableSignal<{ from: number; to: number; } | null>; private dragCounter; private boundResizeHandler; mentionSearchText: _angular_core.WritableSignal; cursorPosition: _angular_core.WritableSignal; focusedMentionIndex: _angular_core.WritableSignal; mentionSuggestions: _angular_core.Signal; isFetchingMentions: _angular_core.Signal; mentionsRequestBuilder: CometChat.UsersRequestBuilder | CometChat.GroupMembersRequestBuilder | null; isFetchingMoreMentions: _angular_core.Signal; hasMoreMentions: _angular_core.Signal; textFormatterArray: _angular_core.WritableSignal; mentionsFormatter: _angular_core.WritableSignal; liveRegionPoliteText: _angular_core.WritableSignal; liveRegionAssertiveText: _angular_core.WritableSignal; fileSizeError: _angular_core.WritableSignal; uniqueMentionCount: _angular_core.WritableSignal; showMentionsCountWarning: _angular_core.WritableSignal; private plainTextMentionUids; private mentionedUsersMap; private skipNextMentionCheck; messageToReplySignal: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.BaseMessage | null>; textMessageToEdit: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.TextMessage | null>; isEditMode: _angular_core.WritableSignal; isSendingStaged: _angular_core.WritableSignal; canSend: _angular_core.Signal; showVoiceButton: _angular_core.Signal; isInReplyMode: _angular_core.Signal; isInQuotedReplyMode: _angular_core.Signal; isInEditMode: _angular_core.Signal; hasAttachments: _angular_core.Signal; attachmentCount: _angular_core.Signal; canAddMoreAttachments: _angular_core.Signal; protected shouldShowToolbar: _angular_core.Signal; protected currentLayoutMode: _angular_core.Signal<"multiline" | "single-line">; protected isMultilineLayout: _angular_core.Signal; attachmentMenuOptions: _angular_core.Signal; private readonly destroyRef; private typingTimeout?; private originalTextBeforeEdit; private _enteringEditMode; constructor(); ngOnInit(): void; ngAfterViewInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; private handleLifecycleError; handleRetryClick(): void; private setupErrorCallback; private initializeComposerText; private initializeMobileViewDetection; private updateMobileViewState; private initializeTextFormatters; private getComposerId; private configureTextFormatters; private forwardKeyEventToFormatters; private updateFormatterCaretPosition; private subscribeToActivePopoverEvent; private subscribeToReplyToMessageEvent; private subscribeToMessageEditedEvent; private subscribeToMessageDeletedEvent; private subscribeToComposeMessageEvent; private subscribeToSdkMessageDeletedEvent; private subscribeToShowModalEvent; private subscribeToHideModalEvent; private subscribeToShowMentionsCountWarningEvent; private insertTextFromExternalSource; private syncLegacyPopoverSignals; /** * Stop this composer's recording because another composer claimed the microphone. Clearing * `contentToDisplay` and re-syncing drops `isRecording`, which swaps the template back off the * recorder branch — unmounting , whose ngOnDestroy stops the recorder * and releases the mic stream. Called by VoiceRecordingCoordinatorService, never directly. */ stopRecordingForCoordinator(): void; toggleEmojiKeyboard(): void; toggleAttachmentMenu(): void; toggleVoiceRecording(): void; toggleStickersKeyboard(): void; toggleAI(): void; private handleEditModeChange; private handleReplyModeChange; private resetComposerState; private clearComposer; enterReplyMode(message: CometChat.BaseMessage): void; exitReplyMode(): void; openPollModal(): void; closePollModal(): void; onPollCreated(): void; handleLinkDialogSave(linkData: LinkData): void; handleLinkDialogRemove(): void; handleLinkDialogCancel(): void; private computeLinkDialogLeft; private handleLinkClick; handleLinkPopoverEdit(data: { url: string; text: string; }): void; handleLinkPopoverRemove(): void; handleLinkPopoverClose(): void; createCollaborativeDocument(): Promise; createCollaborativeWhiteboard(): Promise; getReplyPreviewTitle(): string; getReplyPreviewSubtitle(): string; private formatReplyPreviewText; onReplyPreviewClose(): void; enterEditMode(message: CometChat.TextMessage): void; private populateEditorWithFormattedText; cancelEdit(): void; getCurrentEditMessage(): CometChat.BaseMessage | null; getEditPreviewTitle(): string; getEditPreviewSubtitle(): string; /** `[icon] N Images · caption` parts for the edit banner; null for text messages. */ getEditPreviewMedia(): MediaPreviewParts | null; /** Same, for the reply banner. */ getReplyPreviewMedia(): MediaPreviewParts | null; private formatEditPreviewText; private convertMarkdownToHtml; onEditPreviewClose(): void; private exitEditModeWithoutEvent; private exitEditMode; private initializeRichTextEditor; private handleRichTextKeydown; private destroyRichTextEditor; private handleRichTextUpdate; getRichTextMetadata(): RichTextMetadata | undefined; insertTextIntoRichTextEditor(text: string): void; clearRichTextEditorContent(): void; focusRichTextEditor(): void; handleTextInput(event: Event): void; handleKeydown(event: KeyboardEvent): void; handleKeyup(event: KeyboardEvent): void; handleSend(): Promise; /** * Send the staged attachments as a BATCH: one MediaMessage per attachment type * (order: images -> videos -> audios -> files), each tagged with a shared * `metadata.batchId`. The caption (composer text) goes on the LAST message only. * Voice notes are sent separately (via the recorder), not here. */ private sendStagedMessage; private handleEditMessage; private handleSendNewMessage; private buildMessageMetadata; private extractMentionedUsers; private applyTextFormatters; private getMediaMessageType; private playOutgoingMessageSound; private resetMentionsFormatter; handleAttachmentButtonClick(): void; handleAttachmentOptionClick(optionId: string): void; handleActionSheetItemClick(action: CometChatMessageComposerAction | CometChatActionsView): void; handleActionSheetClose(): void; handleEmojiButtonClick(): void; handleEmojiSelect(emoji: string): void; handleEmojiKeyboardClose(): void; private closeAllPopoverInstances; onEmojiPopoverOpened(): void; onEmojiPopoverClosed(): void; onAttachmentPopoverOpened(): void; onAttachmentPopoverClosed(): void; onVoiceRecorderPopoverOpened(): void; onVoiceRecorderPopoverClosed(): void; onStickersPopoverOpened(): void; onStickersPopoverClosed(): void; handleStickerSelect(event: StickerClickEvent): Promise; handleStickersKeyboardClose(): void; private sendStickerMessage; handleAttachmentClick(attachment: AttachmentFile, index: number): void; handleFullscreenViewerClose(): void; handleFullscreenViewerPrevious(): void; handleFullscreenViewerNext(): void; getCurrentFullscreenAttachment(): AttachmentFile | undefined; insertTextAtCursor(textToInsert: string): number; private focusTextInput; private focusAttachmentButton; private focusEmojiButton; private focusStickersButton; private focusVoiceButton; handleVoiceRecordingClick(): void; startInlineRecording(): void; toggleFixedToolbar(): void; handleRecordingComplete(audioBlob: Blob): Promise; handleRecordingCancel(): void; handleRecordingError(error: Error): void; handleClosePreview(): void; closeAllPopups(): void; private isAnyPopupOpen; private handleFormattingShortcuts; private closeBubbleMenu; handleGlobalEscapeKey(event: Event): void; private readonly TYPING_TIMEOUT_MS; private handleTypingStart; private startTyping; private endTypingIndicator; private getReceiver; private checkForMentionTrigger; private scrollMentionIntoView; private closeMentionSuggestions; private updateMentionsCount; private initializeMentionsRequestBuilder; fetchMoreMentions(): Promise; handleMentionsScroll(event: Event): void; private checkIfSelfMention; selectMentionSuggestion(suggestion: MentionSuggestion$1): Promise; onDocumentClick(event: MouseEvent): void; private emitError; private announcePolite; private announceAssertive; private announceReplyModeActivated; private announceEditModeActivated; private announceRecordingStarted; private announceRecordingStopped; private announceMessageSent; private announceAttachmentAdded; private announceAttachmentRemoved; private announceFocusedMention; private announceMentionSuggestionsCount; private announceMentionInserted; private announceFormatStateChange; handleDragEnter(event: DragEvent): void; handleDragLeave(event: DragEvent): void; handleDragOver(event: DragEvent): void; handleDrop(event: DragEvent): void; handlePaste(event: ClipboardEvent): void; handleFileInputChange(event: Event): void; /** Drop-zone glyph, masked so it takes the overlay's text colour. */ readonly uploadIconUrl = "assets/upload.svg"; /** * The attachment-menu option that opened the file dialog. Consumed (and cleared) by the very * next `processFiles`, so it can never leak into a later drag-drop or paste. */ pendingPickerKind?: 'image' | 'video' | 'audio' | 'file'; private processFiles; private sendFilesDirectly; handleRemoveAttachment(attachment: AttachmentFile): void; private getFileType; private getFileTypeLabel; dismissFileSizeError(): void; getFileSizeErrorMessage(): string; private getPluralFileType; handleInputFocus(): void; handleInputBlur(): void; get templateContext(): { user?: CometChat.User; group?: CometChat.Group; }; /** * Context handed to {@link toolbarTrailingView}. * * Carries the composer itself, because a template cannot otherwise reach the * editor: a custom formatting button needs to apply its format to the current * selection, which only the composer's rich-text editor can do. */ get toolbarTrailingContext(): { user?: CometChat.User; group?: CometChat.Group; composer: CometChatMessageComposerComponent; }; handleToolbarBold(): void; handleToolbarItalic(): void; handleToolbarUnderline(): void; handleToolbarStrikethrough(): void; handleToolbarInlineCode(): void; handleToolbarLink(): void; handleToolbarOrderedList(): void; handleToolbarBulletList(): void; handleToolbarCodeBlock(): void; handleToolbarBlockquote(): void; private handleSelectionUpdate; private updateBubbleMenuPosition; private calculateAndSetPosition; private getTextOffsetFromNode; private updateFormatStateFromEditor; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; static ngAcceptInputType_enableMultipleAttachments: unknown; static ngAcceptInputType_hideError: unknown; } declare class CometChatMessageHeaderComponent implements OnInit, OnDestroy, OnChanges { private pendingTimers; private messageHeaderService; private chatStateService; private cdr; private injector; private globalConfig; private hideUserStatusExplicitlySet; private hideVoiceCallButtonExplicitlySet; private hideVideoCallButtonExplicitlySet; private _hideUserStatus; private _hideVoiceCallButton; private _hideVideoCallButton; user?: CometChat.User; group?: CometChat.Group; set hideUserStatus(value: boolean); get hideUserStatus(): boolean; showBackButton: boolean; set hideVoiceCallButton(value: boolean); get hideVoiceCallButton(): boolean; set hideVideoCallButton(value: boolean); get hideVideoCallButton(): boolean; showSearchOption: boolean; showConversationSummaryButton: boolean; /** Adds "Pinned messages" / "Saved messages" to the overflow menu. */ showPinnedMessagesOption: boolean; callSettingsBuilder: typeof CometChatUIKitCalls.CallSettingsBuilder; summaryGenerationMessageCount: number; enableAutoSummaryGeneration: boolean; lastActiveAtDateTimeFormat?: CalendarObject; headerView?: TemplateRef; itemView?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; leadingView?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; titleView?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; subtitleView?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; trailingView?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; backButtonView?: TemplateRef; auxiliaryButtonView?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; listItemTemplate: TemplateRef | null; emptyStateTemplate: TemplateRef | null; errorStateTemplate: TemplateRef | null; loadingStateTemplate: TemplateRef | null; headerViewContent?: TemplateRef; itemViewContent?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; leadingViewContent?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; titleViewContent?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; subtitleViewContent?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; trailingViewContent?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; backButtonViewContent?: TemplateRef; auxiliaryButtonViewContent?: TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }>; backClick: EventEmitter$1; itemClick: EventEmitter$1<_cometchat_chat_sdk_javascript.User | _cometchat_chat_sdk_javascript.Group>; searchClick: EventEmitter$1; conversationSummaryClick: EventEmitter$1<{ messageCount: number; }>; error: EventEmitter$1<_cometchat_chat_sdk_javascript.CometChatException>; voiceCallClick: EventEmitter$1<_cometchat_chat_sdk_javascript.User | _cometchat_chat_sdk_javascript.Group>; videoCallClick: EventEmitter$1<_cometchat_chat_sdk_javascript.User | _cometchat_chat_sdk_javascript.Group>; /** The host opens its pinned/saved panel — the header only asks for it. */ pinnedMessagesClick: EventEmitter$1; protected currentUser: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.User | null>; protected currentGroup: _angular_core.WritableSignal<_cometchat_chat_sdk_javascript.Group | null>; private propsProvided; userSignal: Signal; groupSignal: Signal; userStatusSignal: Signal; typingIndicatorSignal: Signal; typingUsersSignal: Signal; groupMemberCountSignal: Signal; lastActiveAtSignal: Signal; isUserConversation: Signal; isGroupConversation: Signal; isTyping: Signal; shouldShowBackButton: Signal; /** * The overflow menu hangs BELOW its button. * * Left unset it defaults to `Placement.left`, which is the "open to the side" * branch — the menu lands beside the trigger, top-aligned with it, rather * than under it. `bottom` anchors it to the button's lower edge and only * flips upward when there is not room below. */ readonly overflowMenuPlacement = Placement.bottom; shouldShowOverflowMenu: Signal; private readonly offlineHub; /** Offline on and the SDK not connected: no presence anywhere in the header. */ readonly presenceHidden: Signal; effectiveHideUserStatus: Signal; effectiveHideVoiceCallButton: Signal; effectiveHideVideoCallButton: Signal; private readonly destroyRef; isOverflowMenuOpen: boolean; contextMenu?: CometChatContextMenuComponent; private previousUserStatus; private unreadMessageCount; private autoSummaryTriggered; get effectiveHeaderView(): TemplateRef | undefined; get effectiveItemView(): TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }> | undefined; get effectiveLeadingView(): TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }> | undefined; get effectiveTitleView(): TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }> | undefined; get effectiveSubtitleView(): TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }> | undefined; get effectiveTrailingView(): TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }> | undefined; get effectiveBackButtonView(): TemplateRef | undefined; get effectiveAuxiliaryButtonView(): TemplateRef<{ user?: CometChat.User; group?: CometChat.Group; }> | undefined; get templateContext(): { user?: CometChat.User; group?: CometChat.Group; }; constructor(); handleEscapeKey(event: Event): void; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; private setupErrorCallback; private initializeService; private initializeSignals; private handleUserChange; private handleGroupChange; private emitError; private handleLifecycleError; handleBackClick(): void; handleBackKeydown(event: KeyboardEvent): void; handleItemClick(): void; handleItemKeydown(event: KeyboardEvent): void; handleSearchClick(): void; handleSummaryClick(): void; private triggerSummaryGeneration; private handleAutoSummaryGeneration; /** * Whether this group event's own group snapshot may set the member count. * A swept replay carries the group as it was when the action happened, which * is older than the group the conversation sync delivered just before the * replay, so applying it would undo joins that came after it. */ private countIsCurrent; private subscribeToGroupEvents; getOverflowMenuOptions(): CometChatOption[]; handleOverflowMenuOptionClick(option: ContextMenuItem): void; handleVoiceCallClick(): void; handleVideoCallClick(): void; handleRetryClick(): void; handleError(error: CometChat.CometChatException): void; getAvatarImage(): string; getAvatarName(): string; getDisplayName(): string; getTypingText(): string; getTypingUsersCount(): number; getMemberCountText(): string; getMemberCount(): number; isUserOnline(): boolean; getLastActiveTimestamp(): number | null; getLastActiveDateFormat(): CalendarObject; getHeaderAriaLabel(): string; getItemAriaLabel(): string; closeOverflowMenu(): void; handleOverflowMenuStateChange(isOpen: boolean): void; private announceStatusChange; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; static ngAcceptInputType_hideUserStatus: unknown; static ngAcceptInputType_hideVoiceCallButton: unknown; static ngAcceptInputType_hideVideoCallButton: unknown; static ngAcceptInputType_showPinnedMessagesOption: unknown; } /** * Types for CometChatMessagePreview component. */ /** Preview mode type for message preview context */ type MessagePreviewMode = 'reply' | 'edit'; /** * CometChatMessagePreview is a component that displays a preview of a message * that is being replied to or edited. It shows a title, subtitle, and optional * close button. When the message is deleted, it displays a deleted message UI. * * ## Features * - Displays sender name (Requirement 7.2) * - Truncates long message content with ellipsis (Requirements 7.1, 7.3) * - Shows appropriate icons for media messages (Requirement 7.4) * - Shows "Message deleted" for deleted quoted messages (Requirement 7.8) * * ## Accessibility Features (Requirement 15.1-15.6) * - role="status" with aria-live="polite" for screen reader announcements * - aria-label describing context (replying to/editing) * - Keyboard accessible close button (Enter/Space/Escape keys) * - Proper ARIA attributes for screen readers * - Visible focus indicators meeting WCAG contrast requirements * - Support for nested interactive elements in templates * * @example * ```html * * * ``` */ declare class CometChatMessagePreviewComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy { private globalConfig; private readonly htmlSanitizer; private readonly formatterConfig; private readonly cdr; _cachedPreviewHasHtml: boolean; _cachedFormattedPreview: string; private htmlSanitizerService; private textFormattersExplicitlySet; private _textFormatters; /** Title to display in preview - accepts template */ previewTitle: TemplateRef | null; /** Subtitle to display in preview - accepts template */ previewSubtitle: TemplateRef | null; /** Hide the close button */ hideCloseButton: boolean; /** Message object being replied to or edited */ message?: CometChat.BaseMessage | null; /** Moderation status of the message */ isMessageModerated: boolean; /** * Text formatters for message bubble. * Follows 3-tier priority: @Input > GlobalConfig > default ([]) */ set textFormatters(value: CometChatTextFormatter[]); get textFormatters(): CometChatTextFormatter[]; /** Custom ARIA label for the preview container (for screen readers) */ ariaLabel?: string; /** * Preview mode: 'reply' or 'edit' * Used to determine appropriate ARIA labels for accessibility * @see Requirement 15.5, 15.6 */ mode: MessagePreviewMode; /** * Resolved textFormatters value using 3-tier priority: * 1. Explicitly set @Input value * 2. GlobalConfig value (if defined) * 3. Component default ([]) */ effectiveTextFormatters: _angular_core.Signal; /** Emitted when close button is clicked */ closeClick: EventEmitter$1; elementRef: ElementRef; /** Internal width state for bubble view mode */ width: number; /** Cached logged-in user for "You" detection in senderName */ private loggedInUser; private resizeObserver; /** * Returns true if the message has been deleted * @see Requirement 7.8 */ get isDeleted(): boolean; /** * Returns the localized "message deleted" text * @see Requirement 7.8 */ get deletedMessageText(): string; /** * Returns the localized close button aria-label based on mode * @see Requirement 15.6: aria-label="Cancel reply" or "Cancel edit" */ get closeButtonLabel(): string; /** * Returns the default aria-label for the preview container based on mode * @see Requirement 15.5: aria-label describing context (replying to/editing) */ get defaultAriaLabel(): string; /** * Returns the sender name from the message object. * Used when previewTitle template is not provided. * @see Requirement 7.2 */ get senderName(): string; /** * Returns whether to show the default title (sender name). * Shows when no previewTitle template is provided and message exists. * @see Requirement 7.2 */ get shouldShowDefaultTitle(): boolean; /** * Returns whether to show the default subtitle (message content). * Shows when no previewSubtitle template is provided and message exists. * @see Requirements 7.1, 7.3 */ get shouldShowDefaultSubtitle(): boolean; /** * Returns the message content preview text. * For text messages, returns the text content (truncated via CSS). * For media messages, returns localized type description. * @see Requirements 7.1, 7.3 */ get messageContentPreview(): string; /** * {@link messageContentPreview} with its markdown rendered, for binding to innerHTML. * * A caption (and a text body) is stored as markdown, so interpolating the raw string showed * literal `**bold**` in the quoted-reply block while the bubble above it rendered the formatting. * Escape first, convert inline markdown second, sanitize last — in that order the user's own * angle brackets stay inert and only the tags this component emits survive. */ get messageContentPreviewHtml(): string; /** * Returns true when the message preview text should be rendered as HTML * (contains markdown, rich text metadata, or SDK mention tags). */ get messagePreviewHasHtml(): boolean; /** * Returns sanitized HTML for the preview when messagePreviewHasHtml is true. * Applies the same formatter pipeline as CometChatConversationItem. * Result is single-line (block elements collapsed to spaces). */ get formattedMessagePreview(): string; /** Get active formatters — explicit input takes priority over global config defaults. */ private getActiveFormatters; /** * Sanitize HTML to safe inline tags, collapsing block elements to spaces * so the preview stays on a single line with ellipsis truncation. */ private sanitizePreviewHtml; /** * Returns the CSS class for the media type icon. * Used to display appropriate icons for media messages. * @see Requirement 7.4 */ get mediaIconClass(): string; /** * Returns whether to show the media icon. * Shows for image, video, audio, and file messages. * @see Requirement 7.4 */ get shouldShowMediaIcon(): boolean; /** * Returns the container style based on view mode and moderation status */ get containerStyle(): Record; /** * Returns the CSS class for the container based on view mode */ get containerClass(): string; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; ngOnDestroy(): void; private setupResizeObserver; /** * Cleans up the ResizeObserver */ private cleanupResizeObserver; /** * Handles close button click */ handleClose(): void; /** * Handles keyboard events for close button accessibility. * Activates close button on Enter, Space, or Escape key press. * @see Requirement 15.2: Enter/Space on close button closes preview * @see Requirement 15.3: Escape while preview is visible closes preview */ onCloseKeyDown(event: KeyboardEvent): void; /** * Handles Escape key at component level to close preview * @see Requirement 15.3: Escape while preview is visible closes preview */ onEscapeKey(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Types and interfaces for CometChatTextBubble component. */ /** * Link Preview Data Structure * * Represents the data extracted from message metadata for displaying * rich link preview cards. */ interface LinkPreviewData { /** The URL of the link */ url: string; /** The title of the linked page (optional) */ title?: string; /** A description of the linked page (optional) */ description?: string; /** The URL of a preview image (optional) */ image?: string; /** The URL of the favicon (optional) */ favicon?: string; } declare class CometChatTextBubbleComponent implements OnInit, OnChanges, AfterViewInit { private sanitizer; private cdr; private formatterConfig; private htmlSanitizer; private globalConfig; private textFormattersExplicitlySet; private _textFormatters; message: CometChat.TextMessage; alignment: MessageBubbleAlignment; set textFormatters(value: CometChatTextFormatter[] | undefined); get textFormatters(): CometChatTextFormatter[]; translatedTextOverride?: string; linkClick: EventEmitter$1; mentionClick: EventEmitter$1<_cometchat_chat_sdk_javascript.User>; effectiveTextFormatters: _angular_core.Signal; contentElement?: ElementRef; protected messageText: string; protected formattedText: string; protected translatedText: string; protected formattedTranslatedText: string; protected linkPreviews: LinkPreviewData[]; protected isSingleEmoji: boolean; protected isContentTruncated: boolean; protected isExpanded: boolean; protected contentHeight: number; protected mentionedUsers: CometChat.User[]; protected isOutgoing: boolean; protected isRichText: boolean; readonly MessageBubbleAlignment: typeof MessageBubbleAlignment; constructor(sanitizer: DomSanitizer, cdr: ChangeDetectorRef, formatterConfig: FormatterConfigService, htmlSanitizer: HtmlSanitizerService); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; private initializeTextFormatters; private processMessage; private sanitizeHtml; private applyTextFormatters; /** * Applies non-mentions formatters to already-sanitized rich text HTML. * Only processes text nodes (content outside of HTML tags) to avoid * breaking existing markup. Mentions formatter is skipped since rich text * already has mentions rendered. */ private applyFormattersToParsedHtml; private checkContentTruncation; protected toggleReadMore(): void; protected onLinkPreviewClick(url: string): void; protected onMentionClick(user: CometChat.User): void; protected onTextContentClick(event: MouseEvent): void; protected getDomainFromUrl(url: string): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** Payload emitted by the bubble's `onCardAction` output. */ interface CardBubbleAction { message: CometChat.CardMessage; action: unknown; } declare class CometChatCardBubbleComponent { /** The developer card message to render. */ readonly message: _angular_core.InputSignal<_cometchat_chat_sdk_javascript.CardMessage>; /** Theme mode passed straight to the renderer. */ themeMode: CometChatCardThemeMode; /** Optional renderer theme overrides. */ themeOverride?: CometChatCardThemeOverride; /** Pure-forward of the raw renderer action (developer-card prop channel). */ onCardAction: EventEmitter$1; /** Stringified raw card payload (`''` when there is nothing drawable). */ protected readonly cardJson: _angular_core.Signal; /** Whether a non-empty card payload is present. */ protected readonly hasCard: _angular_core.Signal; /** * Single-line fallback for the empty/invalid-payload case: * `getFallbackText()` → `getText()` → "Card Message". Lazy — the template only * reads it when `hasCard()` is false. */ protected readonly fallbackText: _angular_core.Signal; /** * Forwards the raw renderer action on BOTH channels. The bubble runs * no behavior of its own. Apps should act on one channel only to avoid * double-handling (a stable messageId is available for dedupe). */ protected handleAction(event: CometChatCardActionEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatImageBubbleComponent renders image messages with single/multi-image layouts, * overflow handling, fullscreen gallery, and keyboard accessibility. * @see Requirements 18.1, 18.6 * @deprecated Prefer {@link CometChatImagesBubbleComponent}, which the message bubble now renders * for every image message. This bubble stays public for direct use and remains the internal * primitive that the new bubble delegates to. */ declare class CometChatImageBubbleComponent implements OnInit, OnChanges, OnDestroy { private cdr; private ngZone; /** The media message object. @see Requirements 1.1, 1.3, 1.5 */ message: CometChat.MediaMessage; /** LEFT for incoming, RIGHT for outgoing. @see Requirements 1.5, 13.1, 13.2 */ alignment: MessageBubbleAlignment; /** * Formatters applied to the caption's text. Passed straight through to the * text bubble that renders it, which owns the formatting itself — this bubble * only forwards what the caller supplied. */ textFormatters?: CometChatTextFormatter[]; /** When true, disables click-to-open fullscreen viewer. @default false */ disableInteraction: boolean; imageClick: EventEmitter$1<{ attachment: MediaAttachment; index: number; }>; viewerOpen: EventEmitter$1; viewerClose: EventEmitter$1; protected attachments: MediaAttachment[]; protected captionText: string; protected isOutgoing: boolean; protected layoutType: MediaLayoutType; protected overflowCount: number; protected showGalleryViewer: boolean; protected galleryStartIndex: number; protected senderName: string; protected senderAvatarUrl: string; /** Tracks which attachment indices have finished loading their real image */ protected loadedIndices: Set; /** Tracks which attachment indices failed to load (unsupported / broken / 403) */ protected errorIndices: Set; /** * Indices whose preloader is parked between a failed attempt and its retry. While an index is in * here the preloader is NOT rendered, so re-adding it later builds a FRESH that re-requests * the URL (re-assigning the same src to the existing element would not). */ protected reloadingIndices: Set; /** Failed attempts so far, per index. */ private retryCounts; private retryTimers; /** * A just-sent attachment can 403/404 for a moment before the CDN starts serving it, so the FIRST * load failure is not proof the media is unsupported. Retry once and keep showing the loading * placeholder in between; only a second failure flips the tile to the unsupported glyph. */ private static readonly MAX_LOAD_RETRIES; private static readonly RETRY_DELAY_MS; /** Path to the placeholder image shown while the real image loads */ readonly placeholderSrc = "assets/image_placeholder.png"; /** Glyph shown when the media can't be previewed (unsupported type or unreachable source) */ readonly unsupportedSrc = "assets/unsupported.svg"; readonly MessageBubbleAlignment: typeof MessageBubbleAlignment; /** Offline support: object URLs of cached copies this bubble shows. */ private readonly offlineMedia; private readonly offlineHub; constructor(cdr: ChangeDetectorRef, ngZone: NgZone); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; /** Process the message to extract attachments, caption, and determine layout. */ private processMessage; private extractAttachments; private extractCaption; private extractSenderInfo; private determineLayout; private determineAlignment; protected onImageClick(index: number): void; protected openGalleryViewer(startIndex: number): void; protected closeGalleryViewer(): void; protected getOverflowText(): string; protected onImageKeyDown(event: KeyboardEvent, index: number): void; protected get imageAriaLabel(): string; protected get overflowAriaLabel(): string; /** Offline: some image has no cached copy and the device is offline. */ protected get mediaUnavailable(): boolean; protected trackByAttachment(index: number, attachment: MediaAttachment): string; /** * Whether the hidden preloader should be in the DOM for this index. It runs only while the image * is still unresolved: not loaded, not given up on, and not parked between a failed attempt and * its retry (that gap is what lets the retry mount a fresh and re-request the URL). */ protected shouldPreload(index: number): boolean; /** * Returns the src to display for an image at the given index. * Shows the placeholder until the real image has loaded. */ protected getImageSrc(index: number): string; /** * Called when the real image finishes loading. * Runs inside NgZone so OnPush change detection picks it up immediately. */ protected onImageLoad(index: number, event: Event): void; /** * Called when the real image fails to load (unsupported format, broken/expired link, 403). * * The first failure is NOT treated as "unsupported": a freshly-sent attachment routinely 403s for * a moment before the CDN serves it, and flipping straight to the glyph made it flash on screen * before the picture appeared. Park the preloader, rebuild it shortly after so a new * re-requests the URL, and only surface the glyph once that retry has failed too. The loading * placeholder stays visible throughout, so an unresolved image just looks like it is still loading. */ protected onImageError(index: number): void; private clearRetryTimers; ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * CometChatVideoBubbleComponent displays video messages with single/grid/overflow layouts * and fullscreen player integration. * * @see Requirements 18.2, 18.6 * @deprecated Prefer {@link CometChatVideosBubbleComponent}, which the message bubble now renders * for every video message. This bubble stays public for direct use and remains the internal * primitive that the new bubble delegates to. */ declare class CometChatVideoBubbleComponent implements OnInit, OnChanges, OnDestroy { private cdr; /** @internal Timer references for cleanup */ private pendingTimers; /** The media message containing video attachments. Required. */ message: CometChat.MediaMessage; /** LEFT for incoming, RIGHT for outgoing messages. */ alignment: MessageBubbleAlignment; /** * Formatters applied to the caption's text. Passed straight through to the * text bubble that renders it, which owns the formatting itself — this bubble * only forwards what the caller supplied. */ textFormatters?: CometChatTextFormatter[]; /** When true, disables click-to-open fullscreen viewer. */ disableInteraction: boolean; /** Emitted when a video thumbnail is clicked. */ videoClick: EventEmitter$1<{ attachment: MediaAttachment; index: number; }>; /** Emitted when the fullscreen video player is opened. */ playerOpen: EventEmitter$1; /** Emitted when the fullscreen video player is closed. */ playerClose: EventEmitter$1; protected attachments: MediaAttachment[]; protected captionText: string; protected isOutgoing: boolean; protected layoutType: MediaLayoutType; protected overflowCount: number; protected showPlayerViewer: boolean; protected playerStartIndex: number; protected senderName: string; protected senderAvatarUrl: string; protected failedThumbnails: Set; /** * Indices parked between a failed thumbnail attempt and its retry. While parked the