@satek-team-intern/chatbot-widget 0.10.8 → 0.11.1
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.
- package/README.md +82 -32
- package/dist/assets/background_chatlive_setting.webp +0 -0
- package/dist/chatbot-widget.es.js +5636 -3926
- package/dist/chatbot-widget.umd.js +5 -21
- package/dist/constants/scenario_guest_vi.json.d.ts +103 -0
- package/dist/index.d.ts +1 -0
- package/dist/locales/en.json.d.ts +75 -7
- package/dist/locales/vi.json.d.ts +76 -8
- package/dist/src/assets/Icons.d.ts +67 -48
- package/dist/src/assets/createIcon.d.ts +5 -1
- package/dist/src/components/ChatWindow.d.ts +2 -31
- package/dist/src/components/FloatingButton.d.ts +1 -17
- package/dist/src/components/account/MultiChatManager.d.ts +6 -0
- package/dist/src/components/account/index.d.ts +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/modals/AddGroup.d.ts +0 -1
- package/dist/src/components/modals/AddMember.d.ts +0 -1
- package/dist/src/components/modals/UpdateGroup.d.ts +0 -2
- package/dist/src/components/modals/UserProfileModal.d.ts +1 -10
- package/dist/src/components/shared/AvatarFallBack.d.ts +2 -2
- package/dist/src/components/shared/OnboardingFormBlock.d.ts +10 -0
- package/dist/src/components/shared/QuickReplyButton.d.ts +13 -0
- package/dist/src/components/shared/index.d.ts +2 -1
- package/dist/src/components/sidebar/AppSideBar.d.ts +1 -4
- package/dist/src/components/sidebar/ChatInfoPanel.d.ts +0 -1
- package/dist/src/components/sidebar/ChatList.d.ts +0 -1
- package/dist/src/components/sidebar/ChatSearchBar.d.ts +0 -1
- package/dist/src/components/sidebar/ChatSidebar.d.ts +9 -0
- package/dist/src/components/sidebar/index.d.ts +1 -0
- package/dist/src/components/view/ChatHeader.d.ts +0 -4
- package/dist/src/components/view/ChatListItem.d.ts +1 -3
- package/dist/src/components/view/ChatMainArea.d.ts +9 -0
- package/dist/src/components/view/ChatMainHeader.d.ts +6 -0
- package/dist/src/components/view/ChatliveSetting.d.ts +1 -0
- package/dist/src/components/view/ContactList.d.ts +1 -1
- package/dist/src/components/view/EmptyChatState.d.ts +1 -0
- package/dist/src/components/view/FileIconMap.d.ts +8 -0
- package/dist/src/components/view/GroupList.d.ts +1 -0
- package/dist/src/components/view/ImageFileItem.d.ts +1 -1
- package/dist/src/components/view/MessageFiles.d.ts +3 -0
- package/dist/src/components/view/MessageItem.d.ts +1 -2
- package/dist/src/components/view/SettingSection.d.ts +1 -0
- package/dist/src/components/view/ThemeSetting.d.ts +1 -3
- package/dist/src/components/view/WindowResizeHandles.d.ts +6 -0
- package/dist/src/components/view/index.d.ts +6 -0
- package/dist/src/constants/common.d.ts +3 -1
- package/dist/src/constants/index.d.ts +4 -0
- package/dist/src/constants/onboarding.d.ts +4 -0
- package/dist/src/constants/permissionRules.d.ts +25 -0
- package/dist/src/constants/permissions.d.ts +15 -0
- package/dist/src/hooks/index.d.ts +7 -1
- package/dist/src/hooks/useChat.d.ts +2 -2
- package/dist/src/hooks/useChatActions.d.ts +9 -0
- package/dist/src/hooks/useChatSearch.d.ts +27 -0
- package/dist/src/hooks/useChatWidget.d.ts +4 -0
- package/dist/src/hooks/usePermissions.d.ts +9 -0
- package/dist/src/hooks/useProcessOnboarding.d.ts +3 -0
- package/dist/src/hooks/useSetting.d.ts +4 -1
- package/dist/src/hooks/useVoiceRecorder.d.ts +1 -1
- package/dist/src/hooks/useWindowControls.d.ts +14 -0
- package/dist/src/services/chat.service.d.ts +8 -9
- package/dist/src/services/chatManager.service.d.ts +16 -0
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/store/selectors/chat.d.ts +5 -0
- package/dist/src/store/selectors/index.d.ts +1 -0
- package/dist/src/store/selectors/setting.d.ts +3 -34
- package/dist/src/store/slices/chatSlice.d.ts +108 -5
- package/dist/src/store/slices/index.d.ts +2 -0
- package/dist/src/store/slices/layoutSlice.d.ts +12 -0
- package/dist/src/store/slices/onboardingSlice.d.ts +15 -0
- package/dist/src/store/slices/settingSlice.d.ts +5 -2
- package/dist/src/store/store.d.ts +5 -1
- package/dist/src/types/chat.type.d.ts +79 -6
- package/dist/src/types/index.d.ts +2 -0
- package/dist/src/types/layout.type.d.ts +13 -0
- package/dist/src/types/onboarding.type.d.ts +45 -0
- package/dist/src/types/types.d.ts +23 -10
- package/dist/src/utils/chat.utils.d.ts +7 -12
- package/dist/src/utils/engine.utils.d.ts +5 -0
- package/dist/src/utils/file.utils.d.ts +4 -6
- package/dist/src/utils/format.utils.d.ts +1 -1
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/text.utils.d.ts +1 -0
- package/package.json +2 -1
- package/dist/src/components/modals/AddChat.d.ts +0 -16
- package/dist/src/components/modals/ThemeModal.d.ts +0 -8
- package/dist/src/components/shared/ChatAvatar.d.ts +0 -5
- package/dist/src/components/shared/MemberAvatarFallBack.d.ts +0 -5
- package/dist/src/components/sidebar/SideBarInfoChat.d.ts +0 -11
- package/dist/src/styles/index.d.ts +0 -1
- package/dist/src/utils/formatDateLabel.d.ts +0 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ChatConversation } from '../../../types';
|
|
3
3
|
interface UpdateGroupProps {
|
|
4
|
-
isOpen: boolean;
|
|
5
4
|
onClose: () => void;
|
|
6
5
|
group: ChatConversation | null;
|
|
7
|
-
isPopup?: boolean;
|
|
8
6
|
}
|
|
9
7
|
export declare const UpdateGroup: FC<UpdateGroupProps>;
|
|
10
8
|
export {};
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ChatUser } from '../../../types';
|
|
3
|
-
interface UserProfileModalProps {
|
|
4
|
-
user: ChatUser;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
isOnline?: boolean;
|
|
7
|
-
onMessage: () => void;
|
|
8
|
-
}
|
|
9
|
-
export declare const UserProfileModal: FC<UserProfileModalProps>;
|
|
10
|
-
export {};
|
|
1
|
+
export declare const UserProfileModal: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormField } from '../../../types';
|
|
3
|
+
interface OnboardingFormBlockProps {
|
|
4
|
+
messageId: number;
|
|
5
|
+
fields: FormField[];
|
|
6
|
+
isAnswered: boolean;
|
|
7
|
+
submitLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const OnboardingFormBlock: FC<OnboardingFormBlockProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface Action {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
interface QuickReplyProps {
|
|
8
|
+
messageId: number;
|
|
9
|
+
actions: Action[];
|
|
10
|
+
isAnswered: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const QuickReplyButtons: FC<QuickReplyProps>;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export declare const AppSideBar: (
|
|
2
|
-
activeTab: "chats" | "contacts" | "settings";
|
|
3
|
-
setActiveTab: (tab: "chats" | "contacts" | "settings") => void;
|
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const AppSideBar: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,6 @@ interface SideBarInfoChatProps {
|
|
|
5
5
|
onAddMember: () => void;
|
|
6
6
|
onUpdateGroup?: (chat: ChatConversation) => void;
|
|
7
7
|
onRemoveMember?: (chatId: number, memberId: number) => void;
|
|
8
|
-
isPopup?: boolean;
|
|
9
8
|
}
|
|
10
9
|
declare const ChatInfoPanel: FC<SideBarInfoChatProps>;
|
|
11
10
|
export { ChatInfoPanel };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WidgetContactTab } from '../../../types';
|
|
2
|
+
interface ChatSidebarProps {
|
|
3
|
+
setContactTab: (tab: WidgetContactTab) => void;
|
|
4
|
+
contactTab: WidgetContactTab;
|
|
5
|
+
setIsModalOpen: (open: boolean) => void;
|
|
6
|
+
handleCreateChat: (memberId: string) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ChatSidebar: ({ setContactTab, contactTab, setIsModalOpen, handleCreateChat, }: ChatSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { WidgetMode } from '../../../types';
|
|
3
2
|
interface ChatHeaderProps {
|
|
4
|
-
mode: WidgetMode;
|
|
5
3
|
title?: string;
|
|
6
4
|
logoUrl?: string;
|
|
7
5
|
onBack: () => void;
|
|
8
|
-
onToggleMode: () => void;
|
|
9
|
-
onClose: () => void;
|
|
10
6
|
onAddMemberClick?: () => void;
|
|
11
7
|
onOpenSettings?: () => void;
|
|
12
8
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { ChatConversation
|
|
2
|
+
import { ChatConversation } from '../../../types';
|
|
3
3
|
interface ChatListItemProps {
|
|
4
4
|
chat: ChatConversation;
|
|
5
|
-
onSelectChat: (chat: ChatConversation) => void;
|
|
6
|
-
onAvatarClick: (user: ChatUser, isOnline: boolean) => void;
|
|
7
5
|
}
|
|
8
6
|
export declare const ChatListItem: FC<ChatListItemProps>;
|
|
9
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 @@
|
|
|
1
|
+
export declare const EmptyChatState: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,5 +16,8 @@ export declare const DefaultFileUI: ({ file, handleDownload, }: {
|
|
|
16
16
|
file: ChatFile;
|
|
17
17
|
handleDownload: (e: MouseEvent, file: ChatFile) => void;
|
|
18
18
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const AudioFileItem: ({ file }: {
|
|
20
|
+
file: ChatFile;
|
|
21
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
22
|
export declare const MessageFiles: FC<MessageFilesProps>;
|
|
20
23
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { ChatMessage
|
|
2
|
+
import { ChatMessage } from '../../../types';
|
|
3
3
|
interface MessageItemProps {
|
|
4
4
|
message: ChatMessage;
|
|
5
|
-
onHandleClick: (user: ChatUser) => void;
|
|
6
5
|
}
|
|
7
6
|
export declare const MessageItem: FC<MessageItemProps>;
|
|
8
7
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SettingSection: () => 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 {};
|
|
@@ -8,3 +8,9 @@ export * from './MessageList';
|
|
|
8
8
|
export * from './ChatListItem';
|
|
9
9
|
export * from './ImageFileItem';
|
|
10
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';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageOption } from '../../types';
|
|
1
|
+
import { ChatUser, LanguageOption } from '../../types';
|
|
2
2
|
export declare const COMMON_EMOJIS: string[];
|
|
3
3
|
export declare const COLOR_PRESETS: {
|
|
4
4
|
name: string;
|
|
@@ -11,3 +11,5 @@ export declare const LOCAL_OR_IP_REGEX: RegExp;
|
|
|
11
11
|
export declare const GENERAL_URL_REGEX: RegExp;
|
|
12
12
|
export declare const MESSAGE_LIMIT = 500;
|
|
13
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,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];
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './useChat';
|
|
2
2
|
export { useFileViewer } from './useFileViewer';
|
|
3
3
|
export { useDragDropFiles } from './useDragDropFiles';
|
|
4
4
|
export { useVoiceRecorder } from './useVoiceRecorder';
|
|
5
5
|
export { useTranslation } from './useTranslation';
|
|
6
6
|
export { useToast } from './useToast';
|
|
7
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';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useChat: (chatKey
|
|
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,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 {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { LanguageOption, WidgetFeature } from '../../types';
|
|
1
|
+
import { AuthInfo, LanguageOption, PositionType, WidgetFeature, WidgetScope } from '../../types';
|
|
2
2
|
export declare const useSetting: (config?: {
|
|
3
|
+
scope?: WidgetScope;
|
|
3
4
|
features?: WidgetFeature;
|
|
4
5
|
language?: LanguageOption;
|
|
6
|
+
auth?: AuthInfo;
|
|
7
|
+
initPosition?: PositionType;
|
|
5
8
|
}) => void;
|
|
@@ -6,7 +6,7 @@ export interface VoiceRecorderState {
|
|
|
6
6
|
}
|
|
7
7
|
export interface VoiceRecorderHandle {
|
|
8
8
|
startRecording: () => Promise<void>;
|
|
9
|
-
stopRecording: () => Promise<
|
|
9
|
+
stopRecording: () => Promise<File | null>;
|
|
10
10
|
cancelRecording: () => void;
|
|
11
11
|
playback: () => void;
|
|
12
12
|
clearRecording: () => void;
|
|
@@ -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 {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { AuthInfo, ChatEventPayloads, ChatResponse, ChatConversation, ChatMessage, ChatConfig, PaginationInfo, MessageAction, ChatUser, ChatSetting } from '../../types';
|
|
2
|
-
declare class ChatService {
|
|
3
|
-
private static instance;
|
|
2
|
+
export declare class ChatService {
|
|
4
3
|
private chatSDK;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
init(
|
|
8
|
-
private setupSDK;
|
|
4
|
+
accountCode: string;
|
|
5
|
+
constructor(accountCode: string);
|
|
6
|
+
init(workspace?: string): void;
|
|
9
7
|
get setting(): ChatSetting;
|
|
10
8
|
setAuth(data: AuthInfo): Promise<ChatUser>;
|
|
11
9
|
getAuth(): ChatUser | null;
|
|
@@ -19,7 +17,7 @@ declare class ChatService {
|
|
|
19
17
|
getChats(limit?: number, page?: number): Promise<ChatResponse<ChatConversation[]> & {
|
|
20
18
|
pagination?: PaginationInfo;
|
|
21
19
|
}>;
|
|
22
|
-
findChatByReceiver(receiverId: number): Promise<
|
|
20
|
+
findChatByReceiver(receiverId: number | string): Promise<ChatConversation | undefined>;
|
|
23
21
|
addChat(receiverId: number, content?: string): Promise<ChatResponse<ChatConversation>>;
|
|
24
22
|
addGroup(memberIds: number[], name: string, avatar?: string | File, userId?: number): Promise<ChatResponse<ChatConversation>>;
|
|
25
23
|
updateGroup(chatId: number, name: string, avatar?: string | File): Promise<ChatResponse<ChatConversation>>;
|
|
@@ -34,10 +32,11 @@ declare class ChatService {
|
|
|
34
32
|
message_id: number;
|
|
35
33
|
member_id: number;
|
|
36
34
|
}>;
|
|
35
|
+
getSystemMessages(limit?: number, page?: number): Promise<ChatResponse<ChatMessage[]> & {
|
|
36
|
+
pagination?: PaginationInfo;
|
|
37
|
+
}>;
|
|
37
38
|
addEventListener<K extends keyof ChatEventPayloads>(event: K, listener: (data: K extends keyof ChatEventPayloads ? ChatEventPayloads[K] : unknown) => void): void;
|
|
38
39
|
removeEventListener<K extends keyof ChatEventPayloads>(event: K, listener?: (data: ChatEventPayloads[K]) => void): void;
|
|
39
40
|
runEvent<K extends keyof ChatEventPayloads>(name: K | string, data?: ChatEventPayloads[K]): void;
|
|
40
41
|
setConfig(config: ChatConfig): void;
|
|
41
42
|
}
|
|
42
|
-
export declare const chatService: ChatService;
|
|
43
|
-
export {};
|
|
@@ -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,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;
|
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
import { RootState } from '../../../store';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
acceptFilter: string;
|
|
6
|
-
isFileTypeAllowed: (file: File) => boolean;
|
|
7
|
-
allowDeleteChat: boolean;
|
|
8
|
-
allowDeleteMessage: (messageCreatedTime: string) => boolean;
|
|
9
|
-
allowRevokeMessage: (messageCreatedTime: string) => boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare const selectWidgetFeatures: ((state: {
|
|
12
|
-
chat: import('../../../store').ChatState;
|
|
13
|
-
setting: import('../../../store').SettingState;
|
|
14
|
-
}) => WidgetSettings) & {
|
|
15
|
-
clearCache: () => void;
|
|
16
|
-
resultsCount: () => number;
|
|
17
|
-
resetResultsCount: () => void;
|
|
18
|
-
} & {
|
|
19
|
-
resultFunc: (resultFuncArgs_0: WidgetFeature, resultFuncArgs_1: boolean) => WidgetSettings;
|
|
20
|
-
memoizedResultFunc: ((resultFuncArgs_0: WidgetFeature, resultFuncArgs_1: boolean) => WidgetSettings) & {
|
|
21
|
-
clearCache: () => void;
|
|
22
|
-
resultsCount: () => number;
|
|
23
|
-
resetResultsCount: () => void;
|
|
24
|
-
};
|
|
25
|
-
lastResult: () => WidgetSettings;
|
|
26
|
-
dependencies: [(state: RootState) => WidgetFeature, (state: RootState) => boolean];
|
|
27
|
-
recomputations: () => number;
|
|
28
|
-
resetRecomputations: () => void;
|
|
29
|
-
dependencyRecomputations: () => number;
|
|
30
|
-
resetDependencyRecomputations: () => void;
|
|
31
|
-
} & {
|
|
32
|
-
memoize: typeof import('reselect').weakMapMemoize;
|
|
33
|
-
argsMemoize: typeof import('reselect').weakMapMemoize;
|
|
34
|
-
};
|
|
35
|
-
export {};
|
|
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;
|