@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.
Files changed (26) hide show
  1. package/dist/features/composer/conversation-composer.d.ts +4 -1
  2. package/dist/features/composer/editor/paste-mentions.d.ts +1 -0
  3. package/dist/features/composer/editor/reset-editor-content.d.ts +6 -0
  4. package/dist/features/composer/reply/use-reply-target.d.ts +6 -2
  5. package/dist/features/forward/forward-dialog.d.ts +3 -1
  6. package/dist/features/message-list/bubble/message-actions/message-actions-menu.d.ts +2 -3
  7. package/dist/features/message-list/bubble/message-bubble.d.ts +8 -4
  8. package/dist/features/message-list/overlays/message-detail/message-detail-dialog.d.ts +20 -0
  9. package/dist/features/message-list/overlays/message-details/message-details-modal.d.ts +3 -1
  10. package/dist/features/message-window/use-message-window.d.ts +3 -0
  11. package/dist/index.cjs +46 -46
  12. package/dist/index.js +55155 -54806
  13. package/dist/pages/Setting/hooks/use-conversation-settings.d.ts +0 -1
  14. package/dist/pages/conversation/conversation-detail/conversation-detail.d.ts +2 -2
  15. package/dist/pages/sidebar/hooks/use-conversations.d.ts +0 -7
  16. package/dist/shared/components/chat-dialog.d.ts +15 -0
  17. package/dist/shared/components/load-more-sentinel.d.ts +1 -1
  18. package/dist/shared/components/loading-state.d.ts +13 -0
  19. package/dist/shared/components/selection-panel.d.ts +20 -0
  20. package/dist/shared/hooks/use-auto-focus-first-field.d.ts +11 -0
  21. package/dist/store/draftStore.d.ts +5 -4
  22. package/dist/styles.css +1 -1
  23. package/dist/utils/chat-display.d.ts +12 -1
  24. package/dist/utils/chat.d.ts +5 -2
  25. package/package.json +2 -2
  26. package/dist/features/create-conversation/tabs/selected-members-modal.d.ts +0 -12
@@ -9,7 +9,6 @@ interface UseConversationSettingsParams {
9
9
  }
10
10
  /** Coordinates member management, rename, delete, and leave actions for a conversation. */
11
11
  export declare function useConversationSettings({ conversationId, currentUserId, onConversationUpdated, onDeleteSuccess, onLeaveSuccess, onMembersChanged, }: UseConversationSettingsParams): {
12
- actionError: string;
13
12
  addingUserId: string | null;
14
13
  addMember: (userId: string) => Promise<boolean>;
15
14
  addMembers: (userIds: string[]) => Promise<boolean>;
@@ -1,7 +1,7 @@
1
1
  import { VirtuosoHandle } from 'react-virtuoso';
2
2
  import { RefObject } from 'react';
3
3
  import { MessageRemovedPayload } from '@medipha/chat-core';
4
- import { ChatMessage, ChatUser, ConversationMember } from '../../../utils/chat';
4
+ import { ChatMessage, ChatUser, ConversationMember, MessageReplyPreview } from '../../../utils/chat';
5
5
  import { PendingAttachment } from '../../../features/composer/pending-attachment';
6
6
  interface MessageWindowForDetail {
7
7
  messages: ChatMessage[];
@@ -61,7 +61,7 @@ interface ConversationDetailProps {
61
61
  dayDividerKeys: Set<string>;
62
62
  replyTargetState: ReplyTargetForDetail;
63
63
  onForward: (message: ChatMessage) => void;
64
- onJumpToReply: (replyMessageId: string) => void;
64
+ onJumpToReply: (replyMessageId: string, preview?: MessageReplyPreview) => void;
65
65
  onOpenMentionCard: (userId: string) => void;
66
66
  onOpenUserProfile: (userId: string) => void;
67
67
  onOpenImageLightbox: (message: ChatMessage, urls: string[], index: number) => void;
@@ -7,12 +7,5 @@ interface UseConversationsResult {
7
7
  clearConversationForUser: (conversationId: string) => Promise<boolean>;
8
8
  reload: () => Promise<void>;
9
9
  }
10
- /**
11
- * Loads the current user's conversations and keeps the list live via socket events.
12
- * Backed by the shared `conversationsStore` (not local state) — the page-level "currently
13
- * open conversation" reads and gets patched through the same store, so the two never
14
- * drift out of sync on the same realtime events.
15
- * `activeConversationId` is accepted for call-site compatibility (currently unused here).
16
- */
17
10
  export declare function useConversations(activeConversationId?: string): UseConversationsResult;
18
11
  export {};
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ interface ChatDialogProps {
3
+ open: boolean;
4
+ title: string;
5
+ children: ReactNode;
6
+ onClose: () => void;
7
+ footer?: ReactNode;
8
+ width?: number;
9
+ /** Renders inside the caller's own box instead of the page — for a dialog opened from a
10
+ * panel that already sits above the conversation. */
11
+ inline?: boolean;
12
+ className?: string;
13
+ }
14
+ export declare function ChatDialog({ open, title, children, onClose, footer, width, inline, className, }: ChatDialogProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -1,7 +1,7 @@
1
1
  interface LoadMoreSentinelProps {
2
2
  /** Whether a next page exists to load. */
3
3
  enabled: boolean;
4
- /** True while the next page is being fetched (shows "Đang tải..." and gates refires). */
4
+ /** True while the next page is being fetched (shows the loading animation and gates refires). */
5
5
  isLoading: boolean;
6
6
  onLoadMore: () => void;
7
7
  }
@@ -0,0 +1,13 @@
1
+ interface LoadingStateProps {
2
+ /** `sm` fits inline slots — a tooltip, a "load more" sentinel; `md` is for panel and
3
+ * list bodies that own the whole area while they wait. */
4
+ size?: 'sm' | 'md';
5
+ /** Announced to screen readers, which no longer get the visible "Đang tải..." text. */
6
+ label?: string;
7
+ className?: string;
8
+ }
9
+ /** The app's one loading indicator: the shared loading animation, centred in whatever
10
+ * slot it's dropped into. Replaces the plain "Đang tải..." strings that used to stand in
11
+ * for it across the panels, lists and modals. */
12
+ export declare function LoadingState({ size, label, className }: LoadingStateProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { ConversationMember } from '../../utils/chat';
3
+ export interface SelectionPanelItem {
4
+ id: string;
5
+ name: string;
6
+ avatarUrl?: string | null;
7
+ isGroup?: boolean;
8
+ members?: ConversationMember[];
9
+ }
10
+ interface SelectionSplitProps {
11
+ children: ReactNode;
12
+ items: SelectionPanelItem[];
13
+ max?: number;
14
+ currentUserId?: string | null;
15
+ listClassName?: string;
16
+ onRemove: (id: string) => void;
17
+ onClear: () => void;
18
+ }
19
+ export declare function SelectionSplit({ children, items, max, currentUserId, listClassName, onRemove, onClear, }: SelectionSplitProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Puts the caret in a dialog's first text field as soon as it opens, so every modal that
3
+ * has something to type into behaves the same way — search boxes, name inputs, message
4
+ * composers. Returns the ref to attach to the dialog element.
5
+ *
6
+ * `refocusKey` re-runs the focus whenever it changes — pass the active tab in a tabbed
7
+ * dialog, where each tab has its own field and switching tabs should hand the caret over.
8
+ * Left undefined, this runs once per mount, so a plain content refresh (a list reloading)
9
+ * never yanks focus back from wherever the user moved it.
10
+ */
11
+ export declare function useAutoFocusFirstField<T extends HTMLElement>(refocusKey?: unknown): import('react').RefObject<T>;
@@ -6,10 +6,11 @@ interface DraftState {
6
6
  }
7
7
  /** Flattens a draft doc to the one-line plain text the sidebar row previews. */
8
8
  export declare function getDraftText(doc: JSONContent | undefined): string;
9
- /** Writes the pending snapshot out now, skipping the debounce. */
10
- export declare function flushDrafts(): void;
11
- /** Swaps the loaded draft set to another account, flushing the previous one first. */
9
+ /** Drops every draft when the signed-in account changes — they belong to that account. */
12
10
  export declare function setDraftUser(userId: string | null): void;
13
- /** Unsent composer content per conversation, scoped to the signed-in user. */
11
+ /**
12
+ * Unsent composer content per conversation, held for this page session only: switching
13
+ * conversations keeps what you were typing, a reload starts clean.
14
+ */
14
15
  export declare const useDraftStore: import('zustand').UseBoundStore<import('zustand').StoreApi<DraftState>>;
15
16
  export {};