@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.
Files changed (131) hide show
  1. package/dist/esm/index.js +2 -2
  2. package/dist/esm/index.js.map +1 -1
  3. package/dist/esm/types/core/api/accountApi.d.ts +3 -3
  4. package/dist/esm/types/core/api/api.d.ts +1751 -1593
  5. package/dist/esm/types/core/api/baseApi.d.ts +1 -6
  6. package/dist/esm/types/core/api/chatApi.d.ts +11 -2
  7. package/dist/esm/types/core/api/chatListApi.d.ts +4 -3
  8. package/dist/esm/types/core/api/chatMemberApi.d.ts +3 -3
  9. package/dist/esm/types/core/api/chatMessageApi.d.ts +34 -3
  10. package/dist/esm/types/core/api/index.d.ts +8 -0
  11. package/dist/esm/types/core/api/threadApi.d.ts +95 -1
  12. package/dist/esm/types/core/api/threadMessageApi.d.ts +24 -2
  13. package/package.json +6 -5
  14. package/src/core/api/accountApi.ts +7 -5
  15. package/src/core/api/api.ts +42 -642
  16. package/src/core/api/baseApi.ts +7 -15
  17. package/src/core/api/chatApi.ts +8 -6
  18. package/src/core/api/chatListApi.ts +20 -5
  19. package/src/core/api/chatMemberApi.ts +7 -5
  20. package/src/core/api/chatMessageApi.ts +148 -4
  21. package/src/core/api/index.ts +8 -0
  22. package/src/core/api/threadApi.ts +125 -1
  23. package/src/core/api/threadMessageApi.ts +108 -1
  24. package/src/ui/Chat/ChatEditableHeaderName.tsx +2 -2
  25. package/src/ui/Chat/ChatPanel.tsx +2 -2
  26. package/src/ui/Chat/ChatView.tsx +14 -6
  27. package/src/ui/Chat/Members/ChatMembersPanel.tsx +12 -7
  28. package/src/ui/Chat/Members/ChatMembersPreview.tsx +2 -2
  29. package/src/ui/ChatGroup/ChatGroupPanel.tsx +2 -2
  30. package/src/ui/ChatGroup/Create/CreateChatMemberInput.tsx +2 -2
  31. package/src/ui/ChatGroup/Create/CreateChatPanel.tsx +2 -2
  32. package/src/ui/ChatGroup/Layout/ChatGroupMain.tsx +2 -2
  33. package/src/ui/ChatGroup/List/ChatList.tsx +2 -2
  34. package/src/ui/Conversation/NextObserver/NextMessagesObserver.tsx +2 -2
  35. package/src/ui/Thread/ThreadPanel.tsx +19 -8
  36. package/dist/index.d.ts +0 -3004
  37. package/src/types/core/api/accountApi.d.ts +0 -5
  38. package/src/types/core/api/api.d.ts +0 -2380
  39. package/src/types/core/api/baseApi.d.ts +0 -15
  40. package/src/types/core/api/chatApi.d.ts +0 -16
  41. package/src/types/core/api/chatListApi.d.ts +0 -5
  42. package/src/types/core/api/chatMemberApi.d.ts +0 -6
  43. package/src/types/core/api/chatMessageApi.d.ts +0 -3
  44. package/src/types/core/api/index.d.ts +0 -1
  45. package/src/types/core/api/threadApi.d.ts +0 -1
  46. package/src/types/core/api/threadMessageApi.d.ts +0 -6
  47. package/src/types/core/client.d.ts +0 -83
  48. package/src/types/core/constants.d.ts +0 -1
  49. package/src/types/core/debounce.d.ts +0 -27
  50. package/src/types/core/index.d.ts +0 -4
  51. package/src/types/core/types.d.ts +0 -105
  52. package/src/types/index.d.ts +0 -2
  53. package/src/types/ui/Chat/ChatContext.d.ts +0 -10
  54. package/src/types/ui/Chat/ChatEditableHeaderName.d.ts +0 -2
  55. package/src/types/ui/Chat/ChatHeaderActions.d.ts +0 -2
  56. package/src/types/ui/Chat/ChatPanel.d.ts +0 -13
  57. package/src/types/ui/Chat/ChatView.d.ts +0 -17
  58. package/src/types/ui/Chat/Members/ChatMembersButton.d.ts +0 -2
  59. package/src/types/ui/Chat/Members/ChatMembersPanel.d.ts +0 -2
  60. package/src/types/ui/Chat/Members/ChatMembersPreview.d.ts +0 -2
  61. package/src/types/ui/Chat/Members/index.d.ts +0 -11
  62. package/src/types/ui/Chat/index.d.ts +0 -6
  63. package/src/types/ui/ChatGroup/ChatGroupContext.d.ts +0 -12
  64. package/src/types/ui/ChatGroup/ChatGroupPanel.d.ts +0 -15
  65. package/src/types/ui/ChatGroup/Create/CreateChatButton.d.ts +0 -2
  66. package/src/types/ui/ChatGroup/Create/CreateChatForm.d.ts +0 -11
  67. package/src/types/ui/ChatGroup/Create/CreateChatMemberInput.d.ts +0 -5
  68. package/src/types/ui/ChatGroup/Create/CreateChatNameInput.d.ts +0 -5
  69. package/src/types/ui/ChatGroup/Create/CreateChatPanel.d.ts +0 -2
  70. package/src/types/ui/ChatGroup/Create/index.d.ts +0 -17
  71. package/src/types/ui/ChatGroup/Layout/ChatGroupAside.d.ts +0 -2
  72. package/src/types/ui/ChatGroup/Layout/ChatGroupBody.d.ts +0 -2
  73. package/src/types/ui/ChatGroup/Layout/ChatGroupFooter.d.ts +0 -2
  74. package/src/types/ui/ChatGroup/Layout/ChatGroupHeader.d.ts +0 -2
  75. package/src/types/ui/ChatGroup/Layout/ChatGroupMain.d.ts +0 -2
  76. package/src/types/ui/ChatGroup/Layout/index.d.ts +0 -17
  77. package/src/types/ui/ChatGroup/List/ChatList.d.ts +0 -2
  78. package/src/types/ui/ChatGroup/List/ChatListItemAvatar.d.ts +0 -3
  79. package/src/types/ui/ChatGroup/List/ChatListItemBox.d.ts +0 -6
  80. package/src/types/ui/ChatGroup/List/ChatListItemLastMessage.d.ts +0 -3
  81. package/src/types/ui/ChatGroup/List/ChatListItemLastMessageAuthor.d.ts +0 -3
  82. package/src/types/ui/ChatGroup/List/ChatListItemLastMessageContent.d.ts +0 -3
  83. package/src/types/ui/ChatGroup/List/ChatListItemLastMessageSentAt.d.ts +0 -3
  84. package/src/types/ui/ChatGroup/List/ChatListItemName.d.ts +0 -3
  85. package/src/types/ui/ChatGroup/List/ChatListItemUnreadCount.d.ts +0 -3
  86. package/src/types/ui/ChatGroup/List/index.d.ts +0 -29
  87. package/src/types/ui/ChatGroup/index.d.ts +0 -5
  88. package/src/types/ui/Chatify.d.ts +0 -8
  89. package/src/types/ui/Conversation/Conversation.d.ts +0 -21
  90. package/src/types/ui/Conversation/ConversationActions.d.ts +0 -2
  91. package/src/types/ui/Conversation/ConversationBody.d.ts +0 -2
  92. package/src/types/ui/Conversation/ConversationContext.d.ts +0 -20
  93. package/src/types/ui/Conversation/ConversationHeader.d.ts +0 -2
  94. package/src/types/ui/Conversation/ConversationName.d.ts +0 -2
  95. package/src/types/ui/Conversation/InputBox/InputBox.d.ts +0 -2
  96. package/src/types/ui/Conversation/InputBox/InputFilesBox.d.ts +0 -2
  97. package/src/types/ui/Conversation/InputBox/InputSubmitButtonBox.d.ts +0 -5
  98. package/src/types/ui/Conversation/InputBox/InputTextBox.d.ts +0 -8
  99. package/src/types/ui/Conversation/InputBox/index.d.ts +0 -14
  100. package/src/types/ui/Conversation/Message/MessageAuthor.d.ts +0 -3
  101. package/src/types/ui/Conversation/Message/MessageBox.d.ts +0 -6
  102. package/src/types/ui/Conversation/Message/MessageContent.d.ts +0 -3
  103. package/src/types/ui/Conversation/Message/MessageInfoBox.d.ts +0 -3
  104. package/src/types/ui/Conversation/Message/MessageRow.d.ts +0 -6
  105. package/src/types/ui/Conversation/Message/MessageText.d.ts +0 -3
  106. package/src/types/ui/Conversation/Message/index.d.ts +0 -20
  107. package/src/types/ui/Conversation/NextObserver/NextMessagesObserver.d.ts +0 -5
  108. package/src/types/ui/Conversation/NextObserver/index.d.ts +0 -1
  109. package/src/types/ui/Conversation/ReadObserver/MessageReadObserver.d.ts +0 -6
  110. package/src/types/ui/Conversation/ReadObserver/index.d.ts +0 -1
  111. package/src/types/ui/Conversation/SendingMessage/SendingMessageBox.d.ts +0 -7
  112. package/src/types/ui/Conversation/SendingMessage/SendingMessageContent.d.ts +0 -3
  113. package/src/types/ui/Conversation/SendingMessage/SendingMessageInfoBox.d.ts +0 -3
  114. package/src/types/ui/Conversation/SendingMessage/SendingMessageText.d.ts +0 -3
  115. package/src/types/ui/Conversation/SendingMessage/index.d.ts +0 -14
  116. package/src/types/ui/Conversation/SystemMessage/SystemMessageBox.d.ts +0 -6
  117. package/src/types/ui/Conversation/SystemMessage/SystemMessageRow.d.ts +0 -9
  118. package/src/types/ui/Conversation/SystemMessage/index.d.ts +0 -8
  119. package/src/types/ui/Conversation/index.d.ts +0 -12
  120. package/src/types/ui/Thread/ThreadActions.d.ts +0 -2
  121. package/src/types/ui/Thread/ThreadContext.d.ts +0 -8
  122. package/src/types/ui/Thread/ThreadPanel.d.ts +0 -14
  123. package/src/types/ui/Thread/index.d.ts +0 -3
  124. package/src/types/ui/color.d.ts +0 -6
  125. package/src/types/ui/common/Avatar.d.ts +0 -6
  126. package/src/types/ui/common/Icon.d.ts +0 -20
  127. package/src/types/ui/common/MessageSkeleton.d.ts +0 -5
  128. package/src/types/ui/common/index.d.ts +0 -11
  129. package/src/types/ui/customize.d.ts +0 -9
  130. package/src/types/ui/index.d.ts +0 -11
  131. 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 { chatifyApi } from '../../core';
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 } = chatifyApi.useGetChatListQuery();
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 } = chatifyApi.useGetAccountListQuery();
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 { chatifyApi } from '../../../core';
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 }] = chatifyApi.useAddChatMutation();
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 { chatifyApi } from '../../../core';
5
+ import { useChatListItem } from '../../../core';
6
6
 
7
7
  export const ChatGroupMain = customize('ChatGroupMain', () => {
8
8
  const { chatId, view } = useChatGroupContext();
9
- const chat = chatifyApi.useChatListItem(chatId);
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 { chatifyApi } from '../../../core';
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 } = chatifyApi.useGetChatListQuery();
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<number>();
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 = window.setTimeout(() => setIntersecting(true), 200);
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 { MessageBody, chatifyApi, parseThreadMessageId } from '../../core';
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 } = chatifyApi.useGetThreadQuery({ id: threadId });
24
- const { data: messageList } = chatifyApi.useGetThreadMessageListQuery({ threadId });
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] = chatifyApi.useReadThreadMessageMutation();
39
+ const [read] = useReadThreadMessageMutation();
29
40
  const onRead = useCallback((id: string) => read({ id }), [read]);
30
41
 
31
- const [fetchNext, { isLoading: isFetchNextLoading }] = chatifyApi.useFetchNextThreadMessageListMutation();
42
+ const [fetchNext, { isLoading: isFetchNextLoading }] = useFetchNextThreadMessageListMutation();
32
43
  const onNext = useCallback(() => fetchNext({ threadId }), [fetchNext, threadId]);
33
44
 
34
- const [send] = chatifyApi.useSendThreadMessageMutation();
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 } = chatifyApi.useGetThreadMessageReadQueueQuery();
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] = chatifyApi.useWatchThreadMutation();
89
+ const [watchThread] = useWatchThreadMutation();
79
90
 
80
91
  const threadContext = useMemo<ThreadContextValue | null>(
81
92
  () =>