@medipha/chat 1.0.61 → 1.0.63

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 (36) hide show
  1. package/README.md +2 -0
  2. package/dist/dashboard/dashboard-module.d.ts +1 -1
  3. package/dist/dashboard/dashboard-module.types.d.ts +2 -5
  4. package/dist/features/composer/conversation-composer.d.ts +4 -0
  5. package/dist/features/composer/sticker/sticker-icon.d.ts +1 -0
  6. package/dist/features/composer/sticker/sticker-picker-button.d.ts +10 -0
  7. package/dist/features/composer/toolbar/composer-toolbar.d.ts +9 -3
  8. package/dist/features/message-list/bubble/message-bubble.d.ts +2 -1
  9. package/dist/features/message-list/bubble/message-content-body.d.ts +2 -1
  10. package/dist/features/stickers/sticker-keyword.d.ts +3 -0
  11. package/dist/features/stickers/sticker-label.d.ts +1 -0
  12. package/dist/features/stickers/sticker-message.d.ts +8 -0
  13. package/dist/features/stickers/sticker-picker/sticker-pack-section.d.ts +11 -0
  14. package/dist/features/stickers/sticker-picker/sticker-pack-tab-bar.d.ts +9 -0
  15. package/dist/features/stickers/sticker-picker/sticker-picker-panel.d.ts +8 -0
  16. package/dist/features/stickers/sticker-picker/use-active-sticker-section.d.ts +6 -0
  17. package/dist/features/stickers/sticker-picker/use-recent-stickers.d.ts +2 -0
  18. package/dist/features/stickers/sticker-sprite.d.ts +9 -0
  19. package/dist/features/stickers/sticker-storage.d.ts +2 -0
  20. package/dist/features/stickers/sticker-store.d.ts +15 -0
  21. package/dist/features/stickers/sticker-suggestion-bar.d.ts +9 -0
  22. package/dist/features/stickers/use-sticker-keyword-suggestions.d.ts +13 -0
  23. package/dist/features/stickers/use-sticker-playback.d.ts +2 -0
  24. package/dist/index.cjs +67 -66
  25. package/dist/index.js +11503 -10433
  26. package/dist/module/chat-module.types.d.ts +1 -0
  27. package/dist/module/session/chat-api-connection.d.ts +8 -0
  28. package/dist/module/session/chat-session.d.ts +2 -5
  29. package/dist/pages/conversation/conversation-detail/conversation-detail.d.ts +1 -0
  30. package/dist/pages/conversation/conversation-footer/conversation-footer.d.ts +1 -0
  31. package/dist/shared/components/user-profile-modal.d.ts +4 -4
  32. package/dist/shared/hooks/use-dismiss-on-outside-click.d.ts +9 -0
  33. package/dist/styles.css +1 -1
  34. package/dist/utils/chat.d.ts +2 -1
  35. package/package.json +2 -2
  36. package/dist/features/composer/stickers.d.ts +0 -6
package/README.md CHANGED
@@ -29,6 +29,7 @@ import '@medipha/chat/styles.css';
29
29
  expireTime={expireTime}
30
30
  apiUrl={CHAT_API_URL}
31
31
  socketUrl={CHAT_SOCKET_URL}
32
+ stickerBaseUrl={process.env.REACT_APP_CHAT_STICKER_MANIFEST_URL}
32
33
  hasAddGroupVerified={permissions.addGroupVerified}
33
34
  hasUpdateGroupVerified={permissions.updateGroupVerified}
34
35
  hasDeleteGroupVerified={permissions.deleteGroupVerified}
@@ -53,6 +54,7 @@ relative routes: `/chat-erp` for the conversation list and
53
54
  | `expireTime` | Yes | Token expiry as epoch seconds for media upload checks. |
54
55
  | `apiUrl` | Yes | Base URL for the Chat HTTP API. |
55
56
  | `socketUrl` | Yes | Socket server URL. |
57
+ | `stickerBaseUrl` | No | Sticker media root folder, e.g. `https://media-dev.meditech.vn/images/chat-med`. Not a manifest file URL. Without it, stickers do not load. |
56
58
  | `hasAddGroupVerified` | Yes | May the user create a verified ("tích xanh") group. |
57
59
  | `hasUpdateGroupVerified` | Yes | May the user rename/re-avatar a verified group. |
58
60
  | `hasDeleteGroupVerified` | Yes | May the user disband a verified group. |
@@ -1,2 +1,2 @@
1
1
  import { DashboardModuleProps } from './dashboard-module.types';
2
- export declare function DashboardModule({ accessToken, apiUrl, canViewDashboard, dataSource, onOpenUser, onUnauthorized, onRefreshToken, }: DashboardModuleProps): import('react/jsx-runtime').JSX.Element;
2
+ export declare function DashboardModule({ accessToken, apiUrl, stickerBaseUrl, canViewDashboard, dataSource, onOpenUser, onUnauthorized, onRefreshToken, }: DashboardModuleProps): import('react/jsx-runtime').JSX.Element;
@@ -1,10 +1,7 @@
1
+ import { ChatApiConnectionConfig } from '../module/session/chat-api-connection';
1
2
  import { DashboardDataSource } from './dashboard.types';
2
- export interface DashboardModuleProps {
3
- accessToken: string;
4
- apiUrl: string;
3
+ export interface DashboardModuleProps extends ChatApiConnectionConfig {
5
4
  canViewDashboard: boolean;
6
5
  dataSource?: DashboardDataSource;
7
6
  onOpenUser?: (userId: string) => void;
8
- onUnauthorized?: () => void;
9
- onRefreshToken?: () => Promise<string>;
10
7
  }
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ChatUser, MessageContent } from '../../utils/chat';
3
+ import { StickerFrameAsset } from '@medipha/chat-core';
3
4
  interface ConversationComposerProps {
4
5
  draftKey?: string;
5
6
  conversationName: string;
@@ -19,9 +20,12 @@ interface ConversationComposerProps {
19
20
  replySlot?: ReactNode;
20
21
  onTypingStart?: () => void;
21
22
  onTypingStop?: () => void;
23
+ onSelectSticker?: (sticker: StickerFrameAsset) => boolean;
24
+ disableStickerSuggestions?: boolean;
22
25
  }
23
26
  export interface ConversationComposerHandle {
24
27
  focus: () => void;
28
+ openStickerPack: (packSlug: string) => void;
25
29
  insertMentionAtStart: (userId: string, fallbackName: string) => void;
26
30
  /** Undoes the above when the reply is cancelled, leaving whatever else was typed. */
27
31
  removeMentionAtStart: (userId: string) => void;
@@ -0,0 +1 @@
1
+ export declare function StickerIcon(): import('react/jsx-runtime').JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ interface StickerPickerButtonProps {
3
+ onSelectSticker: (sticker: StickerFrameAsset) => boolean;
4
+ isCompact?: boolean;
5
+ }
6
+ export interface StickerPickerButtonHandle {
7
+ openPack: (packSlug: string) => void;
8
+ }
9
+ export declare const StickerPickerButton: import('react').ForwardRefExoticComponent<StickerPickerButtonProps & import('react').RefAttributes<StickerPickerButtonHandle>>;
10
+ export {};
@@ -1,5 +1,7 @@
1
1
  import { Editor } from '@tiptap/core';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, RefObject } from 'react';
3
+ import { StickerPickerButtonHandle } from '../sticker/sticker-picker-button';
4
+ import { StickerFrameAsset } from '@medipha/chat-core';
3
5
  interface ComposerToolbarProps {
4
6
  editor: Editor | null | undefined;
5
7
  onAttach?: () => void;
@@ -14,9 +16,13 @@ interface ComposerToolbarProps {
14
16
  isCollapsed?: boolean;
15
17
  onExpand?: () => void;
16
18
  showEmojiButton?: boolean;
19
+ onSelectSticker?: (sticker: StickerFrameAsset) => boolean;
20
+ showStickerButton?: boolean;
21
+ stickerPickerRef?: RefObject<StickerPickerButtonHandle>;
22
+ stickerPickerKey?: string;
17
23
  }
18
- /** Composer toolbar row: attach file/image, the "Định dạng" toggle, the emoji picker, and
24
+ /** Composer toolbar row: attach file/image, the "Định dạng" toggle, the emoji and sticker pickers, and
19
25
  * the "..." more menu — plus the format bar it reveals underneath when toggled open. Each
20
26
  * button's own popover/panel lives in its own feature folder; this just arranges them. */
21
- export declare function ComposerToolbar({ editor, onAttach, onAttachImages, isFormatOpen, onToggleFormat, isEnlarged, onToggleEnlarged, sendButton, isCollapsed, onExpand, showEmojiButton, }: ComposerToolbarProps): import('react/jsx-runtime').JSX.Element;
27
+ export declare function ComposerToolbar({ editor, onAttach, onAttachImages, isFormatOpen, onToggleFormat, isEnlarged, onToggleEnlarged, sendButton, isCollapsed, onExpand, showEmojiButton, onSelectSticker, showStickerButton, stickerPickerRef, stickerPickerKey, }: ComposerToolbarProps): import('react/jsx-runtime').JSX.Element;
22
28
  export {};
@@ -40,6 +40,7 @@ export interface MessageBubbleProps {
40
40
  onOpenMentionCard: (userId: string, fallbackName?: string) => void;
41
41
  onOpenSystemMembers: (messageId: string, totalCount: number, actionLabel: string) => void;
42
42
  onOpenImageLightbox: (sources: MediaPreviewSource[], index: number) => void;
43
+ onOpenStickerPack?: (packSlug: string) => void;
43
44
  onImageSettled: () => void;
44
45
  onRetry: () => void;
45
46
  /** Failed send never reached the server (no `id`) — this is a local-only delete, not a recall. */
@@ -54,4 +55,4 @@ export interface MessageBubbleProps {
54
55
  /** Renders one message: day divider, SYSTEM notice, reply/forward context, bubble body
55
56
  * (delegated to MessageContentBody), reaction badge/picker (MessageReactions), action buttons
56
57
  * and options menu (MessageActionsMenu), and the trailing timestamp/status/retry. */
57
- 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;
58
+ 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, onOpenStickerPack, onImageSettled, onRetry, onDeleteFailed, isSenderGroupOwner, resolveUserAvatar, onOpenUserProfile, }: MessageBubbleProps): import('react/jsx-runtime').JSX.Element;
@@ -6,8 +6,9 @@ interface MessageContentBodyProps {
6
6
  onOpenImageLightbox: (sources: MediaPreviewSource[], index: number) => void;
7
7
  onImageSettled: () => void;
8
8
  onOpenMentionCard: (userId: string, fallbackName?: string) => void;
9
+ onOpenStickerPack?: (packSlug: string) => void;
9
10
  }
10
11
  /** The bubble's inner content: image grid, document attachment(s), or marked-up text
11
12
  * with clickable links/mentions — whichever the message type calls for. */
12
- export declare function MessageContentBody({ message, isLatestMessage, onOpenImageLightbox, onImageSettled, onOpenMentionCard, }: MessageContentBodyProps): import('react/jsx-runtime').JSX.Element;
13
+ export declare function MessageContentBody({ message, isLatestMessage, onOpenImageLightbox, onImageSettled, onOpenMentionCard, onOpenStickerPack, }: MessageContentBodyProps): import('react/jsx-runtime').JSX.Element;
13
14
  export {};
@@ -0,0 +1,3 @@
1
+ import { StickerManifest } from '@medipha/chat-core';
2
+ export declare function listStickerKeywords(manifest: StickerManifest): string[];
3
+ export declare function findStickerKeywordForComposerText(composerText: string, stickerKeywords: string[]): string | null;
@@ -0,0 +1 @@
1
+ export declare const STICKER_LABEL = "[Sticker]";
@@ -0,0 +1,8 @@
1
+ import { StickerId } from '@medipha/chat-core';
2
+ export declare const STICKER_MESSAGE_SIZE = 130;
3
+ interface StickerMessageProps {
4
+ stickerId: StickerId | null | undefined;
5
+ onOpenPack?: (packSlug: string) => void;
6
+ }
7
+ export declare function StickerMessage({ stickerId, onOpenPack }: StickerMessageProps): import('react/jsx-runtime').JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ export declare const STICKER_PICKER_CELL_SIZE = 65;
3
+ interface StickerPackSectionProps {
4
+ sectionId: string;
5
+ title: string;
6
+ stickers: StickerFrameAsset[];
7
+ placeholderCount: number;
8
+ onSelectSticker: (sticker: StickerFrameAsset) => void;
9
+ }
10
+ export declare function StickerPackSection({ sectionId, title, stickers, placeholderCount, onSelectSticker, }: StickerPackSectionProps): import('react/jsx-runtime').JSX.Element;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import { StickerPack } from '@medipha/chat-core';
2
+ export declare const RECENT_STICKER_SECTION_ID = "recent";
3
+ interface StickerPackTabBarProps {
4
+ packs: StickerPack[];
5
+ activeSectionId: string | null;
6
+ onSelectSection: (sectionId: string) => void;
7
+ }
8
+ export declare function StickerPackTabBar({ packs, activeSectionId, onSelectSection, }: StickerPackTabBarProps): import('react/jsx-runtime').JSX.Element;
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ interface StickerPickerPanelProps {
3
+ onSelectSticker: (sticker: StickerFrameAsset) => void;
4
+ onClose: () => void;
5
+ initialPackSlug?: string;
6
+ }
7
+ export declare function StickerPickerPanel({ onSelectSticker, onClose, initialPackSlug, }: StickerPickerPanelProps): import('react/jsx-runtime').JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import { RefObject } from 'react';
2
+ export declare const getStickerSectionElementId: (sectionId: string) => string;
3
+ export declare function useActiveStickerSection(scrollContainerRef: RefObject<HTMLElement>, sectionIds: string[]): {
4
+ activeSectionId: string | null;
5
+ scrollToSection: (sectionId: string) => void;
6
+ };
@@ -0,0 +1,2 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ export declare function useRecentStickers(): StickerFrameAsset[];
@@ -0,0 +1,9 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ export declare const STICKER_LOOP_PLAY_COUNT = 5;
3
+ interface StickerSpriteProps {
4
+ asset: StickerFrameAsset | null;
5
+ size: number;
6
+ className?: string;
7
+ }
8
+ export declare function StickerSprite({ asset, size, className }: StickerSpriteProps): import('react/jsx-runtime').JSX.Element;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import { StickerManifestStorage } from '@medipha/chat-core';
2
+ export declare const browserStickerManifestStorage: StickerManifestStorage;
@@ -0,0 +1,15 @@
1
+ import { LoadedStickerPack, StickerFrameAsset, StickerId, StickerManifest } from '@medipha/chat-core';
2
+ interface StickerState {
3
+ manifest: StickerManifest | null;
4
+ manifestVersion: number;
5
+ loadedPacksBySlug: Record<string, LoadedStickerPack>;
6
+ recentScopeKey: string | null;
7
+ recentStickerIds: StickerId[];
8
+ loadStickerManifest: (userId: string) => Promise<void>;
9
+ scanStickerPacks: () => Promise<void>;
10
+ getStickerSuggestions: (keyword: string) => Promise<StickerFrameAsset[]>;
11
+ resolveSticker: (stickerId: StickerId) => Promise<StickerFrameAsset | null>;
12
+ refreshRecentStickers: (userId: string) => void;
13
+ }
14
+ export declare const useStickerStore: import('zustand').UseBoundStore<import('zustand').StoreApi<StickerState>>;
15
+ export {};
@@ -0,0 +1,9 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ export declare const STICKER_SUGGESTION_SIZE = 64;
3
+ interface StickerSuggestionBarProps {
4
+ suggestions: StickerFrameAsset[];
5
+ onSelectSticker: (sticker: StickerFrameAsset) => void;
6
+ onDismiss: () => void;
7
+ }
8
+ export declare function StickerSuggestionBar({ suggestions, onSelectSticker, onDismiss, }: StickerSuggestionBarProps): import('react/jsx-runtime').JSX.Element;
9
+ export {};
@@ -0,0 +1,13 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { StickerFrameAsset } from '@medipha/chat-core';
3
+ interface StickerKeywordSuggestionsOptions {
4
+ editor: Editor | null;
5
+ isDisabled: boolean;
6
+ isMentionMenuOpen: () => boolean;
7
+ }
8
+ export interface StickerKeywordSuggestions {
9
+ suggestions: StickerFrameAsset[];
10
+ dismiss: () => void;
11
+ }
12
+ export declare function useStickerKeywordSuggestions({ editor, isDisabled, isMentionMenuOpen, }: StickerKeywordSuggestionsOptions): StickerKeywordSuggestions;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RefObject } from 'react';
2
+ export declare function useStickerPlayback(stickerElementRef: RefObject<HTMLElement>): boolean;