@satek-team-intern/chatbot-widget 0.11.2 → 0.11.3

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 (101) hide show
  1. package/dist/constants/scenario_guest_vi.json.d.ts +103 -0
  2. package/dist/locales/en.json.d.ts +331 -0
  3. package/dist/locales/vi.json.d.ts +332 -0
  4. package/dist/src/assets/Icons.d.ts +67 -0
  5. package/dist/src/assets/createIcon.d.ts +24 -0
  6. package/dist/src/assets/index.d.ts +2 -0
  7. package/dist/src/components/ChatWidget.d.ts +3 -0
  8. package/dist/src/components/ChatWindow.d.ts +3 -0
  9. package/dist/src/components/FloatingButton.d.ts +1 -0
  10. package/dist/src/components/account/MultiChatManager.d.ts +6 -0
  11. package/dist/src/components/account/index.d.ts +1 -0
  12. package/dist/src/components/index.d.ts +8 -0
  13. package/dist/src/components/modals/AddGroup.d.ts +6 -0
  14. package/dist/src/components/modals/AddMember.d.ts +6 -0
  15. package/dist/src/components/modals/FileViewer.d.ts +10 -0
  16. package/dist/src/components/modals/UpdateGroup.d.ts +8 -0
  17. package/dist/src/components/modals/UserProfileModal.d.ts +1 -0
  18. package/dist/src/components/modals/index.d.ts +5 -0
  19. package/dist/src/components/shared/AvatarFallBack.d.ts +5 -0
  20. package/dist/src/components/shared/OnboardingFormBlock.d.ts +10 -0
  21. package/dist/src/components/shared/QuickReplyButton.d.ts +13 -0
  22. package/dist/src/components/shared/ToastContainer.d.ts +2 -0
  23. package/dist/src/components/shared/index.d.ts +4 -0
  24. package/dist/src/components/sidebar/AppSideBar.d.ts +1 -0
  25. package/dist/src/components/sidebar/ChatInfoPanel.d.ts +10 -0
  26. package/dist/src/components/sidebar/ChatList.d.ts +7 -0
  27. package/dist/src/components/sidebar/ChatSearchBar.d.ts +9 -0
  28. package/dist/src/components/sidebar/ChatSidebar.d.ts +9 -0
  29. package/dist/src/components/sidebar/index.d.ts +5 -0
  30. package/dist/src/components/view/ChatHeader.d.ts +10 -0
  31. package/dist/src/components/view/ChatInput.d.ts +4 -0
  32. package/dist/src/components/view/ChatListItem.d.ts +7 -0
  33. package/dist/src/components/view/ChatMainArea.d.ts +9 -0
  34. package/dist/src/components/view/ChatMainHeader.d.ts +6 -0
  35. package/dist/src/components/view/ChatliveSetting.d.ts +1 -0
  36. package/dist/src/components/view/ContactList.d.ts +6 -0
  37. package/dist/src/components/view/EmptyChatState.d.ts +1 -0
  38. package/dist/src/components/view/FileIconMap.d.ts +8 -0
  39. package/dist/src/components/view/GroupList.d.ts +9 -0
  40. package/dist/src/components/view/ImageFileItem.d.ts +10 -0
  41. package/dist/src/components/view/MessageFiles.d.ts +23 -0
  42. package/dist/src/components/view/MessageItem.d.ts +7 -0
  43. package/dist/src/components/view/MessageList.d.ts +2 -0
  44. package/dist/src/components/view/SettingSection.d.ts +1 -0
  45. package/dist/src/components/view/ThemeSetting.d.ts +1 -0
  46. package/dist/src/components/view/WindowResizeHandles.d.ts +6 -0
  47. package/dist/src/components/view/index.d.ts +16 -0
  48. package/dist/src/config/configEnv.d.ts +11 -0
  49. package/dist/src/constants/common.d.ts +15 -0
  50. package/dist/src/constants/file.d.ts +3 -0
  51. package/dist/src/constants/index.d.ts +6 -0
  52. package/dist/src/constants/onboarding.d.ts +4 -0
  53. package/dist/src/constants/permissionRules.d.ts +25 -0
  54. package/dist/src/constants/permissions.d.ts +15 -0
  55. package/dist/src/contexts/FileViewerContext.d.ts +14 -0
  56. package/dist/src/contexts/ToastContext.d.ts +4 -0
  57. package/dist/src/contexts/index.d.ts +3 -0
  58. package/dist/src/contexts/toast-context.d.ts +16 -0
  59. package/dist/src/hooks/index.d.ts +13 -0
  60. package/dist/src/hooks/useChat.d.ts +2 -0
  61. package/dist/src/hooks/useChatActions.d.ts +9 -0
  62. package/dist/src/hooks/useChatSearch.d.ts +27 -0
  63. package/dist/src/hooks/useChatWidget.d.ts +4 -0
  64. package/dist/src/hooks/useDragDropFiles.d.ts +12 -0
  65. package/dist/src/hooks/useFileViewer.d.ts +2 -0
  66. package/dist/src/hooks/usePermissions.d.ts +9 -0
  67. package/dist/src/hooks/useProcessOnboarding.d.ts +3 -0
  68. package/dist/src/hooks/useSetting.d.ts +8 -0
  69. package/dist/src/hooks/useToast.d.ts +1 -0
  70. package/dist/src/hooks/useTranslation.d.ts +5 -0
  71. package/dist/src/hooks/useVoiceRecorder.d.ts +14 -0
  72. package/dist/src/hooks/useWindowControls.d.ts +14 -0
  73. package/dist/src/locales/index.d.ts +3 -0
  74. package/dist/src/services/chat.service.d.ts +42 -0
  75. package/dist/src/services/chatManager.service.d.ts +16 -0
  76. package/dist/src/services/index.d.ts +3 -0
  77. package/dist/src/services/language.service.d.ts +18 -0
  78. package/dist/src/store/index.d.ts +3 -0
  79. package/dist/src/store/selectors/chat.d.ts +5 -0
  80. package/dist/src/store/selectors/index.d.ts +2 -0
  81. package/dist/src/store/selectors/setting.d.ts +4 -0
  82. package/dist/src/store/slices/chatSlice.d.ts +128 -0
  83. package/dist/src/store/slices/index.d.ts +4 -0
  84. package/dist/src/store/slices/layoutSlice.d.ts +12 -0
  85. package/dist/src/store/slices/onboardingSlice.d.ts +15 -0
  86. package/dist/src/store/slices/settingSlice.d.ts +16 -0
  87. package/dist/src/store/store.d.ts +20 -0
  88. package/dist/src/types/chat.type.d.ts +370 -0
  89. package/dist/src/types/index.d.ts +4 -0
  90. package/dist/src/types/layout.type.d.ts +13 -0
  91. package/dist/src/types/onboarding.type.d.ts +45 -0
  92. package/dist/{index.d.ts → src/types/types.d.ts} +74 -91
  93. package/dist/src/utils/chat.utils.d.ts +30 -0
  94. package/dist/src/utils/engine.utils.d.ts +5 -0
  95. package/dist/src/utils/file.utils.d.ts +18 -0
  96. package/dist/src/utils/format.utils.d.ts +7 -0
  97. package/dist/src/utils/index.d.ts +7 -0
  98. package/dist/src/utils/text.utils.d.ts +1 -0
  99. package/dist/src/utils/validate.utils.d.ts +1 -0
  100. package/dist/src/utils/voice.utils.d.ts +1 -0
  101. package/package.json +1 -1
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ interface ChatHeaderProps {
3
+ title?: string;
4
+ logoUrl?: string;
5
+ onBack: () => void;
6
+ onAddMemberClick?: () => void;
7
+ onOpenSettings?: () => void;
8
+ }
9
+ export declare const ChatHeader: FC<ChatHeaderProps>;
10
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface ChatInputHandle {
2
+ processPastedFiles: (files: FileList) => void;
3
+ }
4
+ export declare const ChatInput: import('react').ForwardRefExoticComponent<import('react').RefAttributes<ChatInputHandle>>;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ import { ChatConversation } from '../../../types';
3
+ interface ChatListItemProps {
4
+ chat: ChatConversation;
5
+ }
6
+ export declare const ChatListItem: FC<ChatListItemProps>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import { RefObject } from 'react';
2
+ import { ChatInputHandle } from '../../../components';
3
+ interface ChatMainAreaProps {
4
+ isInfoSidebarOpen: boolean;
5
+ setIsInfoSidebarOpen: (isOpen: boolean) => void;
6
+ chatInputRef: RefObject<ChatInputHandle | null>;
7
+ }
8
+ export declare const ChatMainArea: ({ isInfoSidebarOpen, setIsInfoSidebarOpen, chatInputRef, }: ChatMainAreaProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,6 @@
1
+ interface ChatMainHeaderProps {
2
+ isInfoSidebarOpen: boolean;
3
+ setIsInfoSidebarOpen: (isOpen: boolean) => void;
4
+ }
5
+ export declare const ChatMainHeader: ({ isInfoSidebarOpen, setIsInfoSidebarOpen, }: ChatMainHeaderProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1 @@
1
+ export declare const ChatLiveSetting: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ interface ContactListProps {
3
+ onMessageClick: (memberId?: string) => void;
4
+ }
5
+ export declare const ContactList: FC<ContactListProps>;
6
+ export {};
@@ -0,0 +1 @@
1
+ export declare const EmptyChatState: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { JSX } from 'react';
2
+ /**
3
+ * Lấy icon dựa trên tên file hoặc extension
4
+ * @param fileNameOrExt Có thể là "image.png" hoặc chỉ "png"
5
+ */
6
+ export declare const FileIconMap: ({ fileNameOrExt, }: {
7
+ fileNameOrExt: string;
8
+ }) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ import { ChatConversation } from '../../../types';
3
+ interface GroupListProps {
4
+ groups: ChatConversation[];
5
+ onGroupClick: (group: ChatConversation) => void;
6
+ onCreateGroupModalOpen: () => void;
7
+ }
8
+ export declare const GroupList: FC<GroupListProps>;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ChatFile } from '../../../types';
2
+ interface ImageFileItemProps {
3
+ file: ChatFile;
4
+ displayedImages: ChatFile[];
5
+ hasMoreImages: boolean;
6
+ remainingImagesCount: number;
7
+ handleImageClick: (file: ChatFile) => void;
8
+ }
9
+ export declare const ImageFileItem: ({ file, displayedImages, hasMoreImages, remainingImagesCount, handleImageClick, }: ImageFileItemProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import { FC, ReactNode, MouseEvent, CSSProperties } from 'react';
2
+ import { ChatFile } from '../../../types';
3
+ interface MessageFilesProps {
4
+ files?: ChatFile[];
5
+ }
6
+ interface FileWrapperProps {
7
+ file: ChatFile;
8
+ children: ReactNode;
9
+ className?: string;
10
+ isLink?: boolean;
11
+ handleImageClick?: (file: ChatFile) => void;
12
+ style?: CSSProperties;
13
+ }
14
+ export declare const FileWrapper: ({ file, children, className, isLink, handleImageClick, style, }: FileWrapperProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const DefaultFileUI: ({ file, handleDownload, }: {
16
+ file: ChatFile;
17
+ handleDownload: (e: MouseEvent, file: ChatFile) => void;
18
+ }) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const AudioFileItem: ({ file }: {
20
+ file: ChatFile;
21
+ }) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const MessageFiles: FC<MessageFilesProps>;
23
+ export {};
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ import { ChatMessage } from '../../../types';
3
+ interface MessageItemProps {
4
+ message: ChatMessage;
5
+ }
6
+ export declare const MessageItem: FC<MessageItemProps>;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const MessageList: FC<object>;
@@ -0,0 +1 @@
1
+ export declare const SettingSection: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ThemeSetting: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { MouseEvent } from 'react';
2
+ interface WindowResizeHandlesProps {
3
+ onResizeMouseDown: (e: MouseEvent<HTMLDivElement, globalThis.MouseEvent>, direction: 'nw' | 'ne' | 'sw' | 'se' | 'n' | 's' | 'e' | 'w') => void;
4
+ }
5
+ export declare const WindowResizeHandles: ({ onResizeMouseDown, }: WindowResizeHandlesProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,16 @@
1
+ export * from './ChatHeader';
2
+ export * from './ChatInput';
3
+ export * from './ContactList';
4
+ export * from './GroupList';
5
+ export * from './MessageFiles';
6
+ export * from './MessageItem';
7
+ export * from './MessageList';
8
+ export * from './ChatListItem';
9
+ export * from './ImageFileItem';
10
+ export * from './ThemeSetting';
11
+ export * from './WindowResizeHandles';
12
+ export * from './EmptyChatState';
13
+ export * from './ChatMainHeader';
14
+ export * from './ChatMainArea';
15
+ export * from './ChatliveSetting';
16
+ export * from './SettingSection';
@@ -0,0 +1,11 @@
1
+ declare class Environment {
2
+ private static instance;
3
+ private config;
4
+ private constructor();
5
+ static getInstance(): Environment;
6
+ get chatKey(): string;
7
+ private get;
8
+ private validate;
9
+ }
10
+ export declare const env: Environment;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ import { ChatUser, LanguageOption } from '../../types';
2
+ export declare const COMMON_EMOJIS: string[];
3
+ export declare const COLOR_PRESETS: {
4
+ name: string;
5
+ className: string;
6
+ value: string;
7
+ dotClass: string;
8
+ }[];
9
+ export declare const EXTRACT_URL_REGEX: RegExp;
10
+ export declare const LOCAL_OR_IP_REGEX: RegExp;
11
+ export declare const GENERAL_URL_REGEX: RegExp;
12
+ export declare const MESSAGE_LIMIT = 500;
13
+ export declare const DEFAULT_LANGUAGE: LanguageOption;
14
+ export declare const SYSTEM_CHAT_ID = -100;
15
+ export declare const SYSTEM_CHAT_ACCOUNT: ChatUser;
@@ -0,0 +1,3 @@
1
+ export declare const MAX_FILE_SIZE: number;
2
+ export declare const MAX_FILES_COUNT = 20;
3
+ export declare const VIEWER_SUPPORTED_TYPES: string[];
@@ -0,0 +1,6 @@
1
+ export * from './file';
2
+ export * from './common';
3
+ export { default as scenarioGuest } from './scenario_guest_vi.json';
4
+ export * from './permissions';
5
+ export * from './permissionRules';
6
+ export * from './onboarding';
@@ -0,0 +1,4 @@
1
+ import { ChatMessage, ChatUser } from '../../types';
2
+ export declare const BotDefault: ChatUser;
3
+ export declare const BotMessageDefault: ChatMessage;
4
+ export declare const GuestDefault: ChatUser;
@@ -0,0 +1,25 @@
1
+ import { PERMISSIONS, PermissionType } from './permissions';
2
+ import { ChatSetting, WidgetRole } from '../../types';
3
+ import { FeatureSet } from '../../utils';
4
+ export interface PermissionContext {
5
+ role: WidgetRole;
6
+ featureSet: FeatureSet;
7
+ chatSetting: ChatSetting | undefined;
8
+ isAdmin: boolean;
9
+ isGuest: boolean;
10
+ hasMultipleLanguages?: boolean;
11
+ }
12
+ interface PermissionPayloadMap {
13
+ [PERMISSIONS.DELETE_MESSAGE]: {
14
+ messageCreatedTime: string;
15
+ };
16
+ [PERMISSIONS.REVOKE_MESSAGE]: {
17
+ messageCreatedTime: string;
18
+ };
19
+ }
20
+ export type GetPayload<T extends PermissionType> = T extends keyof PermissionPayloadMap ? PermissionPayloadMap[T] : undefined;
21
+ type PermissionRulesConfig = {
22
+ [K in PermissionType]: (ctx: PermissionContext, payload: GetPayload<K>) => boolean;
23
+ };
24
+ export declare const PERMISSION_RULES: PermissionRulesConfig;
25
+ export {};
@@ -0,0 +1,15 @@
1
+ export declare const PERMISSIONS: {
2
+ readonly DELETE_CHAT: "delete_chat";
3
+ readonly DELETE_MESSAGE: "delete_message";
4
+ readonly REVOKE_MESSAGE: "revoke_message";
5
+ readonly USE_VOICE: "use_voice";
6
+ readonly USE_IMAGE_ATTACHMENT: "use_image_attachment";
7
+ readonly USE_ATTACHMENT: "use_attachment";
8
+ readonly USE_MULTIPLE_ATTACHMENTS: "use_multiple_attachments";
9
+ readonly USE_GROUP_CHAT: "use_group_chat";
10
+ readonly CHANGE_COLOR: "change_color";
11
+ readonly USE_MULTIPLE_LANGUAGES: "use_multiple_languages";
12
+ readonly USE_DRAG_AND_DROP: "use_drag_and_drop";
13
+ readonly USE_RESIZE_WINDOW: "use_resize_window";
14
+ };
15
+ export type PermissionType = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
@@ -0,0 +1,14 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { ChatFile } from '../../types';
3
+ export interface FileViewerContextType {
4
+ isOpen: boolean;
5
+ files: ChatFile[];
6
+ initialIndex: number;
7
+ openViewer: (files: ChatFile[], initialIndex?: number) => void;
8
+ closeViewer: () => void;
9
+ }
10
+ declare const FileViewerContext: import('react').Context<FileViewerContextType | undefined>;
11
+ export { FileViewerContext };
12
+ export declare const FileViewerProvider: FC<{
13
+ children: ReactNode;
14
+ }>;
@@ -0,0 +1,4 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export declare const ToastProvider: FC<{
3
+ children: ReactNode;
4
+ }>;
@@ -0,0 +1,3 @@
1
+ export * from './FileViewerContext';
2
+ export * from './ToastContext';
3
+ export * from './toast-context';
@@ -0,0 +1,16 @@
1
+ export type ToastType = 'success' | 'error' | 'info' | 'warning';
2
+ export interface Toast {
3
+ id: string;
4
+ message: string;
5
+ type: ToastType;
6
+ isConfirm?: boolean;
7
+ onConfirm?: () => void;
8
+ onCancel?: () => void;
9
+ }
10
+ export interface ToastContextType {
11
+ showToast: (message: string, type?: ToastType) => void;
12
+ confirm: (message: string) => Promise<boolean>;
13
+ removeToast: (id: string) => void;
14
+ toasts: Toast[];
15
+ }
16
+ export declare const ToastContext: import('react').Context<ToastContextType | undefined>;
@@ -0,0 +1,13 @@
1
+ export * from './useChat';
2
+ export { useFileViewer } from './useFileViewer';
3
+ export { useDragDropFiles } from './useDragDropFiles';
4
+ export { useVoiceRecorder } from './useVoiceRecorder';
5
+ export { useTranslation } from './useTranslation';
6
+ export { useToast } from './useToast';
7
+ export { useSetting } from './useSetting';
8
+ export { useChatSearch } from './useChatSearch';
9
+ export { useWindowControls } from './useWindowControls';
10
+ export { useChatActions } from './useChatActions';
11
+ export { useChatWidget } from './useChatWidget';
12
+ export { useProcessOnboarding } from './useProcessOnboarding';
13
+ export { usePermissions } from './usePermissions';
@@ -0,0 +1,2 @@
1
+ import { UseChatOptions } from '../../types';
2
+ export declare const useChat: ({ chatKey, authInfo, scope, workspace, disabledMembers, isPrimary, }: UseChatOptions) => void;
@@ -0,0 +1,9 @@
1
+ import { ChatConversation } from '../../types';
2
+ export declare const useChatActions: ({ setIsModalOpen, setIsUpdateGroupOpen, setUpdatingGroup, }: {
3
+ setIsModalOpen: (isOpen: boolean) => void;
4
+ setIsUpdateGroupOpen: (isOpen: boolean) => void;
5
+ setUpdatingGroup: (chat: ChatConversation | null) => void;
6
+ }) => {
7
+ removeMember: (chatId: number, memberId: number) => Promise<void>;
8
+ handleCreateChat: (directMemberId: string) => Promise<void>;
9
+ };
@@ -0,0 +1,27 @@
1
+ import { ChatConversation, ChatFile, ChatMessage, ChatUser } from '../../types';
2
+ interface SearchChatConversation extends ChatConversation {
3
+ matchedMemberNames?: string[];
4
+ }
5
+ type ChatSearchResultType = {
6
+ filteredChat: ChatConversation[];
7
+ matchedMembers: never[];
8
+ matchedMessages: never[];
9
+ matchedFiles: never[];
10
+ totalMatchedFiles: number;
11
+ } | {
12
+ filteredChat: SearchChatConversation[];
13
+ matchedMembers: ChatUser[];
14
+ matchedMessages: {
15
+ chat: ChatConversation;
16
+ message: ChatMessage | null;
17
+ }[];
18
+ matchedFiles: {
19
+ chat: ChatConversation;
20
+ files: ChatFile[];
21
+ }[];
22
+ totalMatchedFiles: number;
23
+ };
24
+ export declare const useChatSearch: (deferredChatQuery: string, chatFilter: string) => {
25
+ searchResult: ChatSearchResultType;
26
+ };
27
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const useChatWidget: () => {
2
+ hostRef: import('react').RefObject<HTMLDivElement | null>;
3
+ container: HTMLDivElement | null;
4
+ };
@@ -0,0 +1,12 @@
1
+ import { DragEvent } from 'react';
2
+ interface DragDropFilesProps {
3
+ onFilesAdded: (files: FileList) => void;
4
+ }
5
+ export declare const useDragDropFiles: ({ onFilesAdded }: DragDropFilesProps) => {
6
+ isDragOver: boolean;
7
+ handleDragEnter: (e: DragEvent<HTMLDivElement>) => void;
8
+ handleDragOver: (e: DragEvent<HTMLDivElement>) => void;
9
+ handleDragLeave: (e: DragEvent<HTMLDivElement>) => void;
10
+ handleDrop: (e: DragEvent<HTMLDivElement>) => void;
11
+ };
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FileViewerContextType } from '../../contexts';
2
+ export declare const useFileViewer: () => FileViewerContextType;
@@ -0,0 +1,9 @@
1
+ import { GetPayload, PermissionType } from '../../constants';
2
+ interface WidgetSettings {
3
+ hasPermission: <T extends PermissionType>(type: T, ...args: GetPayload<T> extends undefined ? [] : [payload: GetPayload<T>]) => boolean;
4
+ acceptFilter: string;
5
+ isFileTypeAllowed: (file: File) => boolean;
6
+ isGuest: boolean;
7
+ }
8
+ export declare const usePermissions: () => WidgetSettings;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const useProcessOnboarding: () => {
2
+ processOnboardingStep: (userInput: string) => void;
3
+ };
@@ -0,0 +1,8 @@
1
+ import { AuthInfo, LanguageOption, PositionType, WidgetFeature, WidgetScope } from '../../types';
2
+ export declare const useSetting: (config?: {
3
+ scope?: WidgetScope;
4
+ features?: WidgetFeature;
5
+ language?: LanguageOption;
6
+ auth?: AuthInfo;
7
+ initPosition?: PositionType;
8
+ }) => void;
@@ -0,0 +1 @@
1
+ export declare const useToast: () => import('../../contexts').ToastContextType;
@@ -0,0 +1,5 @@
1
+ export declare const useTranslation: () => {
2
+ t: (path: import('../../services').NestedKeys<import('../../services').TranslationSchema>, params?: Record<string, string>) => string;
3
+ currentLanguage: import('../types').LanguageOption;
4
+ toggleChangeLanguage: () => void;
5
+ };
@@ -0,0 +1,14 @@
1
+ export interface VoiceRecorderState {
2
+ isRecording: boolean;
3
+ duration: number;
4
+ recordedFile: File | null;
5
+ error: string | null;
6
+ }
7
+ export interface VoiceRecorderHandle {
8
+ startRecording: () => Promise<void>;
9
+ stopRecording: () => Promise<File | null>;
10
+ cancelRecording: () => void;
11
+ playback: () => void;
12
+ clearRecording: () => void;
13
+ }
14
+ export declare const useVoiceRecorder: () => [VoiceRecorderState, VoiceRecorderHandle];
@@ -0,0 +1,14 @@
1
+ import { MouseEvent, RefObject } from 'react';
2
+ interface UseWindowControlsProps {
3
+ chatWindowRef: RefObject<HTMLDivElement | null>;
4
+ }
5
+ export declare const useWindowControls: (props: UseWindowControlsProps) => {
6
+ handleMouseDown: (e: MouseEvent<HTMLDivElement>) => void;
7
+ handleResizeMouseDown: (e: MouseEvent<HTMLDivElement>, direction: 'nw' | 'ne' | 'sw' | 'se' | 'n' | 's' | 'e' | 'w') => void;
8
+ toggleFullScreen: () => void;
9
+ safePos: {
10
+ x: number;
11
+ y: number;
12
+ } | null;
13
+ };
14
+ export {};
@@ -0,0 +1,3 @@
1
+ import { default as en } from './en.json';
2
+ import { default as vi } from './vi.json';
3
+ export { en, vi };
@@ -0,0 +1,42 @@
1
+ import { AuthInfo, ChatEventPayloads, ChatResponse, ChatConversation, ChatMessage, ChatConfig, PaginationInfo, MessageAction, ChatUser, ChatSetting } from '../../types';
2
+ export declare class ChatService {
3
+ private chatSDK;
4
+ accountCode: string;
5
+ constructor(accountCode: string);
6
+ init(workspace?: string): void;
7
+ get setting(): ChatSetting;
8
+ setAuth(data: AuthInfo): Promise<ChatUser>;
9
+ getAuth(): ChatUser | null;
10
+ clearAuth(): void;
11
+ setReceiver(data: ChatUser): Promise<ChatResponse<ChatUser>>;
12
+ getReceiver(): ChatUser | null;
13
+ clearReceiver(): void;
14
+ getMembers(chatId?: number | null, limit?: number, page?: number, include?: string): Promise<ChatResponse<ChatUser[]>>;
15
+ addMember(chatId: number, memberId: number): Promise<ChatResponse>;
16
+ removeMember(chatId: number, memberId: number): Promise<ChatResponse>;
17
+ getChats(limit?: number, page?: number): Promise<ChatResponse<ChatConversation[]> & {
18
+ pagination?: PaginationInfo;
19
+ }>;
20
+ findChatByReceiver(receiverId: number | string): Promise<ChatConversation | undefined>;
21
+ addChat(receiverId: number, content?: string): Promise<ChatResponse<ChatConversation>>;
22
+ addGroup(memberIds: number[], name: string, avatar?: string | File, userId?: number): Promise<ChatResponse<ChatConversation>>;
23
+ updateGroup(chatId: number, name: string, avatar?: string | File): Promise<ChatResponse<ChatConversation>>;
24
+ removeChat(chatId: number): Promise<ChatResponse>;
25
+ readChat(chatId: number): Promise<ChatResponse>;
26
+ unreadChat(chatId: number): Promise<ChatResponse>;
27
+ getMessages(chatId: number, limit?: number, page?: number): Promise<ChatResponse<ChatMessage[]> & {
28
+ pagination?: PaginationInfo;
29
+ }>;
30
+ addMessage(chatId: number, content?: string | null, files?: FileList | File[] | null, replyId?: number | null): Promise<ChatResponse<ChatMessage>>;
31
+ actionMessage(chatId: number, messageId: number, action: MessageAction): Promise<{
32
+ message_id: number;
33
+ member_id: number;
34
+ }>;
35
+ getSystemMessages(limit?: number, page?: number): Promise<ChatResponse<ChatMessage[]> & {
36
+ pagination?: PaginationInfo;
37
+ }>;
38
+ addEventListener<K extends keyof ChatEventPayloads>(event: K, listener: (data: K extends keyof ChatEventPayloads ? ChatEventPayloads[K] : unknown) => void): void;
39
+ removeEventListener<K extends keyof ChatEventPayloads>(event: K, listener?: (data: ChatEventPayloads[K]) => void): void;
40
+ runEvent<K extends keyof ChatEventPayloads>(name: K | string, data?: ChatEventPayloads[K]): void;
41
+ setConfig(config: ChatConfig): void;
42
+ }
@@ -0,0 +1,16 @@
1
+ import { ChatService } from '../../services';
2
+ declare class ChatServiceManager {
3
+ private static instance;
4
+ private chatKeys;
5
+ private services;
6
+ private scriptLoadPromise;
7
+ private constructor();
8
+ static getInstance(): ChatServiceManager;
9
+ loadSDK(chatKey: string): Promise<void>;
10
+ getOrCreateAccount(accountCode: string, chatKey: string, workspace?: string): Promise<ChatService>;
11
+ getAccount(accountCode?: string): ChatService | undefined;
12
+ removeAccount(accountCode: string): void;
13
+ getChatKey(accountCode: string): string;
14
+ }
15
+ export declare const chatManager: ChatServiceManager;
16
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './chatManager.service';
2
+ export * from './chat.service';
3
+ export * from './language.service';
@@ -0,0 +1,18 @@
1
+ import { en } from '../../locales';
2
+ import { LanguageOption } from '../../types';
3
+ export type TranslationSchema = typeof en;
4
+ export type NestedKeys<T> = T extends object ? {
5
+ [K in keyof T]: `${Exclude<K, symbol>}${'' | `.${NestedKeys<T[K]>}`}`;
6
+ }[keyof T] : '';
7
+ declare class TranslationManager {
8
+ private static instance;
9
+ private translations;
10
+ private currentLocale;
11
+ private constructor();
12
+ static getInstance(): TranslationManager;
13
+ get locale(): LanguageOption;
14
+ set locale(lang: LanguageOption);
15
+ t(path: NestedKeys<TranslationSchema>, params?: Record<string, string>): string;
16
+ }
17
+ export declare const lang: TranslationManager;
18
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './store';
2
+ export * from './slices';
3
+ export * from './selectors';
@@ -0,0 +1,5 @@
1
+ import { RootState } from '../../../store';
2
+ export declare const selectActiveAccountCode: (state: RootState) => string;
3
+ export declare const selectDefaultAccountCode: (state: RootState) => string;
4
+ export declare const selectChatAccount: (state: RootState) => import('../../../store').AccountChatState;
5
+ export declare const selectChatAccountConfig: (state: RootState) => import('../../types').UseChatOptions | undefined;
@@ -0,0 +1,2 @@
1
+ export * from './setting';
2
+ export * from './chat';
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../../store';
2
+ import { ChatDurationUnit } from '../../../types';
3
+ export declare const selectChatSettingByAccount: (state: RootState) => import('../../../types').ChatSetting | undefined;
4
+ export declare const getDurationInMs: (duration: number, unit: ChatDurationUnit) => number;