@bcc-code/vue-bcc-chat-ui 7.2.3 → 7.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.vue.d.ts +4 -0
- package/dist/FixtureApp.vue.d.ts +4 -0
- package/dist/auth.d.ts +3 -0
- package/dist/chat/accessToken.d.ts +11 -0
- package/dist/chat/avatar.d.ts +3 -0
- package/dist/chat/cacheScope.d.ts +13 -0
- package/dist/chat/client.d.ts +7 -0
- package/dist/chat/clipboardFiles.d.ts +5 -0
- package/dist/chat/conversationState.d.ts +17 -0
- package/dist/chat/data.d.ts +18 -0
- package/dist/chat/environment.d.ts +8 -0
- package/dist/chat/i18n/en.d.ts +151 -0
- package/dist/chat/i18n/nb.d.ts +151 -0
- package/dist/chat/i18n/types.d.ts +2 -0
- package/dist/chat/index.d.ts +240 -0
- package/dist/chat/localization.d.ts +17 -0
- package/dist/chat/mentions.d.ts +33 -0
- package/dist/chat/messageText.d.ts +21 -0
- package/dist/chat/mockClient.d.ts +13 -0
- package/dist/chat/offlineStore.d.ts +55 -0
- package/dist/chat/participants.d.ts +8 -0
- package/dist/chat/pinnedMessages.d.ts +12 -0
- package/dist/chat/publicChannelMessageFallback.d.ts +1 -0
- package/dist/chat/reactions.d.ts +8 -0
- package/dist/chat/richText.d.ts +9 -0
- package/dist/chat/runtime.d.ts +3 -0
- package/dist/chat/theme.d.ts +19 -0
- package/dist/chat/types.d.ts +409 -0
- package/dist/components/chat/BccChat.vue.d.ts +100 -0
- package/dist/components/chat/ChatStatusOverlay.vue.d.ts +34 -0
- package/dist/components/chat/publicContract.d.ts +44 -0
- package/dist/components/conversations/ConversationList.vue.d.ts +18 -0
- package/dist/components/conversations/UserProfileCard.vue.d.ts +9 -0
- package/dist/components/messages/ActionMessageRow.vue.d.ts +7 -0
- package/dist/components/messages/AudioStickyPlayer.vue.d.ts +12 -0
- package/dist/components/messages/ComposerActionsPopover.vue.d.ts +15 -0
- package/dist/components/messages/ComposerContextBanner.vue.d.ts +15 -0
- package/dist/components/messages/ComposerFormatMenu.vue.d.ts +19 -0
- package/dist/components/messages/ComposerLinkDialog.vue.d.ts +18 -0
- package/dist/components/messages/ComposerPollDialog.vue.d.ts +18 -0
- package/dist/components/messages/ComposerScheduleDialog.vue.d.ts +22 -0
- package/dist/components/messages/ComposerTriggerMenu.vue.d.ts +24 -0
- package/dist/components/messages/ConversationComposer.vue.d.ts +30 -0
- package/dist/components/messages/LinkPreviewCard.vue.d.ts +8 -0
- package/dist/components/messages/LinkifiedText.vue.d.ts +15 -0
- package/dist/components/messages/MessageAttachmentList.vue.d.ts +12 -0
- package/dist/components/messages/MessageComposer.vue.d.ts +59 -0
- package/dist/components/messages/MessageDateSeparator.vue.d.ts +7 -0
- package/dist/components/messages/MessageDeliveryStatus.vue.d.ts +8 -0
- package/dist/components/messages/MessageForwardedLabel.vue.d.ts +8 -0
- package/dist/components/messages/MessageItem.vue.d.ts +36 -0
- package/dist/components/messages/MessageItemHeader.vue.d.ts +8 -0
- package/dist/components/messages/MessageItemMenu.vue.d.ts +36 -0
- package/dist/components/messages/MessageItemMenuReactions.vue.d.ts +13 -0
- package/dist/components/messages/MessageItemReactions.vue.d.ts +16 -0
- package/dist/components/messages/MessageList.vue.d.ts +42 -0
- package/dist/components/messages/MessageListHeader.vue.d.ts +9 -0
- package/dist/components/messages/MessagePinnedLabel.vue.d.ts +4 -0
- package/dist/components/messages/MessagePollContent.vue.d.ts +14 -0
- package/dist/components/messages/MessageReactionList.vue.d.ts +14 -0
- package/dist/components/messages/MessageReplyQuote.vue.d.ts +12 -0
- package/dist/components/messages/MessageTextContent.vue.d.ts +12 -0
- package/dist/components/messages/PinnedMessagesBar.vue.d.ts +4 -0
- package/dist/components/overlays/ForwardMessageDialog.vue.d.ts +16 -0
- package/dist/components/overlays/FullscreenDialog.vue.d.ts +34 -0
- package/dist/components/overlays/MediaViewerDialog.vue.d.ts +12 -0
- package/dist/components/overlays/MessageInfoDialog.vue.d.ts +16 -0
- package/dist/components/overlays/PinnedMessagesDialog.vue.d.ts +20 -0
- package/dist/components/overlays/ReceiptSection.vue.d.ts +13 -0
- package/dist/components/overlays/ScheduledMessagesDialog.vue.d.ts +37 -0
- package/dist/components/shared/PersonAvatar.vue.d.ts +8 -0
- package/dist/composables/chat/index.d.ts +13 -0
- package/dist/composables/chat/useComposerContext.d.ts +44 -0
- package/dist/composables/chat/useConversationContext.d.ts +36 -0
- package/dist/composables/chat/useDialogsContext.d.ts +43 -0
- package/dist/composables/chat/useMessagesContext.d.ts +42 -0
- package/dist/composables/useAudioPlayer.d.ts +18 -0
- package/dist/composables/useChatActions.d.ts +21 -0
- package/dist/composables/useChatEventBus.d.ts +108 -0
- package/dist/composables/useComposerDrafts.d.ts +47 -0
- package/dist/composables/useComposerTriggers.d.ts +63 -0
- package/dist/composables/useConversationComposer.d.ts +16 -0
- package/dist/composables/useGroupMemberTracking.d.ts +33 -0
- package/dist/composables/useImageZoom.d.ts +26 -0
- package/dist/composables/useIsTouchUi.d.ts +4 -0
- package/dist/composables/useMessageActionMenu.d.ts +257 -0
- package/dist/composables/useMessageInfoDialog.d.ts +201 -0
- package/dist/composables/useMessageListScroll.d.ts +15 -0
- package/dist/composables/useMessageNavigation.d.ts +16 -0
- package/dist/composables/usePinnedMessages.d.ts +190 -0
- package/dist/composables/useRichTextComposer.d.ts +75 -0
- package/dist/demo/ApiExamplesPanel.vue.d.ts +8 -0
- package/dist/demo/CallDebugPanel.vue.d.ts +8 -0
- package/dist/demo/ChatShell.vue.d.ts +12 -0
- package/dist/demo/StatCard.vue.d.ts +17 -0
- package/dist/demo/ThemeModeToggle.vue.d.ts +17 -0
- package/dist/demo/useDemoThemeMode.d.ts +7 -0
- package/dist/{dist-CP-Tq-KK.js → dist-BJ6-Om37.js} +1 -1
- package/dist/dist-BJ6-Om37.js.map +1 -0
- package/dist/index.d.ts +11 -841
- package/dist/main.d.ts +0 -0
- package/dist/sfc-styles-entry.d.ts +1 -0
- package/dist/shims-vue.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/vite-env.d.ts +1 -0
- package/dist/vue-bcc-chat-ui.js +6174 -5663
- package/dist/vue-bcc-chat-ui.js.map +1 -1
- package/dist/{web-CDfDePhG.js → web-DSJwqhTK.js} +2 -2
- package/dist/web-DSJwqhTK.js.map +1 -0
- package/package.json +9 -5
- package/dist/dist-CP-Tq-KK.js.map +0 -1
- package/dist/web-CDfDePhG.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { englishTranslations } from './i18n/en';
|
|
3
|
+
import { TranslationEntry, TranslationParams } from './i18n/types';
|
|
4
|
+
import { Language } from './types';
|
|
5
|
+
type TranslationDictionary = Record<keyof typeof englishTranslations, TranslationEntry>;
|
|
6
|
+
export type TranslationKey = keyof TranslationDictionary;
|
|
7
|
+
export declare const currentChatLanguage: Ref<Language, Language>;
|
|
8
|
+
export declare function resolveChatLocale(language?: Language | null): "nb-NO" | "en-US";
|
|
9
|
+
/** Chat uses 24-hour time formatting consistently. */
|
|
10
|
+
export declare function getSystemHourCycle(): "h12" | "h23";
|
|
11
|
+
export declare function setCurrentChatLanguage(language: Language): void;
|
|
12
|
+
export declare function translateChat(key: TranslationKey, params?: TranslationParams, language?: Language | null): string;
|
|
13
|
+
export declare function useChatI18n(language?: MaybeRefOrGetter<Language | undefined | null>): {
|
|
14
|
+
locale: ComputedRef<"nb-NO" | "en-US">;
|
|
15
|
+
t: (key: TranslationKey, params?: TranslationParams) => string;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseMessage } from '@cometchat/chat-sdk-javascript';
|
|
2
|
+
import { ParticipantInfo } from './types';
|
|
3
|
+
export declare const MENTION_TOKEN_PATTERN: RegExp;
|
|
4
|
+
export declare const MENTION_TOKEN_ENCODED_PATTERN: RegExp;
|
|
5
|
+
export declare const MENTION_UID_DATA_ATTR = "data-mention-uid";
|
|
6
|
+
export declare const COMPOSER_MENTION_CLASS = "composer-mention";
|
|
7
|
+
export declare const MESSAGE_MENTION_CLASS = "message-mention";
|
|
8
|
+
export interface MentionCandidate {
|
|
9
|
+
uid: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
avatar?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function participantToMentionCandidate(participant: ParticipantInfo): MentionCandidate;
|
|
14
|
+
export declare function buildMentionNameByUid(candidates: ReadonlyArray<MentionCandidate>): Record<string, string>;
|
|
15
|
+
export declare function filterMentionCandidates(candidates: ReadonlyArray<MentionCandidate>, query: string, limit?: number): MentionCandidate[];
|
|
16
|
+
export declare function encodeMentionToken(uid: string): string;
|
|
17
|
+
export declare function decodeMentionTokenEntities(text: string): string;
|
|
18
|
+
export declare function containsMentionTokens(text: string): boolean;
|
|
19
|
+
export declare function shieldMentionTokens(text: string): {
|
|
20
|
+
shielded: string;
|
|
21
|
+
tokens: string[];
|
|
22
|
+
};
|
|
23
|
+
export declare function unshieldMentionTokens(text: string, tokens: string[]): string;
|
|
24
|
+
export declare function replaceMentionTokens(text: string, resolveName: (uid: string) => string, className?: string): string;
|
|
25
|
+
export declare function convertMentionTokensToComposerHtml(text: string, nameByUid?: Record<string, string>): string;
|
|
26
|
+
export declare function convertMentionTokensToMessageHtml(text: string, nameByUid?: Record<string, string>): string;
|
|
27
|
+
export declare function serializeComposerHtmlToWireText(html: string): string;
|
|
28
|
+
export declare function ingestMessageTextFromServer(text: string | null | undefined, nameByUid?: Record<string, string>): string;
|
|
29
|
+
export declare function getMentionNameByUidFromSdkMessage(source: BaseMessage | undefined): Record<string, string>;
|
|
30
|
+
export declare function mergeMentionNameByUid(...maps: ReadonlyArray<Record<string, string>>): Record<string, string>;
|
|
31
|
+
export declare function formatMentionTokensPlain(text: string, nameByUid?: Record<string, string>): string;
|
|
32
|
+
export declare function formatConversationSubtitlePreview(subtitle: string, nameByUid?: Record<string, string>): string;
|
|
33
|
+
export declare function getPlainTextWithMentionLabels(html: string, nameByUid?: Record<string, string>): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseMessage } from '@cometchat/chat-sdk-javascript';
|
|
2
|
+
import { formatConversationSubtitlePreview } from './mentions';
|
|
3
|
+
import { ChatAttachmentItem, ChatMessageItem, ChatReplyPreview } from './types';
|
|
4
|
+
type MessageTextSource = Pick<ChatMessageItem, "text" | "kind" | "poll" | "attachments">;
|
|
5
|
+
export declare function getAttachmentDisplayText(attachments: ReadonlyArray<Pick<ChatAttachmentItem, "kind" | "name">>, fallback?: string): string;
|
|
6
|
+
export declare function normalizeMessageText(value: string | null | undefined, mentionNameByUid?: Record<string, string>): string;
|
|
7
|
+
export declare function serializeMessageTextForSend(value: string | null | undefined): string;
|
|
8
|
+
export declare function hasMessageText(value: string | null | undefined): boolean;
|
|
9
|
+
export declare function getMessagePlainText(value: string | null | undefined, mentionNameByUid?: Record<string, string>): string;
|
|
10
|
+
export declare function getMessageDisplayText(message: MessageTextSource, fallback?: string, mentionNameByUid?: Record<string, string>): string;
|
|
11
|
+
export declare function getMessagePreviewText(message: MessageTextSource, mentionNameByUid?: Record<string, string>): string;
|
|
12
|
+
export declare function formatReplyPreviewText(text: string, mentionNameByUid?: Record<string, string>): string;
|
|
13
|
+
export declare function getMessageTextPreview(message?: any, showEmoji?: boolean, showAttachmentName?: boolean): string;
|
|
14
|
+
export declare function buildReplyPreview(message: Pick<ChatMessageItem, "id" | "senderName" | "text" | "kind" | "poll" | "attachments" | "source"> & {
|
|
15
|
+
source?: unknown;
|
|
16
|
+
}): ChatReplyPreview;
|
|
17
|
+
export declare function buildMessageActionText(message: Pick<ChatMessageItem, "text" | "attachments">): string;
|
|
18
|
+
export declare function buildConversationSubtitle(message: MessageTextSource & {
|
|
19
|
+
source?: BaseMessage;
|
|
20
|
+
}): string;
|
|
21
|
+
export { formatConversationSubtitlePreview };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChatClient, ChatUserProfile } from './types';
|
|
2
|
+
export type VisualFixtureMode = "desktop" | "mobile" | "empty" | "scheduled";
|
|
3
|
+
export interface MockChatScenario {
|
|
4
|
+
client: ChatClient;
|
|
5
|
+
profile: ChatUserProfile;
|
|
6
|
+
displayName: string;
|
|
7
|
+
email: string;
|
|
8
|
+
heroStatus: {
|
|
9
|
+
label: string;
|
|
10
|
+
severity: "warn" | "success" | "contrast";
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function createMockChatScenario(mode: VisualFixtureMode): MockChatScenario;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CachedLastMessage, CachedParticipantSettings, ChatAttachmentItem, ChatConversationItem, ChatMessageItem, PollComposerInput } from './types';
|
|
2
|
+
interface OfflineQueueAttachment {
|
|
3
|
+
kind: ChatAttachmentItem["kind"];
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
size: number;
|
|
7
|
+
caption?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface OfflineQueueItem {
|
|
10
|
+
id: string;
|
|
11
|
+
muid: string;
|
|
12
|
+
conversationId: string;
|
|
13
|
+
targetId: string;
|
|
14
|
+
receiverType: "group" | "user";
|
|
15
|
+
kind: "text" | "poll" | "attachment";
|
|
16
|
+
senderAvatar?: string;
|
|
17
|
+
text?: string;
|
|
18
|
+
poll?: PollComposerInput;
|
|
19
|
+
attachment?: OfflineQueueAttachment;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
parentMessageId?: string;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class ChatOfflineStore {
|
|
25
|
+
readonly storageKey: string;
|
|
26
|
+
private attachmentDbPromise;
|
|
27
|
+
constructor(storageKey: string);
|
|
28
|
+
getConversations(): ChatConversationItem[];
|
|
29
|
+
getSearchableConversations(): ChatConversationItem[];
|
|
30
|
+
setConversations(conversations: ChatConversationItem[]): void;
|
|
31
|
+
getMessages(conversationId: string): ChatMessageItem[];
|
|
32
|
+
getAllMessages(): ChatMessageItem[];
|
|
33
|
+
setMessages(conversationId: string, messages: ChatMessageItem[]): void;
|
|
34
|
+
getThreadMessages(parentMessageId: string): ChatMessageItem[];
|
|
35
|
+
setThreadMessages(parentMessageId: string, messages: ChatMessageItem[]): void;
|
|
36
|
+
getPinnedMessages(conversationId: string): ChatMessageItem[];
|
|
37
|
+
setPinnedMessages(conversationId: string, records: ReadonlyArray<ChatMessageItem>): void;
|
|
38
|
+
getQueue(): OfflineQueueItem[];
|
|
39
|
+
enqueue(item: OfflineQueueItem): void;
|
|
40
|
+
dequeue(id: string): void;
|
|
41
|
+
getParticipantSettings(chatUid: string): CachedParticipantSettings | null;
|
|
42
|
+
storeParticipantSettings(settings: CachedParticipantSettings): void;
|
|
43
|
+
getLastMessage(chatUid: string): CachedLastMessage | null;
|
|
44
|
+
storeLastMessage(lastMessage: CachedLastMessage): void;
|
|
45
|
+
clear(): void;
|
|
46
|
+
storeQueuedAttachment(id: string, file: File): Promise<void>;
|
|
47
|
+
getQueuedAttachment(id: string): Promise<File | null>;
|
|
48
|
+
deleteQueuedAttachment(id: string): Promise<void>;
|
|
49
|
+
private read;
|
|
50
|
+
private write;
|
|
51
|
+
private mutate;
|
|
52
|
+
private clearQueuedAttachments;
|
|
53
|
+
private openAttachmentDb;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GroupMember, User } from '@cometchat/chat-sdk-javascript';
|
|
2
|
+
import { ParticipantInfo } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes a CometChat `GroupMember`/`User` instance into a {@link ParticipantInfo}.
|
|
5
|
+
* Pass `roleOverride` when the caller already knows the role (e.g. from a scope-change event)
|
|
6
|
+
* rather than relying on the source object's own scope.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeParticipantInfo(source: GroupMember | User, roleOverride?: string): ParticipantInfo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChatMessageItem } from './types';
|
|
2
|
+
export declare const SYSTEM_PINNER_UID = "app_system";
|
|
3
|
+
export declare function canPinMessage(message: Pick<ChatMessageItem, "kind" | "isDeleted" | "deliveryState"> | null): boolean | null;
|
|
4
|
+
export declare function isPinnedMessage(message: Pick<ChatMessageItem, "pinnedAt"> | null | undefined): boolean;
|
|
5
|
+
/** Whether the pin came from the app/admin rather than from a member. */
|
|
6
|
+
export declare function isSystemPinnedMessage(message: Pick<ChatMessageItem, "pinnedAt" | "pinnedBy"> | null | undefined): boolean;
|
|
7
|
+
/** Most recently pinned message first, falling back to the send order. */
|
|
8
|
+
export declare function sortPinnedMessages(messages: ReadonlyArray<ChatMessageItem>): ChatMessageItem[];
|
|
9
|
+
export declare function upsertPinnedMessage(messages: ReadonlyArray<ChatMessageItem>, message: ChatMessageItem): ChatMessageItem[];
|
|
10
|
+
export declare function removePinnedMessage(messages: ReadonlyArray<ChatMessageItem>, messageId: string): ChatMessageItem[];
|
|
11
|
+
export declare function isPinnedMessageId(messages: ReadonlyArray<ChatMessageItem>, messageId: string): boolean;
|
|
12
|
+
export declare function hasReachedPinnedMessagesLimit(messages: ReadonlyArray<ChatMessageItem>, limit: number | null | undefined): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function installPublicChannelMessageFallback(): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emoji reaction sets used across message action menus and reaction pickers.
|
|
3
|
+
*
|
|
4
|
+
* COMMON_REACTIONS are shown first in the compact popover row.
|
|
5
|
+
* EXTENDED_REACTIONS populate the expanded grid when the user opens the full picker.
|
|
6
|
+
*/
|
|
7
|
+
export declare const COMMON_REACTIONS: string[];
|
|
8
|
+
export declare const EXTENDED_REACTIONS: string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function normalizeRichTextForStorage(input: string | null | undefined): string;
|
|
2
|
+
export interface RenderRichTextOptions {
|
|
3
|
+
mentionNameByUid?: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export declare function getPlainTextFromRichText(input: string | null | undefined, mentionNameByUid?: Record<string, string>): string;
|
|
6
|
+
export declare function renderRichText(input: string | null | undefined, options?: RenderRichTextOptions): string;
|
|
7
|
+
export declare function toMarkdownHtml(str: string, mentionedUsers?: any[]): string;
|
|
8
|
+
export declare function getFirstUrlFromRichText(input: string | null | undefined): string | undefined;
|
|
9
|
+
export declare function normalizeHyperlinkUrl(value: string | null | undefined): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ThemeMode } from './types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
export declare const theme: Ref<{
|
|
4
|
+
palette: {
|
|
5
|
+
mode: ThemeMode;
|
|
6
|
+
setMode: (mode: ThemeMode) => void;
|
|
7
|
+
};
|
|
8
|
+
}, {
|
|
9
|
+
palette: {
|
|
10
|
+
mode: ThemeMode;
|
|
11
|
+
setMode(mode: ThemeMode): void;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
palette: {
|
|
15
|
+
mode: ThemeMode;
|
|
16
|
+
setMode: (mode: ThemeMode) => void;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export declare function setThemeMode(mode: ThemeMode): void;
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { BaseMessage, Conversation, Group, MessageReceipt, CometChat } from '@cometchat/chat-sdk-javascript';
|
|
2
|
+
import { ComputedRef, Ref } from 'vue';
|
|
3
|
+
import { Environment } from './environment';
|
|
4
|
+
export interface ChatUserProfile {
|
|
5
|
+
uid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
status?: string;
|
|
9
|
+
lastSeen?: Date;
|
|
10
|
+
}
|
|
11
|
+
export interface FuseResultMatch {
|
|
12
|
+
indices: ReadonlyArray<[number, number]>;
|
|
13
|
+
key?: {
|
|
14
|
+
src: string;
|
|
15
|
+
} | string;
|
|
16
|
+
value?: string;
|
|
17
|
+
}
|
|
18
|
+
export type Language = "nb" | "no" | "ar" | "de" | "en" | "es" | "fr" | "hi" | "ms" | "pt" | "ru" | "zh" | "zh-tw" | "sv" | "lt";
|
|
19
|
+
export type ThemeMode = "dark" | "light";
|
|
20
|
+
export type OnlineStatus = "online" | "offline";
|
|
21
|
+
export interface ChatInstallOptions {
|
|
22
|
+
environment: Environment;
|
|
23
|
+
language?: Language;
|
|
24
|
+
themeMode: ThemeMode;
|
|
25
|
+
accessToken?: Ref<string | null | undefined> | null | undefined | string;
|
|
26
|
+
loggerCallback?: (entry: LogEntry) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface ChatInstance {
|
|
29
|
+
componentId: string;
|
|
30
|
+
replyToMessage: BaseMessage | null;
|
|
31
|
+
captionedAttachment: {
|
|
32
|
+
fileObject?: File;
|
|
33
|
+
dimensions?: {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
} | null;
|
|
38
|
+
decoyAttachment: {
|
|
39
|
+
fileObject?: File;
|
|
40
|
+
dimensions?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
} | null;
|
|
45
|
+
scheduledMessageChat?: Group;
|
|
46
|
+
showScheduledMessagesChat: boolean;
|
|
47
|
+
showAlert: boolean;
|
|
48
|
+
showRescheduleAlert: boolean;
|
|
49
|
+
userInput: string | null;
|
|
50
|
+
rescheduleInfo: {
|
|
51
|
+
rescheduleMuid: string;
|
|
52
|
+
messageId: number;
|
|
53
|
+
} | null;
|
|
54
|
+
}
|
|
55
|
+
export interface View {
|
|
56
|
+
componentName: string;
|
|
57
|
+
props?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
export type ChatMessageKind = "text" | "image" | "video" | "audio" | "file" | "poll" | "action" | "unsupported";
|
|
60
|
+
export type ChatComposerTarget = "main" | "thread";
|
|
61
|
+
export type ComposerFormatCommand = "bold" | "italic" | "underline";
|
|
62
|
+
export type ComposerFormattingMode = "default" | "external";
|
|
63
|
+
export interface ComposerSelectionRect {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
top: number;
|
|
67
|
+
right: number;
|
|
68
|
+
bottom: number;
|
|
69
|
+
left: number;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
}
|
|
73
|
+
export interface ComposerSelectionState {
|
|
74
|
+
text: string;
|
|
75
|
+
href?: string;
|
|
76
|
+
rect: ComposerSelectionRect;
|
|
77
|
+
}
|
|
78
|
+
export interface ChatComposerSelectionState extends ComposerSelectionState {
|
|
79
|
+
target: ChatComposerTarget;
|
|
80
|
+
}
|
|
81
|
+
export interface BccChatComposerFormattingHandle {
|
|
82
|
+
applyComposerFormat(command: ComposerFormatCommand, target?: ChatComposerTarget): boolean;
|
|
83
|
+
requestComposerLink(target?: ChatComposerTarget): boolean;
|
|
84
|
+
applyComposerLink(url: string, target?: ChatComposerTarget): boolean;
|
|
85
|
+
cancelComposerLink(target?: ChatComposerTarget): void;
|
|
86
|
+
getComposerSelection(target?: ChatComposerTarget): ChatComposerSelectionState | null;
|
|
87
|
+
}
|
|
88
|
+
export interface BccChatExpose extends BccChatComposerFormattingHandle {
|
|
89
|
+
scrollToMessage(messageId: string): Promise<void>;
|
|
90
|
+
readonly groupMembers: ParticipantInfo[];
|
|
91
|
+
}
|
|
92
|
+
export interface ChatAttachmentItem {
|
|
93
|
+
kind: Extract<ChatMessageKind, "image" | "video" | "audio" | "file">;
|
|
94
|
+
name: string;
|
|
95
|
+
url?: string;
|
|
96
|
+
mimeType?: string;
|
|
97
|
+
extension?: string;
|
|
98
|
+
size?: number;
|
|
99
|
+
width?: number;
|
|
100
|
+
height?: number;
|
|
101
|
+
}
|
|
102
|
+
export interface ChatPollOptionItem {
|
|
103
|
+
id: string;
|
|
104
|
+
text: string;
|
|
105
|
+
voteCount: number;
|
|
106
|
+
voters: ChatUserProfile[];
|
|
107
|
+
}
|
|
108
|
+
export interface ChatPollData {
|
|
109
|
+
id?: string;
|
|
110
|
+
question: string;
|
|
111
|
+
options: ChatPollOptionItem[];
|
|
112
|
+
totalVotes: number;
|
|
113
|
+
allowsMultipleAnswers: boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface ChatReactionItem {
|
|
116
|
+
emoji: string;
|
|
117
|
+
count: number;
|
|
118
|
+
reactedByMe: boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface ChatReactionDetailItem {
|
|
121
|
+
emoji: string;
|
|
122
|
+
user: ChatUserProfile;
|
|
123
|
+
reactedAt?: Date;
|
|
124
|
+
}
|
|
125
|
+
export type ChatMessageReceiptKind = "delivered" | "read";
|
|
126
|
+
export interface ChatMessageReceiptItem {
|
|
127
|
+
kind: ChatMessageReceiptKind;
|
|
128
|
+
user: ChatUserProfile;
|
|
129
|
+
timestamp?: Date;
|
|
130
|
+
}
|
|
131
|
+
export interface MessageInfo {
|
|
132
|
+
text?: string;
|
|
133
|
+
type: string;
|
|
134
|
+
senderUid: string;
|
|
135
|
+
senderName: string;
|
|
136
|
+
sentAt: Date;
|
|
137
|
+
sentByCurrentUser: boolean;
|
|
138
|
+
readAt: Date | undefined;
|
|
139
|
+
messageReceipts?: MessageReceipt[];
|
|
140
|
+
}
|
|
141
|
+
export interface ChatMessageReceiptSummary {
|
|
142
|
+
deliveredAt?: Date;
|
|
143
|
+
deliveredToMeAt?: Date;
|
|
144
|
+
readAt?: Date;
|
|
145
|
+
readByMeAt?: Date;
|
|
146
|
+
}
|
|
147
|
+
export interface ChatReplyPreview {
|
|
148
|
+
messageId: string;
|
|
149
|
+
senderName: string;
|
|
150
|
+
text: string;
|
|
151
|
+
kind: ChatMessageKind;
|
|
152
|
+
}
|
|
153
|
+
export interface ChatForwardedFromInfo {
|
|
154
|
+
senderName: string;
|
|
155
|
+
}
|
|
156
|
+
export type ChatDeliveryState = "sent" | "queued" | "sending" | "failed";
|
|
157
|
+
export interface ChatScheduledInfo {
|
|
158
|
+
scheduleDate?: Date;
|
|
159
|
+
originalChatUid?: string;
|
|
160
|
+
muid?: string;
|
|
161
|
+
messageId?: number;
|
|
162
|
+
}
|
|
163
|
+
export interface ChatMessageItem {
|
|
164
|
+
id: string;
|
|
165
|
+
muid?: string;
|
|
166
|
+
conversationId: string;
|
|
167
|
+
senderId: string;
|
|
168
|
+
senderName: string;
|
|
169
|
+
text: string;
|
|
170
|
+
kind: ChatMessageKind;
|
|
171
|
+
sentAt: Date;
|
|
172
|
+
category: string;
|
|
173
|
+
type: string;
|
|
174
|
+
senderAvatar?: string;
|
|
175
|
+
isOwn: boolean;
|
|
176
|
+
isDeleted: boolean;
|
|
177
|
+
isEdited: boolean;
|
|
178
|
+
attachments: ChatAttachmentItem[];
|
|
179
|
+
poll?: ChatPollData;
|
|
180
|
+
scheduled?: ChatScheduledInfo;
|
|
181
|
+
translatedText?: string;
|
|
182
|
+
replyTo?: ChatReplyPreview;
|
|
183
|
+
forwardedFrom?: ChatForwardedFromInfo;
|
|
184
|
+
parentMessageId?: string;
|
|
185
|
+
replyCount: number;
|
|
186
|
+
reactions: ChatReactionItem[];
|
|
187
|
+
receipts: ChatMessageReceiptSummary;
|
|
188
|
+
/** Set while the message is pinned in its conversation; the same value for every member. */
|
|
189
|
+
pinnedAt?: Date;
|
|
190
|
+
/** Uid of the most recent pinner, or the `app_system` sentinel for an app/admin pin. */
|
|
191
|
+
pinnedBy?: string;
|
|
192
|
+
deliveryState: ChatDeliveryState;
|
|
193
|
+
metadata?: Record<string, unknown>;
|
|
194
|
+
source: any;
|
|
195
|
+
}
|
|
196
|
+
export interface ChatConversationItem {
|
|
197
|
+
id: string;
|
|
198
|
+
targetId: string;
|
|
199
|
+
type: "group" | "user";
|
|
200
|
+
title: string;
|
|
201
|
+
subtitle: string;
|
|
202
|
+
avatar?: string;
|
|
203
|
+
unreadCount: number;
|
|
204
|
+
lastMessageAt?: Date;
|
|
205
|
+
muteSettings?: Date | null;
|
|
206
|
+
hasJoined?: boolean;
|
|
207
|
+
tags: string[];
|
|
208
|
+
memberCount?: number;
|
|
209
|
+
source?: Conversation | null;
|
|
210
|
+
lastMessage?: ChatMessageItem | null;
|
|
211
|
+
}
|
|
212
|
+
export interface UserChatInfo {
|
|
213
|
+
chatUid: string;
|
|
214
|
+
name: string;
|
|
215
|
+
unreadMessageCount: number;
|
|
216
|
+
lastMessage?: MessageInfo;
|
|
217
|
+
membersCount: number;
|
|
218
|
+
tags: string[];
|
|
219
|
+
muteSettings?: Date | null;
|
|
220
|
+
hasJoined: boolean;
|
|
221
|
+
}
|
|
222
|
+
export interface ForwardMessageTarget {
|
|
223
|
+
chatUid: string;
|
|
224
|
+
type: "user" | "group";
|
|
225
|
+
}
|
|
226
|
+
export interface ParticipantInfo {
|
|
227
|
+
uid: string;
|
|
228
|
+
displayName: string;
|
|
229
|
+
avatar: string;
|
|
230
|
+
role: string;
|
|
231
|
+
lastSeen?: Date;
|
|
232
|
+
}
|
|
233
|
+
export interface DispatchData {
|
|
234
|
+
muid: string;
|
|
235
|
+
originalChatUid: string;
|
|
236
|
+
scheduleDate: string;
|
|
237
|
+
messageId: number;
|
|
238
|
+
}
|
|
239
|
+
export interface LogEntry {
|
|
240
|
+
logUid: string;
|
|
241
|
+
correlationUid?: string;
|
|
242
|
+
message: string;
|
|
243
|
+
severity: LogSeverity;
|
|
244
|
+
userMetadata?: Record<string, unknown>;
|
|
245
|
+
timestamp: string;
|
|
246
|
+
}
|
|
247
|
+
export declare enum LogSeverity {
|
|
248
|
+
DEBUG = "Debug",
|
|
249
|
+
INFO = "Info",
|
|
250
|
+
WARN = "Warn",
|
|
251
|
+
ERROR = "Error"
|
|
252
|
+
}
|
|
253
|
+
export interface SearchedItems {
|
|
254
|
+
conversations: {
|
|
255
|
+
conversation: ChatConversationItem;
|
|
256
|
+
matches: FuseResultMatch[];
|
|
257
|
+
}[];
|
|
258
|
+
messages: {
|
|
259
|
+
message: ChatMessageItem;
|
|
260
|
+
matches: FuseResultMatch[];
|
|
261
|
+
}[];
|
|
262
|
+
}
|
|
263
|
+
export interface ParticipantSettings {
|
|
264
|
+
chatUid: string;
|
|
265
|
+
personUid: string;
|
|
266
|
+
mutedUntil: string | null;
|
|
267
|
+
}
|
|
268
|
+
export interface PersonSettings {
|
|
269
|
+
mutedAll: boolean;
|
|
270
|
+
}
|
|
271
|
+
export interface CachedParticipantSettings {
|
|
272
|
+
chatUid: string;
|
|
273
|
+
mutedUntil: string | null;
|
|
274
|
+
lastUpdated: number;
|
|
275
|
+
}
|
|
276
|
+
export interface CachedLastMessage {
|
|
277
|
+
chatUid: string;
|
|
278
|
+
lastMessage: null | MessageInfo;
|
|
279
|
+
lastUpdated: number;
|
|
280
|
+
}
|
|
281
|
+
export interface AttachmentUploadInput {
|
|
282
|
+
file: File;
|
|
283
|
+
caption?: string;
|
|
284
|
+
}
|
|
285
|
+
export interface PollComposerInput {
|
|
286
|
+
question: string;
|
|
287
|
+
options: string[];
|
|
288
|
+
}
|
|
289
|
+
export interface MessageSendOptions {
|
|
290
|
+
senderDisplayName?: string;
|
|
291
|
+
}
|
|
292
|
+
export interface ScheduleMessageInput {
|
|
293
|
+
scheduleDate: string;
|
|
294
|
+
text?: string;
|
|
295
|
+
file?: File;
|
|
296
|
+
caption?: string;
|
|
297
|
+
}
|
|
298
|
+
export interface ChatMessagesGetterPagination {
|
|
299
|
+
total_pages?: number;
|
|
300
|
+
current_page?: number;
|
|
301
|
+
[key: string]: unknown;
|
|
302
|
+
}
|
|
303
|
+
export interface ChatMessagesGetterResult<TMessage = Record<string, unknown>> {
|
|
304
|
+
data: TMessage[];
|
|
305
|
+
meta?: {
|
|
306
|
+
pagination?: ChatMessagesGetterPagination;
|
|
307
|
+
[key: string]: unknown;
|
|
308
|
+
};
|
|
309
|
+
[key: string]: unknown;
|
|
310
|
+
}
|
|
311
|
+
export type ChatMessagesGetter = (guid: string, query: string) => Promise<ChatMessagesGetterResult>;
|
|
312
|
+
export interface RescheduleMessageInput {
|
|
313
|
+
messageId: number;
|
|
314
|
+
muid: string;
|
|
315
|
+
originalChatUid: string;
|
|
316
|
+
scheduleDate: string;
|
|
317
|
+
}
|
|
318
|
+
export interface ChatClient {
|
|
319
|
+
initialized: Ref<boolean>;
|
|
320
|
+
loggingIn: Ref<boolean>;
|
|
321
|
+
loadingConversations: Ref<boolean>;
|
|
322
|
+
loadingMessages: Ref<boolean>;
|
|
323
|
+
loadingThreadMessages: Ref<boolean>;
|
|
324
|
+
loadingOlderMessages: Ref<boolean>;
|
|
325
|
+
loadingOlderThreadMessages: Ref<boolean>;
|
|
326
|
+
loadingScheduledMessages: Ref<boolean>;
|
|
327
|
+
sendingMessage: Ref<boolean>;
|
|
328
|
+
schedulingMessage: Ref<boolean>;
|
|
329
|
+
syncingQueue: Ref<boolean>;
|
|
330
|
+
connected: Ref<boolean>;
|
|
331
|
+
offlineMode: Ref<boolean>;
|
|
332
|
+
hideGroupActions: Ref<boolean>;
|
|
333
|
+
loggedIn: Ref<boolean>;
|
|
334
|
+
error: Ref<string | null>;
|
|
335
|
+
currentUser: Ref<ChatUserProfile | null>;
|
|
336
|
+
conversations: Ref<ChatConversationItem[]>;
|
|
337
|
+
messages: Ref<ChatMessageItem[]>;
|
|
338
|
+
threadMessages: Ref<ChatMessageItem[]>;
|
|
339
|
+
scheduledMessages: Ref<ChatMessageItem[]>;
|
|
340
|
+
/** Pinned messages of the active conversation, most recently pinned first. */
|
|
341
|
+
pinnedMessages: Ref<ChatMessageItem[]>;
|
|
342
|
+
loadingPinnedMessages: Ref<boolean>;
|
|
343
|
+
/** Whether Pin Message is enabled for the chat app. */
|
|
344
|
+
pinningEnabled: Ref<boolean>;
|
|
345
|
+
/** Server-owned cap on pins per conversation; null while unknown. */
|
|
346
|
+
pinnedMessagesLimit: Ref<number | null>;
|
|
347
|
+
hasOlderMessages: Ref<boolean>;
|
|
348
|
+
hasOlderThreadMessages: Ref<boolean>;
|
|
349
|
+
pendingQueueCount: ComputedRef<number>;
|
|
350
|
+
activeConversationId: Ref<string | null>;
|
|
351
|
+
activeConversation: ComputedRef<ChatConversationItem | null>;
|
|
352
|
+
activeThreadParentMessage: Ref<ChatMessageItem | null>;
|
|
353
|
+
replyToMessage: Ref<ChatMessageItem | null>;
|
|
354
|
+
editingMessage: Ref<ChatMessageItem | null>;
|
|
355
|
+
init: () => Promise<void>;
|
|
356
|
+
connectRealtime: () => Promise<void>;
|
|
357
|
+
disconnectRealtime: () => Promise<void>;
|
|
358
|
+
login: (accessToken: string) => Promise<void>;
|
|
359
|
+
logout: () => Promise<void>;
|
|
360
|
+
fetchConversations: () => Promise<void>;
|
|
361
|
+
selectConversation: (conversationId: string | null) => Promise<void>;
|
|
362
|
+
sendTextMessage: (text: string, options?: MessageSendOptions) => Promise<void>;
|
|
363
|
+
sendAttachmentMessage: (input: AttachmentUploadInput, options?: MessageSendOptions) => Promise<void>;
|
|
364
|
+
sendPollMessage: (input: PollComposerInput, options?: MessageSendOptions) => Promise<void>;
|
|
365
|
+
forwardMessage: (message: ChatMessageItem, target: ForwardMessageTarget) => Promise<void>;
|
|
366
|
+
fetchScheduledMessages: (originalChatUid?: string) => Promise<void>;
|
|
367
|
+
loadOlderMessages: () => Promise<boolean>;
|
|
368
|
+
loadOlderThreadMessages: () => Promise<boolean>;
|
|
369
|
+
ensureMessageLoaded: (messageId: string) => Promise<boolean>;
|
|
370
|
+
scheduleMessage: (input: ScheduleMessageInput, options?: MessageSendOptions) => Promise<void>;
|
|
371
|
+
rescheduleMessage: (input: RescheduleMessageInput) => Promise<void>;
|
|
372
|
+
removeScheduledMessage: (message: ChatMessageItem) => Promise<void>;
|
|
373
|
+
editScheduledMessage: (message: ChatMessageItem, nextText: string) => Promise<void>;
|
|
374
|
+
setReplyToMessage: (message: ChatMessageItem | null) => void;
|
|
375
|
+
setEditingMessage: (message: ChatMessageItem | null) => void;
|
|
376
|
+
openThread: (message: ChatMessageItem) => Promise<void>;
|
|
377
|
+
closeThread: () => void;
|
|
378
|
+
refreshVisibleMessages: (options?: {
|
|
379
|
+
includeThread?: boolean;
|
|
380
|
+
}) => Promise<void>;
|
|
381
|
+
fetchMessageReceipts: (message: ChatMessageItem) => Promise<ChatMessageReceiptItem[]>;
|
|
382
|
+
fetchMessageReactions: (message: ChatMessageItem) => Promise<ChatReactionDetailItem[]>;
|
|
383
|
+
deleteMessage: (message: ChatMessageItem) => Promise<void>;
|
|
384
|
+
votePoll: (message: ChatMessageItem, optionId: string) => Promise<void>;
|
|
385
|
+
toggleReaction: (message: ChatMessageItem, emoji: string) => Promise<void>;
|
|
386
|
+
fetchPinnedMessages: (conversationId?: string) => Promise<void>;
|
|
387
|
+
pinMessage: (message: ChatMessageItem) => Promise<void>;
|
|
388
|
+
unpinMessage: (messageId: string) => Promise<void>;
|
|
389
|
+
togglePinnedMessage: (message: ChatMessageItem) => Promise<void>;
|
|
390
|
+
isMessagePinned: (messageId: string) => boolean;
|
|
391
|
+
translateMessage: (message: ChatMessageItem) => Promise<void>;
|
|
392
|
+
mentionDisplayNamesByUid: Ref<Record<string, string>>;
|
|
393
|
+
rememberMentionDisplayNames: (entries: ReadonlyArray<{
|
|
394
|
+
uid: string;
|
|
395
|
+
displayName: string;
|
|
396
|
+
}>) => void;
|
|
397
|
+
initiateCall: (receiverId: string, container: HTMLElement, callType?: "video" | "audio", receiverType?: "user" | "group") => Promise<InstanceType<typeof CometChat.Call>>;
|
|
398
|
+
acceptIncomingCall: (container: HTMLElement, sessionId?: string) => Promise<void>;
|
|
399
|
+
rejectIncomingCall: (sessionId?: string) => Promise<void>;
|
|
400
|
+
endActiveCall: () => Promise<void>;
|
|
401
|
+
joinOutgoingCallSession: (container: HTMLElement) => Promise<void>;
|
|
402
|
+
incomingCall: Ref<InstanceType<typeof CometChat.Call> | null>;
|
|
403
|
+
incomingCalls: Ref<Map<string, InstanceType<typeof CometChat.Call>>>;
|
|
404
|
+
outgoingCall: Ref<InstanceType<typeof CometChat.Call> | null>;
|
|
405
|
+
activeCallSessionId: Ref<string | null>;
|
|
406
|
+
activeCallType: Ref<"audio" | "video">;
|
|
407
|
+
callState: Ref<"idle" | "outgoing" | "incoming" | "connecting" | "in-call">;
|
|
408
|
+
}
|
|
409
|
+
export type { Environment };
|