@medipha/chat 1.0.25 → 1.0.27
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/conversation-composer.d.ts +4 -1
- package/dist/features/composer/editor/paste-mentions.d.ts +1 -0
- package/dist/features/composer/editor/reset-editor-content.d.ts +6 -0
- package/dist/features/composer/reply/use-reply-target.d.ts +6 -2
- package/dist/features/forward/forward-dialog.d.ts +3 -1
- 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 +8 -4
- package/dist/features/message-list/overlays/message-detail/message-detail-dialog.d.ts +20 -0
- package/dist/features/message-list/overlays/message-details/message-details-modal.d.ts +3 -1
- package/dist/features/message-window/use-message-window.d.ts +3 -0
- package/dist/index.cjs +46 -46
- package/dist/index.js +55155 -54806
- package/dist/pages/Setting/hooks/use-conversation-settings.d.ts +0 -1
- package/dist/pages/conversation/conversation-detail/conversation-detail.d.ts +2 -2
- package/dist/pages/sidebar/hooks/use-conversations.d.ts +0 -7
- 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/selection-panel.d.ts +20 -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 +12 -1
- package/dist/utils/chat.d.ts +5 -2
- package/package.json +2 -2
- package/dist/features/create-conversation/tabs/selected-members-modal.d.ts +0 -12
|
@@ -10,7 +10,8 @@ interface ConversationComposerProps {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
/** Allows sending with an empty editor (attachments staged in the parent are the payload). */
|
|
12
12
|
hasPendingAttachments?: boolean;
|
|
13
|
-
|
|
13
|
+
/** Returns false to keep the draft in the box — the send was refused, not sent. */
|
|
14
|
+
onSubmit: (content: MessageContent) => boolean | void;
|
|
14
15
|
onError?: (message: string) => void;
|
|
15
16
|
onAttach?: () => void;
|
|
16
17
|
onAttachImages?: () => void;
|
|
@@ -27,6 +28,8 @@ export interface ConversationComposerHandle {
|
|
|
27
28
|
* space — used when starting a reply, so the reply reads like Zalo's own
|
|
28
29
|
* "@[tên] <đang gõ>" instead of relying on the quoted-message banner alone. */
|
|
29
30
|
insertMentionAtStart: (userId: string, fallbackName: string) => void;
|
|
31
|
+
/** Undoes the above when the reply is cancelled, leaving whatever else was typed. */
|
|
32
|
+
removeMentionAtStart: (userId: string) => void;
|
|
30
33
|
}
|
|
31
34
|
/** Rich-text composer that emits backend message content, with real @mentions. */
|
|
32
35
|
export declare const ConversationComposer: import('react').ForwardRefExoticComponent<ConversationComposerProps & import('react').RefAttributes<ConversationComposerHandle>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function flattenPastedMentions(html: string): string;
|
|
@@ -6,5 +6,11 @@ import { Editor } from '@tiptap/core';
|
|
|
6
6
|
* bullet/numbered list — you end up with an empty list item still showing its marker next
|
|
7
7
|
* to the placeholder. `clearNodes()` over the whole selection lifts those wrappers away
|
|
8
8
|
* first, so what's left to clear is plain paragraphs.
|
|
9
|
+
*
|
|
10
|
+
* The trailing `setTextSelection(0)` collapses the caret back to the start of the emptied
|
|
11
|
+
* paragraph. Without it the `AllSelection` opened by `selectAll()` survives the whole
|
|
12
|
+
* chain — `clearContent()` replaces the document range but never re-anchors the selection,
|
|
13
|
+
* and `AllSelection` re-maps onto the new empty document — so the composer came back with
|
|
14
|
+
* its blank line still selected, drawn by the browser as a dark block at the caret.
|
|
9
15
|
*/
|
|
10
16
|
export declare function resetEditorContent(editor: Editor | null | undefined): void;
|
|
@@ -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;
|
|
@@ -3,9 +3,11 @@ interface ForwardDialogProps {
|
|
|
3
3
|
source: ChatMessage;
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
onForward: (targetConversationIds: string[], note: string) => void;
|
|
6
|
+
/** Opens the account-info modal for the person behind a "Cá nhân" row. */
|
|
7
|
+
onOpenProfile?: (userId: string) => void;
|
|
6
8
|
}
|
|
7
9
|
/** Zalo-style forward picker: choose one or more conversations to forward a message into.
|
|
8
10
|
* Built on the shared settings-modal shell/list/checkbox components (same ones the
|
|
9
11
|
* add-member and create-group pickers use) instead of one-off markup. */
|
|
10
|
-
export declare function ForwardDialog({ source, onClose, onForward }: ForwardDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function ForwardDialog({ source, onClose, onForward, onOpenProfile }: ForwardDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -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;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ChatMessage } from '../../../utils/chat';
|
|
1
|
+
import { ChatMessage, MessageReplyPreview } from '../../../utils/chat';
|
|
2
2
|
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;
|
|
@@ -34,7 +35,10 @@ export interface MessageBubbleProps {
|
|
|
34
35
|
onRemove: () => void;
|
|
35
36
|
onReply: () => void;
|
|
36
37
|
onForward: () => void;
|
|
37
|
-
|
|
38
|
+
/** `preview` is passed only from a reply quote — it lets the caller show the quoted
|
|
39
|
+
* message's own content when the jump lands on something no longer in this reader's
|
|
40
|
+
* history. The pin notice's "Xem" has no preview, so it gets a plain notice instead. */
|
|
41
|
+
onJumpToReply: (replyMessageId: string, preview?: MessageReplyPreview) => void;
|
|
38
42
|
onOpenMentionCard: (userId: string, fallbackName?: string) => void;
|
|
39
43
|
onOpenSystemMembers: (messageId: string, totalCount: number, actionLabel: string) => void;
|
|
40
44
|
onOpenImageLightbox: (urls: string[], index: number) => void;
|
|
@@ -52,4 +56,4 @@ export interface MessageBubbleProps {
|
|
|
52
56
|
/** Renders one message: day divider, SYSTEM notice, reply/forward context, bubble body
|
|
53
57
|
* (delegated to MessageContentBody), reaction badge/picker (MessageReactions), action buttons
|
|
54
58
|
* and options menu (MessageActionsMenu), and the trailing timestamp/status/retry. */
|
|
55
|
-
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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MessageContent } from '../../../../utils/chat';
|
|
2
|
+
export interface MessageDetailContent {
|
|
3
|
+
senderName?: string | null;
|
|
4
|
+
text: string;
|
|
5
|
+
createdAt?: string | null;
|
|
6
|
+
/** Absolute URL of the photo for an IMAGE message — shown as a thumbnail above the text. */
|
|
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;
|
|
11
|
+
}
|
|
12
|
+
interface MessageDetailDialogProps {
|
|
13
|
+
detail: MessageDetailContent | null;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
/** Renders inside the caller's own box instead of the page — for a dialog opened from a
|
|
16
|
+
* panel that already sits above the conversation. */
|
|
17
|
+
inline?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function MessageDetailDialog({ detail, onClose, inline }: MessageDetailDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -10,7 +10,9 @@ interface MessageDetailsModalProps {
|
|
|
10
10
|
* is over MAX_DETAILED_SEEN_MEMBERS and details aren't computed at all. */
|
|
11
11
|
seenBy: ConversationMember[] | null;
|
|
12
12
|
onClose: () => void;
|
|
13
|
+
/** Opens the account-info modal for a member of the seen-by list. */
|
|
14
|
+
onOpenProfile?: (userId: string) => void;
|
|
13
15
|
}
|
|
14
16
|
/** "Thông tin tin nhắn" dialog — sender/content/time preview plus a seen-by list. */
|
|
15
|
-
export declare function MessageDetailsModal({ message, isGroup, members, otherMember, currentUserId, authUser, seenBy, onClose, }: MessageDetailsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function MessageDetailsModal({ message, isGroup, members, otherMember, currentUserId, authUser, seenBy, onClose, onOpenProfile, }: MessageDetailsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export {};
|
|
@@ -30,6 +30,9 @@ export declare function useMessageWindow(conversationId: string | undefined): {
|
|
|
30
30
|
isLoadingNewer: boolean;
|
|
31
31
|
isLoadingOlder: boolean;
|
|
32
32
|
loadAround: (messageId: string) => Promise<boolean>;
|
|
33
|
+
/** Whether the last `loadAround` failed because the message is gone for this reader.
|
|
34
|
+
* Read it right after awaiting the call. */
|
|
35
|
+
wasLastAroundNotFound: () => boolean;
|
|
33
36
|
loadLatest: () => Promise<boolean>;
|
|
34
37
|
loadNewer: () => Promise<boolean>;
|
|
35
38
|
loadOlder: () => Promise<boolean>;
|