module-develop-kit 0.5.6 → 0.5.7
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/index.es.js +19 -9
- package/dist/main.d.ts +2 -0
- package/dist/vite-plugins/index.es.js +3 -3
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -10474,10 +10474,10 @@ class Fa {
|
|
|
10474
10474
|
}), this.ua.on("disconnected", () => {
|
|
10475
10475
|
Te.warn("WebSocket已断开"), Re.PENDING === this.callStatus && this.updateStatus(Re.RECONNECT, ke.causes.CONNECTION_ERROR);
|
|
10476
10476
|
}), this.ua.on("registrationFailed", (P) => {
|
|
10477
|
-
this.updateStatus(Re.FAILED, P.cause, P.response.status_code), Te.error(
|
|
10477
|
+
this.updateStatus(Re.FAILED, P.cause, P.response.status_code), Te.error(`SIP 注册失败 cause: ${P?.cause} status_code: ${P?.response?.status_code}`), this.stop();
|
|
10478
10478
|
}), this.ua.start(), this.updateStatus(Re.PENDING);
|
|
10479
10479
|
} catch (i) {
|
|
10480
|
-
Te.error("SIP 初始化失败", i), this.stop(), this.updateStatus(Re.FAILED, ke.causes.SIP_FAILURE_CODE);
|
|
10480
|
+
Te.error("SIP 初始化失败", i?.message), this.stop(), this.updateStatus(Re.FAILED, ke.causes.SIP_FAILURE_CODE);
|
|
10481
10481
|
}
|
|
10482
10482
|
}
|
|
10483
10483
|
/**
|
|
@@ -10505,7 +10505,7 @@ class Fa {
|
|
|
10505
10505
|
};
|
|
10506
10506
|
h();
|
|
10507
10507
|
} catch (F) {
|
|
10508
|
-
Te.error("音频分析模块初始化失败", F);
|
|
10508
|
+
Te.error("音频分析模块初始化失败", F?.message);
|
|
10509
10509
|
}
|
|
10510
10510
|
}
|
|
10511
10511
|
/**
|
|
@@ -10531,7 +10531,11 @@ class Fa {
|
|
|
10531
10531
|
}
|
|
10532
10532
|
},
|
|
10533
10533
|
ended: (E) => {
|
|
10534
|
-
Re.FAILED !== this.callStatus
|
|
10534
|
+
if (Re.FAILED !== this.callStatus) {
|
|
10535
|
+
const t = i ? E?.cause : ke.causes.REJECTED;
|
|
10536
|
+
this.updateStatus(Re.ENDED, t), Te.log("通话已结束 cause: ", t);
|
|
10537
|
+
}
|
|
10538
|
+
this.stop();
|
|
10535
10539
|
},
|
|
10536
10540
|
failed: (E) => {
|
|
10537
10541
|
const { cause: t, message: h = {} } = E, y = t === "Canceled";
|
|
@@ -10539,7 +10543,11 @@ class Fa {
|
|
|
10539
10543
|
y ? Re.CANCELLED : Re.FAILED,
|
|
10540
10544
|
t,
|
|
10541
10545
|
h?.status_code
|
|
10542
|
-
), y ? Te.warn(
|
|
10546
|
+
), y ? Te.warn(
|
|
10547
|
+
`通话已取消 cause: ${t} status_code: ${h?.status_code || ""}`
|
|
10548
|
+
) : Te.error(
|
|
10549
|
+
`通话失败 cause: ${t} status_code: ${h?.status_code || ""}`
|
|
10550
|
+
), this.stop();
|
|
10543
10551
|
},
|
|
10544
10552
|
accepted: () => {
|
|
10545
10553
|
this.stopPlayTipAudio(), Te.log("通话已接听");
|
|
@@ -10594,7 +10602,7 @@ class Fa {
|
|
|
10594
10602
|
iceServers: Ts(F)
|
|
10595
10603
|
}), this.session = this.ua.call(`sip:${L.call}@${F.sipIp}`, P);
|
|
10596
10604
|
} catch (i) {
|
|
10597
|
-
Te.error("SIP 会话创建失败", i), this.stop();
|
|
10605
|
+
Te.error("SIP 会话创建失败", i?.message), this.stop();
|
|
10598
10606
|
}
|
|
10599
10607
|
}
|
|
10600
10608
|
/**
|
|
@@ -10612,7 +10620,7 @@ class Fa {
|
|
|
10612
10620
|
const y = F.currentTime;
|
|
10613
10621
|
Te.log("音频播放开始时间:", y), await F.resume(), i.start(y);
|
|
10614
10622
|
} catch (E) {
|
|
10615
|
-
Te.error("播放音频失败", E);
|
|
10623
|
+
Te.error("播放音频失败", E?.message);
|
|
10616
10624
|
}
|
|
10617
10625
|
let P = !1;
|
|
10618
10626
|
this.stopPlayTipAudio = () => {
|
|
@@ -10632,7 +10640,7 @@ class Fa {
|
|
|
10632
10640
|
try {
|
|
10633
10641
|
this.ua?.stop?.(), !this.session?.isEnded?.() && this.session?.terminate();
|
|
10634
10642
|
} catch (L) {
|
|
10635
|
-
Te.error("挂断失败", L);
|
|
10643
|
+
Te.error("挂断失败", L?.message);
|
|
10636
10644
|
} finally {
|
|
10637
10645
|
this.isStop = !0, this.stopPlayTipAudio();
|
|
10638
10646
|
}
|
|
@@ -10647,7 +10655,7 @@ class Fa {
|
|
|
10647
10655
|
* 挂断电话
|
|
10648
10656
|
*/
|
|
10649
10657
|
hangUp() {
|
|
10650
|
-
Re.ANSWERED === this.callStatus ? (this.updateStatus(Re.ENDED), Te.
|
|
10658
|
+
Re.ANSWERED === this.callStatus ? (this.updateStatus(Re.ENDED), Te.warn("客服正常挂断结束通话")) : (this.updateStatus(Re.CANCELLED), Te.warn("客服取消通话")), this.stop(), this.destroy();
|
|
10651
10659
|
}
|
|
10652
10660
|
}
|
|
10653
10661
|
const o0 = (O) => {
|
|
@@ -10699,6 +10707,8 @@ const o0 = (O) => {
|
|
|
10699
10707
|
call: h,
|
|
10700
10708
|
hangUp: y,
|
|
10701
10709
|
callStatus: L,
|
|
10710
|
+
callCauseCode: P,
|
|
10711
|
+
statusCode: E,
|
|
10702
10712
|
callStatusText: a,
|
|
10703
10713
|
destroy: n,
|
|
10704
10714
|
extension: i,
|
package/dist/main.d.ts
CHANGED
|
@@ -350,6 +350,8 @@ export declare const useCall: (callBack?: (status: ECallStatus, callStatusText:
|
|
|
350
350
|
call: (options: ICallOptions, config: ICallConfig) => void;
|
|
351
351
|
hangUp: () => void;
|
|
352
352
|
callStatus: Ref<ECallStatus, ECallStatus>;
|
|
353
|
+
callCauseCode: Ref<string, string>;
|
|
354
|
+
statusCode: Ref<string, string>;
|
|
353
355
|
callStatusText: Ref<string, string>;
|
|
354
356
|
destroy: () => void;
|
|
355
357
|
extension: Ref<string, string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import a from "@vitejs/plugin-legacy";
|
|
2
|
-
const s = `"use strict";!function(){var r=function(r){document.body?r():window.addEventListener("load",r,{once:!0})};function e(){r(function(){document.body.innerHTML='<div style="width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); position: fixed; left: 0; top: 0"><div style="width: 480px; background-color: #fff; margin: 200px auto; padding: 18px 22px 18px 16px; border-radius: 12px;"><div style="color: #4e5969; font-size: 14px; margin: 24px 0 26px 0">推荐使用谷歌浏览器访问系统,以获得更优操作体验,减少兼容问题</div><div style="display: flex; justify-content: flex-end"><a href="https://www.google.cn/chrome/" target="_blank" style="width: 146px;height: 32px;color: #fff;background-color: #2954ff;text-align: center;font-size: 14px;cursor: pointer;border-radius: 4px;text-decoration: none;display: flex;align-items: center;justify-content: center;">下载谷歌浏览器</a></div></div></div>',document.title="不支持该浏览器"})}try{!function(){var o=window.navigator.userAgent;function n(r){return r&&Array.isArray(r)&&r[1]?String(r[1]):null}function t(r){return n(r.match(/Chrom(?:e|ium)\\/(\\d+(\\.\\d+)*)/i))}function i(r,e){if(!e||!r)return!1;for(var o=String(r).split(".").map(Number),n=String(e).split(".").map(Number),t=0;t<Math.max(o.length,n.length);t++){var i=o[t]||0,c=n[t]||0;if(i>c)return!0;if(i<c)return!1}return!0}var c=85;function a(){r(function(){var r=document.getElementById("vite-legacy-polyfill");if(r){var e=document.createElement("script");e.src=r.src,document.head.appendChild(e)}else console.warn("没有找到vite-legacy-polyfill的加载入口")})}var s=[{name:"Ie",description:"detect IE engine (Trident/MSIE) — 360 在兼容模式下会走 Trident,IE不支持",match:function(r){return/MSIE |Trident\\//i.test(r)},notSupport:!0},{name:"360Browser",description:"360 安全/极速浏览器 (基于 Chromium)",match:function(r){return/(360SE|360EE)/i.test(r)},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Edge",description:"Edge (Chromium) token: Edg/",match:function(r){return Boolean(r.match(/Edg\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Firefox",match:function(r){return Boolean(r.match(/Firefox\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:function(r){return n(r.match(/Firefox\\/(\\d+(\\.\\d+)*)/i))},minSupportVersion:79,forceLoadPolyfills:function(r){return i("104",n(r.match(/Firefox\\/(\\d+(\\.\\d+)*)/i)))}},{name:"Opera",description:"Opera 从 2013 年起转向 Chromium 内核,所以现在的 Opera 实际上是一个 Chromium 壳",match:function(r){return Boolean(r.match(/OPR\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"QQBrowser",description:"QQ 浏览器(基于 Chromium),桌面和移动端",match:function(r){return Boolean(r.match(/QQBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"UCBrowser",description:"UC 浏览器,主要在移动端",match:function(r){return Boolean(r.match(/UCBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"WeChat",description:"微信内置浏览器(通常基于X5内核/Chromium),移动端",match:function(r){return Boolean(r.match(/MicroMessenger\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Chrome",description:"Chrome/Chromium (包含了很多套壳的chrome,Edge也包含了,但是在上面已经处理过了)",match:function(r){return Boolean(r.match(/Chrom(?:e|ium)\\/(\\d+)\\.?/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:function(r){return i("107",t(r))}},{name:"Safari",description:'Safari: 包含 "Version/X Y Safari/" 没有 Chrome/Chromium/Edg/OPR',match:function(r){return!/Chrom(e|ium)|Edg|OPR|QQBrowser/i.test(r)},getBrowserVersion:function(r){return n(r.match(/Version\\/(\\d+(\\.\\d+)*)/i))},minSupportVersion:14.1,forceLoadPolyfills:function(r){return i("16",n(r.match(/Version\\/(\\d+(\\.\\d+)*)/i)))}}];if(s
|
|
2
|
+
const s = `"use strict";!function(){var r=function(r){document.body?r():window.addEventListener("load",r,{once:!0})};function e(){r(function(){document.body.innerHTML='<div style="width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); position: fixed; left: 0; top: 0"><div style="width: 480px; background-color: #fff; margin: 200px auto; padding: 18px 22px 18px 16px; border-radius: 12px;"><div style="color: #4e5969; font-size: 14px; margin: 24px 0 26px 0">推荐使用谷歌浏览器访问系统,以获得更优操作体验,减少兼容问题</div><div style="display: flex; justify-content: flex-end"><a href="https://www.google.cn/chrome/" target="_blank" style="width: 146px;height: 32px;color: #fff;background-color: #2954ff;text-align: center;font-size: 14px;cursor: pointer;border-radius: 4px;text-decoration: none;display: flex;align-items: center;justify-content: center;">下载谷歌浏览器</a></div></div></div>',document.title="不支持该浏览器"})}try{!function(){var o=window.navigator.userAgent;function n(r){return r&&Array.isArray(r)&&r[1]?String(r[1]):null}function t(r){return n(r.match(/Chrom(?:e|ium)\\/(\\d+(\\.\\d+)*)/i))}function i(r,e){if(!e||!r)return!1;for(var o=String(r).split(".").map(Number),n=String(e).split(".").map(Number),t=0;t<Math.max(o.length,n.length);t++){var i=o[t]||0,c=n[t]||0;if(i>c)return!0;if(i<c)return!1}return!0}var c=85;function a(){r(function(){var r=document.getElementById("vite-legacy-polyfill");if(r){var e=document.createElement("script");e.src=r.src,document.head.appendChild(e)}else console.warn("没有找到vite-legacy-polyfill的加载入口")})}var s=[{name:"Ie",description:"detect IE engine (Trident/MSIE) — 360 在兼容模式下会走 Trident,IE不支持",match:function(r){return/MSIE |Trident\\//i.test(r)},notSupport:!0},{name:"360Browser",description:"360 安全/极速浏览器 (基于 Chromium)",match:function(r){return/(360SE|360EE)/i.test(r)},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Edge",description:"Edge (Chromium) token: Edg/",match:function(r){return Boolean(r.match(/Edg\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Firefox",match:function(r){return Boolean(r.match(/Firefox\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:function(r){return n(r.match(/Firefox\\/(\\d+(\\.\\d+)*)/i))},minSupportVersion:79,forceLoadPolyfills:function(r){return i("104",n(r.match(/Firefox\\/(\\d+(\\.\\d+)*)/i)))}},{name:"Opera",description:"Opera 从 2013 年起转向 Chromium 内核,所以现在的 Opera 实际上是一个 Chromium 壳",match:function(r){return Boolean(r.match(/OPR\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"QQBrowser",description:"QQ 浏览器(基于 Chromium),桌面和移动端",match:function(r){return Boolean(r.match(/QQBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"UCBrowser",description:"UC 浏览器,主要在移动端",match:function(r){return Boolean(r.match(/UCBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"WeChat",description:"微信内置浏览器(通常基于X5内核/Chromium),移动端",match:function(r){return Boolean(r.match(/MicroMessenger\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Chrome",description:"Chrome/Chromium (包含了很多套壳的chrome,Edge也包含了,但是在上面已经处理过了)",match:function(r){return Boolean(r.match(/Chrom(?:e|ium)\\/(\\d+)\\.?/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:function(r){return i("107",t(r))}},{name:"Safari",description:'Safari: 包含 "Version/X Y Safari/" 没有 Chrome/Chromium/Edg/OPR',match:function(r){return!/Chrom(e|ium)|Edg|OPR|QQBrowser/i.test(r)},getBrowserVersion:function(r){return n(r.match(/Version\\/(\\d+(\\.\\d+)*)/i))},minSupportVersion:14.1,forceLoadPolyfills:function(r){return i("16",n(r.match(/Version\\/(\\d+(\\.\\d+)*)/i)))}}].find(function(r){return r.match(o)});if(s&&function(r){var e=r.match,n=r.getBrowserVersion,t=r.minSupportVersion,c=r.notSupport,a=r.name;if(!e(o))return!1;if(console.log("当前浏览器ua与",a,"匹配"),c)return!1;var s=n?n(o):null;return s?(console.log("当前浏览器:",a,s),i(s,t)):(console.log("获取不到当前浏览器版本:",a),!1)}(s))try{var u=null==s?void 0:s.forceLoadPolyfills;u&&("function"==typeof u?u(o)&&a():a())}catch(r){console.log("polyfills 强制加载失败",r)}else e()}()}catch(r){console.log("检测脚本执行失败",r),e()}}();`, u = (r) => ({
|
|
3
3
|
name: "vite-plugin-compatibility-detection",
|
|
4
4
|
enforce: "post",
|
|
5
5
|
transformIndexHtml(e) {
|
|
@@ -16,7 +16,7 @@ const s = `"use strict";!function(){var r=function(r){document.body?r():window.a
|
|
|
16
16
|
]
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
19
|
+
}), d = (r) => {
|
|
20
20
|
const e = {
|
|
21
21
|
start: !0,
|
|
22
22
|
startDetection: !0,
|
|
@@ -25,6 +25,6 @@ const s = `"use strict";!function(){var r=function(r){document.body?r():window.a
|
|
|
25
25
|
return o && (t.push(a(c)), n && t.push(u(i))), t;
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
d as getCompatibilityPlugins,
|
|
29
29
|
u as vitePluginCompatibilityDetection
|
|
30
30
|
};
|