@tencentcloud/ai-desk-customer-vue 0.1.0

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 (351) hide show
  1. package/.code.yml +17 -0
  2. package/.eslintignore +6 -0
  3. package/.stylelintrc.json +40 -0
  4. package/CHANGELOG.md +5 -0
  5. package/README.md +12 -0
  6. package/adapter-vue-web.ts +73 -0
  7. package/adapter-vue.ts +10 -0
  8. package/assets/audio-before-delete.svg +4 -0
  9. package/assets/audio-blue.png +0 -0
  10. package/assets/audio-bubble-blue.svg +3 -0
  11. package/assets/audio-bubble-red.svg +3 -0
  12. package/assets/audio-delete.svg +10 -0
  13. package/assets/audio.svg +6 -0
  14. package/assets/back.svg +16 -0
  15. package/assets/background_mobile.png +0 -0
  16. package/assets/camera-uni.png +0 -0
  17. package/assets/close-quote-icon.svg +3 -0
  18. package/assets/customer_avatar.png +0 -0
  19. package/assets/customer_avatar_mobile.png +0 -0
  20. package/assets/dialog-close.png +0 -0
  21. package/assets/double-arrow.svg +1 -0
  22. package/assets/download.svg +6 -0
  23. package/assets/emoji.png +0 -0
  24. package/assets/face-uni.png +0 -0
  25. package/assets/face.png +0 -0
  26. package/assets/file-h5.png +0 -0
  27. package/assets/files.png +0 -0
  28. package/assets/form-dialog-bg.png +0 -0
  29. package/assets/icon-arrow-left.svg +7 -0
  30. package/assets/icon-close.svg +6 -0
  31. package/assets/iconRight.svg +3 -0
  32. package/assets/icon_form.png +0 -0
  33. package/assets/icon_form_filled.png +0 -0
  34. package/assets/icon_question.png +0 -0
  35. package/assets/icon_refresh.png +0 -0
  36. package/assets/icon_success.png +0 -0
  37. package/assets/imRobotGuess.svg +4 -0
  38. package/assets/image-uni.png +0 -0
  39. package/assets/image.png +0 -0
  40. package/assets/keyboard_icon.png +0 -0
  41. package/assets/loading.png +0 -0
  42. package/assets/more-uni.png +0 -0
  43. package/assets/more_tools.png +0 -0
  44. package/assets/msg-audio.svg +1 -0
  45. package/assets/msg-copy.svg +30 -0
  46. package/assets/msg-del.svg +33 -0
  47. package/assets/msg-quote.svg +8 -0
  48. package/assets/msg-revoke.svg +29 -0
  49. package/assets/radio-check.png +0 -0
  50. package/assets/radio-uncheck.png +0 -0
  51. package/assets/radio.svg +6 -0
  52. package/assets/refresh.svg +4 -0
  53. package/assets/rotate-left.svg +7 -0
  54. package/assets/rotate-right.svg +7 -0
  55. package/assets/star.png +0 -0
  56. package/assets/starLine.png +0 -0
  57. package/assets/translate.svg +12 -0
  58. package/assets/video-play.png +0 -0
  59. package/assets/video-uni.png +0 -0
  60. package/assets/video.png +0 -0
  61. package/assets/zoom-in.svg +9 -0
  62. package/assets/zoom-out.svg +9 -0
  63. package/components/CustomerServiceChat/chat-header/index-web.vue +141 -0
  64. package/components/CustomerServiceChat/emoji-config/custom-emoji.ts +15 -0
  65. package/components/CustomerServiceChat/emoji-config/default-emoji.ts +114 -0
  66. package/components/CustomerServiceChat/emoji-config/index.ts +140 -0
  67. package/components/CustomerServiceChat/emoji-config/locales/en.ts +66 -0
  68. package/components/CustomerServiceChat/emoji-config/locales/zh_cn.ts +66 -0
  69. package/components/CustomerServiceChat/index-web.vue +250 -0
  70. package/components/CustomerServiceChat/message-input/index-web.vue +214 -0
  71. package/components/CustomerServiceChat/message-input/index.ts +2 -0
  72. package/components/CustomerServiceChat/message-input/message-input-button.vue +95 -0
  73. package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +884 -0
  74. package/components/CustomerServiceChat/message-input/message-input-file-web.ts +38 -0
  75. package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +204 -0
  76. package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +145 -0
  77. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +180 -0
  78. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.ts +2 -0
  79. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +90 -0
  80. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/h5.scss +26 -0
  81. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/index.scss +4 -0
  82. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/web.scss +55 -0
  83. package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.ts +2 -0
  84. package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +77 -0
  85. package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.ts +2 -0
  86. package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +185 -0
  87. package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +191 -0
  88. package/components/CustomerServiceChat/message-input-toolbar/index.ts +2 -0
  89. package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +111 -0
  90. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +149 -0
  91. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/color.scss +6 -0
  92. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +20 -0
  93. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +5 -0
  94. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +36 -0
  95. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/web.scss +19 -0
  96. package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.ts +2 -0
  97. package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +146 -0
  98. package/components/CustomerServiceChat/message-list/index-web.vue +712 -0
  99. package/components/CustomerServiceChat/message-list/link/index.ts +23 -0
  100. package/components/CustomerServiceChat/message-list/message-elements/message-audio-web.vue +223 -0
  101. package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +504 -0
  102. package/components/CustomerServiceChat/message-list/message-elements/message-custom.vue +5 -0
  103. package/components/CustomerServiceChat/message-list/message-elements/message-face.vue +45 -0
  104. package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +151 -0
  105. package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +97 -0
  106. package/components/CustomerServiceChat/message-list/message-elements/message-location.vue +34 -0
  107. package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +286 -0
  108. package/components/CustomerServiceChat/message-list/message-elements/message-quote/interface.ts +60 -0
  109. package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +139 -0
  110. package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +94 -0
  111. package/components/CustomerServiceChat/message-list/message-elements/message-timestamp.vue +76 -0
  112. package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +319 -0
  113. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/index.ts +9 -0
  114. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/index.ts +5 -0
  115. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +22 -0
  116. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-layout-web.vue +133 -0
  117. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-web.vue +83 -0
  118. package/components/CustomerServiceChat/message-list/message-elements/read-status/index.vue +193 -0
  119. package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +462 -0
  120. package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/message-container.vue +105 -0
  121. package/components/CustomerServiceChat/message-list/message-elements/video-play.vue +59 -0
  122. package/components/CustomerServiceChat/message-list/message-tool/index-web.vue +312 -0
  123. package/components/CustomerServiceChat/message-list/message-tool/message-revoked.vue +63 -0
  124. package/components/CustomerServiceChat/message-list/scroll-button/index.vue +201 -0
  125. package/components/CustomerServiceChat/message-list/style/color.scss +32 -0
  126. package/components/CustomerServiceChat/message-list/style/h5.scss +16 -0
  127. package/components/CustomerServiceChat/message-list/style/index.scss +11 -0
  128. package/components/CustomerServiceChat/message-list/style/web.scss +180 -0
  129. package/components/CustomerServiceChat/style/common.scss +59 -0
  130. package/components/CustomerServiceChat/style/h5.scss +51 -0
  131. package/components/CustomerServiceChat/style/index.scss +12 -0
  132. package/components/CustomerServiceChat/style/uni.scss +13 -0
  133. package/components/CustomerServiceChat/style/web.scss +46 -0
  134. package/components/CustomerServiceChat/style/wx.scss +5 -0
  135. package/components/CustomerServiceChat/utils/conversationDraft.ts +86 -0
  136. package/components/CustomerServiceChat/utils/sendMessage.ts +140 -0
  137. package/components/common/Avatar/index.vue +148 -0
  138. package/components/common/BottomPopup/index.ts +3 -0
  139. package/components/common/BottomPopup/index.vue +160 -0
  140. package/components/common/BottomPopup/style/h5.scss +62 -0
  141. package/components/common/BottomPopup/style/index.scss +3 -0
  142. package/components/common/BottomPopup/style/modal.scss +5 -0
  143. package/components/common/Dialog/index.ts +3 -0
  144. package/components/common/Dialog/index.vue +120 -0
  145. package/components/common/Dialog/style/color.scss +43 -0
  146. package/components/common/Dialog/style/dialog.scss +4 -0
  147. package/components/common/Dialog/style/h5.scss +56 -0
  148. package/components/common/Dialog/style/web.scss +61 -0
  149. package/components/common/Drawer/index.vue +164 -0
  150. package/components/common/Icon.vue +83 -0
  151. package/components/common/ImagePreviewer/image-item-web.vue +42 -0
  152. package/components/common/ImagePreviewer/index-web.vue +682 -0
  153. package/components/common/ImagePreviewer/index.ts +3 -0
  154. package/components/common/Overlay/index.vue +126 -0
  155. package/components/common/ProgressMessage/index.vue +95 -0
  156. package/components/common/RadioSelect/index.vue +59 -0
  157. package/components/common/RichText/LICENSE +21 -0
  158. package/components/common/RichText/README.md +244 -0
  159. package/components/common/RichText/dist/mp-alipay/index.acss +1 -0
  160. package/components/common/RichText/dist/mp-alipay/index.axml +1 -0
  161. package/components/common/RichText/dist/mp-alipay/index.js +8 -0
  162. package/components/common/RichText/dist/mp-alipay/index.json +1 -0
  163. package/components/common/RichText/dist/mp-alipay/node/node.acss +1 -0
  164. package/components/common/RichText/dist/mp-alipay/node/node.axml +1 -0
  165. package/components/common/RichText/dist/mp-alipay/node/node.js +1 -0
  166. package/components/common/RichText/dist/mp-alipay/node/node.json +1 -0
  167. package/components/common/RichText/dist/mp-alipay/parser.js +1 -0
  168. package/components/common/RichText/dist/mp-baidu/index.css +1 -0
  169. package/components/common/RichText/dist/mp-baidu/index.js +8 -0
  170. package/components/common/RichText/dist/mp-baidu/index.json +1 -0
  171. package/components/common/RichText/dist/mp-baidu/index.swan +1 -0
  172. package/components/common/RichText/dist/mp-baidu/node/node.css +1 -0
  173. package/components/common/RichText/dist/mp-baidu/node/node.js +1 -0
  174. package/components/common/RichText/dist/mp-baidu/node/node.json +1 -0
  175. package/components/common/RichText/dist/mp-baidu/node/node.swan +1 -0
  176. package/components/common/RichText/dist/mp-baidu/parser.js +1 -0
  177. package/components/common/RichText/dist/mp-qq/index.js +8 -0
  178. package/components/common/RichText/dist/mp-qq/index.json +1 -0
  179. package/components/common/RichText/dist/mp-qq/index.qml +1 -0
  180. package/components/common/RichText/dist/mp-qq/index.qss +1 -0
  181. package/components/common/RichText/dist/mp-qq/node/node.js +1 -0
  182. package/components/common/RichText/dist/mp-qq/node/node.json +1 -0
  183. package/components/common/RichText/dist/mp-qq/node/node.qml +1 -0
  184. package/components/common/RichText/dist/mp-qq/node/node.qss +1 -0
  185. package/components/common/RichText/dist/mp-qq/parser.js +1 -0
  186. package/components/common/RichText/dist/mp-toutiao/index.js +8 -0
  187. package/components/common/RichText/dist/mp-toutiao/index.json +1 -0
  188. package/components/common/RichText/dist/mp-toutiao/index.ttml +1 -0
  189. package/components/common/RichText/dist/mp-toutiao/index.ttss +1 -0
  190. package/components/common/RichText/dist/mp-toutiao/node/node.js +1 -0
  191. package/components/common/RichText/dist/mp-toutiao/node/node.json +1 -0
  192. package/components/common/RichText/dist/mp-toutiao/node/node.ttml +1 -0
  193. package/components/common/RichText/dist/mp-toutiao/node/node.ttss +1 -0
  194. package/components/common/RichText/dist/mp-toutiao/parser.js +1 -0
  195. package/components/common/RichText/dist/mp-weixin/index.js +8 -0
  196. package/components/common/RichText/dist/mp-weixin/index.json +1 -0
  197. package/components/common/RichText/dist/mp-weixin/index.wxml +1 -0
  198. package/components/common/RichText/dist/mp-weixin/index.wxss +1 -0
  199. package/components/common/RichText/dist/mp-weixin/node/node.js +1 -0
  200. package/components/common/RichText/dist/mp-weixin/node/node.json +1 -0
  201. package/components/common/RichText/dist/mp-weixin/node/node.wxml +1 -0
  202. package/components/common/RichText/dist/mp-weixin/node/node.wxss +1 -0
  203. package/components/common/RichText/dist/mp-weixin/parser.js +1 -0
  204. package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +498 -0
  205. package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +587 -0
  206. package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +1393 -0
  207. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +1 -0
  208. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
  209. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +1 -0
  210. package/components/common/RichText/docs/.nojekyll +0 -0
  211. package/components/common/RichText/docs/index.html +50 -0
  212. package/components/common/RichText/docs/lib/docsify.min.js +1 -0
  213. package/components/common/RichText/docs/lib/prism-bash.min.js +1 -0
  214. package/components/common/RichText/docs/lib/search.min.js +1 -0
  215. package/components/common/RichText/docs/lib/vue.css +858 -0
  216. package/components/common/RichText/gulpfile.js +113 -0
  217. package/components/common/RichText/lint.js +63 -0
  218. package/components/common/RichText/package.json +74 -0
  219. package/components/common/RichText/plugins/README.md +2 -0
  220. package/components/common/RichText/plugins/audio/README.md +25 -0
  221. package/components/common/RichText/plugins/audio/build.js +11 -0
  222. package/components/common/RichText/plugins/audio/context.js +7 -0
  223. package/components/common/RichText/plugins/audio/index.js +34 -0
  224. package/components/common/RichText/plugins/audio/miniprogram/audio.js +189 -0
  225. package/components/common/RichText/plugins/audio/miniprogram/audio.json +3 -0
  226. package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +17 -0
  227. package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +127 -0
  228. package/components/common/RichText/plugins/audio/miniprogram/build.js +3 -0
  229. package/components/common/RichText/plugins/audio/uni-app/audio.vue +269 -0
  230. package/components/common/RichText/plugins/audio/uni-app/build.js +3 -0
  231. package/components/common/RichText/plugins/card/README.md +30 -0
  232. package/components/common/RichText/plugins/card/build.js +14 -0
  233. package/components/common/RichText/plugins/card/index.js +7 -0
  234. package/components/common/RichText/plugins/card/miniprogram/build.js +3 -0
  235. package/components/common/RichText/plugins/card/miniprogram/card.js +26 -0
  236. package/components/common/RichText/plugins/card/miniprogram/card.json +3 -0
  237. package/components/common/RichText/plugins/card/miniprogram/card.wxml +9 -0
  238. package/components/common/RichText/plugins/card/miniprogram/card.wxss +55 -0
  239. package/components/common/RichText/plugins/card/uni-app/build.js +3 -0
  240. package/components/common/RichText/plugins/card/uni-app/card.vue +122 -0
  241. package/components/common/RichText/plugins/editable/README.md +137 -0
  242. package/components/common/RichText/plugins/editable/config.js +15 -0
  243. package/components/common/RichText/plugins/editable/miniprogram/build.js +813 -0
  244. package/components/common/RichText/plugins/editable/miniprogram/index.js +551 -0
  245. package/components/common/RichText/plugins/editable/uni-app/build.js +744 -0
  246. package/components/common/RichText/plugins/editable/uni-app/index.js +553 -0
  247. package/components/common/RichText/plugins/emoji/README.md +15 -0
  248. package/components/common/RichText/plugins/emoji/index.js +203 -0
  249. package/components/common/RichText/plugins/highlight/README.md +26 -0
  250. package/components/common/RichText/plugins/highlight/config.js +5 -0
  251. package/components/common/RichText/plugins/highlight/index.js +96 -0
  252. package/components/common/RichText/plugins/highlight/miniprogram/build.js +88 -0
  253. package/components/common/RichText/plugins/highlight/prism.css +125 -0
  254. package/components/common/RichText/plugins/highlight/prism.min.js +7 -0
  255. package/components/common/RichText/plugins/highlight/uni-app/build.js +88 -0
  256. package/components/common/RichText/plugins/img-cache/README.md +24 -0
  257. package/components/common/RichText/plugins/img-cache/build.js +16 -0
  258. package/components/common/RichText/plugins/img-cache/index.js +138 -0
  259. package/components/common/RichText/plugins/latex/README.md +16 -0
  260. package/components/common/RichText/plugins/latex/build.js +14 -0
  261. package/components/common/RichText/plugins/latex/index.js +77 -0
  262. package/components/common/RichText/plugins/latex/katex.css +1070 -0
  263. package/components/common/RichText/plugins/latex/katex.min.js +1 -0
  264. package/components/common/RichText/plugins/markdown/README.md +17 -0
  265. package/components/common/RichText/plugins/markdown/index.js +34 -0
  266. package/components/common/RichText/plugins/markdown/marked.min.js +6 -0
  267. package/components/common/RichText/plugins/markdown/miniprogram/build.js +70 -0
  268. package/components/common/RichText/plugins/markdown/uni-app/build.js +68 -0
  269. package/components/common/RichText/plugins/search/README.md +46 -0
  270. package/components/common/RichText/plugins/search/miniprogram/index.js +137 -0
  271. package/components/common/RichText/plugins/search/uni-app/index.js +132 -0
  272. package/components/common/RichText/plugins/style/README.md +30 -0
  273. package/components/common/RichText/plugins/style/index.js +129 -0
  274. package/components/common/RichText/plugins/style/parser.js +175 -0
  275. package/components/common/RichText/plugins/template/README.md +2 -0
  276. package/components/common/RichText/plugins/template/build.js +65 -0
  277. package/components/common/RichText/plugins/template/index.js +67 -0
  278. package/components/common/RichText/plugins/txv-video/README.md +18 -0
  279. package/components/common/RichText/plugins/txv-video/build.js +3 -0
  280. package/components/common/RichText/plugins/txv-video/index.js +46 -0
  281. package/components/common/RichText/plugins/txv-video/miniprogram/build.js +6 -0
  282. package/components/common/RichText/plugins/txv-video/uni-app/build.js +3 -0
  283. package/components/common/RichText/src/miniprogram/index.js +396 -0
  284. package/components/common/RichText/src/miniprogram/index.json +6 -0
  285. package/components/common/RichText/src/miniprogram/index.wxml +7 -0
  286. package/components/common/RichText/src/miniprogram/index.wxss +13 -0
  287. package/components/common/RichText/src/miniprogram/node/node.js +247 -0
  288. package/components/common/RichText/src/miniprogram/node/node.json +6 -0
  289. package/components/common/RichText/src/miniprogram/node/node.wxml +112 -0
  290. package/components/common/RichText/src/miniprogram/node/node.wxss +164 -0
  291. package/components/common/RichText/src/miniprogram/parser.js +1269 -0
  292. package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +498 -0
  293. package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +585 -0
  294. package/components/common/RichText/src/uni-app/components/mp-html/parser.js +1393 -0
  295. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +254 -0
  296. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
  297. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +33 -0
  298. package/components/common/RichText/tools/config.js +82 -0
  299. package/components/common/RichText/tools/converter.js +205 -0
  300. package/components/common/RichText/tools/ifdef.js +115 -0
  301. package/components/common/RichText/tools/minifier.js +40 -0
  302. package/components/common/RichText/tools/plugin.js +248 -0
  303. package/components/common/Toast/index-web.ts +122 -0
  304. package/components/common/Toast/index-web.vue +178 -0
  305. package/components/common/Toast/type.ts +8 -0
  306. package/components/common/common.scss +59 -0
  307. package/components/customer-icon.vue +56 -0
  308. package/components/message-branch.vue +120 -0
  309. package/components/message-customer-service.vue +114 -0
  310. package/components/message-form/form-branch.vue +68 -0
  311. package/components/message-form/form-input.vue +242 -0
  312. package/components/message-form/index.vue +80 -0
  313. package/components/message-multi-branch/branch-pc.vue +79 -0
  314. package/components/message-multi-branch/index.vue +60 -0
  315. package/components/message-multi-form/component-mobile/form-popup.vue +37 -0
  316. package/components/message-multi-form/component-mobile/input-mobile.vue +102 -0
  317. package/components/message-multi-form/component-mobile/label-mobile.vue +32 -0
  318. package/components/message-multi-form/component-mobile/radios-mobile.vue +161 -0
  319. package/components/message-multi-form/component-pc/input-pc.vue +93 -0
  320. package/components/message-multi-form/component-pc/label-pc.vue +33 -0
  321. package/components/message-multi-form/component-pc/radio-pc.vue +98 -0
  322. package/components/message-multi-form/form-mobile.vue +385 -0
  323. package/components/message-multi-form/form-pc.vue +184 -0
  324. package/components/message-multi-form/index.vue +61 -0
  325. package/components/message-product-card.vue +129 -0
  326. package/components/message-rating/index.vue +56 -0
  327. package/components/message-rating/message-rating-number.vue +247 -0
  328. package/components/message-rating/message-rating-star.vue +237 -0
  329. package/components/message-rich-text.vue +155 -0
  330. package/components/message-robot-welcome.vue +181 -0
  331. package/components/message-stream.vue +109 -0
  332. package/constant.ts +122 -0
  333. package/excluded-list.txt +6 -0
  334. package/index.ts +30 -0
  335. package/index.vue +60 -0
  336. package/interface.ts +176 -0
  337. package/logger/index.ts +12 -0
  338. package/logger/main.ts +120 -0
  339. package/package.json +62 -0
  340. package/script/fileCopy.js +60 -0
  341. package/script/syncVersion.js +35 -0
  342. package/server.ts +128 -0
  343. package/styles/common.scss +116 -0
  344. package/tsconfig.json +34 -0
  345. package/typings.d.ts +20 -0
  346. package/utils/chatStorage.ts +70 -0
  347. package/utils/copy-web.ts +141 -0
  348. package/utils/enableSampleTaskStatus.ts +8 -0
  349. package/utils/env.ts +15 -0
  350. package/utils/index.ts +59 -0
  351. package/utils/utils.ts +162 -0
@@ -0,0 +1,682 @@
1
+ <template>
2
+ <div
3
+ class="image-previewer"
4
+ :class="[isMobile && 'image-previewer-h5']"
5
+ >
6
+ <div
7
+ ref="image"
8
+ class="image-wrapper"
9
+ @touchstart.stop="handleTouchStart"
10
+ @touchmove.stop="handleTouchMove"
11
+ @touchend.stop="handleTouchEnd"
12
+ @touchcancel.stop="handleTouchCancel"
13
+ @wheel.stop="handleWheel"
14
+ >
15
+ <ul
16
+ ref="ulRef"
17
+ class="image-list"
18
+ :style="{
19
+ width: `${imageList.length * 100}%`,
20
+ transform: `translateX(-${
21
+ (currentImageIndex * 100) / imageList.length
22
+ }%)`,
23
+ transition: '0.5s',
24
+ }"
25
+ >
26
+ <li
27
+ v-for="(item, index) in imageList"
28
+ :key="index"
29
+ class="image-item"
30
+ >
31
+ <ImageItem
32
+ :zoom="zoom"
33
+ :rotate="rotate"
34
+ :src="getImageUrl(item)"
35
+ :messageItem="item"
36
+ :class="[isUniFrameWork ? 'image-item' : '']"
37
+ />
38
+ </li>
39
+ </ul>
40
+ </div>
41
+ <div
42
+ v-show="isPC"
43
+ class="icon icon-close"
44
+ @click="close"
45
+ >
46
+ <Icon
47
+ :file="iconClose"
48
+ width="16px"
49
+ height="16px"
50
+ />
51
+ </div>
52
+ <div
53
+ v-if="isPC && currentImageIndex > 0"
54
+ class="image-button image-button-left"
55
+ @click="goPrev"
56
+ >
57
+ <Icon :file="iconArrowLeft" />
58
+ </div>
59
+ <div
60
+ v-if="isPC && currentImageIndex < imageList.length - 1"
61
+ class="image-button image-button-right"
62
+ @click="goNext"
63
+ >
64
+ <Icon :file="iconArrowLeft" />
65
+ </div>
66
+ <div :class="['actions-bar', isMobile && 'actions-bar-h5']">
67
+ <div
68
+ v-if="isPC"
69
+ class="icon-zoom-in"
70
+ @click="zoomIn"
71
+ >
72
+ <Icon
73
+ :file="iconZoomIn"
74
+ width="27px"
75
+ height="27px"
76
+ />
77
+ </div>
78
+ <div
79
+ v-if="isPC"
80
+ class="icon-zoom-out"
81
+ @click="zoomOut"
82
+ >
83
+ <Icon
84
+ :file="iconZoomOut"
85
+ width="27px"
86
+ height="27px"
87
+ />
88
+ </div>
89
+ <div
90
+ v-if="isPC"
91
+ class="icon-refresh-left"
92
+ @click="rotateLeft"
93
+ >
94
+ <Icon
95
+ :file="iconRotateLeft"
96
+ width="27px"
97
+ height="27px"
98
+ />
99
+ </div>
100
+ <div
101
+ v-if="isPC"
102
+ class="icon-refresh-right"
103
+ @click="rotateRight"
104
+ >
105
+ <Icon
106
+ :file="iconRotateRight"
107
+ width="27px"
108
+ height="27px"
109
+ />
110
+ </div>
111
+ <span class="image-counter">
112
+ {{ currentImageIndex + 1 }} / {{ imageList.length }}
113
+ </span>
114
+ </div>
115
+ <div
116
+ class="save"
117
+ @click.stop.prevent="save"
118
+ >
119
+ <Icon
120
+ :file="iconDownload"
121
+ width="20px"
122
+ height="20px"
123
+ />
124
+ </div>
125
+ </div>
126
+ </template>
127
+
128
+ <script setup lang="ts">
129
+ import vue from '../../../adapter-vue';
130
+ import {
131
+ IMessageModel,
132
+ TUITranslateService,
133
+ } from '@tencentcloud/chat-uikit-engine';
134
+ import { TUIGlobal, getPlatform } from '@tencentcloud/universal-api';
135
+ import Icon from '../Icon.vue';
136
+ import iconClose from '../../../assets/icon-close.svg';
137
+ import iconArrowLeft from '../../../assets/icon-arrow-left.svg';
138
+ import iconZoomIn from '../../../assets/zoom-in.svg';
139
+ import iconZoomOut from '../../../assets/zoom-out.svg';
140
+ import iconRotateLeft from '../../../assets/rotate-left.svg';
141
+ import iconRotateRight from '../../../assets/rotate-right.svg';
142
+ import iconDownload from '../../../assets/download.svg';
143
+ import ImageItem from './image-item-web.vue';
144
+ import { Toast, TOAST_TYPE } from '../Toast/index-web';
145
+ import { isPC, isMobile, isUniFrameWork } from '../../../utils/env';
146
+ const { ref, watchEffect, onMounted, onUnmounted, withDefaults } = vue;
147
+
148
+ interface touchesPosition {
149
+ pageX1?: number;
150
+ pageY1?: number;
151
+ pageX2?: number;
152
+ pageY2?: number;
153
+ }
154
+
155
+ const props = withDefaults(
156
+ defineProps<{
157
+ imageList: IMessageModel[];
158
+ currentImage: IMessageModel;
159
+ }>(),
160
+ {
161
+ imageList: () => [] as IMessageModel[],
162
+ messageItem: () => ({} as IMessageModel),
163
+ },
164
+ );
165
+
166
+ const imageFormatMap = new Map([
167
+ [1, 'jpg'],
168
+ [2, 'gif'],
169
+ [3, 'png'],
170
+ [4, 'bmp'],
171
+ ]);
172
+
173
+ const emit = defineEmits(['close']);
174
+ const zoom = ref(1);
175
+ const rotate = ref(0);
176
+ const minZoom = ref(0.1);
177
+ const currentImageIndex = ref(0);
178
+ const image = ref();
179
+ const ulRef = ref();
180
+ // touch
181
+ let startX = 0;
182
+ const touchStore = {} as touchesPosition;
183
+ let moveFlag = false;
184
+ let twoTouchesFlag = false;
185
+ let timer: number | null = null;
186
+
187
+ watchEffect(() => {
188
+ currentImageIndex.value = props.imageList.findIndex((message: any) => {
189
+ return message.ID === props?.currentImage?.ID;
190
+ });
191
+ });
192
+
193
+ const isNumber = (value: any) => {
194
+ return typeof value === 'number' && isFinite(value);
195
+ };
196
+
197
+ const handleTouchStart = (e: any) => {
198
+ e.preventDefault();
199
+ moveInit(e);
200
+ twoTouchesInit(e);
201
+ };
202
+
203
+ const handleTouchMove = (e: any) => {
204
+ e.preventDefault();
205
+ moveFlag = true;
206
+ if (e.touches && e.touches.length === 2) {
207
+ twoTouchesFlag = true;
208
+ handleTwoTouches(e);
209
+ }
210
+ };
211
+
212
+ const handleTouchEnd = (e: any) => {
213
+ e.preventDefault();
214
+ e.stopPropagation();
215
+ let moveEndX = 0;
216
+ let X = 0;
217
+ if (twoTouchesFlag) {
218
+ if (!timer) {
219
+ twoTouchesFlag = false;
220
+ delete touchStore.pageX2;
221
+ delete touchStore.pageY2;
222
+ timer = setTimeout(() => {
223
+ timer = null;
224
+ }, 200);
225
+ }
226
+ return;
227
+ }
228
+ // H5 touch move to left to go to prev image
229
+ // H5 touch move to right to go to next image
230
+ if (timer === null) {
231
+ switch (moveFlag) {
232
+ // touch event
233
+ case true:
234
+ moveEndX = e?.changedTouches[0]?.pageX;
235
+ X = moveEndX - startX;
236
+ if (X > 100) {
237
+ goPrev();
238
+ } else if (X < -100) {
239
+ goNext();
240
+ }
241
+ break;
242
+ // click event
243
+ case false:
244
+ close();
245
+ break;
246
+ }
247
+ timer = setTimeout(() => {
248
+ timer = null;
249
+ }, 200);
250
+ }
251
+ };
252
+
253
+ const handleTouchCancel = () => {
254
+ twoTouchesFlag = false;
255
+ delete touchStore.pageX1;
256
+ delete touchStore.pageY1;
257
+ };
258
+
259
+ const handleWheel = (e: any) => {
260
+ e.preventDefault();
261
+ if (Math.abs(e.deltaX) !== 0 && Math.abs(e.deltaY) !== 0) return;
262
+ let scale = zoom.value;
263
+ scale += e.deltaY * (e.ctrlKey ? -0.01 : 0.002);
264
+ scale = Math.min(Math.max(0.125, scale), 4);
265
+ zoom.value = scale;
266
+ };
267
+
268
+ const moveInit = (e: any) => {
269
+ startX = e?.changedTouches[0]?.pageX;
270
+ moveFlag = false;
271
+ };
272
+
273
+ const twoTouchesInit = (e: any) => {
274
+ const touch1 = e?.touches[0];
275
+ const touch2 = e?.touches[1];
276
+ touchStore.pageX1 = touch1?.pageX;
277
+ touchStore.pageY1 = touch1?.pageY;
278
+ if (touch2) {
279
+ touchStore.pageX2 = touch2?.pageX;
280
+ touchStore.pageY2 = touch2?.pageY;
281
+ }
282
+ };
283
+
284
+ const handleTwoTouches = (e: any) => {
285
+ const touch1 = e?.touches[0];
286
+ const touch2 = e?.touches[1];
287
+ if (touch2) {
288
+ if (!isNumber(touchStore.pageX2)) {
289
+ touchStore.pageX2 = touch2.pageX;
290
+ }
291
+ if (!isNumber(touchStore.pageY2)) {
292
+ touchStore.pageY2 = touch2.pageY;
293
+ }
294
+ }
295
+ const getDistance = (
296
+ startX: number,
297
+ startY: number,
298
+ stopX: number,
299
+ stopY: number,
300
+ ) => {
301
+ return Math.hypot(stopX - startX, stopY - startY);
302
+ };
303
+ if (
304
+ !isNumber(touchStore.pageX1)
305
+ || !isNumber(touchStore.pageY1)
306
+ || !isNumber(touchStore.pageX2)
307
+ || !isNumber(touchStore.pageY2)
308
+ ) {
309
+ return;
310
+ }
311
+ const touchZoom
312
+ = getDistance(touch1.pageX, touch1.pageY, touch2.pageX, touch2.pageY)
313
+ / getDistance(
314
+ touchStore.pageX1 as number,
315
+ touchStore.pageY1 as number,
316
+ touchStore.pageX2 as number,
317
+ touchStore.pageY2 as number,
318
+ );
319
+ zoom.value = Math.min(Math.max(0.5, zoom.value * touchZoom), 4);
320
+ };
321
+
322
+ onMounted(() => {
323
+ // web: close on esc keydown
324
+ document?.addEventListener
325
+ && document?.addEventListener('keydown', handleEsc);
326
+ });
327
+
328
+ const handleEsc = (e: any) => {
329
+ e.preventDefault();
330
+ if (e?.keyCode === 27) {
331
+ close();
332
+ }
333
+ };
334
+ const zoomIn = () => {
335
+ zoom.value += 0.1;
336
+ };
337
+ const zoomOut = () => {
338
+ zoom.value
339
+ = zoom.value - 0.1 > minZoom.value ? zoom.value - 0.1 : minZoom.value;
340
+ };
341
+ const close = () => {
342
+ emit('close');
343
+ };
344
+ const rotateLeft = () => {
345
+ rotate.value -= 90;
346
+ };
347
+ const rotateRight = () => {
348
+ rotate.value += 90;
349
+ };
350
+ const goNext = () => {
351
+ currentImageIndex.value < props.imageList.length - 1
352
+ && currentImageIndex.value++;
353
+ initStyle();
354
+ };
355
+ const goPrev = () => {
356
+ currentImageIndex.value > 0 && currentImageIndex.value--;
357
+ initStyle();
358
+ };
359
+ const initStyle = () => {
360
+ zoom.value = 1;
361
+ rotate.value = 0;
362
+ };
363
+
364
+ const getImageUrl = (message: IMessageModel) => {
365
+ if (isPC) {
366
+ return message?.payload?.imageInfoArray[0]?.url;
367
+ } else {
368
+ return message?.payload?.imageInfoArray[2]?.url;
369
+ }
370
+ };
371
+
372
+ const save = () => {
373
+ const imageMessage = props.imageList[
374
+ currentImageIndex.value
375
+ ] as IMessageModel;
376
+ const imageSrc = imageMessage?.payload?.imageInfoArray[0]?.url;
377
+ if (!imageSrc) {
378
+ Toast({
379
+ message: TUITranslateService.t('component.图片 url 不存在'),
380
+ type: TOAST_TYPE.ERROR,
381
+ });
382
+ return;
383
+ }
384
+ switch (getPlatform()) {
385
+ case 'wechat':
386
+ // Get the user's current settings and get the album permissions
387
+ TUIGlobal.getSetting({
388
+ success: (res: any) => {
389
+ if (!res?.authSetting['scope.writePhotosAlbum']) {
390
+ TUIGlobal.authorize({
391
+ scope: 'scope.writePhotosAlbum',
392
+ success() {
393
+ downloadImgInUni(imageSrc);
394
+ },
395
+ fail() {
396
+ TUIGlobal.showModal({
397
+ title: '您已拒绝获取相册权限',
398
+ content: '是否进入权限管理,调整授权?',
399
+ success: (res: any) => {
400
+ if (res.confirm) {
401
+ // Call up the client applet settings interface and return the operation results set by the user.
402
+ // Ask the user to authorize again.
403
+ TUIGlobal.openSetting({
404
+ success: (res: any) => {
405
+ console.log(res.authSetting);
406
+ },
407
+ });
408
+ } else if (res.cancel) {
409
+ return Toast({
410
+ message: TUITranslateService.t('component.已取消'),
411
+ type: TOAST_TYPE.ERROR,
412
+ });
413
+ }
414
+ },
415
+ });
416
+ },
417
+ });
418
+ } else {
419
+ // If you already have album permission, save directly to the album
420
+ downloadImgInUni(imageSrc);
421
+ }
422
+ },
423
+ fail: () => {
424
+ Toast({
425
+ message: TUITranslateService.t('component.获取权限失败'),
426
+ type: TOAST_TYPE.ERROR,
427
+ });
428
+ },
429
+ });
430
+ break;
431
+ case 'app':
432
+ downloadImgInUni(imageSrc);
433
+ break;
434
+ default:
435
+ downloadImgInWeb(imageSrc);
436
+ break;
437
+ }
438
+ };
439
+
440
+ const downloadImgInUni = (src: string) => {
441
+ TUIGlobal.showLoading({
442
+ title: '大图提取中',
443
+ });
444
+ TUIGlobal.downloadFile({
445
+ url: src,
446
+ success: function (res: any) {
447
+ TUIGlobal.hideLoading();
448
+ TUIGlobal.saveImageToPhotosAlbum({
449
+ filePath: res.tempFilePath,
450
+ success: () => {
451
+ Toast({
452
+ message: TUITranslateService.t('component.已保存至相册'),
453
+ type: TOAST_TYPE.SUCCESS,
454
+ });
455
+ },
456
+ });
457
+ },
458
+ fail: function () {
459
+ TUIGlobal.hideLoading();
460
+ Toast({
461
+ message: TUITranslateService.t('component.图片下载失败'),
462
+ type: TOAST_TYPE.ERROR,
463
+ });
464
+ },
465
+ });
466
+ };
467
+
468
+ const downloadImgInWeb = (src: string) => {
469
+ const option: any = {
470
+ mode: 'cors',
471
+ headers: new Headers({
472
+ 'Content-Type': 'application/x-www-form-urlencoded',
473
+ }),
474
+ };
475
+ const imageMessage = props.imageList[
476
+ currentImageIndex.value
477
+ ] as IMessageModel;
478
+ const imageFormat: number = imageMessage?.payload?.imageFormat;
479
+ if (!imageFormatMap.has(imageFormat)) {
480
+ Toast({
481
+ message: TUITranslateService.t('component.暂不支持下载此类型图片'),
482
+ type: TOAST_TYPE.ERROR,
483
+ });
484
+ return;
485
+ }
486
+ // If the browser supports fetch, use blob to download, so as to avoid the browser clicking the a tag and jumping to the preview of the new page
487
+ if ((window as any).fetch) {
488
+ fetch(src, option)
489
+ .then(res => res.blob())
490
+ .then((blob) => {
491
+ const a = document.createElement('a');
492
+ const url = window.URL.createObjectURL(blob);
493
+ a.href = url;
494
+ a.download = url + '.' + imageFormatMap.get(imageFormat);
495
+ a.click();
496
+ });
497
+ } else {
498
+ const a = document.createElement('a');
499
+ a.href = src;
500
+ a.target = '_blank';
501
+ a.download = src + '.' + imageFormatMap.get(imageFormat);
502
+ a.click();
503
+ }
504
+ };
505
+
506
+ onUnmounted(() => {
507
+ document?.removeEventListener
508
+ && document?.removeEventListener('keydown', handleEsc);
509
+ });
510
+ </script>
511
+
512
+ <style lang="scss" scoped>
513
+ @import "../common";
514
+
515
+ .actions-bar {
516
+ display: flex;
517
+ justify-content: space-around;
518
+ align-items: center;
519
+ position: absolute;
520
+ bottom: 5%;
521
+ padding: 12px;
522
+ border-radius: 6px;
523
+ background: rgba(255, 255, 255, 0.8);
524
+
525
+ &-h5 {
526
+ padding: 6px;
527
+ }
528
+
529
+ .icon {
530
+ position: static;
531
+ font-size: 24px;
532
+ cursor: pointer;
533
+ width: 27px;
534
+ height: 27px;
535
+ margin: 5px;
536
+ }
537
+
538
+ .icon-zoom-in,
539
+ .icon-zoom-out,
540
+ .icon-refresh-left,
541
+ .icon-refresh-right {
542
+ cursor: pointer;
543
+ user-select: none;
544
+ padding: 5px;
545
+ }
546
+ }
547
+
548
+ .image-previewer {
549
+ position: fixed;
550
+ z-index: 101;
551
+ width: 100vw;
552
+ height: 100vh;
553
+ background: rgba(#000, 0.3);
554
+ top: 0;
555
+ left: 0;
556
+ display: flex;
557
+ flex-direction: column;
558
+ align-items: center;
559
+ user-select: none;
560
+
561
+ .image-wrapper {
562
+ position: relative;
563
+ width: 100%;
564
+ height: 100%;
565
+ display: flex;
566
+ justify-content: center;
567
+ align-items: center;
568
+ overflow: hidden;
569
+ }
570
+
571
+ .image-list {
572
+ position: absolute;
573
+ height: 100%;
574
+ left: 0;
575
+ padding: 0;
576
+ margin: 0;
577
+ display: flex;
578
+ flex-direction: row;
579
+ place-content: center center;
580
+
581
+ .image-item {
582
+ width: 100%;
583
+ height: 100%;
584
+ display: flex;
585
+ align-items: center;
586
+ justify-content: center;
587
+ overflow: hidden;
588
+ }
589
+ }
590
+
591
+ .image-preview {
592
+ max-width: 100%;
593
+ max-height: 100%;
594
+ transition: transform 0.1s ease 0s;
595
+ pointer-events: auto;
596
+ }
597
+
598
+ .image-button {
599
+ display: flex;
600
+ flex-direction: column;
601
+ min-width: auto;
602
+ justify-content: center;
603
+ align-items: center;
604
+ position: absolute;
605
+ cursor: pointer;
606
+ width: 40px;
607
+ height: 40px;
608
+ border-radius: 50%;
609
+ top: calc(50% - 20px);
610
+ background: rgba(255, 255, 255, 0.8);
611
+
612
+ &-left {
613
+ left: 10px;
614
+ }
615
+
616
+ &-right {
617
+ right: 10px;
618
+ transform: rotate(180deg);
619
+ }
620
+
621
+ .icon {
622
+ position: absolute;
623
+ bottom: 0;
624
+ top: 0;
625
+ left: 0;
626
+ right: 0;
627
+ margin: auto;
628
+ line-height: 40px;
629
+ display: flex;
630
+ flex-direction: column;
631
+ min-width: auto;
632
+ justify-content: center;
633
+ align-items: center;
634
+ }
635
+ }
636
+
637
+ .icon-close {
638
+ position: absolute;
639
+ cursor: pointer;
640
+ border-radius: 50%;
641
+ top: 3%;
642
+ right: 3%;
643
+ padding: 10px;
644
+ background: rgba(255, 255, 255, 0.8);
645
+ display: flex;
646
+
647
+ &::before,
648
+ &::after {
649
+ background-color: #444;
650
+ }
651
+ }
652
+ }
653
+
654
+ .image-previewer-h5 {
655
+ width: 100%;
656
+ height: 100%;
657
+ background: #000;
658
+ display: flex;
659
+ flex-direction: column;
660
+ }
661
+
662
+ .save {
663
+ cursor: pointer;
664
+ display: flex;
665
+ justify-content: space-around;
666
+ align-items: center;
667
+ position: absolute;
668
+ bottom: 5%;
669
+ right: 5%;
670
+ padding: 12px;
671
+ border-radius: 6px;
672
+ background: rgba(255, 255, 255, 0.8);
673
+ }
674
+
675
+ .image-counter {
676
+ background: rgba(20, 18, 20, 0.53);
677
+ padding: 3px 5px;
678
+ margin: 5px;
679
+ border-radius: 3px;
680
+ color: #fff;
681
+ }
682
+ </style>
@@ -0,0 +1,3 @@
1
+ import ImagePreviewer from './index.vue';
2
+
3
+ export default ImagePreviewer;