@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.
- package/.code.yml +17 -0
- package/.eslintignore +6 -0
- package/.stylelintrc.json +40 -0
- package/CHANGELOG.md +5 -0
- package/README.md +12 -0
- package/adapter-vue-web.ts +73 -0
- package/adapter-vue.ts +10 -0
- package/assets/audio-before-delete.svg +4 -0
- package/assets/audio-blue.png +0 -0
- package/assets/audio-bubble-blue.svg +3 -0
- package/assets/audio-bubble-red.svg +3 -0
- package/assets/audio-delete.svg +10 -0
- package/assets/audio.svg +6 -0
- package/assets/back.svg +16 -0
- package/assets/background_mobile.png +0 -0
- package/assets/camera-uni.png +0 -0
- package/assets/close-quote-icon.svg +3 -0
- package/assets/customer_avatar.png +0 -0
- package/assets/customer_avatar_mobile.png +0 -0
- package/assets/dialog-close.png +0 -0
- package/assets/double-arrow.svg +1 -0
- package/assets/download.svg +6 -0
- package/assets/emoji.png +0 -0
- package/assets/face-uni.png +0 -0
- package/assets/face.png +0 -0
- package/assets/file-h5.png +0 -0
- package/assets/files.png +0 -0
- package/assets/form-dialog-bg.png +0 -0
- package/assets/icon-arrow-left.svg +7 -0
- package/assets/icon-close.svg +6 -0
- package/assets/iconRight.svg +3 -0
- package/assets/icon_form.png +0 -0
- package/assets/icon_form_filled.png +0 -0
- package/assets/icon_question.png +0 -0
- package/assets/icon_refresh.png +0 -0
- package/assets/icon_success.png +0 -0
- package/assets/imRobotGuess.svg +4 -0
- package/assets/image-uni.png +0 -0
- package/assets/image.png +0 -0
- package/assets/keyboard_icon.png +0 -0
- package/assets/loading.png +0 -0
- package/assets/more-uni.png +0 -0
- package/assets/more_tools.png +0 -0
- package/assets/msg-audio.svg +1 -0
- package/assets/msg-copy.svg +30 -0
- package/assets/msg-del.svg +33 -0
- package/assets/msg-quote.svg +8 -0
- package/assets/msg-revoke.svg +29 -0
- package/assets/radio-check.png +0 -0
- package/assets/radio-uncheck.png +0 -0
- package/assets/radio.svg +6 -0
- package/assets/refresh.svg +4 -0
- package/assets/rotate-left.svg +7 -0
- package/assets/rotate-right.svg +7 -0
- package/assets/star.png +0 -0
- package/assets/starLine.png +0 -0
- package/assets/translate.svg +12 -0
- package/assets/video-play.png +0 -0
- package/assets/video-uni.png +0 -0
- package/assets/video.png +0 -0
- package/assets/zoom-in.svg +9 -0
- package/assets/zoom-out.svg +9 -0
- package/components/CustomerServiceChat/chat-header/index-web.vue +141 -0
- package/components/CustomerServiceChat/emoji-config/custom-emoji.ts +15 -0
- package/components/CustomerServiceChat/emoji-config/default-emoji.ts +114 -0
- package/components/CustomerServiceChat/emoji-config/index.ts +140 -0
- package/components/CustomerServiceChat/emoji-config/locales/en.ts +66 -0
- package/components/CustomerServiceChat/emoji-config/locales/zh_cn.ts +66 -0
- package/components/CustomerServiceChat/index-web.vue +250 -0
- package/components/CustomerServiceChat/message-input/index-web.vue +214 -0
- package/components/CustomerServiceChat/message-input/index.ts +2 -0
- package/components/CustomerServiceChat/message-input/message-input-button.vue +95 -0
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +884 -0
- package/components/CustomerServiceChat/message-input/message-input-file-web.ts +38 -0
- package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +204 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +145 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +180 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +90 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/h5.scss +26 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/index.scss +4 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/web.scss +55 -0
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +77 -0
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +185 -0
- package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +191 -0
- package/components/CustomerServiceChat/message-input-toolbar/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +111 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +149 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/color.scss +6 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +20 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +5 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +36 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/web.scss +19 -0
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +146 -0
- package/components/CustomerServiceChat/message-list/index-web.vue +712 -0
- package/components/CustomerServiceChat/message-list/link/index.ts +23 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-audio-web.vue +223 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +504 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-custom.vue +5 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-face.vue +45 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +151 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +97 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-location.vue +34 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +286 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/interface.ts +60 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +139 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +94 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-timestamp.vue +76 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +319 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/index.ts +9 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/index.ts +5 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +22 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-layout-web.vue +133 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-web.vue +83 -0
- package/components/CustomerServiceChat/message-list/message-elements/read-status/index.vue +193 -0
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +462 -0
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/message-container.vue +105 -0
- package/components/CustomerServiceChat/message-list/message-elements/video-play.vue +59 -0
- package/components/CustomerServiceChat/message-list/message-tool/index-web.vue +312 -0
- package/components/CustomerServiceChat/message-list/message-tool/message-revoked.vue +63 -0
- package/components/CustomerServiceChat/message-list/scroll-button/index.vue +201 -0
- package/components/CustomerServiceChat/message-list/style/color.scss +32 -0
- package/components/CustomerServiceChat/message-list/style/h5.scss +16 -0
- package/components/CustomerServiceChat/message-list/style/index.scss +11 -0
- package/components/CustomerServiceChat/message-list/style/web.scss +180 -0
- package/components/CustomerServiceChat/style/common.scss +59 -0
- package/components/CustomerServiceChat/style/h5.scss +51 -0
- package/components/CustomerServiceChat/style/index.scss +12 -0
- package/components/CustomerServiceChat/style/uni.scss +13 -0
- package/components/CustomerServiceChat/style/web.scss +46 -0
- package/components/CustomerServiceChat/style/wx.scss +5 -0
- package/components/CustomerServiceChat/utils/conversationDraft.ts +86 -0
- package/components/CustomerServiceChat/utils/sendMessage.ts +140 -0
- package/components/common/Avatar/index.vue +148 -0
- package/components/common/BottomPopup/index.ts +3 -0
- package/components/common/BottomPopup/index.vue +160 -0
- package/components/common/BottomPopup/style/h5.scss +62 -0
- package/components/common/BottomPopup/style/index.scss +3 -0
- package/components/common/BottomPopup/style/modal.scss +5 -0
- package/components/common/Dialog/index.ts +3 -0
- package/components/common/Dialog/index.vue +120 -0
- package/components/common/Dialog/style/color.scss +43 -0
- package/components/common/Dialog/style/dialog.scss +4 -0
- package/components/common/Dialog/style/h5.scss +56 -0
- package/components/common/Dialog/style/web.scss +61 -0
- package/components/common/Drawer/index.vue +164 -0
- package/components/common/Icon.vue +83 -0
- package/components/common/ImagePreviewer/image-item-web.vue +42 -0
- package/components/common/ImagePreviewer/index-web.vue +682 -0
- package/components/common/ImagePreviewer/index.ts +3 -0
- package/components/common/Overlay/index.vue +126 -0
- package/components/common/ProgressMessage/index.vue +95 -0
- package/components/common/RadioSelect/index.vue +59 -0
- package/components/common/RichText/LICENSE +21 -0
- package/components/common/RichText/README.md +244 -0
- package/components/common/RichText/dist/mp-alipay/index.acss +1 -0
- package/components/common/RichText/dist/mp-alipay/index.axml +1 -0
- package/components/common/RichText/dist/mp-alipay/index.js +8 -0
- package/components/common/RichText/dist/mp-alipay/index.json +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.acss +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.axml +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.js +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.json +1 -0
- package/components/common/RichText/dist/mp-alipay/parser.js +1 -0
- package/components/common/RichText/dist/mp-baidu/index.css +1 -0
- package/components/common/RichText/dist/mp-baidu/index.js +8 -0
- package/components/common/RichText/dist/mp-baidu/index.json +1 -0
- package/components/common/RichText/dist/mp-baidu/index.swan +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.css +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.js +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.json +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.swan +1 -0
- package/components/common/RichText/dist/mp-baidu/parser.js +1 -0
- package/components/common/RichText/dist/mp-qq/index.js +8 -0
- package/components/common/RichText/dist/mp-qq/index.json +1 -0
- package/components/common/RichText/dist/mp-qq/index.qml +1 -0
- package/components/common/RichText/dist/mp-qq/index.qss +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.js +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.json +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.qml +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.qss +1 -0
- package/components/common/RichText/dist/mp-qq/parser.js +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.js +8 -0
- package/components/common/RichText/dist/mp-toutiao/index.json +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.ttml +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.ttss +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.js +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.json +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.ttml +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.ttss +1 -0
- package/components/common/RichText/dist/mp-toutiao/parser.js +1 -0
- package/components/common/RichText/dist/mp-weixin/index.js +8 -0
- package/components/common/RichText/dist/mp-weixin/index.json +1 -0
- package/components/common/RichText/dist/mp-weixin/index.wxml +1 -0
- package/components/common/RichText/dist/mp-weixin/index.wxss +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.js +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.json +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.wxml +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.wxss +1 -0
- package/components/common/RichText/dist/mp-weixin/parser.js +1 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +498 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +587 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +1393 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +1 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +1 -0
- package/components/common/RichText/docs/.nojekyll +0 -0
- package/components/common/RichText/docs/index.html +50 -0
- package/components/common/RichText/docs/lib/docsify.min.js +1 -0
- package/components/common/RichText/docs/lib/prism-bash.min.js +1 -0
- package/components/common/RichText/docs/lib/search.min.js +1 -0
- package/components/common/RichText/docs/lib/vue.css +858 -0
- package/components/common/RichText/gulpfile.js +113 -0
- package/components/common/RichText/lint.js +63 -0
- package/components/common/RichText/package.json +74 -0
- package/components/common/RichText/plugins/README.md +2 -0
- package/components/common/RichText/plugins/audio/README.md +25 -0
- package/components/common/RichText/plugins/audio/build.js +11 -0
- package/components/common/RichText/plugins/audio/context.js +7 -0
- package/components/common/RichText/plugins/audio/index.js +34 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.js +189 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.json +3 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +17 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +127 -0
- package/components/common/RichText/plugins/audio/miniprogram/build.js +3 -0
- package/components/common/RichText/plugins/audio/uni-app/audio.vue +269 -0
- package/components/common/RichText/plugins/audio/uni-app/build.js +3 -0
- package/components/common/RichText/plugins/card/README.md +30 -0
- package/components/common/RichText/plugins/card/build.js +14 -0
- package/components/common/RichText/plugins/card/index.js +7 -0
- package/components/common/RichText/plugins/card/miniprogram/build.js +3 -0
- package/components/common/RichText/plugins/card/miniprogram/card.js +26 -0
- package/components/common/RichText/plugins/card/miniprogram/card.json +3 -0
- package/components/common/RichText/plugins/card/miniprogram/card.wxml +9 -0
- package/components/common/RichText/plugins/card/miniprogram/card.wxss +55 -0
- package/components/common/RichText/plugins/card/uni-app/build.js +3 -0
- package/components/common/RichText/plugins/card/uni-app/card.vue +122 -0
- package/components/common/RichText/plugins/editable/README.md +137 -0
- package/components/common/RichText/plugins/editable/config.js +15 -0
- package/components/common/RichText/plugins/editable/miniprogram/build.js +813 -0
- package/components/common/RichText/plugins/editable/miniprogram/index.js +551 -0
- package/components/common/RichText/plugins/editable/uni-app/build.js +744 -0
- package/components/common/RichText/plugins/editable/uni-app/index.js +553 -0
- package/components/common/RichText/plugins/emoji/README.md +15 -0
- package/components/common/RichText/plugins/emoji/index.js +203 -0
- package/components/common/RichText/plugins/highlight/README.md +26 -0
- package/components/common/RichText/plugins/highlight/config.js +5 -0
- package/components/common/RichText/plugins/highlight/index.js +96 -0
- package/components/common/RichText/plugins/highlight/miniprogram/build.js +88 -0
- package/components/common/RichText/plugins/highlight/prism.css +125 -0
- package/components/common/RichText/plugins/highlight/prism.min.js +7 -0
- package/components/common/RichText/plugins/highlight/uni-app/build.js +88 -0
- package/components/common/RichText/plugins/img-cache/README.md +24 -0
- package/components/common/RichText/plugins/img-cache/build.js +16 -0
- package/components/common/RichText/plugins/img-cache/index.js +138 -0
- package/components/common/RichText/plugins/latex/README.md +16 -0
- package/components/common/RichText/plugins/latex/build.js +14 -0
- package/components/common/RichText/plugins/latex/index.js +77 -0
- package/components/common/RichText/plugins/latex/katex.css +1070 -0
- package/components/common/RichText/plugins/latex/katex.min.js +1 -0
- package/components/common/RichText/plugins/markdown/README.md +17 -0
- package/components/common/RichText/plugins/markdown/index.js +34 -0
- package/components/common/RichText/plugins/markdown/marked.min.js +6 -0
- package/components/common/RichText/plugins/markdown/miniprogram/build.js +70 -0
- package/components/common/RichText/plugins/markdown/uni-app/build.js +68 -0
- package/components/common/RichText/plugins/search/README.md +46 -0
- package/components/common/RichText/plugins/search/miniprogram/index.js +137 -0
- package/components/common/RichText/plugins/search/uni-app/index.js +132 -0
- package/components/common/RichText/plugins/style/README.md +30 -0
- package/components/common/RichText/plugins/style/index.js +129 -0
- package/components/common/RichText/plugins/style/parser.js +175 -0
- package/components/common/RichText/plugins/template/README.md +2 -0
- package/components/common/RichText/plugins/template/build.js +65 -0
- package/components/common/RichText/plugins/template/index.js +67 -0
- package/components/common/RichText/plugins/txv-video/README.md +18 -0
- package/components/common/RichText/plugins/txv-video/build.js +3 -0
- package/components/common/RichText/plugins/txv-video/index.js +46 -0
- package/components/common/RichText/plugins/txv-video/miniprogram/build.js +6 -0
- package/components/common/RichText/plugins/txv-video/uni-app/build.js +3 -0
- package/components/common/RichText/src/miniprogram/index.js +396 -0
- package/components/common/RichText/src/miniprogram/index.json +6 -0
- package/components/common/RichText/src/miniprogram/index.wxml +7 -0
- package/components/common/RichText/src/miniprogram/index.wxss +13 -0
- package/components/common/RichText/src/miniprogram/node/node.js +247 -0
- package/components/common/RichText/src/miniprogram/node/node.json +6 -0
- package/components/common/RichText/src/miniprogram/node/node.wxml +112 -0
- package/components/common/RichText/src/miniprogram/node/node.wxss +164 -0
- package/components/common/RichText/src/miniprogram/parser.js +1269 -0
- package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +498 -0
- package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +585 -0
- package/components/common/RichText/src/uni-app/components/mp-html/parser.js +1393 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +254 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +33 -0
- package/components/common/RichText/tools/config.js +82 -0
- package/components/common/RichText/tools/converter.js +205 -0
- package/components/common/RichText/tools/ifdef.js +115 -0
- package/components/common/RichText/tools/minifier.js +40 -0
- package/components/common/RichText/tools/plugin.js +248 -0
- package/components/common/Toast/index-web.ts +122 -0
- package/components/common/Toast/index-web.vue +178 -0
- package/components/common/Toast/type.ts +8 -0
- package/components/common/common.scss +59 -0
- package/components/customer-icon.vue +56 -0
- package/components/message-branch.vue +120 -0
- package/components/message-customer-service.vue +114 -0
- package/components/message-form/form-branch.vue +68 -0
- package/components/message-form/form-input.vue +242 -0
- package/components/message-form/index.vue +80 -0
- package/components/message-multi-branch/branch-pc.vue +79 -0
- package/components/message-multi-branch/index.vue +60 -0
- package/components/message-multi-form/component-mobile/form-popup.vue +37 -0
- package/components/message-multi-form/component-mobile/input-mobile.vue +102 -0
- package/components/message-multi-form/component-mobile/label-mobile.vue +32 -0
- package/components/message-multi-form/component-mobile/radios-mobile.vue +161 -0
- package/components/message-multi-form/component-pc/input-pc.vue +93 -0
- package/components/message-multi-form/component-pc/label-pc.vue +33 -0
- package/components/message-multi-form/component-pc/radio-pc.vue +98 -0
- package/components/message-multi-form/form-mobile.vue +385 -0
- package/components/message-multi-form/form-pc.vue +184 -0
- package/components/message-multi-form/index.vue +61 -0
- package/components/message-product-card.vue +129 -0
- package/components/message-rating/index.vue +56 -0
- package/components/message-rating/message-rating-number.vue +247 -0
- package/components/message-rating/message-rating-star.vue +237 -0
- package/components/message-rich-text.vue +155 -0
- package/components/message-robot-welcome.vue +181 -0
- package/components/message-stream.vue +109 -0
- package/constant.ts +122 -0
- package/excluded-list.txt +6 -0
- package/index.ts +30 -0
- package/index.vue +60 -0
- package/interface.ts +176 -0
- package/logger/index.ts +12 -0
- package/logger/main.ts +120 -0
- package/package.json +62 -0
- package/script/fileCopy.js +60 -0
- package/script/syncVersion.js +35 -0
- package/server.ts +128 -0
- package/styles/common.scss +116 -0
- package/tsconfig.json +34 -0
- package/typings.d.ts +20 -0
- package/utils/chatStorage.ts +70 -0
- package/utils/copy-web.ts +141 -0
- package/utils/enableSampleTaskStatus.ts +8 -0
- package/utils/env.ts +15 -0
- package/utils/index.ts +59 -0
- package/utils/utils.ts +162 -0
package/interface.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export interface customerServicePayloadType {
|
|
2
|
+
chatbotPlugin?: number | string;
|
|
3
|
+
customerServicePlugin?: number | string;
|
|
4
|
+
src: string | number;
|
|
5
|
+
content: any;
|
|
6
|
+
subtype?: string;
|
|
7
|
+
isFinished?: number;
|
|
8
|
+
chunks?: string[];
|
|
9
|
+
status?:number;
|
|
10
|
+
nodeStatus?:number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface IMenuItem {
|
|
14
|
+
content: string;
|
|
15
|
+
id: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ratingTemplateType {
|
|
19
|
+
allowClientSendRating: boolean;
|
|
20
|
+
effectiveHour: number;
|
|
21
|
+
head: string;
|
|
22
|
+
tail: string;
|
|
23
|
+
type: number;
|
|
24
|
+
menu: IMenuItem[];
|
|
25
|
+
expireTime: number;
|
|
26
|
+
selected?: IMenuItem;
|
|
27
|
+
sessionId?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface TextMessagePayload {
|
|
31
|
+
text: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface CustomMessagePayload {
|
|
35
|
+
data: string;
|
|
36
|
+
description: string;
|
|
37
|
+
extension: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface IMessageModel {
|
|
41
|
+
ID: string;
|
|
42
|
+
type: string;
|
|
43
|
+
payload: any;
|
|
44
|
+
conversationID: string;
|
|
45
|
+
conversationType: string;
|
|
46
|
+
to: string;
|
|
47
|
+
from: string;
|
|
48
|
+
flow: string;
|
|
49
|
+
time: number;
|
|
50
|
+
status: string;
|
|
51
|
+
isRevoked: boolean;
|
|
52
|
+
priority: string;
|
|
53
|
+
nick: string;
|
|
54
|
+
avatar: string;
|
|
55
|
+
isPeerRead: boolean;
|
|
56
|
+
nameCard: string;
|
|
57
|
+
atUserList: string[];
|
|
58
|
+
cloudCustomData: string;
|
|
59
|
+
isDeleted: boolean;
|
|
60
|
+
isModified: boolean;
|
|
61
|
+
needReadReceipt: boolean;
|
|
62
|
+
readReceiptInfo: any;
|
|
63
|
+
isBroadcastMessage: boolean;
|
|
64
|
+
isSupportExtension: boolean;
|
|
65
|
+
receiverList?: string[];
|
|
66
|
+
revoker: string;
|
|
67
|
+
sequence: number;
|
|
68
|
+
progress: number;
|
|
69
|
+
revokerInfo: {
|
|
70
|
+
userID: string;
|
|
71
|
+
nick: string;
|
|
72
|
+
avatar: string;
|
|
73
|
+
};
|
|
74
|
+
revokeReason: string;
|
|
75
|
+
hasRiskContent: boolean;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type ToolbarDisplayType = 'emojiPicker' | 'tools' | 'none';
|
|
80
|
+
|
|
81
|
+
export interface IEmojiGroup {
|
|
82
|
+
type: string;
|
|
83
|
+
emojiGroupID: number;
|
|
84
|
+
url: string;
|
|
85
|
+
list: string[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type IEmojiGroupList = IEmojiGroup[];
|
|
89
|
+
|
|
90
|
+
export interface IImageMessageContent {
|
|
91
|
+
showName?: string;
|
|
92
|
+
url?: string;
|
|
93
|
+
width?: number;
|
|
94
|
+
height?: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface IMergeMessageContent {
|
|
98
|
+
abstractList: string[];
|
|
99
|
+
compatibleText: string;
|
|
100
|
+
downloadKey: string;
|
|
101
|
+
layersOverLimit: boolean;
|
|
102
|
+
messageList: Array<{
|
|
103
|
+
avatar: string;
|
|
104
|
+
ID: string;
|
|
105
|
+
cloudCustomData: string;
|
|
106
|
+
from: string;
|
|
107
|
+
messageBody: Array<{
|
|
108
|
+
type: string;
|
|
109
|
+
payload: Record<string, any>;
|
|
110
|
+
}>;
|
|
111
|
+
messageReceiver: string;
|
|
112
|
+
messageRandom: number;
|
|
113
|
+
messageSender: string;
|
|
114
|
+
messageSequence: number;
|
|
115
|
+
messageTime: number;
|
|
116
|
+
nick: string;
|
|
117
|
+
receiverUserID: string;
|
|
118
|
+
time: number;
|
|
119
|
+
}>;
|
|
120
|
+
pbDownloadKey: string;
|
|
121
|
+
showName: string;
|
|
122
|
+
title: string;
|
|
123
|
+
version: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface IFileMessageContent {
|
|
127
|
+
name: string;
|
|
128
|
+
url: string;
|
|
129
|
+
size: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface IVideoMessageContent {
|
|
133
|
+
showName: string; // video message sender name
|
|
134
|
+
url: string; // video url
|
|
135
|
+
snapshotUrl: string; // video snapshot url
|
|
136
|
+
snapshotWidth: number; // video snapshot width
|
|
137
|
+
snapshotHeight: number; // video snapshot height
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface IAudioMessageContent {
|
|
141
|
+
showName: string;
|
|
142
|
+
url: string;
|
|
143
|
+
second: number;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface IAudioContext {
|
|
147
|
+
src: string | undefined;
|
|
148
|
+
startTime: number;
|
|
149
|
+
duration: number;
|
|
150
|
+
play: () => void;
|
|
151
|
+
pause: () => void;
|
|
152
|
+
stop: () => void;
|
|
153
|
+
destroy: () => void;
|
|
154
|
+
onPlay: (callback: (...args: any[]) => void) => void;
|
|
155
|
+
onPause: (callback: (...args: any[]) => void) => void;
|
|
156
|
+
onStop: (callback: (...args: any[]) => void) => void;
|
|
157
|
+
onEnded: (callback: (...args: any[]) => void) => void;
|
|
158
|
+
onError: (callback: (...args: any[]) => void) => void;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface ITipTapEditorContent {
|
|
162
|
+
type: 'text' | 'image' | 'video' | 'file';
|
|
163
|
+
payload: {
|
|
164
|
+
text?: string;
|
|
165
|
+
file?: File;
|
|
166
|
+
atUserList?: string[];
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type InputDisplayType = 'editor' | 'audio';
|
|
171
|
+
|
|
172
|
+
export interface ISendMessagePayload {
|
|
173
|
+
text?: string;
|
|
174
|
+
file?: any;
|
|
175
|
+
atUserList?: string[];
|
|
176
|
+
}
|
package/logger/index.ts
ADDED
package/logger/main.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as logsAPI from '@opentelemetry/api-logs';
|
|
2
|
+
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
|
|
3
|
+
import { LoggerProvider, BatchLogRecordProcessor } from '@opentelemetry/sdk-logs';
|
|
4
|
+
import { Resource } from '@opentelemetry/resources';
|
|
5
|
+
type LogBody =
|
|
6
|
+
| string
|
|
7
|
+
| {
|
|
8
|
+
msg: string;
|
|
9
|
+
attributes?: logsAPI.LogAttributes;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const getLogBody = (args: LogBody, defaultAttributes: logsAPI.LogAttributes) => ({
|
|
13
|
+
body: typeof args === 'string' ? args : args.msg,
|
|
14
|
+
attributes:
|
|
15
|
+
typeof args === 'string'
|
|
16
|
+
? defaultAttributes
|
|
17
|
+
: {
|
|
18
|
+
...defaultAttributes,
|
|
19
|
+
...args.attributes,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default class Logger {
|
|
24
|
+
logger: logsAPI.Logger;
|
|
25
|
+
attributes: logsAPI.LogAttributes;
|
|
26
|
+
logLevel: logsAPI.SeverityNumber;
|
|
27
|
+
name: string;
|
|
28
|
+
constructor({
|
|
29
|
+
name,
|
|
30
|
+
id,
|
|
31
|
+
url,
|
|
32
|
+
version = 'latest',
|
|
33
|
+
attributes,
|
|
34
|
+
logLevel = logsAPI.SeverityNumber.ERROR2,
|
|
35
|
+
}: {
|
|
36
|
+
name: string;
|
|
37
|
+
id: string;
|
|
38
|
+
url: URL | string;
|
|
39
|
+
version?: string;
|
|
40
|
+
attributes: logsAPI.LogAttributes;
|
|
41
|
+
logLevel?: logsAPI.SeverityNumber;
|
|
42
|
+
}) {
|
|
43
|
+
this.name = name;
|
|
44
|
+
this.logLevel = logLevel;
|
|
45
|
+
const loggerProvider = new LoggerProvider({
|
|
46
|
+
resource: new Resource({
|
|
47
|
+
'service.name': name,
|
|
48
|
+
'tps.tenant.id': id,
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
loggerProvider.addLogRecordProcessor(
|
|
52
|
+
new BatchLogRecordProcessor(
|
|
53
|
+
new OTLPLogExporter({
|
|
54
|
+
url: url.toString(),
|
|
55
|
+
headers: {
|
|
56
|
+
'X-Tps-TenantID': id,
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
const logger = loggerProvider.getLogger(name, version);
|
|
62
|
+
this.attributes = attributes;
|
|
63
|
+
this.logger = logger;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
debug = (args: LogBody) => {
|
|
67
|
+
if (this.logLevel <= logsAPI.SeverityNumber.DEBUG) {
|
|
68
|
+
console.debug(`[${this.name}]`, args);
|
|
69
|
+
}
|
|
70
|
+
this.logger.emit({
|
|
71
|
+
severityNumber: logsAPI.SeverityNumber.DEBUG,
|
|
72
|
+
severityText: 'debug',
|
|
73
|
+
...getLogBody(args, this.attributes),
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
info(args: LogBody) {
|
|
78
|
+
if (this.logLevel <= logsAPI.SeverityNumber.INFO) {
|
|
79
|
+
console.info(`[${this.name}]`, args);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return this.logger.emit({
|
|
83
|
+
severityNumber: logsAPI.SeverityNumber.INFO,
|
|
84
|
+
severityText: 'info',
|
|
85
|
+
...getLogBody(args, this.attributes),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
warn = (args: LogBody) => {
|
|
90
|
+
if (this.logLevel <= logsAPI.SeverityNumber.WARN) {
|
|
91
|
+
console.warn(`[${this.name}]`, args);
|
|
92
|
+
}
|
|
93
|
+
this.logger.emit({
|
|
94
|
+
severityNumber: logsAPI.SeverityNumber.WARN,
|
|
95
|
+
severityText: 'warn',
|
|
96
|
+
...getLogBody(args, this.attributes),
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
error = (args: LogBody) => {
|
|
101
|
+
if (this.logLevel <= logsAPI.SeverityNumber.ERROR) {
|
|
102
|
+
console.error(`[${this.name}]`, args);
|
|
103
|
+
}
|
|
104
|
+
this.logger.emit({
|
|
105
|
+
severityNumber: logsAPI.SeverityNumber.ERROR,
|
|
106
|
+
severityText: 'error',
|
|
107
|
+
...getLogBody(args, this.attributes),
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
setAttribute = (key: string, value: string | number) => {
|
|
112
|
+
Object.assign(this.attributes, {
|
|
113
|
+
[key]: value,
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
setAttributes = (attributes: logsAPI.LogAttributes) => {
|
|
118
|
+
Object.assign(this.attributes, attributes);
|
|
119
|
+
};
|
|
120
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tencentcloud/ai-desk-customer-vue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "chat uikit ai-desk-customer",
|
|
5
|
+
"main": "index",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"uikit",
|
|
8
|
+
"uni-app",
|
|
9
|
+
"tencent",
|
|
10
|
+
"tencentcloud",
|
|
11
|
+
"messaging",
|
|
12
|
+
"即时通信",
|
|
13
|
+
"通信",
|
|
14
|
+
"WebSocket",
|
|
15
|
+
"ai-desk-customer",
|
|
16
|
+
"customer-service"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"sync": "node ./script/fileCopy.js",
|
|
20
|
+
"version": "node ./script/syncVersion.js",
|
|
21
|
+
"publish:vue": "cd ../tui-customer-service-plugin-vue && ls && npm publish --access public",
|
|
22
|
+
"publish:uniapp": "cd ../tui-customer-service-plugin-uniapp && ls && npm publish --access public"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@tencentcloud/chat-uikit-engine": "latest",
|
|
26
|
+
"@tencentcloud/tui-core": "latest",
|
|
27
|
+
"@tencentcloud/tui-emoji-plugin": "latest",
|
|
28
|
+
"@tencentcloud/universal-api": "latest",
|
|
29
|
+
"@tiptap/core": "2.0.0-beta.220",
|
|
30
|
+
"@tiptap/extension-document": "2.0.0-beta.220",
|
|
31
|
+
"@tiptap/extension-image": "2.0.0-beta.220",
|
|
32
|
+
"@tiptap/extension-mention": "2.0.0-beta.220",
|
|
33
|
+
"@tiptap/extension-paragraph": "2.0.0-beta.220",
|
|
34
|
+
"@tiptap/extension-placeholder": "2.0.0-beta.220",
|
|
35
|
+
"@tiptap/extension-text": "2.0.0-beta.220",
|
|
36
|
+
"@tiptap/pm": "2.0.0-beta.220",
|
|
37
|
+
"@tiptap/suggestion": "2.0.0-beta.220",
|
|
38
|
+
"@types/lodash": "^4.14.202",
|
|
39
|
+
"@vue/composition-api": "^1.0.0-rc.1",
|
|
40
|
+
"dayjs": "^1.11.10",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
42
|
+
"marked": "4.0.10",
|
|
43
|
+
"mp-html": "^2.5.0",
|
|
44
|
+
"vue-clipboard3": "2.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@tencentcloud/tui-core": "latest",
|
|
48
|
+
"@vue/composition-api": "^1.0.0-rc.1",
|
|
49
|
+
"vue": "^2.0.0 || >=3.0.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@vue/composition-api": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public",
|
|
58
|
+
"registry": "https://registry.npmjs.org/"
|
|
59
|
+
},
|
|
60
|
+
"author": "",
|
|
61
|
+
"license": "ISC"
|
|
62
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const sourceFolder = '../tui-customer-service-plugin';
|
|
5
|
+
const destinationFolderWeb = '../tui-customer-service-plugin-vue';
|
|
6
|
+
const destinationFolderUniapp = '../tui-customer-service-plugin-uniapp';
|
|
7
|
+
|
|
8
|
+
// 复制文件夹及其内容
|
|
9
|
+
function copyFolderRecursive(source, destination) {
|
|
10
|
+
console.log(`copy folder ${source} ${destination}`);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(destination)) {
|
|
13
|
+
fs.mkdirSync(destination);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const files = fs.readdirSync(source);
|
|
17
|
+
|
|
18
|
+
files.forEach((file) => {
|
|
19
|
+
const sourcePath = path.join(source, file);
|
|
20
|
+
const destinationPath = path.join(destination, file);
|
|
21
|
+
|
|
22
|
+
if (fs.lstatSync(sourcePath).isDirectory()) {
|
|
23
|
+
if (file !== 'node_modules' && file !== '.git') {
|
|
24
|
+
copyFolderRecursive(sourcePath, destinationPath);
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
fs.copyFileSync(sourcePath, destinationPath);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 过滤文件夹中的文件
|
|
33
|
+
function filterFiles(folder, filterCondition) {
|
|
34
|
+
const files = fs.readdirSync(folder);
|
|
35
|
+
|
|
36
|
+
files.forEach((file) => {
|
|
37
|
+
const filePath = path.join(folder, file);
|
|
38
|
+
|
|
39
|
+
if (fs.lstatSync(filePath).isDirectory()) {
|
|
40
|
+
if (!file.startsWith('adapter')) {
|
|
41
|
+
filterFiles(filePath, filterCondition);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if (filterCondition(file)) {
|
|
45
|
+
console.log(`filter file ${filePath}`);
|
|
46
|
+
fs.unlinkSync(filePath);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 复制文件夹 a 到 b 和 c
|
|
53
|
+
copyFolderRecursive(sourceFolder, destinationFolderWeb);
|
|
54
|
+
copyFolderRecursive(sourceFolder, destinationFolderUniapp);
|
|
55
|
+
|
|
56
|
+
// 在 b 文件夹中去除文件名为 -web 结尾的文件
|
|
57
|
+
filterFiles(destinationFolderWeb, (file) => file.substring(0,file.lastIndexOf('.')).endsWith('-uniapp')&& !file.startsWith('adapter'));
|
|
58
|
+
|
|
59
|
+
// 在 c 文件夹中去除文件名为 -uniapp 的文件(除了 adapter 开头的文件)
|
|
60
|
+
filterFiles(destinationFolderUniapp, (file) => file.substring(0,file.lastIndexOf('.')).endsWith('-web') && !file.startsWith('adapter'));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const newVersion = process.argv[2];
|
|
4
|
+
|
|
5
|
+
if (!newVersion) {
|
|
6
|
+
console.log('请传入新版本号,版本号遵循semver规范 .eg: 1.0.0, 1.0.1, 1.1.0');
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const srcPaths = [
|
|
11
|
+
'./package.json',
|
|
12
|
+
'../tui-customer-service-plugin-vue/package.json',
|
|
13
|
+
'../tui-customer-service-plugin-uniapp/package.json'
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
function start() {
|
|
17
|
+
srcPaths.forEach((src) => {
|
|
18
|
+
const packageJsonContent = fs.readFileSync(src, 'utf8');
|
|
19
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
20
|
+
const currentVersion = packageJson.version;
|
|
21
|
+
let currentName = packageJson.name;
|
|
22
|
+
if(src == '../tui-customer-service-plugin-vue/package.json'){
|
|
23
|
+
currentName = '@tencentcloud/ai-desk-customer-vue';
|
|
24
|
+
} else if(src == '../tui-customer-service-plugin-uniapp/package.json'){
|
|
25
|
+
currentName = '@tencentcloud/ai-desk-customer-uniapp';
|
|
26
|
+
}
|
|
27
|
+
// 更新版本号
|
|
28
|
+
packageJson.version = newVersion;
|
|
29
|
+
packageJson.name = currentName;
|
|
30
|
+
fs.writeFileSync(src, JSON.stringify(packageJson, null, 2) + os.EOL);
|
|
31
|
+
console.log(`${src} 版本号已从 ${currentVersion} 更新为 ${newVersion}`);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
start();
|
package/server.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import TUICore, { TUIConstants, TUILogin } from '@tencentcloud/tui-core';
|
|
2
|
+
import {
|
|
3
|
+
isCustomerServiceMessage,
|
|
4
|
+
isMessageInvisible,
|
|
5
|
+
} from './utils/index';
|
|
6
|
+
import { IMessageModel } from './interface';
|
|
7
|
+
import TUIChatEngine, { TUIChatService, TUIConversationService } from '@tencentcloud/chat-uikit-engine';
|
|
8
|
+
|
|
9
|
+
export default class TUICustomerServer {
|
|
10
|
+
static isInitialized: boolean;
|
|
11
|
+
static instance: TUICustomerServer;
|
|
12
|
+
private customerServiceAccounts: any[];
|
|
13
|
+
constructor() {
|
|
14
|
+
console.log('TUICustomerServer.init ok');
|
|
15
|
+
TUICore.registerService(TUIConstants.TUICustomerServicePlugin.SERVICE.NAME, this);
|
|
16
|
+
TUICore.registerExtension(TUIConstants.TUIContact.EXTENSION.CONTACT_LIST.EXT_ID, this);
|
|
17
|
+
// TUICore.registerEvent(TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS, this);
|
|
18
|
+
this.customerServiceAccounts = ['@customer_service_account'];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getInstance(): TUICustomerServer {
|
|
22
|
+
if (!TUICustomerServer.instance) {
|
|
23
|
+
TUICustomerServer.instance = new TUICustomerServer();
|
|
24
|
+
}
|
|
25
|
+
return TUICustomerServer.instance;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public onNotifyEvent(eventName: string, subKey: string, params?: Record<string, any>) {
|
|
29
|
+
if (eventName === TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED) {
|
|
30
|
+
switch (subKey) {
|
|
31
|
+
case TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS:
|
|
32
|
+
const { chat, SDKAppID, userID, userSig } = TUILogin.getContext();
|
|
33
|
+
|
|
34
|
+
TUIChatEngine.login({
|
|
35
|
+
chat,
|
|
36
|
+
SDKAppID,
|
|
37
|
+
userID,
|
|
38
|
+
userSig,
|
|
39
|
+
});
|
|
40
|
+
TUIConversationService.switchConversation('C2C@customer_service_account');
|
|
41
|
+
TUICore.unregisterEvent(TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS, this);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static loginCustomerUIKit = (sdkappid:number, userid:string, usersig:string) => {
|
|
48
|
+
TUILogin.login({
|
|
49
|
+
SDKAppID: sdkappid,
|
|
50
|
+
userID:userid,
|
|
51
|
+
userSig:usersig,
|
|
52
|
+
useUploadPlugin: true,
|
|
53
|
+
}).then(() => {
|
|
54
|
+
console.log("login success");
|
|
55
|
+
TUIConversationService.switchConversation('C2C@customer_service_account');
|
|
56
|
+
})
|
|
57
|
+
.catch((error) => {
|
|
58
|
+
console.log(error);
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* init
|
|
64
|
+
*/
|
|
65
|
+
public static init(sdkappid:number, userid:string, usersig:string) {
|
|
66
|
+
// Backward compatibility, the new version executes the init operation by default in index.ts
|
|
67
|
+
if (TUICustomerServer.isInitialized) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
TUICustomerServer.isInitialized = true;
|
|
71
|
+
// Execute call server when native plugin TUICallKit exists
|
|
72
|
+
this.loginCustomerUIKit(sdkappid, userid, usersig);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Set customer service number
|
|
76
|
+
public setCustomerServiceAccounts(accounts: any[]) {
|
|
77
|
+
this.customerServiceAccounts = accounts;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Obtain customer service number
|
|
81
|
+
public getCustomerServiceAccounts() {
|
|
82
|
+
return this.customerServiceAccounts;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Determine if the current session is a customer service session
|
|
86
|
+
public isCustomerConversation(conversationID: string) {
|
|
87
|
+
const userID = (conversationID && conversationID.slice(3)) || '';
|
|
88
|
+
return this.customerServiceAccounts.indexOf(userID) > -1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Determine if the current message is a customer service message
|
|
92
|
+
public isCustomerServicePluginMessage(message: IMessageModel) {
|
|
93
|
+
if (!message || !this.isCustomerConversation(message.conversationID)) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return isCustomerServiceMessage(message) || isMessageInvisible(message);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public onGetExtension(extensionID: string) {
|
|
100
|
+
if (extensionID === TUIConstants.TUIContact.EXTENSION.CONTACT_LIST.EXT_ID) {
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
weight: 0,
|
|
104
|
+
icon: '',
|
|
105
|
+
text: '客服号',
|
|
106
|
+
data: {
|
|
107
|
+
name: 'customer',
|
|
108
|
+
accountList: this.customerServiceAccounts,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public onCall(method: string, params: any) {
|
|
116
|
+
if (method === TUIConstants.TUICustomerServicePlugin.SERVICE.METHOD.ACTIVE_CONVERSATION) {
|
|
117
|
+
if (this.isCustomerConversation(params.conversationID)) {
|
|
118
|
+
TUIChatService.sendCustomMessage({
|
|
119
|
+
to: params.conversationID.slice(3),
|
|
120
|
+
conversationType: 'C2C',
|
|
121
|
+
payload: {
|
|
122
|
+
data: JSON.stringify({src: '7', customerServicePlugin: 0}),
|
|
123
|
+
},
|
|
124
|
+
}, { onlineUserOnly: true});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
@import "../components/common/common.scss";
|
|
2
|
+
// button
|
|
3
|
+
@mixin btn {
|
|
4
|
+
border-radius: 5px;
|
|
5
|
+
padding: 13px 0;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
}
|
|
8
|
+
@mixin btn-default {
|
|
9
|
+
@include btn;
|
|
10
|
+
background: #006eff;
|
|
11
|
+
border: 1px solid #006eff;
|
|
12
|
+
color: #fff;
|
|
13
|
+
}
|
|
14
|
+
@mixin btn-error {
|
|
15
|
+
@include btn;
|
|
16
|
+
border: 1px solid #e54545;
|
|
17
|
+
color: #e54545;
|
|
18
|
+
background: #fff;
|
|
19
|
+
}
|
|
20
|
+
@mixin btn-normal {
|
|
21
|
+
@include btn;
|
|
22
|
+
background: #fff;
|
|
23
|
+
border: 1px solid #ddd;
|
|
24
|
+
color: #000;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// flex
|
|
28
|
+
// flex布局 默认 纵向垂直居中水平居中
|
|
29
|
+
@mixin flex($direction: column, $js: center, $al: center) {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
display: -webkit-box;
|
|
32
|
+
display: -moz-box;
|
|
33
|
+
display: -webkit-flex;
|
|
34
|
+
display: -moz-flex;
|
|
35
|
+
display: -ms-flexbox;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: $direction;
|
|
38
|
+
justify-content: $js;
|
|
39
|
+
align-items: $al;
|
|
40
|
+
border: 0px solid black;
|
|
41
|
+
margin: 0;
|
|
42
|
+
padding: 0;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 文本超出隐藏 ...隐藏文本
|
|
47
|
+
@mixin single-line-ellipsis($width: 100%) {
|
|
48
|
+
width: $width;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
-ms-text-overflow: ellipsis;
|
|
51
|
+
text-overflow: ellipsis;
|
|
52
|
+
white-space: nowrap;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 文本最多(n)行,超出部分用...表示
|
|
56
|
+
@mixin line($num) {
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
display: -webkit-box;
|
|
60
|
+
-webkit-line-clamp: $num;
|
|
61
|
+
-webkit-box-orient: vertical;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// position居中
|
|
65
|
+
@mixin positionCenter {
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 50%;
|
|
68
|
+
left: 50%;
|
|
69
|
+
-webkit-transform: translate(-50%, -50%);
|
|
70
|
+
-moz-transform: translate(-50%, -50%);
|
|
71
|
+
-ms-transform: translate(-50%, -50%);
|
|
72
|
+
-o-transform: translate(-50%, -50%);
|
|
73
|
+
transform: translate(-50%, -50%);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.container {
|
|
77
|
+
@include flex;
|
|
78
|
+
position: fixed;
|
|
79
|
+
width: 100vw;
|
|
80
|
+
height: 100vh;
|
|
81
|
+
top: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
z-index: 3;
|
|
84
|
+
background: rgba(0, 0, 0, 0.3);
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
.box {
|
|
87
|
+
@include flex;
|
|
88
|
+
border-radius: 0.5rem;
|
|
89
|
+
background: #fff;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
color: #000;
|
|
92
|
+
}
|
|
93
|
+
.box-h5 {
|
|
94
|
+
width: 100%;
|
|
95
|
+
height: 100%;
|
|
96
|
+
padding: 0px;
|
|
97
|
+
border-radius: 0px;
|
|
98
|
+
justify-content: flex-start;
|
|
99
|
+
.title {
|
|
100
|
+
@include flex;
|
|
101
|
+
box-sizing: border-box;
|
|
102
|
+
width: 100%;
|
|
103
|
+
padding: 15px 18px;
|
|
104
|
+
position: relative;
|
|
105
|
+
.title-back {
|
|
106
|
+
position: absolute;
|
|
107
|
+
left: 18px;
|
|
108
|
+
}
|
|
109
|
+
.title-name {
|
|
110
|
+
font-size: 18px;
|
|
111
|
+
font-weight: 500;
|
|
112
|
+
font-family: PingFangSC-Medium;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|