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.
@@ -1,116 +1,119 @@
1
- /*
2
- * @Author: Wangtao
3
- * @Date: 2023-09-22 18:41:02
4
- * @LastEditors: Wangtao
5
- * @LastEditTime: 2023-10-17 16:51:04
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 (window.ueSimpleSoftphone.initState && !window.ueSimpleSoftphone.isInitApp) {
37
- window.ueSimpleSoftphone.initApp()
38
- }
39
- },
40
- initApp: function(){
41
- Vue.createApp({
42
- components: {
43
- demo: myLib
44
- }
45
- }).mount('#ue-app')
46
- window.ueSimpleSoftphone.isInitApp = true
47
- }
48
- }
49
- function loadModule(url) {
50
- return new Promise(function(resolve, reject) {
51
- var script = document.createElement('script');
52
- script.src = url;
53
-
54
- script.onload = function() {
55
- resolve();
56
- };
57
-
58
- script.onerror = function() {
59
- reject();
60
- };
61
-
62
- document.head.appendChild(script);
63
- });
64
- }
65
-
66
-
67
- function getAudio(id) {
68
- var el = document.getElementById(id);
69
- if (!(el instanceof HTMLAudioElement)) {
70
- // 没有音频dom,重新创建一个
71
- // throw new Error(`Element '${id}' not found or not an audio element.`)
72
- var audio = new Audio();
73
- audio.controls = true;
74
- audio.autoplay = true;
75
- audio.id = "m7remoteAudio";
76
- audio.style.display = "none";
77
- document.body.appendChild(audio);
78
- return document.getElementById(id);
79
- }
80
- else {
81
- return el;
82
- }
83
- }
84
-
85
- loadModule('https://softphone.useasy.cn/ue.global.js').then(() => {
86
- window.onload = function() {
87
- document.body.insertAdjacentHTML('beforeend', `<div id="ue-app">
88
- <demo></demo>
89
- </div>`);
90
- var audioElement = getAudio("m7remoteAudio");
91
- // var script = document.createElement('script');
92
- // script.src = 'https://unpkg.com/vue@3.3.4/dist/vue.global.js'; // 替换为要执行的 JavaScript 文件的 URL
93
- // document.head.appendChild(script);
94
- // softphone.useasy.cn
95
- // 测试1 softphone.useasy.cn
96
- loadModule('https://softphone.useasy.cn/ue.min.js').then(() => {
97
- fetch('https://softphone.useasy.cn/ue.lib.css?time=1')
98
- .then(response => response.text())
99
- .then(content => {
100
- var style = document.createElement('style');
101
- style.type = 'text/css';
102
- style.innerHTML = content;
103
- document.getElementsByTagName('head')[0].appendChild(style);
104
- window.ueSimpleSoftphone.initState = true;
105
- if (window.ueSimpleSoftphone.isInit && !window.ueSimpleSoftphone.isInitApp) {
106
- window.ueSimpleSoftphone.initApp()
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
+