@tencentcloud/chat-uikit-react 1.2.2 → 2.1.2

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 (255) hide show
  1. package/.eslintrc.js +2 -1
  2. package/CHANGELOG.md +13 -2
  3. package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  4. package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  5. package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  6. package/dist/cjs/components/ConversationPreview/ConversationPreview.d.ts +2 -0
  7. package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
  8. package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  9. package/dist/cjs/components/ConversationPreview/utils.js +1 -1
  10. package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -1
  11. package/dist/cjs/components/Icon/config.js +1 -1
  12. package/dist/cjs/components/Icon/images/chats-selected.svg.js +1 -0
  13. package/dist/cjs/components/Icon/images/chats.svg.js +1 -0
  14. package/dist/cjs/components/Icon/images/contacts-selected.svg.js +1 -0
  15. package/dist/cjs/components/Icon/images/contacts.svg.js +1 -0
  16. package/dist/cjs/components/Icon/images/files.png.js +1 -0
  17. package/dist/cjs/components/Icon/images/image.png.js +1 -1
  18. package/dist/cjs/components/Icon/images/video.png.js +1 -1
  19. package/dist/cjs/components/TUIChat/TUIChat.d.ts +5 -0
  20. package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
  21. package/dist/cjs/components/TUIChat/TUIChatState.js +1 -1
  22. package/dist/cjs/components/TUIChat/hooks/useHandleMessage.js +1 -1
  23. package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  24. package/dist/cjs/components/TUIChat/unitls.js +1 -1
  25. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  26. package/dist/cjs/components/TUIContact/TUIContact.js +1 -1
  27. package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -1
  28. package/dist/cjs/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
  29. package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  30. package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  31. package/dist/cjs/components/TUIConversation/TUIConversation.js +1 -1
  32. package/dist/cjs/components/TUIConversationList/TUIConversationList.d.ts +1 -0
  33. package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -1
  34. package/dist/cjs/components/TUIKit/TUIKit.js +1 -1
  35. package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
  36. package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -1
  37. package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
  38. package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -1
  39. package/dist/cjs/components/TUIMessage/MessageImage.js +1 -1
  40. package/dist/cjs/components/TUIMessage/MessageName.js +1 -1
  41. package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
  42. package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
  43. package/dist/cjs/components/TUIMessage/MessageSystem.js +1 -1
  44. package/dist/cjs/components/TUIMessage/MessageText.js +1 -1
  45. package/dist/cjs/components/TUIMessage/MessageTip.js +1 -1
  46. package/dist/cjs/components/TUIMessage/MessageVideo.js +1 -1
  47. package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
  48. package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  49. package/dist/cjs/components/TUIMessage/utils/index.js +1 -1
  50. package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
  51. package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -1
  52. package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  53. package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  54. package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  55. package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  56. package/dist/cjs/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
  57. package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
  58. package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
  59. package/dist/cjs/components/untils.js +1 -1
  60. package/dist/cjs/constants.js +1 -1
  61. package/dist/cjs/context/ComponentContext.d.ts +2 -0
  62. package/dist/cjs/context/TUIChatActionContext.d.ts +3 -14
  63. package/dist/cjs/context/TUIChatStateContext.d.ts +2 -0
  64. package/dist/cjs/context/TUIConversationContext.js +1 -1
  65. package/dist/cjs/index.css +1 -1
  66. package/dist/cjs/index.d.css +257 -12
  67. package/dist/cjs/index.js +1 -1
  68. package/dist/cjs/locales/en/TUIChat.js +1 -1
  69. package/dist/cjs/locales/en/TUIContact.js +1 -1
  70. package/dist/cjs/locales/en/TUIProfile.js +1 -1
  71. package/dist/cjs/locales/index.js +1 -1
  72. package/dist/cjs/locales/zh_cn/TUIChat.js +1 -1
  73. package/dist/cjs/locales/zh_cn/TUIContact.js +1 -1
  74. package/dist/cjs/locales/zh_cn/TUIProfile.js +1 -1
  75. package/dist/cjs/server.js +1 -0
  76. package/dist/cjs/utils/env.js +1 -0
  77. package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  78. package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  79. package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  80. package/dist/esm/components/ConversationPreview/ConversationPreview.d.ts +2 -0
  81. package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
  82. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  83. package/dist/esm/components/ConversationPreview/utils.js +1 -1
  84. package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
  85. package/dist/esm/components/Icon/config.js +1 -1
  86. package/dist/esm/components/Icon/images/chats-selected.svg.js +1 -0
  87. package/dist/esm/components/Icon/images/chats.svg.js +1 -0
  88. package/dist/esm/components/Icon/images/contacts-selected.svg.js +1 -0
  89. package/dist/esm/components/Icon/images/contacts.svg.js +1 -0
  90. package/dist/esm/components/Icon/images/files.png.js +1 -0
  91. package/dist/esm/components/Icon/images/image.png.js +1 -1
  92. package/dist/esm/components/Icon/images/video.png.js +1 -1
  93. package/dist/esm/components/TUIChat/TUIChat.d.ts +5 -0
  94. package/dist/esm/components/TUIChat/TUIChat.js +1 -1
  95. package/dist/esm/components/TUIChat/TUIChatState.js +1 -1
  96. package/dist/esm/components/TUIChat/hooks/useHandleMessage.js +1 -1
  97. package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  98. package/dist/esm/components/TUIChat/unitls.js +1 -1
  99. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  100. package/dist/esm/components/TUIContact/TUIContact.js +1 -1
  101. package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -1
  102. package/dist/esm/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
  103. package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  104. package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  105. package/dist/esm/components/TUIConversation/TUIConversation.js +1 -1
  106. package/dist/esm/components/TUIConversationList/TUIConversationList.d.ts +1 -0
  107. package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -1
  108. package/dist/esm/components/TUIKit/TUIKit.js +1 -1
  109. package/dist/esm/components/TUIManage/TUIManage.js +1 -1
  110. package/dist/esm/components/TUIMessage/MessageBubble.js +1 -1
  111. package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
  112. package/dist/esm/components/TUIMessage/MessageCustom.js +1 -1
  113. package/dist/esm/components/TUIMessage/MessageImage.js +1 -1
  114. package/dist/esm/components/TUIMessage/MessageName.js +1 -1
  115. package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
  116. package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
  117. package/dist/esm/components/TUIMessage/MessageSystem.js +1 -1
  118. package/dist/esm/components/TUIMessage/MessageText.js +1 -1
  119. package/dist/esm/components/TUIMessage/MessageTip.js +1 -1
  120. package/dist/esm/components/TUIMessage/MessageVideo.js +1 -1
  121. package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
  122. package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  123. package/dist/esm/components/TUIMessage/utils/index.js +1 -1
  124. package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
  125. package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -1
  126. package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  127. package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  128. package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  129. package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  130. package/dist/esm/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
  131. package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
  132. package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
  133. package/dist/esm/components/untils.js +1 -1
  134. package/dist/esm/constants.js +1 -1
  135. package/dist/esm/context/ComponentContext.d.ts +2 -0
  136. package/dist/esm/context/TUIChatActionContext.d.ts +3 -14
  137. package/dist/esm/context/TUIChatStateContext.d.ts +2 -0
  138. package/dist/esm/context/TUIConversationContext.js +1 -1
  139. package/dist/esm/index.css +1 -1
  140. package/dist/esm/index.d.css +257 -12
  141. package/dist/esm/index.js +1 -1
  142. package/dist/esm/locales/en/TUIChat.js +1 -1
  143. package/dist/esm/locales/en/TUIContact.js +1 -1
  144. package/dist/esm/locales/en/TUIProfile.js +1 -1
  145. package/dist/esm/locales/index.js +1 -1
  146. package/dist/esm/locales/zh_cn/TUIChat.js +1 -1
  147. package/dist/esm/locales/zh_cn/TUIContact.js +1 -1
  148. package/dist/esm/locales/zh_cn/TUIProfile.js +1 -1
  149. package/dist/esm/server.js +1 -0
  150. package/dist/esm/utils/env.js +1 -0
  151. package/package.json +8 -7
  152. package/rollup.config.js +0 -1
  153. package/scripts/publish-github.js +60 -0
  154. package/scripts/publish-intl-demo.js +14 -0
  155. package/scripts/publish-npm.js +22 -0
  156. package/src/components/Avatar/styles/index.scss +1 -0
  157. package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +6 -3
  158. package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +5 -1
  159. package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +7 -2
  160. package/src/components/ConversationCreate/styles/conversationGroupTypeInfo.scss +1 -0
  161. package/src/components/ConversationCreate/styles/index.scss +2 -0
  162. package/src/components/ConversationPreview/ConversationPreview.tsx +2 -0
  163. package/src/components/ConversationPreview/ConversationPreviewContent.tsx +57 -9
  164. package/src/components/ConversationPreview/styles/index.scss +4 -2
  165. package/src/components/ConversationPreview/utils.tsx +5 -1
  166. package/src/components/DivWithEdit/styles/index.scss +2 -1
  167. package/src/components/Icon/config.ts +4 -5
  168. package/src/components/Icon/images/chats-selected.svg +6 -0
  169. package/src/components/Icon/images/chats.svg +9 -0
  170. package/src/components/Icon/images/contacts-selected.svg +3 -0
  171. package/src/components/Icon/images/contacts.svg +6 -0
  172. package/src/components/Icon/images/files.png +0 -0
  173. package/src/components/Icon/images/image.png +0 -0
  174. package/src/components/Icon/images/language.svg +3 -0
  175. package/src/components/Icon/images/video.png +0 -0
  176. package/src/components/Model/styles/layout.scss +1 -1
  177. package/src/components/Profile/styles/index.scss +4 -0
  178. package/src/components/TUIChat/TUIChat.tsx +74 -120
  179. package/src/components/TUIChat/TUIChatState.tsx +18 -45
  180. package/src/components/TUIChat/hooks/useHandleMessage.tsx +8 -0
  181. package/src/components/TUIChat/hooks/useHandleMessageList.tsx +2 -41
  182. package/src/components/TUIChat/unitls.ts +0 -29
  183. package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +9 -2
  184. package/src/components/TUIContact/TUIContact.tsx +2 -1
  185. package/src/components/TUIContact/TUIContactInfo/TUIContactInfo.tsx +2 -1
  186. package/src/components/TUIContact/TUIContactInfo/basicInfo.tsx +18 -0
  187. package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +4 -1
  188. package/src/components/TUIContact/TUIContactInfo/index.scss +5 -0
  189. package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +3 -2
  190. package/src/components/TUIContact/TUIContactList/index.scss +5 -0
  191. package/src/components/TUIContact/index.scss +5 -0
  192. package/src/components/TUIConversation/TUIConversation.tsx +1 -4
  193. package/src/components/TUIConversationList/TUIConversationList.tsx +91 -65
  194. package/src/components/TUIConversationList/index.scss +5 -0
  195. package/src/components/TUIKit/TUIKit.tsx +152 -10
  196. package/src/components/TUIKit/styles/h5.scss +34 -0
  197. package/src/components/TUIKit/styles/index.scss +103 -0
  198. package/src/components/TUIKit/styles/reset.scss +20 -0
  199. package/src/components/TUIManage/TUIManage.tsx +59 -35
  200. package/src/components/TUIManage/styles/index.scss +15 -1
  201. package/src/components/TUIMessage/MessageBubble.tsx +20 -3
  202. package/src/components/TUIMessage/MessageCustom.tsx +11 -2
  203. package/src/components/TUIMessage/MessageImage.tsx +2 -1
  204. package/src/components/TUIMessage/MessageName.tsx +1 -1
  205. package/src/components/TUIMessage/MessagePlugins.tsx +4 -2
  206. package/src/components/TUIMessage/MessageRevoke.tsx +2 -2
  207. package/src/components/TUIMessage/MessageText.tsx +25 -3
  208. package/src/components/TUIMessage/MessageVideo.tsx +8 -5
  209. package/src/components/TUIMessage/hooks/useMessageHandler.ts +13 -33
  210. package/src/components/TUIMessage/styles/color.scss +1 -0
  211. package/src/components/TUIMessage/styles/layout.scss +33 -6
  212. package/src/components/TUIMessage/utils/index.ts +1 -1
  213. package/src/components/TUIMessageInput/TUIMessageInputDefault.tsx +2 -2
  214. package/src/components/TUIMessageInput/hooks/useEmojiPicker.tsx +2 -6
  215. package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +4 -3
  216. package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +10 -3
  217. package/src/components/TUIMessageInput/hooks/useUploadPicker.tsx +10 -14
  218. package/src/components/TUIMessageInput/styles/color.scss +1 -1
  219. package/src/components/TUIMessageInput/styles/layout.scss +7 -2
  220. package/src/components/TUIMessageList/TUIMessageList.tsx +9 -13
  221. package/src/components/TUIMessageList/index.ts +0 -1
  222. package/src/components/TUIProfile/TUIProfileDefault.tsx +65 -51
  223. package/src/components/TUIProfile/styles/layout.scss +6 -0
  224. package/src/components/untils.ts +9 -0
  225. package/src/constants.ts +9 -1
  226. package/src/context/ComponentContext.tsx +2 -0
  227. package/src/context/TUIChatActionContext.tsx +3 -23
  228. package/src/context/TUIChatStateContext.tsx +2 -0
  229. package/src/context/TUIKitContext.tsx +0 -1
  230. package/src/index.ts +3 -0
  231. package/src/locales/en/TUIChat.ts +2 -1
  232. package/src/locales/en/TUIContact.ts +1 -1
  233. package/src/locales/en/TUIProfile.ts +5 -4
  234. package/src/locales/index.ts +1 -1
  235. package/src/locales/zh_cn/TUIChat.ts +1 -0
  236. package/src/locales/zh_cn/TUIContact.ts +1 -1
  237. package/src/locales/zh_cn/TUIProfile.ts +1 -0
  238. package/src/server.ts +44 -0
  239. package/src/utils/env.ts +5 -0
  240. package/tsconfig.json +1 -0
  241. package/dist/cjs/components/Icon/images/create.png.js +0 -1
  242. package/dist/cjs/components/Icon/images/document.png.js +0 -1
  243. package/dist/cjs/components/TUIChat/hooks/useCreateMessage.d.ts +0 -59
  244. package/dist/cjs/components/TUIChat/hooks/useCreateMessage.js +0 -1
  245. package/dist/cjs/components/TUIChat/hooks/useMessageReceviedListener.js +0 -1
  246. package/dist/cjs/components/TUIMessageList/hooks/useEnrichedMessageList.js +0 -1
  247. package/dist/esm/components/Icon/images/create.png.js +0 -1
  248. package/dist/esm/components/Icon/images/document.png.js +0 -1
  249. package/dist/esm/components/TUIChat/hooks/useCreateMessage.d.ts +0 -59
  250. package/dist/esm/components/TUIChat/hooks/useCreateMessage.js +0 -1
  251. package/dist/esm/components/TUIChat/hooks/useMessageReceviedListener.js +0 -1
  252. package/dist/esm/components/TUIMessageList/hooks/useEnrichedMessageList.js +0 -1
  253. package/src/components/TUIChat/hooks/useCreateMessage.tsx +0 -198
  254. package/src/components/TUIChat/hooks/useMessageReceviedListener.tsx +0 -26
  255. package/src/components/TUIMessageList/hooks/useEnrichedMessageList.tsx +0 -16
@@ -23,6 +23,7 @@
23
23
  .name {
24
24
  display: inline-block;
25
25
  padding-bottom: 3px;
26
+ max-width: 60%;
26
27
  }
27
28
  }
28
29
  }
@@ -57,7 +58,7 @@
57
58
  .bubble {
58
59
  padding: 8px 16px;
59
60
  &-in {
60
- border-radius: 16px 16px 16px 0;
61
+ border-radius: 0px 16px 16px 16px;
61
62
  &.group {
62
63
  border-radius: 0px 16px 16px 16px;
63
64
  }
@@ -104,8 +105,9 @@
104
105
  font-style: normal;
105
106
  font-weight: 500;
106
107
  font-size: 14px;
107
- line-height: 17px;
108
+ line-height: 24px;
108
109
  &-p {
110
+ white-space: pre-wrap;
109
111
  display: inline;
110
112
  vertical-align: middle;
111
113
  }
@@ -136,9 +138,13 @@
136
138
  img {
137
139
  max-width: 300px;
138
140
  }
141
+ .img-h5 {
142
+ max-width: 200px;
143
+ max-height: 200px;
144
+ }
139
145
  .big-image {
140
- max-width: 95%;
141
- max-height: 95%;
146
+ max-width: 90%;
147
+ max-height: 90%;
142
148
  }
143
149
  }
144
150
 
@@ -146,6 +152,8 @@
146
152
  max-width: 300px;
147
153
  .snap-video {
148
154
  position: relative;
155
+ height: 100%;
156
+ border-radius: 10px;
149
157
  &::before {
150
158
  position: absolute;
151
159
  z-index: 1;
@@ -163,14 +171,18 @@
163
171
  }
164
172
  video {
165
173
  width: 100%;
174
+ height: 100%;
166
175
  border-radius: 10px;
167
176
  }
168
177
  .play-video {
169
178
  max-width: 95%;
170
- max-height: 95%;
179
+ max-height: 65%;
171
180
  }
172
181
  }
173
-
182
+ .message-video.message-video-h5 {
183
+ max-width: 200px;
184
+ max-height: 200px;
185
+ }
174
186
  .message-file {
175
187
  display: flex;
176
188
  flex-direction: column;
@@ -317,6 +329,13 @@
317
329
  max-width: 300px;
318
330
  border-radius: 10px;
319
331
  }
332
+ .img-h5, .video-h5{
333
+ min-width: 60px;
334
+ min-height: 60px;
335
+ max-width: 200px;
336
+ max-height: 200px;
337
+ border-radius: 10px;
338
+ }
320
339
  &::before {
321
340
  position: absolute;
322
341
  content: "";
@@ -358,6 +377,7 @@
358
377
  .plugin-popup-box{
359
378
  bottom: auto;
360
379
  top: 100%;
380
+ overflow: hidden;
361
381
  }
362
382
 
363
383
  &-box {
@@ -449,17 +469,20 @@
449
469
  @keyframes highLightedAnimation {
450
470
  0% {
451
471
  opacity: 1;
472
+ color: #ff9c19;
452
473
  }
453
474
  25% {
454
475
  opacity: 0.3;
455
476
  }
456
477
  50% {
478
+ color: #ff9c19;
457
479
  opacity: 1;
458
480
  }
459
481
  75% {
460
482
  opacity: 0.3;
461
483
  }
462
484
  100% {
485
+ color: #ff9c19;
463
486
  opacity: 1;
464
487
  }
465
488
  }
@@ -478,3 +501,7 @@
478
501
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
479
502
  }
480
503
  }
504
+
505
+ .website {
506
+ color: #147aff !important;
507
+ }
@@ -127,7 +127,7 @@ export function handleTipMessageShowContext(message: Message) {
127
127
  options.text = `${t('message.tip.member')}:${userName} ${t('message.tip.quit group')}`;
128
128
  break;
129
129
  case TencentCloudChat.TYPES.GRP_TIP_MBR_KICKED_OUT:
130
- options.text = `${t('message.tip.member')}:${userName} ${t('message.tip.by')}${message.payload.operatorID}${t(
130
+ options.text = `${t('message.tip.member')}:${userName} ${t('message.tip.by')} ${message.payload.operatorID} ${t(
131
131
  'message.tip.kicked out of group',
132
132
  )}`;
133
133
  break;
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { MESSAGE_OPERATE } from '../../constants';
4
4
  import { useTUIChatStateContext } from '../../context';
5
-
5
+ import { isPC } from '../../utils/env';
6
6
  import { useTUIMessageInputContext } from '../../context/TUIMessageInputContext';
7
7
  import { formatEmojiString } from '../TUIMessage/utils/emojiMap';
8
8
 
@@ -34,7 +34,7 @@ export function TUIMessageInputDefault():React.ReactElement {
34
34
  useEffect(() => {
35
35
  if (focus && textareaRef.current) {
36
36
  textareaRef.current.autofocus = true;
37
- textareaRef?.current?.focus();
37
+ isPC && textareaRef?.current?.focus();
38
38
  textareaRef?.current?.addEventListener('paste', handlePasete);
39
39
  }
40
40
  return () => {
@@ -4,7 +4,7 @@ import {
4
4
  useCallback,
5
5
  } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
- import { useTUIChatActionContext } from '../../../context';
7
+ import { TUIChatService } from '@tencentcloud/chat-uikit-engine';
8
8
  import { emojiEnKey } from '../../TUIMessage/utils/emojiMap';
9
9
  import type { IbaseStateProps } from './useMessageInputState';
10
10
 
@@ -25,7 +25,6 @@ export function useEmojiPicker<T extends useEmojiPickerProps>(props:PropsWithChi
25
25
  } = props;
26
26
 
27
27
  const { i18n } = useTranslation();
28
- const { sendMessage, createFaceMessage } = useTUIChatActionContext('useEmojiPicker');
29
28
 
30
29
  const onSelectEmoji = (emoji:EmojiData) => {
31
30
  if (i18n.language === 'zh') {
@@ -36,10 +35,7 @@ export function useEmojiPicker<T extends useEmojiPickerProps>(props:PropsWithChi
36
35
  };
37
36
 
38
37
  const sendFaceMessage = useCallback((emoji:EmojiData) => {
39
- const message = createFaceMessage({
40
- payload: emoji,
41
- });
42
- sendMessage(message);
38
+ TUIChatService.sendFaceMessage({ payload: emoji });
43
39
  }, []);
44
40
 
45
41
  return {
@@ -1,5 +1,8 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import TencentCloudChat, { Conversation, Message } from '@tencentcloud/chat';
3
+ import {
4
+ TUIChatService,
5
+ } from '@tencentcloud/chat-uikit-engine';
3
6
  import { MESSAGE_OPERATE } from '../../../constants';
4
7
  import {
5
8
  useTUIChatActionContext, useTUIChatStateContext, useTUIKitContext,
@@ -11,15 +14,13 @@ export function useHandleForwardMessage(msg?:Message) {
11
14
  } = useTUIChatStateContext('TUIMessageInputDefault');
12
15
 
13
16
  const [conversationList, setConversationList] = useState([]);
14
- const { sendMessage, createForwardMessage } = useTUIChatActionContext('useHandleForwardMessage');
15
17
  const { chat } = useTUIKitContext('TUIChat');
16
18
 
17
19
  const message = msg || operateData[MESSAGE_OPERATE.FORWARD];
18
20
 
19
21
  const sendForwardMessage = (list:Array<Conversation>) => {
20
22
  list.map((item:Conversation) => {
21
- const forwardMessage = createForwardMessage({ conversation: item, message });
22
- sendMessage(forwardMessage);
23
+ TUIChatService.sendForwardMessage([item], [message]);
23
24
  return item;
24
25
  });
25
26
  };
@@ -3,11 +3,15 @@ import React, {
3
3
  ChangeEventHandler,
4
4
  MutableRefObject,
5
5
  } from 'react';
6
+ import {
7
+ TUIChatService,
8
+ } from '@tencentcloud/chat-uikit-engine';
6
9
  import { CONSTANT_DISPATCH_TYPE, MESSAGE_OPERATE, MESSAGE_TYPE_NAME } from '../../../constants';
7
10
  import {
8
11
  useTUIChatActionContext,
9
12
  useTUIKitContext,
10
13
  } from '../../../context';
14
+ import { enableSampleTaskStatus } from '../../untils';
11
15
  import { formatEmojiString } from '../../TUIMessage/utils/emojiMap';
12
16
  import { useHandleQuoteMessage } from './useHandleQuoteMessage';
13
17
  import type { IbaseStateProps, ICursorPos } from './useMessageInputState';
@@ -29,7 +33,7 @@ export const useMessageInputText = (props:useMessageInputTextProps) => {
29
33
  } = props;
30
34
 
31
35
  const { chat } = useTUIKitContext('useMessageInputText');
32
- const { sendMessage, createTextMessage, operateMessage } = useTUIChatActionContext('TUIMessageInput');
36
+ const { operateMessage, setFirstSendMessage } = useTUIChatActionContext('TUIMessageInput');
33
37
 
34
38
  const { cloudCustomData } = useHandleQuoteMessage();
35
39
 
@@ -64,8 +68,11 @@ export const useMessageInputText = (props:useMessageInputTextProps) => {
64
68
  if (cloudCustomData.messageReply) {
65
69
  options.cloudCustomData = JSON.stringify(cloudCustomData);
66
70
  }
67
- const message = createTextMessage(options);
68
- await sendMessage(message);
71
+ TUIChatService.sendTextMessage(options).then((res: any) => {
72
+ const { message } = res.data;
73
+ setFirstSendMessage(message);
74
+ });
75
+ enableSampleTaskStatus('sendMessage');
69
76
  dispatch({
70
77
  getNewText: (text:string) => '',
71
78
  type: CONSTANT_DISPATCH_TYPE.SET_TEXT,
@@ -2,7 +2,11 @@ import {
2
2
  PropsWithChildren,
3
3
  useCallback,
4
4
  } from 'react';
5
+ import {
6
+ TUIChatService,
7
+ } from '@tencentcloud/chat-uikit-engine';
5
8
  import { MESSAGE_TYPE_NAME } from '../../../constants';
9
+ import { enableSampleTaskStatus } from '../../untils';
6
10
  import { useTUIChatActionContext } from '../../../context';
7
11
  import type { IbaseStateProps } from './useMessageInputState';
8
12
 
@@ -12,29 +16,21 @@ export interface filesData {
12
16
 
13
17
  export function useUploadPicker<T extends IbaseStateProps>(props:PropsWithChildren<T>) {
14
18
  const {
15
- sendMessage,
16
- createImageMessage,
17
- createVideoMessage,
18
- createFileMessage,
19
19
  updateUploadPendingMessageList,
20
20
  } = useTUIChatActionContext('useUploadPicker');
21
21
 
22
22
  const creatUploadMessage = {
23
- [MESSAGE_TYPE_NAME.IMAGE]: createImageMessage,
24
- [MESSAGE_TYPE_NAME.VIDEO]: createVideoMessage,
25
- [MESSAGE_TYPE_NAME.FILE]: createFileMessage,
23
+ [MESSAGE_TYPE_NAME.IMAGE]: TUIChatService.sendImageMessage,
24
+ [MESSAGE_TYPE_NAME.VIDEO]: TUIChatService.sendVideoMessage,
25
+ [MESSAGE_TYPE_NAME.FILE]: TUIChatService.sendFileMessage,
26
26
  };
27
27
 
28
28
  const sendUploadMessage = useCallback((file: filesData, type:MESSAGE_TYPE_NAME) => {
29
- const message = creatUploadMessage[type]({
29
+ creatUploadMessage[type]({
30
30
  payload: file,
31
- onProgress(num:number) {
32
- message.progress = num;
33
- updateUploadPendingMessageList(message);
34
- },
35
31
  });
36
- sendMessage(message);
37
- }, [sendMessage]);
32
+ enableSampleTaskStatus('sendMessage');
33
+ }, []);
38
34
 
39
35
  return {
40
36
  sendUploadMessage,
@@ -10,7 +10,7 @@
10
10
 
11
11
  .input-plugin-popup {
12
12
  &-box {
13
- background: rgba(249, 249, 249, 0.94);
13
+ background: #FFFFFF;
14
14
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
15
15
  border-radius: 16px;
16
16
  }
@@ -91,11 +91,11 @@ ul li {
91
91
  // emoji picker styles
92
92
  .emoji-picker {
93
93
  .face-list {
94
- min-width: 265px;
94
+ height: 120px;
95
+ width: 242px;
95
96
  padding: 10px 5px;
96
97
  display: flex;
97
98
  flex-wrap: wrap;
98
- max-height: 120px;
99
99
  overflow-y: auto;
100
100
  &-item {
101
101
  padding: 5px;
@@ -190,6 +190,7 @@ ul li {
190
190
  flex-direction: column;
191
191
  overflow: hidden;
192
192
  width: 300px;
193
+ max-height: 90%;
193
194
  &-header {
194
195
  display: flex;
195
196
  align-items: center;
@@ -239,9 +240,12 @@ ul li {
239
240
  display: flex;
240
241
  justify-content: space-between;
241
242
  align-items: center;
243
+ width: 100%;
242
244
  .info {
243
245
  display: flex;
244
246
  align-items: center;
247
+ flex-shrink: 0;
248
+ width: 100%;
245
249
  &-nick {
246
250
  padding: 0 13px;
247
251
  font-family: PingFangSC-Medium;
@@ -254,6 +258,7 @@ ul li {
254
258
  overflow: hidden;
255
259
  white-space: nowrap;
256
260
  text-overflow: ellipsis;
261
+ width: 80%;
257
262
  }
258
263
  }
259
264
  }
@@ -6,7 +6,6 @@ import {
6
6
  useTUIChatActionContext,
7
7
  useComponentContext,
8
8
  } from '../../context';
9
- import useEnrichedMessageList from './hooks/useEnrichedMessageList';
10
9
  import useMessageListElement from './hooks/useMessageListElement';
11
10
 
12
11
  import { InfiniteScroll, InfiniteScrollProps } from '../InfiniteScrollPaginator';
@@ -25,7 +24,6 @@ function TUIMessageListWithContext <T extends MessageListProps>(
25
24
  props: PropsWithChildren<T>,
26
25
  ):React.ReactElement {
27
26
  const {
28
- messageList: propsMessageList,
29
27
  highlightedMessageId: propsHighlightedMessageId,
30
28
  loadMore: propsLoadMore,
31
29
  intervalsTimer: propsIntervalsTimer,
@@ -35,7 +33,6 @@ function TUIMessageListWithContext <T extends MessageListProps>(
35
33
  const { t } = useTranslation();
36
34
  const [ulElement, setUlElement] = useState<HTMLUListElement | null>(null);
37
35
  const [firstRender, setFirstRender] = useState<boolean>(false);
38
-
39
36
  const {
40
37
  messageList: contextMessageList,
41
38
  highlightedMessageId: contextHighlightedMessageId,
@@ -51,32 +48,31 @@ function TUIMessageListWithContext <T extends MessageListProps>(
51
48
  const highlightedMessageId = propsHighlightedMessageId
52
49
  || TUIMessageListConfig?.highlightedMessageId
53
50
  || contextHighlightedMessageId;
54
- const intervalsTimer = (propsIntervalsTimer || TUIMessageListConfig?.intervalsTimer || 30) * 60;
55
51
 
56
- const { messageList: enrichedMessageList } = useEnrichedMessageList({
57
- messageList: propsMessageList || TUIMessageListConfig?.messageList || contextMessageList,
58
- });
52
+ const intervalsTimer = (propsIntervalsTimer || TUIMessageListConfig?.intervalsTimer || 30) * 60;
59
53
 
60
54
  const loadMore = propsLoadMore || TUIMessageListConfig?.loadMore || contextLoadMore;
61
55
 
62
56
  const elements = useMessageListElement({
63
- enrichedMessageList,
57
+ enrichedMessageList: contextMessageList,
64
58
  TUIMessage,
65
59
  intervalsTimer,
66
60
  });
67
-
68
61
  useEffect(() => {
62
+ // messageList 滑动到底部
69
63
  (async () => {
70
64
  const parentElement = ulElement?.parentElement?.parentElement;
71
- if (!isCompleted && parentElement?.clientHeight >= ulElement?.clientHeight) {
65
+ if (
66
+ !isCompleted
67
+ && parentElement?.clientHeight >= ulElement?.clientHeight
68
+ ) {
72
69
  await loadMore();
73
70
  }
74
-
75
- if (ulElement?.children && (!firstRender || !isSameLastMessageID)) {
71
+ if (ulElement?.children) {
76
72
  const HTMLCollection = ulElement?.children || [];
77
73
  const element = HTMLCollection[HTMLCollection.length - 1];
78
74
  const timer = setTimeout(() => {
79
- element?.scrollIntoView({ block: 'end' });
75
+ element?.scrollIntoView();
80
76
  setFirstRender(true);
81
77
  clearTimeout(timer);
82
78
  }, 100);
@@ -1,2 +1 @@
1
1
  export * from './TUIMessageList';
2
- export * from './hooks/useEnrichedMessageList';
@@ -1,8 +1,8 @@
1
- import React, { PropsWithChildren, useState } from 'react';
1
+ import React, { PropsWithChildren, useEffect, useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import DatePicker from 'react-date-picker';
4
4
  import TencentCloudChat, { Profile } from '@tencentcloud/chat';
5
-
5
+ import { isH5 } from '../../utils/env';
6
6
  import { useTUIKitContext } from '../../context';
7
7
 
8
8
  import { Avatar } from '../Avatar';
@@ -59,13 +59,13 @@ const allowTypeList = [
59
59
 
60
60
  export interface TUIProfileDefaultProps {
61
61
  userInfo?: Profile,
62
- update?:(option:ProfileParams) => void,
62
+ update?: (option: ProfileParams) => void,
63
63
  className?: string,
64
64
  }
65
65
 
66
- function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
66
+ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
67
67
  props: PropsWithChildren<T>,
68
- ):React.ReactElement {
68
+ ): React.ReactElement {
69
69
  const {
70
70
  userInfo,
71
71
  className,
@@ -77,8 +77,20 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
77
77
 
78
78
  const [isEditName, setIsEditName] = useState('');
79
79
 
80
- // show birthday famate
81
- const showBirthdayFormat = (value: string) => {
80
+ // birthday format to show
81
+ const birthdayFormatToShow = (dateNumber: number) => {
82
+ const dateStr = String(dateNumber);
83
+ if (dateStr.length === 8) {
84
+ const year = dateStr.substring(0, 4);
85
+ const month = dateStr.substring(4, 6);
86
+ const day = dateStr.substring(6, 8);
87
+ return `${year}/${month}/${day}`;
88
+ }
89
+ return `${dateNumber}`;
90
+ };
91
+
92
+ // transform birthday string value to Date object
93
+ const transformBirthdayStringToDate = (value: string) => {
82
94
  if (value?.length === 8) {
83
95
  const y = Number(value.slice(0, 4));
84
96
  const m = Number(value.slice(4, 6));
@@ -88,15 +100,15 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
88
100
  return new Date();
89
101
  };
90
102
 
91
- // edit birthday famate transform
92
- const editBirthdayFamate = (date:Date) => {
103
+ // edit birthday format transform
104
+ const editBirthdayFormat = (date: Date) => {
93
105
  const day = date.getDate() > 9 ? date.getDate() : `0${date.getDate()}`;
94
106
  const month = date.getMonth() > 8 ? date.getMonth() + 1 : `0${date.getMonth() + 1}`;
95
107
  const year = date.getFullYear();
96
108
  return `${year}${month}${day}`;
97
109
  };
98
110
 
99
- const editListMap = [
111
+ let editListMap = [
100
112
  {
101
113
  name: 'Signature',
102
114
  value: userInfo?.selfSignature,
@@ -116,21 +128,21 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
116
128
  children: (
117
129
  <ul className="select-list">
118
130
  {
119
- genderList?.map((item, index) => {
120
- const key = `${item.value}${index}`;
121
- return (
122
- <li
123
- className="select-list-item"
124
- role="menuitem"
125
- tabIndex={index}
126
- key={key}
127
- onClick={() => { editGender(item); }}
128
- >
129
- {t(`TUIProfile.${item.label}`)}
130
- </li>
131
- );
132
- })
133
- }
131
+ genderList?.map((item, index) => {
132
+ const key = `${item.value}${index}`;
133
+ return (
134
+ <li
135
+ className="select-list-item"
136
+ role="menuitem"
137
+ tabIndex={index}
138
+ key={key}
139
+ onClick={() => { editGender(item); }}
140
+ >
141
+ {t(`TUIProfile.${item.label}`)}
142
+ </li>
143
+ );
144
+ })
145
+ }
134
146
  </ul>
135
147
  ),
136
148
  },
@@ -144,27 +156,27 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
144
156
  children: (
145
157
  <ul className="select-list">
146
158
  {
147
- allowTypeList?.map((item, index) => {
148
- const key = `${item.value}${index}`;
149
- return (
150
- <li
151
- className="select-list-item"
152
- role="menuitem"
153
- tabIndex={index}
154
- key={key}
155
- onClick={() => { editAllowType(item); }}
156
- >
157
- {t(`TUIProfile.${item.label}`)}
158
- </li>
159
- );
160
- })
161
- }
159
+ allowTypeList?.map((item, index) => {
160
+ const key = `${item.value}${index}`;
161
+ return (
162
+ <li
163
+ className="select-list-item"
164
+ role="menuitem"
165
+ tabIndex={index}
166
+ key={key}
167
+ onClick={() => { editAllowType(item); }}
168
+ >
169
+ {t(`TUIProfile.${item.label}`)}
170
+ </li>
171
+ );
172
+ })
173
+ }
162
174
  </ul>
163
175
  ),
164
176
  },
165
177
  {
166
178
  name: 'Birthday',
167
- value: `${userInfo?.birthday}`,
179
+ value: userInfo?.birthday ? birthdayFormatToShow(userInfo.birthday) : '',
168
180
  type: 'select',
169
181
  children: (
170
182
  <DatePicker
@@ -172,13 +184,15 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
172
184
  calendarClassName="tui-profile-birthday-calendar"
173
185
  isOpen
174
186
  format="y-MM-dd"
175
- onChange={(value:Date) => { editBirthday(value); }}
176
- value={showBirthdayFormat(`${userInfo?.birthday}`)}
187
+ onChange={(value: Date) => { editBirthday(value); }}
188
+ value={transformBirthdayStringToDate(`${userInfo?.birthday}`)}
177
189
  />
178
190
  ),
179
191
  },
180
192
  ];
181
-
193
+ if (isH5) {
194
+ editListMap = editListMap.filter((item) => item.name !== 'Birthday');
195
+ }
182
196
  const handleSetEditName = (name:string) => {
183
197
  setIsEditName(name);
184
198
  };
@@ -189,12 +203,12 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
189
203
  };
190
204
 
191
205
  // edit avatar
192
- const editAvatar = (url:string) => {
206
+ const editAvatar = (url: string) => {
193
207
  confirm({ avatar: url });
194
208
  };
195
209
 
196
210
  // edit nick / selfSignature
197
- const editText = (data?:any) => {
211
+ const editText = (data?: any) => {
198
212
  let key = '';
199
213
  switch (data?.name) {
200
214
  case 'nick':
@@ -224,9 +238,9 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
224
238
  };
225
239
 
226
240
  // edit birthday
227
- const editBirthday = (value:Date) => {
241
+ const editBirthday = (value: Date) => {
228
242
  confirm({
229
- birthday: Number(editBirthdayFamate(value)),
243
+ birthday: Number(editBirthdayFormat(value)),
230
244
  });
231
245
  };
232
246
 
@@ -276,7 +290,7 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
276
290
  className="tui-profile-div-with-edit"
277
291
  classEditName="tui-profile-edit"
278
292
  name={item.name}
279
- value={item?.value}
293
+ value={item.value}
280
294
  type={item.type}
281
295
  toggle={handleSetEditName}
282
296
  isEdit={isEditName === item.name}
@@ -296,10 +310,10 @@ function TUIProfileDefaultWithContext <T extends TUIProfileDefaultProps>(
296
310
  }
297
311
 
298
312
  const MemoizedTUIProfileDefault = React.memo(TUIProfileDefaultWithContext) as
299
- typeof TUIProfileDefaultWithContext;
313
+ typeof TUIProfileDefaultWithContext;
300
314
 
301
315
  export function TUIProfileDefault(props: TUIProfileDefaultProps)
302
- :React.ReactElement {
316
+ : React.ReactElement {
303
317
  const options = { ...props };
304
318
  return <MemoizedTUIProfileDefault {...options} />;
305
319
  }
@@ -59,8 +59,10 @@
59
59
  padding: 0 20px;
60
60
  display: flex;
61
61
  flex-direction: column;
62
+ user-select: none;
62
63
  &-item {
63
64
  padding: 20px 0 0;
65
+ cursor: pointer;
64
66
  h4 {
65
67
  padding-bottom: 3px;
66
68
  font-weight: 400;
@@ -86,6 +88,10 @@
86
88
  }
87
89
  .react-date-picker__calendar {
88
90
  position: static !important;
91
+ .react-calendar__navigation {
92
+ height: 20px !important;
93
+ margin-bottom: 0px;
94
+ }
89
95
  }
90
96
  &-calendar {
91
97
  border: none !important;
@@ -8,6 +8,7 @@ import {
8
8
  } from 'date-fns';
9
9
  import { enGB, zhCN } from 'date-fns/locale';
10
10
  import TencentCloudChat from '@tencentcloud/chat';
11
+ import { TUIStore, StoreName } from '@tencentcloud/chat-uikit-engine';
11
12
  import { defaultGroupAvatarWork, defaultUserAvatar } from './Avatar';
12
13
 
13
14
  // Determine if it is a JSON string
@@ -88,3 +89,11 @@ export const getTimeStamp = (time: number, language?: string) => {
88
89
  locale: locales[lng],
89
90
  });
90
91
  };
92
+
93
+ export function enableSampleTaskStatus(taskKey: string) {
94
+ const tasks = TUIStore.getData(StoreName.APP, 'tasks');
95
+ if (taskKey in tasks && !tasks[taskKey]) {
96
+ tasks[taskKey] = true;
97
+ TUIStore.update(StoreName.APP, 'tasks', tasks);
98
+ }
99
+ }