@tencentcloud/ai-desk-customer-vue 1.5.10 → 1.5.11
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 +9 -1
- package/README.md +103 -77
- package/README_EN.md +873 -0
- package/components/CustomerServiceChat/chat-header/index-web.vue +41 -10
- package/components/CustomerServiceChat/feedback-modal/index.vue +1 -1
- package/components/CustomerServiceChat/index-web.vue +3 -1
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/marked.ts +1 -1
- package/components/CustomerServiceChat/message-toolbar-button/index.vue +11 -6
- package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-end-human-service.vue +16 -5
- package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-human-service.vue +8 -5
- package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-service-rating.vue +8 -5
- package/interface.ts +8 -0
- package/package.json +1 -1
- package/utils/utils.ts +13 -0
package/README_EN.md
ADDED
|
@@ -0,0 +1,873 @@
|
|
|
1
|
+
[简体中文](./README.md) / [English](./README_EN.md)
|
|
2
|
+
## Introduction
|
|
3
|
+
|
|
4
|
+
Customer Service Desk Web UIKit. Using this UIKit, you can integrate the capabilities of Customer Service into your Web or Hybrid projects within one day. Minimize the integration, and use AI to increase revenue and improve efficiency for your products.
|
|
5
|
+
|
|
6
|
+
## Preview
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## Customer Service Desk
|
|
11
|
+
|
|
12
|
+
For more detailed information about Customer Service Desk, please visit [Tencent Cloud Customer Service Desk](https://www.tencentcloud.com/document/product/1229/72679?lang=en&pg=).
|
|
13
|
+
|
|
14
|
+
## Developer Environment Requirements
|
|
15
|
+
- Vue (fully support Vue2 & Vue3, please choose your matched Vue version access guide when accessing below)
|
|
16
|
+
|
|
17
|
+
- TypeScript (if you are a JavaScript Project, please see [Common Issues - How to integrate TUIKit component in a JavaScript project](https://write.woa.com/#0404ab84-2adf-41d1-80a9-c636f742a371) to configure TypeScript Progressive Support)
|
|
18
|
+
|
|
19
|
+
- sass (sass-loader version ≤ 10.1.1)
|
|
20
|
+
|
|
21
|
+
- node(node.js ≥ 16.0.0)
|
|
22
|
+
|
|
23
|
+
- npm (version should match the node version)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## UIKit Integration
|
|
27
|
+
|
|
28
|
+
### Step 1: Project Creation
|
|
29
|
+
|
|
30
|
+
Supports the use of [webpack](#vue-cli) or [vite](vite) to create a project, configured with Vue3/Vue2 + TypeScript + sass. The following is several project setup examples:
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<span id="vue-cli"></span>
|
|
34
|
+
#### vue-cli
|
|
35
|
+
|
|
36
|
+
> **Note:**
|
|
37
|
+
>
|
|
38
|
+
> 1. Ensure your `@vue/cli` version is above **5.0.0**. You can use the following example code to upgrade `@vue/cli` to v5.0.8.
|
|
39
|
+
> 2. If your project was created with a `@vue/cli` lower version, and there is an error after seamless integration with UIKit, see [common issues](https://write.woa.com/#04a7d474-e04a-4765-910f-9bbfe4e3ced9) for problem-solving.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Create a project using vue-cli, configured with Vue2/Vue3 + TypeScript + sass.
|
|
43
|
+
|
|
44
|
+
If you have not installed vue-cli or the vue-cli version is lower than 5.0.0, you can install it in terminal or cmd in the following ways:
|
|
45
|
+
|
|
46
|
+
``` bash
|
|
47
|
+
npm install -g @vue/cli@5.0.8 sass sass-loader@10.1.1
|
|
48
|
+
```
|
|
49
|
+
Create a project using vue-cli and choose the selected configuration in the figure below.
|
|
50
|
+
|
|
51
|
+
``` bash
|
|
52
|
+
vue create ai-desk-example
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Ensure to select the following configuration:
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
After creation, switch to the project directory.
|
|
60
|
+
``` bash
|
|
61
|
+
cd ai-desk-example
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If you are a vue 2 project, configure the environment based on the vue version used by you. Ignore it for vue 3 projects.
|
|
65
|
+
|
|
66
|
+
##### vue2.7
|
|
67
|
+
``` bash
|
|
68
|
+
npm i vue@2.7.9 vue-template-compiler@2.7.9
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
##### Vue 2.6 and Below
|
|
72
|
+
``` bash
|
|
73
|
+
npm i @vue/composition-api unplugin-vue2-script-setup vue@2.6.14 vue-template-compiler@2.6.14
|
|
74
|
+
```
|
|
75
|
+
<span id="vite"></span>
|
|
76
|
+
#### vite
|
|
77
|
+
|
|
78
|
+
> **Note:**
|
|
79
|
+
>
|
|
80
|
+
> Warning: Vite requires [**Node.js**](https://nodejs.org/en/)** version 18+ or 20+.** When your package manager issues a warning, please upgrade your Node Version. For details, refer to [Vite Official Website](https://cn.vitejs.dev/guide/).
|
|
81
|
+
|
|
82
|
+
Create a project using vite, configured with Vue + TypeScript as the figure below.
|
|
83
|
+
``` bash
|
|
84
|
+
npm create vite@latest
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+

|
|
88
|
+
|
|
89
|
+
Switch to the project directory afterward and install the project dependencies.
|
|
90
|
+
``` bash
|
|
91
|
+
cd ai-desk-example
|
|
92
|
+
npm install
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Install plugin required sass environment dependency.
|
|
96
|
+
``` bash
|
|
97
|
+
npm i -D sass sass-loader
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Purge default project styles to avoid styling issues.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
###### MacOS
|
|
104
|
+
``` bash
|
|
105
|
+
echo -n > src/style.css
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
###### Windows (PowerShell)
|
|
109
|
+
``` bash
|
|
110
|
+
Clear-Content -Path src/style.css
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
###### Windows (CMD)
|
|
114
|
+
``` bash
|
|
115
|
+
echo. > src\style.css
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Step 2: Download UI Component
|
|
119
|
+
|
|
120
|
+
Download the UI component via npm and copy it to the src directory of your project.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
#### MacOS
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
``` bash
|
|
128
|
+
npm i @tencentcloud/ai-desk-customer-vue@latest
|
|
129
|
+
|
|
130
|
+
mkdir -p ./src/ai-desk-customer-vue && rsync -av --exclude={'node_modules','excluded-list.txt'} ./node_modules/@tencentcloud/ai-desk-customer-vue/ ./src/ai-desk-customer-vue
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Windows (CMD)
|
|
134
|
+
|
|
135
|
+
``` bash
|
|
136
|
+
npm i @tencentcloud/ai-desk-customer-vue@latest
|
|
137
|
+
|
|
138
|
+
xcopy .\node_modules\@tencentcloud\ai-desk-customer-vue .\src\ai-desk-customer-vue /i /e /exclude:.\node_modules\@tencentcloud\ai-desk-customer-vue\excluded-list.txt
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Step 3: Import UI Component
|
|
142
|
+
|
|
143
|
+
##### You can simply use the UI components on the page that needs to be displayed.
|
|
144
|
+
|
|
145
|
+
##### For example, by implementing the following code in the App.vue file, you can quickly set up a customer service consultation interface (the following example code is supported on both Web and H5 platforms):
|
|
146
|
+
|
|
147
|
+
> **Note:**
|
|
148
|
+
>
|
|
149
|
+
> The following example code uses setup syntax. If your project does not use setup syntax, please register the component according to the standard method of Vue3/Vue2.
|
|
150
|
+
|
|
151
|
+
###### vue3
|
|
152
|
+
``` javascript
|
|
153
|
+
<template>
|
|
154
|
+
<CustomerServiceChat
|
|
155
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
156
|
+
/>
|
|
157
|
+
</template>
|
|
158
|
+
<script setup lang="ts">
|
|
159
|
+
import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
160
|
+
import { onMounted } from "vue";
|
|
161
|
+
|
|
162
|
+
onMounted(() => {
|
|
163
|
+
const SDKAppID = 0; // Your SDKAppID, the application ID with customer service Desk enabled
|
|
164
|
+
const userID = ''; // Your userID, reusable account system of your app or randomly generated
|
|
165
|
+
const userSig = ''; // Your userSig, can be generated by the console during the integration stage, and must be generated by the server during the production stage
|
|
166
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
167
|
+
});
|
|
168
|
+
</script>
|
|
169
|
+
<style scoped>
|
|
170
|
+
</style>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
###### vue2.7
|
|
174
|
+
``` javascript
|
|
175
|
+
<template>
|
|
176
|
+
<div id="app">
|
|
177
|
+
<CustomerServiceChat
|
|
178
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
</template>
|
|
182
|
+
<script lang="ts" setup>
|
|
183
|
+
import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
184
|
+
import vue from './ai-desk-customer-vue/adapter-vue';
|
|
185
|
+
|
|
186
|
+
const { onMounted } = vue;
|
|
187
|
+
|
|
188
|
+
onMounted(() => {
|
|
189
|
+
const SDKAppID = 0; // Your SDKAppID
|
|
190
|
+
const userID = ''; // Your userID
|
|
191
|
+
const userSig = ''; // Your userSig
|
|
192
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
193
|
+
});
|
|
194
|
+
</script>
|
|
195
|
+
<style lang="scss">
|
|
196
|
+
</style>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### Vue 2.6 and Below
|
|
200
|
+
``` javascript
|
|
201
|
+
<template>
|
|
202
|
+
<div id="app">
|
|
203
|
+
<CustomerServiceChat
|
|
204
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
</template>
|
|
208
|
+
<script lang="ts" setup>
|
|
209
|
+
import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
210
|
+
import vue from './ai-desk-customer-vue/adapter-vue';
|
|
211
|
+
|
|
212
|
+
const { onMounted } = vue;
|
|
213
|
+
|
|
214
|
+
onMounted(() => {
|
|
215
|
+
const SDKAppID = 0; // Your SDKAppID
|
|
216
|
+
const userID = ''; // Your userID
|
|
217
|
+
const userSig = ''; // Your userSig
|
|
218
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
219
|
+
});
|
|
220
|
+
</script>
|
|
221
|
+
<style lang="scss">
|
|
222
|
+
</style>
|
|
223
|
+
```
|
|
224
|
+
1. Introduce VueCompositionAPI in `main.ts/main.js`.
|
|
225
|
+
|
|
226
|
+
``` javascript
|
|
227
|
+
import VueCompositionAPI from "@vue/composition-api";
|
|
228
|
+
Vue.use(VueCompositionAPI);
|
|
229
|
+
```
|
|
230
|
+
2. Add in `vue.config.js`. If not, please create this file.
|
|
231
|
+
|
|
232
|
+
``` javascript
|
|
233
|
+
const ScriptSetup = require("unplugin-vue2-script-setup/webpack").default;
|
|
234
|
+
module.exports = {
|
|
235
|
+
parallel: false, // disable thread-loader, which is not compactible with this plugin
|
|
236
|
+
configureWebpack: {
|
|
237
|
+
plugins: [
|
|
238
|
+
ScriptSetup({
|
|
239
|
+
/* options */
|
|
240
|
+
}),
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
chainWebpack(config) {
|
|
244
|
+
// disable type check and let `vue-tsc` handles it
|
|
245
|
+
config.plugins.delete("fork-ts-checker");
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
```
|
|
249
|
+
3. At the end of the `src/ai-desk-customer-vue/adapter-vue-web.ts` file, replace export source:
|
|
250
|
+
|
|
251
|
+
``` javascript
|
|
252
|
+
// Initial writing
|
|
253
|
+
export * from "vue";
|
|
254
|
+
// replace with
|
|
255
|
+
export * from "@vue/composition-api";
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Step 4: Obtain SDKAppID, UserID, UserSig
|
|
259
|
+
|
|
260
|
+
Set the `SDKAppID`, `userID`, and `userSig` in `App.vue`.
|
|
261
|
+
- SDKAppID information can be obtained by clicking Application Management > Add application in the Cloud Contact Center console and choosing Customer Service Desk > Add application, and then enabling Customer Service.
|
|
262
|
+
|
|
263
|
+

|
|
264
|
+
|
|
265
|
+

|
|
266
|
+
|
|
267
|
+
- userID information. A random string can be locally generated, such as test-1234.
|
|
268
|
+
|
|
269
|
+
> **Note:**
|
|
270
|
+
>
|
|
271
|
+
> - userID can only contain printable ASCII characters
|
|
272
|
+
> - userID cannot contain the string `administrator`.
|
|
273
|
+
> - userID cannot contain the ID of a customer service agent.
|
|
274
|
+
> - userID length cannot exceed 45 bytes.
|
|
275
|
+
|
|
276
|
+
- userSig info, click [UserSig Tools](https://console.tencentcloud.com/ccc/tool-usersig), fill in the created userID to generate userSig.
|
|
277
|
+
|
|
278
|
+

|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
### Step 5: Start a Project, initiate your first customer service inquiry
|
|
282
|
+
|
|
283
|
+
Execute the following command to start the project.
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
#### vue-cli
|
|
287
|
+
|
|
288
|
+
> **Note:**
|
|
289
|
+
>
|
|
290
|
+
> Since vue-cli enables webpack global overlay error message prompts by default, for a better experience, **it is recommended to disable global overlay error prompts.**
|
|
291
|
+
>
|
|
292
|
+
> Add the following code to vue.config.js
|
|
293
|
+
>
|
|
294
|
+
> ##### Webpack4 and Above
|
|
295
|
+
> `module.exports = defineConfig({`
|
|
296
|
+
> ` devServer: {`
|
|
297
|
+
> ` client: {`
|
|
298
|
+
> ` overlay: false,`
|
|
299
|
+
> ` },`
|
|
300
|
+
> ` },`
|
|
301
|
+
> `});`
|
|
302
|
+
> ##### webpack3
|
|
303
|
+
> `module.exports = {`
|
|
304
|
+
> ` devServer: {`
|
|
305
|
+
> ` overlay: false,`
|
|
306
|
+
> ` },`
|
|
307
|
+
> `};`
|
|
308
|
+
>
|
|
309
|
+
> Disable TypeScript detection for ai-desk-customer-vue in tsconfig.json.
|
|
310
|
+
>
|
|
311
|
+
> `{`
|
|
312
|
+
> ` "exclude": [`
|
|
313
|
+
> ` "node_modules",`
|
|
314
|
+
> ` "src/ai-desk-customer-vue",`
|
|
315
|
+
> ` ]`
|
|
316
|
+
> `}`
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
``` bash
|
|
320
|
+
npm run serve
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### vite
|
|
324
|
+
|
|
325
|
+
``` bash
|
|
326
|
+
npm run dev
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Advanced Feature
|
|
330
|
+
|
|
331
|
+
### Internationalized Interface
|
|
332
|
+
|
|
333
|
+
UIKit components support the following languages:
|
|
334
|
+
<table>
|
|
335
|
+
<tr>
|
|
336
|
+
<td rowspan="1" colSpan="1" >Language Code (UserLang)</td>
|
|
337
|
+
|
|
338
|
+
<td rowspan="1" colSpan="1" >Language</td>
|
|
339
|
+
</tr>
|
|
340
|
+
|
|
341
|
+
<tr>
|
|
342
|
+
<td rowspan="1" colSpan="1" >zh_cn</td>
|
|
343
|
+
|
|
344
|
+
<td rowspan="1" colSpan="1" >Simplified Chinese</td>
|
|
345
|
+
</tr>
|
|
346
|
+
|
|
347
|
+
<tr>
|
|
348
|
+
<td rowspan="1" colSpan="1" >en</td>
|
|
349
|
+
|
|
350
|
+
<td rowspan="1" colSpan="1" >English</td>
|
|
351
|
+
</tr>
|
|
352
|
+
|
|
353
|
+
<tr>
|
|
354
|
+
<td rowspan="1" colSpan="1" >zh_tw</td>
|
|
355
|
+
|
|
356
|
+
<td rowspan="1" colSpan="1" >Traditional Chinese</td>
|
|
357
|
+
</tr>
|
|
358
|
+
|
|
359
|
+
<tr>
|
|
360
|
+
<td rowspan="1" colSpan="1" >ja</td>
|
|
361
|
+
|
|
362
|
+
<td rowspan="1" colSpan="1" >Japanese</td>
|
|
363
|
+
</tr>
|
|
364
|
+
|
|
365
|
+
<tr>
|
|
366
|
+
<td rowspan="1" colSpan="1" >id</td>
|
|
367
|
+
|
|
368
|
+
<td rowspan="1" colSpan="1" >Indonesian</td>
|
|
369
|
+
</tr>
|
|
370
|
+
|
|
371
|
+
<tr>
|
|
372
|
+
<td rowspan="1" colSpan="1" >ms</td>
|
|
373
|
+
|
|
374
|
+
<td rowspan="1" colSpan="1" >Malaysian</td>
|
|
375
|
+
</tr>
|
|
376
|
+
|
|
377
|
+
<tr>
|
|
378
|
+
<td rowspan="1" colSpan="1" >vi</td>
|
|
379
|
+
|
|
380
|
+
<td rowspan="1" colSpan="1" >Vietnamese</td>
|
|
381
|
+
</tr>
|
|
382
|
+
|
|
383
|
+
<tr>
|
|
384
|
+
<td rowspan="1" colSpan="1" >th</td>
|
|
385
|
+
|
|
386
|
+
<td rowspan="1" colSpan="1" >Thai</td>
|
|
387
|
+
</tr>
|
|
388
|
+
|
|
389
|
+
<tr>
|
|
390
|
+
<td rowspan="1" colSpan="1" >fil</td>
|
|
391
|
+
|
|
392
|
+
<td rowspan="1" colSpan="1" >Filipino</td>
|
|
393
|
+
</tr>
|
|
394
|
+
|
|
395
|
+
<tr>
|
|
396
|
+
<td rowspan="1" colSpan="1" >ru</td>
|
|
397
|
+
|
|
398
|
+
<td rowspan="1" colSpan="1" >Russian</td>
|
|
399
|
+
</tr>
|
|
400
|
+
</table>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
If your business needs to go global and the user language is mainly English, you can set `userLang="en"` when using customer service. If you do not specify `userLang`, UIKit will use the language in browser settings.
|
|
404
|
+
``` javascript
|
|
405
|
+
<template>
|
|
406
|
+
<CustomerServiceChat
|
|
407
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
408
|
+
userLang="en"
|
|
409
|
+
/>
|
|
410
|
+
</template>
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
If you need to support dynamic user language switching, use the `TUICustomerServer.changeLanguage` API and trigger a re-render by modifying the page/component key. This ensures language updates are applied immediately.
|
|
414
|
+
``` javascript
|
|
415
|
+
<template>
|
|
416
|
+
<CustomerServiceChat
|
|
417
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
418
|
+
:key="locale"
|
|
419
|
+
:userLang="locale"
|
|
420
|
+
/>
|
|
421
|
+
</template>
|
|
422
|
+
<script setup lang="ts">
|
|
423
|
+
import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
424
|
+
import { onMounted, ref } from "vue";
|
|
425
|
+
|
|
426
|
+
const locale = ref('en');
|
|
427
|
+
|
|
428
|
+
const changeLanguage = (language: string) => {
|
|
429
|
+
TUICustomerServer.changeLanguage(language).then(() => {
|
|
430
|
+
locale.value = language;
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
</script>
|
|
434
|
+
<style scoped lang="scss">
|
|
435
|
+
</style>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Client-Side Login with Nickname and Avatar
|
|
439
|
+
|
|
440
|
+
If the agent wants to see the user's nickname, avatar, and other information during reception on the workstation to enhance communication efficiency, the effect is as shown below:
|
|
441
|
+
|
|
442
|
+

|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
Please use the `initWithProfile` API to initialize, input Nickname and avatar just.
|
|
446
|
+
``` javascript
|
|
447
|
+
TUICustomerServer.initWithProfile({
|
|
448
|
+
SDKAppID,
|
|
449
|
+
userID,
|
|
450
|
+
userSig,
|
|
451
|
+
nickName: 'John 1852010****',
|
|
452
|
+
avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'
|
|
453
|
+
})
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Toolbar Button
|
|
457
|
+
|
|
458
|
+
If you want to add shortcut buttons above the input box to facilitate users' use, such as adding "transfer to agent" and "Order message", you can set `toolbarButtonList` when deploying Desk UIKit. The effect is as shown below:
|
|
459
|
+
|
|
460
|
+
<img src="https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100028039218/5ae4403a7cdd11f0bd33525400454e06.png" width="450px"></img>
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
`toolbarButtonList` is an array containing one or more items. The description is as follows:
|
|
464
|
+
<table>
|
|
465
|
+
<tr>
|
|
466
|
+
<td rowspan="1" colSpan="1" >Parameter</td>
|
|
467
|
+
|
|
468
|
+
<td rowspan="1" colSpan="1" >Type</td>
|
|
469
|
+
|
|
470
|
+
<td rowspan="1" colSpan="1" >Required or Not</td>
|
|
471
|
+
|
|
472
|
+
<td rowspan="1" colSpan="1" >Description</td>
|
|
473
|
+
</tr>
|
|
474
|
+
|
|
475
|
+
<tr>
|
|
476
|
+
<td rowspan="1" colSpan="1" >title</td>
|
|
477
|
+
|
|
478
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
479
|
+
|
|
480
|
+
<td rowspan="1" colSpan="1" >Yes</td>
|
|
481
|
+
|
|
482
|
+
<td rowspan="1" colSpan="1" >button Title</td>
|
|
483
|
+
</tr>
|
|
484
|
+
|
|
485
|
+
<tr>
|
|
486
|
+
<td rowspan="1" colSpan="1" >icon</td>
|
|
487
|
+
|
|
488
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
489
|
+
|
|
490
|
+
<td rowspan="1" colSpan="1" >No</td>
|
|
491
|
+
|
|
492
|
+
<td rowspan="1" colSpan="1" >Button Icon URL</td>
|
|
493
|
+
</tr>
|
|
494
|
+
|
|
495
|
+
<tr>
|
|
496
|
+
<td rowspan="1" colSpan="1" >isPreset</td>
|
|
497
|
+
|
|
498
|
+
<td rowspan="1" colSpan="1" >Number</td>
|
|
499
|
+
|
|
500
|
+
<td rowspan="1" colSpan="1" >Yes</td>
|
|
501
|
+
|
|
502
|
+
<td rowspan="1" colSpan="1" >- 1: Built-in feature of the customer service component.<br>- 0: Non-built-in feature.</td>
|
|
503
|
+
</tr>
|
|
504
|
+
|
|
505
|
+
<tr>
|
|
506
|
+
<td rowspan="1" colSpan="1" >presetId</td>
|
|
507
|
+
|
|
508
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
509
|
+
|
|
510
|
+
<td rowspan="1" colSpan="1" >No</td>
|
|
511
|
+
|
|
512
|
+
<td rowspan="1" colSpan="1" >When isPreset is 1, valid values include:<br>- humanService: manual service.<br>- serviceRating: service evaluation<br>- endHumanService: End the session.</td>
|
|
513
|
+
</tr>
|
|
514
|
+
|
|
515
|
+
<tr>
|
|
516
|
+
<td rowspan="1" colSpan="1" >isEnabled</td>
|
|
517
|
+
|
|
518
|
+
<td rowspan="1" colSpan="1" >Number</td>
|
|
519
|
+
|
|
520
|
+
<td rowspan="1" colSpan="1" >Yes</td>
|
|
521
|
+
|
|
522
|
+
<td rowspan="1" colSpan="1" >- 1: Render.<br>- 0: No render.</td>
|
|
523
|
+
</tr>
|
|
524
|
+
|
|
525
|
+
<tr>
|
|
526
|
+
<td rowspan="1" colSpan="1" >content</td>
|
|
527
|
+
|
|
528
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
529
|
+
|
|
530
|
+
<td rowspan="1" colSpan="1" >No</td>
|
|
531
|
+
|
|
532
|
+
<td rowspan="1" colSpan="1" >When isPreset is 0, please fill in text content or url.</td>
|
|
533
|
+
</tr>
|
|
534
|
+
|
|
535
|
+
<tr>
|
|
536
|
+
<td rowspan="1" colSpan="1" >type</td>
|
|
537
|
+
|
|
538
|
+
<td rowspan="1" colSpan="1" >Number</td>
|
|
539
|
+
|
|
540
|
+
<td rowspan="1" colSpan="1" >Yes</td>
|
|
541
|
+
|
|
542
|
+
<td rowspan="1" colSpan="1" >- 1: the component sends the corresponding text of the content.<br>- 2: the component opens the corresponding url.<br>- **3 - trigger the specified task flow.**<br>- **4 -transfer to the specified agents or specified agent group.**</td>
|
|
543
|
+
</tr>
|
|
544
|
+
</table>
|
|
545
|
+
|
|
546
|
+
``` javascript
|
|
547
|
+
<template>
|
|
548
|
+
<CustomerServiceChat
|
|
549
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
550
|
+
:toolbarButtonList="toolbarButtonList"
|
|
551
|
+
/>
|
|
552
|
+
</template>
|
|
553
|
+
<script setup lang="ts">
|
|
554
|
+
import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
555
|
+
import { onMounted } from 'vue';
|
|
556
|
+
|
|
557
|
+
const toolbarButtonList = [
|
|
558
|
+
{"title":"manual service","icon":"https://tccc-im-agent-avatar-1258344699.cos.ap-nanjing.myqcloud.com/toolbar_button_1.png","type":1,"content":"","isPreset":1,"presetId":"humanService","isEnabled":1},
|
|
559
|
+
{"title":"service evaluation","icon":"https://tccc-im-agent-avatar-sg-1258344699.cos.ap-singapore.myqcloud.com/toolbar_button_2.png","type":1,"content":"","isPreset":1,"presetId":"serviceRating","isEnabled":1},
|
|
560
|
+
{"title":"End Session","icon":"https://tccc-im-agent-avatar-sg-1258344699.cos.ap-singapore.myqcloud.com/toolbar_button_3.png","type":1,"content":"","isPreset":1,"presetId":"endHumanService","isEnabled":1},
|
|
561
|
+
// Send text
|
|
562
|
+
{"title":"smart customer service","type":1,"content":"smart customer service","isPreset":0,"isEnabled":1},
|
|
563
|
+
// Trigger the specified task flow, taskFlowID is the task flow id, if description is empty it will not be displayed in the message list
|
|
564
|
+
{"title":"Trigger the specified task flow","type":3,"content":{"taskFlowID":3226, "description":"your description"},"isPreset":0,"isEnabled":1},
|
|
565
|
+
// Transfer to specified agents, specificMemberList is the agent account list
|
|
566
|
+
{"title":"Transfer to specified agent","type":4,"content":{"specificMemberList":["agent_01@email.com"], "description":"your description"},"isPreset":0,"isEnabled":1},
|
|
567
|
+
// Transfer to specified agent group, groupID is the customer service agent group ID
|
|
568
|
+
{"title":"Transfer to specified agent group","type":4,"content":{"groupID":111, "description":"your description"},"isPreset":0,"isEnabled":1}
|
|
569
|
+
];
|
|
570
|
+
|
|
571
|
+
onMounted(() => {
|
|
572
|
+
const SDKAppID = 0; // Your SDKAppID, the application ID with customer service Desk enabled
|
|
573
|
+
const userID = ''; // Your userID, reusable account system of your app or randomly generated
|
|
574
|
+
const userSig = ''; // Your userSig, can be generated by the console during the integration stage, and must be generated by the server during the production stage
|
|
575
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
576
|
+
});
|
|
577
|
+
</script>
|
|
578
|
+
<style scoped>
|
|
579
|
+
</style>
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Bottom Quick Order
|
|
583
|
+
|
|
584
|
+
> **Note:**
|
|
585
|
+
>
|
|
586
|
+
> Upgrade [ai-desk-customer-vue](https://www.npmjs.com/package/@tencentcloud/ai-desk-customer-vue) to v1.5.2 or higher.
|
|
587
|
+
>
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
If you want to show a quick order at the bottom of the chat area when opening a customer service conversation, you can configure `bottomQuickOrder`. The effect is as shown below:
|
|
591
|
+
|
|
592
|
+
<img src="https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100028039218/b214a6697cde11f0bd33525400454e06.png" width="400px"></img>
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
`Parameter description of bottomQuickOrder` is as follows:
|
|
596
|
+
<table>
|
|
597
|
+
<tr>
|
|
598
|
+
<td rowspan="1" colSpan="1" >Parameter</td>
|
|
599
|
+
|
|
600
|
+
<td rowspan="1" colSpan="1" >Type</td>
|
|
601
|
+
|
|
602
|
+
<td rowspan="1" colSpan="1" >Required or Not</td>
|
|
603
|
+
|
|
604
|
+
<td rowspan="1" colSpan="1" >Description</td>
|
|
605
|
+
</tr>
|
|
606
|
+
|
|
607
|
+
<tr>
|
|
608
|
+
<td rowspan="1" colSpan="1" >header</td>
|
|
609
|
+
|
|
610
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
611
|
+
|
|
612
|
+
<td rowspan="1" colSpan="1" >Yes</td>
|
|
613
|
+
|
|
614
|
+
<td rowspan="1" colSpan="1" >Order title, corresponding to "Product Card" in the image above.</td>
|
|
615
|
+
</tr>
|
|
616
|
+
|
|
617
|
+
<tr>
|
|
618
|
+
<td rowspan="1" colSpan="1" >desc</td>
|
|
619
|
+
|
|
620
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
621
|
+
|
|
622
|
+
<td rowspan="1" colSpan="1" >Yes</td>
|
|
623
|
+
|
|
624
|
+
<td rowspan="1" colSpan="1" >Order description, corresponding to "$30" in the image above.</td>
|
|
625
|
+
</tr>
|
|
626
|
+
|
|
627
|
+
<tr>
|
|
628
|
+
<td rowspan="1" colSpan="1" >pic</td>
|
|
629
|
+
|
|
630
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
631
|
+
|
|
632
|
+
<td rowspan="1" colSpan="1" >No</td>
|
|
633
|
+
|
|
634
|
+
<td rowspan="1" colSpan="1" >Order image url.</td>
|
|
635
|
+
</tr>
|
|
636
|
+
|
|
637
|
+
<tr>
|
|
638
|
+
<td rowspan="1" colSpan="1" >url</td>
|
|
639
|
+
|
|
640
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
641
|
+
|
|
642
|
+
<td rowspan="1" colSpan="1" >Yes</td>
|
|
643
|
+
|
|
644
|
+
<td rowspan="1" colSpan="1" >When the customer service agent receives the order message, click to open the webpage corresponding to this url.</td>
|
|
645
|
+
</tr>
|
|
646
|
+
|
|
647
|
+
<tr>
|
|
648
|
+
<td rowspan="1" colSpan="1" >customField</td>
|
|
649
|
+
|
|
650
|
+
<td rowspan="1" colSpan="1" >Array</td>
|
|
651
|
+
|
|
652
|
+
<td rowspan="1" colSpan="1" >No</td>
|
|
653
|
+
|
|
654
|
+
<td rowspan="1" colSpan="1" >Custom configuration, such as "order ID", "order time", etc.</td>
|
|
655
|
+
</tr>
|
|
656
|
+
</table>
|
|
657
|
+
|
|
658
|
+
``` javascript
|
|
659
|
+
<template>
|
|
660
|
+
<CustomerServiceChat
|
|
661
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
662
|
+
:bottomQuickOrder="bottomQuickOrder"
|
|
663
|
+
/>
|
|
664
|
+
</template>
|
|
665
|
+
<script setup lang="ts">
|
|
666
|
+
import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
667
|
+
import { onMounted } from 'vue';
|
|
668
|
+
|
|
669
|
+
const bottomQuickOrder = {
|
|
670
|
+
header: "Product Card",
|
|
671
|
+
desc: "$30",
|
|
672
|
+
pic: "https://cloudcache.tencent-cloud.com/qcloud/portal/kit/images/presale.a4955999.jpeg",
|
|
673
|
+
url: 'https://your_url.com',
|
|
674
|
+
customField: [
|
|
675
|
+
{
|
|
676
|
+
name: 'Order ID',
|
|
677
|
+
value: '11111111111111111111'
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: 'Order Time',
|
|
681
|
+
value: '2025-07-02 16:23'
|
|
682
|
+
}
|
|
683
|
+
]
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
onMounted(() => {
|
|
687
|
+
const SDKAppID = 0; // Your SDKAppID
|
|
688
|
+
const userID = ''; // Your userID
|
|
689
|
+
const userSig = ''; // Your userSig
|
|
690
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
691
|
+
});
|
|
692
|
+
</script>
|
|
693
|
+
<style scoped>
|
|
694
|
+
</style>
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
### Transferring to Designated Agent or Agent Group
|
|
698
|
+
|
|
699
|
+
> **Note:**
|
|
700
|
+
>
|
|
701
|
+
> Upgrade [ai-desk-customer-vue](https://www.npmjs.com/package/@tencentcloud/ai-desk-customer-vue) to v1.5.6 or higher.
|
|
702
|
+
>
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
If your application needs to automatically transfer to a specified agent or agent group after logging in, see the following code implementation.
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
【Transfer to Designated Agent】
|
|
710
|
+
``` javascript
|
|
711
|
+
TUICustomerServer.initWithProfile({
|
|
712
|
+
SDKAppID,
|
|
713
|
+
userID,
|
|
714
|
+
userSig,
|
|
715
|
+
nickName: 'John 1852010****'
|
|
716
|
+
avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'
|
|
717
|
+
}).then(() => {
|
|
718
|
+
TUICustomerServer.transferToHuman({
|
|
719
|
+
specificMemberList: ['agent_account_1', 'agent_account_2'], // replace with your agent accounts
|
|
720
|
+
description: 'your description'
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
【Transfer to Agent Group】
|
|
726
|
+
``` javascript
|
|
727
|
+
TUICustomerServer.initWithProfile({
|
|
728
|
+
SDKAppID,
|
|
729
|
+
userID,
|
|
730
|
+
userSig,
|
|
731
|
+
nickName: 'John 1852010****'
|
|
732
|
+
avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'
|
|
733
|
+
}).then(() => {
|
|
734
|
+
TUICustomerServer.transferToHuman({
|
|
735
|
+
groupID: 0, // replace with your customer service agent group ID
|
|
736
|
+
description: 'your description'
|
|
737
|
+
});
|
|
738
|
+
});
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
### Trigger Specified Task Flow
|
|
742
|
+
|
|
743
|
+
> **Note:**
|
|
744
|
+
>
|
|
745
|
+
> Upgrade [ai-desk-customer-vue](https://www.npmjs.com/package/@tencentcloud/ai-desk-customer-vue) to v1.5.6 or higher.
|
|
746
|
+
>
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
If your application needs to automatically trigger the specified task flow after logging in, refer to the following code implementation.
|
|
750
|
+
``` javascript
|
|
751
|
+
TUICustomerServer.initWithProfile({
|
|
752
|
+
SDKAppID,
|
|
753
|
+
userID,
|
|
754
|
+
userSig,
|
|
755
|
+
nickName: 'John 1852010****'
|
|
756
|
+
avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'
|
|
757
|
+
}).then(() => {
|
|
758
|
+
TUICustomerServer.transferToTaskFlow({
|
|
759
|
+
taskFlowID: 0, // replace with your task flow id
|
|
760
|
+
description: 'your description'
|
|
761
|
+
});
|
|
762
|
+
});
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
### Multiple Customer Service Accounts
|
|
766
|
+
|
|
767
|
+
> **Note:**
|
|
768
|
+
>
|
|
769
|
+
> Upgrade [ai-desk-customer-vue](https://www.npmjs.com/package/@tencentcloud/ai-desk-customer-vue) to v1.5.3 or higher.
|
|
770
|
+
>
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
If your application requires multiple customer service accounts to provide users with exclusive customer service features for improved service quality and fast response speed, you can implement the Multiple Customer Service Accounts feature provided by UIKit.
|
|
774
|
+
``` javascript
|
|
775
|
+
// 1. Pass the custom customer service account ID from the business side to UIKit before initialization
|
|
776
|
+
TUICustomerServer.setCustomerServiceIDList(['customerServiceID_001', 'customerServiceID_002', 'customerServiceID_003']);
|
|
777
|
+
// 2. During initialization, include the customer service account ID to start conversation, such as 'customerServiceID_002'
|
|
778
|
+
// If no customer service account ID is specified to start conversation, UIKit uses the first element in the multiple customer service accounts list by default
|
|
779
|
+
TUICustomerServer.initWithProfile({
|
|
780
|
+
SDKAppID,
|
|
781
|
+
userID,
|
|
782
|
+
userSig,
|
|
783
|
+
nickName: 'John 1562010****',
|
|
784
|
+
avatar: 'your avatar url',
|
|
785
|
+
customerServiceID: 'customerServiceID_002',
|
|
786
|
+
});
|
|
787
|
+
```
|
|
788
|
+
|
|
789
|
+
> **Note:**
|
|
790
|
+
>
|
|
791
|
+
> To customize a customer service account, please use [REST API > Create Customer Service Account](https://www.tencentcloud.com/document/product/1229/68817).
|
|
792
|
+
>
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
### Client-Side Proactively Ending Conversation
|
|
796
|
+
|
|
797
|
+
> **Note:**
|
|
798
|
+
>
|
|
799
|
+
> The client-side can proactively end the conversation by sending a custom message, applicable to the following 3 cases:
|
|
800
|
+
>
|
|
801
|
+
> 1. User requests to transfer to agent and enters the queue. Sending this message can end the queue.
|
|
802
|
+
> 2. The customer service mode is manual service. After the user requests agent service and the customer service is successfully allocated, the user waits for the customer service to confirm the reception. Sending this message can end the wait.
|
|
803
|
+
> 3. Transfer to an agent and successfully connect to customer service. Send this message to end the conversation.
|
|
804
|
+
|
|
805
|
+
``` javascript
|
|
806
|
+
TUICustomerServer.sendCustomMessage({
|
|
807
|
+
to: '@customer_service_account',
|
|
808
|
+
conversationType: 'C2C',
|
|
809
|
+
payload: {
|
|
810
|
+
data: JSON.stringify({
|
|
811
|
+
src: '27',
|
|
812
|
+
customerServicePlugin: 0,
|
|
813
|
+
}),
|
|
814
|
+
},
|
|
815
|
+
}, { onlineUserOnly: true });
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
## FAQs
|
|
819
|
+
|
|
820
|
+
##### What Is UserSig? How do I Generate a UserSig?
|
|
821
|
+
|
|
822
|
+
UserSig is the password for user login to IM. It is essentially an encrypted ciphertext of UserID and other information.
|
|
823
|
+
|
|
824
|
+
The UserSig issuance method involves integrating the UserSig calculation code into your server and providing a project-oriented API. When UserSig is required, your project initiates a request to the business server to obtain a dynamic UserSig. For more details, see [UserSig generation by the server](https://www.tencentcloud.com/zh/document/product/1047/34385?lang=zh).
|
|
825
|
+
|
|
826
|
+
##### How to Integrate the UIKit Component Into a JS Project
|
|
827
|
+
|
|
828
|
+
UIKit only supports running in the ts environment. You can progressively configure typescript to allow existing js code in your project to coexist with ts code in UIKit.
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
##### vue-cli
|
|
833
|
+
|
|
834
|
+
Please execute in the project root directory created by your vue-cli scaffold:
|
|
835
|
+
``` bash
|
|
836
|
+
vue add typescript
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
Then configure the options as follows (to ensure simultaneous support for existing js code and ts code in UIKit, be sure to strictly follow the five options below)
|
|
840
|
+
|
|
841
|
+
**After completing the above steps, rerun the project.**
|
|
842
|
+
|
|
843
|
+
###### Vite
|
|
844
|
+
|
|
845
|
+
Please execute in the project root directory created by your vite.
|
|
846
|
+
``` bash
|
|
847
|
+
npm install -D typescript
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
##### Runtime Error: Uncaught TypeError: Marked__WEBPACK_IMPORTED_MODULE_0_ Marked Is Not a Constructor
|
|
851
|
+
|
|
852
|
+
If the following error occurs during operation, it means your current Vue CLI project environment version is low, and you must downgrade the marked version used in UIKit to 5.1.2.
|
|
853
|
+
|
|
854
|
+

|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
Please use the following script in your project root directory to downgrade the marked version:
|
|
858
|
+
``` bash
|
|
859
|
+
npm i marked@5.1.2 --legacy-peer-deps
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
##### Compilation Error: node_modules/marked/lib/marked.esm.js: Class private methods are not enabled.
|
|
863
|
+
|
|
864
|
+
If the following error occurs during operation, it means your current marked version is outdated. Please upgrade the marked version to 6.0.0.
|
|
865
|
+
|
|
866
|
+

|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
Please use the following script in your project root directory to upgrade the marked version:
|
|
870
|
+
``` bash
|
|
871
|
+
npm i marked@6.0.0 --legacy-peer-deps
|
|
872
|
+
```
|
|
873
|
+
|