@bcc-code/vue-bcc-chat-ui 7.0.1 → 7.0.2
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 +2 -0
- package/dist/FixtureApp.vue.d.ts +2 -0
- package/dist/auth.d.ts +2 -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/conversationState.d.ts +11 -0
- package/dist/chat/data.d.ts +15 -0
- package/dist/chat/environment.d.ts +8 -0
- package/dist/chat/i18n/en.d.ts +118 -0
- package/dist/chat/i18n/nb.d.ts +118 -0
- package/dist/chat/i18n/types.d.ts +2 -0
- package/dist/chat/index.d.ts +94 -0
- package/dist/chat/localization.d.ts +15 -0
- package/dist/chat/messageText.d.ts +13 -0
- package/dist/chat/mockClient.d.ts +13 -0
- package/dist/chat/offlineStore.d.ts +53 -0
- package/dist/chat/reactions.d.ts +8 -0
- package/dist/chat/richText.d.ts +5 -0
- package/dist/chat/theme.d.ts +18 -0
- package/dist/chat/types.d.ts +301 -0
- package/dist/components/chat/BccChat.vue.d.ts +509 -0
- package/dist/components/chat/ChatStatusOverlay.vue.d.ts +33 -0
- package/dist/components/chat/publicContract.d.ts +43 -0
- package/dist/components/conversations/ConversationList.vue.d.ts +15 -0
- package/dist/components/conversations/UserProfileCard.vue.d.ts +8 -0
- package/dist/components/messages/ActionMessageRow.vue.d.ts +5 -0
- package/dist/components/messages/ComposerActionsPopover.vue.d.ts +19 -0
- package/dist/components/messages/ComposerContextBanner.vue.d.ts +13 -0
- package/dist/components/messages/ComposerFormatMenu.vue.d.ts +13 -0
- package/dist/components/messages/ComposerPollDialog.vue.d.ts +16 -0
- package/dist/components/messages/ComposerScheduleDialog.vue.d.ts +20 -0
- package/dist/components/messages/ConversationComposer.vue.d.ts +106 -0
- package/dist/components/messages/LinkPreviewCard.vue.d.ts +6 -0
- package/dist/components/messages/LinkifiedText.vue.d.ts +8 -0
- package/dist/components/messages/MessageAttachmentList.vue.d.ts +10 -0
- package/dist/components/messages/MessageComposer.vue.d.ts +69 -0
- package/dist/components/messages/MessageDeliveryStatus.vue.d.ts +6 -0
- package/dist/components/messages/MessageItem.vue.d.ts +27 -0
- package/dist/components/messages/MessageItemHeader.vue.d.ts +6 -0
- package/dist/components/messages/MessageItemMenu.vue.d.ts +26 -0
- package/dist/components/messages/MessageItemMenuReactions.vue.d.ts +11 -0
- package/dist/components/messages/MessageItemReactions.vue.d.ts +14 -0
- package/dist/components/messages/MessageList.vue.d.ts +115 -0
- package/dist/components/messages/MessageListHeader.vue.d.ts +7 -0
- package/dist/components/messages/MessagePollContent.vue.d.ts +12 -0
- package/dist/components/messages/MessageReactionList.vue.d.ts +12 -0
- package/dist/components/messages/MessageReplyQuote.vue.d.ts +10 -0
- package/dist/components/messages/MessageTextContent.vue.d.ts +6 -0
- package/dist/components/overlays/FullscreenDialog.vue.d.ts +34 -0
- package/dist/components/overlays/MediaViewerDialog.vue.d.ts +13 -0
- package/dist/components/overlays/MessageInfoDialog.vue.d.ts +14 -0
- package/dist/components/overlays/ReceiptSection.vue.d.ts +9 -0
- package/dist/components/overlays/ScheduledMessagesDialog.vue.d.ts +25 -0
- package/dist/composables/chat/index.d.ts +13 -0
- package/dist/composables/chat/useComposerContext.d.ts +43 -0
- package/dist/composables/chat/useConversationContext.d.ts +30 -0
- package/dist/composables/chat/useDialogsContext.d.ts +27 -0
- package/dist/composables/chat/useMessagesContext.d.ts +36 -0
- package/dist/composables/useChatActions.d.ts +21 -0
- package/dist/composables/useChatEventBus.d.ts +91 -0
- package/dist/composables/useComposerDrafts.d.ts +44 -0
- package/dist/composables/useConversationComposer.d.ts +15 -0
- package/dist/composables/useGroupMemberTracking.d.ts +28 -0
- package/dist/composables/useImageZoom.d.ts +26 -0
- package/dist/composables/useMessageActionMenu.d.ts +202 -0
- package/dist/composables/useMessageInfoDialog.d.ts +165 -0
- package/dist/composables/useMessageListScroll.d.ts +30 -0
- package/dist/composables/useMessageNavigation.d.ts +18 -0
- package/dist/composables/useRichTextComposer.d.ts +31 -0
- package/dist/demo/ApiExamplesPanel.vue.d.ts +6 -0
- package/dist/demo/ChatShell.vue.d.ts +10 -0
- package/dist/demo/ThemeModeToggle.vue.d.ts +12 -0
- package/dist/demo/useDemoThemeMode.d.ts +6 -0
- package/dist/design.d.ts +10 -0
- package/dist/index.d.ts +11 -0
- package/dist/main.d.ts +0 -0
- package/dist/style.css +1 -0
- package/dist/vue-bcc-chat-ui.js +10564 -0
- package/dist/vue-bcc-chat-ui.js.map +1 -0
- package/package.json +1 -1
- package/dist/assets/index-B_y7vs2y.js +0 -12519
- package/dist/assets/index-uEhSMl7W.css +0 -1
- package/dist/assets/primeicons-C6QP2o4f.woff2 +0 -0
- package/dist/assets/primeicons-DMOk5skT.eot +0 -0
- package/dist/assets/primeicons-Dr5RGzOO.svg +0 -345
- package/dist/assets/primeicons-MpK4pl85.ttf +0 -0
- package/dist/assets/primeicons-WjwUDZjB.woff +0 -0
- package/dist/assets/web-Cp3vw--c.js +0 -1
- package/dist/assets/web-DSc1BjG7.js +0 -1
- package/dist/index.html +0 -13
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComputedRef, Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { AttachmentUploadInput, ChatClient, ChatMessageItem, MessageSendOptions, PollComposerInput, ScheduleMessageInput } from '../../chat/types';
|
|
3
|
+
/** Minimal public interface exposed by a composer component via defineExpose. */
|
|
4
|
+
export interface ComposerHandle {
|
|
5
|
+
focusEditor: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface ComposerContext {
|
|
8
|
+
readonly draft: Ref<string>;
|
|
9
|
+
readonly threadDraft: Ref<string>;
|
|
10
|
+
readonly composerResetSignal: Ref<number>;
|
|
11
|
+
readonly threadComposerResetSignal: Ref<number>;
|
|
12
|
+
readonly mainComposerRef: ShallowRef<ComposerHandle | null>;
|
|
13
|
+
readonly threadComposerRef: ShallowRef<ComposerHandle | null>;
|
|
14
|
+
readonly messageBeingRepliedTo: ComputedRef<ChatMessageItem | null>;
|
|
15
|
+
readonly messageBeingEdited: ComputedRef<ChatMessageItem | null>;
|
|
16
|
+
readonly offlineMode: ComputedRef<boolean>;
|
|
17
|
+
readonly pendingQueueCount: ComputedRef<number>;
|
|
18
|
+
readonly isSendingMessage: ComputedRef<boolean>;
|
|
19
|
+
readonly isSchedulingMessage: ComputedRef<boolean>;
|
|
20
|
+
resetMainComposer(): void;
|
|
21
|
+
resetThreadComposer(): void;
|
|
22
|
+
focusMainComposer(): void;
|
|
23
|
+
focusThreadComposer(): void;
|
|
24
|
+
shouldFocusThreadComposer(message: ChatMessageItem): boolean;
|
|
25
|
+
loadMainDraft(message: ChatMessageItem): void;
|
|
26
|
+
loadThreadDraft(message: ChatMessageItem): void;
|
|
27
|
+
sendMessage(): Promise<void>;
|
|
28
|
+
sendAttachment(input: AttachmentUploadInput): Promise<void>;
|
|
29
|
+
sendPoll(input: PollComposerInput): Promise<void>;
|
|
30
|
+
scheduleMessage(input: ScheduleMessageInput): Promise<void>;
|
|
31
|
+
sendThreadMessage(): Promise<void>;
|
|
32
|
+
sendThreadAttachment(input: AttachmentUploadInput): Promise<void>;
|
|
33
|
+
sendThreadPoll(input: PollComposerInput): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface CreateComposerContextOptions {
|
|
36
|
+
chatClient: ComputedRef<ChatClient | null>;
|
|
37
|
+
sendOptions: ComputedRef<MessageSendOptions | undefined>;
|
|
38
|
+
/** Called after a message has been scheduled. */
|
|
39
|
+
afterSchedule: () => Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export declare function createComposerContext(options: CreateComposerContextOptions): ComposerContext;
|
|
42
|
+
export declare function provideComposerContext(ctx: ComposerContext): void;
|
|
43
|
+
export declare function useComposerContext(): ComposerContext;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { ChatClient, ChatConversationItem, MessageSendOptions } from '../../chat/types';
|
|
3
|
+
export interface ConversationContext {
|
|
4
|
+
/** The resolved ChatClient (from BccChat prop or global singleton). */
|
|
5
|
+
readonly client: ComputedRef<ChatClient | null>;
|
|
6
|
+
/** The currently active conversation. */
|
|
7
|
+
readonly conversation: ComputedRef<ChatConversationItem | null>;
|
|
8
|
+
/** UID of the authenticated user. */
|
|
9
|
+
readonly currentUserId: ComputedRef<string | undefined>;
|
|
10
|
+
readonly canUseMessageActions: ComputedRef<boolean>;
|
|
11
|
+
readonly canReact: ComputedRef<boolean>;
|
|
12
|
+
readonly canReply: ComputedRef<boolean>;
|
|
13
|
+
readonly canOpenThread: ComputedRef<boolean>;
|
|
14
|
+
readonly isReadOnly: ComputedRef<boolean>;
|
|
15
|
+
readonly isChannel: ComputedRef<boolean>;
|
|
16
|
+
readonly sendOptions: ComputedRef<MessageSendOptions | undefined>;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateConversationContextOptions {
|
|
19
|
+
chatClient: ComputedRef<ChatClient | null>;
|
|
20
|
+
selectedConversation: ComputedRef<ChatConversationItem | null>;
|
|
21
|
+
/** Returns prop-supplied read-only flag, or undefined to auto-detect. */
|
|
22
|
+
getPropIsReadOnly: () => boolean | undefined;
|
|
23
|
+
/** Returns prop-supplied send options, or undefined to auto-detect. */
|
|
24
|
+
getPropSendOptions: () => MessageSendOptions | undefined;
|
|
25
|
+
/** Display name override for the sender. */
|
|
26
|
+
getSenderDisplayName: () => string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare function createConversationContext(options: CreateConversationContextOptions): ConversationContext;
|
|
29
|
+
export declare function provideConversationContext(ctx: ConversationContext): void;
|
|
30
|
+
export declare function useConversationContext(): ConversationContext;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { ChatClient, ChatConversationItem, ChatMessageItem, ChatMessageReceiptItem } from '../../chat/types';
|
|
3
|
+
export interface DialogsContext {
|
|
4
|
+
readonly infoMessage: Ref<ChatMessageItem | null>;
|
|
5
|
+
readonly infoMessageReceipts: Ref<ChatMessageReceiptItem[]>;
|
|
6
|
+
readonly loadingMessageReceipts: Ref<boolean>;
|
|
7
|
+
readonly messageReceiptsError: Ref<string | null>;
|
|
8
|
+
openMessageInfo(message: ChatMessageItem): Promise<void>;
|
|
9
|
+
closeMessageInfo(): void;
|
|
10
|
+
readonly hasScheduledMessages: ComputedRef<boolean>;
|
|
11
|
+
readonly showScheduledMessages: Ref<boolean>;
|
|
12
|
+
readonly loadingScheduledMessages: ComputedRef<boolean>;
|
|
13
|
+
readonly scheduledMessages: ComputedRef<ChatMessageItem[]>;
|
|
14
|
+
openScheduledMessages(): Promise<void>;
|
|
15
|
+
refreshScheduledMessages(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface CreateDialogsContextOptions {
|
|
18
|
+
chatClient: ComputedRef<ChatClient | null>;
|
|
19
|
+
selectedConversation: ComputedRef<ChatConversationItem | null>;
|
|
20
|
+
/** Whether the initial scheduled-messages dialog should be open. */
|
|
21
|
+
getInitialScheduledMessagesOpen: () => boolean;
|
|
22
|
+
/** Fallback error string shown when receipt fetch fails. */
|
|
23
|
+
fetchErrorFallback: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function createDialogsContext(options: CreateDialogsContextOptions): DialogsContext;
|
|
26
|
+
export declare function provideDialogsContext(ctx: DialogsContext): void;
|
|
27
|
+
export declare function useDialogsContext(): DialogsContext;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { ChatClient, ChatConversationItem, ChatMessageItem } from '../../chat/types';
|
|
3
|
+
export interface MessagesContext {
|
|
4
|
+
readonly messages: ComputedRef<ChatMessageItem[]>;
|
|
5
|
+
readonly loadingMessages: ComputedRef<boolean>;
|
|
6
|
+
readonly hasOlderMessages: ComputedRef<boolean>;
|
|
7
|
+
readonly loadingOlderMessages: ComputedRef<boolean>;
|
|
8
|
+
readonly threadMessages: ComputedRef<ChatMessageItem[]>;
|
|
9
|
+
readonly loadingThreadMessages: ComputedRef<boolean>;
|
|
10
|
+
readonly activeThreadParentMessage: ComputedRef<ChatMessageItem | null>;
|
|
11
|
+
readonly hasOlderThreadMessages: ComputedRef<boolean>;
|
|
12
|
+
readonly loadingOlderThreadMessages: ComputedRef<boolean>;
|
|
13
|
+
readonly showDefaultEmptyState: ComputedRef<boolean>;
|
|
14
|
+
readonly isChatEmpty: ComputedRef<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateMessagesContextOptions {
|
|
17
|
+
chatClient: ComputedRef<ChatClient | null>;
|
|
18
|
+
selectedConversation: ComputedRef<ChatConversationItem | null>;
|
|
19
|
+
usesPublicContract: ComputedRef<boolean>;
|
|
20
|
+
loadingChat: Ref<boolean>;
|
|
21
|
+
/** Returns prop-supplied messages, or undefined to fall back to client. */
|
|
22
|
+
getPropMessages: () => ChatMessageItem[] | undefined;
|
|
23
|
+
/** Returns prop-supplied thread messages, or undefined to fall back. */
|
|
24
|
+
getPropThreadMessages: () => ChatMessageItem[] | undefined;
|
|
25
|
+
/** Returns prop-supplied loading flag, or undefined to fall back. */
|
|
26
|
+
getPropLoadingMessages: () => boolean | undefined;
|
|
27
|
+
/** Returns prop-supplied thread loading flag, or undefined to fall back. */
|
|
28
|
+
getPropLoadingThreadMessages: () => boolean | undefined;
|
|
29
|
+
/** Returns prop-supplied empty-state flag, or undefined for auto. */
|
|
30
|
+
getPropShowDefaultEmptyState: () => boolean | undefined;
|
|
31
|
+
/** Whether to filter out deleted messages. */
|
|
32
|
+
getHideDeletedMessages: () => boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare function createMessagesContext(options: CreateMessagesContextOptions): MessagesContext;
|
|
35
|
+
export declare function provideMessagesContext(ctx: MessagesContext): void;
|
|
36
|
+
export declare function useMessagesContext(): MessagesContext;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ConversationContext } from './chat/useConversationContext';
|
|
2
|
+
import { ComposerContext } from './chat/useComposerContext';
|
|
3
|
+
import { DialogsContext } from './chat/useDialogsContext';
|
|
4
|
+
import { ChatEventBus } from './useChatEventBus';
|
|
5
|
+
export interface UseChatActionsOptions {
|
|
6
|
+
/** Conversation identity and permissions. */
|
|
7
|
+
conversation: ConversationContext;
|
|
8
|
+
/** Composer draft/send state. */
|
|
9
|
+
composer: ComposerContext;
|
|
10
|
+
/** Dialog overlay state. */
|
|
11
|
+
dialogs: DialogsContext;
|
|
12
|
+
/** The event bus to subscribe to. */
|
|
13
|
+
bus: ChatEventBus;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Subscribes to all bus events and wires them to the appropriate business
|
|
17
|
+
* logic. Returns a teardown function (also registered via `onUnmounted`).
|
|
18
|
+
*/
|
|
19
|
+
export declare function useChatActions({ conversation, composer, dialogs, bus, }: UseChatActionsOptions): {
|
|
20
|
+
teardown: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ChatMessageItem, AttachmentUploadInput, PollComposerInput, ScheduleMessageInput } from '../chat/types';
|
|
2
|
+
/** Target identifier used to distinguish main-conversation from thread actions. */
|
|
3
|
+
export type ChatTarget = "main" | "thread";
|
|
4
|
+
/** All events that can flow through the chat event bus. */
|
|
5
|
+
export interface ChatBusEventMap {
|
|
6
|
+
/** User wants to reply to a message. */
|
|
7
|
+
"message:reply": ChatMessageItem;
|
|
8
|
+
/** User wants to edit a message. */
|
|
9
|
+
"message:edit": ChatMessageItem;
|
|
10
|
+
/** User wants to delete a message. */
|
|
11
|
+
"message:delete": ChatMessageItem;
|
|
12
|
+
/** User wants to view message delivery info. */
|
|
13
|
+
"message:info": ChatMessageItem;
|
|
14
|
+
/** User wants to open a thread for a message. */
|
|
15
|
+
"message:openThread": ChatMessageItem;
|
|
16
|
+
/** User wants to toggle a reaction on a message. */
|
|
17
|
+
"message:toggleReaction": {
|
|
18
|
+
message: ChatMessageItem;
|
|
19
|
+
emoji: string;
|
|
20
|
+
};
|
|
21
|
+
/** User wants to translate a message. */
|
|
22
|
+
"message:translate": ChatMessageItem;
|
|
23
|
+
/** User wants to vote on a poll option. */
|
|
24
|
+
"message:votePoll": {
|
|
25
|
+
message: ChatMessageItem;
|
|
26
|
+
optionId: string;
|
|
27
|
+
};
|
|
28
|
+
/** User wants to navigate to a referenced message. */
|
|
29
|
+
"message:openReference": string;
|
|
30
|
+
/** User pressed send (text or attachment). */
|
|
31
|
+
"composer:send": {
|
|
32
|
+
target: ChatTarget;
|
|
33
|
+
};
|
|
34
|
+
/** User attached a file and pressed send. */
|
|
35
|
+
"composer:sendAttachment": {
|
|
36
|
+
target: ChatTarget;
|
|
37
|
+
input: AttachmentUploadInput;
|
|
38
|
+
};
|
|
39
|
+
/** User composed and submitted a poll. */
|
|
40
|
+
"composer:sendPoll": {
|
|
41
|
+
target: ChatTarget;
|
|
42
|
+
input: PollComposerInput;
|
|
43
|
+
};
|
|
44
|
+
/** User scheduled a message. */
|
|
45
|
+
"composer:schedule": {
|
|
46
|
+
target: ChatTarget;
|
|
47
|
+
input: ScheduleMessageInput;
|
|
48
|
+
};
|
|
49
|
+
/** User cancelled a reply. */
|
|
50
|
+
"composer:cancelReply": undefined;
|
|
51
|
+
/** User cancelled an edit. */
|
|
52
|
+
"composer:cancelEdit": undefined;
|
|
53
|
+
/** User requested older messages. */
|
|
54
|
+
"list:loadOlder": {
|
|
55
|
+
target: ChatTarget;
|
|
56
|
+
};
|
|
57
|
+
/** Open the scheduled-messages dialog. */
|
|
58
|
+
"ui:openScheduled": undefined;
|
|
59
|
+
/** Close the thread dialog. */
|
|
60
|
+
"ui:closeThread": undefined;
|
|
61
|
+
/** Reschedule a scheduled message. */
|
|
62
|
+
"ui:reschedule": {
|
|
63
|
+
messageId: number;
|
|
64
|
+
muid: string;
|
|
65
|
+
originalChatUid: string;
|
|
66
|
+
scheduleDate: string;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Handler type that correctly handles both void and payload events. */
|
|
70
|
+
type EventHandler<T> = T extends undefined ? () => void : (payload: T) => void;
|
|
71
|
+
/** A typed event bus instance. */
|
|
72
|
+
export interface ChatEventBus {
|
|
73
|
+
/** Emit an event with an optional payload. */
|
|
74
|
+
emit<K extends keyof ChatBusEventMap>(event: K, ...args: ChatBusEventMap[K] extends undefined ? [] : [ChatBusEventMap[K]]): void;
|
|
75
|
+
/** Subscribe to an event. Returns an unsubscribe function. */
|
|
76
|
+
on<K extends keyof ChatBusEventMap>(event: K, handler: EventHandler<ChatBusEventMap[K]>): () => void;
|
|
77
|
+
/** Unsubscribe from an event. */
|
|
78
|
+
off<K extends keyof ChatBusEventMap>(event: K, handler: EventHandler<ChatBusEventMap[K]>): void;
|
|
79
|
+
}
|
|
80
|
+
/** Creates a new ChatEventBus instance. Called once by BccChat. */
|
|
81
|
+
export declare function createChatEventBus(): ChatEventBus;
|
|
82
|
+
/** Provides the event bus to descendant components. */
|
|
83
|
+
export declare function provideChatEventBus(bus: ChatEventBus): void;
|
|
84
|
+
/** Injects the event bus from an ancestor BccChat component. */
|
|
85
|
+
export declare function useChatBus(): ChatEventBus;
|
|
86
|
+
/**
|
|
87
|
+
* Convenience helper: subscribes to a bus event and auto-unsubscribes when the
|
|
88
|
+
* calling component is unmounted.
|
|
89
|
+
*/
|
|
90
|
+
export declare function useBusListener<K extends keyof ChatBusEventMap>(bus: ChatEventBus, event: K, handler: EventHandler<ChatBusEventMap[K]>): void;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AttachmentUploadInput, ChatClient, ChatMessageItem, MessageSendOptions, PollComposerInput, ScheduleMessageInput } from '../chat/types';
|
|
2
|
+
/** Minimal public interface exposed by MessageComposer via `defineExpose`. */
|
|
3
|
+
interface ComposerHandle {
|
|
4
|
+
focusEditor: () => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export interface UseComposerDraftsOptions {
|
|
7
|
+
/** Returns the active chat client, or null when unavailable. */
|
|
8
|
+
getClient: () => ChatClient | null;
|
|
9
|
+
/** Returns the resolved send options for the current conversation. */
|
|
10
|
+
getSendOptions: () => MessageSendOptions | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Called after a message has been scheduled so the parent can refresh the
|
|
13
|
+
* scheduled-messages overlay.
|
|
14
|
+
*/
|
|
15
|
+
afterSchedule: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Composable that owns all state for the main + thread dual-composer drafts, including
|
|
19
|
+
* draft text, reset signals, focus helpers, and delegated send actions.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useComposerDrafts(options: UseComposerDraftsOptions): {
|
|
22
|
+
draft: import('vue').Ref<string, string>;
|
|
23
|
+
threadDraft: import('vue').Ref<string, string>;
|
|
24
|
+
composerResetSignal: import('vue').Ref<number, number>;
|
|
25
|
+
threadComposerResetSignal: import('vue').Ref<number, number>;
|
|
26
|
+
mainComposerRef: import('vue').ShallowRef<ComposerHandle | null, ComposerHandle | null>;
|
|
27
|
+
threadComposerRef: import('vue').ShallowRef<ComposerHandle | null, ComposerHandle | null>;
|
|
28
|
+
resetMainComposer: () => void;
|
|
29
|
+
resetThreadComposer: () => void;
|
|
30
|
+
focusMainComposer: () => void;
|
|
31
|
+
focusThreadComposer: () => void;
|
|
32
|
+
shouldFocusThreadComposer: (message: ChatMessageItem) => boolean;
|
|
33
|
+
getEditableMessageText: (message: ChatMessageItem) => string;
|
|
34
|
+
loadMainDraft: (message: ChatMessageItem) => void;
|
|
35
|
+
loadThreadDraft: (message: ChatMessageItem) => void;
|
|
36
|
+
sendMessage: () => Promise<void>;
|
|
37
|
+
sendAttachment: (input: AttachmentUploadInput) => Promise<void>;
|
|
38
|
+
sendPoll: (input: PollComposerInput) => Promise<void>;
|
|
39
|
+
scheduleMessage: (input: ScheduleMessageInput) => Promise<void>;
|
|
40
|
+
sendThreadMessage: () => Promise<void>;
|
|
41
|
+
sendThreadAttachment: (input: AttachmentUploadInput) => Promise<void>;
|
|
42
|
+
sendThreadPoll: (input: PollComposerInput) => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AttachmentUploadInput, ChatClient, ChatMessageItem, MessageSendOptions, PollComposerInput, ScheduleMessageInput } from '../chat/types';
|
|
2
|
+
export declare function useConversationComposer(options: {
|
|
3
|
+
client: ChatClient;
|
|
4
|
+
getSendOptions: () => MessageSendOptions | undefined;
|
|
5
|
+
afterSchedule?: () => Promise<void> | void;
|
|
6
|
+
}): {
|
|
7
|
+
draft: import('vue').Ref<string, string>;
|
|
8
|
+
loadMessageDraft: (message: ChatMessageItem) => void;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
resetSignal: import('vue').Ref<number, number>;
|
|
11
|
+
scheduleMessage: (input: ScheduleMessageInput) => Promise<void>;
|
|
12
|
+
sendAttachment: (input: AttachmentUploadInput) => Promise<void>;
|
|
13
|
+
sendPoll: (input: PollComposerInput) => Promise<void>;
|
|
14
|
+
sendText: () => Promise<void>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ParticipantInfo } from '../chat/types';
|
|
2
|
+
export interface UseGroupMemberTrackingOptions {
|
|
3
|
+
/** Returns the CometChat GUID of the currently active conversation, or undefined when none is selected. */
|
|
4
|
+
getConversationTargetId: () => string | undefined;
|
|
5
|
+
/** Returns true when the active conversation is a broadcast channel (members are not tracked). */
|
|
6
|
+
isChannel: () => boolean;
|
|
7
|
+
/** Called whenever the member list changes with the new complete list. */
|
|
8
|
+
onMembersChanged: (members: ParticipantInfo[]) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Composable that keeps a live `groupMembers` ref in sync with CometChat
|
|
12
|
+
* membership events and exposes a manual `fetchGroupMembers` loader for the
|
|
13
|
+
* initial page-load.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useGroupMemberTracking(options: UseGroupMemberTrackingOptions): {
|
|
16
|
+
groupMembers: import('vue').Ref<{
|
|
17
|
+
uid: string;
|
|
18
|
+
displayName: string;
|
|
19
|
+
avatar: string;
|
|
20
|
+
role: string;
|
|
21
|
+
}[], ParticipantInfo[] | {
|
|
22
|
+
uid: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
avatar: string;
|
|
25
|
+
role: string;
|
|
26
|
+
}[]>;
|
|
27
|
+
fetchGroupMembers: (groupUid: string) => Promise<void>;
|
|
28
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export interface UseImageZoomOptions {
|
|
3
|
+
/** Ref to the scrollable viewport wrapper element. */
|
|
4
|
+
viewportRef: Ref<HTMLElement | null>;
|
|
5
|
+
/** Ref to the `<img>` element whose natural dimensions guide clamping. */
|
|
6
|
+
imageRef: Ref<HTMLImageElement | null>;
|
|
7
|
+
/** Returns true when the current attachment is an image (non-image = zoom disabled). */
|
|
8
|
+
isImage: () => boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Composable that owns scale, translateX, and translateY state and exposes
|
|
12
|
+
* all pointer event handlers required by the media-viewer image stage.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useImageZoom(options: UseImageZoomOptions): {
|
|
15
|
+
scale: Ref<number, number>;
|
|
16
|
+
translateX: Ref<number, number>;
|
|
17
|
+
translateY: Ref<number, number>;
|
|
18
|
+
isDragging: Ref<boolean, boolean>;
|
|
19
|
+
resetTransform: () => void;
|
|
20
|
+
handlePointerDown: (event: PointerEvent) => void;
|
|
21
|
+
handlePointerMove: (event: PointerEvent) => void;
|
|
22
|
+
handlePointerUp: (event: PointerEvent) => void;
|
|
23
|
+
handlePointerCancel: (event: PointerEvent) => void;
|
|
24
|
+
handleWheel: (event: WheelEvent) => void;
|
|
25
|
+
handleDoubleClick: () => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { ChatMessageItem } from '../chat/types';
|
|
2
|
+
import { TranslationKey } from '../chat/localization';
|
|
3
|
+
import { TranslationParams } from '../chat/i18n/types';
|
|
4
|
+
/** Minimal public interface of the custom MessageItemMenu component. */
|
|
5
|
+
interface ActionMenuHandle {
|
|
6
|
+
show: (event: Event) => void;
|
|
7
|
+
hide: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UseMessageActionMenuOptions {
|
|
10
|
+
/** Returns true when message actions are enabled for this view. */
|
|
11
|
+
canUseMessageActions: () => boolean;
|
|
12
|
+
/** Returns true when reactions are allowed. */
|
|
13
|
+
canReact: () => boolean;
|
|
14
|
+
/** Returns true when replying is allowed. */
|
|
15
|
+
canReply: () => boolean;
|
|
16
|
+
/** Returns true when opening a thread is allowed. */
|
|
17
|
+
canOpenThread: () => boolean;
|
|
18
|
+
/** Returns true when the list is rendering a thread view (disables thread action). */
|
|
19
|
+
isInThread: () => boolean;
|
|
20
|
+
/** Translation helper forwarded from the parent component. */
|
|
21
|
+
t: (key: TranslationKey, params?: TranslationParams) => string;
|
|
22
|
+
/** Called to signal a disable-auto-scroll intent (prevents jarring jumps). */
|
|
23
|
+
disableAutoScroll: () => void;
|
|
24
|
+
emit: {
|
|
25
|
+
reply: (message: ChatMessageItem) => void;
|
|
26
|
+
edit: (message: ChatMessageItem) => void;
|
|
27
|
+
info: (message: ChatMessageItem) => void;
|
|
28
|
+
openThread: (message: ChatMessageItem) => void;
|
|
29
|
+
delete: (message: ChatMessageItem) => void;
|
|
30
|
+
translate: (message: ChatMessageItem) => void;
|
|
31
|
+
toggleReaction: (message: ChatMessageItem, emoji: string) => void;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Composable that owns all state for the per-message action popover, reaction
|
|
36
|
+
* expansion, inline reaction toggles, and message copying.
|
|
37
|
+
*/
|
|
38
|
+
export declare function useMessageActionMenu(options: UseMessageActionMenuOptions): {
|
|
39
|
+
actionMenuRef: import('vue').Ref<{
|
|
40
|
+
show: (event: Event) => void;
|
|
41
|
+
hide: () => void;
|
|
42
|
+
} | null, ActionMenuHandle | {
|
|
43
|
+
show: (event: Event) => void;
|
|
44
|
+
hide: () => void;
|
|
45
|
+
} | null>;
|
|
46
|
+
actionMenuAnchorRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
47
|
+
activeActionMessage: import('vue').Ref<{
|
|
48
|
+
id: string;
|
|
49
|
+
muid?: string | undefined;
|
|
50
|
+
conversationId: string;
|
|
51
|
+
senderId: string;
|
|
52
|
+
senderName: string;
|
|
53
|
+
text: string;
|
|
54
|
+
kind: import('..').ChatMessageKind;
|
|
55
|
+
sentAt: Date;
|
|
56
|
+
category: string;
|
|
57
|
+
type: string;
|
|
58
|
+
senderAvatar?: string | undefined;
|
|
59
|
+
isOwn: boolean;
|
|
60
|
+
isDeleted: boolean;
|
|
61
|
+
isEdited: boolean;
|
|
62
|
+
attachments: {
|
|
63
|
+
kind: Extract<import('..').ChatMessageKind, "image" | "video" | "audio" | "file">;
|
|
64
|
+
name: string;
|
|
65
|
+
url?: string | undefined;
|
|
66
|
+
mimeType?: string | undefined;
|
|
67
|
+
extension?: string | undefined;
|
|
68
|
+
size?: number | undefined;
|
|
69
|
+
}[];
|
|
70
|
+
poll?: {
|
|
71
|
+
id?: string | undefined;
|
|
72
|
+
question: string;
|
|
73
|
+
options: {
|
|
74
|
+
id: string;
|
|
75
|
+
text: string;
|
|
76
|
+
voteCount: number;
|
|
77
|
+
voters: string[];
|
|
78
|
+
}[];
|
|
79
|
+
totalVotes: number;
|
|
80
|
+
allowsMultipleAnswers: boolean;
|
|
81
|
+
} | undefined;
|
|
82
|
+
scheduled?: {
|
|
83
|
+
scheduleDate?: Date | undefined;
|
|
84
|
+
originalChatUid?: string | undefined;
|
|
85
|
+
muid?: string | undefined;
|
|
86
|
+
messageId?: number | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
translatedText?: string | undefined;
|
|
89
|
+
replyTo?: {
|
|
90
|
+
messageId: string;
|
|
91
|
+
senderName: string;
|
|
92
|
+
text: string;
|
|
93
|
+
kind: import('..').ChatMessageKind;
|
|
94
|
+
} | undefined;
|
|
95
|
+
parentMessageId?: string | undefined;
|
|
96
|
+
replyCount: number;
|
|
97
|
+
reactions: {
|
|
98
|
+
emoji: string;
|
|
99
|
+
count: number;
|
|
100
|
+
reactedByMe: boolean;
|
|
101
|
+
}[];
|
|
102
|
+
receipts: {
|
|
103
|
+
deliveredAt?: Date | undefined;
|
|
104
|
+
deliveredToMeAt?: Date | undefined;
|
|
105
|
+
readAt?: Date | undefined;
|
|
106
|
+
readByMeAt?: Date | undefined;
|
|
107
|
+
};
|
|
108
|
+
deliveryState: import('..').ChatDeliveryState;
|
|
109
|
+
metadata?: Record<string, unknown> | undefined;
|
|
110
|
+
source: any;
|
|
111
|
+
} | null, ChatMessageItem | {
|
|
112
|
+
id: string;
|
|
113
|
+
muid?: string | undefined;
|
|
114
|
+
conversationId: string;
|
|
115
|
+
senderId: string;
|
|
116
|
+
senderName: string;
|
|
117
|
+
text: string;
|
|
118
|
+
kind: import('..').ChatMessageKind;
|
|
119
|
+
sentAt: Date;
|
|
120
|
+
category: string;
|
|
121
|
+
type: string;
|
|
122
|
+
senderAvatar?: string | undefined;
|
|
123
|
+
isOwn: boolean;
|
|
124
|
+
isDeleted: boolean;
|
|
125
|
+
isEdited: boolean;
|
|
126
|
+
attachments: {
|
|
127
|
+
kind: Extract<import('..').ChatMessageKind, "image" | "video" | "audio" | "file">;
|
|
128
|
+
name: string;
|
|
129
|
+
url?: string | undefined;
|
|
130
|
+
mimeType?: string | undefined;
|
|
131
|
+
extension?: string | undefined;
|
|
132
|
+
size?: number | undefined;
|
|
133
|
+
}[];
|
|
134
|
+
poll?: {
|
|
135
|
+
id?: string | undefined;
|
|
136
|
+
question: string;
|
|
137
|
+
options: {
|
|
138
|
+
id: string;
|
|
139
|
+
text: string;
|
|
140
|
+
voteCount: number;
|
|
141
|
+
voters: string[];
|
|
142
|
+
}[];
|
|
143
|
+
totalVotes: number;
|
|
144
|
+
allowsMultipleAnswers: boolean;
|
|
145
|
+
} | undefined;
|
|
146
|
+
scheduled?: {
|
|
147
|
+
scheduleDate?: Date | undefined;
|
|
148
|
+
originalChatUid?: string | undefined;
|
|
149
|
+
muid?: string | undefined;
|
|
150
|
+
messageId?: number | undefined;
|
|
151
|
+
} | undefined;
|
|
152
|
+
translatedText?: string | undefined;
|
|
153
|
+
replyTo?: {
|
|
154
|
+
messageId: string;
|
|
155
|
+
senderName: string;
|
|
156
|
+
text: string;
|
|
157
|
+
kind: import('..').ChatMessageKind;
|
|
158
|
+
} | undefined;
|
|
159
|
+
parentMessageId?: string | undefined;
|
|
160
|
+
replyCount: number;
|
|
161
|
+
reactions: {
|
|
162
|
+
emoji: string;
|
|
163
|
+
count: number;
|
|
164
|
+
reactedByMe: boolean;
|
|
165
|
+
}[];
|
|
166
|
+
receipts: {
|
|
167
|
+
deliveredAt?: Date | undefined;
|
|
168
|
+
deliveredToMeAt?: Date | undefined;
|
|
169
|
+
readAt?: Date | undefined;
|
|
170
|
+
readByMeAt?: Date | undefined;
|
|
171
|
+
};
|
|
172
|
+
deliveryState: import('..').ChatDeliveryState;
|
|
173
|
+
metadata?: Record<string, unknown> | undefined;
|
|
174
|
+
source: any;
|
|
175
|
+
} | null>;
|
|
176
|
+
copiedMessageId: import('vue').Ref<string | null, string | null>;
|
|
177
|
+
actionMenuPointer: import('vue').Ref<{
|
|
178
|
+
x: number;
|
|
179
|
+
y: number;
|
|
180
|
+
}, {
|
|
181
|
+
x: number;
|
|
182
|
+
y: number;
|
|
183
|
+
} | {
|
|
184
|
+
x: number;
|
|
185
|
+
y: number;
|
|
186
|
+
}>;
|
|
187
|
+
supportsDesktopContextMenu: boolean;
|
|
188
|
+
handleMessageContextMenu: (message: ChatMessageItem, event: MouseEvent) => void;
|
|
189
|
+
handleMessageTap: (message: ChatMessageItem, event: MouseEvent) => void;
|
|
190
|
+
closeActionMenu: () => void;
|
|
191
|
+
resetActionMenuState: () => void;
|
|
192
|
+
reactToMessage: (message: ChatMessageItem, emoji: string) => void;
|
|
193
|
+
toggleInlineReaction: (message: ChatMessageItem, emoji: string) => void;
|
|
194
|
+
getActionItems: (message: ChatMessageItem) => {
|
|
195
|
+
key: string;
|
|
196
|
+
label: string;
|
|
197
|
+
icon: string;
|
|
198
|
+
visible: boolean;
|
|
199
|
+
action: () => void;
|
|
200
|
+
}[];
|
|
201
|
+
};
|
|
202
|
+
export {};
|