@tencentcloud/chat-uikit-react 2.2.4 → 2.2.6

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 (343) hide show
  1. package/.babelrc +2 -2
  2. package/.eslintrc.js +141 -31
  3. package/.lintstagedrc.json +1 -1
  4. package/.stylelintrc.js +17 -18
  5. package/CHANGELOG.md +19 -2
  6. package/README.md +8 -8
  7. package/dist/cjs/assets/fonts/iconfont.ttf +0 -0
  8. package/dist/cjs/assets/fonts/iconfont.woff +0 -0
  9. package/dist/cjs/assets/fonts/iconfont.woff2 +0 -0
  10. package/dist/cjs/components/Avatar/Avatar.d.ts +4 -4
  11. package/dist/cjs/components/Checkbox/index.d.ts +2 -2
  12. package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  13. package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -1
  14. package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  15. package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  16. package/dist/cjs/components/ConversationPreview/ConversationListContainer.d.ts +2 -2
  17. package/dist/cjs/components/ConversationPreview/ConversationPreview.d.ts +8 -8
  18. package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
  19. package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.d.ts +2 -2
  20. package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  21. package/dist/cjs/components/ConversationPreview/utils.js +1 -1
  22. package/dist/cjs/components/ConversationSearch/ConversationSearchResult.d.ts +3 -3
  23. package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -1
  24. package/dist/cjs/components/Icon/Icon.d.ts +3 -3
  25. package/dist/cjs/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +4 -4
  26. package/dist/cjs/components/Input/Input.d.ts +4 -4
  27. package/dist/cjs/components/Model/index.d.ts +2 -2
  28. package/dist/cjs/components/Plugins/index.d.ts +4 -4
  29. package/dist/cjs/components/Popup/index.d.ts +2 -2
  30. package/dist/cjs/components/Switch/Switch.d.ts +2 -2
  31. package/dist/cjs/components/TUIChat/TUIChat.d.ts +12 -12
  32. package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
  33. package/dist/cjs/components/TUIChatHeader/TUIChatHeader.d.ts +5 -5
  34. package/dist/cjs/components/TUIChatHeader/TUIChatHeader.js +1 -1
  35. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +5 -5
  36. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  37. package/dist/cjs/components/TUIContact/TUIContact.d.ts +3 -3
  38. package/dist/cjs/components/TUIContact/TUIContact.js +1 -1
  39. package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +3 -3
  40. package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -1
  41. package/dist/cjs/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
  42. package/dist/cjs/components/TUIContact/TUIContactInfo/blockInfo.js +1 -1
  43. package/dist/cjs/components/TUIContact/TUIContactInfo/friendApplication.js +1 -1
  44. package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  45. package/dist/cjs/components/TUIContact/TUIContactInfo/groupInfo.js +1 -1
  46. package/dist/cjs/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -1
  47. package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.d.ts +3 -3
  48. package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  49. package/dist/cjs/components/TUIContact/hooks/useTUIContact.js +1 -1
  50. package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +1 -1
  51. package/dist/cjs/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
  52. package/dist/cjs/components/TUIConversation/TUIConversation.d.ts +2 -2
  53. package/dist/cjs/components/TUIConversationList/TUIConversationList.d.ts +6 -6
  54. package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -1
  55. package/dist/cjs/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  56. package/dist/cjs/components/TUIManage/TUIManage.d.ts +2 -2
  57. package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
  58. package/dist/cjs/components/TUIMessage/MessageAudio.js +1 -1
  59. package/dist/cjs/components/TUIMessage/MessageAvatar.js +1 -1
  60. package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -1
  61. package/dist/cjs/components/TUIMessage/MessageContext.d.ts +2 -2
  62. package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
  63. package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -1
  64. package/dist/cjs/components/TUIMessage/MessageName.js +1 -1
  65. package/dist/cjs/components/TUIMessage/MessagePlugins.d.ts +4 -4
  66. package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
  67. package/dist/cjs/components/TUIMessage/MessageProgress.js +1 -1
  68. package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
  69. package/dist/cjs/components/TUIMessage/MessageStatus.js +1 -1
  70. package/dist/cjs/components/TUIMessage/MessageSystem.js +1 -1
  71. package/dist/cjs/components/TUIMessage/MessageText.js +1 -1
  72. package/dist/cjs/components/TUIMessage/MessageTip.js +1 -1
  73. package/dist/cjs/components/TUIMessage/TUIMessage.d.ts +19 -19
  74. package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
  75. package/dist/cjs/components/TUIMessage/TUIMessageDefault.js +1 -1
  76. package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  77. package/dist/cjs/components/TUIMessage/hooks/useMessageReply.js +1 -1
  78. package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.d.ts +2 -2
  79. package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  80. package/dist/cjs/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
  81. package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
  82. package/dist/cjs/components/TUIMessageInput/TUIMessageInput.d.ts +7 -7
  83. package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -1
  84. package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.d.ts +2 -2
  85. package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  86. package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  87. package/dist/cjs/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  88. package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  89. package/dist/cjs/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
  90. package/dist/cjs/components/TUIMessageList/TUIMessageList.d.ts +2 -2
  91. package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
  92. package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  93. package/dist/cjs/components/TUIProfile/TUIProfile.d.ts +3 -3
  94. package/dist/cjs/components/TUIProfile/TUIProfile.js +1 -1
  95. package/dist/cjs/components/TUIProfile/TUIProfileDefault.d.ts +2 -2
  96. package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
  97. package/dist/cjs/components/Toast/index.d.ts +2 -2
  98. package/dist/cjs/context/ComponentContext.d.ts +12 -12
  99. package/dist/cjs/context/LanguageContext.js +1 -0
  100. package/dist/cjs/context/TUIChatActionContext.d.ts +3 -3
  101. package/dist/cjs/context/TUIChatStateContext.d.ts +5 -5
  102. package/dist/cjs/context/TUIContactContext.d.ts +4 -4
  103. package/dist/cjs/context/TUIConversationContext.js +1 -1
  104. package/dist/cjs/context/TUIMessageContext.d.ts +17 -17
  105. package/dist/cjs/context/TUIMessageInputContext.d.ts +4 -4
  106. package/dist/cjs/context/ThemeContext.js +1 -0
  107. package/dist/cjs/context/UIKitContext.d.ts +25 -0
  108. package/dist/cjs/context/UIKitContext.js +1 -0
  109. package/dist/cjs/context/UIManagerContext.d.ts +46 -0
  110. package/dist/cjs/context/UIManagerContext.js +1 -0
  111. package/dist/cjs/hooks/useConversation.d.ts +2 -2
  112. package/dist/cjs/index.css +1 -1
  113. package/dist/cjs/index.d.css +984 -1039
  114. package/dist/cjs/index.d.ts +2 -4
  115. package/dist/cjs/index.js +1 -1
  116. package/dist/cjs/locales/en-US/TUIGlobal.js +1 -0
  117. package/dist/cjs/locales/en-US/index.js +1 -1
  118. package/dist/cjs/locales/ja-JP/TUIGlobal.js +1 -0
  119. package/dist/cjs/locales/ja-JP/index.js +1 -1
  120. package/dist/cjs/locales/ko-KR/TUIGlobal.js +1 -0
  121. package/dist/cjs/locales/ko-KR/index.js +1 -1
  122. package/dist/cjs/locales/zh-CN/TUIGlobal.js +1 -0
  123. package/dist/cjs/locales/zh-CN/index.js +1 -1
  124. package/dist/esm/assets/fonts/iconfont.ttf +0 -0
  125. package/dist/esm/assets/fonts/iconfont.woff +0 -0
  126. package/dist/esm/assets/fonts/iconfont.woff2 +0 -0
  127. package/dist/esm/components/Avatar/Avatar.d.ts +4 -4
  128. package/dist/esm/components/Checkbox/index.d.ts +2 -2
  129. package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  130. package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
  131. package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  132. package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  133. package/dist/esm/components/ConversationPreview/ConversationListContainer.d.ts +2 -2
  134. package/dist/esm/components/ConversationPreview/ConversationPreview.d.ts +8 -8
  135. package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
  136. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.d.ts +2 -2
  137. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  138. package/dist/esm/components/ConversationPreview/utils.js +1 -1
  139. package/dist/esm/components/ConversationSearch/ConversationSearchResult.d.ts +3 -3
  140. package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
  141. package/dist/esm/components/Icon/Icon.d.ts +3 -3
  142. package/dist/esm/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +4 -4
  143. package/dist/esm/components/Input/Input.d.ts +4 -4
  144. package/dist/esm/components/Model/index.d.ts +2 -2
  145. package/dist/esm/components/Plugins/index.d.ts +4 -4
  146. package/dist/esm/components/Popup/index.d.ts +2 -2
  147. package/dist/esm/components/Switch/Switch.d.ts +2 -2
  148. package/dist/esm/components/TUIChat/TUIChat.d.ts +12 -12
  149. package/dist/esm/components/TUIChat/TUIChat.js +1 -1
  150. package/dist/esm/components/TUIChatHeader/TUIChatHeader.d.ts +5 -5
  151. package/dist/esm/components/TUIChatHeader/TUIChatHeader.js +1 -1
  152. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +5 -5
  153. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  154. package/dist/esm/components/TUIContact/TUIContact.d.ts +3 -3
  155. package/dist/esm/components/TUIContact/TUIContact.js +1 -1
  156. package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +3 -3
  157. package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -1
  158. package/dist/esm/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
  159. package/dist/esm/components/TUIContact/TUIContactInfo/blockInfo.js +1 -1
  160. package/dist/esm/components/TUIContact/TUIContactInfo/friendApplication.js +1 -1
  161. package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  162. package/dist/esm/components/TUIContact/TUIContactInfo/groupInfo.js +1 -1
  163. package/dist/esm/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -1
  164. package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.d.ts +3 -3
  165. package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  166. package/dist/esm/components/TUIContact/hooks/useTUIContact.js +1 -1
  167. package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +1 -1
  168. package/dist/esm/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
  169. package/dist/esm/components/TUIConversation/TUIConversation.d.ts +2 -2
  170. package/dist/esm/components/TUIConversationList/TUIConversationList.d.ts +6 -6
  171. package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -1
  172. package/dist/esm/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  173. package/dist/esm/components/TUIManage/TUIManage.d.ts +2 -2
  174. package/dist/esm/components/TUIManage/TUIManage.js +1 -1
  175. package/dist/esm/components/TUIMessage/MessageAudio.js +1 -1
  176. package/dist/esm/components/TUIMessage/MessageAvatar.js +1 -1
  177. package/dist/esm/components/TUIMessage/MessageBubble.js +1 -1
  178. package/dist/esm/components/TUIMessage/MessageContext.d.ts +2 -2
  179. package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
  180. package/dist/esm/components/TUIMessage/MessageCustom.js +1 -1
  181. package/dist/esm/components/TUIMessage/MessageName.js +1 -1
  182. package/dist/esm/components/TUIMessage/MessagePlugins.d.ts +4 -4
  183. package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
  184. package/dist/esm/components/TUIMessage/MessageProgress.js +1 -1
  185. package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
  186. package/dist/esm/components/TUIMessage/MessageStatus.js +1 -1
  187. package/dist/esm/components/TUIMessage/MessageSystem.js +1 -1
  188. package/dist/esm/components/TUIMessage/MessageText.js +1 -1
  189. package/dist/esm/components/TUIMessage/MessageTip.js +1 -1
  190. package/dist/esm/components/TUIMessage/TUIMessage.d.ts +19 -19
  191. package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
  192. package/dist/esm/components/TUIMessage/TUIMessageDefault.js +1 -1
  193. package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  194. package/dist/esm/components/TUIMessage/hooks/useMessageReply.js +1 -1
  195. package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.d.ts +2 -2
  196. package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  197. package/dist/esm/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
  198. package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
  199. package/dist/esm/components/TUIMessageInput/TUIMessageInput.d.ts +7 -7
  200. package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -1
  201. package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.d.ts +2 -2
  202. package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  203. package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  204. package/dist/esm/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  205. package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  206. package/dist/esm/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
  207. package/dist/esm/components/TUIMessageList/TUIMessageList.d.ts +2 -2
  208. package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
  209. package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  210. package/dist/esm/components/TUIProfile/TUIProfile.d.ts +3 -3
  211. package/dist/esm/components/TUIProfile/TUIProfile.js +1 -1
  212. package/dist/esm/components/TUIProfile/TUIProfileDefault.d.ts +2 -2
  213. package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
  214. package/dist/esm/components/Toast/index.d.ts +2 -2
  215. package/dist/esm/context/ComponentContext.d.ts +12 -12
  216. package/dist/esm/context/LanguageContext.js +1 -0
  217. package/dist/esm/context/TUIChatActionContext.d.ts +3 -3
  218. package/dist/esm/context/TUIChatStateContext.d.ts +5 -5
  219. package/dist/esm/context/TUIContactContext.d.ts +4 -4
  220. package/dist/esm/context/TUIConversationContext.js +1 -1
  221. package/dist/esm/context/TUIMessageContext.d.ts +17 -17
  222. package/dist/esm/context/TUIMessageInputContext.d.ts +4 -4
  223. package/dist/esm/context/ThemeContext.js +1 -0
  224. package/dist/esm/context/UIKitContext.d.ts +25 -0
  225. package/dist/esm/context/UIKitContext.js +1 -0
  226. package/dist/esm/context/UIManagerContext.d.ts +46 -0
  227. package/dist/esm/context/UIManagerContext.js +1 -0
  228. package/dist/esm/hooks/useConversation.d.ts +2 -2
  229. package/dist/esm/index.css +1 -1
  230. package/dist/esm/index.d.css +984 -1039
  231. package/dist/esm/index.d.ts +2 -4
  232. package/dist/esm/index.js +1 -1
  233. package/dist/esm/locales/en-US/TUIGlobal.js +1 -0
  234. package/dist/esm/locales/en-US/index.js +1 -1
  235. package/dist/esm/locales/ja-JP/TUIGlobal.js +1 -0
  236. package/dist/esm/locales/ja-JP/index.js +1 -1
  237. package/dist/esm/locales/ko-KR/TUIGlobal.js +1 -0
  238. package/dist/esm/locales/ko-KR/index.js +1 -1
  239. package/dist/esm/locales/zh-CN/TUIGlobal.js +1 -0
  240. package/dist/esm/locales/zh-CN/index.js +1 -1
  241. package/package.json +9 -7
  242. package/rollup.config.js +13 -2
  243. package/src/assets/fonts/iconfont.ttf +0 -0
  244. package/src/assets/fonts/iconfont.woff +0 -0
  245. package/src/assets/fonts/iconfont.woff2 +0 -0
  246. package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +4 -4
  247. package/src/components/ConversationCreate/ConversationCreate.tsx +2 -2
  248. package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +3 -2
  249. package/src/components/ConversationCreate/styles/ConversationCreatGroupDetail.scss +16 -7
  250. package/src/components/ConversationCreate/styles/index.scss +23 -13
  251. package/src/components/ConversationPreview/ConversationPreview.tsx +21 -21
  252. package/src/components/ConversationPreview/ConversationPreviewContent.tsx +4 -4
  253. package/src/components/ConversationPreview/styles/index.scss +44 -14
  254. package/src/components/ConversationPreview/utils.tsx +36 -28
  255. package/src/components/Input/styles/index.scss +7 -5
  256. package/src/components/Model/styles/layout.scss +3 -3
  257. package/src/components/Plugins/styles/color.scss +17 -3
  258. package/src/components/Popup/styles/layout.scss +2 -1
  259. package/src/components/TUIChat/TUIChat.tsx +4 -3
  260. package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +3 -3
  261. package/src/components/TUIChatHeader/styles/layout.scss +13 -2
  262. package/src/components/TUIContact/TUIContact.tsx +2 -2
  263. package/src/components/TUIContact/TUIContactInfo/TUIContactInfo.tsx +2 -2
  264. package/src/components/TUIContact/TUIContactInfo/basicInfo.tsx +2 -2
  265. package/src/components/TUIContact/TUIContactInfo/blockInfo.tsx +2 -2
  266. package/src/components/TUIContact/TUIContactInfo/friendApplication.tsx +2 -2
  267. package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +4 -3
  268. package/src/components/TUIContact/TUIContactInfo/groupInfo.tsx +3 -3
  269. package/src/components/TUIContact/TUIContactInfo/hooks/useContactInfo.tsx +2 -2
  270. package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +5 -5
  271. package/src/components/TUIContact/hooks/useTUIContact.tsx +2 -2
  272. package/src/components/TUIContactSearch/TUIContactSearch.tsx +2 -2
  273. package/src/components/TUIContactSearch/hooks/useContactSearch.tsx +2 -2
  274. package/src/components/TUIConversationList/TUIConversationList.tsx +3 -4
  275. package/src/components/TUIConversationList/hooks/useConversationUpdate.tsx +2 -2
  276. package/src/components/TUIConversationList/index.scss +25 -7
  277. package/src/components/TUIManage/TUIManage.tsx +3 -3
  278. package/src/components/TUIManage/styles/index.scss +16 -6
  279. package/src/components/TUIMessage/MessageStatus.tsx +2 -2
  280. package/src/components/TUIMessage/MessageText.tsx +16 -15
  281. package/src/components/TUIMessage/hooks/useMessageHandler.ts +2 -2
  282. package/src/components/TUIMessage/hooks/useMessageReply.ts +2 -2
  283. package/src/components/TUIMessage/styles/color.scss +20 -9
  284. package/src/components/TUIMessage/styles/layout.scss +44 -11
  285. package/src/components/TUIMessageInput/TUIMessageInput.tsx +1 -1
  286. package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +2 -2
  287. package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +2 -2
  288. package/src/components/TUIMessageInput/styles/color.scss +25 -6
  289. package/src/components/TUIMessageInput/styles/layout.scss +58 -16
  290. package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +2 -2
  291. package/src/components/TUIMessageList/styles/layout.scss +16 -2
  292. package/src/components/TUIProfile/TUIProfile.tsx +3 -3
  293. package/src/components/TUIProfile/TUIProfileDefault.tsx +2 -2
  294. package/src/components/TUIProfile/styles/layout.scss +33 -16
  295. package/src/components/index.ts +0 -1
  296. package/src/context/LanguageContext.tsx +59 -0
  297. package/src/context/ThemeContext.tsx +61 -0
  298. package/src/context/UIKitContext.tsx +67 -0
  299. package/src/context/UIManagerContext.tsx +163 -0
  300. package/src/context/index.ts +3 -2
  301. package/src/locales/en-US/index.ts +1 -1
  302. package/src/locales/ja-JP/index.ts +2 -0
  303. package/src/locales/ko-KR/TUIGlobal.ts +2 -2
  304. package/src/locales/ko-KR/index.ts +2 -0
  305. package/src/locales/zh-CN/index.ts +2 -2
  306. package/src/styles/colors/_color-dark.scss +35 -0
  307. package/src/styles/colors/_color-light.scss +35 -0
  308. package/src/styles/colors/_color-theme.scss +54 -0
  309. package/src/styles/fonts/icon-font.scss +18 -0
  310. package/src/styles/index.scss +4 -0
  311. package/src/styles/normalize.scss +355 -0
  312. package/dist/cjs/components/Icon/images/chats-selected.svg.js +0 -1
  313. package/dist/cjs/components/Icon/images/chats.svg.js +0 -1
  314. package/dist/cjs/components/Icon/images/contacts-selected.svg.js +0 -1
  315. package/dist/cjs/components/Icon/images/contacts.svg.js +0 -1
  316. package/dist/cjs/components/TUIKit/TUIKit.d.ts +0 -12
  317. package/dist/cjs/components/TUIKit/TUIKit.js +0 -1
  318. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +0 -21
  319. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.js +0 -1
  320. package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +0 -43
  321. package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +0 -1
  322. package/dist/cjs/context/TUIKitContext.d.ts +0 -25
  323. package/dist/cjs/context/TUIKitContext.js +0 -1
  324. package/dist/esm/components/Icon/images/chats-selected.svg.js +0 -1
  325. package/dist/esm/components/Icon/images/chats.svg.js +0 -1
  326. package/dist/esm/components/Icon/images/contacts-selected.svg.js +0 -1
  327. package/dist/esm/components/Icon/images/contacts.svg.js +0 -1
  328. package/dist/esm/components/TUIKit/TUIKit.d.ts +0 -12
  329. package/dist/esm/components/TUIKit/TUIKit.js +0 -1
  330. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +0 -21
  331. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.js +0 -1
  332. package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +0 -43
  333. package/dist/esm/components/TUIKit/hooks/useTUIKit.js +0 -1
  334. package/dist/esm/context/TUIKitContext.d.ts +0 -25
  335. package/dist/esm/context/TUIKitContext.js +0 -1
  336. package/src/components/TUIKit/TUIKit.tsx +0 -228
  337. package/src/components/TUIKit/hooks/useCreateTUIKitContext.tsx +0 -48
  338. package/src/components/TUIKit/hooks/useTUIKit.tsx +0 -99
  339. package/src/components/TUIKit/index.ts +0 -3
  340. package/src/components/TUIKit/styles/h5.scss +0 -34
  341. package/src/components/TUIKit/styles/index.scss +0 -112
  342. package/src/components/TUIKit/styles/reset.scss +0 -67
  343. package/src/context/TUIKitContext.tsx +0 -39
@@ -1,25 +0,0 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { ChatSDK, Conversation, Profile } from '@tencentcloud/chat';
3
- import { UseContactParams } from '../components/TUIKit/hooks/useTUIKit.js';
4
-
5
- interface TUIKitContextValue {
6
- chat: ChatSDK;
7
- language: string;
8
- conversation?: Conversation;
9
- contactData?: UseContactParams;
10
- setActiveConversation: (conversation?: Conversation) => void;
11
- customClasses?: unknown;
12
- myProfile?: Profile;
13
- TUIManageShow?: boolean;
14
- setTUIManageShow?: React.Dispatch<React.SetStateAction<boolean>>;
15
- TUIProfileShow?: boolean;
16
- setActiveContact: (UseContactParams?: UseContactParams) => void;
17
- setTUIProfileShow?: React.Dispatch<React.SetStateAction<boolean>>;
18
- }
19
- declare const TUIKitContext: React.Context<TUIKitContextValue | undefined>;
20
- declare function TUIKitProvider({ children, value }: PropsWithChildren<{
21
- value: TUIKitContextValue;
22
- }>): React.ReactElement;
23
- declare const useTUIKitContext: (componentName?: string) => TUIKitContextValue;
24
-
25
- export { TUIKitContext, TUIKitContextValue, TUIKitProvider, useTUIKitContext };
@@ -1 +0,0 @@
1
- import{__assign as r}from"tslib";import{jsx as t}from"react/jsx-runtime";import e,{useContext as o}from"react";var i=e.createContext(void 0);function n(e){var o=e.children,n=e.value;return t(i.Provider,r({value:n},{children:o}))}var a=function(r){var t=o(i);return!t&&r?{}:t};export{i as TUIKitContext,n as TUIKitProvider,a as useTUIKitContext};
@@ -1,228 +0,0 @@
1
- import React, { PropsWithChildren, useState, useEffect } from 'react';
2
- import { ChatSDK, Conversation } from '@tencentcloud/chat';
3
- import { TUIStore, StoreName, IConversationModel, TUIConversationService } from '@tencentcloud/chat-uikit-engine';
4
- import { TUILogin } from '@tencentcloud/tui-core';
5
- import { useTranslation } from 'react-i18next';
6
- import { isH5, isPC } from '../../utils/env';
7
- import { useTUIKit, UseContactParams } from './hooks/useTUIKit';
8
- import { useCreateTUIKitContext } from './hooks/useCreateTUIKitContext';
9
- import { TUIKitProvider } from '../../context/TUIKitContext';
10
- import './styles/index.scss';
11
- import './styles/h5.scss';
12
- import { TUIConversation } from '../TUIConversation';
13
- import { TUIChat } from '../TUIChat';
14
- import { TUIManage } from '../TUIManage';
15
- import { TUIProfile } from '../TUIProfile';
16
- import { TUIContact } from '../TUIContact';
17
- import { TUIContactInfo } from '../TUIContact/TUIContactInfo/TUIContactInfo';
18
- import { TUIKIT_TABBAR } from '../../constants';
19
- import '../../locales/index';
20
- import chats from '../Icon/images/chats.svg';
21
- import chatsSelected from '../Icon/images/chats-selected.svg';
22
- import contacts from '../Icon/images/contacts.svg';
23
- import contactsSelected from '../Icon/images/contacts-selected.svg';
24
-
25
- export interface ChatProps {
26
- chat?: any,
27
- language?: string,
28
- customClasses?: unknown,
29
- activeConversation?: Conversation,
30
- }
31
-
32
- interface RenderPCProps {
33
- moduleValue: string,
34
- tabbarRender: any,
35
- setModuleValue: (value: string) => void
36
- }
37
- interface RenderH5Props {
38
- moduleValue: string,
39
- currentConversationID: string,
40
- tabbarRender: any,
41
- contactData: UseContactParams,
42
- setModuleValue: (value: string) => void
43
- }
44
-
45
- const tabbarList = [
46
- {
47
- id: 1,
48
- name: TUIKIT_TABBAR.CHATS,
49
- icon: chats,
50
- selectedIcon: chatsSelected,
51
- value: TUIKIT_TABBAR.CHATS,
52
- },
53
- {
54
- id: 2,
55
- name: TUIKIT_TABBAR.CONTACTS,
56
- icon: contacts,
57
- selectedIcon: contactsSelected,
58
- value: TUIKIT_TABBAR.CONTACTS,
59
- },
60
- ];
61
- const TUIMessageInputConfig = {
62
- className: 'sample-h5-input',
63
- isTransmitter: true,
64
- };
65
-
66
- function RenderForPC({ moduleValue, tabbarRender, setModuleValue } : RenderPCProps) {
67
- return (
68
- <>
69
- <div className="sample-chat-left-container">
70
- <TUIProfile className="sample-chat-profile" />
71
- {tabbarRender}
72
- {moduleValue === TUIKIT_TABBAR.CHATS && <TUIConversation />}
73
- {moduleValue === TUIKIT_TABBAR.CONTACTS && <TUIContact />}
74
- </div>
75
- {moduleValue === TUIKIT_TABBAR.CHATS && (
76
- <>
77
- <TUIChat />
78
- <TUIManage />
79
- </>
80
- )}
81
- {moduleValue === TUIKIT_TABBAR.CONTACTS && (
82
- <TUIContact>
83
- <TUIContactInfo
84
- showChats={() => {
85
- setModuleValue(TUIKIT_TABBAR.CHATS);
86
- }}
87
- />
88
- </TUIContact>
89
- )}
90
- </>
91
- );
92
- }
93
-
94
- function RenderForH5({
95
- moduleValue, contactData, tabbarRender, currentConversationID, setModuleValue,
96
- }: RenderH5Props) {
97
- return (
98
- <div className='sample-chat-h5'>
99
- {!currentConversationID && !contactData && (
100
- <div className="sample-chat-h5-container">
101
- <TUIProfile className="sample-profile" />
102
- {tabbarRender}
103
- {moduleValue === TUIKIT_TABBAR.CHATS && <TUIConversation />}
104
- {moduleValue === TUIKIT_TABBAR.CONTACTS && <TUIContact />}
105
- </div>
106
- )}
107
- {moduleValue === TUIKIT_TABBAR.CHATS && currentConversationID && (
108
- <>
109
- <TUIChat TUIMessageInputConfig={TUIMessageInputConfig} />
110
- <TUIManage />
111
- </>
112
- )}
113
- { moduleValue === TUIKIT_TABBAR.CONTACTS && contactData && (
114
- <TUIContact>
115
- <TUIContactInfo
116
- showChats={() => {
117
- setModuleValue(TUIKIT_TABBAR.CHATS);
118
- }}
119
- />
120
- </TUIContact>
121
- )}
122
- </div>
123
- );
124
- }
125
- export function TUIKit<
126
- T extends ChatProps
127
- >(
128
- props:PropsWithChildren<T>,
129
- ):React.ReactElement {
130
- const [moduleValue, setModuleValue] = useState('chats');
131
- const { t } = useTranslation();
132
- const {
133
- children,
134
- chat = TUILogin.getContext().chat,
135
- customClasses,
136
- activeConversation,
137
- language = 'en-US',
138
- } = props;
139
-
140
- (window as any).tencent_cloud_im_csig_react_uikit_23F_xa = true;
141
- const {
142
- conversation,
143
- contactData,
144
- setActiveConversation,
145
- myProfile,
146
- TUIManageShow,
147
- setTUIManageShow,
148
- TUIProfileShow,
149
- setTUIProfileShow,
150
- setActiveContact,
151
- } = useTUIKit({ chat, activeConversation, language });
152
- const chatContextValue = useCreateTUIKitContext({
153
- chat,
154
- language,
155
- conversation,
156
- contactData,
157
- setActiveConversation,
158
- customClasses,
159
- myProfile,
160
- TUIManageShow,
161
- setTUIManageShow,
162
- TUIProfileShow,
163
- setTUIProfileShow,
164
- setActiveContact,
165
- });
166
- useEffect(() => {
167
- TUIStore.watch(StoreName.CONV, {
168
- currentConversation: onCurrentConversation,
169
- });
170
- return () => {
171
- TUIStore.unwatch(StoreName.CONV, {
172
- currentConversation: onCurrentConversation,
173
- });
174
- };
175
- }, []);
176
-
177
- const switchTabbar = (value: string) => {
178
- setModuleValue(value);
179
- TUIConversationService.switchConversation('');
180
- };
181
- const onCurrentConversation = (conversationModel: IConversationModel) => {
182
- setActiveConversation(conversationModel?.getConversation());
183
- };
184
-
185
- const tabbarRender = (
186
- <div className="sample-chat-tab">
187
- {tabbarList.map((item: any) => (
188
- <div
189
- className="sample-chat-tab-container"
190
- key={item.id}
191
- role="presentation"
192
- onClick={() => {
193
- switchTabbar(item.value);
194
- }}
195
- >
196
- <img src={moduleValue === item.value ? item.selectedIcon : item.icon} alt="" />
197
- <p className={`sample-chat-tab-text ${moduleValue === item.value ? 'sample-chat-tab-active' : ''}`}>
198
- {t(item.name)}
199
- </p>
200
- </div>
201
- ))}
202
- </div>
203
- );
204
-
205
- return (
206
- <TUIKitProvider value={chatContextValue}>
207
- <div className="tui-kit">
208
- {children ||
209
- (isPC && (
210
- <RenderForPC
211
- moduleValue={moduleValue}
212
- tabbarRender={tabbarRender}
213
- setModuleValue={setModuleValue}
214
- />
215
- )) ||
216
- (isH5 && (
217
- <RenderForH5
218
- contactData={contactData}
219
- moduleValue={moduleValue}
220
- tabbarRender={tabbarRender}
221
- currentConversationID={conversation?.conversationID || ''}
222
- setModuleValue={setModuleValue}
223
- />
224
- ))}
225
- </div>
226
- </TUIKitProvider>
227
- );
228
- }
@@ -1,48 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { TUIKitContextValue } from '../../../context/TUIKitContext';
3
-
4
- export const useCreateTUIKitContext = (value:TUIKitContextValue) => {
5
- const {
6
- chat,
7
- language,
8
- conversation,
9
- contactData,
10
- customClasses,
11
- setActiveConversation,
12
- myProfile,
13
- TUIManageShow,
14
- setTUIManageShow,
15
- TUIProfileShow,
16
- setTUIProfileShow,
17
- setActiveContact,
18
- } = value;
19
-
20
- const TUIKitContext = useMemo(
21
- () => ({
22
- chat,
23
- language,
24
- conversation,
25
- contactData,
26
- customClasses,
27
- setActiveConversation,
28
- myProfile,
29
- TUIManageShow,
30
- setTUIManageShow,
31
- TUIProfileShow,
32
- setTUIProfileShow,
33
- setActiveContact,
34
- }),
35
- [
36
- language,
37
- conversation,
38
- contactData,
39
- customClasses,
40
- chat,
41
- TUIManageShow,
42
- TUIProfileShow,
43
- setTUIProfileShow,
44
- myProfile,
45
- ],
46
- );
47
- return TUIKitContext;
48
- };
@@ -1,99 +0,0 @@
1
- import React, { useState, useCallback, useEffect } from 'react';
2
- import {
3
- TUIStore,
4
- StoreName,
5
- IGroupModel
6
- } from '@tencentcloud/chat-uikit-engine';
7
- import { useTranslation } from 'react-i18next';
8
- import {
9
- ChatSDK,
10
- Conversation,
11
- Profile,
12
- Friend,
13
- FriendApplication,
14
- } from '@tencentcloud/chat';
15
-
16
- interface blockData {
17
- type: 'block',
18
- data: Profile
19
- }
20
-
21
- interface friendData {
22
- type: 'friend',
23
- data: Friend
24
- }
25
-
26
- interface friendApplicationData {
27
- type: 'friendApplication',
28
- data: FriendApplication
29
- }
30
-
31
- interface addFriendData {
32
- type: 'addFriend',
33
- data: Profile
34
- }
35
-
36
- interface GroupData {
37
- type: 'group',
38
- data: IGroupModel
39
- }
40
-
41
- export type UseContactParams = blockData | friendData |
42
- friendApplicationData | addFriendData| GroupData | undefined;
43
-
44
- export interface UseChatParams{
45
- chat: ChatSDK,
46
- activeConversation?: Conversation,
47
- language?: string,
48
- }
49
-
50
- export const useTUIKit = ({
51
- chat, activeConversation: paramsActiveConversation,
52
- language,
53
- }:UseChatParams) => {
54
- const { i18n } = useTranslation();
55
- const [conversation, setConversation] = useState<Conversation | undefined>(paramsActiveConversation);
56
- const [myProfile, setMyProfile] = useState<Profile>();
57
- const [TUIManageShow, setTUIManageShow] = useState<boolean>(false);
58
- const [TUIProfileShow, setTUIProfileShow] = useState<boolean>(false);
59
- const [contactData, setContactData] = useState<UseContactParams>();
60
-
61
- useEffect(() => {
62
- i18n.changeLanguage(language);
63
- TUIStore.watch(StoreName.USER, {
64
- userProfile: (userProfileData: any) => {
65
- setMyProfile(userProfileData);
66
- },
67
- });
68
- }, [language]);
69
- const setActiveConversation = useCallback(
70
- (activeConversation?: Conversation) => {
71
- if (activeConversation) {
72
- chat?.setMessageRead({ conversationID: activeConversation.conversationID });
73
- }
74
- if (conversation && (activeConversation?.conversationID !== conversation.conversationID)) {
75
- setTUIManageShow(false);
76
- }
77
- setConversation(activeConversation);
78
- },
79
- [chat],
80
- );
81
- const setActiveContact = (actionContactData?: UseContactParams) => {
82
- setContactData(actionContactData);
83
- };
84
-
85
- useEffect(() => {
86
- paramsActiveConversation && setConversation(paramsActiveConversation);
87
- }, [paramsActiveConversation]);
88
- return {
89
- conversation,
90
- contactData,
91
- setActiveConversation,
92
- myProfile,
93
- TUIManageShow,
94
- setTUIManageShow,
95
- TUIProfileShow,
96
- setTUIProfileShow,
97
- setActiveContact,
98
- };
99
- };
@@ -1,3 +0,0 @@
1
- export * from './TUIKit';
2
- export * from './hooks/useTUIKit';
3
- export * from './hooks/useCreateTUIKitContext';
@@ -1,34 +0,0 @@
1
- .App {
2
- height: 100%;
3
- }
4
- #root {
5
- width: 100%;
6
- height: 100%;
7
- margin: 0;
8
- }
9
- .sample-chat-h5 {
10
- position:relative;
11
- width: 100%;
12
- height: 100%;
13
- overflow: hidden;
14
- &-container {
15
- display: flex;
16
- flex-direction: column;
17
- width: 100%;
18
- height: 100%;
19
- .sample-profile {
20
- position: absolute;
21
- top: 0;
22
- z-index: 1;
23
- width:100%;
24
- max-width: 100%;
25
- min-width: 100%;
26
- }
27
- .tui-kit-input-box.tui-kit-input-box--focus {
28
- outline: none;
29
- }
30
- }
31
- .tui-message-input .tui-kit-input-box--focus {
32
- outline: none;
33
- }
34
- }
@@ -1,112 +0,0 @@
1
- @import "reset";
2
- .tui-kit {
3
- position: relative;
4
- display: flex;
5
- width: 100%;
6
- height: 100%;
7
- background-color: #FFFFFF;
8
- text-align: initial;
9
- }
10
- .sample-chat {
11
- position:relative;
12
- margin: 0 auto;
13
- width: calc(100% - 20rem);
14
- min-width: 850px;
15
- height: 86%;
16
- box-sizing: border-box;
17
- border-radius: 12px;
18
- overflow: hidden;
19
- &-profile {
20
- position: absolute;
21
- top: 0;
22
- z-index: 1;
23
- }
24
- &-left-container {
25
- max-width: 360px;
26
- min-width: 360px;
27
- display: flex;
28
- flex-direction: column;
29
- }
30
- &-tab {
31
- display: flex;
32
- align-items: center;
33
- justify-content: space-around;
34
- margin: 12px;
35
- }
36
- &-tab-container {
37
- display: flex;
38
- flex-direction: column;
39
- align-items: center;
40
- justify-content: center;
41
- cursor: pointer;
42
- }
43
- &-tab-text {
44
- font-size: 15px;
45
- line-height: 25px;
46
- text-align: center;
47
- }
48
- &-tab-active {
49
- color: #147AFF;
50
- }
51
- }
52
- .tuikit-container {
53
- display: flex;
54
- height: 100%;
55
- position: relative;
56
- text-align: initial;
57
- box-shadow: 0 11px 20px 0 rgba(0,0,0,.3);
58
- }
59
- .tui-chat-default {
60
- width: 100%;
61
- height: 100%;
62
- background-size: cover;
63
- background-position-x: -17px;
64
- background-position-y: 173px;
65
- padding: 100px 40px 0;
66
- header {
67
- display: flex;
68
- align-items: center;
69
- font-size: 1.75rem;
70
- font-family: PingFangSC-Medium;
71
- font-weight: 500;
72
- color: #000;
73
- letter-spacing: 0;
74
- img {
75
- width: 32px;
76
- margin: 0 10px;
77
- }
78
- }
79
- .content {
80
- max-width: 393px;
81
- font-size: 16px;
82
- line-height: 24px;
83
- font-family: PingFangSC-Regular;
84
- font-weight: 400;
85
- color: #666;
86
- letter-spacing: 0;
87
- padding: 36px 0 20px;
88
- }
89
- .link {
90
- font-size: 14px;
91
- line-height: 20px;
92
- font-family: PingFangSC-Regular;
93
- font-weight: 400;
94
- color: #666;
95
- letter-spacing: 0;
96
- a {
97
- font-family: PingFangSC-Regular;
98
- font-weight: 400;
99
- color: #006eff;
100
- letter-spacing: 0;
101
- text-decoration: none;
102
- padding: 0 5px;
103
- }
104
- }
105
- }
106
-
107
-
108
- body {
109
- #webpack-dev-server-client-overlay {
110
- display: none !important;
111
- }
112
- }
@@ -1,67 +0,0 @@
1
- html, body, div, span, applet, object, iframe,
2
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3
- a, abbr, acronym, address, big, cite, code,
4
- del, dfn, em, img, ins, kbd, q, s, samp,
5
- small, strike, strong, sub, sup, tt, var,
6
- b, u, i, center,
7
- dl, dt, dd, ol, ul, li,
8
- fieldset, form, label, legend,
9
- table, caption, tbody, tfoot, thead, tr, th, td,
10
- article, aside, canvas, details, embed,
11
- figure, figcaption, footer, header, hgroup,
12
- menu, nav, output, ruby, section, summary,
13
- time, mark, audio, video {
14
- margin: 0;
15
- padding: 0;
16
- border: 0;
17
- font-size: 100%;
18
- font: inherit;
19
- vertical-align: baseline;
20
- }
21
- a,a:link,a:visited,a:hover,a:active{
22
- text-decoration: none;
23
- color:inherit;
24
- }
25
- /* HTML5 display-role reset for older browsers */
26
- article, aside, details, figcaption, figure,
27
- footer, header, hgroup, menu, nav, section {
28
- display: block;
29
- }
30
- body {
31
- line-height: 1;
32
- }
33
- ol, ul {
34
- list-style: none;
35
- }
36
- blockquote, q {
37
- quotes: none;
38
- }
39
- blockquote:before, blockquote:after,
40
- q:before, q:after {
41
- content: '';
42
- content: none;
43
- }
44
- table {
45
- border-collapse: collapse;
46
- border-spacing: 0;
47
- }
48
- html, body {
49
- height: 100%;
50
- width: 100%;
51
- margin: 0;
52
- -webkit-text-size-adjust: 100%;
53
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
54
- }
55
- *{
56
- -webkit-touch-callout:none;
57
- -webkit-user-select:none;
58
- -khtml-user-select:none;
59
- -moz-user-select:none;
60
- -ms-user-select:none;
61
- user-select:none;
62
- }
63
- .text-ellipsis {
64
- text-overflow: ellipsis;
65
- white-space: nowrap;
66
- overflow: hidden;
67
- }
@@ -1,39 +0,0 @@
1
- import React, { PropsWithChildren, useContext } from 'react';
2
- import {
3
- ChatSDK,
4
- Conversation,
5
- Profile,
6
- } from '@tencentcloud/chat';
7
- import { UseContactParams } from '../components/TUIKit/hooks/useTUIKit';
8
-
9
- export interface TUIKitContextValue {
10
- chat: ChatSDK,
11
- language: string,
12
- conversation?: Conversation,
13
- contactData?: UseContactParams,
14
- setActiveConversation: (conversation?: Conversation) => void,
15
- customClasses?: unknown,
16
- myProfile?: Profile,
17
- TUIManageShow?: boolean,
18
- setTUIManageShow?: React.Dispatch<React.SetStateAction<boolean>>,
19
- TUIProfileShow?: boolean,
20
- setActiveContact: (UseContactParams?: UseContactParams) => void,
21
- setTUIProfileShow?: React.Dispatch<React.SetStateAction<boolean>>,
22
- }
23
- export const TUIKitContext = React.createContext<TUIKitContextValue | undefined>(undefined);
24
- export function TUIKitProvider({ children, value }:PropsWithChildren<{
25
- value: TUIKitContextValue
26
- }>):React.ReactElement {
27
- return (
28
- <TUIKitContext.Provider value={(value as unknown) as TUIKitContextValue}>
29
- {children}
30
- </TUIKitContext.Provider>
31
- );
32
- }
33
- export const useTUIKitContext = (componentName?:string):TUIKitContextValue => {
34
- const contextValue = useContext(TUIKitContext);
35
- if (!contextValue && componentName) {
36
- return {} as TUIKitContextValue;
37
- }
38
- return (contextValue as unknown) as TUIKitContextValue;
39
- };