@medipha/chat 1.0.26 → 1.0.28
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/features/composer/attachment-file-helpers.d.ts +6 -0
- package/dist/features/composer/conversation-composer.d.ts +3 -10
- package/dist/features/composer/editor/mention-suggestion-list.d.ts +2 -1
- package/dist/features/composer/editor/paste-mentions.d.ts +1 -0
- package/dist/features/composer/reply/use-reply-target.d.ts +6 -2
- package/dist/features/message-list/bubble/message-actions/message-actions-menu.d.ts +2 -3
- package/dist/features/message-list/bubble/message-bubble.d.ts +3 -2
- package/dist/features/message-list/overlays/message-detail/message-detail-dialog.d.ts +4 -0
- package/dist/index.cjs +46 -46
- package/dist/index.js +54515 -54299
- package/dist/pages/Setting/hooks/use-conversation-settings.d.ts +0 -1
- package/dist/pages/Setting/members/settings-modal.d.ts +1 -4
- package/dist/shared/components/chat-dialog.d.ts +15 -0
- package/dist/shared/components/load-more-sentinel.d.ts +1 -1
- package/dist/shared/components/loading-state.d.ts +13 -0
- package/dist/shared/components/work-status-badge.d.ts +9 -0
- package/dist/shared/hooks/use-auto-focus-first-field.d.ts +11 -0
- package/dist/store/draftStore.d.ts +5 -4
- package/dist/styles.css +1 -1
- package/dist/utils/chat-display.d.ts +7 -1
- package/dist/utils/chat.d.ts +4 -2
- package/package.json +2 -2
|
@@ -3,6 +3,12 @@ export declare const ACCEPT_ATTRIBUTE = ".jpg,.jpeg,.png,.webp,.gif,.pdf,.doc,.d
|
|
|
3
3
|
export declare const ACCEPTED_FILE_EXTENSIONS: Set<string>;
|
|
4
4
|
export declare const getFileExtension: (file: File) => string;
|
|
5
5
|
export declare const isImageFile: (file: File) => boolean;
|
|
6
|
+
/** A clipboard image is not a file on disk, so the browser invents its name — usually
|
|
7
|
+
* "image.png", but it can arrive without a usable extension, which both the staging
|
|
8
|
+
* filter and the backend reject (they key off the extension, never the mimetype). Rebuild
|
|
9
|
+
* those under a real extension derived from the mimetype; anything already named like an
|
|
10
|
+
* image, and anything not an image at all, is returned untouched. */
|
|
11
|
+
export declare const withImageFileExtension: (file: File) => File;
|
|
6
12
|
/** Splits staged files into same-kind runs (images vs. documents) so each becomes one grouped message. */
|
|
7
13
|
export declare const groupAttachmentsByKind: (attachments: PendingAttachment[]) => PendingAttachment[][];
|
|
8
14
|
/** Keeps only files with a supported extension; `hasRejectedFiles` tells the caller
|
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
import { ChatUser, MessageContent } from '../../utils/chat';
|
|
2
2
|
interface ConversationComposerProps {
|
|
3
|
-
/** Keys the saved draft. Omit (or pass undefined) to disable draft persistence. */
|
|
4
3
|
draftKey?: string;
|
|
5
4
|
conversationName: string;
|
|
6
5
|
members: ChatUser[];
|
|
7
6
|
canMentionAll: boolean;
|
|
8
|
-
/** Enables @mentions; turned off for 1-1 chats where there's nobody to tag. */
|
|
9
7
|
enableMentions?: boolean;
|
|
10
8
|
disabled?: boolean;
|
|
11
|
-
/** Allows sending with an empty editor (attachments staged in the parent are the payload). */
|
|
12
9
|
hasPendingAttachments?: boolean;
|
|
13
|
-
onSubmit: (content: MessageContent) => void;
|
|
10
|
+
onSubmit: (content: MessageContent) => boolean | void;
|
|
14
11
|
onError?: (message: string) => void;
|
|
15
12
|
onAttach?: () => void;
|
|
16
13
|
onAttachImages?: () => void;
|
|
17
|
-
/** Stages pasted image file(s) exactly like the attach-image button/drop would. */
|
|
18
14
|
onPasteFiles?: (files: File[]) => void;
|
|
19
15
|
onTypingStart?: () => void;
|
|
20
16
|
onTypingStop?: () => void;
|
|
21
17
|
}
|
|
22
18
|
export interface ConversationComposerHandle {
|
|
23
|
-
/** Returns the caret to the editor — used after staging an attachment, where focus
|
|
24
|
-
* otherwise stays on the attach button (or the file dialog that just closed). */
|
|
25
19
|
focus: () => void;
|
|
26
|
-
/** Inserts an @mention of this user at the very start of the draft, then a trailing
|
|
27
|
-
* space — used when starting a reply, so the reply reads like Zalo's own
|
|
28
|
-
* "@[tên] <đang gõ>" instead of relying on the quoted-message banner alone. */
|
|
29
20
|
insertMentionAtStart: (userId: string, fallbackName: string) => void;
|
|
21
|
+
/** Undoes the above when the reply is cancelled, leaving whatever else was typed. */
|
|
22
|
+
removeMentionAtStart: (userId: string) => void;
|
|
30
23
|
}
|
|
31
24
|
/** Rich-text composer that emits backend message content, with real @mentions. */
|
|
32
25
|
export declare const ConversationComposer: import('react').ForwardRefExoticComponent<ConversationComposerProps & import('react').RefAttributes<ConversationComposerHandle>>;
|
|
@@ -9,7 +9,8 @@ interface MentionSuggestionListProps {
|
|
|
9
9
|
items: MentionItem[];
|
|
10
10
|
selectedIndex: number;
|
|
11
11
|
onSelect: (index: number) => void;
|
|
12
|
+
onHighlight: (index: number) => void;
|
|
12
13
|
}
|
|
13
14
|
/** Zalo-style @mention dropdown: hint row, an "@All" option, then members with avatars. */
|
|
14
|
-
export declare function MentionSuggestionList({ items, selectedIndex, onSelect }: MentionSuggestionListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export declare function MentionSuggestionList({ items, selectedIndex, onSelect, onHighlight, }: MentionSuggestionListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
15
16
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function flattenPastedMentions(html: string): string;
|
|
@@ -3,9 +3,13 @@ import { ChatMessage } from '../../../utils/chat';
|
|
|
3
3
|
* Tracks the message the composer is currently replying to — set from a bubble's
|
|
4
4
|
* "Reply" action, read by the composer's reply banner and included in the next send,
|
|
5
5
|
* cleared on submit or when its target message is removed/recalled.
|
|
6
|
+
*
|
|
7
|
+
* Kept per conversation, the same way drafts are: a reply belongs to the conversation it
|
|
8
|
+
* was started in, so switching away must not carry it into another one (whose messages it
|
|
9
|
+
* doesn't belong to), and coming back must restore it.
|
|
6
10
|
*/
|
|
7
|
-
export declare function useReplyTarget(): {
|
|
8
|
-
replyTarget: ChatMessage
|
|
11
|
+
export declare function useReplyTarget(conversationId: string | undefined): {
|
|
12
|
+
replyTarget: ChatMessage;
|
|
9
13
|
startReply: (message: ChatMessage) => void;
|
|
10
14
|
clearReply: () => void;
|
|
11
15
|
clearIfTarget: (messageId: string) => void;
|
|
@@ -6,10 +6,9 @@ interface MessageActionsMenuProps {
|
|
|
6
6
|
/** "Xem chi tiết" (delivery/read receipts) only means anything for a message the current
|
|
7
7
|
* user themself sent — someone else's message shows the same receipts to everyone. */
|
|
8
8
|
canViewDetails: boolean;
|
|
9
|
-
/** Whether
|
|
9
|
+
/** Whether there is something to put on the clipboard: text, or an image message's
|
|
10
|
+
* photos. False for a file-only message. */
|
|
10
11
|
canCopy: boolean;
|
|
11
|
-
/** False for a multi-image message — its reply-quote can't point at any one photo, so
|
|
12
|
-
* there's nothing specific for a reply to reference. */
|
|
13
12
|
canReply: boolean;
|
|
14
13
|
canForward: boolean;
|
|
15
14
|
isPinned: boolean;
|
|
@@ -3,7 +3,8 @@ import { ReactionType } from '@medipha/chat-core';
|
|
|
3
3
|
export interface MessageBubbleProps {
|
|
4
4
|
message: ChatMessage;
|
|
5
5
|
isMine: boolean;
|
|
6
|
-
|
|
6
|
+
currentUserId: string | null;
|
|
7
|
+
resolveUserName: (userId: string) => string;
|
|
7
8
|
isGroup: boolean;
|
|
8
9
|
isFocused: boolean;
|
|
9
10
|
isLatestMessage: boolean;
|
|
@@ -55,4 +56,4 @@ export interface MessageBubbleProps {
|
|
|
55
56
|
/** Renders one message: day divider, SYSTEM notice, reply/forward context, bubble body
|
|
56
57
|
* (delegated to MessageContentBody), reaction badge/picker (MessageReactions), action buttons
|
|
57
58
|
* and options menu (MessageActionsMenu), and the trailing timestamp/status/retry. */
|
|
58
|
-
export declare function MessageBubble({ message, isMine, isGroup, isFocused, isLatestMessage, showDayDivider, isReactionPickerOpen, myReactionType, onOpenReactionPicker, onCloseReactionPickerIfSelf, onApplyReaction, onRemoveReaction, onOpenReactionModal, canManagePins, isPinned, onTogglePin, isMenuOpen, menuPosition, onOpenMenu, onCloseMenu, onCopyMessage, onViewDetails, canRemove, removeLabel, isRemoving, onRemove, onReply, onForward, onJumpToReply, onOpenMentionCard, onOpenSystemMembers, onOpenImageLightbox, onImageSettled, onRetry, onDeleteFailed, isSenderGroupOwner, resolveUserAvatar, onOpenUserProfile, }: MessageBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
export declare function MessageBubble({ message, isMine, currentUserId, resolveUserName, isGroup, isFocused, isLatestMessage, showDayDivider, isReactionPickerOpen, myReactionType, onOpenReactionPicker, onCloseReactionPickerIfSelf, onApplyReaction, onRemoveReaction, onOpenReactionModal, canManagePins, isPinned, onTogglePin, isMenuOpen, menuPosition, onOpenMenu, onCloseMenu, onCopyMessage, onViewDetails, canRemove, removeLabel, isRemoving, onRemove, onReply, onForward, onJumpToReply, onOpenMentionCard, onOpenSystemMembers, onOpenImageLightbox, onImageSettled, onRetry, onDeleteFailed, isSenderGroupOwner, resolveUserAvatar, onOpenUserProfile, }: MessageBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { MessageContent } from '../../../../utils/chat';
|
|
1
2
|
export interface MessageDetailContent {
|
|
2
3
|
senderName?: string | null;
|
|
3
4
|
text: string;
|
|
4
5
|
createdAt?: string | null;
|
|
5
6
|
/** Absolute URL of the photo for an IMAGE message — shown as a thumbnail above the text. */
|
|
6
7
|
imageUrl?: string | null;
|
|
8
|
+
/** The message's own content. A rich document is shown (and copied) with its bold,
|
|
9
|
+
* italics, links and mentions intact; anything else falls back to `text` above. */
|
|
10
|
+
content?: MessageContent | null;
|
|
7
11
|
}
|
|
8
12
|
interface MessageDetailDialogProps {
|
|
9
13
|
detail: MessageDetailContent | null;
|