@webinex/chatify 2.0.0-build10 → 2.0.0-build2
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/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/core/api/accountApi.d.ts +3 -3
- package/dist/esm/types/core/api/api.d.ts +1751 -1593
- package/dist/esm/types/core/api/baseApi.d.ts +1 -6
- package/dist/esm/types/core/api/chatApi.d.ts +11 -2
- package/dist/esm/types/core/api/chatListApi.d.ts +4 -3
- package/dist/esm/types/core/api/chatMemberApi.d.ts +3 -3
- package/dist/esm/types/core/api/chatMessageApi.d.ts +34 -3
- package/dist/esm/types/core/api/index.d.ts +8 -0
- package/dist/esm/types/core/api/threadApi.d.ts +95 -1
- package/dist/esm/types/core/api/threadMessageApi.d.ts +24 -2
- package/package.json +6 -5
- package/src/core/api/accountApi.ts +7 -5
- package/src/core/api/api.ts +42 -642
- package/src/core/api/baseApi.ts +7 -15
- package/src/core/api/chatApi.ts +8 -6
- package/src/core/api/chatListApi.ts +20 -5
- package/src/core/api/chatMemberApi.ts +7 -5
- package/src/core/api/chatMessageApi.ts +148 -4
- package/src/core/api/index.ts +8 -0
- package/src/core/api/threadApi.ts +125 -1
- package/src/core/api/threadMessageApi.ts +108 -1
- package/src/ui/Chat/ChatEditableHeaderName.tsx +2 -2
- package/src/ui/Chat/ChatPanel.tsx +2 -2
- package/src/ui/Chat/ChatView.tsx +14 -6
- package/src/ui/Chat/Members/ChatMembersPanel.tsx +12 -7
- package/src/ui/Chat/Members/ChatMembersPreview.tsx +2 -2
- package/src/ui/ChatGroup/ChatGroupPanel.tsx +2 -2
- package/src/ui/ChatGroup/Create/CreateChatMemberInput.tsx +2 -2
- package/src/ui/ChatGroup/Create/CreateChatPanel.tsx +2 -2
- package/src/ui/ChatGroup/Layout/ChatGroupMain.tsx +2 -2
- package/src/ui/ChatGroup/List/ChatList.tsx +2 -2
- package/src/ui/Conversation/NextObserver/NextMessagesObserver.tsx +2 -2
- package/src/ui/Thread/ThreadPanel.tsx +19 -8
- package/dist/index.d.ts +0 -3004
- package/src/types/core/api/accountApi.d.ts +0 -5
- package/src/types/core/api/api.d.ts +0 -2380
- package/src/types/core/api/baseApi.d.ts +0 -15
- package/src/types/core/api/chatApi.d.ts +0 -16
- package/src/types/core/api/chatListApi.d.ts +0 -5
- package/src/types/core/api/chatMemberApi.d.ts +0 -6
- package/src/types/core/api/chatMessageApi.d.ts +0 -3
- package/src/types/core/api/index.d.ts +0 -1
- package/src/types/core/api/threadApi.d.ts +0 -1
- package/src/types/core/api/threadMessageApi.d.ts +0 -6
- package/src/types/core/client.d.ts +0 -83
- package/src/types/core/constants.d.ts +0 -1
- package/src/types/core/debounce.d.ts +0 -27
- package/src/types/core/index.d.ts +0 -4
- package/src/types/core/types.d.ts +0 -105
- package/src/types/index.d.ts +0 -2
- package/src/types/ui/Chat/ChatContext.d.ts +0 -10
- package/src/types/ui/Chat/ChatEditableHeaderName.d.ts +0 -2
- package/src/types/ui/Chat/ChatHeaderActions.d.ts +0 -2
- package/src/types/ui/Chat/ChatPanel.d.ts +0 -13
- package/src/types/ui/Chat/ChatView.d.ts +0 -17
- package/src/types/ui/Chat/Members/ChatMembersButton.d.ts +0 -2
- package/src/types/ui/Chat/Members/ChatMembersPanel.d.ts +0 -2
- package/src/types/ui/Chat/Members/ChatMembersPreview.d.ts +0 -2
- package/src/types/ui/Chat/Members/index.d.ts +0 -11
- package/src/types/ui/Chat/index.d.ts +0 -6
- package/src/types/ui/ChatGroup/ChatGroupContext.d.ts +0 -12
- package/src/types/ui/ChatGroup/ChatGroupPanel.d.ts +0 -15
- package/src/types/ui/ChatGroup/Create/CreateChatButton.d.ts +0 -2
- package/src/types/ui/ChatGroup/Create/CreateChatForm.d.ts +0 -11
- package/src/types/ui/ChatGroup/Create/CreateChatMemberInput.d.ts +0 -5
- package/src/types/ui/ChatGroup/Create/CreateChatNameInput.d.ts +0 -5
- package/src/types/ui/ChatGroup/Create/CreateChatPanel.d.ts +0 -2
- package/src/types/ui/ChatGroup/Create/index.d.ts +0 -17
- package/src/types/ui/ChatGroup/Layout/ChatGroupAside.d.ts +0 -2
- package/src/types/ui/ChatGroup/Layout/ChatGroupBody.d.ts +0 -2
- package/src/types/ui/ChatGroup/Layout/ChatGroupFooter.d.ts +0 -2
- package/src/types/ui/ChatGroup/Layout/ChatGroupHeader.d.ts +0 -2
- package/src/types/ui/ChatGroup/Layout/ChatGroupMain.d.ts +0 -2
- package/src/types/ui/ChatGroup/Layout/index.d.ts +0 -17
- package/src/types/ui/ChatGroup/List/ChatList.d.ts +0 -2
- package/src/types/ui/ChatGroup/List/ChatListItemAvatar.d.ts +0 -3
- package/src/types/ui/ChatGroup/List/ChatListItemBox.d.ts +0 -6
- package/src/types/ui/ChatGroup/List/ChatListItemLastMessage.d.ts +0 -3
- package/src/types/ui/ChatGroup/List/ChatListItemLastMessageAuthor.d.ts +0 -3
- package/src/types/ui/ChatGroup/List/ChatListItemLastMessageContent.d.ts +0 -3
- package/src/types/ui/ChatGroup/List/ChatListItemLastMessageSentAt.d.ts +0 -3
- package/src/types/ui/ChatGroup/List/ChatListItemName.d.ts +0 -3
- package/src/types/ui/ChatGroup/List/ChatListItemUnreadCount.d.ts +0 -3
- package/src/types/ui/ChatGroup/List/index.d.ts +0 -29
- package/src/types/ui/ChatGroup/index.d.ts +0 -5
- package/src/types/ui/Chatify.d.ts +0 -8
- package/src/types/ui/Conversation/Conversation.d.ts +0 -21
- package/src/types/ui/Conversation/ConversationActions.d.ts +0 -2
- package/src/types/ui/Conversation/ConversationBody.d.ts +0 -2
- package/src/types/ui/Conversation/ConversationContext.d.ts +0 -20
- package/src/types/ui/Conversation/ConversationHeader.d.ts +0 -2
- package/src/types/ui/Conversation/ConversationName.d.ts +0 -2
- package/src/types/ui/Conversation/InputBox/InputBox.d.ts +0 -2
- package/src/types/ui/Conversation/InputBox/InputFilesBox.d.ts +0 -2
- package/src/types/ui/Conversation/InputBox/InputSubmitButtonBox.d.ts +0 -5
- package/src/types/ui/Conversation/InputBox/InputTextBox.d.ts +0 -8
- package/src/types/ui/Conversation/InputBox/index.d.ts +0 -14
- package/src/types/ui/Conversation/Message/MessageAuthor.d.ts +0 -3
- package/src/types/ui/Conversation/Message/MessageBox.d.ts +0 -6
- package/src/types/ui/Conversation/Message/MessageContent.d.ts +0 -3
- package/src/types/ui/Conversation/Message/MessageInfoBox.d.ts +0 -3
- package/src/types/ui/Conversation/Message/MessageRow.d.ts +0 -6
- package/src/types/ui/Conversation/Message/MessageText.d.ts +0 -3
- package/src/types/ui/Conversation/Message/index.d.ts +0 -20
- package/src/types/ui/Conversation/NextObserver/NextMessagesObserver.d.ts +0 -5
- package/src/types/ui/Conversation/NextObserver/index.d.ts +0 -1
- package/src/types/ui/Conversation/ReadObserver/MessageReadObserver.d.ts +0 -6
- package/src/types/ui/Conversation/ReadObserver/index.d.ts +0 -1
- package/src/types/ui/Conversation/SendingMessage/SendingMessageBox.d.ts +0 -7
- package/src/types/ui/Conversation/SendingMessage/SendingMessageContent.d.ts +0 -3
- package/src/types/ui/Conversation/SendingMessage/SendingMessageInfoBox.d.ts +0 -3
- package/src/types/ui/Conversation/SendingMessage/SendingMessageText.d.ts +0 -3
- package/src/types/ui/Conversation/SendingMessage/index.d.ts +0 -14
- package/src/types/ui/Conversation/SystemMessage/SystemMessageBox.d.ts +0 -6
- package/src/types/ui/Conversation/SystemMessage/SystemMessageRow.d.ts +0 -9
- package/src/types/ui/Conversation/SystemMessage/index.d.ts +0 -8
- package/src/types/ui/Conversation/index.d.ts +0 -12
- package/src/types/ui/Thread/ThreadActions.d.ts +0 -2
- package/src/types/ui/Thread/ThreadContext.d.ts +0 -8
- package/src/types/ui/Thread/ThreadPanel.d.ts +0 -14
- package/src/types/ui/Thread/index.d.ts +0 -3
- package/src/types/ui/color.d.ts +0 -6
- package/src/types/ui/common/Avatar.d.ts +0 -6
- package/src/types/ui/common/Icon.d.ts +0 -20
- package/src/types/ui/common/MessageSkeleton.d.ts +0 -5
- package/src/types/ui/common/index.d.ts +0 -11
- package/src/types/ui/customize.d.ts +0 -9
- package/src/types/ui/index.d.ts +0 -11
- package/src/types/ui/localizer.d.ts +0 -35
|
@@ -4,7 +4,7 @@ import { CreateChatPanelCustomizeValue } from './Create';
|
|
|
4
4
|
import { ChatGroupBody, ChatGroupFooter, ChatGroupHeader, ChatGroupLayoutCustomizeValue } from './Layout';
|
|
5
5
|
import { ChatListCustomizeValue } from './List';
|
|
6
6
|
import { ChatGroupContext, useChatGroupContext } from './ChatGroupContext';
|
|
7
|
-
import {
|
|
7
|
+
import { useGetChatListQuery } from '../../core';
|
|
8
8
|
import { CustomizeContext } from '../customize';
|
|
9
9
|
import { ChatViewCustomizeValue } from '../Chat';
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@ export interface ChatifyProps {
|
|
|
23
23
|
|
|
24
24
|
function Content(props: Pick<ChatifyProps, 'className' | 'style'>) {
|
|
25
25
|
const { className = '', style } = props;
|
|
26
|
-
const { data: chats } =
|
|
26
|
+
const { data: chats } = useGetChatListQuery();
|
|
27
27
|
const { openChat, none, chatId } = useChatGroupContext();
|
|
28
28
|
const openFirstChatRef = useRef(false);
|
|
29
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { chatifyApi } from '../../../core';
|
|
2
|
+
import { chatifyApi, useGetAccountListQuery } from '../../../core';
|
|
3
3
|
import { customize } from '../../customize';
|
|
4
4
|
import { Checkbox, Form, List } from 'antd';
|
|
5
5
|
import { useLocalizer } from '../../localizer';
|
|
@@ -16,7 +16,7 @@ interface CheckboxListProps {
|
|
|
16
16
|
|
|
17
17
|
function CheckboxList(props: CheckboxListProps) {
|
|
18
18
|
const { value, onChange } = props;
|
|
19
|
-
const { data: accounts, isFetching } =
|
|
19
|
+
const { data: accounts, isFetching } = useGetAccountListQuery();
|
|
20
20
|
const me = chatifyApi.settings.me();
|
|
21
21
|
const dataSource = useMemo(() => accounts?.filter((x) => x.id !== me) ?? [], [accounts, me]);
|
|
22
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useAddChatMutation } from '../../../core';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useLocalizer } from '../../localizer';
|
|
4
4
|
import { CreateChatForm, CreateChatFormValue } from './CreateChatForm';
|
|
@@ -8,7 +8,7 @@ import { Icon } from '../../common/Icon';
|
|
|
8
8
|
import { useChatGroupContext } from '../ChatGroupContext';
|
|
9
9
|
|
|
10
10
|
function useSubmit() {
|
|
11
|
-
const [add, { isLoading }] =
|
|
11
|
+
const [add, { isLoading }] = useAddChatMutation();
|
|
12
12
|
const { openChat } = useChatGroupContext();
|
|
13
13
|
|
|
14
14
|
const onSubmit = useCallback(
|
|
@@ -2,11 +2,11 @@ import { customize } from '../../customize';
|
|
|
2
2
|
import { CreateChatPanel } from '../Create';
|
|
3
3
|
import { ChatView } from '../../Chat';
|
|
4
4
|
import { useChatGroupContext } from '../ChatGroupContext';
|
|
5
|
-
import {
|
|
5
|
+
import { useChatListItem } from '../../../core';
|
|
6
6
|
|
|
7
7
|
export const ChatGroupMain = customize('ChatGroupMain', () => {
|
|
8
8
|
const { chatId, view } = useChatGroupContext();
|
|
9
|
-
const chat =
|
|
9
|
+
const chat = useChatListItem(chatId);
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<div className="wxchtf-main">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Menu, MenuProps } from 'antd';
|
|
2
2
|
import { useCallback, useMemo } from 'react';
|
|
3
3
|
import type { MenuItemType } from 'antd/es/menu/hooks/useItems';
|
|
4
|
-
import {
|
|
4
|
+
import { useGetChatListQuery } from '../../../core';
|
|
5
5
|
import { ChatListItemBox } from './ChatListItemBox';
|
|
6
6
|
import { customize } from '../../customize';
|
|
7
7
|
import { useChatGroupContext } from '../ChatGroupContext';
|
|
@@ -16,7 +16,7 @@ function useOnSelect() {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function useMenuItems() {
|
|
19
|
-
const { data: chats } =
|
|
19
|
+
const { data: chats } = useGetChatListQuery();
|
|
20
20
|
|
|
21
21
|
return useMemo<MenuItemType[] | undefined>(() => {
|
|
22
22
|
return chats
|
|
@@ -10,13 +10,13 @@ export function NextMessagesObserver(props: NextMessagesObserverProps) {
|
|
|
10
10
|
const { onLoad, loading } = props;
|
|
11
11
|
const [intersecting, setIntersecting] = useState(false);
|
|
12
12
|
const ref = useRef<HTMLDivElement | null>(null);
|
|
13
|
-
const timerRef = useRef<
|
|
13
|
+
const timerRef = useRef<NodeJS.Timer>();
|
|
14
14
|
|
|
15
15
|
const observer = useMemo(
|
|
16
16
|
() =>
|
|
17
17
|
new IntersectionObserver(([entry]) => {
|
|
18
18
|
if (entry.isIntersecting) {
|
|
19
|
-
timerRef.current =
|
|
19
|
+
timerRef.current = setTimeout(() => setIntersecting(true), 200);
|
|
20
20
|
} else {
|
|
21
21
|
clearTimeout(timerRef.current!);
|
|
22
22
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
MessageBody,
|
|
4
|
+
chatifyApi,
|
|
5
|
+
parseThreadMessageId,
|
|
6
|
+
useFetchNextThreadMessageListMutation,
|
|
7
|
+
useGetThreadMessageListQuery,
|
|
8
|
+
useGetThreadMessageReadQueueQuery,
|
|
9
|
+
useGetThreadQuery,
|
|
10
|
+
useReadThreadMessageMutation,
|
|
11
|
+
useSendThreadMessageMutation,
|
|
12
|
+
useWatchThreadMutation,
|
|
13
|
+
} from '../../core';
|
|
3
14
|
import { Conversation, ConversationCustomizeValue, ConversationProps } from '../Conversation';
|
|
4
15
|
import { ThreadContext, ThreadContextValue } from './ThreadContext';
|
|
5
16
|
import { Localizer, LocalizerContext, defaultLocalizer } from '../localizer';
|
|
@@ -20,24 +31,24 @@ export interface ThreadPanelProps {
|
|
|
20
31
|
|
|
21
32
|
function usePanelState(props: ThreadPanelProps) {
|
|
22
33
|
const { threadId } = props;
|
|
23
|
-
const { data: thread } =
|
|
24
|
-
const { data: messageList } =
|
|
34
|
+
const { data: thread } = useGetThreadQuery({ id: threadId });
|
|
35
|
+
const { data: messageList } = useGetThreadMessageListQuery({ threadId });
|
|
25
36
|
const { id, name, archive, lastReadMessageId, watch } = thread ?? {};
|
|
26
37
|
const { messages, hasMore } = messageList ?? {};
|
|
27
38
|
|
|
28
|
-
const [read] =
|
|
39
|
+
const [read] = useReadThreadMessageMutation();
|
|
29
40
|
const onRead = useCallback((id: string) => read({ id }), [read]);
|
|
30
41
|
|
|
31
|
-
const [fetchNext, { isLoading: isFetchNextLoading }] =
|
|
42
|
+
const [fetchNext, { isLoading: isFetchNextLoading }] = useFetchNextThreadMessageListMutation();
|
|
32
43
|
const onNext = useCallback(() => fetchNext({ threadId }), [fetchNext, threadId]);
|
|
33
44
|
|
|
34
|
-
const [send] =
|
|
45
|
+
const [send] = useSendThreadMessageMutation();
|
|
35
46
|
const onSend = useCallback(
|
|
36
47
|
(message: MessageBody) => send({ body: message, threadId }).unwrap(),
|
|
37
48
|
[threadId, send],
|
|
38
49
|
);
|
|
39
50
|
|
|
40
|
-
const { data: readQueue } =
|
|
51
|
+
const { data: readQueue } = useGetThreadMessageReadQueueQuery();
|
|
41
52
|
|
|
42
53
|
const conversation = useMemo(() => {
|
|
43
54
|
if (!id) {
|
|
@@ -75,7 +86,7 @@ function usePanelState(props: ThreadPanelProps) {
|
|
|
75
86
|
watch,
|
|
76
87
|
]);
|
|
77
88
|
|
|
78
|
-
const [watchThread] =
|
|
89
|
+
const [watchThread] = useWatchThreadMutation();
|
|
79
90
|
|
|
80
91
|
const threadContext = useMemo<ThreadContextValue | null>(
|
|
81
92
|
() =>
|