ue-softphone-sdk 3.0.14 → 3.0.15
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/dist/lib/ue-soft-phone.min.js +1 -1
- package/dist/ue-softphone-sdk.js +1 -1
- package/package.json +1 -1
- package/sdkdemo/ue-load.min.js +119 -116
- package/sdkdemo/ue.lib.css +1 -1
- package/sdkdemo/ue.min.js +10 -16
- package/src/index.ts +2 -1
- package/dist.tar.gz +0 -0
package/sdkdemo/ue-load.min.js
CHANGED
|
@@ -1,116 +1,119 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: Wangtao
|
|
3
|
-
* @Date: 2023-09-22 18:41:02
|
|
4
|
-
* @LastEditors: Wangtao
|
|
5
|
-
* @LastEditTime:
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
window.ueSimpleSoftphone = {
|
|
9
|
-
initState: false,
|
|
10
|
-
isInit: false,
|
|
11
|
-
isInitApp: false,
|
|
12
|
-
initParams: {},
|
|
13
|
-
init: function(options) {
|
|
14
|
-
if (!options.accountId) {
|
|
15
|
-
console.error('accountId is null')
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
if (!options.agentNumber) {
|
|
19
|
-
console.error('agentNumber is null')
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
if (!options.password) {
|
|
23
|
-
console.error('password is null')
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
if (!options.loginType) {
|
|
27
|
-
console.error('loginType is null')
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
window.ueSimpleSoftphone.initParams.accountId = options.accountId
|
|
31
|
-
window.ueSimpleSoftphone.initParams.agentNumber = options.agentNumber
|
|
32
|
-
window.ueSimpleSoftphone.initParams.password = options.password
|
|
33
|
-
window.ueSimpleSoftphone.initParams.loginType = options.loginType
|
|
34
|
-
window.ueSimpleSoftphone.initParams.server = options.server || ''
|
|
35
|
-
window.ueSimpleSoftphone.isInit = true;
|
|
36
|
-
if (
|
|
37
|
-
window.ueSimpleSoftphone.
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
script
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
audio
|
|
75
|
-
audio
|
|
76
|
-
audio.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
document.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Wangtao
|
|
3
|
+
* @Date: 2023-09-22 18:41:02
|
|
4
|
+
* @LastEditors: Wangtao
|
|
5
|
+
* @LastEditTime: 2024-02-04 17:35:34
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
window.ueSimpleSoftphone = {
|
|
9
|
+
initState: false,
|
|
10
|
+
isInit: false,
|
|
11
|
+
isInitApp: false,
|
|
12
|
+
initParams: {},
|
|
13
|
+
init: function(options) {
|
|
14
|
+
if (!options.accountId) {
|
|
15
|
+
console.error('accountId is null')
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
if (!options.agentNumber) {
|
|
19
|
+
console.error('agentNumber is null')
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
if (!options.password) {
|
|
23
|
+
console.error('password is null')
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
if (!options.loginType) {
|
|
27
|
+
console.error('loginType is null')
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
window.ueSimpleSoftphone.initParams.accountId = options.accountId
|
|
31
|
+
window.ueSimpleSoftphone.initParams.agentNumber = options.agentNumber
|
|
32
|
+
window.ueSimpleSoftphone.initParams.password = options.password
|
|
33
|
+
window.ueSimpleSoftphone.initParams.loginType = options.loginType
|
|
34
|
+
window.ueSimpleSoftphone.initParams.server = options.server || ''
|
|
35
|
+
window.ueSimpleSoftphone.isInit = true;
|
|
36
|
+
if (options.listenCallEvent && typeof options.listenCallEvent === 'function') {
|
|
37
|
+
window.ueSimpleSoftphone.backEventFunction = options.listenCallEvent
|
|
38
|
+
}
|
|
39
|
+
if (window.ueSimpleSoftphone.initState && !window.ueSimpleSoftphone.isInitApp) {
|
|
40
|
+
window.ueSimpleSoftphone.initApp()
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
initApp: function(){
|
|
44
|
+
Vue.createApp({
|
|
45
|
+
components: {
|
|
46
|
+
demo: myLib
|
|
47
|
+
}
|
|
48
|
+
}).mount('#ue-app')
|
|
49
|
+
window.ueSimpleSoftphone.isInitApp = true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function loadModule(url) {
|
|
53
|
+
return new Promise(function(resolve, reject) {
|
|
54
|
+
var script = document.createElement('script');
|
|
55
|
+
script.src = url;
|
|
56
|
+
|
|
57
|
+
script.onload = function() {
|
|
58
|
+
resolve();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
script.onerror = function() {
|
|
62
|
+
reject();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
document.head.appendChild(script);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
function getAudio(id) {
|
|
71
|
+
var el = document.getElementById(id);
|
|
72
|
+
if (!(el instanceof HTMLAudioElement)) {
|
|
73
|
+
// 没有音频dom,重新创建一个
|
|
74
|
+
// throw new Error(`Element '${id}' not found or not an audio element.`)
|
|
75
|
+
var audio = new Audio();
|
|
76
|
+
audio.controls = true;
|
|
77
|
+
audio.autoplay = true;
|
|
78
|
+
audio.id = "m7remoteAudio";
|
|
79
|
+
audio.style.display = "none";
|
|
80
|
+
document.body.appendChild(audio);
|
|
81
|
+
return document.getElementById(id);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return el;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
loadModule('https://softphone.useasy.cn/ue.global.js').then(() => {
|
|
89
|
+
window.onload = function() {
|
|
90
|
+
document.body.insertAdjacentHTML('beforeend', `<div id="ue-app">
|
|
91
|
+
<demo></demo>
|
|
92
|
+
</div>`);
|
|
93
|
+
var audioElement = getAudio("m7remoteAudio");
|
|
94
|
+
// var script = document.createElement('script');
|
|
95
|
+
// script.src = 'https://unpkg.com/vue@3.3.4/dist/vue.global.js'; // 替换为要执行的 JavaScript 文件的 URL
|
|
96
|
+
// document.head.appendChild(script);
|
|
97
|
+
// softphone.useasy.cn
|
|
98
|
+
// 测试1 softphone.useasy.cn
|
|
99
|
+
loadModule('https://softphone.useasy.cn/ue.min.js').then(() => {
|
|
100
|
+
fetch('https://softphone.useasy.cn/ue.lib.css?time=1')
|
|
101
|
+
.then(response => response.text())
|
|
102
|
+
.then(content => {
|
|
103
|
+
var style = document.createElement('style');
|
|
104
|
+
style.type = 'text/css';
|
|
105
|
+
style.innerHTML = content;
|
|
106
|
+
document.getElementsByTagName('head')[0].appendChild(style);
|
|
107
|
+
window.ueSimpleSoftphone.initState = true;
|
|
108
|
+
if (window.ueSimpleSoftphone.isInit && !window.ueSimpleSoftphone.isInitApp) {
|
|
109
|
+
window.ueSimpleSoftphone.initApp()
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|