@medipha/chat 1.0.66 → 1.0.68

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.
@@ -3,12 +3,20 @@ export interface WidgetFocusRequest {
3
3
  conversationId: string;
4
4
  nonce: number;
5
5
  }
6
+ /** Asks the widget to show a colleague's "Thông tin tài khoản" dialog (with its "Nhắn tin" button). */
7
+ export interface WidgetProfileRequest {
8
+ userId: string;
9
+ /** Change it on every request so asking for the same person again opens the dialog again. */
10
+ nonce: number;
11
+ }
6
12
  export interface ChatWidgetProps extends ChatModuleProps {
7
13
  /** Whether the host is currently showing the widget. Keep the widget mounted while this
8
14
  * is false — the conversation list stays warm and onUnreadTotalChange keeps reporting —
9
15
  * but the floating chat window is withheld, since it is portalled out of whatever box
10
16
  * the host hides. Defaults to true. */
11
17
  isOpen?: boolean;
18
+ /** Lets the host (e.g. the newsfeed) open a user's profile dialog inside this widget. */
19
+ openProfileRequest?: WidgetProfileRequest;
12
20
  onActiveConversationChange?: (conversationId: string | undefined) => void;
13
21
  onExpandChange?: (isExpanded: boolean) => void;
14
22
  onOpenFullPage?: (conversationId: string | undefined) => void;
@@ -1,4 +1,4 @@
1
- import { WidgetFocusRequest } from './chat-widget.types';
1
+ import { WidgetFocusRequest, WidgetProfileRequest } from './chat-widget.types';
2
2
  interface WidgetChatShellProps {
3
3
  isWindowVisible: boolean;
4
4
  isExpanded: boolean;
@@ -12,6 +12,7 @@ interface WidgetChatShellProps {
12
12
  onFocusConversation: (conversationId: string) => void;
13
13
  onOpenFullPage?: (conversationId: string | undefined) => void;
14
14
  onRequestClose?: () => void;
15
+ openProfileRequest?: WidgetProfileRequest;
15
16
  }
16
- export declare function WidgetChatShell({ isWindowVisible, isExpanded, openConversationIds, windowCapacity, focusedConversationId, composerFocusRequest, onToggleExpand, onOpenConversation, onCloseConversation, onFocusConversation, onOpenFullPage, onRequestClose, }: WidgetChatShellProps): import('react/jsx-runtime').JSX.Element;
17
+ export declare function WidgetChatShell({ isWindowVisible, isExpanded, openConversationIds, windowCapacity, focusedConversationId, composerFocusRequest, onToggleExpand, onOpenConversation, onCloseConversation, onFocusConversation, onOpenFullPage, onRequestClose, openProfileRequest, }: WidgetChatShellProps): import('react/jsx-runtime').JSX.Element;
17
18
  export {};
@@ -0,0 +1,17 @@
1
+ import { Conversation } from '../../utils/chat';
2
+ import { SidebarConversationFilter } from './sidebar-filter/sidebar-filter';
3
+ export type ConversationListEntry = {
4
+ kind: 'conversation';
5
+ conversation: Conversation;
6
+ } | {
7
+ kind: 'saved';
8
+ };
9
+ interface ConversationListOptions {
10
+ conversations: Conversation[];
11
+ currentUserId: string | null;
12
+ searchTerm: string;
13
+ activeFilter: SidebarConversationFilter;
14
+ tagFilters: string[];
15
+ }
16
+ export declare function buildConversationListEntries({ conversations, currentUserId, searchTerm, activeFilter, tagFilters, }: ConversationListOptions): ConversationListEntry[];
17
+ export {};
@@ -0,0 +1,7 @@
1
+ interface SavedConversationEntryProps {
2
+ isCompact: boolean;
3
+ isOpening: boolean;
4
+ onOpen: () => void;
5
+ }
6
+ export declare function SavedConversationEntry({ isCompact, isOpening, onOpen, }: SavedConversationEntryProps): import('react/jsx-runtime').JSX.Element;
7
+ export {};
@@ -1,6 +1,9 @@
1
1
  import { Conversation } from '../../../utils/chat';
2
+ import { ConversationListEntry } from '../conversation-list-entries';
2
3
  interface SidbarConversationListProps {
3
- conversations: Conversation[];
4
+ entries: ConversationListEntry[];
5
+ isOpeningSavedConversation: boolean;
6
+ onOpenSavedConversation: () => void;
4
7
  isLoading: boolean;
5
8
  error: string;
6
9
  currentUserId: string | null;
@@ -20,5 +23,5 @@ interface SidbarConversationListProps {
20
23
  * conversation (a tag, a pin, an unread count) only re-renders that row, not the whole
21
24
  * list — the "..." menu and its selection state live here instead, since only one can be
22
25
  * open across the whole list. */
23
- export declare function SidbarConversationList({ conversations, isLoading, error, currentUserId, activeConversationId, openConversationIds, isCompact, buildConversationPath, onSelectConversation, onTogglePin, onClearConversation, pendingNotificationIds, onToggleErpNotification, onOpenTagManager, }: SidbarConversationListProps): import('react/jsx-runtime').JSX.Element;
26
+ export declare function SidbarConversationList({ entries, isOpeningSavedConversation, onOpenSavedConversation, isLoading, error, currentUserId, activeConversationId, openConversationIds, isCompact, buildConversationPath, onSelectConversation, onTogglePin, onClearConversation, pendingNotificationIds, onToggleErpNotification, onOpenTagManager, }: SidbarConversationListProps): import('react/jsx-runtime').JSX.Element;
24
27
  export {};
@@ -5,6 +5,7 @@ interface ConversationAvatarProps {
5
5
  /** Name used for the initials fallback when there is no photo. */
6
6
  name: string;
7
7
  isGroup: boolean;
8
+ isSaved?: boolean;
8
9
  /** Group members used to build the composite avatar; empty for direct chats. */
9
10
  members?: ConversationMember[];
10
11
  /** Total member count for the group composite; falls back to members.length. */
@@ -12,5 +13,5 @@ interface ConversationAvatarProps {
12
13
  currentUserId?: string | null;
13
14
  className?: string;
14
15
  }
15
- export declare function ConversationAvatar({ avatarUrl, name, isGroup, members, memberCount, currentUserId, className, }: ConversationAvatarProps): import('react/jsx-runtime').JSX.Element;
16
+ export declare function ConversationAvatar({ avatarUrl, name, isGroup, isSaved, members, memberCount, currentUserId, className, }: ConversationAvatarProps): import('react/jsx-runtime').JSX.Element;
16
17
  export {};
@@ -5,6 +5,7 @@ export interface SelectionPanelItem {
5
5
  name: string;
6
6
  avatarUrl?: string | null;
7
7
  isGroup?: boolean;
8
+ isSaved?: boolean;
8
9
  members?: ConversationMember[];
9
10
  }
10
11
  interface SelectionSplitProps {
@@ -15,6 +16,7 @@ interface SelectionSplitProps {
15
16
  listClassName?: string;
16
17
  onRemove: (id: string) => void;
17
18
  onClear: () => void;
19
+ disabled?: boolean;
18
20
  }
19
- export declare function SelectionSplit({ children, items, max, currentUserId, listClassName, onRemove, onClear, }: SelectionSplitProps): import('react/jsx-runtime').JSX.Element;
21
+ export declare function SelectionSplit({ children, items, max, currentUserId, listClassName, onRemove, onClear, disabled, }: SelectionSplitProps): import('react/jsx-runtime').JSX.Element;
20
22
  export {};
@@ -3,6 +3,11 @@ interface ConversationsState {
3
3
  conversations: Conversation[];
4
4
  isLoading: boolean;
5
5
  error: string;
6
+ savedConversationContext: SavedConversationContext | null;
7
+ isOpeningSavedConversation: boolean;
8
+ savedConversationError: string;
9
+ setSavedConversationContext: (context: SavedConversationContext | null) => void;
10
+ openSavedConversation: () => Promise<Conversation | null>;
6
11
  /** Bumped per conversation whenever this user clears it. An open message window reloads
7
12
  * only when its conversationId changes, so clearing the conversation currently on screen
8
13
  * would otherwise leave the already-fetched history sitting there — the server hides it
@@ -38,6 +43,10 @@ interface ConversationsState {
38
43
  applyTagConversations: (tag: ConversationTag, conversationIds: string[]) => void;
39
44
  applyConversationTag: (conversationId: string, tag: ConversationTag | null) => void;
40
45
  }
46
+ interface SavedConversationContext {
47
+ userId: string;
48
+ apiUrl: string;
49
+ }
41
50
  /**
42
51
  * Shared conversation-summary list — the single source sidebar rows AND the page-level
43
52
  * "currently open conversation" both read, instead of each independently patching its own
@@ -1,8 +1,20 @@
1
1
  import { ChatMessage } from '../utils/chat';
2
+ import { useConversationsStore } from './conversationsStore';
3
+ import { ForwardDestination } from '../features/forward/forward-attempt';
4
+ type ForwardContext = ReturnType<typeof useConversationsStore.getState>['savedConversationContext'];
2
5
  interface ForwardState {
3
6
  /** The message currently staged to forward — drives whether ForwardDialog is open. */
4
7
  forwardSource: ChatMessage | null;
5
8
  forwardConversationId: string | null;
9
+ forwardContext: ForwardContext;
10
+ forwardSessionId: number;
11
+ forwardTargets: ForwardDestination[];
12
+ forwardSelectionKeys: string[];
13
+ setForwardSelection: (keys: string[]) => void;
14
+ isSubmitting: boolean;
15
+ forwardError: string;
16
+ submitForward: (conversationIds: string[], userIds: string[], note: string) => Promise<Record<string, unknown>[] | null>;
17
+ confirmForwardedMessage: (incoming: unknown) => void;
6
18
  openForward: (message: ChatMessage, conversationId?: string) => void;
7
19
  closeForward: () => void;
8
20
  clearIfTarget: (messageId: string) => void;