@medipha/chat 1.0.29 → 1.0.31

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 (34) hide show
  1. package/README.md +82 -7
  2. package/dist/features/composer/conversation-composer.d.ts +2 -0
  3. package/dist/features/composer/emoji/emoji-picker-button.d.ts +2 -1
  4. package/dist/features/composer/toolbar/composer-toolbar.d.ts +4 -1
  5. package/dist/features/create-conversation/create-conversation-panel.d.ts +1 -1
  6. package/dist/features/media-preview/media-preview-modal.d.ts +1 -1
  7. package/dist/features/message-list/bubble/message-actions/message-actions-menu.d.ts +2 -5
  8. package/dist/features/message-list/bubble/message-bubble.d.ts +2 -5
  9. package/dist/features/message-list/overlays/message-menu/use-message-menu.d.ts +2 -0
  10. package/dist/index.cjs +47 -47
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.js +15440 -14861
  13. package/dist/module/chat-runtime-props.d.ts +2 -0
  14. package/dist/module/chat-runtime-provider.d.ts +9 -0
  15. package/dist/module/navigation/chat-navigation-context.d.ts +16 -0
  16. package/dist/module/navigation/router-chat-navigation.d.ts +4 -0
  17. package/dist/module/session/chat-session.d.ts +9 -0
  18. package/dist/module/widget/chat-widget.d.ts +2 -0
  19. package/dist/module/widget/chat-widget.types.d.ts +13 -0
  20. package/dist/module/widget/widget-chat-navigation.d.ts +8 -0
  21. package/dist/module/widget/widget-conversation-screen.d.ts +15 -0
  22. package/dist/pages/conversation/conversation-detail/conversation-detail.d.ts +1 -0
  23. package/dist/pages/conversation/conversation-footer/conversation-footer.d.ts +3 -1
  24. package/dist/pages/conversation/conversation-header/conversation-header.d.ts +6 -1
  25. package/dist/pages/conversation/hooks/use-current-membership.d.ts +1 -1
  26. package/dist/pages/conversation/index.d.ts +4 -0
  27. package/dist/pages/conversations/index.d.ts +3 -3
  28. package/dist/pages/conversations/use-conversation-workspace.d.ts +21 -0
  29. package/dist/pages/conversations/workspace-user-profile-modal.d.ts +12 -0
  30. package/dist/pages/sidebar/index.d.ts +9 -1
  31. package/dist/pages/sidebar/sidbar-conversation-list/sidbar-conversation-list.d.ts +4 -2
  32. package/dist/pages/sidebar/sidebar-header-infor/sidebar-header-infor.d.ts +9 -3
  33. package/dist/styles.css +1 -1
  34. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ import { ChatModuleProps } from './chat-module.types';
2
+ export declare function assertChatRuntimeProps({ accessToken, apiUrl, socketUrl }: ChatModuleProps): void;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChatModuleProps } from './chat-module.types';
3
+ interface ChatRuntimeProviderProps {
4
+ runtimeProps: ChatModuleProps;
5
+ rootClassName?: string;
6
+ children: ReactNode;
7
+ }
8
+ export declare function ChatRuntimeProvider({ runtimeProps, rootClassName, children, }: ChatRuntimeProviderProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Conversation } from '../../utils/chat';
2
+ export interface OpenConversationOptions {
3
+ conversation?: Conversation;
4
+ replace?: boolean;
5
+ }
6
+ export interface CloseConversationOptions {
7
+ replace?: boolean;
8
+ }
9
+ export interface ChatNavigation {
10
+ activeConversationId: string | undefined;
11
+ openConversation: (conversationId: string, options?: OpenConversationOptions) => void;
12
+ closeConversation: (options?: CloseConversationOptions) => void;
13
+ buildConversationPath?: (conversationId: string) => string;
14
+ }
15
+ export declare const ChatNavigationContext: import('react').Context<ChatNavigation | null>;
16
+ export declare function useChatNavigation(): ChatNavigation;
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ export declare function RouterChatNavigationProvider({ children }: {
3
+ children: ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ export interface ChatSessionConfig {
2
+ accessToken: string;
3
+ apiUrl: string;
4
+ socketUrl: string;
5
+ userId: string;
6
+ }
7
+ export declare function configureChatTransport(config: ChatSessionConfig): void;
8
+ export declare function acquireChatSession(config: ChatSessionConfig): () => void;
9
+ export declare function useChatSession({ accessToken, apiUrl, socketUrl, userId, }: ChatSessionConfig): void;
@@ -0,0 +1,2 @@
1
+ import { ChatWidgetProps } from './chat-widget.types';
2
+ export declare function ChatWidget(widgetProps: ChatWidgetProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ChatModuleProps } from '../chat-module.types';
2
+ export interface ChatWidgetProps extends ChatModuleProps {
3
+ /** Whether the host is currently showing the widget. Keep the widget mounted while this
4
+ * is false — the conversation list stays warm and onUnreadTotalChange keeps reporting —
5
+ * but the floating chat window is withheld, since it is portalled out of whatever box
6
+ * the host hides. Defaults to true. */
7
+ isOpen?: boolean;
8
+ onActiveConversationChange?: (conversationId: string | undefined) => void;
9
+ onExpandChange?: (isExpanded: boolean) => void;
10
+ onOpenFullPage?: (conversationId: string | undefined) => void;
11
+ onRequestClose?: () => void;
12
+ onUnreadTotalChange?: (unreadTotal: number) => void;
13
+ }
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ interface WidgetChatNavigationProviderProps {
3
+ activeConversationId: string | undefined;
4
+ onActiveConversationIdChange: (conversationId: string | undefined) => void;
5
+ children: ReactNode;
6
+ }
7
+ export declare function WidgetChatNavigationProvider({ activeConversationId, onActiveConversationIdChange, children, }: WidgetChatNavigationProviderProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,15 @@
1
+ interface WidgetConversationScreenProps {
2
+ isWindowVisible: boolean;
3
+ isExpanded: boolean;
4
+ onToggleExpand: () => void;
5
+ onOpenFullPage?: () => void;
6
+ onOpenAllConversations?: () => void;
7
+ onRequestClose?: () => void;
8
+ }
9
+ /** The anchored rail plus, once a conversation is picked, one floating chat window.
10
+ * The window is portalled to the document rather than rendered inside the rail: it is a
11
+ * modal that floats over the host page, so it must not inherit the rail's box, stacking
12
+ * context or width. It carries no settings column — the header's zoom button hands the
13
+ * conversation to the host's full-page chat instead. */
14
+ export declare function WidgetConversationScreen({ isWindowVisible, isExpanded, onToggleExpand, onOpenFullPage, onOpenAllConversations, onRequestClose, }: WidgetConversationScreenProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -14,6 +14,7 @@ interface MessageWindowForDetail {
14
14
  updateAtBottom: (isAtBottom: boolean) => void;
15
15
  isLoadingOlder: boolean;
16
16
  isLoadingNewer: boolean;
17
+ isLoadingAround: boolean;
17
18
  hasUnseenMessages: boolean;
18
19
  isAtBottom: boolean;
19
20
  }
@@ -16,6 +16,8 @@ interface ConversationFooterProps {
16
16
  conversationId: string | undefined;
17
17
  currentUserId: string | null;
18
18
  conversationTitle: string;
19
+ composerPlaceholder?: string;
20
+ isCompactComposer?: boolean;
19
21
  mentionMembers: ChatUser[];
20
22
  canMentionAll: boolean;
21
23
  isGroup: boolean;
@@ -43,5 +45,5 @@ interface ConversationFooterProps {
43
45
  /** The message composer itself — toolbar + input — plus its two hidden file inputs. Owns
44
46
  * turning a submitted draft (text and/or staged attachments) into outgoing messages,
45
47
  * including uploading any staged files before they're sent. */
46
- export declare function ConversationFooter({ conversationId, currentUserId, conversationTitle, mentionMembers, canMentionAll, isGroup, disabled, lockedReason, pendingAttachmentsState, replyTargetState, replySenderName, replySenderAvatarUrl, emitOutgoingMessage, markMessageFailed, mergeOutgoingMessage, stickToLatest, onComposerError, onAttach, onAttachImages, onTypingStart, onTypingStop, uploadInputRef, imageUploadInputRef, acceptAttribute, }: ConversationFooterProps): import("react/jsx-runtime").JSX.Element;
48
+ export declare function ConversationFooter({ conversationId, currentUserId, conversationTitle, composerPlaceholder, isCompactComposer, mentionMembers, canMentionAll, isGroup, disabled, lockedReason, pendingAttachmentsState, replyTargetState, replySenderName, replySenderAvatarUrl, emitOutgoingMessage, markMessageFailed, mergeOutgoingMessage, stickToLatest, onComposerError, onAttach, onAttachImages, onTypingStart, onTypingStop, uploadInputRef, imageUploadInputRef, acceptAttribute, }: ConversationFooterProps): import("react/jsx-runtime").JSX.Element;
47
49
  export {};
@@ -21,7 +21,12 @@ interface ConversationHeaderProps {
21
21
  /** Group owner only: hovering the title reveals a rename button. */
22
22
  canEditTitle?: boolean;
23
23
  onEditTitle?: () => void;
24
+ /** Anchored widget only: hands this conversation over to the host's full-page chat. */
25
+ onOpenFullPage?: () => void;
26
+ /** Anchored widget only: collapses the floating window down to this header. */
27
+ /** Anchored widget only: closes the floating window and returns to the list. */
28
+ onCloseConversation?: () => void;
24
29
  }
25
30
  /** Conversation title/status row plus the collapsible in-header search and toggle buttons. */
26
- export declare function ConversationHeader({ title, avatarUrl, isGroup, isVerified, groupMemberCount, members, currentUserId, isOtherMemberOnline, onOpenSearch, onOpenMessageList, isSettingsOpen, onToggleSettings, onOpenMembers, canEditTitle, onEditTitle, onOpenAvatarProfile, }: ConversationHeaderProps): import("react/jsx-runtime").JSX.Element;
31
+ export declare function ConversationHeader({ title, avatarUrl, isGroup, isVerified, groupMemberCount, members, currentUserId, isOtherMemberOnline, onOpenSearch, onOpenMessageList, isSettingsOpen, onToggleSettings, onOpenMembers, canEditTitle, onEditTitle, onOpenAvatarProfile, onOpenFullPage, onCloseConversation, }: ConversationHeaderProps): import("react/jsx-runtime").JSX.Element;
27
32
  export {};
@@ -5,7 +5,7 @@ import { ChatUser } from '../../../utils/chat';
5
5
  * across permission checks (pin management, moderation, title editing). A no-op for
6
6
  * DIRECT conversations, which have no membership roles to resolve.
7
7
  */
8
- export declare function useCurrentMembership(conversationId: string | undefined, conversationType: string, currentUserId: string | null, onError: (message: string) => void): {
8
+ export declare function useCurrentMembership(conversationId: string | undefined, conversationType: string, currentUserId: string | null): {
9
9
  mentionMembers: ChatUser[];
10
10
  currentMemberRole: string;
11
11
  currentMemberStatus: string;
@@ -18,6 +18,10 @@ interface ConversationGroupProps {
18
18
  onOpenMembers: () => void;
19
19
  onOpenUserProfile: (userId: string) => void;
20
20
  onNavigateBack: () => void;
21
+ onOpenFullPage?: () => void;
22
+ onCloseConversation?: () => void;
23
+ composerPlaceholder?: string;
24
+ isCompactComposer?: boolean;
21
25
  }
22
26
  /** Header + detail + footer for the currently open conversation. Owns only what's
23
27
  * genuinely shared across those three (message window, membership, reply target,
@@ -1,4 +1,4 @@
1
- /** Full-viewport chat workspace: sidebar plus the active conversation. Owns the
2
- * conversation object itself (shared by both the conversation group and the Setting
3
- * group) and the handful of dialogs/state that outlive either (forward, user profile). */
1
+ /** Full-viewport chat workspace: sidebar, the active conversation, and the settings/search
2
+ * column. Conversation loading and the dialogs that outlive a conversation come from
3
+ * useConversationWorkspace, which the anchored widget screen shares. */
4
4
  export declare function ConversationScreen(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { ChatUser, Conversation } from '../../utils/chat';
2
+ /** Everything the full-page screen and the anchored widget screen both need: which
3
+ * conversation is open, its freshly loaded record, and the two dialogs/actions that
4
+ * outlive whichever conversation is on screen. Neither layout, side panels nor window
5
+ * chrome belong here — those are what the two screens differ in. */
6
+ export declare function useConversationWorkspace(): {
7
+ conversationId: string | undefined;
8
+ conversation: Conversation | null;
9
+ isLoadingConversation: boolean;
10
+ currentUserId: string | null;
11
+ authUser: ChatUser | null;
12
+ accessToken: string;
13
+ userProfile: {
14
+ profileUserId: string | null;
15
+ openProfile: (userId: string | null) => void;
16
+ closeProfile: () => void;
17
+ };
18
+ openConversation: (conversationId: string, options?: import('../../module/navigation/chat-navigation-context').OpenConversationOptions) => void;
19
+ closeConversation: (options?: import('../../module/navigation/chat-navigation-context').CloseConversationOptions) => void;
20
+ startDirectChat: (targetUserId: string) => void;
21
+ };
@@ -0,0 +1,12 @@
1
+ import { Conversation } from '../../utils/chat';
2
+ interface WorkspaceUserProfileModalProps {
3
+ profileUserId: string | null;
4
+ conversation: Conversation | null;
5
+ currentUserId: string | null;
6
+ onClose: () => void;
7
+ onStartChat: (targetUserId: string) => void;
8
+ }
9
+ /** The account-info dialog both chat screens open from an avatar. Rendered from the screen
10
+ * rather than the message list because it outlives whichever conversation is on screen. */
11
+ export declare function WorkspaceUserProfileModal({ profileUserId, conversation, currentUserId, onClose, onStartChat, }: WorkspaceUserProfileModalProps): import("react/jsx-runtime").JSX.Element | null;
12
+ export {};
@@ -1,4 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ interface ConversationSidebarProps {
3
+ headerAction?: ReactNode;
4
+ footerAction?: ReactNode;
5
+ /** Avatar-only rail: rows carry no visible name, so each one needs a hover title. */
6
+ isCompact?: boolean;
7
+ }
1
8
  /** Left rail listing conversations with search, unread filter, and creation entry. Owns the
2
9
  * search/filter state shared by its filter row and list, and the conversation feed itself —
3
10
  * its 3 sub-parts (header-infor, filter, conversation-list) are otherwise independent. */
4
- export declare function ConversationSidebar(): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ConversationSidebar({ headerAction, footerAction, isCompact, }?: ConversationSidebarProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -5,10 +5,12 @@ interface SidbarConversationListProps {
5
5
  error: string;
6
6
  currentUserId: string | null;
7
7
  activeConversationId: string | undefined;
8
- buildConversationPath: (targetId: string) => string;
8
+ isCompact?: boolean;
9
+ buildConversationPath?: (targetId: string) => string;
10
+ onSelectConversation: (conversation: Conversation) => void;
9
11
  onTogglePin: (conversationId: string, nextPinned: boolean) => void;
10
12
  onClearConversation: (conversationId: string) => Promise<boolean>;
11
13
  }
12
14
  /** The scrollable list of conversation rows — already-filtered input in, Link rows out. */
13
- export declare function SidbarConversationList({ conversations, isLoading, error, currentUserId, activeConversationId, buildConversationPath, onTogglePin, onClearConversation, }: SidbarConversationListProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function SidbarConversationList({ conversations, isLoading, error, currentUserId, activeConversationId, isCompact, buildConversationPath, onSelectConversation, onTogglePin, onClearConversation, }: SidbarConversationListProps): import("react/jsx-runtime").JSX.Element;
14
16
  export {};
@@ -1,4 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ interface SidebarHeaderInforProps {
3
+ trailingAction?: ReactNode;
4
+ }
1
5
  /** Current-user identity block at the top of the sidebar: avatar, name, work info, and
2
- * the entry point into the user's own profile modal. Fully self-contained — reads the
3
- * authenticated user straight from the auth store, no props needed. */
4
- export declare function SidebarHeaderInfor(): import("react/jsx-runtime").JSX.Element;
6
+ * the entry point into the user's own profile modal. Reads the authenticated user
7
+ * straight from the auth store; the optional trailing slot carries a host control (the
8
+ * widget's close button) that has to sit on this row. */
9
+ export declare function SidebarHeaderInfor({ trailingAction }?: SidebarHeaderInforProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};