@tencentcloud/ai-desk-customer-vue 1.3.0 → 1.4.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/CHANGELOG.md +11 -4
- package/assets/customer_avatar.png +0 -0
- package/assets/face.svg +10 -0
- package/assets/files.svg +5 -0
- package/assets/image.svg +8 -0
- package/assets/rating_tool_icon.svg +5 -0
- package/assets/rating_tool_icon_h5.svg +1 -0
- package/assets/video.svg +8 -0
- package/assets/video_h5.svg +1 -0
- package/components/CustomerServiceChat/chat-header/index-web.vue +16 -14
- package/components/CustomerServiceChat/index-web.vue +69 -13
- package/components/CustomerServiceChat/message-input/index-web.vue +31 -5
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +24 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +1 -1
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +1 -1
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +6 -8
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +11 -16
- package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +61 -18
- package/components/CustomerServiceChat/message-input-toolbar/rating-tool/index.vue +72 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +10 -1
- package/components/CustomerServiceChat/message-input-toolbar/user-define-input-tool.vue +80 -0
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +9 -14
- package/components/CustomerServiceChat/message-list/index-web.vue +33 -6
- package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +53 -6
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-branch.vue +5 -5
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-desk.vue +8 -3
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch/branch-pc.vue +20 -6
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch/index.vue +2 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-order.vue +1 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +1 -1
- package/components/CustomerServiceChat/message-list/scroll-button/index.vue +3 -3
- package/components/CustomerServiceChat/message-list/style/web.scss +2 -1
- package/components/CustomerServiceChat/message-toolbar-button/index.vue +111 -42
- package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-end-human-service.vue +59 -0
- package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-human-service.vue +55 -0
- package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-service-rating.vue +59 -0
- package/constant.ts +15 -0
- package/interface.ts +35 -5
- package/locales/en/aidesk.ts +4 -3
- package/locales/fil/aidesk.ts +2 -1
- package/locales/id/aidesk.ts +3 -2
- package/locales/ja/aidesk.ts +1 -0
- package/locales/ms/aidesk.ts +1 -0
- package/locales/ru/aidesk.ts +1 -0
- package/locales/th/aidesk.ts +1 -0
- package/locales/vi/aidesk.ts +1 -0
- package/locales/zh_cn/aidesk.ts +1 -0
- package/locales/zh_tw/aidesk.ts +1 -0
- package/package.json +1 -1
- package/server.ts +5 -1
- package/utils/state.js +30 -0
- package/utils/utils.ts +48 -1
- package/assets/face.png +0 -0
- package/assets/files.png +0 -0
- package/assets/image.png +0 -0
- package/assets/video.png +0 -0
|
@@ -93,7 +93,7 @@ export default {
|
|
|
93
93
|
display: -webkit-box;
|
|
94
94
|
overflow: hidden;
|
|
95
95
|
text-overflow: ellipsis;
|
|
96
|
-
-webkit-line-clamp:
|
|
96
|
+
-webkit-line-clamp: 1;
|
|
97
97
|
-webkit-box-orient: vertical;
|
|
98
98
|
word-break: break-all;
|
|
99
99
|
}
|
|
@@ -105,7 +105,6 @@ export default {
|
|
|
105
105
|
color: rgba(0, 0, 0, 0.55);
|
|
106
106
|
overflow: hidden;
|
|
107
107
|
text-overflow: ellipsis;
|
|
108
|
-
white-space: nowrap;
|
|
109
108
|
font-weight: 600;
|
|
110
109
|
}
|
|
111
110
|
}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
IMessageModel,
|
|
23
23
|
} from '@tencentcloud/chat-uikit-engine';
|
|
24
24
|
import Icon from '../../../common/Icon.vue';
|
|
25
|
-
import files from '../../../../assets/files.
|
|
25
|
+
import files from '../../../../assets/files.svg';
|
|
26
26
|
import { isUniFrameWork } from '../../../../utils/env';
|
|
27
27
|
import type { IFileMessageContent } from '../../../../interface';
|
|
28
28
|
const { withDefaults } = vue;
|
|
@@ -64,7 +64,7 @@ watch(
|
|
|
64
64
|
onMounted(() => {
|
|
65
65
|
TUIStore.watch(StoreName.CHAT, {
|
|
66
66
|
messageList: onMessageListUpdated,
|
|
67
|
-
newMessageList:
|
|
67
|
+
newMessageList: onNewMessageList,
|
|
68
68
|
});
|
|
69
69
|
TUIStore.watch(StoreName.CONV, {
|
|
70
70
|
currentConversation: onCurrentConversationUpdated,
|
|
@@ -74,7 +74,7 @@ onMounted(() => {
|
|
|
74
74
|
onUnmounted(() => {
|
|
75
75
|
TUIStore.unwatch(StoreName.CHAT, {
|
|
76
76
|
messageList: onMessageListUpdated,
|
|
77
|
-
newMessageList:
|
|
77
|
+
newMessageList: onNewMessageList,
|
|
78
78
|
});
|
|
79
79
|
TUIStore.unwatch(StoreName.CONV, {
|
|
80
80
|
currentConversation: onCurrentConversationUpdated,
|
|
@@ -97,7 +97,7 @@ function onMessageListUpdated(newMessageList: IMessageModel[]) {
|
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
function
|
|
100
|
+
function onNewMessageList(newMessageList: IMessageModel[]) {
|
|
101
101
|
if (Array.isArray(newMessageList) && isScrollButtonVisible.value) {
|
|
102
102
|
newMessageList.forEach((message: IMessageModel) => {
|
|
103
103
|
if (
|
|
@@ -1,75 +1,144 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</
|
|
13
|
-
|
|
2
|
+
<div class="toolbar-button-container">
|
|
3
|
+
<template v-for="(item, index) in props.toolbarButtonList">
|
|
4
|
+
<ToolbarButtonHumanService v-if="item.presetId === TOOLBAR_BUTTON_TYPE.HUMAN_SERVICE && shouldRender(item) && !isInHumanService" :title="item.title" :icon="item.icon"/>
|
|
5
|
+
<ToolbarButtonServiceRating v-else-if="item.presetId === TOOLBAR_BUTTON_TYPE.SERVICE_RATING && shouldRender(item) && isInHumanService" :title="item.title" :icon="item.icon"/>
|
|
6
|
+
<ToolbarButtonEndHumanService v-else-if="item.presetId === TOOLBAR_BUTTON_TYPE.END_HUMAN_SERVICE && shouldRender(item) && isInHumanService" :title="item.title" :icon="item.icon"/>
|
|
7
|
+
<div v-else-if="shouldRender(item) && !item.presetId" :key="index"
|
|
8
|
+
:class="['toolbar-button', isH5 ? 'toolbar-button-h5' : '']" @click="onClick(item, index)">
|
|
9
|
+
<Icon v-if="item.icon" class="toolbar-button-icon" :file="item.icon" width="18px" height="18px"/>
|
|
10
|
+
<div class="toolbar-button-text">
|
|
11
|
+
{{ item.title }}
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
</div>
|
|
14
16
|
</template>
|
|
15
17
|
<script lang="ts" setup>
|
|
18
|
+
import vue from '../../../adapter-vue';
|
|
19
|
+
const { ref, onMounted, onUnmounted } = vue;
|
|
20
|
+
import {
|
|
21
|
+
TUIChatService,
|
|
22
|
+
TUIStore,
|
|
23
|
+
StoreName,
|
|
24
|
+
IConversationModel
|
|
25
|
+
} from '@tencentcloud/chat-uikit-engine';
|
|
16
26
|
import { isH5 } from '../../../utils/env';
|
|
17
27
|
import { ToolbarButtonModel } from '../../../interface';
|
|
18
28
|
import Icon from '../../common/Icon.vue';
|
|
19
|
-
|
|
29
|
+
import { TOOLBAR_BUTTON_TYPE } from '../../../constant';
|
|
30
|
+
import { isEnabledMessageReadReceiptGlobal, openSafeUrl, getTo } from '../../../utils/utils';
|
|
31
|
+
import ToolbarButtonHumanService from './toolbar-button-human-service.vue';
|
|
32
|
+
import ToolbarButtonServiceRating from './toolbar-button-service-rating.vue';
|
|
33
|
+
import ToolbarButtonEndHumanService from './toolbar-button-end-human-service.vue';
|
|
20
34
|
interface IProps {
|
|
21
|
-
|
|
35
|
+
toolbarButtonList?: ToolbarButtonModel[] | undefined;
|
|
22
36
|
}
|
|
23
37
|
|
|
24
|
-
const props = withDefaults(defineProps<IProps>(), {
|
|
25
|
-
|
|
38
|
+
const props = withDefaults(defineProps<IProps>(), {});
|
|
39
|
+
|
|
40
|
+
const isInHumanService = ref(false);
|
|
41
|
+
const currentConversation = ref<IConversationModel>();
|
|
42
|
+
|
|
43
|
+
onMounted(() => {
|
|
44
|
+
TUIStore.watch(StoreName.CONV, {
|
|
45
|
+
currentConversation: onCurrentConversationUpdate,
|
|
46
|
+
});
|
|
47
|
+
TUIStore.watch(StoreName.CUSTOM, {
|
|
48
|
+
isInHumanService: onInHumanServiceUpdate,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
onUnmounted(() => {
|
|
53
|
+
TUIStore.unwatch(StoreName.CONV, {
|
|
54
|
+
currentConversation: onCurrentConversationUpdate,
|
|
55
|
+
});
|
|
56
|
+
TUIStore.unwatch(StoreName.CUSTOM, {
|
|
57
|
+
isInHumanService: onInHumanServiceUpdate,
|
|
58
|
+
});
|
|
26
59
|
});
|
|
27
60
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
61
|
+
const onCurrentConversationUpdate = (conversation: IConversationModel) => {
|
|
62
|
+
currentConversation.value = conversation;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const onInHumanServiceUpdate = (value: boolean) => {
|
|
66
|
+
isInHumanService.value = value;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
function onClick(item:ToolbarButtonModel, index: number) {
|
|
70
|
+
if (item.type === 1 && item.content) {
|
|
71
|
+
TUIChatService.sendTextMessage({
|
|
72
|
+
to: getTo(currentConversation?.value),
|
|
73
|
+
conversationType: currentConversation?.value?.type,
|
|
74
|
+
payload: {
|
|
75
|
+
text: item.content
|
|
76
|
+
},
|
|
77
|
+
needReadReceipt: isEnabledMessageReadReceiptGlobal(),
|
|
78
|
+
});
|
|
79
|
+
} else if (item.type === 2 && item.content) {
|
|
80
|
+
openSafeUrl(item.content);
|
|
81
|
+
} else if (props.toolbarButtonList !== undefined && typeof props.toolbarButtonList[index].clickEvent === 'function') {
|
|
82
|
+
props.toolbarButtonList[index].clickEvent();
|
|
83
|
+
}
|
|
32
84
|
}
|
|
33
85
|
|
|
34
86
|
function shouldRender(item: ToolbarButtonModel) {
|
|
87
|
+
if (item.isEnabled === 1) {
|
|
88
|
+
return true;
|
|
89
|
+
} else if (item.isEnabled === 0) {
|
|
90
|
+
return false;
|
|
91
|
+
} else if (item.renderCondition) {
|
|
35
92
|
return typeof item.renderCondition === 'function' ? item.renderCondition() : false;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
36
95
|
}
|
|
37
96
|
|
|
38
97
|
</script>
|
|
39
98
|
<style>
|
|
40
99
|
.toolbar-button-container {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: row !important;
|
|
102
|
+
margin: 5px !important;
|
|
103
|
+
align-items: center ;
|
|
104
|
+
overflow-x: auto; /* 允许横向滚动 */
|
|
105
|
+
scrollbar-width: none; /* Firefox 隐藏滚动条 */
|
|
106
|
+
-ms-overflow-style: none; /* IE/Edge 隐藏滚动条 */
|
|
107
|
+
&::-webkit-scrollbar {
|
|
108
|
+
display: none; /* Chrome 隐藏滚动条 */
|
|
109
|
+
}
|
|
45
110
|
}
|
|
46
111
|
|
|
47
112
|
.toolbar-button {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
113
|
+
border: 1px solid #E7EAEF;
|
|
114
|
+
padding: 5px 10px;
|
|
115
|
+
border-radius: 20px;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
margin-left: 10px;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
user-select: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.toolbar-button:first-child {
|
|
125
|
+
margin-left: 5px;
|
|
57
126
|
}
|
|
58
127
|
|
|
59
128
|
.toolbar-button-h5 {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
129
|
+
border: none;
|
|
130
|
+
background-color: #fff;
|
|
131
|
+
box-shadow: 0px 2px 2px 0px rgba(70, 98, 140, 0.06);
|
|
63
132
|
}
|
|
64
133
|
|
|
65
134
|
.toolbar-button-icon {
|
|
66
|
-
|
|
135
|
+
margin-right: 3px;
|
|
67
136
|
}
|
|
68
137
|
.toolbar-button-text {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
138
|
+
font-size: 12px;
|
|
139
|
+
text-overflow: ellipsis;
|
|
140
|
+
max-width: 100px;
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
font-family: PingFangSC-Regular;
|
|
74
143
|
}
|
|
75
144
|
</style>
|
package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-end-human-service.vue
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['toolbar-button', isH5 ? 'toolbar-button-h5' : '']" @click="onClick">
|
|
3
|
+
<Icon v-if="props.icon" class="toolbar-button-icon" :file="props.icon" width="14px" height="14px"/>
|
|
4
|
+
<div class="toolbar-button-text">
|
|
5
|
+
{{ props.title || TUITranslateService.t('AIDesk.结束人工会话') }}
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import vue from '../../../adapter-vue';
|
|
11
|
+
const { ref, onMounted, onUnmounted } = vue;
|
|
12
|
+
import { isH5 } from '../../../utils/env';
|
|
13
|
+
import Icon from '../../common/Icon.vue';
|
|
14
|
+
import { TUITranslateService, TUIChatService, IConversationModel, TUIStore, StoreName } from '@tencentcloud/chat-uikit-engine';
|
|
15
|
+
import { CUSTOM_MESSAGE_SRC } from '../../../constant';
|
|
16
|
+
import { isEnabledMessageReadReceiptGlobal, getTo } from '../../../utils/utils';
|
|
17
|
+
const currentConversation = ref<IConversationModel>();
|
|
18
|
+
interface IProps {
|
|
19
|
+
title?:string;
|
|
20
|
+
icon?:string | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
24
|
+
title: '',
|
|
25
|
+
icon: ''
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
onMounted(() => {
|
|
29
|
+
TUIStore.watch(StoreName.CONV, {
|
|
30
|
+
currentConversation: onCurrentConversationUpdate,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
onUnmounted(() => {
|
|
35
|
+
TUIStore.unwatch(StoreName.CONV, {
|
|
36
|
+
currentConversation: onCurrentConversationUpdate,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const onCurrentConversationUpdate = (conversation: IConversationModel) => {
|
|
41
|
+
currentConversation.value = conversation;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onClick = () => {
|
|
45
|
+
TUIChatService.sendCustomMessage({
|
|
46
|
+
to: getTo(currentConversation?.value),
|
|
47
|
+
conversationType: currentConversation?.value?.type,
|
|
48
|
+
payload: {
|
|
49
|
+
data: JSON.stringify({
|
|
50
|
+
customerServicePlugin: 0,
|
|
51
|
+
src: CUSTOM_MESSAGE_SRC.USER_END_SESSION,
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
needReadReceipt: isEnabledMessageReadReceiptGlobal(),
|
|
55
|
+
},{ onlineUserOnly:true });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
</script>
|
|
59
|
+
<style></style>
|
package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-human-service.vue
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['toolbar-button', isH5 ? 'toolbar-button-h5' : '']" @click="onClick">
|
|
3
|
+
<Icon v-if="props.icon" class="toolbar-button-icon" :file="props.icon" width="14px" height="14px"/>
|
|
4
|
+
<div class="toolbar-button-text">
|
|
5
|
+
{{ props.title || TUITranslateService.t('AIDesk.转人工服务') }}
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import vue from '../../../adapter-vue';
|
|
11
|
+
const { ref, onMounted, onUnmounted } = vue;
|
|
12
|
+
import { isH5 } from '../../../utils/env';
|
|
13
|
+
import Icon from '../../common/Icon.vue';
|
|
14
|
+
import { TUITranslateService, TUIChatService, IConversationModel, StoreName, TUIStore } from '@tencentcloud/chat-uikit-engine';
|
|
15
|
+
import { isEnabledMessageReadReceiptGlobal, getTo } from '../../../utils/utils';
|
|
16
|
+
const currentConversation = ref<IConversationModel>();
|
|
17
|
+
interface IProps {
|
|
18
|
+
title?:string;
|
|
19
|
+
icon?:string | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
23
|
+
title: '',
|
|
24
|
+
icon: ''
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
onMounted(() => {
|
|
28
|
+
TUIStore.watch(StoreName.CONV, {
|
|
29
|
+
currentConversation: onCurrentConversationUpdate,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
onUnmounted(() => {
|
|
34
|
+
TUIStore.unwatch(StoreName.CONV, {
|
|
35
|
+
currentConversation: onCurrentConversationUpdate,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const onCurrentConversationUpdate = (conversation: IConversationModel) => {
|
|
40
|
+
currentConversation.value = conversation;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const onClick = () => {
|
|
44
|
+
TUIChatService.sendTextMessage({
|
|
45
|
+
to: getTo(currentConversation?.value),
|
|
46
|
+
conversationType: currentConversation?.value?.type,
|
|
47
|
+
payload: {
|
|
48
|
+
text: TUITranslateService.t('AIDesk.转人工服务')
|
|
49
|
+
},
|
|
50
|
+
needReadReceipt: isEnabledMessageReadReceiptGlobal(),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
</script>
|
|
55
|
+
<style></style>
|
package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-service-rating.vue
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['toolbar-button', isH5 ? 'toolbar-button-h5' : '']" @click="onClick">
|
|
3
|
+
<Icon v-if="props.icon" class="toolbar-button-icon" :file="props.icon" width="14px" height="14px"/>
|
|
4
|
+
<div class="toolbar-button-text">
|
|
5
|
+
{{ props.title || TUITranslateService.t('AIDesk.服务评价') }}
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import vue from '../../../adapter-vue';
|
|
11
|
+
const { ref, onMounted, onUnmounted } = vue;
|
|
12
|
+
import { isH5 } from '../../../utils/env';
|
|
13
|
+
import Icon from '../../common/Icon.vue';
|
|
14
|
+
import { TUITranslateService, TUIChatService, IConversationModel, StoreName, TUIStore } from '@tencentcloud/chat-uikit-engine';
|
|
15
|
+
import { CUSTOM_MESSAGE_SRC } from '../../../constant';
|
|
16
|
+
import { isEnabledMessageReadReceiptGlobal, getTo } from '../../../utils/utils';
|
|
17
|
+
const currentConversation = ref<IConversationModel>();
|
|
18
|
+
interface IProps {
|
|
19
|
+
title?:string;
|
|
20
|
+
icon?:string | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
24
|
+
title: '',
|
|
25
|
+
icon: ''
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
onMounted(() => {
|
|
29
|
+
TUIStore.watch(StoreName.CONV, {
|
|
30
|
+
currentConversation: onCurrentConversationUpdate,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
onUnmounted(() => {
|
|
35
|
+
TUIStore.unwatch(StoreName.CONV, {
|
|
36
|
+
currentConversation: onCurrentConversationUpdate,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const onCurrentConversationUpdate = (conversation: IConversationModel) => {
|
|
41
|
+
currentConversation.value = conversation;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onClick = () => {
|
|
45
|
+
TUIChatService.sendCustomMessage({
|
|
46
|
+
to: getTo(currentConversation?.value),
|
|
47
|
+
conversationType: currentConversation?.value?.type,
|
|
48
|
+
payload: {
|
|
49
|
+
data:JSON.stringify({
|
|
50
|
+
src: CUSTOM_MESSAGE_SRC.USER_SATISFACTION,
|
|
51
|
+
customerServicePlugin: 0,
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
needReadReceipt: isEnabledMessageReadReceiptGlobal(),
|
|
55
|
+
},{ onlineUserOnly: true });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
</script>
|
|
59
|
+
<style></style>
|
package/constant.ts
CHANGED
|
@@ -141,3 +141,18 @@ export const WHITE_LIST = [
|
|
|
141
141
|
CUSTOM_MESSAGE_SRC.CONCURRENCY_LIMIT,
|
|
142
142
|
CUSTOM_MESSAGE_SRC.ORDER,
|
|
143
143
|
];
|
|
144
|
+
|
|
145
|
+
export const TOOLBAR_BUTTON_TYPE = {
|
|
146
|
+
HUMAN_SERVICE: 'humanService',
|
|
147
|
+
SERVICE_RATING: 'serviceRating',
|
|
148
|
+
END_HUMAN_SERVICE: 'endHumanService',
|
|
149
|
+
}
|
|
150
|
+
export const INPUT_TOOLBAR_TYPE = {
|
|
151
|
+
EMOJI: 'emoji',
|
|
152
|
+
IMAGE: 'image',
|
|
153
|
+
FILE: 'file',
|
|
154
|
+
VIDEO: 'video',
|
|
155
|
+
RATING: 'rating',
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const USER_DEFAULT_AVATAR = 'https://web.sdk.qcloud.com/im/desk/assets/user_default_avatar.png';
|
package/interface.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TOOLBAR_BUTTON_TYPE,INPUT_TOOLBAR_TYPE } from './constant';
|
|
1
2
|
export interface customerServicePayloadType {
|
|
2
3
|
chatbotPlugin?: number | string;
|
|
3
4
|
customerServicePlugin?: number | string;
|
|
@@ -9,6 +10,12 @@ export interface customerServicePayloadType {
|
|
|
9
10
|
status?:number;
|
|
10
11
|
nodeStatus?:number;
|
|
11
12
|
thinkingStatus?:number;
|
|
13
|
+
optionType?: number;
|
|
14
|
+
taskInfo?: {
|
|
15
|
+
taskID?: number;
|
|
16
|
+
nodeID?: string;
|
|
17
|
+
env?: string;
|
|
18
|
+
}
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
interface IMenuItem {
|
|
@@ -176,9 +183,32 @@ export interface ISendMessagePayload {
|
|
|
176
183
|
atUserList?: string[];
|
|
177
184
|
}
|
|
178
185
|
|
|
186
|
+
// 快捷按钮已有功能
|
|
187
|
+
export type ToolbarButtonPresetType = typeof TOOLBAR_BUTTON_TYPE[keyof typeof TOOLBAR_BUTTON_TYPE];
|
|
188
|
+
|
|
179
189
|
export interface ToolbarButtonModel {
|
|
180
|
-
title:string,
|
|
181
|
-
icon?:string,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
190
|
+
title: string, // 名称
|
|
191
|
+
icon?: string, // 图标
|
|
192
|
+
type?: number, // 类型 1:关键词回复 2:跳转链接
|
|
193
|
+
content?: string, // 发送的文本或跳转的链接
|
|
194
|
+
presetId?: ToolbarButtonPresetType, // 若要显示已有功能,填写相关type
|
|
195
|
+
isPreset?: number, // 是否是预置功能 0:非预置 1:预置类型
|
|
196
|
+
isEnabled?: number, // 是否显示
|
|
197
|
+
renderCondition?: () => {}, // [UIKit] 是否显示
|
|
198
|
+
clickEvent?: () => void, // [UIKit] 点击事件
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// 输入框功能 已有功能
|
|
202
|
+
export type InputToolbarPresetType = typeof INPUT_TOOLBAR_TYPE[keyof typeof INPUT_TOOLBAR_TYPE];
|
|
203
|
+
|
|
204
|
+
export interface InputToolbarModel {
|
|
205
|
+
title?: string, // 名称
|
|
206
|
+
icon?: string, // 图标
|
|
207
|
+
type?: number, // 类型 1:关键词回复 2:跳转链接
|
|
208
|
+
content?: string, // 发送的文本或跳转的链接
|
|
209
|
+
isPreset?: number, // 是否是预置功能 0:非预置 1:预置类型
|
|
210
|
+
presetId?: InputToolbarPresetType, // 若要显示已有功能,填写相关type
|
|
211
|
+
isEnabled?: number, // 是否显示
|
|
212
|
+
renderCondition?: () => {},// [UIKit] 是否显示
|
|
213
|
+
clickEvent?: () => void,// [UIKit] 点击事件
|
|
214
|
+
}
|
package/locales/en/aidesk.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const AIDesk = {
|
|
2
|
-
"结束人工会话": "
|
|
3
|
-
"转人工服务": "
|
|
2
|
+
"结束人工会话": "End human service",
|
|
3
|
+
"转人工服务": "Human service",
|
|
4
4
|
"跳转": "Goto",
|
|
5
5
|
"立即填写": "Fill now",
|
|
6
6
|
"已提交": "Submitted",
|
|
@@ -13,6 +13,7 @@ const AIDesk = {
|
|
|
13
13
|
"请对本次服务进行评价": "Please rate this service",
|
|
14
14
|
"提交评价": "Feedback",
|
|
15
15
|
"并发限制": "There are currently too many users accessing the service. Please try again later",
|
|
16
|
-
"分支选项异常": "Content is abnormal, please check the task flow configuration"
|
|
16
|
+
"分支选项异常": "Content is abnormal, please check the task flow configuration",
|
|
17
|
+
"服务评价": "Feedback",
|
|
17
18
|
}
|
|
18
19
|
export default AIDesk;
|
package/locales/fil/aidesk.ts
CHANGED
|
@@ -13,6 +13,7 @@ const AIDesk = {
|
|
|
13
13
|
"请对本次服务进行评价": "Mangyaring suriin ang serbisyong ito",
|
|
14
14
|
"提交评价": "Ipasa ang pagsusuri",
|
|
15
15
|
"并发限制": "Maraming tao ang naghahanap ng tulong ngayon, subukan muli mamaya",
|
|
16
|
-
"分支选项异常": "Ang nilalaman ay abnormal, pakisuri ang configuration ng task flow"
|
|
16
|
+
"分支选项异常": "Ang nilalaman ay abnormal, pakisuri ang configuration ng task flow",
|
|
17
|
+
"服务评价": "Pagsusuri ng Serbisyo",
|
|
17
18
|
}
|
|
18
19
|
export default AIDesk;
|
package/locales/id/aidesk.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const AIDesk = {
|
|
2
|
-
"结束人工会话": "
|
|
3
|
-
"转人工服务": "
|
|
2
|
+
"结束人工会话": "Selesai",
|
|
3
|
+
"转人工服务": "Layanan manusia",
|
|
4
4
|
"跳转": "Goto",
|
|
5
5
|
"立即填写": "Isi sekarang",
|
|
6
6
|
"已提交": "Terkirim",
|
|
@@ -12,6 +12,7 @@ const AIDesk = {
|
|
|
12
12
|
"如果满意请给好评哦~":"Jika Anda puas, silakan berikan ulasan yang bagus~",
|
|
13
13
|
"请对本次服务进行评价": "Silakan beri penilaian untuk layanan ini",
|
|
14
14
|
"提交评价": "Kirim Ulasan",
|
|
15
|
+
"服务评价": "Ulasan Layanan",
|
|
15
16
|
"并发限制": "Saat ini banyak pengguna yang mengakses. Mohon coba lagi nanti",
|
|
16
17
|
"分支选项异常": "Konten tidak normal, silakan periksa konfigurasi alur tugas"
|
|
17
18
|
}
|
package/locales/ja/aidesk.ts
CHANGED
package/locales/ms/aidesk.ts
CHANGED
|
@@ -12,6 +12,7 @@ const AIDesk = {
|
|
|
12
12
|
"如果满意请给好评哦~":"Jika anda berpuas hati, sila berikan ulasan yang baik~",
|
|
13
13
|
"请对本次服务进行评价": "Sila beri penilaian untuk perkhidmatan ini",
|
|
14
14
|
"提交评价": "Hantar Penilaian",
|
|
15
|
+
"服务评价": "Penilaian Perkhidmatan",
|
|
15
16
|
"并发限制": "Terdapat terlalu ramai pengguna pada masa ini. Sila cuba lagi nanti",
|
|
16
17
|
"分支选项异常": "Kandungan tidak normal, sila semak konfigurasi aliran tugas"
|
|
17
18
|
}
|
package/locales/ru/aidesk.ts
CHANGED
|
@@ -12,6 +12,7 @@ const AIDesk = {
|
|
|
12
12
|
"如果满意请给好评哦~":"Если вы удовлетворены, пожалуйста, оставьте хороший отзыв~",
|
|
13
13
|
"请对本次服务进行评价": "Оцените обслуживание",
|
|
14
14
|
"提交评价": "Отправить оценку",
|
|
15
|
+
"服务评价": "Оценка услуги",
|
|
15
16
|
"并发限制": "В данный момент слишком много пользователей. Попробуйте позже",
|
|
16
17
|
"分支选项异常": "Содержимое аномально, пожалуйста, проверьте конфигурацию потока задач"
|
|
17
18
|
}
|
package/locales/th/aidesk.ts
CHANGED
|
@@ -12,6 +12,7 @@ const AIDesk = {
|
|
|
12
12
|
"如果满意请给好评哦~": "หากพอใจแล้วก็อย่าลืมรีวิวให้ด้วยนะ~",
|
|
13
13
|
"请对本次服务进行评价": "กรุณาประเมินบริการครั้งนี้",
|
|
14
14
|
"提交评价": "ส่งการประเมิน",
|
|
15
|
+
"服务评价": "การประเมินบริการ",
|
|
15
16
|
"并发限制": "ปัจจุบันมีผู้ใช้งานจำนวนมาก กรุณาลองใหม่ในภายหลัง",
|
|
16
17
|
"分支选项异常": "เนื้อหาผิดปกติ กรุณาตรวจสอบการตั้งค่ากระบวนการงาน"
|
|
17
18
|
}
|
package/locales/vi/aidesk.ts
CHANGED
|
@@ -12,6 +12,7 @@ const AIDesk = {
|
|
|
12
12
|
"如果满意请给好评哦~":"Nếu bạn hài lòng, hãy cho chúng tôi một đánh giá tốt nhé~",
|
|
13
13
|
"请对本次服务进行评价": "Vui lòng đánh giá dịch vụ này",
|
|
14
14
|
"提交评价": "Gửi đánh giá",
|
|
15
|
+
"服务评价": " Đánh giá dịch vụ",
|
|
15
16
|
"并发限制": "Hiện có quá nhiều người đang truy cập. Vui lòng thử lại sau",
|
|
16
17
|
"分支选项异常": "Nội dung bất thường, vui lòng kiểm tra cấu hình luồng tác vụ"
|
|
17
18
|
}
|
package/locales/zh_cn/aidesk.ts
CHANGED
package/locales/zh_tw/aidesk.ts
CHANGED
package/package.json
CHANGED
package/server.ts
CHANGED
|
@@ -17,6 +17,9 @@ import TUIChatEngine, {
|
|
|
17
17
|
import Log from './utils/logger';
|
|
18
18
|
import { version } from './package.json'
|
|
19
19
|
import { Toast, TOAST_TYPE } from "./components/common/Toast/index-web";
|
|
20
|
+
import { switchReadStatus } from "./utils/utils";
|
|
21
|
+
import state from "./utils/state";
|
|
22
|
+
import { USER_DEFAULT_AVATAR } from "./constant";
|
|
20
23
|
|
|
21
24
|
interface IInitWithProfile {
|
|
22
25
|
SDKAppID: number,
|
|
@@ -43,7 +46,7 @@ export default class TUICustomerServer {
|
|
|
43
46
|
this.customerServiceAccounts = ['@customer_service_account'];
|
|
44
47
|
this.isLoggedIn = false;
|
|
45
48
|
this.loggedInUserID = '';
|
|
46
|
-
this.myProfile = {};
|
|
49
|
+
this.myProfile = { avatar: USER_DEFAULT_AVATAR };
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
static getInstance(): TUICustomerServer {
|
|
@@ -65,6 +68,7 @@ export default class TUICustomerServer {
|
|
|
65
68
|
this.isLoggedIn = true;
|
|
66
69
|
this.loggedInUserID = userID;
|
|
67
70
|
TUIConversationService.switchConversation('C2C@customer_service_account');
|
|
71
|
+
switchReadStatus(state.get('showReadStatus'));
|
|
68
72
|
TUIChatEngine.chat.callExperimentalAPI('isFeatureEnabledForStat', Math.pow(2, 42));
|
|
69
73
|
})
|
|
70
74
|
.catch((error) => {
|