@tencentcloud/ai-desk-customer-vue 1.5.11 → 1.6.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 +13 -0
- package/assets/audio-blue.svg +4 -0
- package/assets/audio_icon_1.svg +3 -0
- package/assets/audio_icon_2.svg +3 -0
- package/assets/audio_icon_3.svg +3 -0
- package/assets/keyboard-icon.svg +9 -0
- package/components/CustomerServiceChat/index-web.vue +10 -2
- package/components/CustomerServiceChat/message-input/index-web.vue +57 -10
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +342 -11
- package/components/CustomerServiceChat/message-list/index-web.vue +13 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-audio-web.vue +50 -78
- package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +1 -1
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/marked.ts +3 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-robot-welcome.vue +13 -6
- package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +3 -2
- package/components/common/Toast/index-web.ts +16 -3
- package/components/common/Toast/index-web.vue +16 -6
- package/constant.ts +1 -0
- package/locales/en/TUIChat.ts +6 -2
- package/locales/fil/TUIChat.ts +6 -2
- package/locales/id/TUIChat.ts +76 -72
- package/locales/ja/TUIChat.ts +76 -72
- package/locales/ms/TUIChat.ts +76 -72
- package/locales/ru/TUIChat.ts +6 -2
- package/locales/th/TUIChat.ts +76 -72
- package/locales/vi/TUIChat.ts +76 -72
- package/locales/zh_cn/TUIChat.ts +6 -2
- package/locales/zh_tw/TUIChat.ts +6 -2
- package/package.json +2 -1
- package/server.ts +22 -3
- package/assets/keyboard_icon.png +0 -0
package/server.ts
CHANGED
|
@@ -17,7 +17,7 @@ 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, transferToHuman, transferToTaskFlow, validateUserID, updateCustomStore } from "./utils/utils";
|
|
20
|
+
import { switchReadStatus, transferToHuman, transferToTaskFlow, validateUserID, updateCustomStore, isNonEmptyObject } from "./utils/utils";
|
|
21
21
|
import state from "./utils/state";
|
|
22
22
|
import { USER_DEFAULT_AVATAR } from "./constant";
|
|
23
23
|
import { vueVersion } from "./adapter-vue-web";
|
|
@@ -45,11 +45,13 @@ export default class TUICustomerServer {
|
|
|
45
45
|
private loggedInUserID: string;
|
|
46
46
|
private myProfile: IProfile;
|
|
47
47
|
private paramsForActiveAgain: any;
|
|
48
|
+
private loginFailToasts: any[];
|
|
48
49
|
constructor() {
|
|
49
50
|
TUICore.registerService(TUIConstants.TUICustomerServicePlugin.SERVICE.NAME, this);
|
|
50
51
|
TUICore.registerExtension(TUIConstants.TUIContact.EXTENSION.CONTACT_LIST.EXT_ID, this);
|
|
51
52
|
this.customerServiceIDList = ['@customer_service_account'];
|
|
52
53
|
this.currentCustomerServiceID = this.customerServiceIDList[0];
|
|
54
|
+
this.loginFailToasts = [];
|
|
53
55
|
this.isLoggedIn = false;
|
|
54
56
|
this.loggedInUserID = '';
|
|
55
57
|
this.myProfile = { avatar: USER_DEFAULT_AVATAR };
|
|
@@ -62,6 +64,15 @@ export default class TUICustomerServer {
|
|
|
62
64
|
return TUICustomerServer.instance;
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
private clearToasts() {
|
|
68
|
+
this.loginFailToasts.forEach(toast => {
|
|
69
|
+
if (isNonEmptyObject(toast)) {
|
|
70
|
+
toast.close();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this.loginFailToasts = [];
|
|
74
|
+
}
|
|
75
|
+
|
|
65
76
|
private async loginCustomerUIKit(SDKAppID:number, userID:string, userSig:string) {
|
|
66
77
|
clearChatStorage(SDKAppID, userID);
|
|
67
78
|
return TUIChatEngine.login({
|
|
@@ -71,6 +82,7 @@ export default class TUICustomerServer {
|
|
|
71
82
|
useUploadPlugin: true,
|
|
72
83
|
}).then(() => {
|
|
73
84
|
Log.i(`login success. userID:${userID}`);
|
|
85
|
+
this.clearToasts();
|
|
74
86
|
this.isLoggedIn = true;
|
|
75
87
|
this.loggedInUserID = userID;
|
|
76
88
|
this.switchConversation(`C2C${this.currentCustomerServiceID}`);
|
|
@@ -78,11 +90,12 @@ export default class TUICustomerServer {
|
|
|
78
90
|
TUIChatEngine.chat.callExperimentalAPI('isFeatureEnabledForStat', Math.pow(2, 42));
|
|
79
91
|
})
|
|
80
92
|
.catch((error) => {
|
|
81
|
-
Toast({
|
|
93
|
+
let loginFailToast = Toast({
|
|
82
94
|
message: TUITranslateService.t('TUIChat.登录失败'),
|
|
83
95
|
type: TOAST_TYPE.ERROR,
|
|
84
96
|
duration: 30000,
|
|
85
97
|
});
|
|
98
|
+
this.loginFailToasts.push(loginFailToast);
|
|
86
99
|
Log.l(error);
|
|
87
100
|
})
|
|
88
101
|
}
|
|
@@ -131,10 +144,16 @@ export default class TUICustomerServer {
|
|
|
131
144
|
if (nickName) {
|
|
132
145
|
// chat 个人资料的昵称是 nick
|
|
133
146
|
this.myProfile.nick = nickName;
|
|
147
|
+
} else {
|
|
148
|
+
this.myProfile.nick = '';
|
|
134
149
|
}
|
|
150
|
+
|
|
135
151
|
if (avatar) {
|
|
136
152
|
this.myProfile.avatar = avatar;
|
|
153
|
+
} else {
|
|
154
|
+
this.myProfile.avatar = USER_DEFAULT_AVATAR;
|
|
137
155
|
}
|
|
156
|
+
|
|
138
157
|
if (customerServiceID) {
|
|
139
158
|
this.currentCustomerServiceID = customerServiceID;
|
|
140
159
|
if (!this.customerServiceIDList.includes(this.currentCustomerServiceID)) {
|
|
@@ -146,7 +165,7 @@ export default class TUICustomerServer {
|
|
|
146
165
|
|
|
147
166
|
public async unInit() {
|
|
148
167
|
this.isLoggedIn = false;
|
|
149
|
-
this.
|
|
168
|
+
this.clearToasts();
|
|
150
169
|
return TUIChatEngine.logout();
|
|
151
170
|
}
|
|
152
171
|
|
package/assets/keyboard_icon.png
DELETED
|
Binary file
|