@tencentcloud/ai-desk-customer-vue 0.1.3 → 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 +6 -14
- 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/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 +1 -1
- package/server.ts +2 -12
- 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
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const uglify = require('uglify-js')
|
|
2
|
-
const through2 = require('through2')
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @description 压缩内联 wxs 脚本
|
|
6
|
-
*/
|
|
7
|
-
function wxs () {
|
|
8
|
-
return through2.obj(function (file, _, callback) {
|
|
9
|
-
if (file.isBuffer()) {
|
|
10
|
-
file.contents = Buffer.from(file.contents.toString().replace(/<wxs(.*?)>([\s\S]+?)<\/wxs>/, (_, $1, $2) => {
|
|
11
|
-
return `<wxs${$1}>${uglify.minify($2, {
|
|
12
|
-
fromString: true,
|
|
13
|
-
mangle: {
|
|
14
|
-
toplevel: true
|
|
15
|
-
}
|
|
16
|
-
}).code}</wxs>`
|
|
17
|
-
}))
|
|
18
|
-
}
|
|
19
|
-
this.push(file)
|
|
20
|
-
callback()
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @description 压缩 json 文件
|
|
26
|
-
*/
|
|
27
|
-
function json () {
|
|
28
|
-
return through2.obj(function (file, _, callback) {
|
|
29
|
-
if (file.isBuffer()) {
|
|
30
|
-
file.contents = Buffer.from(JSON.stringify(JSON.parse(file.contents.toString())))
|
|
31
|
-
}
|
|
32
|
-
this.push(file)
|
|
33
|
-
callback()
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
module.exports = {
|
|
38
|
-
wxs,
|
|
39
|
-
json
|
|
40
|
-
}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview 处理插件
|
|
3
|
-
*/
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const through2 = require('through2')
|
|
6
|
-
|
|
7
|
-
const config = require('./config')
|
|
8
|
-
|
|
9
|
-
config.plugins.sort((a, b) => {
|
|
10
|
-
// editable 置于最后面
|
|
11
|
-
if (a === 'editable') return 1
|
|
12
|
-
if (b === 'editable') return -1
|
|
13
|
-
// markdown 置于最前面
|
|
14
|
-
if (a === 'markdown') return -1
|
|
15
|
-
if (b === 'markdown') return 1
|
|
16
|
-
// 剩余任意顺序
|
|
17
|
-
return 0
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
// 提取和替换标签名选择器(组件中仅支持 class 选择器)
|
|
21
|
-
const tagSelector = {}
|
|
22
|
-
let tagI = 0
|
|
23
|
-
if (config.externStyle) {
|
|
24
|
-
config.externStyle = config.externStyle.replace(/[^,\s}]+(?=[^}]*{)/g, $ => {
|
|
25
|
-
if (!/[a-zA-Z_]/.test($[0])) return $
|
|
26
|
-
if (tagSelector[$]) return '.' + tagSelector[$]
|
|
27
|
-
tagSelector[$] = '_' + tagI++
|
|
28
|
-
return '.' + tagSelector[$]
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
/**
|
|
34
|
-
* @description 构建插件
|
|
35
|
-
* @param {string} platform 使用平台
|
|
36
|
-
*/
|
|
37
|
-
build (platform) {
|
|
38
|
-
const builds = {} // 构建模块
|
|
39
|
-
let pluginImports = '' // 插件引入
|
|
40
|
-
let plugins = '' // 插件列表
|
|
41
|
-
let voidTags = '' // 增加的自闭合标签
|
|
42
|
-
let wxml = '' // 要引入到 node.wxml 中的内容
|
|
43
|
-
let js = '' // 要引入到 node.js 中的内容
|
|
44
|
-
let wxss = config.externStyle // 要引入到 node.wxss 中的内容
|
|
45
|
-
const json = {} // 要引入到 node.json 中的内容
|
|
46
|
-
|
|
47
|
-
// 收集插件中要写入模板文件的内容
|
|
48
|
-
for (let i = 0; i < config.plugins.length; i++) {
|
|
49
|
-
const plugin = config.plugins[i]
|
|
50
|
-
let build = {}
|
|
51
|
-
try {
|
|
52
|
-
// 专用 build
|
|
53
|
-
if (platform === 'uni-app') {
|
|
54
|
-
build = require(`../plugins/${plugin}/uni-app/build.js`)
|
|
55
|
-
} else {
|
|
56
|
-
build = require(`../plugins/${plugin}/miniprogram/build.js`)
|
|
57
|
-
}
|
|
58
|
-
} catch (e) { }
|
|
59
|
-
try {
|
|
60
|
-
// 通用 build
|
|
61
|
-
build = Object.assign(require(`../plugins/${plugin}/build.js`), build)
|
|
62
|
-
} catch (e) { }
|
|
63
|
-
// 可以在当前平台使用
|
|
64
|
-
if (!build.platform || build.platform.includes(platform)) {
|
|
65
|
-
builds[plugin] = build
|
|
66
|
-
if (platform === 'uni-app') {
|
|
67
|
-
plugins += plugin.replace(/-([a-z])/g, ($, $1) => $1.toUpperCase()) + ','
|
|
68
|
-
pluginImports += `import ${plugin.replace(/-([a-z])/g, ($, $1) => $1.toUpperCase())} from './${plugin}/${build.main ? build.main : 'index.js'}'\n`
|
|
69
|
-
} else {
|
|
70
|
-
plugins += `require('./${plugin}/${build.main ? build.main : 'index.js'}'),`
|
|
71
|
-
}
|
|
72
|
-
if (build.template) {
|
|
73
|
-
wxml += build.template.replace('wx:if', 'wx:elif').replace('v-if', 'v-else-if')
|
|
74
|
-
}
|
|
75
|
-
if (build.methods) {
|
|
76
|
-
for (const method in build.methods) {
|
|
77
|
-
js += build.methods[method].toString() + ','
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (build.usingComponents) {
|
|
81
|
-
Object.assign(json, build.usingComponents)
|
|
82
|
-
}
|
|
83
|
-
if (build.style) {
|
|
84
|
-
wxss += build.style
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// 加入其他自定义标签
|
|
90
|
-
for (const item of config.customElements) {
|
|
91
|
-
if (platform === 'uni-app') {
|
|
92
|
-
if (item.platforms) {
|
|
93
|
-
wxml += '<!-- #ifdef ' + item.platforms.join(' || ').toUpperCase() + ' -->'
|
|
94
|
-
}
|
|
95
|
-
voidTags += item.name + ','
|
|
96
|
-
wxml += '<' + item.name + ' v-else-if="n.name==\'' + item.name + '\'" :class="n.attrs.class" :style="n.attrs.style"'
|
|
97
|
-
if (item.attrs) {
|
|
98
|
-
for (const attr of item.attrs) {
|
|
99
|
-
wxml += ' :' + attr + '="n.attrs'
|
|
100
|
-
if (attr.includes('-')) {
|
|
101
|
-
wxml += '[\'' + attr + '\']"'
|
|
102
|
-
} else {
|
|
103
|
-
wxml += '.' + attr + '"'
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
wxml += ' />'
|
|
108
|
-
if (item.platforms) {
|
|
109
|
-
wxml += '<!-- #endif -->'
|
|
110
|
-
}
|
|
111
|
-
} else if (!item.platforms || item.platforms.join(',').toLowerCase().includes(platform)) {
|
|
112
|
-
voidTags += item.name + ','
|
|
113
|
-
wxml += '<' + item.name + ' wx:elif="{{n.name==\'' + item.name + '\'}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}"'
|
|
114
|
-
if (item.attrs) {
|
|
115
|
-
for (const attr of item.attrs) {
|
|
116
|
-
wxml += ' ' + attr + '="{{n.attrs'
|
|
117
|
-
if (attr.includes('-')) {
|
|
118
|
-
wxml += '[\'' + attr + '\']}}"'
|
|
119
|
-
} else {
|
|
120
|
-
wxml += '.' + attr + '}}"'
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
wxml += ' />'
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return through2.obj(function (file, _, callback) {
|
|
129
|
-
if (file.isBuffer()) {
|
|
130
|
-
// src 目录
|
|
131
|
-
if (file.base.includes('src')) {
|
|
132
|
-
let content = file.contents.toString()
|
|
133
|
-
if (file.basename === 'index.js' || file.basename === 'mp-html.vue') {
|
|
134
|
-
// 注册插件列表
|
|
135
|
-
if (platform === 'uni-app') {
|
|
136
|
-
content = content.replace(/const\s*plugins\s*=\s*\[\]/, `${pluginImports}const plugins=[${plugins}]`)
|
|
137
|
-
} else {
|
|
138
|
-
content = content.replace(/plugins\s*=\s*\[\]/, `plugins=[${plugins}]`)
|
|
139
|
-
}
|
|
140
|
-
} else if (file.basename === 'parser.js') {
|
|
141
|
-
// 设置标签名选择器
|
|
142
|
-
content = content.replace(/tagSelector\s*=\s*{}/, `tagSelector=${JSON.stringify(tagSelector)}`)
|
|
143
|
-
// 设置自闭合标签
|
|
144
|
-
.replace(/voidTags\s*:\s*makeMap\('/, 'voidTags: makeMap(\'' + voidTags)
|
|
145
|
-
} else if (file.basename === 'node.wxml') {
|
|
146
|
-
// 引入模板
|
|
147
|
-
content = content.replace(/<!--\s*insert\s*-->/, wxml)
|
|
148
|
-
} else if (file.basename === 'node.js') {
|
|
149
|
-
// 引入方法
|
|
150
|
-
content = content.replace(/methods\s*:\s*{/, 'methods:{' + js)
|
|
151
|
-
} else if (file.basename === 'node.wxss') {
|
|
152
|
-
// 引入样式
|
|
153
|
-
content = wxss + content
|
|
154
|
-
} else if (file.basename === 'node.json') {
|
|
155
|
-
// 引入组件声明
|
|
156
|
-
const comps = JSON.stringify(json).slice(1, -1)
|
|
157
|
-
if (comps) {
|
|
158
|
-
content = content.replace(/"usingComponents"\s*:\s*{/, '"usingComponents":{' + comps + ',')
|
|
159
|
-
}
|
|
160
|
-
} else if (file.basename === 'node.vue') {
|
|
161
|
-
// 引入 vue
|
|
162
|
-
content = content.replace(/<!--\s*insert\s*-->/, wxml)
|
|
163
|
-
.replace(/methods\s*:\s*{/, 'methods:{' + js)
|
|
164
|
-
.replace('<style>', '<style>' + wxss.replace(/\.[a-zA-Z_][^)}]*?[{,]/g, '/deep/ $&')).replace(/,url/g, ', url')
|
|
165
|
-
let importComp = ''
|
|
166
|
-
let comps = ''
|
|
167
|
-
for (let item in json) {
|
|
168
|
-
const val = json[item]
|
|
169
|
-
// 插件无法通过这种方式引入
|
|
170
|
-
if (val.includes('plugin://')) continue
|
|
171
|
-
item = item.replace(/-([a-z])/g, (_, $1) => $1.toUpperCase())
|
|
172
|
-
importComp += 'import ' + item + " from '" + val + "'\n"
|
|
173
|
-
comps += item + ',\n'
|
|
174
|
-
}
|
|
175
|
-
content = content.replace('<script>', '<script>\n' + importComp)
|
|
176
|
-
.replace(/components\s*:\s*{/, 'components: {\n' + comps)
|
|
177
|
-
} else if (file.basename === 'local.html' && wxss) {
|
|
178
|
-
// 引入样式
|
|
179
|
-
content = '<style>' + wxss + '</style>' + content
|
|
180
|
-
}
|
|
181
|
-
file.contents = Buffer.from(content)
|
|
182
|
-
for (const item in builds) {
|
|
183
|
-
if (builds[item].handler) {
|
|
184
|
-
builds[item].handler(file, platform)
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
// plugins 目录
|
|
189
|
-
const name = file.relative.split(path.sep)[0]
|
|
190
|
-
const build = builds[name]
|
|
191
|
-
// 本平台不支持使用
|
|
192
|
-
if (!build || file.extname === '.md' || file.basename === 'build.js') {
|
|
193
|
-
callback()
|
|
194
|
-
return
|
|
195
|
-
}
|
|
196
|
-
// import
|
|
197
|
-
if (build.import) {
|
|
198
|
-
if (typeof build.import === 'string') {
|
|
199
|
-
if (file.relative.includes(build.import)) {
|
|
200
|
-
file.import = true
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
for (let i = 0; i < build.import.length; i++) {
|
|
204
|
-
if (file.relative.includes(build.import[i])) {
|
|
205
|
-
file.import = true
|
|
206
|
-
break
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
if (build.handler) {
|
|
212
|
-
build.handler(file, platform)
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
this.push(file)
|
|
217
|
-
callback()
|
|
218
|
-
})
|
|
219
|
-
},
|
|
220
|
-
/**
|
|
221
|
-
* @description 引入样式文件到 node.wxss 中
|
|
222
|
-
*/
|
|
223
|
-
importCss () {
|
|
224
|
-
let css = ''
|
|
225
|
-
return through2.obj(function (file, _, callback) {
|
|
226
|
-
if (file.isBuffer()) {
|
|
227
|
-
let content = file.contents.toString()
|
|
228
|
-
// 要被引入的文件
|
|
229
|
-
if (file.import) {
|
|
230
|
-
css += content
|
|
231
|
-
callback()
|
|
232
|
-
return
|
|
233
|
-
}
|
|
234
|
-
// 引入到对应位置
|
|
235
|
-
if (file.basename === 'node.wxss') {
|
|
236
|
-
content = css + content
|
|
237
|
-
} else if (file.basename === 'node.vue') {
|
|
238
|
-
content = content.replace('<style>', '<style>' + css.replace(/\.[a-z_][^)}]+?[{,]/g, '/deep/ $&')).replace(/,url/g, ', url')
|
|
239
|
-
} else if (file.basename === 'local.html' && css) {
|
|
240
|
-
content = '<style>' + css + '</style>' + content
|
|
241
|
-
}
|
|
242
|
-
file.contents = Buffer.from(content)
|
|
243
|
-
}
|
|
244
|
-
this.push(file)
|
|
245
|
-
callback()
|
|
246
|
-
})
|
|
247
|
-
}
|
|
248
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="custom">
|
|
3
|
-
<div
|
|
4
|
-
v-if="
|
|
5
|
-
payload.src === CUSTOM_MESSAGE_SRC.BRANCH ||
|
|
6
|
-
payload.src === CUSTOM_MESSAGE_SRC.BRANCH_NUMBER ||
|
|
7
|
-
(payload.src === CUSTOM_MESSAGE_SRC.ROBOT_MSG &&
|
|
8
|
-
payload.subtype !== 'welcome_msg')
|
|
9
|
-
"
|
|
10
|
-
>
|
|
11
|
-
<MessageBranch
|
|
12
|
-
:payload="payload"
|
|
13
|
-
@sendMessage="sendTextMessage"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
<div
|
|
17
|
-
v-if="
|
|
18
|
-
payload.src === CUSTOM_MESSAGE_SRC.ROBOT_MSG
|
|
19
|
-
"
|
|
20
|
-
>
|
|
21
|
-
<MessageIMRobotWelcome
|
|
22
|
-
:payload="payload"
|
|
23
|
-
@sendMessage="sendTextMessage"
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.FROM_INPUT">
|
|
27
|
-
<MessageForm
|
|
28
|
-
:payload="payload"
|
|
29
|
-
@sendMessage="sendTextMessage"
|
|
30
|
-
/>
|
|
31
|
-
</div>
|
|
32
|
-
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.PRODUCT_CARD">
|
|
33
|
-
<MessageProductCard :payload="payload" />
|
|
34
|
-
</div>
|
|
35
|
-
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.RICH_TEXT">
|
|
36
|
-
<MessageRichText :payload="payload" />
|
|
37
|
-
</div>
|
|
38
|
-
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.STREAM_TEXT">
|
|
39
|
-
<MessageStream :payload="payload" />
|
|
40
|
-
</div>
|
|
41
|
-
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.MULTI_BRANCH">
|
|
42
|
-
<MessageMultiBranch :payload="payload"
|
|
43
|
-
@sendMessage="sendTextMessage"/>
|
|
44
|
-
</div>
|
|
45
|
-
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.MULTI_FORM && message.flow == 'in'">
|
|
46
|
-
<MessageMultiForm :payload="payload"
|
|
47
|
-
@sendMessage="sendCustomMessage"
|
|
48
|
-
@showFormPopup="handleShowFormPopup"
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script lang="ts">
|
|
55
|
-
import vue from '../adapter-vue';
|
|
56
|
-
import { JSONToObject } from '../utils/index';
|
|
57
|
-
import { CUSTOM_MESSAGE_SRC } from '../constant';
|
|
58
|
-
import { customerServicePayloadType, IMessageModel } from '../interface';
|
|
59
|
-
import MessageBranch from './message-branch.vue';
|
|
60
|
-
import MessageForm from './message-form/index.vue';
|
|
61
|
-
import MessageIMRobotWelcome from './message-robot-welcome.vue';
|
|
62
|
-
import MessageProductCard from './message-product-card.vue';
|
|
63
|
-
import MessageRichText from './message-rich-text.vue';
|
|
64
|
-
import MessageStream from './message-stream.vue';
|
|
65
|
-
import MessageMultiBranch from './message-multi-branch/index.vue';
|
|
66
|
-
import MessageMultiForm from './message-multi-form/index.vue';
|
|
67
|
-
const { computed } = vue;
|
|
68
|
-
|
|
69
|
-
interface Props {
|
|
70
|
-
message: IMessageModel;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default {
|
|
74
|
-
components: {
|
|
75
|
-
MessageBranch,
|
|
76
|
-
MessageForm,
|
|
77
|
-
MessageProductCard,
|
|
78
|
-
MessageRichText,
|
|
79
|
-
MessageIMRobotWelcome,
|
|
80
|
-
MessageStream,
|
|
81
|
-
MessageMultiBranch,
|
|
82
|
-
MessageMultiForm
|
|
83
|
-
},
|
|
84
|
-
props: {
|
|
85
|
-
message: {
|
|
86
|
-
type: Object as () => IMessageModel,
|
|
87
|
-
default: () => ({}),
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
emits: ['sendMessage','sendCustomMessage','showFormPopup'],
|
|
91
|
-
setup(props: Props, { emit }) {
|
|
92
|
-
const payload = computed<customerServicePayloadType>(() => {
|
|
93
|
-
return props.message && JSONToObject(props.message?.payload?.data);
|
|
94
|
-
});
|
|
95
|
-
const sendTextMessage = (text: string) => {
|
|
96
|
-
emit('sendMessage', text);
|
|
97
|
-
};
|
|
98
|
-
const sendCustomMessage = (data: any) => {
|
|
99
|
-
emit('sendCustomMessage', data);
|
|
100
|
-
};
|
|
101
|
-
const handleShowFormPopup = (data: boolean) => {
|
|
102
|
-
emit('showFormPopup', data);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
payload,
|
|
107
|
-
sendTextMessage,
|
|
108
|
-
CUSTOM_MESSAGE_SRC,
|
|
109
|
-
sendCustomMessage,
|
|
110
|
-
handleShowFormPopup
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
</script>
|
package/script/fileCopy.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const sourceFolder = '../tui-customer-service-plugin';
|
|
5
|
-
const destinationFolderWeb = '../tui-customer-service-plugin-vue';
|
|
6
|
-
const destinationFolderUniapp = '../tui-customer-service-plugin-uniapp';
|
|
7
|
-
|
|
8
|
-
// 复制文件夹及其内容
|
|
9
|
-
function copyFolderRecursive(source, destination) {
|
|
10
|
-
console.log(`copy folder ${source} ${destination}`);
|
|
11
|
-
|
|
12
|
-
if (!fs.existsSync(destination)) {
|
|
13
|
-
fs.mkdirSync(destination);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const files = fs.readdirSync(source);
|
|
17
|
-
|
|
18
|
-
files.forEach((file) => {
|
|
19
|
-
const sourcePath = path.join(source, file);
|
|
20
|
-
const destinationPath = path.join(destination, file);
|
|
21
|
-
|
|
22
|
-
if (fs.lstatSync(sourcePath).isDirectory()) {
|
|
23
|
-
if (file !== 'node_modules' && file !== '.git') {
|
|
24
|
-
copyFolderRecursive(sourcePath, destinationPath);
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
fs.copyFileSync(sourcePath, destinationPath);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 过滤文件夹中的文件
|
|
33
|
-
function filterFiles(folder, filterCondition) {
|
|
34
|
-
const files = fs.readdirSync(folder);
|
|
35
|
-
|
|
36
|
-
files.forEach((file) => {
|
|
37
|
-
const filePath = path.join(folder, file);
|
|
38
|
-
|
|
39
|
-
if (fs.lstatSync(filePath).isDirectory()) {
|
|
40
|
-
if (!file.startsWith('adapter')) {
|
|
41
|
-
filterFiles(filePath, filterCondition);
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
if (filterCondition(file)) {
|
|
45
|
-
console.log(`filter file ${filePath}`);
|
|
46
|
-
fs.unlinkSync(filePath);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// 复制文件夹 a 到 b 和 c
|
|
53
|
-
copyFolderRecursive(sourceFolder, destinationFolderWeb);
|
|
54
|
-
copyFolderRecursive(sourceFolder, destinationFolderUniapp);
|
|
55
|
-
|
|
56
|
-
// 在 b 文件夹中去除文件名为 -web 结尾的文件
|
|
57
|
-
filterFiles(destinationFolderWeb, (file) => file.substring(0,file.lastIndexOf('.')).endsWith('-uniapp')&& !file.startsWith('adapter'));
|
|
58
|
-
|
|
59
|
-
// 在 c 文件夹中去除文件名为 -uniapp 的文件(除了 adapter 开头的文件)
|
|
60
|
-
filterFiles(destinationFolderUniapp, (file) => file.substring(0,file.lastIndexOf('.')).endsWith('-web') && !file.startsWith('adapter'));
|
package/script/syncVersion.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const os = require('os');
|
|
3
|
-
const newVersion = process.argv[2];
|
|
4
|
-
|
|
5
|
-
if (!newVersion) {
|
|
6
|
-
console.log('请传入新版本号,版本号遵循semver规范 .eg: 1.0.0, 1.0.1, 1.1.0');
|
|
7
|
-
process.exit(1);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const srcPaths = [
|
|
11
|
-
'./package.json',
|
|
12
|
-
'../tui-customer-service-plugin-vue/package.json',
|
|
13
|
-
'../tui-customer-service-plugin-uniapp/package.json'
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
function start() {
|
|
17
|
-
srcPaths.forEach((src) => {
|
|
18
|
-
const packageJsonContent = fs.readFileSync(src, 'utf8');
|
|
19
|
-
const packageJson = JSON.parse(packageJsonContent);
|
|
20
|
-
const currentVersion = packageJson.version;
|
|
21
|
-
let currentName = packageJson.name;
|
|
22
|
-
if(src == '../tui-customer-service-plugin-vue/package.json'){
|
|
23
|
-
currentName = '@tencentcloud/ai-desk-customer-vue';
|
|
24
|
-
} else if(src == '../tui-customer-service-plugin-uniapp/package.json'){
|
|
25
|
-
currentName = '@tencentcloud/ai-desk-customer-uniapp';
|
|
26
|
-
}
|
|
27
|
-
// 更新版本号
|
|
28
|
-
packageJson.version = newVersion;
|
|
29
|
-
packageJson.name = currentName;
|
|
30
|
-
fs.writeFileSync(src, JSON.stringify(packageJson, null, 2) + os.EOL);
|
|
31
|
-
console.log(`${src} 版本号已从 ${currentVersion} 更新为 ${newVersion}`);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
start();
|
|
File without changes
|
|
File without changes
|