@16x/webphone-sdk 3.0.2 → 3.1.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +39 -26
  2. package/LICENSE +1 -1
  3. package/README.md +113 -113
  4. package/dist/{CCBarClient-xC63i3Qd.js → CCBarClient-CcPfEToZ.js} +225 -162
  5. package/dist/CCBarClient-DCQ8XjcL.cjs +1 -0
  6. package/dist/{Diagnostics-CvH6cjih.cjs → Diagnostics-D38Hm3NT.cjs} +1 -1
  7. package/dist/{Diagnostics-BhsVHELt.js → Diagnostics-Di049OpT.js} +1 -1
  8. package/dist/JsSipAdapter-BBRrDaM4.cjs +1 -0
  9. package/dist/{JsSipAdapter-CV6q6UUY.js → JsSipAdapter-Bke1Qjfe.js} +22 -17
  10. package/dist/SharedWorkerProtocol-39dch6xL.cjs +1 -0
  11. package/dist/{SharedWorkerProtocol-jfo9N5wa.js → SharedWorkerProtocol-DKVQ5-po.js} +5 -1
  12. package/dist/core/CCBarClient.d.ts +22 -2
  13. package/dist/{createJsSipFactory-yttVU3d6.js → createJsSipFactory-9CPsweDR.js} +4 -1
  14. package/dist/{createJsSipFactory-2X4FBIU2.cjs → createJsSipFactory-Dr8HbLl-.cjs} +1 -1
  15. package/dist/diagnostics/index.cjs +1 -1
  16. package/dist/diagnostics/index.js +1 -1
  17. package/dist/errors/CCBarError.d.ts +6 -0
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.js +3 -3
  20. package/dist/index.umd.js +2 -2
  21. package/dist/legacy/index.cjs +1 -1
  22. package/dist/legacy/index.js +2 -2
  23. package/dist/shared/SharedWorkerProtocol.d.ts +2 -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/ui/index.cjs +1 -1
  28. package/dist/version.d.ts +1 -0
  29. package/package.json +111 -109
  30. package/dist/CCBarClient-DdLM2NKm.cjs +0 -1
  31. package/dist/JsSipAdapter-BM7I95Xb.cjs +0 -1
  32. package/dist/SharedWorkerProtocol-V_x8Erjv.cjs +0 -1
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../SharedWorkerProtocol-V_x8Erjv.cjs"),t=require("../CCBarClient-DdLM2NKm.cjs");require("../createJsSipFactory-2X4FBIU2.cjs");var n=class extends Error{code=`LEGACY_METHOD_DEPRECATED`;constructor(e,t){super(`${e} 已废弃:${t}`),this.name=`DeprecatedError`}},r=class{client;warnedMethods=new Set;unsubscribeIncoming;currentCall;constructor(e){this.client=new t.t(e),this.unsubscribeIncoming=this.client.on(`call.incoming`,({callId:e})=>{this.currentCall=this.client.getCalls().find(t=>t.id===e)})}getToken(...e){return this.warn(`getToken`,`请改用 client.connect()`),this.client.connect()}getAccount(...e){return this.warn(`getAccount`,`请改用 client.connect()`),this.client.connect()}login(...e){return this.warn(`login`,`请改用 client.connect()`),this.client.connect()}async call(e,...t){this.warn(`call`,`请改用 client.dial({ destination })`);let n=await this.client.dial({destination:String(e)});return this.currentCall=n,n}async insideCall(e,...t){this.warn(`insideCall`,`请改用 client.dial({ destination, type: 'extension' })`);let n=await this.client.dial({destination:String(e),type:`extension`});return this.currentCall=n,n}answer(...e){this.warn(`answer`,`请改用 call.answer()`);let t=this.requireCurrentCall();return this.client.answer(t.id)}async hangup(...e){this.warn(`hangup`,`请改用 call.hangup()`);let t=this.requireCurrentCall();try{await t.hangup()}finally{this.currentCall===t&&(this.currentCall=void 0)}}holdCall(...e){return this.warn(`holdCall`,`请改用 call.hold()`),this.requireCurrentCall().hold()}unholdCall(...e){return this.warn(`unholdCall`,`请改用 call.resume()`),this.requireCurrentCall().resume()}transSo(e,...t){return this.warn(`transSo`,`请改用 call.transfer({ target, type: 'blind' })`),this.requireCurrentCall().transfer({target:String(e),type:`blind`})}async signOut(...e){this.warn(`signOut`,`请改用 client.disconnect() 和 client.dispose()`);let t;try{await this.client.disconnect()}catch(e){t=e}try{await this.client.dispose()}catch(e){t??=e}if(this.unsubscribeIncoming(),this.currentCall=void 0,t!==void 0)throw t}setId(...e){return this.warn(`setId`,`请改用 client.setAgentStatus('available')`),this.client.setAgentStatus(`available`)}setBu(...e){throw this.warn(`setBu`,`busy由通话状态或服务端状态策略控制,浏览器不得伪造`),new n(`setBu()`,`busy由通话状态或服务端状态策略控制,浏览器不得伪造`)}setRe(...e){return this.warn(`setRe`,`请改用 client.setAgentStatus('break')`),this.client.setAgentStatus(`break`)}requireCurrentCall(){let t=this.client.getActiveCall();if(t!==void 0&&(this.currentCall=t),this.currentCall===void 0)throw new e.i(`CALL_NOT_CONNECTED`,`call`,!1);return this.currentCall}warn(e,t){i()&&!this.warnedMethods.has(e)&&(this.warnedMethods.add(e),console.warn(`[CCBarSDK] ${e}() 已废弃。${t}`))}};function i(){return!1}var a=`0.1.0`;typeof window<`u`&&(window.CCBarSDK=r),exports.CCBarSDK=r,exports.DeprecatedError=n,exports.legacyVersion=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../SharedWorkerProtocol-39dch6xL.cjs"),t=require("../CCBarClient-DCQ8XjcL.cjs");require("../createJsSipFactory-Dr8HbLl-.cjs");var n=class extends Error{code=`LEGACY_METHOD_DEPRECATED`;constructor(e,t){super(`${e} 已废弃:${t}`),this.name=`DeprecatedError`}},r=class{client;warnedMethods=new Set;unsubscribeIncoming;currentCall;constructor(e){this.client=new t.t(e),this.unsubscribeIncoming=this.client.on(`call.incoming`,({callId:e})=>{this.currentCall=this.client.getCalls().find(t=>t.id===e)})}getToken(...e){return this.warn(`getToken`,`请改用 client.connect()`),this.client.connect()}getAccount(...e){return this.warn(`getAccount`,`请改用 client.connect()`),this.client.connect()}login(...e){return this.warn(`login`,`请改用 client.connect()`),this.client.connect()}async call(e,...t){this.warn(`call`,`请改用 client.dial({ destination })`);let n=await this.client.dial({destination:String(e)});return this.currentCall=n,n}async insideCall(e,...t){this.warn(`insideCall`,`请改用 client.dial({ destination, type: 'extension' })`);let n=await this.client.dial({destination:String(e),type:`extension`});return this.currentCall=n,n}answer(...e){this.warn(`answer`,`请改用 call.answer()`);let t=this.requireCurrentCall();return this.client.answer(t.id)}async hangup(...e){this.warn(`hangup`,`请改用 call.hangup()`);let t=this.requireCurrentCall();try{await t.hangup()}finally{this.currentCall===t&&(this.currentCall=void 0)}}holdCall(...e){return this.warn(`holdCall`,`请改用 call.hold()`),this.requireCurrentCall().hold()}unholdCall(...e){return this.warn(`unholdCall`,`请改用 call.resume()`),this.requireCurrentCall().resume()}transSo(e,...t){return this.warn(`transSo`,`请改用 call.transfer({ target, type: 'blind' })`),this.requireCurrentCall().transfer({target:String(e),type:`blind`})}async signOut(...e){this.warn(`signOut`,`请改用 client.disconnect() 和 client.dispose()`);let t;try{await this.client.disconnect()}catch(e){t=e}try{await this.client.dispose()}catch(e){t??=e}if(this.unsubscribeIncoming(),this.currentCall=void 0,t!==void 0)throw t}setId(...e){return this.warn(`setId`,`请改用 client.setAgentStatus('available')`),this.client.setAgentStatus(`available`)}setBu(...e){throw this.warn(`setBu`,`busy由通话状态或服务端状态策略控制,浏览器不得伪造`),new n(`setBu()`,`busy由通话状态或服务端状态策略控制,浏览器不得伪造`)}setRe(...e){return this.warn(`setRe`,`请改用 client.setAgentStatus('break')`),this.client.setAgentStatus(`break`)}requireCurrentCall(){let t=this.client.getActiveCall();if(t!==void 0&&(this.currentCall=t),this.currentCall===void 0)throw new e.i(`CALL_NOT_CONNECTED`,`call`,!1);return this.currentCall}warn(e,t){i()&&!this.warnedMethods.has(e)&&(this.warnedMethods.add(e),console.warn(`[CCBarSDK] ${e}() 已废弃。${t}`))}};function i(){return!1}var a=`0.1.0`;typeof window<`u`&&(window.CCBarSDK=r),exports.CCBarSDK=r,exports.DeprecatedError=n,exports.legacyVersion=a;
@@ -1,5 +1,5 @@
1
- import { i as e } from "../SharedWorkerProtocol-jfo9N5wa.js";
2
- import { t } from "../CCBarClient-xC63i3Qd.js";
1
+ import { i as e } from "../SharedWorkerProtocol-DKVQ5-po.js";
2
+ import { t } from "../CCBarClient-CcPfEToZ.js";
3
3
  //#region src/legacy/CCBarSDK.ts
4
4
  var n = class extends Error {
5
5
  code = "LEGACY_METHOD_DEPRECATED";
@@ -7,6 +7,8 @@ export interface SerializedCCBarError {
7
7
  readonly retryable: boolean;
8
8
  readonly requestId?: string;
9
9
  readonly callId?: string;
10
+ readonly serverCode?: string;
11
+ readonly status?: number;
10
12
  readonly message: string;
11
13
  }
12
14
  export type WorkerRequest = {
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SharedWorkerProtocol-V_x8Erjv.cjs");require("./createJsSipFactory-2X4FBIU2.cjs");var t=class{ports=new Map;requestResults=new Map;lifecycleState=`connected`;bootstrapOwner;options;constructor(e={}){this.options={timeoutMs:e.timeoutMs??15e3,...e}}attach(e,t){let n=e;o(t);let r=this.ports.get(t);r!==void 0&&r!==n&&this.detachPort(t,r),this.ports.set(t,n),n.onmessage=e=>{this.handlePortMessage(n,t,e.data)},n.start(),n.onclose=()=>{this.ports.get(t)===n&&this.detachPort(t,n)};let i=!1;return()=>{i||(i=!0,this.ports.get(t)===n&&this.detachPort(t,n))}}async handle(t){let n=e.t(t);if(!a(n))return i(t.requestId,new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1));let r=`${n.tabId}:${n.requestId}`,o=this.requestResults.get(r);if(o!==void 0)return o;let s=this.execute(n).finally(()=>{this.requestResults.get(r)===s&&this.requestResults.delete(r)});return this.requestResults.set(r,s),s}broadcast(e){let t=r(e);this.ports.forEach(e=>e.postMessage(t))}getTabIds(){return[...this.ports.keys()]}getLifecycleState(){return this.lifecycleState}restart(){this.lifecycleState=`reconnecting`,this.bootstrapOwner=void 0,this.broadcast({version:1,type:`event`,event:`connection.stateChanged`,payload:{state:`reconnecting`}})}markReady(t=[]){this.lifecycleState=`connected`,this.bootstrapOwner=void 0,this.broadcast({version:1,type:`event`,event:`connection.stateChanged`,payload:{state:`connected`}}),t.forEach(t=>{this.broadcast({version:1,type:`event`,event:`call.snapshot`,payload:e.n(t)})})}async execute(t){try{if(this.assertCommandAllowed(t),t.type===`detach`){let e=this.ports.get(t.tabId);e!==void 0&&this.detachPort(t.tabId,e)}t.type===`command`&&t.command===`bootstrap`&&this.claimBootstrap(t.tabId);let e=await s(this.options.handleRequest?.(t)??Promise.resolve({attached:t.tabId}),this.options.timeoutMs);return{version:1,type:`response`,requestId:t.requestId,ok:!0,result:e}}catch(n){let r=n instanceof e.i?n:n instanceof c?new e.i(`NETWORK_TIMEOUT`,`network`,!0,{requestId:t.requestId}):new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1,{requestId:t.requestId,cause:n});return i(t.requestId,r)}}assertCommandAllowed(t){if(t.type===`command`&&this.lifecycleState===`reconnecting`&&(t.command===`dial`||t.command===`answer`))throw new e.i(`CALL_OPERATION_NOT_ALLOWED`,`call`,!0,{callId:t.payload?.callId})}claimBootstrap(t){if(this.bootstrapOwner===void 0){this.bootstrapOwner=t;return}if(this.bootstrapOwner!==t)throw new e.i(`CALL_OPERATION_NOT_ALLOWED`,`call`,!0)}async handlePortMessage(t,n,r){try{let o=e.t(r);if(!a(o)||o.tabId!==n){t.postMessage(i(typeof r==`object`&&r&&`requestId`in r&&typeof r.requestId==`string`?r.requestId:``,new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1)));return}t.postMessage(await this.handle(o))}catch(e){let n=typeof r==`object`&&r&&`requestId`in r&&typeof r.requestId==`string`?r.requestId:``;t.postMessage(i(n,e))}}detachPort(e,t){t.onmessage=null,t.onclose=null,this.ports.delete(e),this.options.onPortDetached?.(e)}};function n(n,r=new t){return n.onconnect=t=>{let n=t.ports[0];if(n===void 0)return;let o=!0;n.onmessage=t=>{try{let i=e.t(t.data);if(!a(i)||i.type!==`attach`)throw new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1);o=!1,r.attach(n,i.tabId),r.handle(i).then(e=>n.postMessage(e))}catch(e){let r=typeof t.data==`object`&&t.data!==null&&`requestId`in t.data&&typeof t.data.requestId==`string`?t.data.requestId:``;n.postMessage(i(r,e))}},n.start(),o||(n.onmessage=null)},r}function r(t){if((t.event===`call.snapshot`||t.event===`call.created`)&&typeof t.payload==`object`&&t.payload!==null)return{...t,payload:e.n(t.payload)};if(t.event===`call.failed`&&typeof t.payload==`object`&&t.payload!==null&&`error`in t.payload){let n=t.payload;return{...t,payload:{...typeof n.callId==`string`?{callId:n.callId}:{},error:e.r(n.error)}}}return t.event===`error`?{...t,payload:e.r(t.payload)}:structuredClone(t)}function i(t,n){return{version:1,type:`response`,requestId:t,ok:!1,error:e.r(n)}}function a(e){return typeof e==`object`&&!!e&&`requestId`in e&&`tabId`in e&&`type`in e&&(e.type===`attach`||e.type===`detach`||e.type===`command`)}function o(t){if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(t))throw new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1)}async function s(e,t){let n;try{return await Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(new c),t)})])}finally{n!==void 0&&clearTimeout(n)}}var c=class extends Error{};function l(e){return n(e)}var u=typeof globalThis==`object`&&`onconnect`in globalThis?n(globalThis):void 0;exports.createSharedWorkerRuntime=l,exports.sharedWorkerRuntime=u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SharedWorkerProtocol-39dch6xL.cjs");require("./createJsSipFactory-Dr8HbLl-.cjs");var t=class{ports=new Map;requestResults=new Map;lifecycleState=`connected`;bootstrapOwner;options;constructor(e={}){this.options={timeoutMs:e.timeoutMs??15e3,...e}}attach(e,t){let n=e;o(t);let r=this.ports.get(t);r!==void 0&&r!==n&&this.detachPort(t,r),this.ports.set(t,n),n.onmessage=e=>{this.handlePortMessage(n,t,e.data)},n.start(),n.onclose=()=>{this.ports.get(t)===n&&this.detachPort(t,n)};let i=!1;return()=>{i||(i=!0,this.ports.get(t)===n&&this.detachPort(t,n))}}async handle(t){let n=e.t(t);if(!a(n))return i(t.requestId,new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1));let r=`${n.tabId}:${n.requestId}`,o=this.requestResults.get(r);if(o!==void 0)return o;let s=this.execute(n).finally(()=>{this.requestResults.get(r)===s&&this.requestResults.delete(r)});return this.requestResults.set(r,s),s}broadcast(e){let t=r(e);this.ports.forEach(e=>e.postMessage(t))}getTabIds(){return[...this.ports.keys()]}getLifecycleState(){return this.lifecycleState}restart(){this.lifecycleState=`reconnecting`,this.bootstrapOwner=void 0,this.broadcast({version:1,type:`event`,event:`connection.stateChanged`,payload:{state:`reconnecting`}})}markReady(t=[]){this.lifecycleState=`connected`,this.bootstrapOwner=void 0,this.broadcast({version:1,type:`event`,event:`connection.stateChanged`,payload:{state:`connected`}}),t.forEach(t=>{this.broadcast({version:1,type:`event`,event:`call.snapshot`,payload:e.n(t)})})}async execute(t){try{if(this.assertCommandAllowed(t),t.type===`detach`){let e=this.ports.get(t.tabId);e!==void 0&&this.detachPort(t.tabId,e)}t.type===`command`&&t.command===`bootstrap`&&this.claimBootstrap(t.tabId);let e=await s(this.options.handleRequest?.(t)??Promise.resolve({attached:t.tabId}),this.options.timeoutMs);return{version:1,type:`response`,requestId:t.requestId,ok:!0,result:e}}catch(n){let r=n instanceof e.i?n:n instanceof c?new e.i(`NETWORK_TIMEOUT`,`network`,!0,{requestId:t.requestId}):new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1,{requestId:t.requestId,cause:n});return i(t.requestId,r)}}assertCommandAllowed(t){if(t.type===`command`&&this.lifecycleState===`reconnecting`&&(t.command===`dial`||t.command===`answer`))throw new e.i(`CALL_OPERATION_NOT_ALLOWED`,`call`,!0,{callId:t.payload?.callId})}claimBootstrap(t){if(this.bootstrapOwner===void 0){this.bootstrapOwner=t;return}if(this.bootstrapOwner!==t)throw new e.i(`CALL_OPERATION_NOT_ALLOWED`,`call`,!0)}async handlePortMessage(t,n,r){try{let o=e.t(r);if(!a(o)||o.tabId!==n){t.postMessage(i(typeof r==`object`&&r&&`requestId`in r&&typeof r.requestId==`string`?r.requestId:``,new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1)));return}t.postMessage(await this.handle(o))}catch(e){let n=typeof r==`object`&&r&&`requestId`in r&&typeof r.requestId==`string`?r.requestId:``;t.postMessage(i(n,e))}}detachPort(e,t){t.onmessage=null,t.onclose=null,this.ports.delete(e),this.options.onPortDetached?.(e)}};function n(n,r=new t){return n.onconnect=t=>{let n=t.ports[0];if(n===void 0)return;let o=!0;n.onmessage=t=>{try{let i=e.t(t.data);if(!a(i)||i.type!==`attach`)throw new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1);o=!1,r.attach(n,i.tabId),r.handle(i).then(e=>n.postMessage(e))}catch(e){let r=typeof t.data==`object`&&t.data!==null&&`requestId`in t.data&&typeof t.data.requestId==`string`?t.data.requestId:``;n.postMessage(i(r,e))}},n.start(),o||(n.onmessage=null)},r}function r(t){if((t.event===`call.snapshot`||t.event===`call.created`)&&typeof t.payload==`object`&&t.payload!==null)return{...t,payload:e.n(t.payload)};if(t.event===`call.failed`&&typeof t.payload==`object`&&t.payload!==null&&`error`in t.payload){let n=t.payload;return{...t,payload:{...typeof n.callId==`string`?{callId:n.callId}:{},error:e.r(n.error)}}}return t.event===`error`?{...t,payload:e.r(t.payload)}:structuredClone(t)}function i(t,n){return{version:1,type:`response`,requestId:t,ok:!1,error:e.r(n)}}function a(e){return typeof e==`object`&&!!e&&`requestId`in e&&`tabId`in e&&`type`in e&&(e.type===`attach`||e.type===`detach`||e.type===`command`)}function o(t){if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(t))throw new e.i(`SDK_INTERNAL_ERROR`,`internal`,!1)}async function s(e,t){let n;try{return await Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(new c),t)})])}finally{n!==void 0&&clearTimeout(n)}}var c=class extends Error{};function l(e){return n(e)}var u=typeof globalThis==`object`&&`onconnect`in globalThis?n(globalThis):void 0;exports.createSharedWorkerRuntime=l,exports.sharedWorkerRuntime=u;
@@ -1,4 +1,4 @@
1
- import { i as e, n as t, r as n, t as r } from "./SharedWorkerProtocol-jfo9N5wa.js";
1
+ import { i as e, n as t, r as n, t as r } from "./SharedWorkerProtocol-DKVQ5-po.js";
2
2
  //#region src/shared/SharedWorkerRuntime.ts
3
3
  var i = class {
4
4
  ports = /* @__PURE__ */ new Map();
package/dist/styles.css CHANGED
@@ -1,7 +1,7 @@
1
- @import './tokens.css';
2
- @import './base.css';
3
- @import './compact.css';
4
- @import './panel.css';
5
- @import './mobile.css';
6
- @import './dark.css';
7
- @import './reduced-motion.css';
1
+ @import './tokens.css';
2
+ @import './base.css';
3
+ @import './compact.css';
4
+ @import './panel.css';
5
+ @import './mobile.css';
6
+ @import './dark.css';
7
+ @import './reduced-motion.css';
package/dist/ui/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../createJsSipFactory-2X4FBIU2.cjs");var e={call:`Call`,numberLabel:`Number`,statusReady:`Ready`,statusSetup:`Not initialized`,statusConnecting:`Connecting`,statusIncoming:`Incoming call`,statusActive:`On a call`,statusHeld:`On hold`,statusDialing:`Dialing`,statusEnded:`Call ended`,statusFailed:`Call failed`,statusUnsupported:`Unsupported browser`,statusPermission:`Microphone unavailable`,statusError:`Unable to continue`,incoming:`Incoming call`,answer:`Answer`,reject:`Decline`,hangup:`Hang up`,mute:`Mute`,unmute:`Unmute`,hold:`Hold`,resume:`Resume`,transfer:`Transfer`,blindTransfer:`Blind transfer`,more:`More`,devices:`Devices`,enablePhone:`Enable phone`,retryPermission:`Check again`,permissionTitle:`Microphone unavailable`,permissionBody:`Allow microphone access in the browser settings, then check again.`,errorTitle:`Unable to continue`,errorBody:`Check the network, origin allowlist, or agent permission, then retry.`,currentCall:`Current call`,inbound:`Inbound`,outbound:`Outbound`,foregroundChecking:`Back in foreground, checking the connection`,foregroundFailed:`Foreground recovery failed. Retry.`,signIn:`Sign in`,signOut:`Sign out`,outboundCall:`Outbound`,internalCall:`Internal`,agentIdle:`Available`,agentBusy:`Busy`,agentBreak:`Break`,agentBusyHint:`Busy is controlled by the call or server`,rowSignIn:`Presence`,rowCall:`Call`,rowAgent:`Agent`,extensionLabel:`Extension`,extensionPlaceholder:`Optional, assigned by the server`},t={call:`呼叫`,numberLabel:`号码`,statusReady:`可拨号`,statusSetup:`未初始化`,statusConnecting:`正在连接`,statusIncoming:`来电`,statusActive:`通话中`,statusHeld:`保持中`,statusDialing:`正在拨号`,statusEnded:`通话结束`,statusFailed:`呼叫失败`,statusUnsupported:`不支持的浏览器`,statusPermission:`无法使用麦克风`,statusError:`无法继续通话`,incoming:`来电`,answer:`接听`,reject:`拒绝`,hangup:`挂断`,mute:`静音`,unmute:`取消静音`,hold:`保持`,resume:`恢复`,transfer:`转接`,blindTransfer:`盲转`,more:`更多`,devices:`设备`,enablePhone:`启用电话`,retryPermission:`重新检测`,permissionTitle:`无法使用麦克风`,permissionBody:`请在浏览器设置中允许本网站访问麦克风,然后重新检测。`,errorTitle:`无法继续通话`,errorBody:`请检查网络、域名授权或坐席权限后重试。`,currentCall:`当前通话`,inbound:`呼入`,outbound:`呼出`,foregroundChecking:`已返回前台,正在检查连接`,foregroundFailed:`前台恢复失败,请重试`,signIn:`签入`,signOut:`退签`,outboundCall:`外呼`,internalCall:`内呼`,agentIdle:`空闲`,agentBusy:`置忙`,agentBreak:`休息`,agentBusyHint:`置忙由通话或服务端状态控制`,rowSignIn:`签入`,rowCall:`通话`,rowAgent:`坐席`,extensionLabel:`分机`,extensionPlaceholder:`可空,由服务端分配`};function n(n){return n.toLowerCase().startsWith(`en`)?e:t}function r(e,t,r){return{...n(e),...r===void 0?{}:r(e),...t??{}}}async function i(e){await e.media.requestPermission(),await e.initialize(),await e.connect()}function a(e,t={}){let n=t.document??(typeof document>`u`?void 0:document);if(n===void 0)return()=>void 0;let r=()=>{if(n.visibilityState===`hidden`){t.onHidden?.();return}t.onChecking?.(),e.recover().then(()=>t.onRecovered?.()).catch(e=>t.onFailed?.(e))};return n.addEventListener(`visibilitychange`,r),()=>n.removeEventListener(`visibilitychange`,r)}function o(e){return e.replace(/\s+/g,``)}function s(e,t,n){return o(e).length>0&&n===`connected`&&t!==`denied`}async function c(e,t,n){let r=o(t);r!==``&&await e.dial({destination:r,...n===void 0?{}:{type:n}})}async function l(e,t){return t?await e.unmute():await e.mute(),!t}async function u(e){e.state===`held`?await e.resume():await e.hold()}async function d(e,t){await e.sendDtmf(t)}async function f(e,t){let n=o(t);n!==``&&await e.transfer({target:n,type:`blind`})}function p(e,t={}){let n=document.createElement(e);return t.className!==void 0&&(n.className=t.className),t.text!==void 0&&(n.textContent=t.text),Object.entries(t.attrs??{}).forEach(([e,t])=>n.setAttribute(e,t)),t.children?.forEach(e=>n.append(e)),n}function m(e){return p(`div`,{attrs:{part:`status-rail`,role:`status`,"aria-live":`polite`},text:e})}function h(e,t,n=`destination`){let r=p(`input`,{attrs:{id:e,type:`tel`,inputmode:`tel`,name:n,autocomplete:`tel`}});return{field:p(`div`,{children:[p(`label`,{attrs:{for:e},text:t}),r]}),input:r}}var g=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`*`,`0`,`#`];function _(e){return e.mode===`compact`?v(e):y(e)}function v(e){let{field:t,input:n}=h(`ccbar-destination`,e.messages.numberLabel??`号码`);n.value=e.destination;let r=e.view.kind===`ready`||e.view.kind===`setup`||e.view.kind===`ended`?p(`button`,{attrs:{type:`button`,"data-action":`dial`,part:`call-button`,...e.canDial?{}:{disabled:``}},text:e.messages.call??`呼叫`}):p(`button`,{attrs:{type:`button`,"data-action":`hangup`,part:`hangup-button`},text:e.messages.hangup??`挂断`}),i=[S(e.messages.status??``,e.floating),p(`div`,{className:`ccbar-toolbar`,children:[t,e.view.kind===`active`||e.view.kind===`held`?E(e):p(`span`),r,p(`button`,{attrs:{type:`button`,"data-action":`more`},text:e.messages.more??`更多`})]})];return e.moreOpen&&i.push(p(`div`,{className:`ccbar-more`,children:[D(e.view,e.messages),p(`button`,{attrs:{type:`button`,"data-action":`devices`},text:e.messages.devices??`设备`})]})),p(`div`,{attrs:{part:`panel`,"data-layout":`compact`},children:i})}function y(e){let{input:t}=h(`ccbar-destination`,e.messages.numberLabel??`号码`),{field:n}=h(`ccbar-transfer-target`,e.messages.transfer??`转接号码`,`transfer-target`);t.value=e.destination,t.placeholder=e.messages.numberLabel??`号码`,t.setAttribute(`aria-label`,e.messages.numberLabel??`号码`);let r=e.view.kind===`active`||e.view.kind===`held`||e.view.kind===`dialing`,i=e.view.kind===`held`,a=e.view.kind===`connecting`,o=[S(e.messages.status??``,e.floating,e.extension,e.messages.extensionLabel??`分机`),b(e.messages.rowSignIn??`签入`,[C(e),x(`signin`,e.messages.signIn??`签入`,{variant:`primary`,disabled:e.connected||a}),x(`signout`,e.messages.signOut??`退签`,{disabled:!e.connected})]),b(e.messages.numberLabel??`号码`,[t],{labelFor:t.id}),b(e.messages.rowCall??`通话`,[x(`dial`,e.messages.outboundCall??`外呼`,{variant:`primary`,disabled:!e.canDial}),x(`dial-internal`,e.messages.internalCall??`内呼`,{disabled:!e.canDial}),x(`hangup`,e.messages.hangup??`挂断`,{variant:`danger`,disabled:!r}),x(`transfer`,e.messages.transfer??`转接`,{disabled:!r}),x(`hold`,e.messages.hold??`保持`,{pressed:i,disabled:!r||i}),x(`resume`,e.messages.resume??`恢复`,{disabled:!i}),E(e)]),...r?[b(e.messages.transfer??`转接号码`,[n],{labelFor:`ccbar-transfer-target`})]:[],b(e.messages.rowAgent??`坐席`,[x(`agent-available`,e.messages.agentIdle??`空闲`,{pressed:e.agentStatus===`available`,disabled:!e.connected}),x(`agent-busy`,e.messages.agentBusy??`置忙`,{disabled:!0,title:e.messages.agentBusyHint??`置忙由通话或服务端状态控制`}),x(`agent-break`,e.messages.agentBreak??`休息`,{pressed:e.agentStatus===`break`,disabled:!e.connected})]),T()];return e.calls.length>1&&o.push(O(e.calls,e.messages)),p(`div`,{attrs:{part:`panel`,"data-layout":`panel`},children:o})}function b(e,t,n={}){return p(`div`,{className:`ccbar-bar-row`,children:[p(n.labelFor===void 0?`div`:`label`,{className:`ccbar-bar-label`,attrs:n.labelFor===void 0?{}:{for:n.labelFor},text:e}),p(`div`,{className:`ccbar-bar-keys`,children:t})]})}function x(e,t,n={}){let r=e===`dial`?`call-button`:e===`hangup`?`hangup-button`:void 0;return p(`button`,{attrs:{type:`button`,"data-action":e,...r===void 0?{}:{part:r},...n.variant===void 0?{}:{"data-variant":n.variant},...n.disabled===!0?{disabled:``}:{},...n.pressed===void 0?{}:{"aria-pressed":n.pressed?`true`:`false`},...n.title===void 0?{}:{title:n.title}},text:t})}function S(e,t,n=``,r=`分机`){let i=w(e);return t&&i.setAttribute(`data-drag-handle`,``),n!==``&&i.append(p(`span`,{className:`ccbar-ext-chip`,text:`${r} ${n}`})),i}function C(e){let t=p(`input`,{attrs:{id:`ccbar-extension`,type:`tel`,inputmode:`numeric`,name:`extension`,autocomplete:`off`,placeholder:e.messages.extensionPlaceholder??`可空,由服务端分配`,"aria-label":e.messages.extensionLabel??`分机`}});return t.value=e.extension,e.connected&&(t.readOnly=!0),t}function w(e){return m(e)}function T(){return p(`div`,{className:`ccbar-dialpad`,children:g.map(e=>p(`button`,{attrs:{type:`button`,"data-digit":e},text:e}))})}function E(e){return p(`button`,{attrs:{type:`button`,"data-action":`mute`,"aria-pressed":e.muted?`true`:`false`},text:e.muted?e.messages.unmute??`取消静音`:e.messages.mute??`静音`})}function D(e,t){let n=e.kind===`held`;return p(`button`,{attrs:{type:`button`,"data-action":`hold`,"aria-pressed":n?`true`:`false`},text:n?t.resume??`恢复`:t.hold??`保持`})}function O(e,t){return p(`ul`,{className:`ccbar-call-list`,children:e.map(e=>p(`li`,{children:[p(`button`,{attrs:{type:`button`,"data-call-id":e.id},children:[p(`span`,{text:`${e.destination} ${e.direction===`inbound`?t.inbound??`呼入`:t.outbound??`呼出`} ${k(e.state,t)}`}),...e.current?[p(`span`,{className:`ccbar-call-current`,text:t.currentCall??`当前通话`})]:[]]})]}))})}function k(e,t){return e===`held`?t.statusHeld??`保持中`:e===`active`?t.statusActive??`通话中`:e===`dialing`||e===`ringing`||e===`connecting`?t.statusDialing??`拨号中`:e}function A(e){switch(e.view.kind){case`permission-error`:return p(`div`,{attrs:{part:`panel`},children:[m(e.messages.permissionTitle??`无法使用麦克风`),p(`h2`,{text:e.messages.permissionTitle??`无法使用麦克风`}),p(`p`,{text:e.messages.permissionBody??`请在浏览器设置中允许本网站访问麦克风,然后重新检测。`}),p(`button`,{attrs:{type:`button`,"data-action":`retry-permission`},text:e.messages.retryPermission??`重新检测`})]});case`unrecoverable-error`:case`unsupported`:return p(`div`,{attrs:{part:`panel`},children:[p(`div`,{attrs:{role:`alert`,part:`status-rail`},text:e.messages.errorTitle??`无法继续通话`}),p(`p`,{text:e.messages.errorBody??`请检查网络、域名授权或坐席权限后重试。`})]});case`setup`:case`connecting`:case`incoming`:case`active`:case`held`:case`dialing`:case`ended`:case`ready`:return p(`div`,{attrs:{part:`panel`},children:[m(e.messages.status??``)]});default:return e.view}}function j(e){return p(`div`,{attrs:{part:`panel`},children:[m(e.messages.status??`来电`),p(`p`,{text:e.view.from}),p(`button`,{attrs:{type:`button`,"data-action":`answer`},text:e.messages.answer??`接听`}),p(`button`,{attrs:{type:`button`,"data-action":`reject`},text:e.messages.reject??`拒绝`})]})}var M=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`*`,`0`,`#`];function N(e){return F(p(`div`,{attrs:{part:`panel`,"data-layout":`mobile`},children:[m(e.status),p(`button`,{attrs:{type:`button`,"data-action":`enable-phone`,...e.enabling?{disabled:``}:{}},text:e.enablePhone??`启用电话`})]}))}function P(e){let t=e.view.kind===`active`||e.view.kind===`dialing`,n=[m(e.messages.status??``)];if(t){let t=e.view.kind===`active`||e.view.kind===`dialing`?e.view.destination??``:``;n.push(p(`p`,{text:t}),I(p(`button`,{attrs:{type:`button`,"data-action":`mute`,"aria-pressed":e.muted?`true`:`false`},text:e.muted?e.messages.unmute??`取消静音`:e.messages.mute??`静音`}),44),L(),I(p(`button`,{attrs:{type:`button`,"data-action":`hangup`,part:`hangup-button`},text:e.messages.hangup??`挂断`}),52))}else{let{field:t,input:r}=h(`ccbar-destination`,e.messages.numberLabel??`号码`);r.value=e.destination,n.push(t,L(),p(`button`,{attrs:{type:`button`,"data-action":`dial`,part:`call-button`,...e.canDial?{}:{disabled:``}},text:e.messages.call??`呼叫`}))}return e.showOutputDevice&&n.push(p(`button`,{attrs:{type:`button`,"data-action":`devices`},text:e.messages.devices??`设备`})),F(p(`div`,{attrs:{part:`panel`,"data-layout":`mobile`},children:n}))}function F(e){return e.style.minHeight=`100dvh`,e.style.paddingBottom=`max(16px, env(safe-area-inset-bottom))`,e}function I(e,t){return e.style.minHeight=`${t}px`,e}function L(){return p(`div`,{className:`ccbar-dialpad`,children:M.map(e=>p(`button`,{attrs:{type:`button`,"data-digit":e},text:e}))})}var R={kind:`permission-error`,code:`MEDIA_PERMISSION_DENIED`,action:`retry-permission`};function z(e){if(e.supported===!1)return{kind:`unsupported`};if(e.permission===`denied`||e.error?.code===`MEDIA_PERMISSION_DENIED`)return R;if(e.error!==void 0&&e.error.code!==`MEDIA_PLAYBACK_BLOCKED`)return{kind:`unrecoverable-error`,code:e.error.code};let t=e.calls.find(e=>e.direction===`inbound`&&(e.state===`ringing`||e.state===`new`));if(t!==void 0)return{kind:`incoming`,callId:t.id,from:t.destination??``};let n=e.calls.find(e=>e.state===`active`);if(n!==void 0)return{kind:`active`,callId:n.id,destination:n.destination};let r=e.calls.find(e=>e.state===`held`);if(r!==void 0)return{kind:`held`,callId:r.id,destination:r.destination};let i=e.calls.find(e=>e.state===`dialing`||e.state===`ringing`||e.state===`connecting`);if(i!==void 0)return{kind:`dialing`,callId:i.id,destination:i.destination};let a=e.calls.find(e=>e.state===`ended`||e.state===`failed`);return a===void 0?e.connectionState===`connecting`||e.connectionState===`reconnecting`?{kind:`connecting`}:e.connectionState===`connected`?{kind:`ready`}:{kind:`setup`}:{kind:`ended`,callId:a.id}}var B=`:root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f5f9;--ccbar-color-border:#d8e0ea;--ccbar-color-title:#0f172a;--ccbar-color-text:#334155;--ccbar-color-muted:#475569;--ccbar-color-primary:#2563eb;--ccbar-color-primary-hover:#1d4ed8;--ccbar-color-success:#15803d;--ccbar-color-warning:#a15c00;--ccbar-color-danger:#b91c1c;--ccbar-radius-sm:6px;--ccbar-radius:8px;--ccbar-radius-lg:12px;--ccbar-control-height:40px;--ccbar-control-height-touch:44px;--ccbar-space-1:4px;--ccbar-space-2:8px;--ccbar-space-3:12px;--ccbar-space-4:16px;--ccbar-space-6:24px;--ccbar-font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;--ccbar-panel-width:560px}:host{color:var(--ccbar-color-text);font-family:var(--ccbar-font-family);display:block}:host([floating]){z-index:2147483646;right:var(--ccbar-space-6);bottom:var(--ccbar-space-6);position:fixed}[part=panel]{background:var(--ccbar-color-surface);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-lg)}[part=status-rail]{align-items:center;gap:var(--ccbar-space-2);min-height:var(--ccbar-control-height);padding:var(--ccbar-space-2) var(--ccbar-space-3);border-bottom:1px solid var(--ccbar-color-border);color:var(--ccbar-color-muted);font-variant-numeric:tabular-nums;display:flex}[part=status-rail]:before{content:"";background:var(--ccbar-color-muted);border-radius:50%;flex:none;width:8px;height:8px}button{min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);background:var(--ccbar-color-surface);color:var(--ccbar-color-title);font:inherit}button[data-action=dial],button[data-action=signin],button[data-action=answer],button[data-variant=primary]{background:var(--ccbar-color-primary);border-color:var(--ccbar-color-primary);color:#fff}button[aria-pressed=true]{border-color:var(--ccbar-color-primary);color:var(--ccbar-color-primary);background:var(--ccbar-color-surface-muted)}button[data-action=hangup],button[data-action=reject]{background:var(--ccbar-color-danger);border-color:var(--ccbar-color-danger);color:#fff;margin-top:var(--ccbar-space-4)}button:disabled{opacity:.5}button:focus-visible,input:focus-visible{outline:2px solid var(--ccbar-color-primary);outline-offset:2px}input[type=tel]{width:100%;min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);font-variant-numeric:tabular-nums}.ccbar-call-list{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;padding:0;list-style:none;display:grid}.ccbar-call-list button{text-align:left;width:100%}.ccbar-call-current{color:var(--ccbar-color-title);display:block}[data-layout=compact]{min-height:80px;max-height:96px}[data-layout=compact] .ccbar-toolbar{gap:var(--ccbar-space-2);padding:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;display:grid}[data-layout=compact] .ccbar-more{right:var(--ccbar-space-3);gap:var(--ccbar-space-2);display:grid;position:absolute}[data-layout=panel]{width:min(var(--ccbar-panel-width), 100%);min-width:420px;max-width:560px;padding:var(--ccbar-space-3)}[data-layout=panel] .ccbar-bar-row{gap:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:48px minmax(0,1fr);align-items:center;min-height:36px;display:grid}[data-layout=panel] .ccbar-bar-row+.ccbar-bar-row{margin-top:var(--ccbar-space-2)}[data-layout=panel] .ccbar-bar-label{color:var(--ccbar-color-muted);font-size:12px}[data-layout=panel] .ccbar-bar-keys{align-items:center;gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=panel] .ccbar-bar-keys button{min-width:48px;min-height:32px;padding:0 10px;font-size:13px}[data-layout=panel] .ccbar-bar-keys input[type=tel]{max-width:320px}[data-layout=panel] .ccbar-bar-keys input[name=extension]{width:148px;max-width:148px}[data-layout=panel] .ccbar-ext-chip{background:var(--ccbar-color-surface-muted);height:28px;color:var(--ccbar-color-title);font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;margin-left:auto;padding:0 10px;font-size:12px;display:inline-flex}[data-layout=panel] [data-action=hangup]{margin-top:0}[data-layout=panel] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;grid-template-columns:repeat(3,1fr);display:grid}[data-layout=panel] .ccbar-safe-actions{gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=mobile]{min-height:100vh;padding:var(--ccbar-space-4);padding-bottom:max(16px, env(safe-area-inset-bottom))}[data-layout=mobile] button{min-width:44px;min-height:44px}[data-layout=mobile] [data-action=enable-phone],[data-layout=mobile] [data-action=dial],[data-layout=mobile] [data-action=hangup]{min-height:52px}[data-layout=mobile] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0;grid-template-columns:repeat(3,1fr);display:grid}:host([data-theme=dark]){--ccbar-color-surface:#0f172a;--ccbar-color-surface-muted:#1e293b;--ccbar-color-border:#334155;--ccbar-color-title:#f8fafc;--ccbar-color-text:#e2e8f0;--ccbar-color-muted:#94a3b8;--ccbar-color-primary:#3b82f6;--ccbar-color-primary-hover:#2563eb;--ccbar-color-success:#22c55e;--ccbar-color-warning:#f59e0b;--ccbar-color-danger:#ef4444}@media (prefers-reduced-motion:reduce){:host *,:host :before,:host :after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}`,V=typeof HTMLElement==`function`?HTMLElement:class{},H=new WeakSet,U=[`connection.stateChanged`,`connection.reconnecting`,`connection.failed`,`call.incoming`,`call.stateChanged`,`call.activeChanged`,`call.ended`,`call.failed`,`media.permissionChanged`,`agent.statusChanged`,`error`],W=class extends V{static get observedAttributes(){return[`mode`,`floating`,`draggable`,`locale`,`theme`]}#e;#t=!1;#n=[];#r=`idle`;#i=`unknown`;#a;#o=new Set;#s=``;#c=``;#l=`offline`;#u=!1;#d=!1;#f=Promise.resolve();#p;#m=!1;#h=!1;#g;#_;#v;#y;#b;get messageResolver(){return this.#y}set messageResolver(e){this.#y=e,this.shadowRoot!==null&&this.render()}get client(){return this.#e}set client(e){this.#O(),this.#e=e,this.#D(),this.render()}get ownsClient(){return this.#t}set ownsClient(e){this.#t=e===!0}connectedCallback(){this.#V(),this.#B(),this.render()}disconnectedCallback(){let e=this.#e,t=this.#t;this.#O(),this.#G(),this.#b?.(),this.#b=void 0,t&&(this.#e=void 0,e?.dispose())}attributeChangedCallback(e){this.#V(),e===`theme`&&this.#B(),this.shadowRoot!==null&&this.render()}render(){let e=this.#k();e!==void 0&&(e.innerHTML=`<style>${B}</style>`,e.append(this.#S(this.#x())))}#x(){let e=this.#e?.getCalls?.().map(e=>({id:e.id,state:e.state,destination:e.destination,direction:this.#o.has(e.id)?`inbound`:`outbound`}))??[];return z({connectionState:this.#r,permission:this.#i,calls:e,error:this.#a})}#S(e){let t=this.#z(),n=this.#_??this.#g??K(e,t),r={...t,status:n},i=this.#C(e,r,n);return i.setAttribute(`data-view`,this.#E()&&!this.#m?`setup`:e.kind),i.hasAttribute(`data-layout`)||i.setAttribute(`data-layout`,this.#E()?`mobile`:`panel`),i}#C(e,t,n){if(this.#E()&&!this.#m)return N({enabling:this.#h,status:n,enablePhone:t.enablePhone});switch(e.kind){case`permission-error`:case`unrecoverable-error`:case`unsupported`:return A({view:e,messages:t});case`incoming`:return this.#E()?P({view:{kind:`ready`},messages:t,destination:this.#s,muted:this.#u,canDial:s(this.#s,this.#i,this.#r),showOutputDevice:this.#e?.media.supportsOutputSelection()===!0}):j({view:e,messages:t});case`setup`:case`connecting`:case`ended`:case`ready`:case`active`:case`held`:case`dialing`:return this.#E()?P({view:e.kind===`held`?{kind:`ready`}:e,messages:t,destination:this.#s,muted:this.#u,canDial:s(this.#s,this.#i,this.#r),showOutputDevice:this.#e?.media.supportsOutputSelection()===!0}):_({mode:this.#T()===`compact`?`compact`:`panel`,view:e,messages:t,destination:this.#s,muted:this.#u,canDial:s(this.#s,this.#i,this.#r),moreOpen:this.#d,floating:this.hasAttribute(`floating`),connected:this.#r===`connected`,agentStatus:this.#l,extension:this.#c,calls:this.#w()});default:return e}}#w(){let e=this.#e?.getActiveCall?.()?.id;return this.#e?.getCalls?.().map(t=>({id:t.id,destination:t.destination,state:t.state,direction:this.#o.has(t.id)?`inbound`:`outbound`,current:t.id===e}))??[]}#T(){let e=this.getAttribute(`mode`);return e===`compact`||e===`mobile`?e:`panel`}#E(){return this.#T()===`mobile`}#D(){let e=this.#e;e!==void 0&&(this.#n.push(e.on(`connection.stateChanged`,t=>{if(this.#r=t.state,t.state!==`connected`&&(this.#l=`offline`),t.state===`connected`){let t=e.getAgent?.()?.extension?.trim();t!==void 0&&t!==``&&(this.#c=t)}})),this.#n.push(e.on(`agent.statusChanged`,e=>{(e.status===`available`||e.status===`offline`||e.status===`break`)&&(this.#l=e.status)})),this.#n.push(e.on(`connection.failed`,e=>{this.#r=`failed`,this.#a={code:e.error.code}})),this.#n.push(e.on(`media.permissionChanged`,e=>{this.#i=e.permission})),this.#n.push(e.on(`error`,e=>{this.#a={code:e.error.code}})),this.#n.push(e.on(`call.incoming`,e=>{this.#o.add(e.callId)})),this.#n.push(e.on(`call.ended`,e=>{this.#o.delete(e.callId),this.#u=!1})),this.#n.push(e.on(`call.failed`,()=>{this.#_=this.#z().statusFailed})),U.forEach(t=>{this.#n.push(e.on(t,()=>this.render()))}),this.#E()&&typeof e.recover==`function`&&(this.#v=a(e,{onChecking:()=>{this.#g=this.#z().foregroundChecking,this.render()},onRecovered:()=>{this.#g=void 0,this.render()},onFailed:()=>{this.#g=this.#z().foregroundFailed,this.render()}})))}#O(){let e=this.#n;this.#n=[],e.forEach(e=>e()),this.#r=`idle`,this.#i=`unknown`,this.#l=`offline`,this.#a=void 0,this.#o.clear(),this.#u=!1,this.#d=!1,this.#m=!1,this.#h=!1,this.#g=void 0,this.#v?.(),this.#v=void 0}#k(){if(typeof this.attachShadow!=`function`)return;let e=this.shadowRoot??this.attachShadow({mode:`open`});return H.has(e)||(H.add(e),e.addEventListener(`click`,e=>this.#A(e)),e.addEventListener(`input`,e=>this.#P(e)),e.addEventListener(`pointerdown`,e=>this.#H(e))),e}#A(e){let t=J(e,this),n=t?.closest(`[data-action="enable-phone"]`);n instanceof HTMLButtonElement&&(n.disabled=!0),this.#f=this.#f.then(()=>this.#F(t)).catch(e=>{this.#_=Y(e),this.render()})}#j(){let e=this.shadowRoot?.querySelector(`input[name="destination"]`);return e instanceof HTMLInputElement?e.value:this.#s}#M(){let e=this.shadowRoot?.querySelector(`input[name="extension"]`);return e instanceof HTMLInputElement?e.value.trim():this.#c}#N(){let e=this.shadowRoot?.querySelector(`input[name="transfer-target"]`);return e instanceof HTMLInputElement?e.value:``}#P(e){let t=J(e,this);if(t instanceof HTMLInputElement&&t.name!==`transfer-target`){if(t.name===`extension`){this.#c=t.value.trim();return}this.#s=t.value,this.#L()}}async#F(e){if(this.#_=void 0,e===void 0)return;let t=e.closest(`[data-call-id]`);if(t instanceof HTMLElement&&t.dataset.callId!==void 0){await this.#e?.setActiveCall(t.dataset.callId);return}let n=e.closest(`[data-digit]`);if(n instanceof HTMLElement&&n.dataset.digit!==void 0){await this.#I(n.dataset.digit);return}let r=e.closest(`[data-action]`);if(!(r instanceof HTMLElement)||r instanceof HTMLButtonElement&&r.disabled&&r.getAttribute(`data-action`)!==`enable-phone`)return;let a=this.#e?.getActiveCall?.();switch(r.getAttribute(`data-action`)){case`signin`:if(this.#e===void 0)return;this.#c=this.#M(),await this.#e.media?.requestPermission?.(),await this.#e.initialize(),await this.#e.connect(this.#c===``?void 0:{extension:this.#c});return;case`signout`:if(this.#e===void 0)return;this.#l=`offline`,await this.#e.disconnect();return;case`dial`:case`dial-internal`:if(this.#s=this.#j(),this.#e===void 0)return;this.#i!==`granted`&&await this.#e.media?.requestPermission?.(),await c(this.#e,this.#s,r.getAttribute(`data-action`)===`dial-internal`?`extension`:void 0);return;case`mute`:if(a===void 0)return;this.#u=await l(a,this.#u),this.#R();return;case`hold`:a!==void 0&&await u(a);return;case`resume`:a!==void 0&&await a.resume();return;case`transfer`:a!==void 0&&await f(a,this.#N());return;case`hangup`:await a?.hangup();return;case`answer`:a!==void 0&&await this.#e?.answer(a.id);return;case`reject`:await a?.reject();return;case`enable-phone`:if(this.#e===void 0||this.#m)return;this.#h=!0;try{await i(this.#e),this.#m=!0}finally{this.#h=!1,this.render()}return;case`more`:this.#d=!this.#d,this.render();return;case`retry-permission`:await this.#e?.media.requestPermission();return;case`devices`:return;case`agent-available`:await this.#e?.setAgentStatus(`available`);return;case`agent-break`:await this.#e?.setAgentStatus(`break`);return;case`agent-busy`:return;default:return}}async#I(e){let t=this.#e?.getActiveCall?.();if(t!==void 0&&(t.state===`active`||t.state===`held`)){await d(t,e);return}this.#s+=e;let n=this.shadowRoot?.querySelector(`input[name="destination"]`);n instanceof HTMLInputElement&&(n.value=this.#s),this.#L()}#L(){let e=!s(this.#s,this.#i,this.#r);for(let t of[`dial`,`dial-internal`]){let n=this.shadowRoot?.querySelector(`[data-action="${t}"]`);n instanceof HTMLButtonElement&&(n.disabled=e)}}#R(){let e=this.shadowRoot?.querySelector(`[data-action="mute"]`);e instanceof HTMLButtonElement&&(e.setAttribute(`aria-pressed`,this.#u?`true`:`false`),e.textContent=this.#u?this.#z().unmute:this.#z().mute)}#z(){return r(this.getAttribute(`locale`)??`zh-CN`,void 0,this.#y)}#B(){this.#b?.(),this.#b=void 0;let e=this.getAttribute(`theme`)??`light`;if(e===`dark`||e===`light`){this.setAttribute(`data-theme`,e);return}if(typeof window>`u`||typeof window.matchMedia!=`function`){this.setAttribute(`data-theme`,`light`);return}let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{this.setAttribute(`data-theme`,t.matches?`dark`:`light`)};n(),t.addEventListener(`change`,n),this.#b=()=>t.removeEventListener(`change`,n)}#V(){this.style.position=this.hasAttribute(`floating`)?`fixed`:``}#H(e){if(!(e instanceof PointerEvent)||!this.hasAttribute(`floating`)||!this.hasAttribute(`draggable`)||(e.target instanceof Element?e.target.closest(`[data-drag-handle]`):null)===null)return;e.preventDefault();let t=this.getBoundingClientRect();this.#p={pointerId:e.pointerId,offsetX:e.clientX-t.left,offsetY:e.clientY-t.top},window.addEventListener(`pointermove`,this.#U),window.addEventListener(`pointerup`,this.#W)}#U=e=>{if(this.#p===void 0||e.pointerId!==this.#p.pointerId)return;let t=window.visualViewport,n=t?.width??window.innerWidth,r=t?.height??window.innerHeight,i=q(e.clientX-this.#p.offsetX,0,Math.max(0,n-this.offsetWidth)),a=q(e.clientY-this.#p.offsetY,0,Math.max(0,r-this.offsetHeight));this.style.left=`${i}px`,this.style.top=`${a}px`,this.style.right=`auto`,this.style.bottom=`auto`};#W=e=>{this.#p!==void 0&&e.pointerId===this.#p.pointerId&&this.#G()};#G(){this.#p=void 0,window.removeEventListener(`pointermove`,this.#U),window.removeEventListener(`pointerup`,this.#W)}};function G(e={}){if(typeof customElements>`u`)return;let t=e.tagName??`xcall-ccbar`;if(customElements.get(t)!==void 0)return;let n=t===`xcall-ccbar`?W:class extends W{};customElements.define(t,n)}function K(e,t){switch(e.kind){case`unsupported`:return t.statusUnsupported;case`permission-error`:return t.statusPermission;case`unrecoverable-error`:return t.statusError;case`setup`:return t.statusSetup;case`connecting`:return t.statusConnecting;case`incoming`:return t.statusIncoming;case`active`:return t.statusActive;case`held`:return t.statusHeld;case`dialing`:return t.statusDialing;case`ended`:return t.statusEnded;case`ready`:return t.statusReady;default:return e}}function q(e,t,n){return Math.min(n,Math.max(t,e))}function J(e,t){for(let n of e.composedPath())if(n instanceof Element&&n!==t)return n;return e.target instanceof Element&&e.target!==t?e.target:void 0}function Y(e){return typeof e==`object`&&e&&`code`in e&&typeof e.code==`string`?e.code:`SDK_INTERNAL_ERROR`}var X=`0.1.0`;exports.XCallCCBarElement=W,exports.defineCCBarElement=G,exports.enUS=e,exports.resolveMessages=r,exports.uiVersion=X,exports.zhCN=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../createJsSipFactory-Dr8HbLl-.cjs");var e={call:`Call`,numberLabel:`Number`,statusReady:`Ready`,statusSetup:`Not initialized`,statusConnecting:`Connecting`,statusIncoming:`Incoming call`,statusActive:`On a call`,statusHeld:`On hold`,statusDialing:`Dialing`,statusEnded:`Call ended`,statusFailed:`Call failed`,statusUnsupported:`Unsupported browser`,statusPermission:`Microphone unavailable`,statusError:`Unable to continue`,incoming:`Incoming call`,answer:`Answer`,reject:`Decline`,hangup:`Hang up`,mute:`Mute`,unmute:`Unmute`,hold:`Hold`,resume:`Resume`,transfer:`Transfer`,blindTransfer:`Blind transfer`,more:`More`,devices:`Devices`,enablePhone:`Enable phone`,retryPermission:`Check again`,permissionTitle:`Microphone unavailable`,permissionBody:`Allow microphone access in the browser settings, then check again.`,errorTitle:`Unable to continue`,errorBody:`Check the network, origin allowlist, or agent permission, then retry.`,currentCall:`Current call`,inbound:`Inbound`,outbound:`Outbound`,foregroundChecking:`Back in foreground, checking the connection`,foregroundFailed:`Foreground recovery failed. Retry.`,signIn:`Sign in`,signOut:`Sign out`,outboundCall:`Outbound`,internalCall:`Internal`,agentIdle:`Available`,agentBusy:`Busy`,agentBreak:`Break`,agentBusyHint:`Busy is controlled by the call or server`,rowSignIn:`Presence`,rowCall:`Call`,rowAgent:`Agent`,extensionLabel:`Extension`,extensionPlaceholder:`Optional, assigned by the server`},t={call:`呼叫`,numberLabel:`号码`,statusReady:`可拨号`,statusSetup:`未初始化`,statusConnecting:`正在连接`,statusIncoming:`来电`,statusActive:`通话中`,statusHeld:`保持中`,statusDialing:`正在拨号`,statusEnded:`通话结束`,statusFailed:`呼叫失败`,statusUnsupported:`不支持的浏览器`,statusPermission:`无法使用麦克风`,statusError:`无法继续通话`,incoming:`来电`,answer:`接听`,reject:`拒绝`,hangup:`挂断`,mute:`静音`,unmute:`取消静音`,hold:`保持`,resume:`恢复`,transfer:`转接`,blindTransfer:`盲转`,more:`更多`,devices:`设备`,enablePhone:`启用电话`,retryPermission:`重新检测`,permissionTitle:`无法使用麦克风`,permissionBody:`请在浏览器设置中允许本网站访问麦克风,然后重新检测。`,errorTitle:`无法继续通话`,errorBody:`请检查网络、域名授权或坐席权限后重试。`,currentCall:`当前通话`,inbound:`呼入`,outbound:`呼出`,foregroundChecking:`已返回前台,正在检查连接`,foregroundFailed:`前台恢复失败,请重试`,signIn:`签入`,signOut:`退签`,outboundCall:`外呼`,internalCall:`内呼`,agentIdle:`空闲`,agentBusy:`置忙`,agentBreak:`休息`,agentBusyHint:`置忙由通话或服务端状态控制`,rowSignIn:`签入`,rowCall:`通话`,rowAgent:`坐席`,extensionLabel:`分机`,extensionPlaceholder:`可空,由服务端分配`};function n(n){return n.toLowerCase().startsWith(`en`)?e:t}function r(e,t,r){return{...n(e),...r===void 0?{}:r(e),...t??{}}}async function i(e){await e.media.requestPermission(),await e.initialize(),await e.connect()}function a(e,t={}){let n=t.document??(typeof document>`u`?void 0:document);if(n===void 0)return()=>void 0;let r=()=>{if(n.visibilityState===`hidden`){t.onHidden?.();return}t.onChecking?.(),e.recover().then(()=>t.onRecovered?.()).catch(e=>t.onFailed?.(e))};return n.addEventListener(`visibilitychange`,r),()=>n.removeEventListener(`visibilitychange`,r)}function o(e){return e.replace(/\s+/g,``)}function s(e,t,n){return o(e).length>0&&n===`connected`&&t!==`denied`}async function c(e,t,n){let r=o(t);r!==``&&await e.dial({destination:r,...n===void 0?{}:{type:n}})}async function l(e,t){return t?await e.unmute():await e.mute(),!t}async function u(e){e.state===`held`?await e.resume():await e.hold()}async function d(e,t){await e.sendDtmf(t)}async function f(e,t){let n=o(t);n!==``&&await e.transfer({target:n,type:`blind`})}function p(e,t={}){let n=document.createElement(e);return t.className!==void 0&&(n.className=t.className),t.text!==void 0&&(n.textContent=t.text),Object.entries(t.attrs??{}).forEach(([e,t])=>n.setAttribute(e,t)),t.children?.forEach(e=>n.append(e)),n}function m(e){return p(`div`,{attrs:{part:`status-rail`,role:`status`,"aria-live":`polite`},text:e})}function h(e,t,n=`destination`){let r=p(`input`,{attrs:{id:e,type:`tel`,inputmode:`tel`,name:n,autocomplete:`tel`}});return{field:p(`div`,{children:[p(`label`,{attrs:{for:e},text:t}),r]}),input:r}}var g=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`*`,`0`,`#`];function _(e){return e.mode===`compact`?v(e):y(e)}function v(e){let{field:t,input:n}=h(`ccbar-destination`,e.messages.numberLabel??`号码`);n.value=e.destination;let r=e.view.kind===`ready`||e.view.kind===`setup`||e.view.kind===`ended`?p(`button`,{attrs:{type:`button`,"data-action":`dial`,part:`call-button`,...e.canDial?{}:{disabled:``}},text:e.messages.call??`呼叫`}):p(`button`,{attrs:{type:`button`,"data-action":`hangup`,part:`hangup-button`},text:e.messages.hangup??`挂断`}),i=[S(e.messages.status??``,e.floating),p(`div`,{className:`ccbar-toolbar`,children:[t,e.view.kind===`active`||e.view.kind===`held`?E(e):p(`span`),r,p(`button`,{attrs:{type:`button`,"data-action":`more`},text:e.messages.more??`更多`})]})];return e.moreOpen&&i.push(p(`div`,{className:`ccbar-more`,children:[D(e.view,e.messages),p(`button`,{attrs:{type:`button`,"data-action":`devices`},text:e.messages.devices??`设备`})]})),p(`div`,{attrs:{part:`panel`,"data-layout":`compact`},children:i})}function y(e){let{input:t}=h(`ccbar-destination`,e.messages.numberLabel??`号码`),{field:n}=h(`ccbar-transfer-target`,e.messages.transfer??`转接号码`,`transfer-target`);t.value=e.destination,t.placeholder=e.messages.numberLabel??`号码`,t.setAttribute(`aria-label`,e.messages.numberLabel??`号码`);let r=e.view.kind===`active`||e.view.kind===`held`||e.view.kind===`dialing`,i=e.view.kind===`held`,a=e.view.kind===`connecting`,o=[S(e.messages.status??``,e.floating,e.extension,e.messages.extensionLabel??`分机`),b(e.messages.rowSignIn??`签入`,[C(e),x(`signin`,e.messages.signIn??`签入`,{variant:`primary`,disabled:e.connected||a}),x(`signout`,e.messages.signOut??`退签`,{disabled:!e.connected})]),b(e.messages.numberLabel??`号码`,[t],{labelFor:t.id}),b(e.messages.rowCall??`通话`,[x(`dial`,e.messages.outboundCall??`外呼`,{variant:`primary`,disabled:!e.canDial}),x(`dial-internal`,e.messages.internalCall??`内呼`,{disabled:!e.canDial}),x(`hangup`,e.messages.hangup??`挂断`,{variant:`danger`,disabled:!r}),x(`transfer`,e.messages.transfer??`转接`,{disabled:!r}),x(`hold`,e.messages.hold??`保持`,{pressed:i,disabled:!r||i}),x(`resume`,e.messages.resume??`恢复`,{disabled:!i}),E(e)]),...r?[b(e.messages.transfer??`转接号码`,[n],{labelFor:`ccbar-transfer-target`})]:[],b(e.messages.rowAgent??`坐席`,[x(`agent-available`,e.messages.agentIdle??`空闲`,{pressed:e.agentStatus===`available`,disabled:!e.connected}),x(`agent-busy`,e.messages.agentBusy??`置忙`,{disabled:!0,title:e.messages.agentBusyHint??`置忙由通话或服务端状态控制`}),x(`agent-break`,e.messages.agentBreak??`休息`,{pressed:e.agentStatus===`break`,disabled:!e.connected})]),T()];return e.calls.length>1&&o.push(O(e.calls,e.messages)),p(`div`,{attrs:{part:`panel`,"data-layout":`panel`},children:o})}function b(e,t,n={}){return p(`div`,{className:`ccbar-bar-row`,children:[p(n.labelFor===void 0?`div`:`label`,{className:`ccbar-bar-label`,attrs:n.labelFor===void 0?{}:{for:n.labelFor},text:e}),p(`div`,{className:`ccbar-bar-keys`,children:t})]})}function x(e,t,n={}){let r=e===`dial`?`call-button`:e===`hangup`?`hangup-button`:void 0;return p(`button`,{attrs:{type:`button`,"data-action":e,...r===void 0?{}:{part:r},...n.variant===void 0?{}:{"data-variant":n.variant},...n.disabled===!0?{disabled:``}:{},...n.pressed===void 0?{}:{"aria-pressed":n.pressed?`true`:`false`},...n.title===void 0?{}:{title:n.title}},text:t})}function S(e,t,n=``,r=`分机`){let i=w(e);return t&&i.setAttribute(`data-drag-handle`,``),n!==``&&i.append(p(`span`,{className:`ccbar-ext-chip`,text:`${r} ${n}`})),i}function C(e){let t=p(`input`,{attrs:{id:`ccbar-extension`,type:`tel`,inputmode:`numeric`,name:`extension`,autocomplete:`off`,placeholder:e.messages.extensionPlaceholder??`可空,由服务端分配`,"aria-label":e.messages.extensionLabel??`分机`}});return t.value=e.extension,e.connected&&(t.readOnly=!0),t}function w(e){return m(e)}function T(){return p(`div`,{className:`ccbar-dialpad`,children:g.map(e=>p(`button`,{attrs:{type:`button`,"data-digit":e},text:e}))})}function E(e){return p(`button`,{attrs:{type:`button`,"data-action":`mute`,"aria-pressed":e.muted?`true`:`false`},text:e.muted?e.messages.unmute??`取消静音`:e.messages.mute??`静音`})}function D(e,t){let n=e.kind===`held`;return p(`button`,{attrs:{type:`button`,"data-action":`hold`,"aria-pressed":n?`true`:`false`},text:n?t.resume??`恢复`:t.hold??`保持`})}function O(e,t){return p(`ul`,{className:`ccbar-call-list`,children:e.map(e=>p(`li`,{children:[p(`button`,{attrs:{type:`button`,"data-call-id":e.id},children:[p(`span`,{text:`${e.destination} ${e.direction===`inbound`?t.inbound??`呼入`:t.outbound??`呼出`} ${k(e.state,t)}`}),...e.current?[p(`span`,{className:`ccbar-call-current`,text:t.currentCall??`当前通话`})]:[]]})]}))})}function k(e,t){return e===`held`?t.statusHeld??`保持中`:e===`active`?t.statusActive??`通话中`:e===`dialing`||e===`ringing`||e===`connecting`?t.statusDialing??`拨号中`:e}function A(e){switch(e.view.kind){case`permission-error`:return p(`div`,{attrs:{part:`panel`},children:[m(e.messages.permissionTitle??`无法使用麦克风`),p(`h2`,{text:e.messages.permissionTitle??`无法使用麦克风`}),p(`p`,{text:e.messages.permissionBody??`请在浏览器设置中允许本网站访问麦克风,然后重新检测。`}),p(`button`,{attrs:{type:`button`,"data-action":`retry-permission`},text:e.messages.retryPermission??`重新检测`})]});case`unrecoverable-error`:case`unsupported`:return p(`div`,{attrs:{part:`panel`},children:[p(`div`,{attrs:{role:`alert`,part:`status-rail`},text:e.messages.errorTitle??`无法继续通话`}),p(`p`,{text:e.messages.errorBody??`请检查网络、域名授权或坐席权限后重试。`})]});case`setup`:case`connecting`:case`incoming`:case`active`:case`held`:case`dialing`:case`ended`:case`ready`:return p(`div`,{attrs:{part:`panel`},children:[m(e.messages.status??``)]});default:return e.view}}function j(e){return p(`div`,{attrs:{part:`panel`},children:[m(e.messages.status??`来电`),p(`p`,{text:e.view.from}),p(`button`,{attrs:{type:`button`,"data-action":`answer`},text:e.messages.answer??`接听`}),p(`button`,{attrs:{type:`button`,"data-action":`reject`},text:e.messages.reject??`拒绝`})]})}var M=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`*`,`0`,`#`];function N(e){return F(p(`div`,{attrs:{part:`panel`,"data-layout":`mobile`},children:[m(e.status),p(`button`,{attrs:{type:`button`,"data-action":`enable-phone`,...e.enabling?{disabled:``}:{}},text:e.enablePhone??`启用电话`})]}))}function P(e){let t=e.view.kind===`active`||e.view.kind===`dialing`,n=[m(e.messages.status??``)];if(t){let t=e.view.kind===`active`||e.view.kind===`dialing`?e.view.destination??``:``;n.push(p(`p`,{text:t}),I(p(`button`,{attrs:{type:`button`,"data-action":`mute`,"aria-pressed":e.muted?`true`:`false`},text:e.muted?e.messages.unmute??`取消静音`:e.messages.mute??`静音`}),44),L(),I(p(`button`,{attrs:{type:`button`,"data-action":`hangup`,part:`hangup-button`},text:e.messages.hangup??`挂断`}),52))}else{let{field:t,input:r}=h(`ccbar-destination`,e.messages.numberLabel??`号码`);r.value=e.destination,n.push(t,L(),p(`button`,{attrs:{type:`button`,"data-action":`dial`,part:`call-button`,...e.canDial?{}:{disabled:``}},text:e.messages.call??`呼叫`}))}return e.showOutputDevice&&n.push(p(`button`,{attrs:{type:`button`,"data-action":`devices`},text:e.messages.devices??`设备`})),F(p(`div`,{attrs:{part:`panel`,"data-layout":`mobile`},children:n}))}function F(e){return e.style.minHeight=`100dvh`,e.style.paddingBottom=`max(16px, env(safe-area-inset-bottom))`,e}function I(e,t){return e.style.minHeight=`${t}px`,e}function L(){return p(`div`,{className:`ccbar-dialpad`,children:M.map(e=>p(`button`,{attrs:{type:`button`,"data-digit":e},text:e}))})}var R={kind:`permission-error`,code:`MEDIA_PERMISSION_DENIED`,action:`retry-permission`};function z(e){if(e.supported===!1)return{kind:`unsupported`};if(e.permission===`denied`||e.error?.code===`MEDIA_PERMISSION_DENIED`)return R;if(e.error!==void 0&&e.error.code!==`MEDIA_PLAYBACK_BLOCKED`)return{kind:`unrecoverable-error`,code:e.error.code};let t=e.calls.find(e=>e.direction===`inbound`&&(e.state===`ringing`||e.state===`new`));if(t!==void 0)return{kind:`incoming`,callId:t.id,from:t.destination??``};let n=e.calls.find(e=>e.state===`active`);if(n!==void 0)return{kind:`active`,callId:n.id,destination:n.destination};let r=e.calls.find(e=>e.state===`held`);if(r!==void 0)return{kind:`held`,callId:r.id,destination:r.destination};let i=e.calls.find(e=>e.state===`dialing`||e.state===`ringing`||e.state===`connecting`);if(i!==void 0)return{kind:`dialing`,callId:i.id,destination:i.destination};let a=e.calls.find(e=>e.state===`ended`||e.state===`failed`);return a===void 0?e.connectionState===`connecting`||e.connectionState===`reconnecting`?{kind:`connecting`}:e.connectionState===`connected`?{kind:`ready`}:{kind:`setup`}:{kind:`ended`,callId:a.id}}var B=`:root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f5f9;--ccbar-color-border:#d8e0ea;--ccbar-color-title:#0f172a;--ccbar-color-text:#334155;--ccbar-color-muted:#475569;--ccbar-color-primary:#2563eb;--ccbar-color-primary-hover:#1d4ed8;--ccbar-color-success:#15803d;--ccbar-color-warning:#a15c00;--ccbar-color-danger:#b91c1c;--ccbar-radius-sm:6px;--ccbar-radius:8px;--ccbar-radius-lg:12px;--ccbar-control-height:40px;--ccbar-control-height-touch:44px;--ccbar-space-1:4px;--ccbar-space-2:8px;--ccbar-space-3:12px;--ccbar-space-4:16px;--ccbar-space-6:24px;--ccbar-font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;--ccbar-panel-width:560px}:host{color:var(--ccbar-color-text);font-family:var(--ccbar-font-family);display:block}:host([floating]){z-index:2147483646;right:var(--ccbar-space-6);bottom:var(--ccbar-space-6);position:fixed}[part=panel]{background:var(--ccbar-color-surface);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-lg)}[part=status-rail]{align-items:center;gap:var(--ccbar-space-2);min-height:var(--ccbar-control-height);padding:var(--ccbar-space-2) var(--ccbar-space-3);border-bottom:1px solid var(--ccbar-color-border);color:var(--ccbar-color-muted);font-variant-numeric:tabular-nums;display:flex}[part=status-rail]:before{content:"";background:var(--ccbar-color-muted);border-radius:50%;flex:none;width:8px;height:8px}button{min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);background:var(--ccbar-color-surface);color:var(--ccbar-color-title);font:inherit}button[data-action=dial],button[data-action=signin],button[data-action=answer],button[data-variant=primary]{background:var(--ccbar-color-primary);border-color:var(--ccbar-color-primary);color:#fff}button[aria-pressed=true]{border-color:var(--ccbar-color-primary);color:var(--ccbar-color-primary);background:var(--ccbar-color-surface-muted)}button[data-action=hangup],button[data-action=reject]{background:var(--ccbar-color-danger);border-color:var(--ccbar-color-danger);color:#fff;margin-top:var(--ccbar-space-4)}button:disabled{opacity:.5}button:focus-visible,input:focus-visible{outline:2px solid var(--ccbar-color-primary);outline-offset:2px}input[type=tel]{width:100%;min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);font-variant-numeric:tabular-nums}.ccbar-call-list{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;padding:0;list-style:none;display:grid}.ccbar-call-list button{text-align:left;width:100%}.ccbar-call-current{color:var(--ccbar-color-title);display:block}[data-layout=compact]{min-height:80px;max-height:96px}[data-layout=compact] .ccbar-toolbar{gap:var(--ccbar-space-2);padding:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;display:grid}[data-layout=compact] .ccbar-more{right:var(--ccbar-space-3);gap:var(--ccbar-space-2);display:grid;position:absolute}[data-layout=panel]{width:min(var(--ccbar-panel-width), 100%);min-width:420px;max-width:560px;padding:var(--ccbar-space-3)}[data-layout=panel] .ccbar-bar-row{gap:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:48px minmax(0,1fr);align-items:center;min-height:36px;display:grid}[data-layout=panel] .ccbar-bar-row+.ccbar-bar-row{margin-top:var(--ccbar-space-2)}[data-layout=panel] .ccbar-bar-label{color:var(--ccbar-color-muted);font-size:12px}[data-layout=panel] .ccbar-bar-keys{align-items:center;gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=panel] .ccbar-bar-keys button{min-width:48px;min-height:32px;padding:0 10px;font-size:13px}[data-layout=panel] .ccbar-bar-keys input[type=tel]{max-width:320px}[data-layout=panel] .ccbar-bar-keys input[name=extension]{width:148px;max-width:148px}[data-layout=panel] .ccbar-ext-chip{background:var(--ccbar-color-surface-muted);height:28px;color:var(--ccbar-color-title);font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;margin-left:auto;padding:0 10px;font-size:12px;display:inline-flex}[data-layout=panel] [data-action=hangup]{margin-top:0}[data-layout=panel] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;grid-template-columns:repeat(3,1fr);display:grid}[data-layout=panel] .ccbar-safe-actions{gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=mobile]{min-height:100vh;padding:var(--ccbar-space-4);padding-bottom:max(16px, env(safe-area-inset-bottom))}[data-layout=mobile] button{min-width:44px;min-height:44px}[data-layout=mobile] [data-action=enable-phone],[data-layout=mobile] [data-action=dial],[data-layout=mobile] [data-action=hangup]{min-height:52px}[data-layout=mobile] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0;grid-template-columns:repeat(3,1fr);display:grid}:host([data-theme=dark]){--ccbar-color-surface:#0f172a;--ccbar-color-surface-muted:#1e293b;--ccbar-color-border:#334155;--ccbar-color-title:#f8fafc;--ccbar-color-text:#e2e8f0;--ccbar-color-muted:#94a3b8;--ccbar-color-primary:#3b82f6;--ccbar-color-primary-hover:#2563eb;--ccbar-color-success:#22c55e;--ccbar-color-warning:#f59e0b;--ccbar-color-danger:#ef4444}@media (prefers-reduced-motion:reduce){:host *,:host :before,:host :after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}`,V=typeof HTMLElement==`function`?HTMLElement:class{},H=new WeakSet,U=[`connection.stateChanged`,`connection.reconnecting`,`connection.failed`,`call.incoming`,`call.stateChanged`,`call.activeChanged`,`call.ended`,`call.failed`,`media.permissionChanged`,`agent.statusChanged`,`error`],W=class extends V{static get observedAttributes(){return[`mode`,`floating`,`draggable`,`locale`,`theme`]}#e;#t=!1;#n=[];#r=`idle`;#i=`unknown`;#a;#o=new Set;#s=``;#c=``;#l=`offline`;#u=!1;#d=!1;#f=Promise.resolve();#p;#m=!1;#h=!1;#g;#_;#v;#y;#b;get messageResolver(){return this.#y}set messageResolver(e){this.#y=e,this.shadowRoot!==null&&this.render()}get client(){return this.#e}set client(e){this.#O(),this.#e=e,this.#D(),this.render()}get ownsClient(){return this.#t}set ownsClient(e){this.#t=e===!0}connectedCallback(){this.#V(),this.#B(),this.render()}disconnectedCallback(){let e=this.#e,t=this.#t;this.#O(),this.#G(),this.#b?.(),this.#b=void 0,t&&(this.#e=void 0,e?.dispose())}attributeChangedCallback(e){this.#V(),e===`theme`&&this.#B(),this.shadowRoot!==null&&this.render()}render(){let e=this.#k();e!==void 0&&(e.innerHTML=`<style>${B}</style>`,e.append(this.#S(this.#x())))}#x(){let e=this.#e?.getCalls?.().map(e=>({id:e.id,state:e.state,destination:e.destination,direction:this.#o.has(e.id)?`inbound`:`outbound`}))??[];return z({connectionState:this.#r,permission:this.#i,calls:e,error:this.#a})}#S(e){let t=this.#z(),n=this.#_??this.#g??K(e,t),r={...t,status:n},i=this.#C(e,r,n);return i.setAttribute(`data-view`,this.#E()&&!this.#m?`setup`:e.kind),i.hasAttribute(`data-layout`)||i.setAttribute(`data-layout`,this.#E()?`mobile`:`panel`),i}#C(e,t,n){if(this.#E()&&!this.#m)return N({enabling:this.#h,status:n,enablePhone:t.enablePhone});switch(e.kind){case`permission-error`:case`unrecoverable-error`:case`unsupported`:return A({view:e,messages:t});case`incoming`:return this.#E()?P({view:{kind:`ready`},messages:t,destination:this.#s,muted:this.#u,canDial:s(this.#s,this.#i,this.#r),showOutputDevice:this.#e?.media.supportsOutputSelection()===!0}):j({view:e,messages:t});case`setup`:case`connecting`:case`ended`:case`ready`:case`active`:case`held`:case`dialing`:return this.#E()?P({view:e.kind===`held`?{kind:`ready`}:e,messages:t,destination:this.#s,muted:this.#u,canDial:s(this.#s,this.#i,this.#r),showOutputDevice:this.#e?.media.supportsOutputSelection()===!0}):_({mode:this.#T()===`compact`?`compact`:`panel`,view:e,messages:t,destination:this.#s,muted:this.#u,canDial:s(this.#s,this.#i,this.#r),moreOpen:this.#d,floating:this.hasAttribute(`floating`),connected:this.#r===`connected`,agentStatus:this.#l,extension:this.#c,calls:this.#w()});default:return e}}#w(){let e=this.#e?.getActiveCall?.()?.id;return this.#e?.getCalls?.().map(t=>({id:t.id,destination:t.destination,state:t.state,direction:this.#o.has(t.id)?`inbound`:`outbound`,current:t.id===e}))??[]}#T(){let e=this.getAttribute(`mode`);return e===`compact`||e===`mobile`?e:`panel`}#E(){return this.#T()===`mobile`}#D(){let e=this.#e;e!==void 0&&(this.#n.push(e.on(`connection.stateChanged`,t=>{if(this.#r=t.state,t.state!==`connected`&&(this.#l=`offline`),t.state===`connected`){let t=e.getAgent?.()?.extension?.trim();t!==void 0&&t!==``&&(this.#c=t)}})),this.#n.push(e.on(`agent.statusChanged`,e=>{(e.status===`available`||e.status===`offline`||e.status===`break`)&&(this.#l=e.status)})),this.#n.push(e.on(`connection.failed`,e=>{this.#r=`failed`,this.#a={code:e.error.code}})),this.#n.push(e.on(`media.permissionChanged`,e=>{this.#i=e.permission})),this.#n.push(e.on(`error`,e=>{this.#a={code:e.error.code}})),this.#n.push(e.on(`call.incoming`,e=>{this.#o.add(e.callId)})),this.#n.push(e.on(`call.ended`,e=>{this.#o.delete(e.callId),this.#u=!1})),this.#n.push(e.on(`call.failed`,()=>{this.#_=this.#z().statusFailed})),U.forEach(t=>{this.#n.push(e.on(t,()=>this.render()))}),this.#E()&&typeof e.recover==`function`&&(this.#v=a(e,{onChecking:()=>{this.#g=this.#z().foregroundChecking,this.render()},onRecovered:()=>{this.#g=void 0,this.render()},onFailed:()=>{this.#g=this.#z().foregroundFailed,this.render()}})))}#O(){let e=this.#n;this.#n=[],e.forEach(e=>e()),this.#r=`idle`,this.#i=`unknown`,this.#l=`offline`,this.#a=void 0,this.#o.clear(),this.#u=!1,this.#d=!1,this.#m=!1,this.#h=!1,this.#g=void 0,this.#v?.(),this.#v=void 0}#k(){if(typeof this.attachShadow!=`function`)return;let e=this.shadowRoot??this.attachShadow({mode:`open`});return H.has(e)||(H.add(e),e.addEventListener(`click`,e=>this.#A(e)),e.addEventListener(`input`,e=>this.#P(e)),e.addEventListener(`pointerdown`,e=>this.#H(e))),e}#A(e){let t=J(e,this),n=t?.closest(`[data-action="enable-phone"]`);n instanceof HTMLButtonElement&&(n.disabled=!0),this.#f=this.#f.then(()=>this.#F(t)).catch(e=>{this.#_=Y(e),this.render()})}#j(){let e=this.shadowRoot?.querySelector(`input[name="destination"]`);return e instanceof HTMLInputElement?e.value:this.#s}#M(){let e=this.shadowRoot?.querySelector(`input[name="extension"]`);return e instanceof HTMLInputElement?e.value.trim():this.#c}#N(){let e=this.shadowRoot?.querySelector(`input[name="transfer-target"]`);return e instanceof HTMLInputElement?e.value:``}#P(e){let t=J(e,this);if(t instanceof HTMLInputElement&&t.name!==`transfer-target`){if(t.name===`extension`){this.#c=t.value.trim();return}this.#s=t.value,this.#L()}}async#F(e){if(this.#_=void 0,e===void 0)return;let t=e.closest(`[data-call-id]`);if(t instanceof HTMLElement&&t.dataset.callId!==void 0){await this.#e?.setActiveCall(t.dataset.callId);return}let n=e.closest(`[data-digit]`);if(n instanceof HTMLElement&&n.dataset.digit!==void 0){await this.#I(n.dataset.digit);return}let r=e.closest(`[data-action]`);if(!(r instanceof HTMLElement)||r instanceof HTMLButtonElement&&r.disabled&&r.getAttribute(`data-action`)!==`enable-phone`)return;let a=this.#e?.getActiveCall?.();switch(r.getAttribute(`data-action`)){case`signin`:if(this.#e===void 0)return;this.#c=this.#M(),await this.#e.media?.requestPermission?.(),await this.#e.initialize(),await this.#e.connect(this.#c===``?void 0:{extension:this.#c});return;case`signout`:if(this.#e===void 0)return;this.#l=`offline`,await this.#e.disconnect();return;case`dial`:case`dial-internal`:if(this.#s=this.#j(),this.#e===void 0)return;this.#i!==`granted`&&await this.#e.media?.requestPermission?.(),await c(this.#e,this.#s,r.getAttribute(`data-action`)===`dial-internal`?`extension`:void 0);return;case`mute`:if(a===void 0)return;this.#u=await l(a,this.#u),this.#R();return;case`hold`:a!==void 0&&await u(a);return;case`resume`:a!==void 0&&await a.resume();return;case`transfer`:a!==void 0&&await f(a,this.#N());return;case`hangup`:await a?.hangup();return;case`answer`:a!==void 0&&await this.#e?.answer(a.id);return;case`reject`:await a?.reject();return;case`enable-phone`:if(this.#e===void 0||this.#m)return;this.#h=!0;try{await i(this.#e),this.#m=!0}finally{this.#h=!1,this.render()}return;case`more`:this.#d=!this.#d,this.render();return;case`retry-permission`:await this.#e?.media.requestPermission();return;case`devices`:return;case`agent-available`:await this.#e?.setAgentStatus(`available`);return;case`agent-break`:await this.#e?.setAgentStatus(`break`);return;case`agent-busy`:return;default:return}}async#I(e){let t=this.#e?.getActiveCall?.();if(t!==void 0&&(t.state===`active`||t.state===`held`)){await d(t,e);return}this.#s+=e;let n=this.shadowRoot?.querySelector(`input[name="destination"]`);n instanceof HTMLInputElement&&(n.value=this.#s),this.#L()}#L(){let e=!s(this.#s,this.#i,this.#r);for(let t of[`dial`,`dial-internal`]){let n=this.shadowRoot?.querySelector(`[data-action="${t}"]`);n instanceof HTMLButtonElement&&(n.disabled=e)}}#R(){let e=this.shadowRoot?.querySelector(`[data-action="mute"]`);e instanceof HTMLButtonElement&&(e.setAttribute(`aria-pressed`,this.#u?`true`:`false`),e.textContent=this.#u?this.#z().unmute:this.#z().mute)}#z(){return r(this.getAttribute(`locale`)??`zh-CN`,void 0,this.#y)}#B(){this.#b?.(),this.#b=void 0;let e=this.getAttribute(`theme`)??`light`;if(e===`dark`||e===`light`){this.setAttribute(`data-theme`,e);return}if(typeof window>`u`||typeof window.matchMedia!=`function`){this.setAttribute(`data-theme`,`light`);return}let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{this.setAttribute(`data-theme`,t.matches?`dark`:`light`)};n(),t.addEventListener(`change`,n),this.#b=()=>t.removeEventListener(`change`,n)}#V(){this.style.position=this.hasAttribute(`floating`)?`fixed`:``}#H(e){if(!(e instanceof PointerEvent)||!this.hasAttribute(`floating`)||!this.hasAttribute(`draggable`)||(e.target instanceof Element?e.target.closest(`[data-drag-handle]`):null)===null)return;e.preventDefault();let t=this.getBoundingClientRect();this.#p={pointerId:e.pointerId,offsetX:e.clientX-t.left,offsetY:e.clientY-t.top},window.addEventListener(`pointermove`,this.#U),window.addEventListener(`pointerup`,this.#W)}#U=e=>{if(this.#p===void 0||e.pointerId!==this.#p.pointerId)return;let t=window.visualViewport,n=t?.width??window.innerWidth,r=t?.height??window.innerHeight,i=q(e.clientX-this.#p.offsetX,0,Math.max(0,n-this.offsetWidth)),a=q(e.clientY-this.#p.offsetY,0,Math.max(0,r-this.offsetHeight));this.style.left=`${i}px`,this.style.top=`${a}px`,this.style.right=`auto`,this.style.bottom=`auto`};#W=e=>{this.#p!==void 0&&e.pointerId===this.#p.pointerId&&this.#G()};#G(){this.#p=void 0,window.removeEventListener(`pointermove`,this.#U),window.removeEventListener(`pointerup`,this.#W)}};function G(e={}){if(typeof customElements>`u`)return;let t=e.tagName??`xcall-ccbar`;if(customElements.get(t)!==void 0)return;let n=t===`xcall-ccbar`?W:class extends W{};customElements.define(t,n)}function K(e,t){switch(e.kind){case`unsupported`:return t.statusUnsupported;case`permission-error`:return t.statusPermission;case`unrecoverable-error`:return t.statusError;case`setup`:return t.statusSetup;case`connecting`:return t.statusConnecting;case`incoming`:return t.statusIncoming;case`active`:return t.statusActive;case`held`:return t.statusHeld;case`dialing`:return t.statusDialing;case`ended`:return t.statusEnded;case`ready`:return t.statusReady;default:return e}}function q(e,t,n){return Math.min(n,Math.max(t,e))}function J(e,t){for(let n of e.composedPath())if(n instanceof Element&&n!==t)return n;return e.target instanceof Element&&e.target!==t?e.target:void 0}function Y(e){return typeof e==`object`&&e&&`code`in e&&typeof e.code==`string`?e.code:`SDK_INTERNAL_ERROR`}var X=`0.1.0`;exports.XCallCCBarElement=W,exports.defineCCBarElement=G,exports.enUS=e,exports.resolveMessages=r,exports.uiVersion=X,exports.zhCN=t;
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "3.1.0";
package/package.json CHANGED
@@ -1,109 +1,111 @@
1
- {
2
- "name": "@16x/webphone-sdk",
3
- "version": "3.0.2",
4
- "homepage": "https://www.npmjs.com/package/@16x/webphone-sdk",
5
- "private": false,
6
- "license": "UNLICENSED",
7
- "publishConfig": {
8
- "access": "public",
9
- "registry": "https://registry.npmjs.org"
10
- },
11
- "type": "module",
12
- "sideEffects": [
13
- "./dist/styles.css"
14
- ],
15
- "files": [
16
- "dist/index.js",
17
- "dist/index.cjs",
18
- "dist/index.umd.js",
19
- "dist/*.js",
20
- "dist/*.cjs",
21
- "dist/index.d.ts",
22
- "dist/types.d.ts",
23
- "dist/errors",
24
- "dist/events",
25
- "dist/state",
26
- "dist/auth",
27
- "dist/api",
28
- "dist/core",
29
- "dist/shared",
30
- "dist/ui",
31
- "dist/legacy",
32
- "dist/diagnostics",
33
- "dist/shared-worker.js",
34
- "dist/shared-worker.d.ts",
35
- "dist/styles.css",
36
- "README.md",
37
- "LICENSE",
38
- "CHANGELOG.md"
39
- ],
40
- "exports": {
41
- ".": {
42
- "types": "./dist/index.d.ts",
43
- "import": "./dist/index.js",
44
- "require": "./dist/index.cjs"
45
- },
46
- "./ui": {
47
- "types": "./dist/ui/index.d.ts",
48
- "import": "./dist/ui/index.js",
49
- "require": "./dist/ui/index.cjs"
50
- },
51
- "./legacy": {
52
- "types": "./dist/legacy/index.d.ts",
53
- "import": "./dist/legacy/index.js",
54
- "require": "./dist/legacy/index.cjs"
55
- },
56
- "./diagnostics": {
57
- "types": "./dist/diagnostics/index.d.ts",
58
- "import": "./dist/diagnostics/index.js",
59
- "require": "./dist/diagnostics/index.cjs"
60
- },
61
- "./shared-worker": {
62
- "types": "./dist/shared-worker.d.ts",
63
- "import": "./dist/shared-worker.js"
64
- },
65
- "./styles.css": "./dist/styles.css"
66
- },
67
- "scripts": {
68
- "build": "vite build && vite build -c vite.umd.config.ts",
69
- "typecheck": "tsc -p tsconfig.json --noEmit",
70
- "test": "npm run build && vitest run",
71
- "lint": "eslint .",
72
- "pack:check": "node scripts/check-package.mjs",
73
- "sbom": "node scripts/generate-sbom.mjs",
74
- "release:artifacts": "node scripts/generate-release-artifacts.mjs",
75
- "check:node-next": "npm run build && node scripts/check-node-next-consumer.mjs",
76
- "build:examples": "node scripts/build-examples.mjs",
77
- "verify:bundle": "node scripts/check-bundle-size.mjs",
78
- "verify:memory": "node scripts/run-memory-soak.mjs",
79
- "verify:call-soak": "node scripts/run-call-soak.mjs",
80
- "verify:hour-soak": "node scripts/run-browser-call-soak.mjs",
81
- "verify:staged": "npm run verify:memory && npm run verify:call-soak",
82
- "docs:build": "node scripts/build-docs-site.mjs",
83
- "docs:check": "node scripts/check-docs-site.mjs",
84
- "docs:test": "npm run docs:build && npx vitest run tests/docs-site/static-site.test.ts tests/docs-site/navigation.test.ts",
85
- "customer:packages": "node scripts/create-customer-packages.mjs",
86
- "publish:npm": "bash scripts/publish-npm.sh",
87
- "verify:release": "npm run lint && npm run typecheck && npm test && npm run build && npm run build:examples && npm run verify:bundle && npm run pack:check && npm run sbom"
88
- },
89
- "dependencies": {
90
- "jssip": "3.10.1"
91
- },
92
- "devDependencies": {
93
- "@eslint/js": "^10.0.1",
94
- "@types/react": "^19.3.0",
95
- "@types/react-dom": "^19.3.0",
96
- "@vitejs/plugin-react": "^6.1.1",
97
- "@vitejs/plugin-vue": "^6.0.9",
98
- "eslint": "^10.10.0",
99
- "happy-dom": "^20.14.5",
100
- "react": "^19.3.0",
101
- "react-dom": "^19.3.0",
102
- "typescript": "^6.0.3",
103
- "typescript-eslint": "^8.70.0",
104
- "vite": "^8.3.0",
105
- "vite-plugin-dts": "^5.1.0",
106
- "vitest": "^5.0.1",
107
- "vue": "^3.5.43"
108
- }
109
- }
1
+ {
2
+ "name": "@16x/webphone-sdk",
3
+ "version": "3.1.0",
4
+ "homepage": "https://www.npmjs.com/package/@16x/webphone-sdk",
5
+ "private": false,
6
+ "license": "UNLICENSED",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "registry": "https://registry.npmjs.org"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": [
13
+ "./dist/styles.css"
14
+ ],
15
+ "files": [
16
+ "dist/index.js",
17
+ "dist/index.cjs",
18
+ "dist/index.umd.js",
19
+ "dist/*.js",
20
+ "dist/*.cjs",
21
+ "dist/index.d.ts",
22
+ "dist/types.d.ts",
23
+ "dist/version.d.ts",
24
+ "dist/errors",
25
+ "dist/events",
26
+ "dist/state",
27
+ "dist/auth",
28
+ "dist/api",
29
+ "dist/core",
30
+ "dist/shared",
31
+ "dist/ui",
32
+ "dist/legacy",
33
+ "dist/diagnostics",
34
+ "dist/shared-worker.js",
35
+ "dist/shared-worker.d.ts",
36
+ "dist/styles.css",
37
+ "README.md",
38
+ "LICENSE",
39
+ "CHANGELOG.md"
40
+ ],
41
+ "exports": {
42
+ ".": {
43
+ "types": "./dist/index.d.ts",
44
+ "import": "./dist/index.js",
45
+ "require": "./dist/index.cjs"
46
+ },
47
+ "./ui": {
48
+ "types": "./dist/ui/index.d.ts",
49
+ "import": "./dist/ui/index.js",
50
+ "require": "./dist/ui/index.cjs"
51
+ },
52
+ "./legacy": {
53
+ "types": "./dist/legacy/index.d.ts",
54
+ "import": "./dist/legacy/index.js",
55
+ "require": "./dist/legacy/index.cjs"
56
+ },
57
+ "./diagnostics": {
58
+ "types": "./dist/diagnostics/index.d.ts",
59
+ "import": "./dist/diagnostics/index.js",
60
+ "require": "./dist/diagnostics/index.cjs"
61
+ },
62
+ "./shared-worker": {
63
+ "types": "./dist/shared-worker.d.ts",
64
+ "import": "./dist/shared-worker.js"
65
+ },
66
+ "./styles.css": "./dist/styles.css"
67
+ },
68
+ "scripts": {
69
+ "build": "vite build && vite build -c vite.umd.config.ts",
70
+ "typecheck": "tsc -p tsconfig.json --noEmit",
71
+ "test": "npm run build && npm run docs:build && vitest run",
72
+ "lint": "eslint .",
73
+ "pack:check": "node scripts/check-package.mjs",
74
+ "sbom": "node scripts/generate-sbom.mjs",
75
+ "release:artifacts": "node scripts/generate-release-artifacts.mjs",
76
+ "check:node-next": "npm run build && node scripts/check-node-next-consumer.mjs",
77
+ "build:examples": "node scripts/build-examples.mjs",
78
+ "verify:bundle": "node scripts/check-bundle-size.mjs",
79
+ "verify:memory": "node scripts/run-memory-soak.mjs",
80
+ "verify:call-soak": "node scripts/run-call-soak.mjs",
81
+ "verify:hour-soak": "node scripts/run-browser-call-soak.mjs",
82
+ "verify:staged": "npm run verify:memory && npm run verify:call-soak",
83
+ "docs:build": "node scripts/build-docs-site.mjs",
84
+ "docs:check": "node scripts/check-docs-site.mjs",
85
+ "docs:test": "npm run docs:build && npx vitest run tests/docs-site/static-site.test.ts tests/docs-site/navigation.test.ts tests/docs-site/check-docs-site.test.ts",
86
+ "docs:release": "npm run customer:packages && npm run docs:build && node scripts/create-integration-package.mjs && npm run docs:build && npm run docs:check",
87
+ "customer:packages": "node scripts/create-customer-packages.mjs",
88
+ "publish:npm": "bash scripts/publish-npm.sh",
89
+ "verify:release": "npm run lint && npm run typecheck && npm test && npm run build && npm run build:examples && npm run verify:bundle && npm run pack:check && npm run sbom"
90
+ },
91
+ "dependencies": {
92
+ "jssip": "3.10.1"
93
+ },
94
+ "devDependencies": {
95
+ "@eslint/js": "^10.0.1",
96
+ "@types/react": "^19.3.0",
97
+ "@types/react-dom": "^19.3.0",
98
+ "@vitejs/plugin-react": "^6.1.1",
99
+ "@vitejs/plugin-vue": "^6.0.9",
100
+ "eslint": "^10.10.0",
101
+ "happy-dom": "^20.14.5",
102
+ "react": "^19.3.0",
103
+ "react-dom": "^19.3.0",
104
+ "typescript": "^6.0.3",
105
+ "typescript-eslint": "^8.70.0",
106
+ "vite": "^8.3.0",
107
+ "vite-plugin-dts": "^5.1.0",
108
+ "vitest": "^5.0.1",
109
+ "vue": "^3.5.43"
110
+ }
111
+ }