import { BehaviorSubject, Subject, Subscription } from "rxjs"; import { GeoLoc } from "../models/geoLoc.model"; import { FileDescriptor } from '../models/common/fileDescriptor'; import { UrlMetaData } from "../services/ulrMetadata/urlMetadata.service"; import { Contact } from "./contact.model"; import { Bubble } from "./bubble.model"; import { Branded } from "../utils/branded"; export type Urgency = 'std' | 'low' | 'middle' | 'high'; export declare function parseUrgency(text: string): Urgency; export declare class MessageAdditionalContent { type: Type; message: string; constructor(type: Type, message: string); static create(type: T, message: string): MessageAdditionalContent; } export declare class ReplaceMsg { id: MessageID; body: string; static create(id: MessageID, body: string): ReplaceMsg; private constructor(); } export declare class Mention { /** Mentionned user id */ dbId: string; /** Mentionned user display name */ displayName?: string; private constructor(); /** * Create a new mention from user data * @param id - db id of the mentionned user * @param displayName - user display name */ static create(id: string, displayName?: string): Mention; } export declare class MentionLegacy { dbId: string; jid: string; position: number; size: number; /** Mentionned user display name */ displayName?: string; constructor(dbId: string, jid: string, position: number, size: number, displayName?: string); /** * Create a new mention from a jid, position and size * @param dbId - db id of the mentionned user * @param jid - jid of the mentionned user * @param position - the mention position in a message * @param size - the mention text length inside a message * @param displayName - user display name * @returns a mention object */ static create(dbId: string, jid: string, position: number, size: number, displayName?: string): MentionLegacy; } export declare class Reaction { /** Jid of user reacting */ jid: string; /** Concatenated reaction by user */ emojis: string; private constructor(); /** * Create a new reaction * @param jid - jid of user reacting * @param emojis - Concatenated reaction by user * * @returns a reaction object */ static create(jid: string, emojis: string): Reaction; } /** * Convert a contact into a mention string * @param contact - The user contact * * @public */ export declare function formatMention(contact: Contact | Mention): string; export declare const MENTION_REGEX: RegExp; /** * @public * @description Message side: from a recipient, from me or specific admin message */ export declare enum MessageSide { LEFT = "L", RIGHT = "R", ADMIN = "ADMIN" } /** * @public * @description Message type */ export declare enum MessageType { /** A chat message */ CHAT = "Chat", /** A file message */ FILE = "File", /** A file message */ FS = "FileSharing", /** A WebRTC message */ WEBRTC = "WebRTC CAll", /** A Recording message */ RECORDING = "Recording", /** A Form message */ FORM = "FORM", /** A Forward message */ FORWARD = "FORWARD", /** A Pin message */ PIN = "PIN", /** A Poll message */ POLL = "POLL", /** A Poll message */ RECAP = "RECAP" } export declare enum MessageStatus { /** No receipt received yet */ NONE = "NONE", /** No receipt received after a while (The server doesn't answer) */ ERROR = "ERROR", /** Receipt in progress */ IN_PROGRESS = "IN_PROGRESS", /** The server has confirmed the reception of the message */ SENT = "SENT", /** The message has been received but not read */ UNREAD = "UNREAD", /** The message has been read */ READ = "READ" } type MessageWithAdditional = Message & { additionalContent: NonNullable>; }; export type MessageID = Branded; export declare class Message { rxSubject: Subject; private receiptStatusInfo; /** * The message ID * @readonly */ id: MessageID; /** * The type of the message * @readonly */ type: MessageType; /** * The creation date of the message * @readonly */ date: Date; /** * The initiator of the message * @readonly */ from: Contact; /** * The receiver of the message * @readonly */ to: Contact | Bubble; /** * The message originator * @readonly */ side: MessageSide; /** * The content of the message * @readonly */ data: string; /** * The status of the send * @readonly */ sendStatus: MessageStatus; /** * The status of the receipt * @readonly */ receiptStatus: MessageStatus; /** * An attached file Id (if exists) * @readonly */ fileId: string; /** * An attached file Name (if exists) * @readonly */ fileName: string; /** * If the message has additional contents * @readonly */ additionalContent?: MessageAdditionalContent; /** * @public * @property {string} subject The subject of the message displayed in notifs * @readonly */ subject: string; /** * @public * @property {string} answeredMsgId The Id of the message answered * @readonly */ answeredMsgId?: MessageID; /** * @public * @property {string} answeredMsgDate The Date of the message answered * @readonly */ answeredMsgDate: Date; /** * @public * @property {GeoLoc} geoloc * @readonly */ geoloc: GeoLoc; /** * @public * @property {any} voiceMessage * @readonly */ voiceMessage: any; /** * @public * @readonly */ mentions: (Mention | MentionLegacy)[]; mentionedMembersArray: (Mention | MentionLegacy)[]; /** * Map representing the relation jid / reaction * * @type {Map} * @memberof Message */ reactions: Map; /** * Map representing the relation emoji / count * * @type {Map} * @memberof Message */ reactionsCount: Map; reactionsSubject: Subject<{ reactions: Map; addedReaction: Reaction; }>; /** * @public * @property {UrlMetaData|null} urlMetadata * @readonly */ urlMetadata: UrlMetaData | null; /** * @private * @readonly */ serverAckTimer: any; /** * The urgency of message ('std', 'low', 'middle', 'high') * @readonly */ urgency: Urgency; urgencyAck: boolean; urgencyAckType: string; urgencyHandler: any; translatedText: string; modified: boolean; deleted: boolean; lastReadSubject: BehaviorSubject; isMerged: boolean; historyIndex: any; showCorrectedMessages: boolean; replaceMsgs: any[]; fileErrorMsg: string; shortFileDescriptor: FileDescriptor; attachedMsgId: MessageID | null; attachIndex?: number; attachNumber?: number; forwardedMsg: Message; isForwarded: boolean; forwardedInfo: any; forwardConvType: string; showIdentity: boolean; noStore: boolean; static maxReactionperUser: number; private constructor(); static create(id: MessageID, date: Date, from: any, side: MessageSide, data: string, additionalContent?: MessageAdditionalContent, subject?: any, answeredMsgId?: MessageID, answeredMsgDate?: Date | null, mentions?: Mention[]): Message; static createFromMsg(origMsg: Message): Message; static createFileSharingMessage(id: MessageID, date: Date, from: any, side: MessageSide, data: string, fileId: string | null, fileName: any, attachedInfos: any, geoloc: GeoLoc): Message; static createFileMessage(id: MessageID, date: Date, from: any, side: MessageSide, data: string, status: any): Message; static createWebRTCMessage(id: MessageID, date: Date, from: any, side: MessageSide, data: string, status: any): Message; static createPinMessage(id: MessageID, date: Date, from: any, side: MessageSide, data: string): Message; static createShareRecapMessage(id: MessageID, date: Date, from: any, side: MessageSide, data: string, additionalContent: MessageAdditionalContent): Message; static createPollMessage(id: MessageID, date: Date, from: any, side: MessageSide, data: string, additionalContent: MessageAdditionalContent): Message; static createBubbleAdminMessage(id: MessageID, date: Date, from: any, type: any, translatedMessage: string): Message; static createRecordingAdminMessage(id: MessageID, date: Date, from: any, cmd: any): Message; sendUpdateEvent(data?: any): void; subscribe(callback: any): Subscription; isTextModified(): boolean; isModified(): boolean; isDeleted(): boolean; getLastTextModified(): string; addReplaceMsg(messageId: MessageID, replacedMsgBody: string): void; setReceiptStatus(receiptStatus: MessageStatus): this; getInfoForLogs(): string; modify(stanzaData: any): void; updateReaction(reaction: Reaction): void; private updateReactionsCount; handleReactions(reactions: Map): void; handleReactionsCount(reactionsCount: Map): void; getReactionsByUser(jid: string): string[]; hasUserUsedEmojiReaction(jid: string, emoji: string): boolean; hasAdditionalContent(): this is MessageWithAdditional; isMarkDown(): this is MessageWithAdditional<'text/markdown'>; isAdaptiveCard(): this is MessageWithAdditional<'form/json'>; isAdaptiveCardResponse(): this is MessageWithAdditional<'rainbow/json'>; getReceiptStatusIconId(): string; isMessageback(message: MessageWithAdditional): boolean; toJSON(): any; } export declare class AnswerMessage { name: string; messageAnswered: Message; answeredMessageData: any; constructor(name: string, messageAnswered: Message, answeredMessageData: any); } export {}; //# sourceMappingURL=message.model.d.ts.map