@webinex/chatify 2.0.0-alpha7 → 2.0.0-alpha9

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 (216) hide show
  1. package/dist/Chatify-DGRV4QKP.js +2203 -0
  2. package/dist/Chatify-DGRV4QKP.js.map +1 -0
  3. package/dist/Chatify.css +670 -0
  4. package/dist/audit.css +60 -0
  5. package/dist/audit.js +242 -0
  6. package/dist/audit.js.map +1 -0
  7. package/dist/index.js +97 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/types/audit/AuditChatList.d.ts +9 -0
  10. package/dist/types/audit/AuditConversationPanel.d.ts +10 -0
  11. package/dist/types/audit/AuditPanel.d.ts +14 -0
  12. package/dist/types/audit/AuditPanelCustomizeValue.d.ts +9 -0
  13. package/dist/types/audit/AuditSearch.d.ts +5 -0
  14. package/dist/types/audit/AuditSearchValue.d.ts +14 -0
  15. package/dist/types/audit/auditApi.d.ts +97 -0
  16. package/dist/types/audit/index.d.ts +17 -0
  17. package/dist/types/core/api/api.d.ts +17295 -0
  18. package/dist/{esm/types → types}/core/api/baseApi.d.ts +1 -1
  19. package/dist/{esm/types → types}/core/client.d.ts +4 -3
  20. package/dist/{esm/types → types}/core/types.d.ts +25 -0
  21. package/dist/types/ui/Chat/ChatEditableHeaderName.d.ts +1 -0
  22. package/dist/types/ui/Chat/ChatHeaderActions.d.ts +1 -0
  23. package/dist/{esm/types → types}/ui/Chat/ChatView.d.ts +1 -2
  24. package/dist/types/ui/Chat/Members/ChatMembersButton.d.ts +1 -0
  25. package/dist/types/ui/Chat/Members/ChatMembersPanel.d.ts +1 -0
  26. package/dist/types/ui/Chat/Members/ChatMembersPreview.d.ts +1 -0
  27. package/dist/{esm/types → types}/ui/ChatGroup/ChatGroupPanel.d.ts +2 -2
  28. package/dist/types/ui/ChatGroup/Create/CreateChatButton.d.ts +1 -0
  29. package/dist/{esm/types → types}/ui/ChatGroup/Create/CreateChatForm.d.ts +1 -2
  30. package/dist/types/ui/ChatGroup/Create/CreateChatMemberInput.d.ts +4 -0
  31. package/dist/types/ui/ChatGroup/Create/CreateChatNameInput.d.ts +4 -0
  32. package/dist/types/ui/ChatGroup/Create/CreateChatPanel.d.ts +1 -0
  33. package/dist/types/ui/ChatGroup/Layout/ChatGroupAside.d.ts +1 -0
  34. package/dist/types/ui/ChatGroup/Layout/ChatGroupBody.d.ts +1 -0
  35. package/dist/types/ui/ChatGroup/Layout/ChatGroupFooter.d.ts +1 -0
  36. package/dist/types/ui/ChatGroup/Layout/ChatGroupHeader.d.ts +1 -0
  37. package/dist/types/ui/ChatGroup/Layout/ChatGroupMain.d.ts +1 -0
  38. package/dist/types/ui/ChatGroup/List/ChatListPanel.d.ts +1 -0
  39. package/dist/types/ui/ChatGroup/List/index.d.ts +6 -0
  40. package/dist/types/ui/Chatify.d.ts +9 -0
  41. package/dist/{esm/types → types}/ui/Conversation/Conversation.d.ts +2 -3
  42. package/dist/types/ui/Conversation/ConversationActions.d.ts +1 -0
  43. package/dist/types/ui/Conversation/ConversationBody.d.ts +1 -0
  44. package/dist/{esm/types → types}/ui/Conversation/ConversationContext.d.ts +6 -5
  45. package/dist/types/ui/Conversation/ConversationHeader.d.ts +1 -0
  46. package/dist/types/ui/Conversation/ConversationName.d.ts +1 -0
  47. package/dist/types/ui/Conversation/InputBox/InputBox.d.ts +1 -0
  48. package/dist/types/ui/Conversation/InputBox/InputBoxFile.d.ts +7 -0
  49. package/dist/types/ui/Conversation/InputBox/InputBoxFileList.d.ts +7 -0
  50. package/dist/types/ui/Conversation/InputBox/InputFilesBox.d.ts +11 -0
  51. package/dist/types/ui/Conversation/InputBox/InputSubmitButtonBox.d.ts +6 -0
  52. package/dist/{esm/types → types}/ui/Conversation/InputBox/InputTextBox.d.ts +1 -1
  53. package/dist/types/ui/Conversation/Message/MessageAuthor.d.ts +2 -0
  54. package/dist/types/ui/Conversation/Message/MessageBox.d.ts +5 -0
  55. package/dist/types/ui/Conversation/Message/MessageContent.d.ts +2 -0
  56. package/dist/types/ui/Conversation/Message/MessageFile.d.ts +5 -0
  57. package/dist/types/ui/Conversation/Message/MessageFileList.d.ts +2 -0
  58. package/dist/types/ui/Conversation/Message/MessageInfoBox.d.ts +2 -0
  59. package/dist/{esm/types → types}/ui/Conversation/Message/MessageRow.d.ts +1 -1
  60. package/dist/types/ui/Conversation/Message/MessageText.d.ts +2 -0
  61. package/dist/types/ui/Conversation/SendingMessage/SendingMessageBox.d.ts +6 -0
  62. package/dist/types/ui/Conversation/SendingMessage/SendingMessageContent.d.ts +2 -0
  63. package/dist/types/ui/Conversation/SendingMessage/SendingMessageInfoBox.d.ts +2 -0
  64. package/dist/types/ui/Conversation/SendingMessage/SendingMessageText.d.ts +2 -0
  65. package/dist/types/ui/Conversation/SystemMessage/SystemMessageBox.d.ts +5 -0
  66. package/dist/{esm/types → types}/ui/Conversation/SystemMessage/SystemMessageRow.d.ts +1 -1
  67. package/dist/types/ui/Thread/ThreadActions.d.ts +1 -0
  68. package/dist/{esm/types → types}/ui/Thread/ThreadContext.d.ts +1 -1
  69. package/dist/types/ui/common/Avatar.d.ts +5 -0
  70. package/dist/types/ui/common/ChatList/ChatList.d.ts +16 -0
  71. package/dist/types/ui/common/ChatList/ChatListItemAvatar.d.ts +2 -0
  72. package/dist/types/ui/common/ChatList/ChatListItemBox.d.ts +9 -0
  73. package/dist/types/ui/common/ChatList/ChatListItemLastMessage.d.ts +2 -0
  74. package/dist/types/ui/common/ChatList/ChatListItemLastMessageAuthor.d.ts +2 -0
  75. package/dist/types/ui/common/ChatList/ChatListItemLastMessageContent.d.ts +2 -0
  76. package/dist/types/ui/common/ChatList/ChatListItemLastMessageSentAt.d.ts +2 -0
  77. package/dist/types/ui/common/ChatList/ChatListItemName.d.ts +2 -0
  78. package/dist/types/ui/common/ChatList/ChatListItemUnreadCount.d.ts +2 -0
  79. package/dist/types/ui/common/ChatList/ChatListValue.d.ts +8 -0
  80. package/dist/{esm/types/ui/ChatGroup/List → types/ui/common/ChatList}/index.d.ts +1 -0
  81. package/dist/types/ui/common/Icon.d.ts +21 -0
  82. package/dist/types/ui/common/MessageSkeleton.d.ts +4 -0
  83. package/dist/{esm/types → types}/ui/common/index.d.ts +1 -0
  84. package/dist/{esm/types → types}/ui/customize.d.ts +1 -1
  85. package/dist/{esm/types → types}/ui/index.d.ts +1 -3
  86. package/dist/{esm/types → types}/ui/localizer.d.ts +7 -2
  87. package/package.json +40 -53
  88. package/src/audit/AuditChatList.tsx +25 -0
  89. package/src/audit/AuditConversationPanel.tsx +48 -0
  90. package/src/audit/AuditPanel.tsx +76 -0
  91. package/src/audit/AuditPanelCustomizeValue.ts +11 -0
  92. package/src/audit/AuditSearch.tsx +89 -0
  93. package/src/audit/AuditSearchValue.tsx +42 -0
  94. package/src/audit/auditApi.tsx +113 -0
  95. package/src/audit/index.d.ts +18 -0
  96. package/src/audit/index.tsx +28 -0
  97. package/src/audit/styles.scss +72 -0
  98. package/src/core/client.ts +6 -1
  99. package/src/core/debounce.ts +1 -1
  100. package/src/core/types.tsx +33 -0
  101. package/src/styles/aside.scss +0 -136
  102. package/src/styles/chat-list.scss +138 -0
  103. package/src/styles/chat.scss +0 -198
  104. package/src/styles/conversation.scss +200 -0
  105. package/src/styles/index.scss +2 -0
  106. package/src/ui/Chat/ChatEditableHeaderName.tsx +1 -1
  107. package/src/ui/Chat/Members/ChatMembersPreview.tsx +1 -1
  108. package/src/ui/ChatGroup/ChatGroupPanel.tsx +2 -2
  109. package/src/ui/ChatGroup/Layout/ChatGroupAside.tsx +2 -2
  110. package/src/ui/ChatGroup/List/ChatListPanel.tsx +28 -0
  111. package/src/ui/ChatGroup/List/index.ts +6 -29
  112. package/src/ui/Chatify.tsx +7 -1
  113. package/src/ui/Conversation/Conversation.tsx +15 -1
  114. package/src/ui/Conversation/ConversationActions.tsx +8 -1
  115. package/src/ui/Conversation/ConversationContext.ts +4 -3
  116. package/src/ui/Conversation/ConversationHeader.tsx +4 -8
  117. package/src/ui/Conversation/InputBox/InputBox.tsx +4 -0
  118. package/src/ui/Conversation/InputBox/InputTextBox.tsx +1 -1
  119. package/src/ui/Conversation/Message/MessageInfoBox.tsx +1 -1
  120. package/src/ui/Conversation/ReadObserver/MessageReadObserver.tsx +1 -1
  121. package/src/ui/common/ChatList/ChatList.tsx +84 -0
  122. package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemBox.tsx +11 -5
  123. package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessageAuthor.tsx +3 -3
  124. package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessageContent.tsx +4 -4
  125. package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessageSentAt.tsx +1 -1
  126. package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemUnreadCount.tsx +1 -1
  127. package/src/ui/common/ChatList/ChatListValue.ts +9 -0
  128. package/src/ui/common/ChatList/index.ts +32 -0
  129. package/src/ui/common/Icon.tsx +15 -13
  130. package/src/ui/common/index.ts +1 -0
  131. package/src/ui/index.ts +3 -3
  132. package/src/ui/localizer.tsx +14 -2
  133. package/dist/css/chatify.css +0 -664
  134. package/dist/esm/index.js +0 -11
  135. package/dist/esm/index.js.map +0 -1
  136. package/dist/esm/types/core/api/api.d.ts +0 -12696
  137. package/dist/esm/types/ui/Chat/ChatEditableHeaderName.d.ts +0 -2
  138. package/dist/esm/types/ui/Chat/ChatHeaderActions.d.ts +0 -2
  139. package/dist/esm/types/ui/Chat/Members/ChatMembersButton.d.ts +0 -2
  140. package/dist/esm/types/ui/Chat/Members/ChatMembersPanel.d.ts +0 -2
  141. package/dist/esm/types/ui/Chat/Members/ChatMembersPreview.d.ts +0 -2
  142. package/dist/esm/types/ui/ChatGroup/Create/CreateChatButton.d.ts +0 -2
  143. package/dist/esm/types/ui/ChatGroup/Create/CreateChatMemberInput.d.ts +0 -5
  144. package/dist/esm/types/ui/ChatGroup/Create/CreateChatNameInput.d.ts +0 -5
  145. package/dist/esm/types/ui/ChatGroup/Create/CreateChatPanel.d.ts +0 -2
  146. package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupAside.d.ts +0 -2
  147. package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupBody.d.ts +0 -2
  148. package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupFooter.d.ts +0 -2
  149. package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupHeader.d.ts +0 -2
  150. package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupMain.d.ts +0 -2
  151. package/dist/esm/types/ui/ChatGroup/List/ChatList.d.ts +0 -2
  152. package/dist/esm/types/ui/ChatGroup/List/ChatListItemAvatar.d.ts +0 -3
  153. package/dist/esm/types/ui/ChatGroup/List/ChatListItemBox.d.ts +0 -6
  154. package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessage.d.ts +0 -3
  155. package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessageAuthor.d.ts +0 -3
  156. package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessageContent.d.ts +0 -3
  157. package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessageSentAt.d.ts +0 -3
  158. package/dist/esm/types/ui/ChatGroup/List/ChatListItemName.d.ts +0 -3
  159. package/dist/esm/types/ui/ChatGroup/List/ChatListItemUnreadCount.d.ts +0 -3
  160. package/dist/esm/types/ui/Chatify.d.ts +0 -8
  161. package/dist/esm/types/ui/Conversation/ConversationActions.d.ts +0 -2
  162. package/dist/esm/types/ui/Conversation/ConversationBody.d.ts +0 -2
  163. package/dist/esm/types/ui/Conversation/ConversationHeader.d.ts +0 -2
  164. package/dist/esm/types/ui/Conversation/ConversationName.d.ts +0 -2
  165. package/dist/esm/types/ui/Conversation/InputBox/InputBox.d.ts +0 -2
  166. package/dist/esm/types/ui/Conversation/InputBox/InputBoxFile.d.ts +0 -8
  167. package/dist/esm/types/ui/Conversation/InputBox/InputBoxFileList.d.ts +0 -8
  168. package/dist/esm/types/ui/Conversation/InputBox/InputFilesBox.d.ts +0 -12
  169. package/dist/esm/types/ui/Conversation/InputBox/InputSubmitButtonBox.d.ts +0 -7
  170. package/dist/esm/types/ui/Conversation/Message/MessageAuthor.d.ts +0 -3
  171. package/dist/esm/types/ui/Conversation/Message/MessageBox.d.ts +0 -6
  172. package/dist/esm/types/ui/Conversation/Message/MessageContent.d.ts +0 -3
  173. package/dist/esm/types/ui/Conversation/Message/MessageFile.d.ts +0 -6
  174. package/dist/esm/types/ui/Conversation/Message/MessageFileList.d.ts +0 -3
  175. package/dist/esm/types/ui/Conversation/Message/MessageInfoBox.d.ts +0 -3
  176. package/dist/esm/types/ui/Conversation/Message/MessageText.d.ts +0 -3
  177. package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageBox.d.ts +0 -7
  178. package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageContent.d.ts +0 -3
  179. package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageInfoBox.d.ts +0 -3
  180. package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageText.d.ts +0 -3
  181. package/dist/esm/types/ui/Conversation/SystemMessage/SystemMessageBox.d.ts +0 -6
  182. package/dist/esm/types/ui/Thread/ThreadActions.d.ts +0 -2
  183. package/dist/esm/types/ui/common/Avatar.d.ts +0 -6
  184. package/dist/esm/types/ui/common/Icon.d.ts +0 -22
  185. package/dist/esm/types/ui/common/MessageSkeleton.d.ts +0 -5
  186. package/dist/index.d.ts +0 -13363
  187. package/src/ui/ChatGroup/List/ChatList.tsx +0 -41
  188. /package/dist/{esm/types → types}/core/api/index.d.ts +0 -0
  189. /package/dist/{esm/types → types}/core/constants.d.ts +0 -0
  190. /package/dist/{esm/types → types}/core/debounce.d.ts +0 -0
  191. /package/dist/{esm/types → types}/core/index.d.ts +0 -0
  192. /package/dist/{esm/types → types}/index.d.ts +0 -0
  193. /package/dist/{esm/types → types}/ui/Chat/ChatContext.d.ts +0 -0
  194. /package/dist/{esm/types → types}/ui/Chat/ChatPanel.d.ts +0 -0
  195. /package/dist/{esm/types → types}/ui/Chat/Members/index.d.ts +0 -0
  196. /package/dist/{esm/types → types}/ui/Chat/index.d.ts +0 -0
  197. /package/dist/{esm/types → types}/ui/ChatGroup/ChatGroupContext.d.ts +0 -0
  198. /package/dist/{esm/types → types}/ui/ChatGroup/Create/index.d.ts +0 -0
  199. /package/dist/{esm/types → types}/ui/ChatGroup/Layout/index.d.ts +0 -0
  200. /package/dist/{esm/types → types}/ui/ChatGroup/index.d.ts +0 -0
  201. /package/dist/{esm/types → types}/ui/Conversation/InputBox/index.d.ts +0 -0
  202. /package/dist/{esm/types → types}/ui/Conversation/Message/index.d.ts +0 -0
  203. /package/dist/{esm/types → types}/ui/Conversation/NextObserver/NextMessagesObserver.d.ts +0 -0
  204. /package/dist/{esm/types → types}/ui/Conversation/NextObserver/index.d.ts +0 -0
  205. /package/dist/{esm/types → types}/ui/Conversation/ReadObserver/MessageReadObserver.d.ts +0 -0
  206. /package/dist/{esm/types → types}/ui/Conversation/ReadObserver/index.d.ts +0 -0
  207. /package/dist/{esm/types → types}/ui/Conversation/SendingMessage/index.d.ts +0 -0
  208. /package/dist/{esm/types → types}/ui/Conversation/SystemMessage/index.d.ts +0 -0
  209. /package/dist/{esm/types → types}/ui/Conversation/index.d.ts +0 -0
  210. /package/dist/{esm/types → types}/ui/Thread/ThreadPanel.d.ts +0 -0
  211. /package/dist/{esm/types → types}/ui/Thread/index.d.ts +0 -0
  212. /package/dist/{esm/types → types}/ui/color.d.ts +0 -0
  213. /package/dist/{esm/types → types}/ui/useFormatter.d.ts +0 -0
  214. /package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemAvatar.tsx +0 -0
  215. /package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessage.tsx +0 -0
  216. /package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemName.tsx +0 -0
@@ -0,0 +1,200 @@
1
+ @use './variables.scss' as vars;
2
+ @use './mixins.scss' as mixins;
3
+
4
+ .wxchtf-conversation {
5
+ flex: auto;
6
+ display: flex;
7
+ flex-flow: row nowrap;
8
+ min-width: 0;
9
+
10
+ .wxchtf-conversation-main {
11
+ flex: 1;
12
+ display: flex;
13
+ flex-flow: column nowrap;
14
+ min-width: 0;
15
+
16
+ .wxchtf-conversation-header {
17
+ padding: 15px 20px;
18
+ line-height: 24px;
19
+ z-index: 2;
20
+ box-shadow: 0px 2px 4px 0px rgba(88, 99, 107, 0.04), 0px 1px 9px -1px rgba(88, 99, 107, 0.04),
21
+ 0px 1px 2px 0px rgba(88, 99, 107, 0.06);
22
+
23
+ .wxchtf-conversation-name {
24
+ font-weight: 600;
25
+ font-size: 16px;
26
+ flex: none;
27
+
28
+ &.--editable {
29
+ cursor: pointer;
30
+ }
31
+ }
32
+
33
+ .wxchtf-conversation-actions {
34
+ display: inline-flex;
35
+ }
36
+
37
+ .wxchtf-chat-members {
38
+ display: inline-flex;
39
+ gap: 6px;
40
+ }
41
+ }
42
+
43
+ .wxchtf-conversation-body {
44
+ flex: 1 1 auto;
45
+ height: 100px;
46
+ overflow-y: auto;
47
+ background: white;
48
+ padding: 2rem 1rem;
49
+ padding-right: 1rem;
50
+ display: flex;
51
+ flex-flow: column-reverse nowrap;
52
+ align-items: center;
53
+
54
+ @include mixins.scrollbar();
55
+
56
+ .wxchtf-message,
57
+ .wxchtf-sending-message,
58
+ .wxchtf-system-message,
59
+ .wxchtf-message-skeleton {
60
+ margin-bottom: 8px;
61
+ max-width: vars.$messageBoxWidth;
62
+ width: 100%;
63
+
64
+ &:first-child {
65
+ margin-bottom: 0;
66
+ }
67
+ }
68
+
69
+ .wxchtf-message,
70
+ .wxchtf-sending-message {
71
+ display: flex;
72
+ flex-flow: row nowrap;
73
+ align-items: flex-start;
74
+
75
+ & > div {
76
+ min-width: 0;
77
+ }
78
+
79
+ &:not(.--my) {
80
+ .wxchtf-message-content,
81
+ .wxchtf-sending-message-content {
82
+ border-bottom-left-radius: 0;
83
+ }
84
+ }
85
+
86
+ &.--my {
87
+ direction: rtl;
88
+ justify-content: flex-start;
89
+
90
+ .wxchtf-message-author {
91
+ display: none;
92
+ }
93
+
94
+ .wxchtf-message-content,
95
+ .wxchtf-sending-message-content {
96
+ direction: ltr;
97
+ border-bottom-right-radius: 0;
98
+ background-color: vars.$myMessageBackground;
99
+ }
100
+
101
+ .wxchtf-message-info-box {
102
+ text-align: right;
103
+ }
104
+ }
105
+
106
+ .wxchtf-message-author {
107
+ margin-right: 15px;
108
+ flex: none;
109
+
110
+ .ant-avatar {
111
+ @include mixins.avatarSize(vars.$avatarSize);
112
+ }
113
+ }
114
+
115
+ .wxchtf-message-info-box,
116
+ .wxchtf-sending-message-info-box {
117
+ text-align: left;
118
+ margin-bottom: 3px;
119
+
120
+ .wxchtf-message-author-name,
121
+ .wxchtf-message-sent-at,
122
+ .wxchtf-message-read-box,
123
+ .wxchtf-sending-message-sending-box {
124
+ display: inline-block;
125
+ font-size: 0.85em;
126
+ opacity: 0.5;
127
+ }
128
+
129
+ .wxchtf-message-sent-at,
130
+ .wxchtf-message-read-box,
131
+ .wxchtf-sending-message-sending-box {
132
+ margin-left: 5px;
133
+ }
134
+ }
135
+
136
+ .wxchtf-message-content,
137
+ .wxchtf-sending-message-content {
138
+ width: fit-content;
139
+ min-width: 300px;
140
+ max-width: 70%;
141
+ padding: 12px 19px;
142
+ background: white;
143
+ background-color: vars.$messageBackground;
144
+ display: block;
145
+ white-space: pre-wrap;
146
+ overflow-wrap: break-word;
147
+ border-radius: 24px;
148
+
149
+ .wxchtf-message-text {
150
+ line-height: 21px;
151
+ }
152
+ }
153
+ }
154
+
155
+ .wxchtf-system-message {
156
+ font-style: italic;
157
+ position: relative;
158
+ text-align: center;
159
+ color: #0e0f1799;
160
+
161
+ .wxchtf-text,
162
+ .wxchtf-timestamp {
163
+ position: relative;
164
+ z-index: 1;
165
+ padding-inline: 8px;
166
+ display: inline-block;
167
+ font-size: 0.85em;
168
+ background-color: white;
169
+ }
170
+
171
+ .wxchtf-timestamp {
172
+ padding-left: 10px;
173
+ }
174
+ }
175
+
176
+ .wxchtf-message-skeleton {
177
+ display: flex;
178
+ flex-flow: row nowrap;
179
+ align-items: flex-end;
180
+
181
+ .wxchtf-avatar {
182
+ margin-right: 15px;
183
+ }
184
+
185
+ .wxchtf-avatar .ant-skeleton-avatar {
186
+ width: vars.$avatarSize;
187
+ height: vars.$avatarSize;
188
+ line-height: vars.$avatarSize;
189
+ }
190
+
191
+ .wxchtf-content {
192
+ width: 300px;
193
+ height: 100px;
194
+ border-radius: vars.$messageBorderRadius;
195
+ border-bottom-left-radius: 0;
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
@@ -5,6 +5,8 @@
5
5
  @use './chat.scss';
6
6
  @use './input.scss';
7
7
  @use './members.scss';
8
+ @use './chat-list.scss';
9
+ @use './conversation.scss';
8
10
 
9
11
  .wxchtf-message.--my .wxchtf-file-list .wxchtf-file {
10
12
  background-color: darken($color: vars.$myMessageBackground, $amount: 3%);
@@ -2,7 +2,7 @@ import { Input, Tooltip } from 'antd';
2
2
  import { chatifyApi } from '../../core';
3
3
  import { customize } from '../customize';
4
4
  import { useEffect, useState } from 'react';
5
- import isHotkey from 'is-hotkey';
5
+ import { isHotkey } from 'is-hotkey';
6
6
  import { useConversation } from '../Conversation';
7
7
 
8
8
  const isEscape = isHotkey('escape');
@@ -14,7 +14,7 @@ export const ChatMembersPreview = customize('ChatMembersPreview', () => {
14
14
  }
15
15
 
16
16
  return (
17
- <AntdAvatar.Group maxCount={5}>
17
+ <AntdAvatar.Group max={{ count: 5 }}>
18
18
  {chat.members.map((x) => (
19
19
  <Tooltip key={x.id} title={x.name}>
20
20
  <Avatar account={x} />
@@ -2,7 +2,7 @@ import { CSSProperties, FC, useEffect, useMemo, useRef } from 'react';
2
2
  import { Localizer, LocalizerContext, defaultLocalizer } from '../localizer';
3
3
  import { CreateChatPanelCustomizeValue } from './Create';
4
4
  import { ChatGroupBody, ChatGroupFooter, ChatGroupHeader, ChatGroupLayoutCustomizeValue } from './Layout';
5
- import { ChatListCustomizeValue } from './List';
5
+ import { ChatListPanelCustomizeValue } from './List';
6
6
  import { ChatGroupContext, useChatGroupContext } from './ChatGroupContext';
7
7
  import { chatifyApi } from '../../core';
8
8
  import { CustomizeContext } from '../customize';
@@ -11,7 +11,7 @@ import { ChatViewCustomizeValue } from '../Chat';
11
11
  export interface ChatGroupCustomizeValue
12
12
  extends ChatViewCustomizeValue,
13
13
  CreateChatPanelCustomizeValue,
14
- ChatListCustomizeValue,
14
+ ChatListPanelCustomizeValue,
15
15
  ChatGroupLayoutCustomizeValue {}
16
16
 
17
17
  export interface ChatifyProps {
@@ -1,12 +1,12 @@
1
1
  import { customize } from '../../customize';
2
- import { ChatList } from '../List';
2
+ import { ChatListPanel } from '../List';
3
3
  import { CreateChatButton } from '../Create/CreateChatButton';
4
4
 
5
5
  export const ChatGroupAside = customize('ChatGroupAside', () => {
6
6
  return (
7
7
  <div className="wxchtf-aside">
8
8
  <CreateChatButton />
9
- <ChatList />
9
+ <ChatListPanel />
10
10
  </div>
11
11
  );
12
12
  });
@@ -0,0 +1,28 @@
1
+ import { useMemo } from 'react';
2
+ import { chatifyApi } from '../../../core';
3
+ import { customize } from '../../customize';
4
+ import { useChatGroupContext } from '../ChatGroupContext';
5
+ import { ChatListValue, ChatList } from '../../common';
6
+
7
+ function useData() {
8
+ const { data: chats } = chatifyApi.useGetChatListQuery();
9
+ return useMemo(
10
+ () =>
11
+ chats?.map(
12
+ (x): ChatListValue => ({
13
+ id: x.id,
14
+ name: x.name,
15
+ lastMessage: x.message,
16
+ lastReadMessageId: x.lastReadMessageId,
17
+ }),
18
+ ) ?? [],
19
+ [chats],
20
+ );
21
+ }
22
+
23
+ export const ChatListPanel = customize('ChatListPanel', () => {
24
+ const { chatId, openChat } = useChatGroupContext();
25
+ const data = useData();
26
+
27
+ return <ChatList items={data} selected={chatId} onSelect={openChat} />;
28
+ });
@@ -1,31 +1,8 @@
1
- import { ChatList } from './ChatList';
2
- import { ChatListItemAvatar } from './ChatListItemAvatar';
3
- import { ChatListItemBox } from './ChatListItemBox';
4
- import { ChatListItemLastMessage } from './ChatListItemLastMessage';
5
- import { ChatListItemLastMessageAuthor } from './ChatListItemLastMessageAuthor';
6
- import { ChatListItemLastMessageContent } from './ChatListItemLastMessageContent';
7
- import { ChatListItemLastMessageSentAt } from './ChatListItemLastMessageSentAt';
8
- import { ChatListItemName } from './ChatListItemName';
9
- import { ChatListItemUnreadCount } from './ChatListItemUnreadCount';
1
+ import { ChatListCustomizeValue } from '../../common';
2
+ import { ChatListPanel } from './ChatListPanel';
10
3
 
11
- export * from './ChatList';
12
- export * from './ChatListItemAvatar';
13
- export * from './ChatListItemBox';
14
- export * from './ChatListItemLastMessage';
15
- export * from './ChatListItemLastMessageAuthor';
16
- export * from './ChatListItemLastMessageContent';
17
- export * from './ChatListItemLastMessageSentAt';
18
- export * from './ChatListItemName';
19
- export * from './ChatListItemUnreadCount';
4
+ export * from './ChatListPanel';
20
5
 
21
- export interface ChatListCustomizeValue {
22
- ChatList?: typeof ChatList.Component | null;
23
- ChatListItemAvatar?: typeof ChatListItemAvatar.Component | null;
24
- ChatListItemBox?: typeof ChatListItemBox.Component | null;
25
- ChatListItemLastMessage?: typeof ChatListItemLastMessage.Component | null;
26
- ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
27
- ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
28
- ChatListItemLastMessageSentAt?: typeof ChatListItemLastMessageSentAt.Component | null;
29
- ChatListItemName?: typeof ChatListItemName.Component | null;
30
- ChatListItemUnreadCount?: typeof ChatListItemUnreadCount.Component | null;
31
- }
6
+ export type ChatListPanelCustomizeValue = ChatListCustomizeValue & {
7
+ ChatListPanel?: typeof ChatListPanel.Component | null;
8
+ };
@@ -2,8 +2,14 @@ import { ChatPanel } from './Chat';
2
2
  import { ChatGroupPanel } from './ChatGroup';
3
3
  import { ThreadPanel } from './Thread';
4
4
 
5
+ export interface ChatifyType {
6
+ Thread: typeof ThreadPanel;
7
+ ChatGroup: typeof ChatGroupPanel;
8
+ Chat: typeof ChatPanel;
9
+ }
10
+
5
11
  export const Chatify = {
6
12
  Thread: ThreadPanel,
7
13
  ChatGroup: ChatGroupPanel,
8
14
  Chat: ChatPanel,
9
- };
15
+ } as unknown as ChatifyType;
@@ -30,7 +30,19 @@ export interface ConversationCustomizeValue
30
30
  }
31
31
 
32
32
  export const Conversation = customize('Conversation', (props: ConversationProps) => {
33
- const { value, hasMore, messages, nextLoading, onNext, onRead, onSend, isReading, noReadTracking } = props;
33
+ const {
34
+ value,
35
+ hasMore,
36
+ messages,
37
+ nextLoading,
38
+ onNext,
39
+ onRead,
40
+ onSend,
41
+ isReading,
42
+ noReadTracking,
43
+ onClose,
44
+ } = props;
45
+
34
46
  const { id, active, name, lastReadMessageId } = value;
35
47
 
36
48
  const context = useMemo<ConversationContextValue>(
@@ -47,6 +59,7 @@ export const Conversation = customize('Conversation', (props: ConversationProps)
47
59
  onSend,
48
60
  isReading,
49
61
  noReadTracking,
62
+ onClose,
50
63
  }),
51
64
  [
52
65
  id,
@@ -61,6 +74,7 @@ export const Conversation = customize('Conversation', (props: ConversationProps)
61
74
  lastReadMessageId,
62
75
  isReading,
63
76
  noReadTracking,
77
+ onClose,
64
78
  ],
65
79
  );
66
80
 
@@ -1,5 +1,12 @@
1
+ import { Button } from 'antd';
1
2
  import { customize } from '../customize';
3
+ import { useConversation } from './ConversationContext';
4
+ import { Icon } from '../common';
2
5
 
3
6
  export const ConversationActions = customize('ConversationActions', () => {
4
- return null;
7
+ const { onClose } = useConversation();
8
+
9
+ if (!onClose) return null;
10
+
11
+ return <Button onClick={onClose} type="link" icon={<Icon type="close" />} />;
5
12
  });
@@ -15,11 +15,12 @@ export interface ConversationContextValue extends ConversationValue {
15
15
  nextLoading: boolean;
16
16
  noReadTracking?: boolean;
17
17
 
18
- isReading: (id: string) => boolean;
18
+ isReading?: (id: string) => boolean;
19
19
  onNext: () => void;
20
- onSend: (message: MessageBody) => void;
21
- onRead: (id: string) => void;
20
+ onSend?: (message: MessageBody) => void;
21
+ onRead?: (id: string) => void;
22
22
  flippo?: Flippo;
23
+ onClose?: () => void;
23
24
  }
24
25
 
25
26
  export const ConversationContext = React.createContext<ConversationContextValue>(undefined!);
@@ -1,22 +1,18 @@
1
1
  import { Col, Row } from 'antd';
2
- import { customize, useCustomize } from '../customize';
2
+ import { customize } from '../customize';
3
3
  import { ConversationName } from './ConversationName';
4
4
  import { ConversationActions } from './ConversationActions';
5
5
 
6
6
  export const ConversationHeader = customize('ConversationHeader', () => {
7
- const Actions = useCustomize(ConversationActions);
8
-
9
7
  return (
10
8
  <div className="wxchtf-conversation-header">
11
9
  <Row justify="space-between" align="middle">
12
10
  <Col>
13
11
  <ConversationName />
14
12
  </Col>
15
- {Actions && (
16
- <Col className="wxchtf-conversation-actions">
17
- <Actions />
18
- </Col>
19
- )}
13
+ <Col className="wxchtf-conversation-actions">
14
+ <ConversationActions />
15
+ </Col>
20
16
  </Row>
21
17
  </div>
22
18
  );
@@ -15,6 +15,10 @@ function useFormState() {
15
15
  const { onUpload, files, loading, setFiles, showFileBox, onDeleteFile } = useFlippoInputFileBox();
16
16
 
17
17
  const onSubmit = useCallback(() => {
18
+ if (!onSend) {
19
+ return;
20
+ }
21
+
18
22
  const textValue = text.trim().length === 0 ? null : text.trim();
19
23
 
20
24
  if ((!textValue && files.length === 0) || loading) {
@@ -1,6 +1,6 @@
1
1
  import { Input } from 'antd';
2
2
  import { customize } from '../../customize';
3
- import isHotkey from 'is-hotkey';
3
+ import { isHotkey } from 'is-hotkey';
4
4
  import { RefObject, memo, useCallback } from 'react';
5
5
  import { useLocalizer } from '../../localizer';
6
6
  import { TextAreaProps } from 'antd/es/input';
@@ -12,7 +12,7 @@ export const MessageInfoBox = customize('MessageInfoBox', (props: MessageBoxProp
12
12
  const my = sentBy.id === me;
13
13
  const localizer = useLocalizer();
14
14
  const isRead = lastReadMessageId != null && id.localeCompare(lastReadMessageId) <= 0;
15
- const reading = !isRead && isReading(id);
15
+ const reading = !isRead && isReading?.(id);
16
16
 
17
17
  return (
18
18
  <div className="wxchtf-message-info-box">
@@ -20,7 +20,7 @@ const Observer: FC<MessageReadObserverProps> = (props) => {
20
20
  new IntersectionObserver(([entry]) => {
21
21
  if (entry.isIntersecting && !readRef.current) {
22
22
  readRef.current = true;
23
- onRead(message.id);
23
+ onRead?.(message.id);
24
24
  }
25
25
  }),
26
26
 
@@ -0,0 +1,84 @@
1
+ import { Menu, MenuProps } from 'antd';
2
+ import { useMemo } from 'react';
3
+ import { ChatListItemBox } from './ChatListItemBox';
4
+ import { customize } from '../../customize';
5
+ import { ChatListValue } from './ChatListValue';
6
+ import { useLocalizer } from '../../localizer';
7
+ import { messageSequencePart } from '../../../core';
8
+
9
+ export interface ChatListProps {
10
+ className?: string;
11
+ items: ChatListValue[];
12
+ selected: string | null;
13
+ onSelect?: (id: string) => void;
14
+
15
+ /**
16
+ * If true, do not show read status.
17
+ */
18
+ noRead?: boolean;
19
+
20
+ /**
21
+ * If set, shows a message at the bottom indicating that only the top N chats are shown.
22
+ */
23
+ top?: number;
24
+ }
25
+
26
+ function useOnSelect(props: ChatListProps) {
27
+ const { onSelect } = props;
28
+
29
+ return useMemo(
30
+ () =>
31
+ onSelect
32
+ ? (info: Parameters<NonNullable<MenuProps['onSelect']>>[0]) => onSelect(info.key as string)
33
+ : undefined,
34
+ [onSelect],
35
+ );
36
+ }
37
+
38
+ function useMenuItems(props: ChatListProps) {
39
+ //28b2a1a6-c052-4761-ad2d-95ce36d59f06-000000001
40
+ const { items, noRead, top } = props;
41
+ const localizer = useLocalizer();
42
+
43
+ return useMemo<MenuProps['items']>(() => {
44
+ const result = items
45
+ ?.slice()
46
+ .sort(
47
+ (a, b) => -messageSequencePart(a.lastMessage.id).localeCompare(messageSequencePart(b.lastMessage.id)),
48
+ )
49
+ .map((x) => ({ key: x.id, label: <ChatListItemBox chat={x} noRead={noRead} /> }));
50
+
51
+ if (top != null) {
52
+ return [
53
+ ...result,
54
+ {
55
+ type: 'item',
56
+ key: 'top',
57
+ disabled: true,
58
+ label: (
59
+ <div style={{ textAlign: 'center', cursor: 'text', fontStyle: 'italic' }}>
60
+ {localizer.chatList.topShown(top)}
61
+ </div>
62
+ ),
63
+ },
64
+ ];
65
+ }
66
+
67
+ return result;
68
+ }, [items, noRead, top, localizer]);
69
+ }
70
+
71
+ export const ChatList = customize('ChatList', (props: ChatListProps) => {
72
+ const { selected: selectedChatId } = props;
73
+ const selected = useMemo(() => (selectedChatId ? [selectedChatId] : []), [selectedChatId]);
74
+ const onSelect = useOnSelect(props);
75
+ const items = useMenuItems(props);
76
+
77
+ return (
78
+ <>
79
+ {items && (
80
+ <Menu className="wxchtf-chat-list" selectedKeys={selected} onSelect={onSelect} items={items} />
81
+ )}
82
+ </>
83
+ );
84
+ });
@@ -1,20 +1,26 @@
1
- import { ChatListItem as ChatListItemModel } from '../../../core';
2
1
  import { customize } from '../../customize';
3
2
  import { ChatListItemName } from './ChatListItemName';
4
3
  import { ChatListItemUnreadCount } from './ChatListItemUnreadCount';
5
4
  import { ChatListItemLastMessage } from './ChatListItemLastMessage';
6
5
  import { ChatListItemAvatar } from './ChatListItemAvatar';
6
+ import { ChatListValue } from './ChatListValue';
7
7
 
8
8
  export interface ChatListItemBoxProps {
9
- chat: ChatListItemModel;
9
+ chat: ChatListValue;
10
+
11
+ /**
12
+ * If true, do not show read status.
13
+ */
14
+ noRead?: boolean;
10
15
  }
11
16
 
12
17
  export const ChatListItemBox = customize('ChatListItemBox', (props: ChatListItemBoxProps) => {
13
- const { message, lastReadMessageId } = props.chat;
14
- const read = lastReadMessageId != null && lastReadMessageId.localeCompare(message.id) >= 0;
18
+ const { noRead = false } = props;
19
+ const { lastMessage, lastReadMessageId } = props.chat;
20
+ const read = lastReadMessageId != null && lastReadMessageId.localeCompare(lastMessage.id) >= 0;
15
21
 
16
22
  return (
17
- <div className={'wxchtf-chat' + (!read ? ' --unread' : '')}>
23
+ <div className={'wxchtf-chat' + (!read && !noRead ? ' --unread' : '')}>
18
24
  <ChatListItemAvatar {...props} />
19
25
  <span className="wxchtf-chat-info">
20
26
  <ChatListItemName {...props} />
@@ -4,12 +4,12 @@ import type { ChatListItemBoxProps } from './ChatListItemBox';
4
4
  export const ChatListItemLastMessageAuthor = customize(
5
5
  'ChatListItemLastMessageAuthor',
6
6
  (props: ChatListItemBoxProps) => {
7
- const { message } = props.chat;
7
+ const { lastMessage } = props.chat;
8
8
 
9
- if (message.sentBy.id === 'chatify::system') {
9
+ if (lastMessage.sentBy.id === 'chatify::system') {
10
10
  return null;
11
11
  }
12
12
 
13
- return <div className="wxchtf-chat-last-author">{message.sentBy.name}</div>;
13
+ return <div className="wxchtf-chat-last-author">{lastMessage.sentBy.name}</div>;
14
14
  },
15
15
  );
@@ -7,14 +7,14 @@ import type { ChatListItemBoxProps } from './ChatListItemBox';
7
7
  export const ChatListItemLastMessageContent = customize<FC<ChatListItemBoxProps>>(
8
8
  'ChatListItemLastMessageContent',
9
9
  (props) => {
10
- const { message } = props.chat;
10
+ const { lastMessage } = props.chat;
11
11
  const localizer = useLocalizer();
12
12
 
13
13
  return (
14
14
  <div className="wxchtf-chat-last-message">
15
- {message.sentBy.id === 'chatify::system'
16
- ? message.text && formatSystemMessage(localizer, message.text)
17
- : message.text}
15
+ {lastMessage.sentBy.id === 'chatify::system'
16
+ ? lastMessage.text && formatSystemMessage(localizer, lastMessage.text)
17
+ : lastMessage.text}
18
18
  </div>
19
19
  );
20
20
  },
@@ -7,7 +7,7 @@ export const ChatListItemLastMessageSentAt = customize(
7
7
  (props: ChatListItemBoxProps) => {
8
8
  const {
9
9
  chat: {
10
- message: { sentAt },
10
+ lastMessage: { sentAt },
11
11
  },
12
12
  } = props;
13
13
 
@@ -4,7 +4,7 @@ import { ChatListItemBoxProps } from './ChatListItemBox';
4
4
  export const ChatListItemUnreadCount = customize('ChatListItemUnreadCount', (props: ChatListItemBoxProps) => {
5
5
  const { totalUnreadCount: unreadCount } = props.chat;
6
6
 
7
- if (unreadCount <= 0) {
7
+ if (unreadCount == null || unreadCount <= 0) {
8
8
  return null;
9
9
  }
10
10
 
@@ -0,0 +1,9 @@
1
+ import { MessageBase } from '../../../core';
2
+
3
+ export interface ChatListValue {
4
+ id: string;
5
+ name: string;
6
+ lastMessage: MessageBase;
7
+ totalUnreadCount?: number;
8
+ lastReadMessageId?: string | null;
9
+ }