@medipha/chat 1.0.61 → 1.0.62

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 (32) 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 +3 -0
  5. package/dist/features/composer/sticker/sticker-icon.d.ts +1 -0
  6. package/dist/features/composer/sticker/sticker-picker-button.d.ts +7 -0
  7. package/dist/features/composer/toolbar/composer-toolbar.d.ts +5 -2
  8. package/dist/features/stickers/sticker-keyword.d.ts +3 -0
  9. package/dist/features/stickers/sticker-label.d.ts +1 -0
  10. package/dist/features/stickers/sticker-message.d.ts +7 -0
  11. package/dist/features/stickers/sticker-picker/sticker-pack-section.d.ts +11 -0
  12. package/dist/features/stickers/sticker-picker/sticker-pack-tab-bar.d.ts +9 -0
  13. package/dist/features/stickers/sticker-picker/sticker-picker-panel.d.ts +7 -0
  14. package/dist/features/stickers/sticker-picker/use-active-sticker-section.d.ts +6 -0
  15. package/dist/features/stickers/sticker-picker/use-recent-stickers.d.ts +2 -0
  16. package/dist/features/stickers/sticker-sprite.d.ts +9 -0
  17. package/dist/features/stickers/sticker-storage.d.ts +2 -0
  18. package/dist/features/stickers/sticker-store.d.ts +15 -0
  19. package/dist/features/stickers/sticker-suggestion-bar.d.ts +9 -0
  20. package/dist/features/stickers/use-sticker-keyword-suggestions.d.ts +13 -0
  21. package/dist/features/stickers/use-sticker-playback.d.ts +2 -0
  22. package/dist/index.cjs +67 -66
  23. package/dist/index.js +11342 -10310
  24. package/dist/module/chat-module.types.d.ts +1 -0
  25. package/dist/module/session/chat-api-connection.d.ts +8 -0
  26. package/dist/module/session/chat-session.d.ts +2 -5
  27. package/dist/shared/components/user-profile-modal.d.ts +4 -4
  28. package/dist/shared/hooks/use-dismiss-on-outside-click.d.ts +9 -0
  29. package/dist/styles.css +1 -1
  30. package/dist/utils/chat.d.ts +2 -1
  31. package/package.json +2 -2
  32. 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,6 +20,8 @@ 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;
@@ -0,0 +1 @@
1
+ export declare function StickerIcon(): import('react/jsx-runtime').JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ interface StickerPickerButtonProps {
3
+ onSelectSticker: (sticker: StickerFrameAsset) => boolean;
4
+ isCompact?: boolean;
5
+ }
6
+ export declare function StickerPickerButton({ onSelectSticker, isCompact }: StickerPickerButtonProps): import('react/jsx-runtime').JSX.Element;
7
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { Editor } from '@tiptap/core';
2
2
  import { ReactNode } from 'react';
3
+ import { StickerFrameAsset } from '@medipha/chat-core';
3
4
  interface ComposerToolbarProps {
4
5
  editor: Editor | null | undefined;
5
6
  onAttach?: () => void;
@@ -14,9 +15,11 @@ interface ComposerToolbarProps {
14
15
  isCollapsed?: boolean;
15
16
  onExpand?: () => void;
16
17
  showEmojiButton?: boolean;
18
+ onSelectSticker?: (sticker: StickerFrameAsset) => boolean;
19
+ showStickerButton?: boolean;
17
20
  }
18
- /** Composer toolbar row: attach file/image, the "Định dạng" toggle, the emoji picker, and
21
+ /** Composer toolbar row: attach file/image, the "Định dạng" toggle, the emoji and sticker pickers, and
19
22
  * the "..." more menu — plus the format bar it reveals underneath when toggled open. Each
20
23
  * 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;
24
+ export declare function ComposerToolbar({ editor, onAttach, onAttachImages, isFormatOpen, onToggleFormat, isEnlarged, onToggleEnlarged, sendButton, isCollapsed, onExpand, showEmojiButton, onSelectSticker, showStickerButton, }: ComposerToolbarProps): import('react/jsx-runtime').JSX.Element;
22
25
  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,7 @@
1
+ import { StickerId } from '@medipha/chat-core';
2
+ export declare const STICKER_MESSAGE_SIZE = 130;
3
+ interface StickerMessageProps {
4
+ stickerId: StickerId | null | undefined;
5
+ }
6
+ export declare function StickerMessage({ stickerId }: StickerMessageProps): import('react/jsx-runtime').JSX.Element;
7
+ 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,7 @@
1
+ import { StickerFrameAsset } from '@medipha/chat-core';
2
+ interface StickerPickerPanelProps {
3
+ onSelectSticker: (sticker: StickerFrameAsset) => void;
4
+ onClose: () => void;
5
+ }
6
+ export declare function StickerPickerPanel({ onSelectSticker, onClose }: StickerPickerPanelProps): import('react/jsx-runtime').JSX.Element;
7
+ 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;