@16x/webphone-sdk 3.1.10 → 3.1.12

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +11 -206
  2. package/LICENSE +1 -1
  3. package/README.md +161 -214
  4. package/dist/{CCBarClient-Sr_zlDBu.js → CCBarClient-DBNOXOlX.js} +83 -56
  5. package/dist/CCBarClient-DdOn4U0l.cjs +1 -0
  6. package/dist/{Diagnostics-WkQagE6_.js → Diagnostics-BGHpzoTR.js} +1 -1
  7. package/dist/{Diagnostics-x4G0ho6W.cjs → Diagnostics-DzEFDij_.cjs} +1 -1
  8. package/dist/{JsSipAdapter-CwDotPN2.js → JsSipAdapter-Cz6MwjPa.js} +5 -2
  9. package/dist/{JsSipAdapter-BN9BAFHr.cjs → JsSipAdapter-DZZ6vQSa.cjs} +1 -1
  10. package/dist/SharedWorkerProtocol-C-4KpECM.cjs +1 -0
  11. package/dist/SharedWorkerProtocol-CffZrUXg.js +119 -0
  12. package/dist/core/CCBarCall.d.ts +3 -0
  13. package/dist/createJsSipFactory-B1ORbJiP.cjs +22 -0
  14. package/dist/createJsSipFactory-CoWZN-BC.js +7410 -0
  15. package/dist/diagnostics/index.cjs +1 -1
  16. package/dist/diagnostics/index.js +1 -1
  17. package/dist/errors/CCBarError.d.ts +3 -0
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.js +3 -3
  20. package/dist/index.umd.js +16 -69
  21. package/dist/legacy/index.cjs +1 -1
  22. package/dist/legacy/index.js +2 -2
  23. package/dist/shared/SharedWorkerProtocol.d.ts +1 -0
  24. package/dist/shared-worker.cjs +1 -1
  25. package/dist/shared-worker.js +1 -1
  26. package/dist/styles.css +7 -7
  27. package/dist/types.d.ts +1 -1
  28. package/dist/ui/i18n/types.d.ts +1 -0
  29. package/dist/ui/index.cjs +1 -1
  30. package/dist/ui/index.js +16 -7
  31. package/dist/version.d.ts +1 -1
  32. package/package.json +109 -109
  33. package/dist/CCBarClient-z-TFUjTB.cjs +0 -1
  34. package/dist/SharedWorkerProtocol-39dch6xL.cjs +0 -1
  35. package/dist/SharedWorkerProtocol-DKVQ5-po.js +0 -87
  36. package/dist/createJsSipFactory-9CPsweDR.js +0 -9665
  37. package/dist/createJsSipFactory-Dr8HbLl-.cjs +0 -75
@@ -0,0 +1,119 @@
1
+ import { t as e } from "./redact-DB3CMbsK.js";
2
+ //#region src/errors/CCBarError.ts
3
+ var t = {
4
+ AUTH_TOKEN_UNAVAILABLE: "获取登录凭证失败,请检查凭证获取服务后重试。",
5
+ AUTH_TOKEN_EXPIRED: "登录凭证已过期,请重新获取凭证后登录。",
6
+ AUTH_TOKEN_REJECTED: "服务端未接受当前登录凭证,请核实凭证类型和权限。",
7
+ AUTH_PERMISSION_DENIED: "当前账号没有执行此操作的权限,请联系管理员。",
8
+ CONFIG_INVALID: "配置不完整或格式不正确,请检查软电话配置。",
9
+ CONFIG_ORIGIN_NOT_ALLOWED: "当前页面域名未获授权,请联系管理员配置访问域名。",
10
+ NETWORK_OFFLINE: "网络连接已断开,请检查网络后重试。",
11
+ NETWORK_TIMEOUT: "请求超时,请检查网络后重试。",
12
+ SIP_WS_UNAVAILABLE: "无法连接 SIP 服务,请检查 SIP WSS 地址和网络。",
13
+ REGISTRATION_FAILED: "SIP 注册失败,请检查坐席配置后重试。",
14
+ REGISTRATION_REJECTED: "SIP 服务拒绝了当前账号,请核对分机和 SIP 凭证。",
15
+ MEDIA_PERMISSION_DENIED: "麦克风权限未开启,请在浏览器设置中允许使用麦克风。",
16
+ MEDIA_DEVICE_NOT_FOUND: "未找到可用的音频设备,请连接麦克风或耳机后重试。",
17
+ MEDIA_DEVICE_IN_USE: "音频设备正在被其他程序使用,请关闭占用设备的程序后重试。",
18
+ MEDIA_PLAYBACK_BLOCKED: "浏览器阻止了声音播放,请点击页面并检查浏览器音频设置。",
19
+ CALL_INVALID_DESTINATION: "被叫号码格式不正确,请检查后重试。",
20
+ CALL_INVALID_USERDATA: "通话附加数据格式不正确,请检查后重试。",
21
+ CALL_ALREADY_EXISTS: "当前已有进行中的通话,请先结束当前通话。",
22
+ CALL_REJECTED: "对方或呼叫平台拒绝了本次呼叫。",
23
+ CALL_BUSY: "对方正在通话中,请稍后重试。",
24
+ CALL_NOT_CONNECTED: "当前没有可操作的通话,请先拨打或接听电话。",
25
+ NOT_SIGNED_IN: "请先登录,并等待 SIP 注册成功后再操作。",
26
+ CALL_OPERATION_NOT_ALLOWED: "当前通话状态不支持此操作,请检查通话状态后重试。",
27
+ CAPABILITY_NOT_SUPPORTED: "当前浏览器或设备不支持此功能。",
28
+ H5_BACKGROUND_NOT_SUPPORTED: "页面在后台时无法执行此操作,请返回通话页面后重试。",
29
+ SDK_ALREADY_DISPOSED: "软电话实例已关闭,请重新创建实例后操作。",
30
+ SDK_INTERNAL_ERROR: "软电话发生异常,请稍后重试;如问题持续,请联系技术支持。",
31
+ LEGACY_PLATFORM_UNREACHABLE: "无法连接坐席服务,请检查 API host 和网络。",
32
+ LEGACY_PLATFORM_REJECTED: "坐席服务未能完成请求,请核对账号权限和接口配置。"
33
+ }, n = class extends Error {
34
+ code;
35
+ category;
36
+ retryable;
37
+ requestId;
38
+ callId;
39
+ cause;
40
+ serverCode;
41
+ platformCode;
42
+ status;
43
+ constructor(e, n, r, i = {}) {
44
+ super(t[e]), this.name = "CCBarError", this.code = e, this.category = n, this.retryable = r, this.requestId = i.requestId, this.callId = i.callId, this.cause = i.cause, this.serverCode = i.serverCode, this.platformCode = i.platformCode, this.status = i.status;
45
+ }
46
+ }, r = [
47
+ "new",
48
+ "dialing",
49
+ "ringing",
50
+ "connecting",
51
+ "active",
52
+ "held",
53
+ "ended",
54
+ "failed"
55
+ ];
56
+ function i(e) {
57
+ if (!l(e) || typeof e.id != "string" || typeof e.destination != "string" || typeof e.incoming != "boolean" || !c(e.state)) throw d("Invalid call snapshot");
58
+ return {
59
+ id: e.id,
60
+ ...typeof e.from == "string" ? { from: e.from } : {},
61
+ destination: e.destination,
62
+ state: e.state,
63
+ incoming: e.incoming,
64
+ ...typeof e.ownerTabId == "string" ? { ownerTabId: e.ownerTabId } : {}
65
+ };
66
+ }
67
+ function a(e) {
68
+ return e instanceof n ? {
69
+ code: e.code,
70
+ category: e.category,
71
+ retryable: e.retryable,
72
+ ...e.requestId === void 0 ? {} : { requestId: e.requestId },
73
+ ...e.callId === void 0 ? {} : { callId: e.callId },
74
+ ...e.serverCode === void 0 ? {} : { serverCode: e.serverCode },
75
+ ...e.platformCode === void 0 ? {} : { platformCode: e.platformCode },
76
+ ...e.status === void 0 ? {} : { status: e.status },
77
+ message: u(e.message)
78
+ } : {
79
+ code: "SDK_INTERNAL_ERROR",
80
+ category: "internal",
81
+ retryable: !1,
82
+ message: u(e instanceof Error ? e.message : String(e))
83
+ };
84
+ }
85
+ function o(e) {
86
+ if (!l(e)) throw d("Invalid worker message");
87
+ if (e.version !== 1) throw d("Unsupported worker protocol version");
88
+ if (e.type === "attach" || e.type === "detach") return s(e), e;
89
+ if (e.type === "command") {
90
+ if (s(e), typeof e.command != "string" || e.payload !== void 0 && !l(e.payload)) throw d("Invalid worker command");
91
+ return e;
92
+ }
93
+ if (e.type === "response") {
94
+ if (typeof e.requestId != "string" || typeof e.ok != "boolean") throw d("Invalid worker response");
95
+ return e;
96
+ }
97
+ if (e.type === "event") {
98
+ if (typeof e.event != "string" || !("payload" in e)) throw d("Invalid worker event");
99
+ return e;
100
+ }
101
+ throw d("Unknown worker message type");
102
+ }
103
+ function s(e) {
104
+ if (typeof e.requestId != "string" || typeof e.tabId != "string") throw d("Worker request requires requestId and tabId");
105
+ }
106
+ function c(e) {
107
+ return typeof e == "string" && r.includes(e);
108
+ }
109
+ function l(e) {
110
+ return typeof e == "object" && !!e && !Array.isArray(e);
111
+ }
112
+ function u(t) {
113
+ return e(t).replace(/(?:authorization|token|ticket|credential|password|secret)/gi, "[REDACTED]");
114
+ }
115
+ function d(e) {
116
+ return new n("SDK_INTERNAL_ERROR", "internal", !1, { cause: e });
117
+ }
118
+ //#endregion
119
+ export { n as i, i as n, a as r, o as t };
@@ -29,6 +29,8 @@ export declare class CCBarCall {
29
29
  private readonly capabilities;
30
30
  private disposed;
31
31
  private pendingOperation?;
32
+ private localHeld;
33
+ private remoteHeld;
32
34
  private incomingOperation?;
33
35
  private ownerTabId?;
34
36
  private ownerLost;
@@ -68,6 +70,7 @@ export declare class CCBarCall {
68
70
  private handleSessionEvent;
69
71
  private transitionToActive;
70
72
  private transitionIfAllowed;
73
+ private updateHoldState;
71
74
  private transitionIfStillRinging;
72
75
  private transitionTo;
73
76
  private startPendingOperation;