ysyt-react-agent-lib 1.0.72 → 1.0.74
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/{ConsultModel-CkUULQXx.js → ConsultModel-BW6ts2M2.js} +1 -1
- package/dist/{ConsultModel-qQ6NAhBt.mjs → ConsultModel-DtkAqyBf.mjs} +2 -2
- package/dist/{TransferModel-S_rQ79xn.mjs → TransferModel-D8AqxV2E.mjs} +2 -2
- package/dist/{TransferModel-C2m94oQg.js → TransferModel-DYL9K5Tk.js} +1 -1
- package/dist/es/YsytBarPhone/index.d.ts +1 -1
- package/dist/{index-z-wiFTY0.mjs → index-C2ymK-lh.mjs} +1 -1
- package/dist/{index-Cqn0W0On.mjs → index-CP8hx9XN.mjs} +5 -5
- package/dist/{index-CMcK4hZF.js → index-CasEGtND.js} +2 -2
- package/dist/{index-BgFZvAS7.js → index-DEhvqTXo.js} +1 -1
- package/dist/ysyt-react-agent-lib.cjs.js +1 -1
- package/dist/ysyt-react-agent-lib.es.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CasEGtND.js"),s=require("react"),i=require("./index-DEhvqTXo.js"),c=s.memo(({open:n,onCallBack:r,queryFetch:x})=>{const[o,a]=s.useState([]);return s.useEffect(()=>{(async()=>{try{await x({success:t=>{a(t.data||[])}})}catch(t){console.log(t)}})()},[n]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(i.Modal,{open:n,title:"咨询",footer:!1,onCancel:()=>r(),children:e.jsxRuntimeExports.jsx(e.ModelBody,{children:o.length===0?e.jsxRuntimeExports.jsx(e.Empty,{image:e.Empty.PRESENTED_IMAGE_SIMPLE}):e.jsxRuntimeExports.jsx(e.Space,{wrap:!0,children:o.map(t=>e.jsxRuntimeExports.jsx(i.Tag,{color:"processing",onClick:()=>r(t.agent_no),children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsxRuntimeExports.jsx(e.YsytIconSvg,{name:"zixun"}),e.jsxRuntimeExports.jsxs("span",{style:{marginLeft:10},children:["咨询坐席: ",t.agent_name]})]})},t.agent_no))})})})})});exports.default=c;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as e, M as c, E as r, S as i, Y as d } from "./index-
|
|
1
|
+
import { j as e, M as c, E as r, S as i, Y as d } from "./index-CP8hx9XN.mjs";
|
|
2
2
|
import { memo as m, useState as g, useEffect as x } from "react";
|
|
3
|
-
import { M as j, T as p } from "./index-
|
|
3
|
+
import { M as j, T as p } from "./index-C2ymK-lh.mjs";
|
|
4
4
|
const E = m(({ open: a, onCallBack: t, queryFetch: o }) => {
|
|
5
5
|
const [n, l] = g([]);
|
|
6
6
|
return x(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as e, M as h, R as j, a as f, E as d, S as y, Y as c, I as v } from "./index-
|
|
1
|
+
import { j as e, M as h, R as j, a as f, E as d, S as y, Y as c, I as v } from "./index-CP8hx9XN.mjs";
|
|
2
2
|
import { memo as E, useState as n, useEffect as T } from "react";
|
|
3
|
-
import { M as I, T as M } from "./index-
|
|
3
|
+
import { M as I, T as M } from "./index-C2ymK-lh.mjs";
|
|
4
4
|
const _ = E(({ open: r, onCallBack: a, queryFetch: g }) => {
|
|
5
5
|
const [o, p] = n([]), [t, x] = n(0), [l, m] = n(""), [u, i] = n(!1);
|
|
6
6
|
return T(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CasEGtND.js"),t=require("react"),l=require("./index-DEhvqTXo.js"),m=t.memo(({open:o,onCallBack:n,queryFetch:u})=>{const[x,p]=t.useState([]),[r,c]=t.useState(0),[i,d]=t.useState(""),[j,a]=t.useState(!1);return t.useEffect(()=>{(async()=>{a(!0);try{await u({success:s=>{p(s.data||[])}})}catch(s){console.log(s)}a(!1)})()},[o]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(l.Modal,{open:o,title:"转接",footer:!1,onCancel:()=>n(),children:e.jsxRuntimeExports.jsxs(e.ModelBody,{children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Radio.Group,{options:[{label:"转接坐席",value:0},{label:"转接外线",value:1}],value:r,onChange:s=>c(s.target.value)})}),e.jsxRuntimeExports.jsx(e.Spin,{spinning:j,children:e.jsxRuntimeExports.jsxs("div",{style:{borderTop:"1px solid #eee",marginTop:10,paddingTop:10},children:[r===0&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:x.length===0?e.jsxRuntimeExports.jsx(e.Empty,{image:e.Empty.PRESENTED_IMAGE_SIMPLE}):e.jsxRuntimeExports.jsx(e.Space,{wrap:!0,children:x.map(s=>e.jsxRuntimeExports.jsx(l.Tag,{color:"processing",onClick:()=>n(s.agent_no,0),children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsxRuntimeExports.jsx(e.YsytIconSvg,{name:"zixun"}),e.jsxRuntimeExports.jsxs("span",{style:{marginRight:10},children:["转接坐席: ",s.agent_name]})]})},s.agent_no))})}),r===1&&e.jsxRuntimeExports.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",gap:"0 5px"},children:[e.jsxRuntimeExports.jsx(e.Input,{style:{flex:1},value:i,onChange:s=>d(s.target.value),placeholder:"请输入外线号码, 回车转接",onPressEnter:()=>{n(i,1)}}),e.jsxRuntimeExports.jsx(e.YsytIconSvg,{name:"boda",color:"#1D92E9",size:25,onClick:()=>{n(i,1)}})]})]})})]})})})});exports.default=m;
|
|
@@ -7,7 +7,7 @@ import { OnCallBackType } from '../../types';
|
|
|
7
7
|
* @param appSecret
|
|
8
8
|
* @param agentNo 坐席工号
|
|
9
9
|
* @param enableBrowserAlert 浏览器通知是否开启
|
|
10
|
-
* @param browserAlertTime 浏览器通知消失时间
|
|
10
|
+
* @param browserAlertTime 浏览器通知消失时间 秒
|
|
11
11
|
* @param logBuiltinEnabled 开发日志是否开启
|
|
12
12
|
* @param ringingCardShow 振铃卡片是否开启 默认开启
|
|
13
13
|
* @param initialState 初始化状态 可选 不传入用呼叫设置
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as r from "react";
|
|
2
2
|
import $, { useContext as re, useRef as Z, useMemo as Lt, useEffect as De } from "react";
|
|
3
|
-
import { i as Dt, K as Ne, g as se, F as kt, m as fe, u as N, r as nt, b as Pe, p as je, C as q, c as O, d as Ie, e as At, o as ge, f as Ce, h as _t, k as Vt, l as Wt, W as qt, n as Gt, B as Te, q as ot, s as Xt, _ as R, t as ke, v as Y, w as Me, x as at, y as Ae, z as Ut, A as _e, D as Ve, P as Kt, G as Qt, H as K, J as Zt, L as Yt, N as Re, O as Jt, Q as lt, T as en, U as tn, V as rt, X as nn, Z as on, $ as an, a0 as ue, a1 as ln, a2 as st, a3 as rn, a4 as sn, a5 as cn, a6 as dn, a7 as un, a8 as mn, a9 as fn, aa as gn, ab as Cn, ac as it, ad as pn, ae as vn } from "./index-
|
|
3
|
+
import { i as Dt, K as Ne, g as se, F as kt, m as fe, u as N, r as nt, b as Pe, p as je, C as q, c as O, d as Ie, e as At, o as ge, f as Ce, h as _t, k as Vt, l as Wt, W as qt, n as Gt, B as Te, q as ot, s as Xt, _ as R, t as ke, v as Y, w as Me, x as at, y as Ae, z as Ut, A as _e, D as Ve, P as Kt, G as Qt, H as K, J as Zt, L as Yt, N as Re, O as Jt, Q as lt, T as en, U as tn, V as rt, X as nn, Z as on, $ as an, a0 as ue, a1 as ln, a2 as st, a3 as rn, a4 as sn, a5 as cn, a6 as dn, a7 as un, a8 as mn, a9 as fn, aa as gn, ab as Cn, ac as it, ad as pn, ae as vn } from "./index-CP8hx9XN.mjs";
|
|
4
4
|
const bn = new Ne("antFadeIn", {
|
|
5
5
|
"0%": {
|
|
6
6
|
opacity: 0
|
|
@@ -12826,7 +12826,7 @@ class ta {
|
|
|
12826
12826
|
const i = new Notification(A, { body: t, tag: `xy-global-notification${(/* @__PURE__ */ new Date()).getTime()}`, renotify: !0 });
|
|
12827
12827
|
i.onclick = () => {
|
|
12828
12828
|
window.focus(), i.close(), n == null || n();
|
|
12829
|
-
}, setTimeout(() => i.close(), r ||
|
|
12829
|
+
}, setTimeout(() => i.close(), 1e3 * (r || 3));
|
|
12830
12830
|
}
|
|
12831
12831
|
}
|
|
12832
12832
|
static async checkMediaPermissions() {
|
|
@@ -34356,7 +34356,7 @@ const Ek = {
|
|
|
34356
34356
|
consult_transfer: "咨询转接",
|
|
34357
34357
|
consult_retrieve: "取回通话",
|
|
34358
34358
|
conference: "三方会议"
|
|
34359
|
-
}, yk = Uq(() => import("./ConsultModel-
|
|
34359
|
+
}, yk = Uq(() => import("./ConsultModel-DtkAqyBf.mjs")), Mk = Uq(() => import("./TransferModel-D8AqxV2E.mjs")), zk = (e) => {
|
|
34360
34360
|
var pe, KA, zA;
|
|
34361
34361
|
const {
|
|
34362
34362
|
style: A,
|
|
@@ -34529,7 +34529,7 @@ const Ek = {
|
|
|
34529
34529
|
};
|
|
34530
34530
|
Le(() => {
|
|
34531
34531
|
var N;
|
|
34532
|
-
(N = f.current) == null || N.setBrowserAlertTime(n ||
|
|
34532
|
+
(N = f.current) == null || N.setBrowserAlertTime(n || 3);
|
|
34533
34533
|
}, [n]), Le(() => {
|
|
34534
34534
|
var N;
|
|
34535
34535
|
(N = f.current) == null || N.setBrowserAlert(r || !1);
|
|
@@ -34546,7 +34546,7 @@ const Ek = {
|
|
|
34546
34546
|
device: N
|
|
34547
34547
|
},
|
|
34548
34548
|
success: () => {
|
|
34549
|
-
T(N), tt.success("切换设备成功")
|
|
34549
|
+
T(N), tt.success("切换设备成功");
|
|
34550
34550
|
}
|
|
34551
34551
|
}));
|
|
34552
34552
|
} catch (hA) {
|
|
@@ -34564,7 +34564,7 @@ const Ek = {
|
|
|
34564
34564
|
state_name: dA
|
|
34565
34565
|
},
|
|
34566
34566
|
success: () => {
|
|
34567
|
-
G(dA),
|
|
34567
|
+
G(dA), tt.success("切换状态成功");
|
|
34568
34568
|
}
|
|
34569
34569
|
}));
|
|
34570
34570
|
} catch (qA) {
|
|
@@ -1053,7 +1053,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1053
1053
|
`:""}
|
|
1054
1054
|
</div>
|
|
1055
1055
|
</my-popover>
|
|
1056
|
-
`;$r(r,this.rttHTML)}}class Wo{static requestPermission(){"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()}static async requestMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(t=>t.kind==="audioinput"&&t.label!=="")?null:await navigator.mediaDevices.getUserMedia({audio:!0})}catch(A){return console.warn("获取音频权限失败:",A),null}}static show(A,t,n,r){if("Notification"in window&&Notification.permission==="granted"){const i=new Notification(A,{body:t,tag:`xy-global-notification${new Date().getTime()}`,renotify:!0});i.onclick=()=>{window.focus(),i.close(),n==null||n()},setTimeout(()=>i.close(),r||3e3)}}static async checkMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(A=>A.kind==="audioinput"&&A.label!=="")}catch(A){return console.warn("无法检查设备权限:",A),!1}}}const Dw=console.log,Th=(...e)=>{fA.logBuiltinEnabled&&Dw(...e)};let ir=null;class Mt{constructor(A){this.url=A,this.ws=null,this.heartbeatWorker=null,this.reconnectDelay=3e3,this.manualClose=!1,this.apiClient=new Sd,this.sipClient=null,this.outNumber="",this.pendingMessages=new Map,this.initWebSocket()}static getInstance({url:A,sipClient:t}){if(!ir){if(!A)throw new Error("WebSocket 尚未初始化");ir=new Mt(A),ir.sipClient=t}return ir}stateIdleChange(){const{state:A}=fA.stateObject;A!==He.IDLE&&this.apiClient._changeState({data:{...fA.stateBeforeChange,state_name:fA.stateBeforeChange.state===He.IDLE?"空闲":"忙碌"}})}inCallAutoAnswer(){const{soft_device_auto_answer:A,auto_answer_time:t}=fA.agentInfo,n=A===1,r=AA.get("direction");if(n&&r===mn.INCOMING){const i=Number(t)||0;i>0&&(fA.autoAnswerTimer=setTimeout(()=>{this.sipClient.answerCall(),fA.autoAnswerTimer=null},1e3*i))}}async getCustomerInfo(A){try{await this.apiClient._getInCallCrmDetail({data:{phone:A},success:t=>{AA.updateCustomerInfo(t.data||{phone:A,is_vip:0,customer_name:"未知客户",city:"未知",province:"未知",contact_count:0,in_contact_count:0})}})}catch{}}putAgentState(){fA.sessionId="";const{post_call_process_time:A}=fA.agentInfo,t=A||0;if(fA.autoStateTimer&&(clearTimeout(fA.autoStateTimer),fA.autoStateTimer=null),AA.updateCustomerInfo(void 0),t>0){const{state:n}=fA.stateObject;if(n===He.IDLE)return;this.apiClient._changeState({data:{state:He.BUSY,state_name:"整理"}}),fA.autoStateTimer=setTimeout(()=>{fA.autoStateTimer=null,this.stateIdleChange()},1e3*t)}else this.stateIdleChange()}initWebSocket(){const A=pC(Md,wd);this.ws=new WebSocket(this.url+A),this.ws.onopen=()=>{const t=new Date().getTime();this.sendMessage({type:0,msg_id:t}),this.pendingMessages.set(t,performance.now()),this.startHeartbeat()},this.ws.onmessage=async t=>{const n=JSON.parse(t.data),{type:r,data:i,code:o,msg:a,msg_id:s}=n;if(r===0&&s){const l=this.pendingMessages.get(s),u=performance.now()-l;fA.latency=parseFloat(u.toFixed(2)),this.pendingMessages.delete(s)}if(r!==0&&Th("%cWebSocket 收到消息:","color: blue; font-weight: bold;",n),r===fe.OUT_CALL&&(o!==0?(AA.reset(),QA.emit(pA.OUT_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a),setTimeout(()=>{AA.updateCustomerInfo(void 0)},500),this.stateIdleChange()):o===0&&QA.emit(pA.OUT_SUCCESS)),r===fe.AGENT_STATE){const{state:l,state_name:u}=i;(fA.stateObject.state===He.IDLE||fA.stateObject.state===He.BUSY&&u!=="整理")&&(fA.stateBeforeChange=fA.stateObject),fA.stateObject={state:l,state_name:u},u==="振铃中"&&AA.updateDisplayText(nt.AGENT_RINGING),QA.emit(pA.AGENT_STATE,{state:l,state_name:u})}if(r===fe.OUT_CALL_INCOMING_CALL){try{await this.getCustomerInfo(this.outNumber)}catch(l){console.error(l)}QA.emit(pA.OUT_INCOMING_CALL,{customer_phone:this.outNumber,session_id:i.session_id}),fA.sessionId=i.session_id,AA.updateActionConfigs(uw)}if(r===fe.OUT_CALL_END&&(AA.updateDisplayText(""),i.device_type===1&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.OUT_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no===fA.agentInfo.agent_no?(AA.reset(),QA.emit(pA.OUR_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),this.putAgentState(),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no!==fA.agentInfo.agent_no?(AA.updateDisplayText(nt.CALLING),QA.emit(pA.OTHER_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Ei)):i.device_type===3&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.THREE_WAY_OUR_SIDE_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===4&&i.agent_no===fA.agentInfo.agent_no&&(this.putAgentState(),AA.reset(),QA.emit(pA.TRANSFER_END,{session_id:i.session_id}),AA.updateActionConfigs(Bn))),r===fe.OUT_CALL_RINGING&&i.type===1&&(QA.emit(pA.OUT_RINGING,{session_id:fA.sessionId,type:i.type}),AA.updateDisplayText(nt.RINGING)),r===fe.OUT_CALL_ANSWER&&(QA.emit(pA.OUT_OFF_ANSWER,{session_id:fA.sessionId}),AA.updateOutCallIsAnswer(!0),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs(Ei)),r===fe.CONSULT_RINGING&&(QA.emit(pA.CONSULT_RINGING,{session_id:i.session_id}),AA.updateDisplayText(nt.AGENT_RINGING),AA.updateActionConfigs([])),r===fe.CONSULT_ANSWER&&(QA.emit(pA.CONSULT_OFF_HOOK,{session_id:i.session_id}),AA.updateConsultIsAnswer(!0),AA.updateDisplayText(nt.CONSULTING),AA.updateActionConfigs(Vw)),r===fe.CONSULT_FAIL&&(QA.emit(pA.CONSULT_FAILED,{custom_reason:i.custom_reason}),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs(Ei)),r===fe.CONSULT_CALL_IN&&(QA.emit(pA.CONSULT_INCOMING,{agent_no:i.agent_no,agent_mane:i.agent_name,session_id:i.session_id}),fA.sessionId=i.session_id,AA.updateIsCalling(!0),AA.updateDirection(mn.CONSULT),AA.updateDisplayText(nt.CONSULT_CALL_IN),AA.updateActionConfigs(bc),fA.enableBrowserAlert&&Wo.show("📞 咨询来电",`坐席 [${i.agent_name}] 正在咨询...`,()=>{QA.emit(be.NOTIFICATION_CLICK,{agent_mane:i.agent_name,agent_no:i.agent_no})},fA.browserAlertTime)),r===fe.CONSULT_CALL_IN_SUCCESS&&(QA.emit(pA.CONSULT_CALL_IN_SUCCESS,{session_id:i.session_id}),AA.updateConsultIsAnswer(!0),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs(dw)),r===fe.CONSULT_RETURN_CALL_SUCCESS&&(i.status==="success"?(AA.updateConsultIsAnswer(!1),QA.emit(pA.CONSULT_RETURN_CALL_SUCCESS),AA.updateDisplayText(nt.CALLING),QA.emit(pA.OTHER_SIDE_CONSULT_HANGUP),AA.updateActionConfigs(Ei)):QA.emit(be.FAIL_NOTIFICATION,"媒体失败")),r===fe.MUTE&&(o===0?(AA.updateIsMuted(!0),QA.emit(pA.MUTE_SUCCESS),AA.updateDisplayText(nt.MUTING)):(QA.emit(pA.MUTE_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.UNMUTE&&(o===0?(AA.updateIsMuted(!1),QA.emit(pA.UNMUTE_SUCCESS),AA.updateDisplayText(nt.CALLING)):(QA.emit(pA.UNMUTE_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CALL_HOLD&&(o===0?(AA.updateIsHold(!0),AA.updateDisplayText(nt.HOLDING),QA.emit(pA.HOLD_SUCCESS)):(QA.emit(pA.HOLD_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CALL_UNHOLD&&(o===0?(AA.updateDisplayText(nt.CALLING),AA.updateIsHold(!1),QA.emit(pA.UNHOLD_SUCCESS)):(QA.emit(pA.UNHOLD_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CONSULT_TRANSFER&&(o===0?QA.emit(pA.CONSULT_TRANSFER_SUCCESS):(QA.emit(pA.CONSULT_TRANSFER_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CONSULT_TRANSFER_FAILED&&QA.emit(pA.CONSULT_TRANSFER_FAILED,i.status),r===fe.CONSULT_TRANSFER_OFF_HOOK&&(AA.updateDirection(mn.INCOMING),AA.updateDisplayText(nt.CALLING),QA.emit(pA.CONSULT_TRANSFER_OFF_HOOK),AA.updateActionConfigs($a),AA.updateIncomingIsAnswer(!0),AA.updateConsultIsAnswer(!1)),r===fe.INCOMING_CALL){fA.sessionId=i.session_id;try{await this.getCustomerInfo(i.customer_phone)}catch(l){console.error(l)}AA.updateIsCalling(!0),AA.updateDirection(mn.INCOMING),this.inCallAutoAnswer(),AA.updateDisplayText(nt.INCOMING_CALL),QA.emit(pA.INCOMING_CALL,{customer_phone:i.customer_phone,session_id:i.session_id}),AA.updateActionConfigs(bc),fA.enableBrowserAlert&&Wo.show("📞 客户来电",`客户 [${i.customer_phone}] 正在呼入...`,()=>{QA.emit(be.NOTIFICATION_CLICK,{customer_phone:i.customer_phone})},fA.browserAlertTime)}if(r===fe.INCOMING_CALL_OFF_HOOK&&(AA.updateIncomingIsAnswer(!0),QA.emit(pA.INCOMING_CALL_OFF_HOOK,{session_id:fA.sessionId}),AA.updateActionConfigs($a),AA.updateDisplayText(nt.CALLING)),r===fe.INCOMING_CALL_END&&(AA.updateDisplayText(""),i.device_type===1&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.INCOMING_CALL_END,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no===fA.agentInfo.agent_no?(AA.reset(),QA.emit(pA.OUR_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),this.putAgentState(),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no!==fA.agentInfo.agent_no?(AA.updateDisplayText(nt.CALLING),QA.emit(pA.OTHER_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Ei)):i.device_type===3&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.THREE_WAY_OUR_SIDE_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===4&&i.agent_no===fA.agentInfo.agent_no&&(this.putAgentState(),AA.reset(),QA.emit(pA.TRANSFER_END,{session_id:i.session_id}),AA.updateActionConfigs(Bn))),r===fe.SATISFACTION_EVALUATION&&(o===0?QA.emit(pA.SATISFACTION_EVALUATION_SUCCESS):(QA.emit(pA.SATISFACTION_EVALUATION_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CONSULT_THREE_WAY&&(o!==0?(QA.emit(pA.CONSULT_THREE_WAY_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a)):o===0&&AA.updateIsMeeting(!0)),r===fe.CONSULT_THREE_WAY_RESULT&&(i.status==="success"?(AA.updateDirection(mn.MEETING),AA.updateDisplayText(nt.MEETING),AA.updateActionConfigs(gw),QA.emit(pA.CONSULT_THREE_WAY_SUCCESS)):(QA.emit(pA.CONSULT_THREE_WAY_FAILED,{conf_name:i.conf_name}),AA.updateIsMeeting(!1))),r===fe.TRANSFER_INCOMING_CALL&&(i.agent_no===fA.agentInfo.agent_no?(AA.updateDisplayText(nt.TRANSFERRING),QA.emit(pA.TRANSFER_PROGRESS),AA.updateActionConfigs([]),AA.updateTransferIsAnswer(!0)):(fA.sessionId=i.session_id,QA.emit(pA.TRANSFER_INCOMING_CALL,{agent_no:i.agent_no,agent_name:i.agent_name,session_id:i.session_id}),AA.updateIsCalling(!0),AA.updateDirection(mn.TRANSFER),AA.updateDisplayText(nt.TRANSFER_INCOMING_CALL),AA.updateActionConfigs(bc),fA.enableBrowserAlert&&Wo.show("📞 转接来电",`坐席 [${i.agent_no}] 正在转接...`,()=>{QA.emit(be.NOTIFICATION_CLICK,{agent_no:i.agent_no})},fA.browserAlertTime))),r===fe.TRANSFER_OFF_HOOK&&(QA.emit(pA.TRANSFER_OFF_HOOK,{session_id:fA.sessionId}),AA.updateTransferIsAnswer(!1),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs($a)),r===fe.TRANSFER_FAILED&&i.status==="failed"){QA.emit(pA.TRANSFER_FAILED,"未知原因"),QA.emit(be.FAIL_NOTIFICATION,"转接失败");const l=AA.get("direction");l===mn.OUTGOING?AA.updateActionConfigs(Ei):l===mn.INCOMING&&AA.updateActionConfigs($a)}r===fe.KICK_OFFLINE&&QA.emit(be.KICK_OFF)},this.ws.onclose=()=>{this.stopHeartbeat(),this.manualClose||setTimeout(()=>this.initWebSocket(),this.reconnectDelay)},this.ws.onerror=()=>{var t;(t=this.ws)==null||t.close()}}startHeartbeat(){const A=new Blob([`
|
|
1056
|
+
`;$r(r,this.rttHTML)}}class Wo{static requestPermission(){"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()}static async requestMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(t=>t.kind==="audioinput"&&t.label!=="")?null:await navigator.mediaDevices.getUserMedia({audio:!0})}catch(A){return console.warn("获取音频权限失败:",A),null}}static show(A,t,n,r){if("Notification"in window&&Notification.permission==="granted"){const i=new Notification(A,{body:t,tag:`xy-global-notification${new Date().getTime()}`,renotify:!0});i.onclick=()=>{window.focus(),i.close(),n==null||n()},setTimeout(()=>i.close(),1e3*(r||3))}}static async checkMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(A=>A.kind==="audioinput"&&A.label!=="")}catch(A){return console.warn("无法检查设备权限:",A),!1}}}const Dw=console.log,Th=(...e)=>{fA.logBuiltinEnabled&&Dw(...e)};let ir=null;class Mt{constructor(A){this.url=A,this.ws=null,this.heartbeatWorker=null,this.reconnectDelay=3e3,this.manualClose=!1,this.apiClient=new Sd,this.sipClient=null,this.outNumber="",this.pendingMessages=new Map,this.initWebSocket()}static getInstance({url:A,sipClient:t}){if(!ir){if(!A)throw new Error("WebSocket 尚未初始化");ir=new Mt(A),ir.sipClient=t}return ir}stateIdleChange(){const{state:A}=fA.stateObject;A!==He.IDLE&&this.apiClient._changeState({data:{...fA.stateBeforeChange,state_name:fA.stateBeforeChange.state===He.IDLE?"空闲":"忙碌"}})}inCallAutoAnswer(){const{soft_device_auto_answer:A,auto_answer_time:t}=fA.agentInfo,n=A===1,r=AA.get("direction");if(n&&r===mn.INCOMING){const i=Number(t)||0;i>0&&(fA.autoAnswerTimer=setTimeout(()=>{this.sipClient.answerCall(),fA.autoAnswerTimer=null},1e3*i))}}async getCustomerInfo(A){try{await this.apiClient._getInCallCrmDetail({data:{phone:A},success:t=>{AA.updateCustomerInfo(t.data||{phone:A,is_vip:0,customer_name:"未知客户",city:"未知",province:"未知",contact_count:0,in_contact_count:0})}})}catch{}}putAgentState(){fA.sessionId="";const{post_call_process_time:A}=fA.agentInfo,t=A||0;if(fA.autoStateTimer&&(clearTimeout(fA.autoStateTimer),fA.autoStateTimer=null),AA.updateCustomerInfo(void 0),t>0){const{state:n}=fA.stateObject;if(n===He.IDLE)return;this.apiClient._changeState({data:{state:He.BUSY,state_name:"整理"}}),fA.autoStateTimer=setTimeout(()=>{fA.autoStateTimer=null,this.stateIdleChange()},1e3*t)}else this.stateIdleChange()}initWebSocket(){const A=pC(Md,wd);this.ws=new WebSocket(this.url+A),this.ws.onopen=()=>{const t=new Date().getTime();this.sendMessage({type:0,msg_id:t}),this.pendingMessages.set(t,performance.now()),this.startHeartbeat()},this.ws.onmessage=async t=>{const n=JSON.parse(t.data),{type:r,data:i,code:o,msg:a,msg_id:s}=n;if(r===0&&s){const l=this.pendingMessages.get(s),u=performance.now()-l;fA.latency=parseFloat(u.toFixed(2)),this.pendingMessages.delete(s)}if(r!==0&&Th("%cWebSocket 收到消息:","color: blue; font-weight: bold;",n),r===fe.OUT_CALL&&(o!==0?(AA.reset(),QA.emit(pA.OUT_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a),setTimeout(()=>{AA.updateCustomerInfo(void 0)},500),this.stateIdleChange()):o===0&&QA.emit(pA.OUT_SUCCESS)),r===fe.AGENT_STATE){const{state:l,state_name:u}=i;(fA.stateObject.state===He.IDLE||fA.stateObject.state===He.BUSY&&u!=="整理")&&(fA.stateBeforeChange=fA.stateObject),fA.stateObject={state:l,state_name:u},u==="振铃中"&&AA.updateDisplayText(nt.AGENT_RINGING),QA.emit(pA.AGENT_STATE,{state:l,state_name:u})}if(r===fe.OUT_CALL_INCOMING_CALL){try{await this.getCustomerInfo(this.outNumber)}catch(l){console.error(l)}QA.emit(pA.OUT_INCOMING_CALL,{customer_phone:this.outNumber,session_id:i.session_id}),fA.sessionId=i.session_id,AA.updateActionConfigs(uw)}if(r===fe.OUT_CALL_END&&(AA.updateDisplayText(""),i.device_type===1&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.OUT_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no===fA.agentInfo.agent_no?(AA.reset(),QA.emit(pA.OUR_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),this.putAgentState(),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no!==fA.agentInfo.agent_no?(AA.updateDisplayText(nt.CALLING),QA.emit(pA.OTHER_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Ei)):i.device_type===3&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.THREE_WAY_OUR_SIDE_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===4&&i.agent_no===fA.agentInfo.agent_no&&(this.putAgentState(),AA.reset(),QA.emit(pA.TRANSFER_END,{session_id:i.session_id}),AA.updateActionConfigs(Bn))),r===fe.OUT_CALL_RINGING&&i.type===1&&(QA.emit(pA.OUT_RINGING,{session_id:fA.sessionId,type:i.type}),AA.updateDisplayText(nt.RINGING)),r===fe.OUT_CALL_ANSWER&&(QA.emit(pA.OUT_OFF_ANSWER,{session_id:fA.sessionId}),AA.updateOutCallIsAnswer(!0),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs(Ei)),r===fe.CONSULT_RINGING&&(QA.emit(pA.CONSULT_RINGING,{session_id:i.session_id}),AA.updateDisplayText(nt.AGENT_RINGING),AA.updateActionConfigs([])),r===fe.CONSULT_ANSWER&&(QA.emit(pA.CONSULT_OFF_HOOK,{session_id:i.session_id}),AA.updateConsultIsAnswer(!0),AA.updateDisplayText(nt.CONSULTING),AA.updateActionConfigs(Vw)),r===fe.CONSULT_FAIL&&(QA.emit(pA.CONSULT_FAILED,{custom_reason:i.custom_reason}),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs(Ei)),r===fe.CONSULT_CALL_IN&&(QA.emit(pA.CONSULT_INCOMING,{agent_no:i.agent_no,agent_mane:i.agent_name,session_id:i.session_id}),fA.sessionId=i.session_id,AA.updateIsCalling(!0),AA.updateDirection(mn.CONSULT),AA.updateDisplayText(nt.CONSULT_CALL_IN),AA.updateActionConfigs(bc),fA.enableBrowserAlert&&Wo.show("📞 咨询来电",`坐席 [${i.agent_name}] 正在咨询...`,()=>{QA.emit(be.NOTIFICATION_CLICK,{agent_mane:i.agent_name,agent_no:i.agent_no})},fA.browserAlertTime)),r===fe.CONSULT_CALL_IN_SUCCESS&&(QA.emit(pA.CONSULT_CALL_IN_SUCCESS,{session_id:i.session_id}),AA.updateConsultIsAnswer(!0),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs(dw)),r===fe.CONSULT_RETURN_CALL_SUCCESS&&(i.status==="success"?(AA.updateConsultIsAnswer(!1),QA.emit(pA.CONSULT_RETURN_CALL_SUCCESS),AA.updateDisplayText(nt.CALLING),QA.emit(pA.OTHER_SIDE_CONSULT_HANGUP),AA.updateActionConfigs(Ei)):QA.emit(be.FAIL_NOTIFICATION,"媒体失败")),r===fe.MUTE&&(o===0?(AA.updateIsMuted(!0),QA.emit(pA.MUTE_SUCCESS),AA.updateDisplayText(nt.MUTING)):(QA.emit(pA.MUTE_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.UNMUTE&&(o===0?(AA.updateIsMuted(!1),QA.emit(pA.UNMUTE_SUCCESS),AA.updateDisplayText(nt.CALLING)):(QA.emit(pA.UNMUTE_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CALL_HOLD&&(o===0?(AA.updateIsHold(!0),AA.updateDisplayText(nt.HOLDING),QA.emit(pA.HOLD_SUCCESS)):(QA.emit(pA.HOLD_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CALL_UNHOLD&&(o===0?(AA.updateDisplayText(nt.CALLING),AA.updateIsHold(!1),QA.emit(pA.UNHOLD_SUCCESS)):(QA.emit(pA.UNHOLD_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CONSULT_TRANSFER&&(o===0?QA.emit(pA.CONSULT_TRANSFER_SUCCESS):(QA.emit(pA.CONSULT_TRANSFER_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CONSULT_TRANSFER_FAILED&&QA.emit(pA.CONSULT_TRANSFER_FAILED,i.status),r===fe.CONSULT_TRANSFER_OFF_HOOK&&(AA.updateDirection(mn.INCOMING),AA.updateDisplayText(nt.CALLING),QA.emit(pA.CONSULT_TRANSFER_OFF_HOOK),AA.updateActionConfigs($a),AA.updateIncomingIsAnswer(!0),AA.updateConsultIsAnswer(!1)),r===fe.INCOMING_CALL){fA.sessionId=i.session_id;try{await this.getCustomerInfo(i.customer_phone)}catch(l){console.error(l)}AA.updateIsCalling(!0),AA.updateDirection(mn.INCOMING),this.inCallAutoAnswer(),AA.updateDisplayText(nt.INCOMING_CALL),QA.emit(pA.INCOMING_CALL,{customer_phone:i.customer_phone,session_id:i.session_id}),AA.updateActionConfigs(bc),fA.enableBrowserAlert&&Wo.show("📞 客户来电",`客户 [${i.customer_phone}] 正在呼入...`,()=>{QA.emit(be.NOTIFICATION_CLICK,{customer_phone:i.customer_phone})},fA.browserAlertTime)}if(r===fe.INCOMING_CALL_OFF_HOOK&&(AA.updateIncomingIsAnswer(!0),QA.emit(pA.INCOMING_CALL_OFF_HOOK,{session_id:fA.sessionId}),AA.updateActionConfigs($a),AA.updateDisplayText(nt.CALLING)),r===fe.INCOMING_CALL_END&&(AA.updateDisplayText(""),i.device_type===1&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.INCOMING_CALL_END,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no===fA.agentInfo.agent_no?(AA.reset(),QA.emit(pA.OUR_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),this.putAgentState(),AA.updateActionConfigs(Bn)):i.device_type===2&&i.agent_no!==fA.agentInfo.agent_no?(AA.updateDisplayText(nt.CALLING),QA.emit(pA.OTHER_SIDE_CONSULT_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Ei)):i.device_type===3&&i.agent_no===fA.agentInfo.agent_no?(this.putAgentState(),AA.reset(),QA.emit(pA.THREE_WAY_OUR_SIDE_HANGUP,{session_id:i.session_id}),AA.updateActionConfigs(Bn)):i.device_type===4&&i.agent_no===fA.agentInfo.agent_no&&(this.putAgentState(),AA.reset(),QA.emit(pA.TRANSFER_END,{session_id:i.session_id}),AA.updateActionConfigs(Bn))),r===fe.SATISFACTION_EVALUATION&&(o===0?QA.emit(pA.SATISFACTION_EVALUATION_SUCCESS):(QA.emit(pA.SATISFACTION_EVALUATION_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a))),r===fe.CONSULT_THREE_WAY&&(o!==0?(QA.emit(pA.CONSULT_THREE_WAY_FAILED,a),QA.emit(be.FAIL_NOTIFICATION,a)):o===0&&AA.updateIsMeeting(!0)),r===fe.CONSULT_THREE_WAY_RESULT&&(i.status==="success"?(AA.updateDirection(mn.MEETING),AA.updateDisplayText(nt.MEETING),AA.updateActionConfigs(gw),QA.emit(pA.CONSULT_THREE_WAY_SUCCESS)):(QA.emit(pA.CONSULT_THREE_WAY_FAILED,{conf_name:i.conf_name}),AA.updateIsMeeting(!1))),r===fe.TRANSFER_INCOMING_CALL&&(i.agent_no===fA.agentInfo.agent_no?(AA.updateDisplayText(nt.TRANSFERRING),QA.emit(pA.TRANSFER_PROGRESS),AA.updateActionConfigs([]),AA.updateTransferIsAnswer(!0)):(fA.sessionId=i.session_id,QA.emit(pA.TRANSFER_INCOMING_CALL,{agent_no:i.agent_no,agent_name:i.agent_name,session_id:i.session_id}),AA.updateIsCalling(!0),AA.updateDirection(mn.TRANSFER),AA.updateDisplayText(nt.TRANSFER_INCOMING_CALL),AA.updateActionConfigs(bc),fA.enableBrowserAlert&&Wo.show("📞 转接来电",`坐席 [${i.agent_no}] 正在转接...`,()=>{QA.emit(be.NOTIFICATION_CLICK,{agent_no:i.agent_no})},fA.browserAlertTime))),r===fe.TRANSFER_OFF_HOOK&&(QA.emit(pA.TRANSFER_OFF_HOOK,{session_id:fA.sessionId}),AA.updateTransferIsAnswer(!1),AA.updateDisplayText(nt.CALLING),AA.updateActionConfigs($a)),r===fe.TRANSFER_FAILED&&i.status==="failed"){QA.emit(pA.TRANSFER_FAILED,"未知原因"),QA.emit(be.FAIL_NOTIFICATION,"转接失败");const l=AA.get("direction");l===mn.OUTGOING?AA.updateActionConfigs(Ei):l===mn.INCOMING&&AA.updateActionConfigs($a)}r===fe.KICK_OFFLINE&&QA.emit(be.KICK_OFF)},this.ws.onclose=()=>{this.stopHeartbeat(),this.manualClose||setTimeout(()=>this.initWebSocket(),this.reconnectDelay)},this.ws.onerror=()=>{var t;(t=this.ws)==null||t.close()}}startHeartbeat(){const A=new Blob([`
|
|
1057
1057
|
let timer;
|
|
1058
1058
|
self.onmessage = function (e) {
|
|
1059
1059
|
if (e.data === 'start') {
|
|
@@ -1546,4 +1546,4 @@ html body {
|
|
|
1546
1546
|
&:hover {
|
|
1547
1547
|
opacity: 0.9;
|
|
1548
1548
|
}
|
|
1549
|
-
`;function nk({title:e,content:A,icon:t,onOk:n,onCancel:r}){const i=document.createElement("div");document.body.appendChild(i);const o=zO.createRoot(i),a=()=>{o.unmount(),i.remove()},s=async()=>{n&&await n(),a()},l=()=>{r==null||r(),a()};o.render(VA.jsx(XO,{children:VA.jsxs($O,{children:[VA.jsxs(_O,{children:[t&&VA.jsx(Ak,{children:t}),e]}),VA.jsx(ek,{children:A}),VA.jsxs(tk,{children:[VA.jsx(Sq,{onClick:l,children:"取消"}),VA.jsx(Sq,{primary:!0,onClick:s,children:"确定"})]})]})}))}const rk={1:VA.jsx(Te,{name:"ruandianhua"}),2:VA.jsx(Te,{name:"pnhone"}),3:VA.jsx(Te,{name:"sip-phone"})},ik={call_number:"",answer:"接听",reject:"拒接",hangup:"挂机",dtmf:"DTMF",unhold:"取消保持",hold:"保持",mute:"静音",unmute:"取消静音",satisfaction:"满意度",consult:"咨询",consult_transfer:"咨询转接",consult_retrieve:"取回通话",conference:"三方会议"},ok=R.lazy(()=>Promise.resolve().then(()=>require("./ConsultModel-CkUULQXx.js"))),ak=R.lazy(()=>Promise.resolve().then(()=>require("./TransferModel-C2m94oQg.js"))),sk=e=>{var he,ZA,WA;const{style:A,logBuiltinEnabled:t,browserAlertTime:n,enableBrowserAlert:r,agentNo:i,appKey:o,appSecret:a,url:s,onCallBack:l,ringingCardShow:u=!0,onLoginCancel:V,...d}=e,{height:f,busy:m,idle:C,selectOutNumberColor:q}=A||{},p=R.useRef(),I=R.useRef(),[S,Q]=R.useState(new Audio(JO)),[M,g]=R.useState(new Audio(PO)),[B,v]=R.useState(),[E,h]=R.useState(),[y,b]=R.useState(!1),[w,x]=R.useState(new Date().getTime()),[D,F]=R.useState(),[U,Y]=R.useState(),[K,L]=R.useState([]),[N,G]=R.useState([]),[P,j]=R.useState(""),[W,J]=R.useState(!1),[$,z]=R.useState([]),[tA,rA]=R.useState(""),[oA,_]=R.useState(""),[uA,H]=R.useState(!1),[aA,iA]=R.useState(!1),[IA,yA]=R.useState(),[CA,FA]=R.useState(new Date().getTime()),TA=Z=>{switch(Z){case He.IDLE:return C||"#1D92E9";case He.BUSY:return m||"#F5212D";default:return"#1D92E9"}};R.useEffect(()=>((async()=>(b(!0),p.current=pr.getInstance({agentNo:i,appKey:o,appSecret:a,url:s}),UA(),p.current.on(be.PHONE_BAR_OPERATION,Z=>{L(Z)}),await p.current.agent_api.checkAgentLogin({data:{agent_no:i},success:async Z=>{Z.data.is_login?nk({title:"当前账号已登录!",icon:VA.jsx(Te,{name:"wing",size:20}),content:"是否继续登录",onOk:async()=>{await p.current.init({...d,logBuiltinEnabled:t,browserAlertTime:n,enableBrowserAlert:r}),I.current=p.current.getAgentData()},onCancel:()=>{V==null||V()}}):(await p.current.init({...d,logBuiltinEnabled:t,browserAlertTime:n,enableBrowserAlert:r}),I.current=p.current.getAgentData())}}),b(!1)))(),()=>{var Z;(Z=p.current)==null||Z.destroy()}),[]);const UA=()=>{var Z,dA;(Z=p.current)==null||Z.on(be.EVENT_ALL,({event:hA,data:qA})=>{switch(hA){case pA.OUT_SUCCESS:case pA.CONSULT_RINGING:{MA(S),yA("out");return}case pA.OUT_INCOMING_CALL:{l==null||l(pA.OUT_INCOMING_CALL,{customer_phone:qA.customer_phone,session_id:qA.session_id});return}case pA.OUT_OFF_ANSWER:case pA.OUT_FAILED:case pA.CONSULT_FAILED:case pA.OUT_RINGING:case pA.CONSULT_OFF_HOOK:{cA(S);return}case pA.CONSULT_INCOMING:case pA.TRANSFER_INCOMING_CALL:case pA.INCOMING_CALL:{yA("in"),(hA===pA.CONSULT_INCOMING||hA===pA.TRANSFER_INCOMING_CALL)&&(l==null||l(hA,{agent_no:qA.agent_no,agent_name:qA.agent_name,session_id:qA.session_id})),hA===pA.INCOMING_CALL&&(l==null||l(pA.INCOMING_CALL,{customer_phone:qA.customer_phone,session_id:qA.session_id})),MA(M);return}case pA.TRANSFER_OFF_HOOK:case pA.CONSULT_CALL_IN_SUCCESS:case pA.INCOMING_CALL_OFF_HOOK:{l==null||l(hA,{session_id:qA.session_id}),cA(M);return}case pA.OUT_HANGUP:case pA.THREE_WAY_OUR_SIDE_HANGUP:case pA.OUR_SIDE_CONSULT_HANGUP:case pA.INCOMING_CALL_END:{l==null||l(hA,{session_id:qA.session_id}),cA(M),cA(S),yA(void 0),H(!1),iA(!1);return}case pA.REJECT:l==null||l(hA,{session_id:qA.session_id});return;default:return null}}),(dA=p.current)==null||dA.on(pA.AGENT_STATE,hA=>{Y(hA.state_name),x(new Date().getTime())}).on(pA.CALL_PROGRESS,hA=>{j(hA)}).on(be.WEBSITE_DELAY,hA=>{v(hA)}).on(pA.CUSTOMER_INFO,hA=>{h(hA)}).on(be.AGENT_INIT_STATUS,hA=>{if(hA){const{default_device:qA,init_state:EA,out_display_select_switch:YA,out_display_data:LA}=p.current.getAgentData();J(YA===1),YA===1&&z((LA||"").split("#")),F(qA),Y(EA===1?"空闲":"忙碌"),te()}}).on(be.SELECT_EXTERNAL_NUMBER,hA=>{rA(hA)}).on(be.FAIL_NOTIFICATION,hA=>{_e.error(hA)}).on(be.KICK_OFF,()=>{l?l==null||l(be.KICK_OFF):_e.warning("您的座席账号已在别处登录,请重新登录。如非您本人操作,请及时修改密码。"),Y("")})};R.useEffect(()=>{var Z;(Z=p.current)==null||Z.setBrowserAlertTime(n||3e3)},[n]),R.useEffect(()=>{var Z;(Z=p.current)==null||Z.setBrowserAlert(r||!1)},[r]);const MA=Z=>{Z.currentTime=0,Z.loop=!0,Z.play()},cA=Z=>{Z.pause()},BA=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.agent_api.changeDevice({data:{device:Z},success:()=>{F(Z),_e.success("切换设备成功"),x(new Date().getTime())}}))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},KA=async(Z,dA)=>{var hA;try{await((hA=p.current)==null?void 0:hA.agent_api.changeState({data:{state:Z,state_name:dA},success:()=>{Y(dA),x(new Date().getTime()),_e.success("切换状态成功")}}))}catch(qA){const{msg:EA}=JSON.parse(qA.message);_e.warning(EA)}},ee=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.agent_api.setAgentExplicit({data:{number:Z},success:()=>{_e.success(`切换[${Z}]外显号码成功`)}}))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},te=async()=>{var Z;try{await((Z=p.current)==null?void 0:Z.agent_api.getAgentState({success:dA=>{G(dA.data)}}))}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},jA=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.makeCall(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},kA=async()=>{var Z;try{await((Z=p.current)==null?void 0:Z.call_api.answerCall())}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},XA=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.cancelCall()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},le=async()=>{var Z;try{await((Z=p.current)==null?void 0:Z.call_api.hangup())}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},_A=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.holdCall()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},RA=()=>{var Z;(Z=p.current)==null||Z.call_api.unholdCall()},SA=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.consultCall(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},ie=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.consultRetrieve()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},ae=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.consultTransfer()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},pe=()=>{var Z;try{(Z=p.current)==null||Z.call_api.mute()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},Qe=()=>{var Z;try{(Z=p.current)==null||Z.call_api.unmute()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},ze=()=>{var Z;try{(Z=p.current)==null||Z.call_api.satisfactionEvaluation()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},We=()=>{var Z;try{(Z=p.current)==null||Z.call_api.startConference()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},et=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.transferAgent(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},Xe=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.transferOutline(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},je=VA.jsx(KO,{onPressEnter:Z=>{Z&&jA(Z)}},CA),we=R.useMemo(()=>[{name:"call_number",icon:VA.jsx(Aa,{trigger:"click",rootClassName:"call-number-popover",destroyTooltipOnHide:!0,onOpenChange:dA=>{FA(new Date().getTime())},content:je,children:VA.jsx("span",{children:VA.jsx(Te,{name:"boda",color:"#48D866",size:25})})})},{name:"answer",icon:VA.jsx(Te,{name:"jieting",onClick:kA,size:25})},{name:"reject",icon:VA.jsx(Te,{name:"jujie",color:"red",onClick:XA,size:25})},{name:"hangup",icon:VA.jsx(Te,{name:"guaji",color:"red",onClick:le,size:25})},{name:"hold",icon:VA.jsx(Te,{name:"baochi",color:"#1D92E9",onClick:_A,size:25})},{name:"unhold",icon:VA.jsx(Te,{name:"quxiaobaochi",color:"#1D92E9",onClick:RA,size:25})},{name:"mute",icon:VA.jsx(Te,{name:"mk",onClick:pe,color:"#1D92E9",size:25})},{name:"unmute",icon:VA.jsx(Te,{name:"guanbimk",onClick:Qe,color:"#1D92E9",size:25})},{name:"satisfaction",icon:VA.jsx(Te,{name:"manyidu",onClick:ze,size:25})},{name:"consult",icon:VA.jsx(Te,{name:"zixun",onClick:()=>{H(!0)},size:25})},{name:"consult_transfer",icon:VA.jsx(Te,{name:"zhuanjie",onClick:ae,size:25})},{name:"transfer",icon:VA.jsx(Te,{size:25,name:"zhuanjie",onClick:()=>{iA(!0)}})},{name:"consult_retrieve",icon:VA.jsx(Te,{name:"fanhui",color:"#ffc53d",size:25,onClick:ie})},{name:"conference",icon:VA.jsx(Te,{name:"huiyi",onClick:We,size:25})}].filter(({name:dA})=>K.includes(dA)),[K]);return VA.jsx(VA.Fragment,{children:VA.jsxs(Ar,{prefixCls:"ysyt",theme:{components:{Select:{selectorBg:"none"}}},children:[U?VA.jsx(nc,{spinning:y,children:VA.jsxs(YS,{height:f,children:[VA.jsx(NS,{children:VA.jsx(mi,{variant:"underlined",value:D,onChange:Z=>{BA(Z)},options:(((he=I.current)==null?void 0:he.answer_devices)||[]).map(Z=>({...Z,label:VA.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[rk[Z.value],VA.jsx("span",{style:{marginLeft:5},children:Z.label})]})})),style:{width:140}})}),VA.jsxs(ZS,{background:TA(U==="空闲"?1:2),children:[VA.jsxs("div",{className:"ysyt-strip",children:[VA.jsx("div",{children:P?VA.jsx("span",{className:"ysyt-strip-state-name",children:P}):VA.jsx(Dv,{trigger:["click"],menu:{items:N.map(Z=>({label:VA.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[Z.state===1?VA.jsx(Te,{name:"kongxian",color:"#7cb305",size:16}):VA.jsx(Te,{name:"manglu",color:"#f5222d",size:16}),VA.jsx("span",{style:{marginLeft:10},children:Z.state_name})]}),key:Z.state_name,onClick:()=>{KA(Z.state,Z.state_name)}}))},children:VA.jsxs("div",{style:{color:"#fff",cursor:"pointer",display:"flex",alignItems:"center"},children:[U==="空闲"?VA.jsx(Te,{name:"kongxian",color:"#fff",size:20}):VA.jsx(Te,{name:"manglu2",size:20}),VA.jsx("span",{style:{margin:"0 10px"},children:U}),VA.jsx(Te,{name:"xia",color:"#fff"})]})})}),VA.jsx("div",{className:"ysyt-strip-time",children:VA.jsx(HO,{},w)})]}),VA.jsx("div",{className:"ysyt-action",children:we.map(({name:Z,icon:dA})=>VA.jsx(ka,{title:ik[Z],children:dA},Z))}),W&&VA.jsx($S,{children:VA.jsx("div",{children:VA.jsx(Aa,{trigger:"click",title:"外显号码池",onOpenChange:Z=>{Z||_("")},content:VA.jsxs(_S,{children:[VA.jsx("div",{children:VA.jsx(Pr,{value:oA,placeholder:"请输入外显号码",onChange:Z=>_(Z.target.value)})}),VA.jsx("div",{className:"ysyt-number-content",children:VA.jsx(xa.Group,{value:tA,onChange:Z=>{ee(Z.target.value)},options:$.filter(Z=>Z.includes(oA)).map(Z=>({label:VA.jsx(A1,{style:{color:tA===Z?"#1D92E9":""},children:Z},Z),value:Z}))})})]}),children:VA.jsxs("div",{style:{fontSize:14,cursor:"pointer",color:q||"#333",display:"flex",alignItems:"center"},children:[VA.jsx(Te,{name:"external",color:q||"#333"}),VA.jsx("span",{style:{margin:"0 5px"},children:"外显号码"}),VA.jsx(Te,{name:"xia",color:q||"#333"})]})})})})]}),VA.jsx(PS,{children:B&&B.rtt&&VA.jsx("div",{children:VA.jsx(Aa,{content:VA.jsxs("div",{children:[VA.jsxs("div",{children:["延迟: ",B.rtt,"ms"]}),B.jitter&&VA.jsxs("div",{children:["抖动: ",B.jitter,"ms"]}),VA.jsxs("div",{children:["丢包: ",B.packetsLost||0]}),B.packetsReceived?VA.jsxs("div",{children:["接收: ",B.packetsReceived]}):null,B.packetsSent?VA.jsxs("div",{children:["发送: ",B.packetsSent]}):null,B.sendBitrate?VA.jsxs("div",{children:["发送码率: ",B.sendBitrate,"KB/s"]}):null,B.recvBitrate?VA.jsxs("div",{children:["接收码率: ",B.recvBitrate,"KB/s"]}):null]}),placement:"bottomLeft",children:VA.jsxs("div",{style:{padding:"0 10px"},children:[B.rtt>=250?VA.jsx(Te,{name:"wifi1"}):"",B.rtt>=121&&B.rtt<250?VA.jsx(Te,{name:"wifi2"}):"",B.rtt<=120?VA.jsx(Te,{name:"wifi3"}):""]})})})}),u&&VA.jsxs(XS,{height:f,show:!!E,children:[VA.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[VA.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[(E==null?void 0:E.is_vip)===1&&VA.jsx(Te,{name:"vip"}),VA.jsx("span",{style:{marginLeft:5},children:E==null?void 0:E.customer_name})]}),VA.jsx("b",{children:E==null?void 0:E.phone})]}),VA.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[VA.jsxs("span",{children:[E==null?void 0:E.province,"-",E==null?void 0:E.city]}),IA&&VA.jsxs("span",{children:[IA==="out"?"呼出次数:":"呼入次数:",VA.jsx("span",{style:{color:"#1D92E9"},children:IA==="out"?E==null?void 0:E.contact_count:E==null?void 0:E.in_contact_count})]})]})]})]})}):VA.jsx(VA.Fragment,{}),VA.jsx(R.Suspense,{children:uA&&((ZA=p.current)==null?void 0:ZA.agent_api)&&VA.jsx(ok,{open:uA,queryFetch:p.current.agent_api.getIdleAgentList,onCallBack:Z=>{H(!1),Z&&SA(Z)}})}),VA.jsx(R.Suspense,{children:aA&&((WA=p.current)==null?void 0:WA.agent_api)&&VA.jsx(ak,{open:aA,queryFetch:p.current.agent_api.getIdleAgentList,onCallBack:(Z,dA)=>{iA(!1),Z&&(dA===0?et(Z):dA===1&&Xe(Z))}})})]})})},lk=e=>{var A;return(A=pr.getInstance())==null?void 0:A.call_api.makeCall(e)},ck=()=>{var e;return(e=pr.getInstance())==null?void 0:e.getRealTimeCustomerInfo()},uk=async e=>{var A,t;if(e!==He.IDLE&&e!==He.BUSY)throw new Error("Invalid agent state");try{await((t=(A=pr.getInstance())==null?void 0:A.agent_api)==null?void 0:t.changeState({data:{state:e,state_name:e===He.IDLE?"空闲":"忙碌"}}))}catch(n){console.error(n)}},Vk=async e=>{var A,t;try{await((t=(A=pr.getInstance())==null?void 0:A.agent_api)==null?void 0:t.changeDevice({data:{device:e}}))}catch(n){console.error(n)}};exports.Button=gi;exports.CONTAINER_MAX_OFFSET=Zd;exports.CSSMotion=fi;exports.ConfigContext=Ue;exports.ConfigProvider=Ar;exports.ContextIsolator=fa;exports.DisabledContextProvider=wm;exports.Empty=Vr;exports.FastColor=Ze;exports.Input=Pr;exports.KeyCode=re;exports.Keyframe=Fe;exports.ModelBody=JS;exports.Portal=Pl;exports.Radio=xa;exports.RefIcon=Ac;exports.RefIcon$1=sg;exports.RefIcon$2=Da;exports.RefIcon$3=ag;exports.RefIcon$4=lg;exports.Space=_l;exports.Spin=nc;exports.Wave=Ul;exports.YsytBarPhone=sk;exports.YsytIconSvg=Te;exports._extends=DA;exports._objectSpread2=k;exports._slicedToArray=X;exports._toConsumableArray=wA;exports._typeof=Ae;exports.canUseDom=Ut;exports.classNames=nA;exports.clearFix=Us;exports.contains=Fq;exports.convertLegacyProps=UR;exports.devUseWarning=at;exports.genFocusStyle=Os;exports.genPresetColor=Cm;exports.genStyleHooks=Qt;exports.genSubStyleComponent=mm;exports.getConfirmLocale=wy;exports.getCustomerInfo=ck;exports.getReactRender=Hd;exports.getTransitionName=Nl;exports.globalConfig=qd;exports.initMotion=Dl;exports.initZoomMotion=wa;exports.isPresetColor=Sv;exports.isPresetStatusColor=cF;exports.jsxRuntimeExports=VA;exports.localeValues=ci;exports.makeCall=lk;exports.merge=Je;exports.omit=zt;exports.pickAttrs=Kr;exports.replaceElement=d0;exports.resetComponent=Kt;exports.setAgentDevice=Vk;exports.setAgentInitState=uk;exports.unit=mA;exports.useCSSVarCls=Yn;exports.useComponentConfig=_n;exports.useComposeRef=Lr;exports.useEvent=rt;exports.useId=Ol;exports.useLocale=ql;exports.useSafeState=no;exports.useToken=cn;exports.useZIndex=Ba;exports.warnContext=Nm;exports.warning=Yr;exports.withPureRenderTheme=av;exports.zIndexContext=Sa;
|
|
1549
|
+
`;function nk({title:e,content:A,icon:t,onOk:n,onCancel:r}){const i=document.createElement("div");document.body.appendChild(i);const o=zO.createRoot(i),a=()=>{o.unmount(),i.remove()},s=async()=>{n&&await n(),a()},l=()=>{r==null||r(),a()};o.render(VA.jsx(XO,{children:VA.jsxs($O,{children:[VA.jsxs(_O,{children:[t&&VA.jsx(Ak,{children:t}),e]}),VA.jsx(ek,{children:A}),VA.jsxs(tk,{children:[VA.jsx(Sq,{onClick:l,children:"取消"}),VA.jsx(Sq,{primary:!0,onClick:s,children:"确定"})]})]})}))}const rk={1:VA.jsx(Te,{name:"ruandianhua"}),2:VA.jsx(Te,{name:"pnhone"}),3:VA.jsx(Te,{name:"sip-phone"})},ik={call_number:"",answer:"接听",reject:"拒接",hangup:"挂机",dtmf:"DTMF",unhold:"取消保持",hold:"保持",mute:"静音",unmute:"取消静音",satisfaction:"满意度",consult:"咨询",consult_transfer:"咨询转接",consult_retrieve:"取回通话",conference:"三方会议"},ok=R.lazy(()=>Promise.resolve().then(()=>require("./ConsultModel-BW6ts2M2.js"))),ak=R.lazy(()=>Promise.resolve().then(()=>require("./TransferModel-DYL9K5Tk.js"))),sk=e=>{var he,ZA,WA;const{style:A,logBuiltinEnabled:t,browserAlertTime:n,enableBrowserAlert:r,agentNo:i,appKey:o,appSecret:a,url:s,onCallBack:l,ringingCardShow:u=!0,onLoginCancel:V,...d}=e,{height:f,busy:m,idle:C,selectOutNumberColor:q}=A||{},p=R.useRef(),I=R.useRef(),[S,Q]=R.useState(new Audio(JO)),[M,g]=R.useState(new Audio(PO)),[B,v]=R.useState(),[E,h]=R.useState(),[y,b]=R.useState(!1),[w,x]=R.useState(new Date().getTime()),[D,F]=R.useState(),[U,Y]=R.useState(),[K,L]=R.useState([]),[N,G]=R.useState([]),[P,j]=R.useState(""),[W,J]=R.useState(!1),[$,z]=R.useState([]),[tA,rA]=R.useState(""),[oA,_]=R.useState(""),[uA,H]=R.useState(!1),[aA,iA]=R.useState(!1),[IA,yA]=R.useState(),[CA,FA]=R.useState(new Date().getTime()),TA=Z=>{switch(Z){case He.IDLE:return C||"#1D92E9";case He.BUSY:return m||"#F5212D";default:return"#1D92E9"}};R.useEffect(()=>((async()=>(b(!0),p.current=pr.getInstance({agentNo:i,appKey:o,appSecret:a,url:s}),UA(),p.current.on(be.PHONE_BAR_OPERATION,Z=>{L(Z)}),await p.current.agent_api.checkAgentLogin({data:{agent_no:i},success:async Z=>{Z.data.is_login?nk({title:"当前账号已登录!",icon:VA.jsx(Te,{name:"wing",size:20}),content:"是否继续登录",onOk:async()=>{await p.current.init({...d,logBuiltinEnabled:t,browserAlertTime:n,enableBrowserAlert:r}),I.current=p.current.getAgentData()},onCancel:()=>{V==null||V()}}):(await p.current.init({...d,logBuiltinEnabled:t,browserAlertTime:n,enableBrowserAlert:r}),I.current=p.current.getAgentData())}}),b(!1)))(),()=>{var Z;(Z=p.current)==null||Z.destroy()}),[]);const UA=()=>{var Z,dA;(Z=p.current)==null||Z.on(be.EVENT_ALL,({event:hA,data:qA})=>{switch(hA){case pA.OUT_SUCCESS:case pA.CONSULT_RINGING:{MA(S),yA("out");return}case pA.OUT_INCOMING_CALL:{l==null||l(pA.OUT_INCOMING_CALL,{customer_phone:qA.customer_phone,session_id:qA.session_id});return}case pA.OUT_OFF_ANSWER:case pA.OUT_FAILED:case pA.CONSULT_FAILED:case pA.OUT_RINGING:case pA.CONSULT_OFF_HOOK:{cA(S);return}case pA.CONSULT_INCOMING:case pA.TRANSFER_INCOMING_CALL:case pA.INCOMING_CALL:{yA("in"),(hA===pA.CONSULT_INCOMING||hA===pA.TRANSFER_INCOMING_CALL)&&(l==null||l(hA,{agent_no:qA.agent_no,agent_name:qA.agent_name,session_id:qA.session_id})),hA===pA.INCOMING_CALL&&(l==null||l(pA.INCOMING_CALL,{customer_phone:qA.customer_phone,session_id:qA.session_id})),MA(M);return}case pA.TRANSFER_OFF_HOOK:case pA.CONSULT_CALL_IN_SUCCESS:case pA.INCOMING_CALL_OFF_HOOK:{l==null||l(hA,{session_id:qA.session_id}),cA(M);return}case pA.OUT_HANGUP:case pA.THREE_WAY_OUR_SIDE_HANGUP:case pA.OUR_SIDE_CONSULT_HANGUP:case pA.INCOMING_CALL_END:{l==null||l(hA,{session_id:qA.session_id}),cA(M),cA(S),yA(void 0),H(!1),iA(!1);return}case pA.REJECT:l==null||l(hA,{session_id:qA.session_id});return;default:return null}}),(dA=p.current)==null||dA.on(pA.AGENT_STATE,hA=>{Y(hA.state_name),x(new Date().getTime())}).on(pA.CALL_PROGRESS,hA=>{j(hA)}).on(be.WEBSITE_DELAY,hA=>{v(hA)}).on(pA.CUSTOMER_INFO,hA=>{h(hA)}).on(be.AGENT_INIT_STATUS,hA=>{if(hA){const{default_device:qA,init_state:EA,out_display_select_switch:YA,out_display_data:LA}=p.current.getAgentData();J(YA===1),YA===1&&z((LA||"").split("#")),F(qA),Y(EA===1?"空闲":"忙碌"),te()}}).on(be.SELECT_EXTERNAL_NUMBER,hA=>{rA(hA)}).on(be.FAIL_NOTIFICATION,hA=>{_e.error(hA)}).on(be.KICK_OFF,()=>{l?l==null||l(be.KICK_OFF):_e.warning("您的座席账号已在别处登录,请重新登录。如非您本人操作,请及时修改密码。"),Y("")})};R.useEffect(()=>{var Z;(Z=p.current)==null||Z.setBrowserAlertTime(n||3)},[n]),R.useEffect(()=>{var Z;(Z=p.current)==null||Z.setBrowserAlert(r||!1)},[r]);const MA=Z=>{Z.currentTime=0,Z.loop=!0,Z.play()},cA=Z=>{Z.pause()},BA=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.agent_api.changeDevice({data:{device:Z},success:()=>{F(Z),_e.success("切换设备成功")}}))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},KA=async(Z,dA)=>{var hA;try{await((hA=p.current)==null?void 0:hA.agent_api.changeState({data:{state:Z,state_name:dA},success:()=>{Y(dA),_e.success("切换状态成功")}}))}catch(qA){const{msg:EA}=JSON.parse(qA.message);_e.warning(EA)}},ee=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.agent_api.setAgentExplicit({data:{number:Z},success:()=>{_e.success(`切换[${Z}]外显号码成功`)}}))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},te=async()=>{var Z;try{await((Z=p.current)==null?void 0:Z.agent_api.getAgentState({success:dA=>{G(dA.data)}}))}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},jA=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.makeCall(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},kA=async()=>{var Z;try{await((Z=p.current)==null?void 0:Z.call_api.answerCall())}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},XA=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.cancelCall()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},le=async()=>{var Z;try{await((Z=p.current)==null?void 0:Z.call_api.hangup())}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},_A=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.holdCall()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},RA=()=>{var Z;(Z=p.current)==null||Z.call_api.unholdCall()},SA=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.consultCall(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},ie=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.consultRetrieve()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},ae=async()=>{var Z;try{(Z=p.current)==null||Z.call_api.consultTransfer()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},pe=()=>{var Z;try{(Z=p.current)==null||Z.call_api.mute()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},Qe=()=>{var Z;try{(Z=p.current)==null||Z.call_api.unmute()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},ze=()=>{var Z;try{(Z=p.current)==null||Z.call_api.satisfactionEvaluation()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},We=()=>{var Z;try{(Z=p.current)==null||Z.call_api.startConference()}catch(dA){const{msg:hA}=JSON.parse(dA.message);_e.warning(hA)}},et=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.transferAgent(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},Xe=async Z=>{var dA;try{await((dA=p.current)==null?void 0:dA.call_api.transferOutline(Z))}catch(hA){const{msg:qA}=JSON.parse(hA.message);_e.warning(qA)}},je=VA.jsx(KO,{onPressEnter:Z=>{Z&&jA(Z)}},CA),we=R.useMemo(()=>[{name:"call_number",icon:VA.jsx(Aa,{trigger:"click",rootClassName:"call-number-popover",destroyTooltipOnHide:!0,onOpenChange:dA=>{FA(new Date().getTime())},content:je,children:VA.jsx("span",{children:VA.jsx(Te,{name:"boda",color:"#48D866",size:25})})})},{name:"answer",icon:VA.jsx(Te,{name:"jieting",onClick:kA,size:25})},{name:"reject",icon:VA.jsx(Te,{name:"jujie",color:"red",onClick:XA,size:25})},{name:"hangup",icon:VA.jsx(Te,{name:"guaji",color:"red",onClick:le,size:25})},{name:"hold",icon:VA.jsx(Te,{name:"baochi",color:"#1D92E9",onClick:_A,size:25})},{name:"unhold",icon:VA.jsx(Te,{name:"quxiaobaochi",color:"#1D92E9",onClick:RA,size:25})},{name:"mute",icon:VA.jsx(Te,{name:"mk",onClick:pe,color:"#1D92E9",size:25})},{name:"unmute",icon:VA.jsx(Te,{name:"guanbimk",onClick:Qe,color:"#1D92E9",size:25})},{name:"satisfaction",icon:VA.jsx(Te,{name:"manyidu",onClick:ze,size:25})},{name:"consult",icon:VA.jsx(Te,{name:"zixun",onClick:()=>{H(!0)},size:25})},{name:"consult_transfer",icon:VA.jsx(Te,{name:"zhuanjie",onClick:ae,size:25})},{name:"transfer",icon:VA.jsx(Te,{size:25,name:"zhuanjie",onClick:()=>{iA(!0)}})},{name:"consult_retrieve",icon:VA.jsx(Te,{name:"fanhui",color:"#ffc53d",size:25,onClick:ie})},{name:"conference",icon:VA.jsx(Te,{name:"huiyi",onClick:We,size:25})}].filter(({name:dA})=>K.includes(dA)),[K]);return VA.jsx(VA.Fragment,{children:VA.jsxs(Ar,{prefixCls:"ysyt",theme:{components:{Select:{selectorBg:"none"}}},children:[U?VA.jsx(nc,{spinning:y,children:VA.jsxs(YS,{height:f,children:[VA.jsx(NS,{children:VA.jsx(mi,{variant:"underlined",value:D,onChange:Z=>{BA(Z)},options:(((he=I.current)==null?void 0:he.answer_devices)||[]).map(Z=>({...Z,label:VA.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[rk[Z.value],VA.jsx("span",{style:{marginLeft:5},children:Z.label})]})})),style:{width:140}})}),VA.jsxs(ZS,{background:TA(U==="空闲"?1:2),children:[VA.jsxs("div",{className:"ysyt-strip",children:[VA.jsx("div",{children:P?VA.jsx("span",{className:"ysyt-strip-state-name",children:P}):VA.jsx(Dv,{trigger:["click"],menu:{items:N.map(Z=>({label:VA.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[Z.state===1?VA.jsx(Te,{name:"kongxian",color:"#7cb305",size:16}):VA.jsx(Te,{name:"manglu",color:"#f5222d",size:16}),VA.jsx("span",{style:{marginLeft:10},children:Z.state_name})]}),key:Z.state_name,onClick:()=>{KA(Z.state,Z.state_name)}}))},children:VA.jsxs("div",{style:{color:"#fff",cursor:"pointer",display:"flex",alignItems:"center"},children:[U==="空闲"?VA.jsx(Te,{name:"kongxian",color:"#fff",size:20}):VA.jsx(Te,{name:"manglu2",size:20}),VA.jsx("span",{style:{margin:"0 10px"},children:U}),VA.jsx(Te,{name:"xia",color:"#fff"})]})})}),VA.jsx("div",{className:"ysyt-strip-time",children:VA.jsx(HO,{},w)})]}),VA.jsx("div",{className:"ysyt-action",children:we.map(({name:Z,icon:dA})=>VA.jsx(ka,{title:ik[Z],children:dA},Z))}),W&&VA.jsx($S,{children:VA.jsx("div",{children:VA.jsx(Aa,{trigger:"click",title:"外显号码池",onOpenChange:Z=>{Z||_("")},content:VA.jsxs(_S,{children:[VA.jsx("div",{children:VA.jsx(Pr,{value:oA,placeholder:"请输入外显号码",onChange:Z=>_(Z.target.value)})}),VA.jsx("div",{className:"ysyt-number-content",children:VA.jsx(xa.Group,{value:tA,onChange:Z=>{ee(Z.target.value)},options:$.filter(Z=>Z.includes(oA)).map(Z=>({label:VA.jsx(A1,{style:{color:tA===Z?"#1D92E9":""},children:Z},Z),value:Z}))})})]}),children:VA.jsxs("div",{style:{fontSize:14,cursor:"pointer",color:q||"#333",display:"flex",alignItems:"center"},children:[VA.jsx(Te,{name:"external",color:q||"#333"}),VA.jsx("span",{style:{margin:"0 5px"},children:"外显号码"}),VA.jsx(Te,{name:"xia",color:q||"#333"})]})})})})]}),VA.jsx(PS,{children:B&&B.rtt&&VA.jsx("div",{children:VA.jsx(Aa,{content:VA.jsxs("div",{children:[VA.jsxs("div",{children:["延迟: ",B.rtt,"ms"]}),B.jitter&&VA.jsxs("div",{children:["抖动: ",B.jitter,"ms"]}),VA.jsxs("div",{children:["丢包: ",B.packetsLost||0]}),B.packetsReceived?VA.jsxs("div",{children:["接收: ",B.packetsReceived]}):null,B.packetsSent?VA.jsxs("div",{children:["发送: ",B.packetsSent]}):null,B.sendBitrate?VA.jsxs("div",{children:["发送码率: ",B.sendBitrate,"KB/s"]}):null,B.recvBitrate?VA.jsxs("div",{children:["接收码率: ",B.recvBitrate,"KB/s"]}):null]}),placement:"bottomLeft",children:VA.jsxs("div",{style:{padding:"0 10px"},children:[B.rtt>=250?VA.jsx(Te,{name:"wifi1"}):"",B.rtt>=121&&B.rtt<250?VA.jsx(Te,{name:"wifi2"}):"",B.rtt<=120?VA.jsx(Te,{name:"wifi3"}):""]})})})}),u&&VA.jsxs(XS,{height:f,show:!!E,children:[VA.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[VA.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[(E==null?void 0:E.is_vip)===1&&VA.jsx(Te,{name:"vip"}),VA.jsx("span",{style:{marginLeft:5},children:E==null?void 0:E.customer_name})]}),VA.jsx("b",{children:E==null?void 0:E.phone})]}),VA.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[VA.jsxs("span",{children:[E==null?void 0:E.province,"-",E==null?void 0:E.city]}),IA&&VA.jsxs("span",{children:[IA==="out"?"呼出次数:":"呼入次数:",VA.jsx("span",{style:{color:"#1D92E9"},children:IA==="out"?E==null?void 0:E.contact_count:E==null?void 0:E.in_contact_count})]})]})]})]})}):VA.jsx(VA.Fragment,{}),VA.jsx(R.Suspense,{children:uA&&((ZA=p.current)==null?void 0:ZA.agent_api)&&VA.jsx(ok,{open:uA,queryFetch:p.current.agent_api.getIdleAgentList,onCallBack:Z=>{H(!1),Z&&SA(Z)}})}),VA.jsx(R.Suspense,{children:aA&&((WA=p.current)==null?void 0:WA.agent_api)&&VA.jsx(ak,{open:aA,queryFetch:p.current.agent_api.getIdleAgentList,onCallBack:(Z,dA)=>{iA(!1),Z&&(dA===0?et(Z):dA===1&&Xe(Z))}})})]})})},lk=e=>{var A;return(A=pr.getInstance())==null?void 0:A.call_api.makeCall(e)},ck=()=>{var e;return(e=pr.getInstance())==null?void 0:e.getRealTimeCustomerInfo()},uk=async e=>{var A,t;if(e!==He.IDLE&&e!==He.BUSY)throw new Error("Invalid agent state");try{await((t=(A=pr.getInstance())==null?void 0:A.agent_api)==null?void 0:t.changeState({data:{state:e,state_name:e===He.IDLE?"空闲":"忙碌"}}))}catch(n){console.error(n)}},Vk=async e=>{var A,t;try{await((t=(A=pr.getInstance())==null?void 0:A.agent_api)==null?void 0:t.changeDevice({data:{device:e}}))}catch(n){console.error(n)}};exports.Button=gi;exports.CONTAINER_MAX_OFFSET=Zd;exports.CSSMotion=fi;exports.ConfigContext=Ue;exports.ConfigProvider=Ar;exports.ContextIsolator=fa;exports.DisabledContextProvider=wm;exports.Empty=Vr;exports.FastColor=Ze;exports.Input=Pr;exports.KeyCode=re;exports.Keyframe=Fe;exports.ModelBody=JS;exports.Portal=Pl;exports.Radio=xa;exports.RefIcon=Ac;exports.RefIcon$1=sg;exports.RefIcon$2=Da;exports.RefIcon$3=ag;exports.RefIcon$4=lg;exports.Space=_l;exports.Spin=nc;exports.Wave=Ul;exports.YsytBarPhone=sk;exports.YsytIconSvg=Te;exports._extends=DA;exports._objectSpread2=k;exports._slicedToArray=X;exports._toConsumableArray=wA;exports._typeof=Ae;exports.canUseDom=Ut;exports.classNames=nA;exports.clearFix=Us;exports.contains=Fq;exports.convertLegacyProps=UR;exports.devUseWarning=at;exports.genFocusStyle=Os;exports.genPresetColor=Cm;exports.genStyleHooks=Qt;exports.genSubStyleComponent=mm;exports.getConfirmLocale=wy;exports.getCustomerInfo=ck;exports.getReactRender=Hd;exports.getTransitionName=Nl;exports.globalConfig=qd;exports.initMotion=Dl;exports.initZoomMotion=wa;exports.isPresetColor=Sv;exports.isPresetStatusColor=cF;exports.jsxRuntimeExports=VA;exports.localeValues=ci;exports.makeCall=lk;exports.merge=Je;exports.omit=zt;exports.pickAttrs=Kr;exports.replaceElement=d0;exports.resetComponent=Kt;exports.setAgentDevice=Vk;exports.setAgentInitState=uk;exports.unit=mA;exports.useCSSVarCls=Yn;exports.useComponentConfig=_n;exports.useComposeRef=Lr;exports.useEvent=rt;exports.useId=Ol;exports.useLocale=ql;exports.useSafeState=no;exports.useToken=cn;exports.useZIndex=Ba;exports.warnContext=Nm;exports.warning=Yr;exports.withPureRenderTheme=av;exports.zIndexContext=Sa;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const b=require("react"),a=require("./index-
|
|
1
|
+
"use strict";const b=require("react"),a=require("./index-CasEGtND.js");function st(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=st(b),it=new a.Keyframe("antFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),ct=new a.Keyframe("antFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),dt=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const{antCls:o}=e,n=`${o}-fade`,r=t?"&":"";return[a.initMotion(n,it,ct,e.motionDurationMid,t),{[`
|
|
2
2
|
${r}${n}-enter,
|
|
3
3
|
${r}${n}-appear
|
|
4
4
|
`]:{opacity:0,animationTimingFunction:"linear"},[`${r}${n}-leave`]:{animationTimingFunction:"linear"}}]},ut=e=>{const{paddingXXS:t,lineWidth:o,tagPaddingHorizontal:n,componentCls:r,calc:l}=e,i=l(n).sub(o).equal(),u=l(t).sub(o).equal();return{[r]:Object.assign(Object.assign({},a.resetComponent(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:i,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:`${a.unit(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",position:"relative",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},[`${r}-close-icon`]:{marginInlineStart:u,fontSize:e.tagIconSize,color:e.colorTextDescription,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:i}}),[`${r}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},Ce=e=>{const{lineWidth:t,fontSizeIcon:o,calc:n}=e,r=e.fontSizeSM;return a.merge(e,{tagFontSize:r,tagLineHeight:a.unit(n(e.lineHeightSM).mul(r).equal()),tagIconSize:n(o).sub(n(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},pe=e=>({defaultBg:new a.FastColor(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText}),Re=a.genStyleHooks("Tag",e=>{const t=Ce(e);return ut(t)},pe);function oe(e){if(e)return{closable:e.closable,closeIcon:e.closeIcon}}function $e(e){const{closable:t,closeIcon:o}=e||{};return b.useMemo(()=>{if(!t&&(t===!1||o===!1||o===null))return!1;if(t===void 0&&o===void 0)return null;let n={closeIcon:typeof o!="boolean"&&o!==null?o:void 0};return t&&typeof t=="object"&&(n=Object.assign(Object.assign({},n),t)),n},[t,o])}function xe(){const e={};for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return o.forEach(r=>{r&&Object.keys(r).forEach(l=>{r[l]!==void 0&&(e[l]=r[l])})}),e}const mt={};function Be(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mt;const n=$e(e),r=$e(t),l=typeof n!="boolean"?!!(n!=null&&n.disabled):!1,i=b.useMemo(()=>Object.assign({closeIcon:b.createElement(a.RefIcon,null)},o),[o]),u=b.useMemo(()=>n===!1?!1:n?xe(i,r,n):r===!1?!1:r?xe(i,r):i.closable?i:!1,[n,r,i]);return b.useMemo(()=>{if(u===!1)return[!1,null,l];const{closeIconRender:c}=i,{closeIcon:g}=u;let d=g;if(d!=null){c&&(d=c(g));const m=a.pickAttrs(u,!0);Object.keys(m).length&&(d=b.isValidElement(d)?b.cloneElement(d,m):b.createElement("span",Object.assign({},m),d))}return[!0,d,l]},[u,i])}var ft=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o};const gt=s.forwardRef((e,t)=>{const{prefixCls:o,style:n,className:r,checked:l,onChange:i,onClick:u}=e,c=ft(e,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:g,tag:d}=s.useContext(a.ConfigContext),m=y=>{i==null||i(!l),u==null||u(y)},f=g("tag",o),[v,x,C]=Re(f),p=a.classNames(f,`${f}-checkable`,{[`${f}-checkable-checked`]:l},d==null?void 0:d.className,r,x,C);return v(s.createElement("span",Object.assign({},c,{ref:t,style:Object.assign(Object.assign({},n),d==null?void 0:d.style),className:p,onClick:m})))}),Ct=e=>a.genPresetColor(e,(t,o)=>{let{textColor:n,lightBorderColor:r,lightColor:l,darkColor:i}=o;return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:n,background:l,borderColor:r,"&-inverse":{color:e.colorTextLightSolid,background:i,borderColor:i},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}}),pt=a.genSubStyleComponent(["Tag","preset"],e=>{const t=Ce(e);return Ct(t)},pe);function bt(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}const ne=(e,t,o)=>{const n=bt(o);return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:e[`color${o}`],background:e[`color${n}Bg`],borderColor:e[`color${n}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}},vt=a.genSubStyleComponent(["Tag","status"],e=>{const t=Ce(e);return[ne(t,"success","Success"),ne(t,"processing","Info"),ne(t,"error","Error"),ne(t,"warning","Warning")]},pe);var ht=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o};const yt=s.forwardRef((e,t)=>{const{prefixCls:o,className:n,rootClassName:r,style:l,children:i,icon:u,color:c,onClose:g,bordered:d=!0,visible:m}=e,f=ht(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:v,direction:x,tag:C}=s.useContext(a.ConfigContext),[p,y]=s.useState(!0),h=a.omit(f,["closeIcon","closable"]);process.env.NODE_ENV!=="production"&&a.devUseWarning("Tag").deprecated(!("visible"in e),"visible","visible && <Tag />"),s.useEffect(()=>{m!==void 0&&y(m)},[m]);const S=a.isPresetColor(c),N=a.isPresetStatusColor(c),E=S||N,O=Object.assign(Object.assign({backgroundColor:c&&!E?c:void 0},C==null?void 0:C.style),l),$=v("tag",o),[P,j,H]=Re($),B=a.classNames($,C==null?void 0:C.className,{[`${$}-${c}`]:E,[`${$}-has-color`]:c&&!E,[`${$}-hidden`]:!p,[`${$}-rtl`]:x==="rtl",[`${$}-borderless`]:!d},n,r,j,H),_=I=>{I.stopPropagation(),g==null||g(I),!I.defaultPrevented&&y(!1)},[,V]=Be(oe(e),oe(C),{closable:!1,closeIconRender:I=>{const X=s.createElement("span",{className:`${$}-close-icon`,onClick:_},I);return a.replaceElement(I,X,M=>({onClick:q=>{var R;(R=M==null?void 0:M.onClick)===null||R===void 0||R.call(M,q),_(q)},className:a.classNames(M==null?void 0:M.className,`${$}-close-icon`)}))}}),A=typeof f.onClick=="function"||i&&i.type==="a",z=u||null,W=z?s.createElement(s.Fragment,null,z,i&&s.createElement("span",null,i)):i,L=s.createElement("span",Object.assign({},h,{ref:t,className:B,style:O}),W,V,S&&s.createElement(pt,{key:"preset",prefixCls:$}),N&&s.createElement(vt,{key:"status",prefixCls:$}));return P(A?s.createElement(a.Wave,{component:"Tag"},L):L)}),be=yt;process.env.NODE_ENV!=="production"&&(be.displayName="Tag");be.CheckableTag=gt;function ie(e){return!!(e!=null&&e.then)}const _e=e=>{const{type:t,children:o,prefixCls:n,buttonProps:r,close:l,autoFocus:i,emitEvent:u,isSilent:c,quitOnNullishReturnValue:g,actionFn:d}=e,m=s.useRef(!1),f=s.useRef(null),[v,x]=a.useSafeState(!1),C=function(){l==null||l.apply(void 0,arguments)};s.useEffect(()=>{let h=null;return i&&(h=setTimeout(()=>{var S;(S=f.current)===null||S===void 0||S.focus({preventScroll:!0})})),()=>{h&&clearTimeout(h)}},[]);const p=h=>{ie(h)&&(x(!0),h.then(function(){x(!1,!0),C.apply(void 0,arguments),m.current=!1},S=>{if(x(!1,!0),m.current=!1,!(c!=null&&c()))return Promise.reject(S)}))},y=h=>{if(m.current)return;if(m.current=!0,!d){C();return}let S;if(u){if(S=d(h),g&&!ie(S)){m.current=!1,C(h);return}}else if(d.length)S=d(l),m.current=!1;else if(S=d(),!ie(S)){C();return}p(S)};return s.createElement(a.Button,Object.assign({},a.convertLegacyProps(t),{onClick:y,loading:v,prefixCls:n},r,{ref:f}),o)},ee=b.createContext({}),{Provider:He}=ee,Se=()=>{const{autoFocusButton:e,cancelButtonProps:t,cancelTextLocale:o,isSilent:n,mergedOkCancel:r,rootPrefixCls:l,close:i,onCancel:u,onConfirm:c}=b.useContext(ee);return r?b.createElement(_e,{isSilent:n,actionFn:u,close:function(){i==null||i.apply(void 0,arguments),c==null||c(!1)},autoFocus:e==="cancel",buttonProps:t,prefixCls:`${l}-btn`},o):null},Oe=()=>{const{autoFocusButton:e,close:t,isSilent:o,okButtonProps:n,rootPrefixCls:r,okTextLocale:l,okType:i,onConfirm:u,onOk:c}=b.useContext(ee);return b.createElement(_e,{isSilent:o,type:i||"primary",actionFn:c,close:function(){t==null||t.apply(void 0,arguments),u==null||u(!0)},autoFocus:e==="ok",buttonProps:n,prefixCls:`${r}-btn`},l)};var ze=s.createContext({});function Ne(e,t,o){var n=t;return!n&&o&&(n="".concat(e,"-").concat(o)),n}function Ee(e,t){var o=e["page".concat(t?"Y":"X","Offset")],n="scroll".concat(t?"Top":"Left");if(typeof o!="number"){var r=e.document;o=r.documentElement[n],typeof o!="number"&&(o=r.body[n])}return o}function $t(e){var t=e.getBoundingClientRect(),o={left:t.left,top:t.top},n=e.ownerDocument,r=n.defaultView||n.parentWindow;return o.left+=Ee(r),o.top+=Ee(r,!0),o}const xt=s.memo(function(e){var t=e.children;return t},function(e,t){var o=t.shouldUpdate;return!o});var St={width:0,height:0,overflow:"hidden",outline:"none"},Ot={outline:"none"},ve=b.forwardRef(function(e,t){var o=e.prefixCls,n=e.className,r=e.style,l=e.title,i=e.ariaId,u=e.footer,c=e.closable,g=e.closeIcon,d=e.onClose,m=e.children,f=e.bodyStyle,v=e.bodyProps,x=e.modalRender,C=e.onMouseDown,p=e.onMouseUp,y=e.holderRef,h=e.visible,S=e.forceRender,N=e.width,E=e.height,O=e.classNames,$=e.styles,P=b.useContext(ze),j=P.panel,H=a.useComposeRef(y,j),B=b.useRef(),_=b.useRef();b.useImperativeHandle(t,function(){return{focus:function(){var R;(R=B.current)===null||R===void 0||R.focus({preventScroll:!0})},changeActive:function(R){var Y=document,G=Y.activeElement;R&&G===_.current?B.current.focus({preventScroll:!0}):!R&&G===B.current&&_.current.focus({preventScroll:!0})}}});var V={};N!==void 0&&(V.width=N),E!==void 0&&(V.height=E);var A=u?b.createElement("div",{className:a.classNames("".concat(o,"-footer"),O==null?void 0:O.footer),style:a._objectSpread2({},$==null?void 0:$.footer)},u):null,z=l?b.createElement("div",{className:a.classNames("".concat(o,"-header"),O==null?void 0:O.header),style:a._objectSpread2({},$==null?void 0:$.header)},b.createElement("div",{className:"".concat(o,"-title"),id:i},l)):null,W=b.useMemo(function(){return a._typeof(c)==="object"&&c!==null?c:c?{closeIcon:g??b.createElement("span",{className:"".concat(o,"-close-x")})}:{}},[c,g,o]),L=a.pickAttrs(W,!0),I=a._typeof(c)==="object"&&c.disabled,X=c?b.createElement("button",a._extends({type:"button",onClick:d,"aria-label":"Close"},L,{className:"".concat(o,"-close"),disabled:I}),W.closeIcon):null,M=b.createElement("div",{className:a.classNames("".concat(o,"-content"),O==null?void 0:O.content),style:$==null?void 0:$.content},X,z,b.createElement("div",a._extends({className:a.classNames("".concat(o,"-body"),O==null?void 0:O.body),style:a._objectSpread2(a._objectSpread2({},f),$==null?void 0:$.body)},v),m),A);return b.createElement("div",{key:"dialog-element",role:"dialog","aria-labelledby":l?i:null,"aria-modal":"true",ref:H,style:a._objectSpread2(a._objectSpread2({},r),V),className:a.classNames(o,n),onMouseDown:C,onMouseUp:p},b.createElement("div",{ref:B,tabIndex:0,style:Ot},b.createElement(xt,{shouldUpdate:h||S},x?x(M):M)),b.createElement("div",{tabIndex:0,ref:_,style:St}))});process.env.NODE_ENV!=="production"&&(ve.displayName="Panel");var Ae=s.forwardRef(function(e,t){var o=e.prefixCls,n=e.title,r=e.style,l=e.className,i=e.visible,u=e.forceRender,c=e.destroyOnClose,g=e.motionName,d=e.ariaId,m=e.onVisibleChanged,f=e.mousePosition,v=b.useRef(),x=s.useState(),C=a._slicedToArray(x,2),p=C[0],y=C[1],h={};p&&(h.transformOrigin=p);function S(){var N=$t(v.current);y(f&&(f.x||f.y)?"".concat(f.x-N.left,"px ").concat(f.y-N.top,"px"):"")}return s.createElement(a.CSSMotion,{visible:i,onVisibleChanged:m,onAppearPrepare:S,onEnterPrepare:S,forceRender:u,motionName:g,removeOnLeave:c,ref:v},function(N,E){var O=N.className,$=N.style;return s.createElement(ve,a._extends({},e,{ref:t,title:n,ariaId:d,prefixCls:o,holderRef:E,style:a._objectSpread2(a._objectSpread2(a._objectSpread2({},$),r),h),className:a.classNames(l,O)}))})});Ae.displayName="Content";var Nt=function(t){var o=t.prefixCls,n=t.style,r=t.visible,l=t.maskProps,i=t.motionName,u=t.className;return s.createElement(a.CSSMotion,{key:"mask",visible:r,motionName:i,leavedClassName:"".concat(o,"-mask-hidden")},function(c,g){var d=c.className,m=c.style;return s.createElement("div",a._extends({ref:g,style:a._objectSpread2(a._objectSpread2({},m),n),className:a.classNames("".concat(o,"-mask"),d,u)},l))})},Et=function(t){var o=t.prefixCls,n=o===void 0?"rc-dialog":o,r=t.zIndex,l=t.visible,i=l===void 0?!1:l,u=t.keyboard,c=u===void 0?!0:u,g=t.focusTriggerAfterClose,d=g===void 0?!0:g,m=t.wrapStyle,f=t.wrapClassName,v=t.wrapProps,x=t.onClose,C=t.afterOpenChange,p=t.afterClose,y=t.transitionName,h=t.animation,S=t.closable,N=S===void 0?!0:S,E=t.mask,O=E===void 0?!0:E,$=t.maskTransitionName,P=t.maskAnimation,j=t.maskClosable,H=j===void 0?!0:j,B=t.maskStyle,_=t.maskProps,V=t.rootClassName,A=t.classNames,z=t.styles;process.env.NODE_ENV!=="production"&&(["wrapStyle","bodyStyle","maskStyle"].forEach(function(w){a.warning(!(w in t),"".concat(w," is deprecated, please use styles instead."))}),"wrapClassName"in t&&a.warning(!1,"wrapClassName is deprecated, please use classNames instead."));var W=b.useRef(),L=b.useRef(),I=b.useRef(),X=s.useState(i),M=a._slicedToArray(X,2),q=M[0],R=M[1],Y=a.useId();function G(){a.contains(L.current,document.activeElement)||(W.current=document.activeElement)}function le(){if(!a.contains(L.current,document.activeElement)){var w;(w=I.current)===null||w===void 0||w.focus()}}function k(w){if(w)le();else{if(R(!1),O&&W.current&&d){try{W.current.focus({preventScroll:!0})}catch{}W.current=null}q&&(p==null||p())}C==null||C(w)}function T(w){x==null||x(w)}var D=b.useRef(!1),J=b.useRef(),ot=function(){clearTimeout(J.current),D.current=!0},at=function(){J.current=setTimeout(function(){D.current=!1})},ye=null;H&&(ye=function(se){D.current?D.current=!1:L.current===se.target&&T(se)});function rt(w){if(c&&w.keyCode===a.KeyCode.ESC){w.stopPropagation(),T(w);return}i&&w.keyCode===a.KeyCode.TAB&&I.current.changeActive(!w.shiftKey)}b.useEffect(function(){i&&(R(!0),G())},[i]),b.useEffect(function(){return function(){clearTimeout(J.current)}},[]);var lt=a._objectSpread2(a._objectSpread2(a._objectSpread2({zIndex:r},m),z==null?void 0:z.wrapper),{},{display:q?null:"none"});return s.createElement("div",a._extends({className:a.classNames("".concat(n,"-root"),V)},a.pickAttrs(t,{data:!0})),s.createElement(Nt,{prefixCls:n,visible:O&&i,motionName:Ne(n,$,P),style:a._objectSpread2(a._objectSpread2({zIndex:r},B),z==null?void 0:z.mask),maskProps:_,className:A==null?void 0:A.mask}),s.createElement("div",a._extends({tabIndex:-1,onKeyDown:rt,className:a.classNames("".concat(n,"-wrap"),f,A==null?void 0:A.wrapper),ref:L,onClick:ye,style:lt},v),s.createElement(Ae,a._extends({},t,{onMouseDown:ot,onMouseUp:at,ref:I,closable:N,ariaId:Y,prefixCls:n,visible:i&&q,onClose:T,onVisibleChanged:k,motionName:Ne(n,y,h)}))))},Le=function(t){var o=t.visible,n=t.getContainer,r=t.forceRender,l=t.destroyOnClose,i=l===void 0?!1:l,u=t.afterClose,c=t.panelRef,g=s.useState(o),d=a._slicedToArray(g,2),m=d[0],f=d[1],v=s.useMemo(function(){return{panel:c}},[c]);return s.useEffect(function(){o&&f(!0)},[o]),!r&&i&&!m?null:s.createElement(ze.Provider,{value:v},s.createElement(a.Portal,{open:o||r||m,autoDestroy:!1,getContainer:n,autoLock:o||m},s.createElement(Et,a._extends({},t,{destroyOnClose:i,afterClose:function(){u==null||u(),f(!1)}}))))};Le.displayName="Dialog";const wt=()=>a.canUseDom()&&window.document.documentElement,ae=e=>{const{prefixCls:t,className:o,style:n,size:r,shape:l}=e,i=a.classNames({[`${t}-lg`]:r==="large",[`${t}-sm`]:r==="small"}),u=a.classNames({[`${t}-circle`]:l==="circle",[`${t}-square`]:l==="square",[`${t}-round`]:l==="round"}),c=s.useMemo(()=>typeof r=="number"?{width:r,height:r,lineHeight:`${r}px`}:{},[r]);return s.createElement("span",{className:a.classNames(t,i,u,o),style:Object.assign(Object.assign({},c),n)})},jt=new a.Keyframe("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),re=e=>({height:e,lineHeight:a.unit(e)}),Q=e=>Object.assign({width:e},re(e)),Pt=e=>({background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:jt,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),ce=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},re(e)),It=e=>{const{skeletonAvatarCls:t,gradientFromColor:o,controlHeight:n,controlHeightLG:r,controlHeightSM:l}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:o},Q(n)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},Q(r)),[`${t}${t}-sm`]:Object.assign({},Q(l))}},Tt=e=>{const{controlHeight:t,borderRadiusSM:o,skeletonInputCls:n,controlHeightLG:r,controlHeightSM:l,gradientFromColor:i,calc:u}=e;return{[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:o},ce(t,u)),[`${n}-lg`]:Object.assign({},ce(r,u)),[`${n}-sm`]:Object.assign({},ce(l,u))}},we=e=>Object.assign({width:e},re(e)),Mt=e=>{const{skeletonImageCls:t,imageSizeBase:o,gradientFromColor:n,borderRadiusSM:r,calc:l}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:n,borderRadius:r},we(l(o).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},we(o)),{maxWidth:l(o).mul(4).equal(),maxHeight:l(o).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}},de=(e,t,o)=>{const{skeletonButtonCls:n}=e;return{[`${o}${n}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${o}${n}-round`]:{borderRadius:t}}},ue=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},re(e)),Rt=e=>{const{borderRadiusSM:t,skeletonButtonCls:o,controlHeight:n,controlHeightLG:r,controlHeightSM:l,gradientFromColor:i,calc:u}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[o]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:t,width:u(n).mul(2).equal(),minWidth:u(n).mul(2).equal()},ue(n,u))},de(e,n,o)),{[`${o}-lg`]:Object.assign({},ue(r,u))}),de(e,r,`${o}-lg`)),{[`${o}-sm`]:Object.assign({},ue(l,u))}),de(e,l,`${o}-sm`))},Bt=e=>{const{componentCls:t,skeletonAvatarCls:o,skeletonTitleCls:n,skeletonParagraphCls:r,skeletonButtonCls:l,skeletonInputCls:i,skeletonImageCls:u,controlHeight:c,controlHeightLG:g,controlHeightSM:d,gradientFromColor:m,padding:f,marginSM:v,borderRadius:x,titleHeight:C,blockRadius:p,paragraphLiHeight:y,controlHeightXS:h,paragraphMarginTop:S}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:f,verticalAlign:"top",[o]:Object.assign({display:"inline-block",verticalAlign:"top",background:m},Q(c)),[`${o}-circle`]:{borderRadius:"50%"},[`${o}-lg`]:Object.assign({},Q(g)),[`${o}-sm`]:Object.assign({},Q(d))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[n]:{width:"100%",height:C,background:m,borderRadius:p,[`+ ${r}`]:{marginBlockStart:d}},[r]:{padding:0,"> li":{width:"100%",height:y,listStyle:"none",background:m,borderRadius:p,"+ li":{marginBlockStart:h}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${n}, ${r} > li`]:{borderRadius:x}}},[`${t}-with-avatar ${t}-content`]:{[n]:{marginBlockStart:v,[`+ ${r}`]:{marginBlockStart:S}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},Rt(e)),It(e)),Tt(e)),Mt(e)),[`${t}${t}-block`]:{width:"100%",[l]:{width:"100%"},[i]:{width:"100%"}},[`${t}${t}-active`]:{[`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-CasEGtND.js");exports.YsytGetCustomerInfo=e.getCustomerInfo;exports.YsytMakeCall=e.makeCall;exports.YsytSetAgentDevice=e.setAgentDevice;exports.YsytSetAgentInitState=e.setAgentInitState;exports.default=e.YsytBarPhone;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ysyt-react-agent-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.74",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/ysyt-react-agent-lib.cjs.js",
|
|
6
6
|
"module": "dist/ysyt-react-agent-lib.es.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"antd": "5.24.0",
|
|
31
31
|
"styled-components": "^6.1.13",
|
|
32
|
-
"ysyt-agent-sdk": "1.0.
|
|
32
|
+
"ysyt-agent-sdk": "1.0.125"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.2.0",
|