@tencentcloud/ai-desk-customer-vue 0.1.2 → 0.1.4
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/components/CustomerServiceChat/index-web.vue +7 -14
- package/components/CustomerServiceChat/message-input/index-web.vue +17 -16
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +3 -6
- package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +3 -14
- package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +2 -5
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +8 -15
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +3 -7
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +6 -44
- package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +1 -14
- package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +0 -56
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +4 -7
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +0 -1
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +7 -50
- package/components/CustomerServiceChat/message-list/index-web.vue +3 -7
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components → message-desk}/index.ts +1 -1
- package/components/{customer-icon.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/customer-icon.vue} +0 -9
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components/message-customer → message-desk/message-desk-elements}/index.ts +1 -1
- package/components/{message-branch.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-branch.vue} +4 -4
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-desk.vue +126 -0
- package/components/{message-multi-branch → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch}/branch-pc.vue +1 -1
- package/components/{message-multi-branch → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch}/index.vue +2 -3
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/form-popup.vue +2 -3
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/input-mobile.vue +1 -1
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/radios-mobile.vue +7 -7
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-pc/input-pc.vue +1 -1
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-pc/radio-pc.vue +4 -5
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/form-mobile.vue +8 -7
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/form-pc.vue +5 -5
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/index.vue +3 -3
- package/components/{message-product-card.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-product-card.vue} +2 -2
- package/components/{message-rating → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating}/index.vue +4 -4
- package/components/{message-rating → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating}/message-rating-number.vue +3 -3
- package/components/{message-rating → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating}/message-rating-star.vue +5 -5
- package/components/{message-rich-text.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rich-text.vue} +5 -17
- package/components/{message-robot-welcome.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-robot-welcome.vue} +7 -7
- package/components/{message-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-single-form}/form-input.vue +5 -5
- package/components/{message-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-single-form}/index.vue +1 -1
- package/components/{message-stream.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-stream.vue} +2 -2
- package/{styles → components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/styles}/common.scss +1 -1
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components → message-desk}/message-plugin-layout-web.vue +2 -9
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components → message-desk}/message-plugin-web.vue +5 -5
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +2 -4
- package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +3 -6
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +3 -29
- package/components/CustomerServiceChat/style/h5.scss +2 -1
- package/components/CustomerServiceChat/style/index.scss +0 -2
- package/components/common/Avatar/index.vue +2 -23
- package/components/common/BottomPopup/index.vue +2 -3
- package/components/common/Dialog/index.vue +2 -2
- package/components/common/ImagePreviewer/index-web.vue +2 -84
- package/components/common/ProgressMessage/index.vue +0 -8
- package/index.ts +4 -13
- package/index.vue +1 -60
- package/package.json +4 -5
- package/server.ts +3 -32
- package/utils/chatStorage.ts +2 -11
- package/utils/index.ts +2 -1
- package/assets/audio-before-delete.svg +0 -4
- package/assets/audio-blue.png +0 -0
- package/assets/audio-bubble-blue.svg +0 -3
- package/assets/audio-bubble-red.svg +0 -3
- package/assets/audio-delete.svg +0 -10
- package/assets/audio.svg +0 -6
- package/assets/camera-uni.png +0 -0
- package/assets/face-uni.png +0 -0
- package/assets/more-uni.png +0 -0
- package/assets/translate.svg +0 -12
- package/assets/video-uni.png +0 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +0 -36
- package/components/CustomerServiceChat/message-list/link/index.ts +0 -23
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +0 -22
- package/components/CustomerServiceChat/style/uni.scss +0 -12
- package/components/CustomerServiceChat/style/wx.scss +0 -5
- package/components/common/RichText/LICENSE +0 -21
- package/components/common/RichText/README.md +0 -244
- package/components/common/RichText/dist/mp-alipay/index.acss +0 -1
- package/components/common/RichText/dist/mp-alipay/index.axml +0 -1
- package/components/common/RichText/dist/mp-alipay/index.js +0 -8
- package/components/common/RichText/dist/mp-alipay/index.json +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.acss +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.axml +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.js +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.json +0 -1
- package/components/common/RichText/dist/mp-alipay/parser.js +0 -1
- package/components/common/RichText/dist/mp-baidu/index.css +0 -1
- package/components/common/RichText/dist/mp-baidu/index.js +0 -8
- package/components/common/RichText/dist/mp-baidu/index.json +0 -1
- package/components/common/RichText/dist/mp-baidu/index.swan +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.css +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.js +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.json +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.swan +0 -1
- package/components/common/RichText/dist/mp-baidu/parser.js +0 -1
- package/components/common/RichText/dist/mp-qq/index.js +0 -8
- package/components/common/RichText/dist/mp-qq/index.json +0 -1
- package/components/common/RichText/dist/mp-qq/index.qml +0 -1
- package/components/common/RichText/dist/mp-qq/index.qss +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.js +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.json +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.qml +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.qss +0 -1
- package/components/common/RichText/dist/mp-qq/parser.js +0 -1
- package/components/common/RichText/dist/mp-toutiao/index.js +0 -8
- package/components/common/RichText/dist/mp-toutiao/index.json +0 -1
- package/components/common/RichText/dist/mp-toutiao/index.ttml +0 -1
- package/components/common/RichText/dist/mp-toutiao/index.ttss +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.js +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.json +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.ttml +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.ttss +0 -1
- package/components/common/RichText/dist/mp-toutiao/parser.js +0 -1
- package/components/common/RichText/dist/mp-weixin/index.js +0 -8
- package/components/common/RichText/dist/mp-weixin/index.json +0 -1
- package/components/common/RichText/dist/mp-weixin/index.wxml +0 -1
- package/components/common/RichText/dist/mp-weixin/index.wxss +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.js +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.json +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.wxml +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.wxss +0 -1
- package/components/common/RichText/dist/mp-weixin/parser.js +0 -1
- package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +0 -498
- package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +0 -587
- package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +0 -1393
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +0 -1
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +0 -1
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +0 -1
- package/components/common/RichText/docs/.nojekyll +0 -0
- package/components/common/RichText/docs/index.html +0 -50
- package/components/common/RichText/docs/lib/docsify.min.js +0 -1
- package/components/common/RichText/docs/lib/prism-bash.min.js +0 -1
- package/components/common/RichText/docs/lib/search.min.js +0 -1
- package/components/common/RichText/docs/lib/vue.css +0 -858
- package/components/common/RichText/gulpfile.js +0 -113
- package/components/common/RichText/lint.js +0 -63
- package/components/common/RichText/package.json +0 -74
- package/components/common/RichText/plugins/README.md +0 -2
- package/components/common/RichText/plugins/audio/README.md +0 -25
- package/components/common/RichText/plugins/audio/build.js +0 -11
- package/components/common/RichText/plugins/audio/context.js +0 -7
- package/components/common/RichText/plugins/audio/index.js +0 -34
- package/components/common/RichText/plugins/audio/miniprogram/audio.js +0 -189
- package/components/common/RichText/plugins/audio/miniprogram/audio.json +0 -3
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +0 -17
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +0 -127
- package/components/common/RichText/plugins/audio/miniprogram/build.js +0 -3
- package/components/common/RichText/plugins/audio/uni-app/audio.vue +0 -269
- package/components/common/RichText/plugins/audio/uni-app/build.js +0 -3
- package/components/common/RichText/plugins/card/README.md +0 -30
- package/components/common/RichText/plugins/card/build.js +0 -14
- package/components/common/RichText/plugins/card/index.js +0 -7
- package/components/common/RichText/plugins/card/miniprogram/build.js +0 -3
- package/components/common/RichText/plugins/card/miniprogram/card.js +0 -26
- package/components/common/RichText/plugins/card/miniprogram/card.json +0 -3
- package/components/common/RichText/plugins/card/miniprogram/card.wxml +0 -9
- package/components/common/RichText/plugins/card/miniprogram/card.wxss +0 -55
- package/components/common/RichText/plugins/card/uni-app/build.js +0 -3
- package/components/common/RichText/plugins/card/uni-app/card.vue +0 -122
- package/components/common/RichText/plugins/editable/README.md +0 -137
- package/components/common/RichText/plugins/editable/config.js +0 -15
- package/components/common/RichText/plugins/editable/miniprogram/build.js +0 -813
- package/components/common/RichText/plugins/editable/miniprogram/index.js +0 -551
- package/components/common/RichText/plugins/editable/uni-app/build.js +0 -744
- package/components/common/RichText/plugins/editable/uni-app/index.js +0 -553
- package/components/common/RichText/plugins/emoji/README.md +0 -15
- package/components/common/RichText/plugins/emoji/index.js +0 -203
- package/components/common/RichText/plugins/highlight/README.md +0 -26
- package/components/common/RichText/plugins/highlight/config.js +0 -5
- package/components/common/RichText/plugins/highlight/index.js +0 -96
- package/components/common/RichText/plugins/highlight/miniprogram/build.js +0 -88
- package/components/common/RichText/plugins/highlight/prism.css +0 -125
- package/components/common/RichText/plugins/highlight/prism.min.js +0 -7
- package/components/common/RichText/plugins/highlight/uni-app/build.js +0 -88
- package/components/common/RichText/plugins/img-cache/README.md +0 -24
- package/components/common/RichText/plugins/img-cache/build.js +0 -16
- package/components/common/RichText/plugins/img-cache/index.js +0 -138
- package/components/common/RichText/plugins/latex/README.md +0 -16
- package/components/common/RichText/plugins/latex/build.js +0 -14
- package/components/common/RichText/plugins/latex/index.js +0 -77
- package/components/common/RichText/plugins/latex/katex.css +0 -1070
- package/components/common/RichText/plugins/latex/katex.min.js +0 -1
- package/components/common/RichText/plugins/markdown/README.md +0 -17
- package/components/common/RichText/plugins/markdown/index.js +0 -34
- package/components/common/RichText/plugins/markdown/marked.min.js +0 -6
- package/components/common/RichText/plugins/markdown/miniprogram/build.js +0 -70
- package/components/common/RichText/plugins/markdown/uni-app/build.js +0 -68
- package/components/common/RichText/plugins/search/README.md +0 -46
- package/components/common/RichText/plugins/search/miniprogram/index.js +0 -137
- package/components/common/RichText/plugins/search/uni-app/index.js +0 -132
- package/components/common/RichText/plugins/style/README.md +0 -30
- package/components/common/RichText/plugins/style/index.js +0 -129
- package/components/common/RichText/plugins/style/parser.js +0 -175
- package/components/common/RichText/plugins/template/README.md +0 -2
- package/components/common/RichText/plugins/template/build.js +0 -65
- package/components/common/RichText/plugins/template/index.js +0 -67
- package/components/common/RichText/plugins/txv-video/README.md +0 -18
- package/components/common/RichText/plugins/txv-video/build.js +0 -3
- package/components/common/RichText/plugins/txv-video/index.js +0 -46
- package/components/common/RichText/plugins/txv-video/miniprogram/build.js +0 -6
- package/components/common/RichText/plugins/txv-video/uni-app/build.js +0 -3
- package/components/common/RichText/src/miniprogram/index.js +0 -396
- package/components/common/RichText/src/miniprogram/index.json +0 -6
- package/components/common/RichText/src/miniprogram/index.wxml +0 -7
- package/components/common/RichText/src/miniprogram/index.wxss +0 -13
- package/components/common/RichText/src/miniprogram/node/node.js +0 -247
- package/components/common/RichText/src/miniprogram/node/node.json +0 -6
- package/components/common/RichText/src/miniprogram/node/node.wxml +0 -112
- package/components/common/RichText/src/miniprogram/node/node.wxss +0 -164
- package/components/common/RichText/src/miniprogram/parser.js +0 -1269
- package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +0 -498
- package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +0 -585
- package/components/common/RichText/src/uni-app/components/mp-html/parser.js +0 -1393
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +0 -254
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +0 -1
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +0 -33
- package/components/common/RichText/tools/config.js +0 -82
- package/components/common/RichText/tools/converter.js +0 -205
- package/components/common/RichText/tools/ifdef.js +0 -115
- package/components/common/RichText/tools/minifier.js +0 -40
- package/components/common/RichText/tools/plugin.js +0 -248
- package/components/message-customer-service.vue +0 -114
- package/script/fileCopy.js +0 -60
- package/script/syncVersion.js +0 -35
- /package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/label-mobile.vue +0 -0
- /package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-pc/label-pc.vue +0 -0
- /package/components/{message-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-single-form}/form-branch.vue +0 -0
|
@@ -27,25 +27,18 @@
|
|
|
27
27
|
<!-- web message-bubble is a named slot, content area slotName is messageElement -->
|
|
28
28
|
<template #messageElement>
|
|
29
29
|
<slot
|
|
30
|
-
v-if="!isUniFrameWork"
|
|
31
30
|
name="messageBubble"
|
|
32
31
|
/>
|
|
33
32
|
</template>
|
|
34
|
-
<!-- uni-app message-bubble is an anonymous slot, no slotName -->
|
|
35
|
-
<slot
|
|
36
|
-
v-if="isUniFrameWork"
|
|
37
|
-
name="messageBubble"
|
|
38
|
-
/>
|
|
39
33
|
</MessageBubble>
|
|
40
34
|
</div>
|
|
41
35
|
</div>
|
|
42
36
|
</template>
|
|
43
37
|
|
|
44
38
|
<script lang="ts" setup>
|
|
45
|
-
import vue from '
|
|
39
|
+
import vue from '../../../../../adapter-vue';
|
|
46
40
|
import { TUIStore, IMessageModel } from '@tencentcloud/chat-uikit-engine';
|
|
47
|
-
import MessageBubble from '
|
|
48
|
-
import { isUniFrameWork } from '../../../../../../utils/env';
|
|
41
|
+
import MessageBubble from '../message-bubble-web.vue';
|
|
49
42
|
const { computed } = vue;
|
|
50
43
|
interface IProps {
|
|
51
44
|
message: IMessageModel;
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script lang="ts" setup>
|
|
22
|
-
import vue from '
|
|
22
|
+
import vue from '../../../../../adapter-vue';
|
|
23
23
|
import { TUIStore } from '@tencentcloud/chat-uikit-engine';
|
|
24
24
|
import { IMessageModel } from '@tencentcloud/chat-uikit-engine';
|
|
25
25
|
import {
|
|
26
26
|
isCustomerServicePluginMessage,
|
|
27
27
|
isCustomServiceMessageInvisible,
|
|
28
|
-
} from './message-
|
|
28
|
+
} from './message-desk-elements/index';
|
|
29
29
|
import MessagePluginLayout from './message-plugin-layout-web.vue';
|
|
30
|
-
import MessageCustomerService from './message-
|
|
30
|
+
import MessageCustomerService from './message-desk-elements/message-desk.vue';
|
|
31
31
|
const { computed } = vue;
|
|
32
32
|
|
|
33
33
|
interface IProps {
|
|
@@ -50,10 +50,10 @@ const messageModel = computed(() => TUIStore.getMessageModel(props.message.ID));
|
|
|
50
50
|
const pluginMessageType = computed<{ pluginType: string; showStyle: string }>(
|
|
51
51
|
() => {
|
|
52
52
|
let typeObj = { pluginType: '', showStyle: '' };
|
|
53
|
-
if (isCustomerServicePluginMessage(messageModel.value)) {
|
|
53
|
+
if (isCustomerServicePluginMessage(messageModel.value as any)) {
|
|
54
54
|
typeObj = {
|
|
55
55
|
pluginType: 'customer',
|
|
56
|
-
showStyle: isCustomServiceMessageInvisible(messageModel.value)
|
|
56
|
+
showStyle: isCustomServiceMessageInvisible(messageModel.value as any)
|
|
57
57
|
? ''
|
|
58
58
|
: 'bubble',
|
|
59
59
|
};
|
package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue
CHANGED
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
getBoundingClientRect,
|
|
52
52
|
getScrollInfo,
|
|
53
53
|
} from '@tencentcloud/universal-api';
|
|
54
|
-
import {
|
|
54
|
+
import { isH5,isPC } from '../../../../../utils/env';
|
|
55
55
|
import {
|
|
56
56
|
Toast,
|
|
57
57
|
TOAST_TYPE,
|
|
@@ -191,13 +191,11 @@ async function scrollToOriginalMessage() {
|
|
|
191
191
|
- scrollViewRect.top
|
|
192
192
|
- (selfAddValue++ % 2);
|
|
193
193
|
const isNeedScroll = originalMessageRect.top < scrollViewRect.top;
|
|
194
|
-
if (
|
|
194
|
+
if (window) {
|
|
195
195
|
const scrollView = document.getElementById('messageScrollList');
|
|
196
196
|
if (isNeedScroll && scrollView) {
|
|
197
197
|
scrollView.scrollTop = finalScrollTop;
|
|
198
198
|
}
|
|
199
|
-
} else if (isUniFrameWork && isNeedScroll) {
|
|
200
|
-
emits('scrollTo', finalScrollTop);
|
|
201
199
|
}
|
|
202
200
|
emits('blinkMessage', originMessageID);
|
|
203
201
|
} catch (error) {
|
package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
/>
|
|
34
34
|
</Overlay>
|
|
35
35
|
<Drawer
|
|
36
|
-
v-else-if="!props.disabled && isH5
|
|
36
|
+
v-else-if="!props.disabled && isH5"
|
|
37
37
|
:visible="isMessageListVisible"
|
|
38
38
|
:isFullScreen="true"
|
|
39
39
|
:overlayColor="'transparent'"
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
import Overlay from '../../../../common/Overlay/index.vue';
|
|
59
59
|
import Drawer from '../../../../common/Drawer/index.vue';
|
|
60
60
|
import SimpleMessageList from '../simple-message-list/index.vue';
|
|
61
|
-
import { isH5, isPC
|
|
61
|
+
import { isH5, isPC } from '../../../../../utils/env';
|
|
62
62
|
import { transformTextWithKeysToEmojiNames } from '../../../emoji-config/index';
|
|
63
63
|
import { IMergeMessageContent } from '../../../../../interface';
|
|
64
64
|
const { ref, withDefaults } = vue;
|
|
@@ -94,11 +94,8 @@ function openMergeDetail() {
|
|
|
94
94
|
if (props.disabled) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
if (!isUniFrameWork) {
|
|
98
97
|
isMessageListVisible.value = true;
|
|
99
|
-
|
|
100
|
-
emits('assignMessageIDInUniapp', props.messageItem.ID);
|
|
101
|
-
}
|
|
98
|
+
|
|
102
99
|
}
|
|
103
100
|
|
|
104
101
|
function closeMergeDetail() {
|
package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue
CHANGED
|
@@ -87,27 +87,8 @@
|
|
|
87
87
|
v-else-if="item.messageBody[0].type === TYPES.MSG_VIDEO"
|
|
88
88
|
class="message-video"
|
|
89
89
|
>
|
|
90
|
-
|
|
91
|
-
v-if="isUniFrameWork"
|
|
92
|
-
@click="
|
|
93
|
-
previewVideoInUniapp(
|
|
94
|
-
item.messageBody[0].payload['remoteVideoUrl']
|
|
95
|
-
)
|
|
96
|
-
"
|
|
97
|
-
>
|
|
98
|
-
<image
|
|
99
|
-
class="image"
|
|
100
|
-
:src="item.messageBody[0].payload['thumbUrl']"
|
|
101
|
-
mode="widthFix"
|
|
102
|
-
alt="image"
|
|
103
|
-
/>
|
|
104
|
-
<Icon
|
|
105
|
-
class="video-play-icon"
|
|
106
|
-
:file="playIcon"
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
90
|
+
|
|
109
91
|
<video
|
|
110
|
-
v-else
|
|
111
92
|
class="video"
|
|
112
93
|
controls
|
|
113
94
|
:poster="item.messageBody[0].payload['thumbUrl']"
|
|
@@ -186,7 +167,7 @@ import {
|
|
|
186
167
|
DEFAULT_BIG_EMOJI_URL,
|
|
187
168
|
CUSTOM_BIG_EMOJI_URL,
|
|
188
169
|
} from '../../../emoji-config/index';
|
|
189
|
-
import { isMobile
|
|
170
|
+
import { isMobile } from '../../../../../utils/env';
|
|
190
171
|
import { IMergeMessageContent } from '../../../../../interface';
|
|
191
172
|
const { computed, ref, watch } = vue;
|
|
192
173
|
|
|
@@ -294,14 +275,7 @@ function backPreviousLevel() {
|
|
|
294
275
|
}
|
|
295
276
|
}
|
|
296
277
|
|
|
297
|
-
|
|
298
|
-
if (isUniFrameWork) {
|
|
299
|
-
const encodedUrl = encodeURIComponent(url);
|
|
300
|
-
uni.navigateTo({
|
|
301
|
-
url: `/TUIKit/components/TUIChat/video-play?videoUrl=${encodedUrl}`,
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
}
|
|
278
|
+
|
|
305
279
|
|
|
306
280
|
function resolveBigFaceUrl(bigFaceKey: string): string {
|
|
307
281
|
let url = '';
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
.tui-chat-h5 {
|
|
8
8
|
background-image:url("../../../assets/background_mobile.png");
|
|
9
9
|
background-size: cover;
|
|
10
|
+
height: 100vh;
|
|
10
11
|
&-message-list {
|
|
11
12
|
flex: 1;
|
|
12
13
|
overflow: hidden;
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
&-message-input {
|
|
17
|
-
height:
|
|
18
|
+
height: auto;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
&-message-input-toolbar {
|
|
@@ -7,24 +7,7 @@
|
|
|
7
7
|
borderRadius: avatarBorderRadius,
|
|
8
8
|
}"
|
|
9
9
|
>
|
|
10
|
-
<template v-if="isUniFrameWork">
|
|
11
|
-
<image
|
|
12
|
-
v-if="!loadErrorInUniapp"
|
|
13
|
-
class="avatar-image"
|
|
14
|
-
:src="avatarImageUrl || defaultAvatarUrl"
|
|
15
|
-
@load="avatarLoadSuccess"
|
|
16
|
-
@error="avatarLoadFailed"
|
|
17
|
-
/>
|
|
18
|
-
<image
|
|
19
|
-
v-else
|
|
20
|
-
class="avatar-image"
|
|
21
|
-
:src="defaultAvatarUrl"
|
|
22
|
-
@load="avatarLoadSuccess"
|
|
23
|
-
@error="avatarLoadFailed"
|
|
24
|
-
/>
|
|
25
|
-
</template>
|
|
26
10
|
<img
|
|
27
|
-
v-else
|
|
28
11
|
class="avatar-image"
|
|
29
12
|
:src="avatarImageUrl || defaultAvatarUrl"
|
|
30
13
|
@load="avatarLoadSuccess"
|
|
@@ -43,7 +26,6 @@
|
|
|
43
26
|
|
|
44
27
|
<script setup lang="ts">
|
|
45
28
|
import vue from '../../../adapter-vue';
|
|
46
|
-
import { isUniFrameWork } from '../../../utils/env';
|
|
47
29
|
const { ref, toRefs } = vue;
|
|
48
30
|
|
|
49
31
|
interface IProps {
|
|
@@ -79,7 +61,7 @@ const {
|
|
|
79
61
|
|
|
80
62
|
let reloadAvatarTime = 0;
|
|
81
63
|
const isImgLoaded = ref<boolean>(false);
|
|
82
|
-
|
|
64
|
+
|
|
83
65
|
|
|
84
66
|
function avatarLoadSuccess(e: Event) {
|
|
85
67
|
isImgLoaded.value = true;
|
|
@@ -91,11 +73,8 @@ function avatarLoadFailed(e: Event) {
|
|
|
91
73
|
if (reloadAvatarTime > 3) {
|
|
92
74
|
return;
|
|
93
75
|
}
|
|
94
|
-
if (isUniFrameWork) {
|
|
95
|
-
loadErrorInUniapp.value = true;
|
|
96
|
-
} else {
|
|
97
76
|
(e.currentTarget as HTMLImageElement).src = defaultAvatarUrl.value;
|
|
98
|
-
|
|
77
|
+
|
|
99
78
|
emits('onError', e);
|
|
100
79
|
}
|
|
101
80
|
</script>
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
v-if="!isPC"
|
|
10
10
|
:class="[
|
|
11
11
|
'bottom-popup',
|
|
12
|
-
isUniFrameWork && 'bottom-popup-uni',
|
|
13
12
|
!isPC && 'bottom-popup-h5',
|
|
14
13
|
!isPC && props.modal && 'bottom-popup-modal',
|
|
15
14
|
]"
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
import vue from '../../../adapter-vue';
|
|
65
64
|
import { TUITranslateService } from '@tencentcloud/chat-uikit-engine';
|
|
66
65
|
import { outsideClick } from '@tencentcloud/universal-api';
|
|
67
|
-
import { isPC, isH5
|
|
66
|
+
import { isPC, isH5 } from '../../../utils/env';
|
|
68
67
|
const { ref, watch, nextTick } = vue;
|
|
69
68
|
|
|
70
69
|
const props = defineProps({
|
|
@@ -129,7 +128,7 @@ watch(
|
|
|
129
128
|
emits('onOpen', dialogRef);
|
|
130
129
|
nextTick(() => {
|
|
131
130
|
// Effective under web h5
|
|
132
|
-
if (isH5
|
|
131
|
+
if (isH5) {
|
|
133
132
|
if (props.closeByClickOutside) {
|
|
134
133
|
outsideClick.listen({
|
|
135
134
|
domRefs: dialogRef.value,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</header>
|
|
25
25
|
<div
|
|
26
26
|
class="dialog-main-content"
|
|
27
|
-
:class="[
|
|
27
|
+
:class="[isH5 ? 'dialog-main-content-uniapp' : '']"
|
|
28
28
|
>
|
|
29
29
|
<slot />
|
|
30
30
|
</div>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<script lang="ts" setup>
|
|
53
53
|
import vue from '../../../adapter-vue';
|
|
54
54
|
import { TUITranslateService } from '@tencentcloud/chat-uikit-engine';
|
|
55
|
-
import { isPC, isH5
|
|
55
|
+
import { isPC, isH5 } from '../../../utils/env';
|
|
56
56
|
const { ref, watchEffect } = vue;
|
|
57
57
|
const clickType = {
|
|
58
58
|
OUTSIDE: 'outside',
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
:rotate="rotate"
|
|
34
34
|
:src="getImageUrl(item)"
|
|
35
35
|
:messageItem="item"
|
|
36
|
-
:class="[isUniFrameWork ? 'image-item' : '']"
|
|
37
36
|
/>
|
|
38
37
|
</li>
|
|
39
38
|
</ul>
|
|
@@ -131,7 +130,6 @@ import {
|
|
|
131
130
|
IMessageModel,
|
|
132
131
|
TUITranslateService,
|
|
133
132
|
} from '@tencentcloud/chat-uikit-engine';
|
|
134
|
-
import { TUIGlobal, getPlatform } from '@tencentcloud/universal-api';
|
|
135
133
|
import Icon from '../Icon.vue';
|
|
136
134
|
import iconClose from '../../../assets/icon-close.svg';
|
|
137
135
|
import iconArrowLeft from '../../../assets/icon-arrow-left.svg';
|
|
@@ -142,7 +140,7 @@ import iconRotateRight from '../../../assets/rotate-right.svg';
|
|
|
142
140
|
import iconDownload from '../../../assets/download.svg';
|
|
143
141
|
import ImageItem from './image-item-web.vue';
|
|
144
142
|
import { Toast, TOAST_TYPE } from '../Toast/index-web';
|
|
145
|
-
import { isPC, isMobile
|
|
143
|
+
import { isPC, isMobile } from '../../../utils/env';
|
|
146
144
|
const { ref, watchEffect, onMounted, onUnmounted, withDefaults } = vue;
|
|
147
145
|
|
|
148
146
|
interface touchesPosition {
|
|
@@ -381,88 +379,8 @@ const save = () => {
|
|
|
381
379
|
});
|
|
382
380
|
return;
|
|
383
381
|
}
|
|
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
382
|
downloadImgInWeb(imageSrc);
|
|
436
|
-
|
|
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
|
-
});
|
|
383
|
+
|
|
466
384
|
};
|
|
467
385
|
|
|
468
386
|
const downloadImgInWeb = (src: string) => {
|
|
@@ -8,17 +8,10 @@
|
|
|
8
8
|
class="progress-container"
|
|
9
9
|
>
|
|
10
10
|
<progress
|
|
11
|
-
v-if="!isUniFrameWork"
|
|
12
11
|
class="progress"
|
|
13
12
|
:value="props.messageItem.progress"
|
|
14
13
|
max="1"
|
|
15
14
|
/>
|
|
16
|
-
<progress
|
|
17
|
-
v-else
|
|
18
|
-
activeColor="#006EFF"
|
|
19
|
-
class="progress-common"
|
|
20
|
-
:percent="Math.round(props.messageItem.progress * 100)"
|
|
21
|
-
/>
|
|
22
15
|
</div>
|
|
23
16
|
</div>
|
|
24
17
|
</template>
|
|
@@ -26,7 +19,6 @@
|
|
|
26
19
|
<script lang="ts" setup>
|
|
27
20
|
import type { IMessageModel } from '@tencentcloud/chat-uikit-engine';
|
|
28
21
|
import vue from '../../../adapter-vue';
|
|
29
|
-
import { isUniFrameWork } from '../../../utils/env';
|
|
30
22
|
import type { IImageMessageContent } from '../../../interface';
|
|
31
23
|
const { withDefaults } = vue;
|
|
32
24
|
|
package/index.ts
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
declare const uni: any;
|
|
2
2
|
import TUICustomerPluginServer from './server';
|
|
3
3
|
import { isMessageInvisible } from './utils/index';
|
|
4
|
-
// #ifndef APP || APP-PLUS || MP || H5
|
|
5
4
|
import CustomerChatWeb from './components/CustomerServiceChat/index-web.vue';
|
|
6
|
-
|
|
5
|
+
|
|
7
6
|
|
|
8
7
|
const TUICustomerServer = TUICustomerPluginServer.getInstance();
|
|
9
8
|
|
|
10
9
|
const isCustomerServicePluginMessage = TUICustomerServer.isCustomerServicePluginMessage.bind(TUICustomerServer);
|
|
11
10
|
|
|
12
|
-
const setCustomerServiceAccounts = TUICustomerServer.setCustomerServiceAccounts.bind(TUICustomerServer);
|
|
13
|
-
|
|
14
|
-
const getCustomerServiceAccounts = TUICustomerServer.getCustomerServiceAccounts.bind(TUICustomerServer);
|
|
15
|
-
|
|
16
11
|
const isCustomerConversation = TUICustomerServer.isCustomerConversation.bind(TUICustomerServer);
|
|
17
12
|
|
|
18
|
-
let CustomerServiceChat =
|
|
19
|
-
|
|
20
|
-
CustomerServiceChat = CustomerChatWeb;
|
|
21
|
-
}
|
|
13
|
+
let CustomerServiceChat = CustomerChatWeb;
|
|
14
|
+
|
|
22
15
|
|
|
23
16
|
export {
|
|
24
17
|
isCustomerServicePluginMessage,
|
|
25
18
|
isMessageInvisible,
|
|
26
|
-
setCustomerServiceAccounts,
|
|
27
|
-
getCustomerServiceAccounts,
|
|
28
19
|
CustomerServiceChat,
|
|
29
20
|
isCustomerConversation
|
|
30
|
-
};
|
|
21
|
+
};
|
package/index.vue
CHANGED
|
@@ -1,60 +1 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="message-custom">
|
|
3
|
-
<MessageRating
|
|
4
|
-
v-if="isMessageRating(props.message)"
|
|
5
|
-
:message="props.message"
|
|
6
|
-
@sendMessage="sendCustomMessage"
|
|
7
|
-
/>
|
|
8
|
-
<MessageCustomerService
|
|
9
|
-
v-else-if="isCustomerServiceMessage(props.message)"
|
|
10
|
-
:message="props.message"
|
|
11
|
-
@sendMessage="sendTextMessage"
|
|
12
|
-
@sendCustomMessage="sendCustomMessage"
|
|
13
|
-
@showFormPopup="handleShowFormPopup"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
<script lang="ts">
|
|
18
|
-
import { isCustomerServiceMessage, isMessageRating } from './utils/index';
|
|
19
|
-
import { CustomMessagePayload, TextMessagePayload, IMessageModel } from './interface';
|
|
20
|
-
import MessageCustomerService from './components/message-customer-service.vue';
|
|
21
|
-
import MessageRating from './components/message-rating/index.vue';
|
|
22
|
-
import {
|
|
23
|
-
TUIChatService,
|
|
24
|
-
} from '@tencentcloud/chat-uikit-engine';
|
|
25
|
-
interface Props {
|
|
26
|
-
message: IMessageModel;
|
|
27
|
-
}
|
|
28
|
-
export default {
|
|
29
|
-
components: {
|
|
30
|
-
MessageCustomerService,
|
|
31
|
-
MessageRating,
|
|
32
|
-
},
|
|
33
|
-
props: {
|
|
34
|
-
message: {
|
|
35
|
-
type: Object as () => IMessageModel,
|
|
36
|
-
default: () => ({}),
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
emits: ['showFormPopup'],
|
|
40
|
-
setup(props: Props, { emit }) {
|
|
41
|
-
const sendTextMessage = (payload: TextMessagePayload) => {
|
|
42
|
-
TUIChatService.sendTextMessage({payload});
|
|
43
|
-
};
|
|
44
|
-
const sendCustomMessage = (payload: CustomMessagePayload) => {
|
|
45
|
-
TUIChatService.sendCustomMessage({payload});
|
|
46
|
-
};
|
|
47
|
-
const handleShowFormPopup = (data: boolean) => {
|
|
48
|
-
emit('showFormPopup', data);
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
props,
|
|
52
|
-
sendTextMessage,
|
|
53
|
-
sendCustomMessage,
|
|
54
|
-
isCustomerServiceMessage,
|
|
55
|
-
isMessageRating,
|
|
56
|
-
handleShowFormPopup
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
</script>
|
|
1
|
+
<template></template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencentcloud/ai-desk-customer-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "chat uikit ai-desk-customer",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"keywords": [
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"publish:uniapp": "cd ../tui-customer-service-plugin-uniapp && ls && npm publish --access public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@tencentcloud/chat-uikit-engine": "
|
|
26
|
-
"@tencentcloud/tui-core": "
|
|
25
|
+
"@tencentcloud/chat-uikit-engine": "^2.4.2",
|
|
26
|
+
"@tencentcloud/tui-core": "^2.4.0",
|
|
27
27
|
"@tencentcloud/tui-emoji-plugin": "latest",
|
|
28
|
-
"@tencentcloud/universal-api": "
|
|
28
|
+
"@tencentcloud/universal-api": "^2.4.0",
|
|
29
29
|
"@tiptap/core": "2.0.0-beta.220",
|
|
30
30
|
"@tiptap/extension-document": "2.0.0-beta.220",
|
|
31
31
|
"@tiptap/extension-image": "2.0.0-beta.220",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"vue-clipboard3": "2.0.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@tencentcloud/tui-core": "latest",
|
|
48
47
|
"@vue/composition-api": "^1.0.0-rc.1",
|
|
49
48
|
"vue": "^2.0.0 || >=3.0.0"
|
|
50
49
|
},
|
package/server.ts
CHANGED
|
@@ -3,8 +3,7 @@ import {
|
|
|
3
3
|
isCustomerServiceMessage,
|
|
4
4
|
isMessageInvisible,
|
|
5
5
|
} from './utils/index';
|
|
6
|
-
import { IMessageModel
|
|
7
|
-
import TUIChatEngine, { TUIChatService, TUIConversationService } from '@tencentcloud/chat-uikit-engine';
|
|
6
|
+
import TUIChatEngine, { TUIChatService, TUIConversationService,IMessageModel } from '@tencentcloud/chat-uikit-engine';
|
|
8
7
|
|
|
9
8
|
export default class TUICustomerServer {
|
|
10
9
|
static isInitialized: boolean;
|
|
@@ -14,7 +13,6 @@ export default class TUICustomerServer {
|
|
|
14
13
|
console.log('TUICustomerServer.init ok');
|
|
15
14
|
TUICore.registerService(TUIConstants.TUICustomerServicePlugin.SERVICE.NAME, this);
|
|
16
15
|
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
16
|
this.customerServiceAccounts = ['@customer_service_account'];
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -25,25 +23,6 @@ export default class TUICustomerServer {
|
|
|
25
23
|
return TUICustomerServer.instance;
|
|
26
24
|
}
|
|
27
25
|
|
|
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
26
|
static loginCustomerUIKit(SDKAppID:number, userID:string, userSig:string) {
|
|
48
27
|
TUIChatEngine.login({
|
|
49
28
|
SDKAppID,
|
|
@@ -53,6 +32,7 @@ export default class TUICustomerServer {
|
|
|
53
32
|
}).then(() => {
|
|
54
33
|
console.log("login success");
|
|
55
34
|
TUIConversationService.switchConversation('C2C@customer_service_account');
|
|
35
|
+
TUIChatEngine.chat.callExperimentalAPI('isFeatureEnabledForStat', Math.pow(2, 42));
|
|
56
36
|
})
|
|
57
37
|
.catch((error) => {
|
|
58
38
|
console.log(error);
|
|
@@ -72,15 +52,6 @@ export default class TUICustomerServer {
|
|
|
72
52
|
this.loginCustomerUIKit(SDKAppID, userID, userSig);
|
|
73
53
|
}
|
|
74
54
|
|
|
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
55
|
|
|
85
56
|
// Determine if the current session is a customer service session
|
|
86
57
|
public isCustomerConversation(conversationID: string) {
|
|
@@ -125,4 +96,4 @@ export default class TUICustomerServer {
|
|
|
125
96
|
}
|
|
126
97
|
}
|
|
127
98
|
}
|
|
128
|
-
}
|
|
99
|
+
}
|
package/utils/chatStorage.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isUniFrameWork } from './env';
|
|
2
1
|
import { TUIGlobal } from '@tencentcloud/universal-api';
|
|
3
2
|
|
|
4
3
|
interface IChatStorage {
|
|
@@ -38,11 +37,7 @@ class ChatStorage implements IChatStorage {
|
|
|
38
37
|
}
|
|
39
38
|
this.chatStorage[key] = value;
|
|
40
39
|
try {
|
|
41
|
-
|
|
42
|
-
TUIGlobal.setStorageSync(ChatStorage.CHAT_STORAGE_KEY, JSON.stringify(this.chatStorage));
|
|
43
|
-
} else {
|
|
44
|
-
localStorage.setItem(ChatStorage.CHAT_STORAGE_KEY, JSON.stringify(this.chatStorage));
|
|
45
|
-
}
|
|
40
|
+
localStorage.setItem(ChatStorage.CHAT_STORAGE_KEY, JSON.stringify(this.chatStorage));
|
|
46
41
|
} catch (error) {
|
|
47
42
|
throw new Error('Fail to set chat storage');
|
|
48
43
|
}
|
|
@@ -50,11 +45,7 @@ class ChatStorage implements IChatStorage {
|
|
|
50
45
|
|
|
51
46
|
private getChatStorageFromLocalStorage(): Record<string, any> {
|
|
52
47
|
let chatStorageString: string = '';
|
|
53
|
-
|
|
54
|
-
chatStorageString = TUIGlobal.getStorageSync(ChatStorage.CHAT_STORAGE_KEY) || '';
|
|
55
|
-
} else {
|
|
56
|
-
chatStorageString = localStorage.getItem(ChatStorage.CHAT_STORAGE_KEY) || '';
|
|
57
|
-
}
|
|
48
|
+
chatStorageString = localStorage.getItem(ChatStorage.CHAT_STORAGE_KEY) || '';
|
|
58
49
|
if (!chatStorageString) {
|
|
59
50
|
return {};
|
|
60
51
|
}
|