call-control-sdk 5.2.6 → 5.3.3
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/README.md +1077 -116
- package/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var cs=Object.defineProperty,ps=Object.defineProperties;var ds=Object.getOwnPropertyDescriptors;var Mo=Object.getOwnPropertySymbols;var us=Object.prototype.hasOwnProperty,gs=Object.prototype.propertyIsEnumerable;var st=(e,t,s)=>t in e?cs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,r=(e,t)=>{for(var s in t||(t={}))us.call(t,s)&&st(e,s,t[s]);if(Mo)for(var s of Mo(t))gs.call(t,s)&&st(e,s,t[s]);return e},X=(e,t)=>ps(e,ds(t));var te=(e,t,s)=>st(e,typeof t!="symbol"?t+"":t,s);var at=class{constructor(){te(this,"config",null);te(this,"ticketId",null);te(this,"baseUrl","");te(this,"eventQueue",[]);te(this,"isOnline",!0);te(this,"retryQueue",[]);te(this,"flushTimer",null)}async init(t){this.config=r({autoTrack:!0,retryAttempts:3,queueSize:100,flushInterval:5e3},t),this.baseUrl=t.baseUrl||(typeof window!="undefined"?window.location.origin:""),this.setupNetworkDetection();let s=await this.createTicket();return this.startPeriodicFlush(),console.log("EventTracker SDK initialized successfully"),s}isInitialized(){return this.config!==null&&this.ticketId!==null}getConfig(){return this.config}getTicketId(){return this.ticketId}async createTicket(){if(!this.config)throw new Error("EventTracker not initialized");try{let t=await this.makeRequest("/api/v1/et/init",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({agentId:this.config.agentId,sessionId:this.config.sessionId})});if(!t.ok)throw new Error(`Failed to initialize: ${t.status} ${t.statusText}`);let s=await t.json();return this.ticketId=s.ticketId,this.config.autoTrack&&this.setupAutoTracking(),this.ticketId}catch(t){throw console.error("EventTracker initialization failed:",t),t}}async logEvent(t,s){if(!this.config||!this.ticketId){console.warn("EventTracker not initialized, skipping event:",t);return}let i={eventType:t,eventData:s,timestamp:Date.now()};if(this.eventQueue.push(i),this.eventQueue.length>(this.config.queueSize||100)&&this.eventQueue.shift(),this.isOnline)try{await this.sendEvent(i)}catch(l){console.warn("Failed to send event, will retry later:",l)}}async sendEvent(t){if(!(!this.config||!this.ticketId))try{let s=await this.makeRequest("/api/v1/et/event",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId,eventType:t.eventType,eventData:t.eventData})});if(!s.ok)throw new Error(`Failed to log event: ${s.status} ${s.statusText}`);let i=this.eventQueue.findIndex(l=>l.timestamp===t.timestamp);i>-1&&this.eventQueue.splice(i,1)}catch(s){console.error("Event logging failed:",s),this.retryQueue.push(()=>this.sendEvent(t))}}async closeTicket(){if(!this.config||!this.ticketId)throw new Error("EventTracker not initialized");await this.flush();try{let t=await this.makeRequest("/api/v1/et/close",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId})});if(!t.ok)throw new Error(`Failed to close ticket: ${t.status} ${t.statusText}`);this.ticketId=null,this.stopPeriodicFlush(),console.log("Ticket closed successfully")}catch(t){throw console.error("Ticket close failed:",t),t}}async flush(){if(!this.isOnline||this.eventQueue.length===0)return;let t=[...this.eventQueue];for(let i of t)await this.sendEvent(i);let s=[...this.retryQueue];this.retryQueue=[];for(let i of s)try{await i()}catch(l){console.error("Retry failed:",l)}}async makeRequest(t,s){var o;let i=`${this.baseUrl}${t}`,l=((o=this.config)==null?void 0:o.retryAttempts)||3;for(let d=1;d<=l;d++)try{return await fetch(i,s)}catch(g){if(d===l)throw g;let h=Math.min(1e3*Math.pow(2,d-1),1e4);await new Promise(u=>setTimeout(u,h))}throw new Error("Max retries exceeded")}setupAutoTracking(){var i;if(typeof window=="undefined"||!((i=this.config)!=null&&i.autoTrack))return;let t=this.config.autoTrack===!0?{}:this.config.autoTrack;if(t.pageVisits!==!1&&this.logEvent("pageVisit",{url:window.location.href,title:document.title,referrer:document.referrer,userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()}).catch(l=>console.warn("Failed to track page visit:",l)),t.clicks!==!1&&document.addEventListener("click",l=>{var d;let o=l.target;(o.tagName==="BUTTON"||o.tagName==="A"||o.onclick||o.getAttribute("role")==="button"||o instanceof HTMLButtonElement&&o.type==="button")&&this.logEvent("click",{element:o.tagName,text:(d=o.textContent)==null?void 0:d.trim().substring(0,100),href:o.getAttribute("href"),id:o.id,className:o.className,role:o.getAttribute("role"),position:{x:l.clientX,y:l.clientY},timestamp:new Date().toISOString()}).catch(g=>console.warn("Failed to track click:",g))}),t.forms!==!1&&document.addEventListener("submit",l=>{let o=l.target,d=new FormData(o),g={};d.forEach((h,u)=>{g[u]=h.toString()}),this.logEvent("formSubmission",{formId:o.id,action:o.action,method:o.method,fields:Object.keys(g),fieldCount:Object.keys(g).length,timestamp:new Date().toISOString()}).catch(h=>console.warn("Failed to track form submission:",h))}),t.inputs!==!1){let l;document.addEventListener("input",o=>{let d=o.target;(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.tagName==="SELECT")&&(clearTimeout(l),l=setTimeout(()=>{var g;this.logEvent("fieldChange",{element:d.tagName,type:d.getAttribute("type"),name:d.getAttribute("name"),id:d.id,valueLength:((g=d.value)==null?void 0:g.length)||0,timestamp:new Date().toISOString()}).catch(h=>console.warn("Failed to track field change:",h))},1e3))})}let s=Date.now();window.addEventListener("beforeunload",()=>{let l=Date.now()-s;this.logEvent("pageUnload",{url:window.location.href,sessionDuration:l,timestamp:new Date().toISOString()}),this.ticketId&&navigator.sendBeacon(`${this.baseUrl}/api/v1/et/close`,JSON.stringify({ticketId:this.ticketId}))}),t.visibility!==!1&&document.addEventListener("visibilitychange",()=>{this.logEvent("visibilityChange",{hidden:document.hidden,visibilityState:document.visibilityState,timestamp:new Date().toISOString()})}),t.errors!==!1&&(window.addEventListener("error",l=>{this.logEvent("jsError",{message:l.message,filename:l.filename,lineno:l.lineno,colno:l.colno,timestamp:new Date().toISOString()})}),window.addEventListener("unhandledrejection",l=>{var o;this.logEvent("unhandledRejection",{reason:(o=l.reason)==null?void 0:o.toString(),timestamp:new Date().toISOString()})})),t.performance!==!1&&typeof window.performance!="undefined"&&window.performance.navigation&&window.addEventListener("load",()=>{setTimeout(()=>{let l=window.performance.navigation,o=window.performance.timing;this.logEvent("performanceMetrics",{navigationTime:o.navigationStart,loadTime:o.loadEventEnd-o.navigationStart,domReady:o.domContentLoadedEventEnd-o.navigationStart,renderTime:o.loadEventEnd-o.domContentLoadedEventEnd,navigationType:l.type,redirectCount:l.redirectCount,timestamp:new Date().toISOString()})},1e3)})}setupNetworkDetection(){typeof window!="undefined"&&(this.isOnline=navigator.onLine,window.addEventListener("online",()=>{this.isOnline=!0,console.log("EventTracker: Back online, flushing queued events"),this.flush()}),window.addEventListener("offline",()=>{this.isOnline=!1,console.log("EventTracker: Offline, queueing events")}))}startPeriodicFlush(){var s;this.flushTimer&&clearInterval(this.flushTimer);let t=((s=this.config)==null?void 0:s.flushInterval)||5e3;this.flushTimer=setInterval(()=>{this.flush()},t)}stopPeriodicFlush(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}},nt=new at;typeof window!="undefined"&&(window.EventTracker=nt);var it=class{constructor(){te(this,"state");te(this,"listeners",[]);te(this,"STORAGE_KEY","call-control-sdk-state");this.state=this.getInitialState(),this.loadFromStorage()}getInitialState(){return{apiKey:null,process:null,agentId:"",isInitialized:!1,isHolding:!1,isMuted:!1,status:"idle",callStartTime:null,controlPanelPosition:{x:10,y:10},iframePosition:{x:10,y:80},callData:{agent_id:"",status:"",type:"",event_time:"",phone_number:""},conferenceLine:[{line:1,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:2,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:3,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:4,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:5,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1}]}}loadFromStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);if(t){let s=JSON.parse(t);this.state=X(r({},this.state),{apiKey:s.apiKey||"",agentId:s.agentId||"",process:s.process||null,isInitialized:s.isInitialized||!1,isHolding:s.isHolding||!1,isMuted:s.isMuted||!1,status:s.status||"idle",callStartTime:s.callStartTime||null,controlPanelPosition:s.controlPanelPosition||{x:10,y:10},iframePosition:s.iframePosition||{x:10,y:80},callData:s.callData||{mobileNumber:"",callReferenceId:"",agentLoginId:""},conferenceLine:s.conferenceLine&&Array.isArray(s.conferenceLine)&&s.conferenceLine.length>0?s.conferenceLine:this.state.conferenceLine})}}catch(t){console.warn("Failed to load SDK state from localStorage:",t)}}saveToStorage(){try{let t={apiKey:this.state.apiKey,agentId:this.state.agentId,process:this.state.process,isInitialized:this.state.isInitialized,isHolding:this.state.isHolding,isMuted:this.state.isMuted,status:this.state.status,callStartTime:this.state.callStartTime,controlPanelPosition:this.state.controlPanelPosition,iframePosition:this.state.iframePosition,callData:this.state.callData,conferenceLine:this.state.conferenceLine};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(t){console.warn("Failed to save SDK state to localStorage:",t)}}notifyListeners(){this.listeners.forEach(t=>t())}initialize(t,s){if(!t||typeof t!="string"||t.trim().length===0)throw new Error("API key not available");this.state.apiKey=t,this.state.agentId=s,this.state.isInitialized=!0,this.saveToStorage(),this.notifyListeners()}getState(){return r({},this.state)}subscribe(t){return this.listeners.push(t),()=>{let s=this.listeners.indexOf(t);s>-1&&this.listeners.splice(s,1)}}setHolding(t){this.state.isHolding=t,this.saveToStorage(),this.notifyListeners()}setMuted(t){this.state.isMuted=t,this.saveToStorage(),this.notifyListeners()}setStatus(t){this.state.status=t,this.saveToStorage(),this.notifyListeners()}setProcess(t){this.state.process=t,this.saveToStorage(),this.notifyListeners()}setControlPanelPosition(t){this.state.controlPanelPosition=t,this.saveToStorage(),this.notifyListeners()}setIframePosition(t){this.state.iframePosition=t,this.saveToStorage(),this.notifyListeners()}startCall(){this.state.callStartTime=Date.now(),this.state.status="on call",this.saveToStorage(),this.notifyListeners()}endCall(){this.state.callStartTime=null,this.state.status="idle",this.state.isHolding=!1,this.state.isMuted=!1,this.saveToStorage(),this.notifyListeners()}updateCallData(t){this.state.callData=r(r({},this.state.callData),t),this.saveToStorage(),this.notifyListeners()}setConferenceLine(t){var i;(!this.state.conferenceLine||!Array.isArray(this.state.conferenceLine))&&(console.warn("Conference line data corrupted, resetting to initial state"),this.state.conferenceLine=this.getInitialState().conferenceLine);let s=(i=this.state.conferenceLine)==null?void 0:i.map(l=>l.line===t.line?t:l);this.state.conferenceLine=s,this.saveToStorage(),this.notifyListeners()}resetConferenceLines(){this.state.conferenceLine=this.getInitialState().conferenceLine,this.saveToStorage(),this.notifyListeners()}clearStorageAndReset(){try{localStorage.removeItem(this.STORAGE_KEY),this.state=this.getInitialState(),this.notifyListeners()}catch(t){console.warn("Failed to clear localStorage:",t)}}debugStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);console.log("Current localStorage data:",t),t&&console.log("Parsed localStorage data:",JSON.parse(t)),console.log("Current state:",this.state)}catch(t){console.error("Error debugging storage:",t)}}getConferenceLines(){return this.state.conferenceLine||[]}},E=new it;import{useCallback as ys,useState as _e}from"react";var P="http://192.168.101.177:8095",fs="ws://192.168.101.177:8095",q={v1:"/api/v1"},O={LOGIN:`${P}${q.v1}/cti/login?provider=convox`,READY_AGENT:`${P}${q.v1}/cti/ready-agent?provider=convox`,UPDATE_AGENT_BREAK:`${P}${q.v1}/cti/update-agent-status?provider=convox`,CLICK_TO_CALL:`${P}${q.v1}/cti/calls?provider=convox`,HOLD_CALL:`${P}${q.v1}/cti/calls/hold?provider=convox`,MUTE_CALL:`${P}${q.v1}/cti/calls/mute?provider=convox`,UNMUTE_CALL:`${P}${q.v1}/cti/unmute-call?provider=convox`,END_CALL:`${P}${q.v1}/cti/calls/end?provider=convox`,LOGOUT:`${P}${q.v1}/cti/logout?provider=convox`,CONFERENCE_CALL:`${P}${q.v1}/cti/calls/conference?provider=convox`,CONFERENCE_CALL_HOLD_OR_UN_HOLD:`${P}${q.v1}/cti/calls/conference/hold?provider=convox`,CONFERENCE_CALL_MUTE_OT_UN_MUTE:`${P}${q.v1}/cti/calls/conference/mute?provider=convox`,CONFERENCE_CALL_END:`${P}${q.v1}/cti/calls/conference/hangup?provider=convox`,CONFERENCE_CALL_END_ALL:`${P}${q.v1}/cti/calls/conference/hangup/all?provider=convox`,TRANSFER_CALL:`${P}${q.v1}/cti/calls/transfer?provider=convox`,AGENTS_LIST:`${P}${q.v1}/cti/users`,PROCESS_LIST:`${P}${q.v1}/cti/processes-list`,TRANSFER_TO_DETAILS:`${P}${q.v1}/cti/transfer-to-details?provider=convox`,CALL_HISTORY:`${P}${q.v1}/dashboard/call-history`,SENTIMENTAL_ANALYSIS:`${P}${q.v1}/users/get_sentiment_analysis`},Uo={WS:`${fs}${q.v1}/cti/ws`};import ms from"axios";var xs="12345",lt=ms.create({baseURL:P,headers:{"Content-Type":"application/json",Authorization:xs},timeout:1e4});lt.interceptors.request.use(e=>{let t="12345";return t&&e.headers&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e instanceof Error?e:new Error(String(e))));lt.interceptors.response.use(e=>e,async e=>{var s;let t=e.config;return((s=e.response)==null?void 0:s.status)===401&&!t._retry&&(t._retry=!0),Promise.reject(e instanceof Error?e:new Error(String(e)))});var Z=lt;var hs=()=>{let[e,t]=_e(!1),[s,i]=_e(!1),[l,o]=_e(!1),[d,g]=_e(null),[h,u]=_e(null);return{logout:ys(async()=>{var y;let f=JSON.parse((y=localStorage.getItem("call-control-sdk-state"))!=null?y:"");t(!0);let p={action:"LOGOUTUSER",userId:f.agentId||""};return Z.post(O.LOGOUT,p).then(m=>(E.clearStorageAndReset(),localStorage.clear(),sessionStorage.clear(),u(m==null?void 0:m.data),i(!0),m==null?void 0:m.data)).catch(m=>{var L;return o(!0),g(m),(L=m==null?void 0:m.response)==null?void 0:L.data}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:s,isError:l,error:d,data:h}},Cs=hs;import{useCallback as bs,useState as we}from"react";var vs=()=>{let[e,t]=we(!1),[s,i]=we(!1),[l,o]=we(!1),[d,g]=we(null),[h,u]=we(null);return{handleEndCall:bs(async f=>{var m,L,H,M,A,w,z,V,Y,Q,b,C,I,_,N;let p=JSON.parse((m=localStorage.getItem("call-control-sdk-state"))!=null?m:"");t(!0);let y={action:"ENDCALL",userId:p==null?void 0:p.agentId,processid:(M=(H=(L=p==null?void 0:p.process)==null?void 0:L.process_id)==null?void 0:H.toString())!=null?M:"",process_name:(w=(A=p==null?void 0:p.process)==null?void 0:A.process_name)!=null?w:"",callreferenceid:(V=(z=p==null?void 0:p.callData)==null?void 0:z.convox_id)!=null?V:"",mobile_number:(Q=(Y=p==null?void 0:p.callData)==null?void 0:Y.phone_number)!=null?Q:"",disposition:(b=f==null?void 0:f.disposition)!=null?b:"RES",set_followUp:(C=f==null?void 0:f.followUp)!=null?C:"N",callback_date:(I=f==null?void 0:f.callbackDate)!=null?I:"",callback_hrs:(_=f==null?void 0:f.callbackHrs)!=null?_:"",callback_mins:(N=f==null?void 0:f.callbackMins)!=null?N:"",endcall_type:"CLOSE"};return Z.post(O.END_CALL,y).then(v=>(E.endCall(),u(v==null?void 0:v.data),i(!0),v==null?void 0:v.data)).catch(v=>{var k;return o(!0),g(v),(k=v==null?void 0:v.response)==null?void 0:k.data}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:s,isError:l,error:d,data:h}};import{ArrowDropDown as js,CallEnd as Ys,Close as Xs,DragIndicator as Vo,Group as Js,Layers as Vs,Mic as Qs,MicOff as Zs,Pause as ea,Pending as ta,Phone as oa,PlayArrow as sa,SupportAgent as aa,TransferWithinAStation as na,Upcoming as ia,WifiCalling3 as la}from"@mui/icons-material";import{Box as re,Button as Te,Chip as dt,CircularProgress as Pe,Fade as Qo,IconButton as tt,Menu as ut,MenuItem as Zo,Paper as es,TextField as ra,Tooltip as me,Typography as ts,useTheme as ca}from"@mui/material";import{useCallback as pa,useEffect as ot,useRef as da,useState as ne}from"react";import{useCallback as Je,useRef as rt,useState as Bo}from"react";function ct(e,t){let[s,i]=Bo(e),[l,o]=Bo(!1),d=rt(),g=rt({x:0,y:0}),h=rt({x:0,y:0}),u=Je(y=>{let m=d.current;if(!m)return;let L=m.getBoundingClientRect(),H=window.innerWidth,M=window.innerHeight,A={x:Math.max(0,Math.min(y.x,H-L.width)),y:Math.max(0,Math.min(y.y,M-L.height))};i(A),t==null||t(A)},[t]),x=Je((y,m)=>{o(!0),g.current={x:y,y:m},h.current=s;let L=(w,z)=>{let V=w-g.current.x,Y=z-g.current.y;u({x:h.current.x+V,y:h.current.y+Y})},H=w=>{w.preventDefault(),L(w.clientX,w.clientY)},M=w=>{w.preventDefault();let z=w.touches[0];z&&L(z.clientX,z.clientY)},A=()=>{o(!1),document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",A),document.removeEventListener("touchmove",M),document.removeEventListener("touchend",A)};document.addEventListener("mousemove",H),document.addEventListener("mouseup",A),document.addEventListener("touchmove",M,{passive:!1}),document.addEventListener("touchend",A)},[s,u]),f=Je(y=>{y.preventDefault(),x(y.clientX,y.clientY)},[x]),p=Je(y=>{y.preventDefault();let m=y.touches[0];m&&x(m.clientX,m.clientY)},[x]);return{position:s,isDragging:l,dragRef:d,handleMouseDown:f,handleTouchStart:p}}import{useState as Ts,useEffect as Ss}from"react";function xe(){let[e,t]=Ts(E.getState());return Ss(()=>E.subscribe(()=>{t(E.getState())}),[]),e}import{useCallback as _s,useReducer as ws}from"react";import{createContext as Es,useContext as Ls,useState as pt}from"react";import{Snackbar as Ds,Alert as Is}from"@mui/material";import{jsx as Ho,jsxs as Rs}from"react/jsx-runtime";var $o=Es(void 0),ke=()=>{let e=Ls($o);if(!e)throw new Error("useToast must be used inside ToastProvider");return e},zo=({children:e})=>{let[t,s]=pt(!1),[i,l]=pt(""),[o,d]=pt("info"),g=(h,u="info")=>{l(h),d(u),s(!0)};return Rs($o.Provider,{value:{showToast:g},children:[e,Ho(Ds,{open:t,color:o,autoHideDuration:3e3,onClose:()=>s(!1),anchorOrigin:{vertical:"top",horizontal:"right"},children:Ho(Is,{variant:"filled",severity:o,onClose:()=>s(!1),sx:{width:"100%"},children:i})})]})};var ks={isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null},As=(e,t)=>{if(t.type==="isLoading")return X(r({},e),{isLoading:t.payload});if(t.type==="isSuccess")return X(r({},e),{isSuccess:!0,data:t.payload});if(t.type==="isError")return X(r({},e),{isError:!0,error:t.payload});if(t.type==="reset")return{isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null};throw Error("Unknown action.")};var oe=(e={})=>{let{onSuccess:t=null,onError:s=null}=e,{showToast:i}=ke(),[l,o]=ws(As,ks);return[_s((g,h,u={})=>{o({type:"isLoading",payload:!0}),Z.post(g,h,u).then(x=>{var f,p;o({type:"isSuccess",payload:x.data}),t==null||t(x.data,h),console.log((f=x.data)==null?void 0:f.message,"res45"),i((p=x.data)==null?void 0:p.message,"success")}).catch(x=>{var p,y,m,L,H,M,A,w,z,V,Y,Q;let f={status:(y=(p=x.response)==null?void 0:p.status)!=null?y:500,message:((L=(m=x.response)==null?void 0:m.data)==null?void 0:L.detail)||((M=(H=x.response)==null?void 0:H.data)==null?void 0:M.message)||x.message||"An unknown error occurred",data:(w=(A=x.response)==null?void 0:A.data)!=null?w:null,statusText:(V=(z=x.response)==null?void 0:z.statusText)!=null?V:"",code:(Y=x==null?void 0:x.code)!=null?Y:"",name:(Q=x==null?void 0:x.name)!=null?Q:""};i(f.message,"error"),o({type:"isError",payload:f}),s==null||s(f,h)}).finally(()=>{o({type:"isLoading",payload:!1})})},[t,s,i]),l]};import{Call as Qe,CallEnd as qo,CallSplit as Os,Close as et,Mic as Ms,MicOff as Us,Pause as Bs,PhoneDisabled as Hs,PlayArrow as $s,SupportAgent as Ze}from"@mui/icons-material";import{Box as W,Button as ee,Dialog as Ne,IconButton as ge,Paper as be,TextField as he,Typography as J,Autocomplete as Wo,Grid as ye,Tooltip as Ae,useTheme as zs,TableContainer as qs,Table as Ws,TableHead as Fs,TableRow as Fo,TableCell as le,TableBody as Gs,CircularProgress as Ce}from"@mui/material";import{useEffect as Go,useState as ue}from"react";import{useTheme as Ns}from"@mui/material";var Ps=()=>{let e=Ns();return{disabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",border:"1px solid rgb(206, 204, 204)",height:"40px","&:hover":{boxShadow:" 0px 2px 2px rgba(0, 0, 0, 0.79)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},enabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},outlined:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",backgroundColor:e.palette.grey[200],boxShadow:`0px 2px 1px ${e.palette.primary.light}`,border:`0px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:`0px 2px 1px ${e.palette.primary.main}`,border:`0px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}}}},Ve=Ps;import{Fragment as ve,jsx as a,jsxs as D}from"react/jsx-runtime";var Ks=({each:e})=>{var Q,b;let t=xe(),{showToast:s}=ke(),{disabled:i,enabled:l,outlined:o}=Ve(),d=zs(),[g,h]=ue(!1),[u,x]=ue(!1),[f,p]=ue(!1),[y,m]=ue(!1),[L,H]=ue(!1),M=(C,I)=>{E.setConferenceLine(r(r({},C),I))},A=(C,I)=>{var v,k,$,U;let _=r(r({},C),I);h(!0);let N={action:"EXTERNAL_CONFERENCE",operation:`CALL${_.line}`,line_used:String(_.line),thirdparty_no:_.phone,userid:(k=(v=t.callData)==null?void 0:v.agent_id)!=null?k:"",process:(U=($=t.callData)==null?void 0:$.process_name)!=null?U:""};Z.post(O.CONFERENCE_CALL,N).then(R=>{var S;s((S=R.data)==null?void 0:S.message,"success"),E.setConferenceLine(r(r({},C),I))}).catch(R=>{var B,F,G,K;let S=((F=(B=R.response)==null?void 0:B.data)==null?void 0:F.detail)||((K=(G=R.response)==null?void 0:G.data)==null?void 0:K.message)||R.message||"An unknown error occurred";s(S,"error")}).finally(()=>{h(!1)})},w=(C,I)=>{var v,k,$,U;let _=r(r({},C),I);x(!0);let N={action:"EXTERNAL_CONFERENCE",operation:"CONFERENCE",line_used:String(_.line),thirdparty_no:_.phone,userid:(k=(v=t.callData)==null?void 0:v.agent_id)!=null?k:"",process:(U=($=t.callData)==null?void 0:$.process_name)!=null?U:""};Z.post(O.CONFERENCE_CALL,N).then(R=>{var S;s((S=R.data)==null?void 0:S.message,"success"),E.setConferenceLine(r(r({},C),I))}).catch(R=>{var B,F,G,K;let S=((F=(B=R.response)==null?void 0:B.data)==null?void 0:F.detail)||((K=(G=R.response)==null?void 0:G.data)==null?void 0:K.message)||R.message||"An unknown error occurred";s(S,"error")}).finally(()=>{x(!1)})},z=(C,I,_)=>{var k,$,U,R;let N=r(r({},C),I);p(!0);let v={action:"EXTERNAL_CONFERENCE",operation:_,hold_channel_no:_==="HOLDUSER"?`hold${N.line}`:`unhold${N.line}`,userid:($=(k=t.callData)==null?void 0:k.agent_id)!=null?$:"",process:(R=(U=t.callData)==null?void 0:U.process_name)!=null?R:""};Z.post(O.CONFERENCE_CALL_HOLD_OR_UN_HOLD,v).then(S=>{var B;s((B=S.data)==null?void 0:B.message,"success"),E.setConferenceLine(r(r({},C),I))}).catch(S=>{var F,G,K,ie;let B=((G=(F=S.response)==null?void 0:F.data)==null?void 0:G.detail)||((ie=(K=S.response)==null?void 0:K.data)==null?void 0:ie.message)||S.message||"An unknown error occurred";s(B,"error")}).finally(()=>{p(!1)})},V=(C,I,_)=>{var k,$,U,R;let N=r(r({},C),I);m(!0);let v={action:"EXTERNAL_CONFERENCE",operation:_,channel_no:_==="MUTEUSER"?`mute${N.line}`:`play${N.line}`,userid:($=(k=t.callData)==null?void 0:k.agent_id)!=null?$:"",thirdparty_no:N.phone,process:(R=(U=t.callData)==null?void 0:U.process_name)!=null?R:""};Z.post(O.CONFERENCE_CALL_MUTE_OT_UN_MUTE,v).then(S=>{var B;s((B=S.data)==null?void 0:B.message,"success"),E.setConferenceLine(r(r({},C),I))}).catch(S=>{var F,G,K,ie;let B=((G=(F=S.response)==null?void 0:F.data)==null?void 0:G.detail)||((ie=(K=S.response)==null?void 0:K.data)==null?void 0:ie.message)||S.message||"An unknown error occurred";s(B,"error")}).finally(()=>{m(!1)})},Y=(C,I)=>{var v,k,$,U;let _=r(r({},C),I);H(!0);let N={action:"EXTERNAL_CONFERENCE",operation:"HANGUP_CHANNEL",line_used:String(_.line-1),user_type:`THIRDPARTY${_.line-1}`,thirdparty_no:_.phone,userid:(k=(v=t.callData)==null?void 0:v.agent_id)!=null?k:"",process:(U=($=t.callData)==null?void 0:$.process_name)!=null?U:""};Z.post(O.CONFERENCE_CALL_END,N).then(R=>{var S;s((S=R.data)==null?void 0:S.message,"success"),E.setConferenceLine(r(r({},C),I))}).catch(R=>{var B,F,G,K;let S=((F=(B=R.response)==null?void 0:B.data)==null?void 0:F.detail)||((K=(G=R.response)==null?void 0:G.data)==null?void 0:K.message)||R.message||"An unknown error occurred";s(S,"error")}).finally(()=>{H(!1)})};return D(Fo,{sx:{border:"2px solid #fff"},children:[a(le,{sx:{padding:"6px"},children:D(J,{children:["Line ",(Q=e==null?void 0:e.line)!=null?Q:"",". "]})}),a(le,{sx:{padding:"6px"},children:a(J,{variant:"body2",sx:{px:1,borderRadius:"10px",width:"80px",maxWidth:"100px"},children:(b=e==null?void 0:e.status)!=null?b:""})}),a(le,{sx:{padding:"6px"},children:a(ee,{sx:{textTransform:"capitalize"},size:"small",children:a(J,{variant:"body2",children:(e==null?void 0:e.line)===1?"Internal":"External"})})}),a(le,{sx:{padding:"6px"},children:a(he,{size:"small",placeholder:"Phone Number",value:(e==null?void 0:e.phone)||"",disabled:(e==null?void 0:e.line)===1,onChange:C=>{M(e,{phone:C.target.value})}})}),a(le,{sx:{padding:"6px"},children:D(W,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around"},children:[a(Ae,{title:"Call",children:a(ee,{variant:e!=null&&e.isCallStart?"outlined":"contained",color:"success",sx:e!=null&&e.isCallStart?r({},i):X(r({},l),{border:`0px solid ${d.palette.success.light}`,"&:hover":{bgcolor:"success.light",boxShadow:`0px 2px 1px ${d.palette.success.light}`,border:`0px solid ${d.palette.success.light}`},"&:active":{bgcolor:"success.light",boxShadow:`inset 1px -2px 4px ${d.palette.primary.light}`}}),onClick:()=>{A(e,{isCallStart:!0,status:"ONCALL"})},disabled:(e==null?void 0:e.isCallStart)||g,children:g?a(Ce,{size:"20px",color:"success"}):a(Qe,{sx:{color:e!=null&&e.isCallStart?"default":"#e7e7e7ff"}})})}),a(Ae,{title:"Merge Call",children:a(ee,{variant:e!=null&&e.isMergeCall?"contained":"outlined",sx:e!=null&&e.isMergeCall&&(e!=null&&e.isCallStart)?r({},i):e!=null&&e.isCallStart?r({},o):r({},i),onClick:()=>{w(e,{isMergeCall:!0,status:"ONCALL"})},disabled:!(e!=null&&e.isCallStart)||u,children:u?a(Ce,{size:"20px",sx:{color:e!=null&&e.isMergeCall?"#e7e7e7ff":d.palette.primary.main}}):a(Os,{})})}),a(Ae,{title:e.isHold?"Hold":"Un Hold",children:a(ee,{variant:e!=null&&e.isHold?"contained":"outlined",sx:e!=null&&e.isHold&&(e!=null&&e.isCallStart)?r({},i):e!=null&&e.isCallStart?r({},o):r({},i),onClick:()=>{e.isHold?z(e,{isHold:!1},"UNHOLDUSER"):z(e,{isHold:!0},"HOLDUSER")},disabled:!(e!=null&&e.isCallStart)||f,children:f?a(Ce,{size:"20px",sx:{color:d.palette.primary.main}}):e.isHold?a($s,{}):a(Bs,{})})}),a(Ae,{title:e.isMute?"Mute":"Un Mute",children:a(ee,{variant:e!=null&&e.isMute?"contained":"outlined",sx:e!=null&&e.isMute&&(e!=null&&e.isCallStart)?r({},i):e!=null&&e.isCallStart?r({},o):r({},i),onClick:()=>{e.isMute?V(e,{isMute:!1},"PLAYUSER"):V(e,{isMute:!0},"MUTEUSER")},disabled:!(e!=null&&e.isCallStart)||y,children:y?a(Ce,{size:"20px",sx:{color:d.palette.primary.main}}):e.isMute?a(Us,{}):a(Ms,{})})}),a(Ae,{title:"End Call",children:(e==null?void 0:e.line)!==1?a(ee,{variant:e!=null&&e.isCallStart?"contained":"outlined",color:"error",sx:e!=null&&e.isCallStart?X(r({},l),{minWidth:"60px !important",border:`0px solid ${d.palette.error.light}`,"&:hover":{bgcolor:"error.light",boxShadow:`0px 2px 1px ${d.palette.error.light}`,border:`0px solid ${d.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${d.palette.primary.light}`}}):X(r({},i),{minWidth:"60px !important"}),onClick:()=>{Y(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart)||L,children:L?a(Ce,{size:"20px",color:"error"}):a(qo,{})}):a(ee,{variant:e!=null&&e.isCallStart?"contained":"outlined",sx:X(r({},i),{visibility:"hidden",minWidth:"60px !important"}),onClick:()=>{Y(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart),children:a(J,{children:a(qo,{sx:{visibility:"hidden"}})})})})]})})]},e.line)};function Ko({open:e,setOpen:t}){var h;let s=xe(),{showToast:i}=ke(),[l,o]=ue(!1),d=()=>{t(!1)},g=()=>{var x,f,p,y;o(!0);let u={action:"EXTERNAL_CONFERENCE",operation:"ENDCONFERENCE",userid:(f=(x=s.callData)==null?void 0:x.agent_id)!=null?f:"",process:(y=(p=s.callData)==null?void 0:p.process_name)!=null?y:""};Z.post(O.CONFERENCE_CALL_END_ALL,u).then(m=>{var L;i((L=m.data)==null?void 0:L.message,"success"),E.resetConferenceLines(),d()}).catch(m=>{var H,M,A,w;let L=((M=(H=m.response)==null?void 0:H.data)==null?void 0:M.detail)||((w=(A=m.response)==null?void 0:A.data)==null?void 0:w.message)||m.message||"An unknown error occurred";i(L,"error")}).finally(()=>{o(!1)})};return Go(()=>{var x,f,p,y;let u={line:1,status:(f=(x=s.callData)==null?void 0:x.status)!=null?f:"",type:"internal",phone:(y=(p=s.callData)==null?void 0:p.phone_number)!=null?y:"",isMute:!1,isHold:!1,isMergeCall:!1,isCallStart:!0};E.setConferenceLine(u)},[]),a(ve,{children:a(Ne,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:D(be,{sx:{borderRadius:2},children:[D(W,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px"},children:[D(J,{variant:"body1",children:[(h=s==null?void 0:s.agentId)!=null?h:""," conference"]}),a(ge,{onClick:d,children:a(et,{})})]}),a(W,{sx:{boxShadow:"1px 1px 2px #e7e5e5ff",margin:"0px 15px",borderRadius:"20px"},children:a(qs,{component:be,sx:{outline:"0px solid gray !important",boxShadow:"1px 1px 6px #e7e5e5ff"},children:D(Ws,{sx:{border:"4px solid #ffffff !important"},children:[a(Fs,{children:D(Fo,{sx:{border:"2px solid #f3f3f3ff !important"},children:[a(le,{sx:{padding:"6px"},children:"Line"}),a(le,{sx:{padding:"6px"},children:"Status"}),a(le,{sx:{padding:"6px"},children:"Call Type"}),a(le,{sx:{padding:"6px"},children:"Mobile Number"}),a(le,{sx:{padding:"6px"},children:"Call Actions"})]})}),a(Gs,{children:s==null?void 0:s.conferenceLine.map(u=>a(Ks,{each:u}))})]})})}),a(W,{textAlign:"center",m:2,children:D(ee,{variant:"outlined",color:"error",size:"large",onClick:g,disabled:l,sx:{px:2,borderRadius:"20px",textTransform:"capitalize"},children:[l?a(Ce,{size:"20px",color:"error",sx:{marginRight:"8px"}}):a(ge,{sx:{bgcolor:"error.main","&:hover":{bgcolor:"error.dark"},marginRight:"8px",width:"28px",height:"28px",fontSize:"12px",fontWeight:"600",lineHeight:"16px",letterSpacing:"0.02em",textTransform:"capitalize",color:"white",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%"},children:a(Hs,{sx:{color:"white",fontSize:"16px",fontWeight:"600"}})}),"End Conference"]})})]})})})}function jo({open:e,setOpen:t}){var p,y,m,L,H,M,A,w,z,V,Y,Q;let[s]=oe({onSuccess:b=>{console.log("res",b),t(!1)},onError:b=>{console.log("error",b)}}),i=xe(),[l,o]=ue("process"),[d,{data:g}]=oe(),[h,{data:u}]=oe(),x=()=>{t(!1)},f=(b,C)=>{var I,_,N,v,k,$,U,R,S,B,F,G,K,ie,Oe,Me,Ue,Be,Se,He,Ee,$e,Le,ze,qe,We,De,Fe,Ge,Ke,je,Ye,Xe;if(console.log(b,"data34"),C==="PROCESS"){let fe={mobile_number:(_=(I=i.callData)==null?void 0:I.phone_number)!=null?_:"",userid:(v=(N=i.callData)==null?void 0:N.agent_id)!=null?v:"",type:"PROCESS",transfer_to:(k=b==null?void 0:b.process_name)!=null?k:"",callreferenceid:(U=($=i.callData)==null?void 0:$.convox_id)!=null?U:"",processid:String((S=(R=i.callData)==null?void 0:R.process_id)!=null?S:""),process_name:(F=(B=i.callData)==null?void 0:B.process_name)!=null?F:""};s(O.TRANSFER_CALL,fe)}else if(C==="QUEUE"){let fe={mobile_number:(K=(G=i.callData)==null?void 0:G.phone_number)!=null?K:"",userid:(Oe=(ie=i.callData)==null?void 0:ie.agent_id)!=null?Oe:"",type:"QUEUE",transfer_to:(Me=b==null?void 0:b.queue_name)!=null?Me:"",callreferenceid:(Be=(Ue=i.callData)==null?void 0:Ue.convox_id)!=null?Be:"",processid:String((He=(Se=i.callData)==null?void 0:Se.process_id)!=null?He:""),process_name:($e=(Ee=i.callData)==null?void 0:Ee.process_name)!=null?$e:""};s(O.TRANSFER_CALL,fe)}else if(C==="AGENT"){let fe={mobile_number:(ze=(Le=i.callData)==null?void 0:Le.phone_number)!=null?ze:"",userid:(We=(qe=i.callData)==null?void 0:qe.agent_id)!=null?We:"",type:"AGENT",transfer_to:(De=b==null?void 0:b.user_id)!=null?De:"",callreferenceid:(Ge=(Fe=i.callData)==null?void 0:Fe.convox_id)!=null?Ge:"",processid:String((je=(Ke=i.callData)==null?void 0:Ke.process_id)!=null?je:""),process_name:(Xe=(Ye=i.callData)==null?void 0:Ye.process_name)!=null?Xe:""};s(O.TRANSFER_CALL,fe)}};return Go(()=>{d(O.AGENTS_LIST,{status:"IDLE",active:!0}),h(O.TRANSFER_TO_DETAILS,{status:"ACTIVE",active:!0})},[]),console.log(g,"idleAgentsList"),a(ve,{children:a(Ne,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:D(be,{sx:{borderRadius:2},children:[D(W,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[a(J,{variant:"body1",children:" Call Transfer"}),a(ge,{onClick:x,children:a(et,{})})]}),D(W,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:[D(W,{sx:{display:"flex",gap:1},children:[a(ee,{variant:l==="process"?"contained":"outlined",onClick:()=>o("process"),children:"Process"}),a(ee,{variant:l==="queues"?"contained":"outlined",onClick:()=>o("queues"),children:"Queues"}),a(ee,{variant:l==="agents"?"contained":"outlined",onClick:()=>o("agents"),children:"Agents"})]}),l==="process"&&a(W,{sx:{display:"flex",gap:1},children:(p=u==null?void 0:u.data)!=null&&p.process&&((m=(y=u==null?void 0:u.data)==null?void 0:y.process)==null?void 0:m.length)>0?(H=(L=u==null?void 0:u.data)==null?void 0:L.process)==null?void 0:H.map((b,C)=>D(W,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px","&:hover":{bgcolor:"action.selected"}},children:[D(J,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(Ze,{sx:{marginRight:"4px"}}),b.process_name]}),a(ge,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{f(b,"PROCESS")},children:a(Qe,{})})]},C)):a(J,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",textAlign:"center",width:"100%",margin:"10px 0px",color:"gray"},children:"No Process Found"})}),l==="queues"&&a(W,{sx:{display:"flex",gap:1},children:(M=u==null?void 0:u.data)!=null&&M.queue&&((w=(A=u==null?void 0:u.data)==null?void 0:A.queue)==null?void 0:w.length)>0?(V=(z=u==null?void 0:u.data)==null?void 0:z.queue)==null?void 0:V.map((b,C)=>{var I,_,N,v,k,$;return D(W,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px","&:hover":{bgcolor:"action.selected"}},children:[D(J,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(Ze,{sx:{marginRight:"4px"}}),b.queue_name,(N=(_=(I=u==null?void 0:u.data)==null?void 0:I.process)==null?void 0:_.find(U=>U.process_id===b.process_id))!=null&&N.process_name?a(J,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",color:"gray"},children:"("+(($=(k=(v=u==null?void 0:u.data)==null?void 0:v.process)==null?void 0:k.find(U=>U.process_id===b.process_id))==null?void 0:$.process_name)+")"}):""]}),a(ge,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{f(b,"QUEUE")},children:a(Qe,{})})]},C)}):a(J,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",textAlign:"center",width:"100%",margin:"10px 0px",color:"gray"},children:"No Queues Found"})}),l==="agents"&&a(W,{sx:{display:"flex",gap:1},children:g!=null&&g.data&&((Y=g==null?void 0:g.data)==null?void 0:Y.length)>0?(Q=g==null?void 0:g.data)==null?void 0:Q.map((b,C)=>D(W,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px","&:hover":{bgcolor:"action.selected"}},children:[D(J,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(Ze,{sx:{marginRight:"4px"}}),b.name]}),a(ge,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{f(b,"AGENT")},children:a(Qe,{})})]},C)):a(J,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",textAlign:"center",width:"100%",margin:"10px 0px",color:"gray"},children:"No Agents Found"})})]})]})})})}function Yo({open:e,setOpen:t,onSubmitDisposition:s}){var x,f;let[i,l]=ue({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""}),o=[{label:"Not Interested",value:"NI"},{label:"Resolved",value:"RES"}],d=[{label:"Yes",value:"Y"},{label:"No",value:"N"}],g=(p,y)=>{l(m=>X(r({},m),{[p]:y}))},h=()=>{l({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""})},u=()=>{h(),t(!1)};return a(ve,{children:a(Ne,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"xs",children:D(be,{sx:{borderRadius:2},children:[a(W,{sx:{display:"flex",justifyContent:"center",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:D(J,{variant:"body1",m:1,children:[" ","Call Disposition"]})}),a(W,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"10px",margin:"10px",borderRadius:"10px"},children:D(ye,{container:!0,spacing:2,children:[a(ye,{size:6,children:a(Wo,{value:i.disposition,options:o,getOptionLabel:p=>p.label,onChange:(p,y)=>g("disposition",y),size:"small",renderInput:p=>a(he,X(r({},p),{label:"Disposition",fullWidth:!0}))})}),a(ye,{size:6,children:a(Wo,{options:d,getOptionLabel:p=>p.label,value:i.followUp,onChange:(p,y)=>g("followUp",y),size:"small",renderInput:p=>a(he,X(r({},p),{label:"Follow Up",fullWidth:!0}))})}),((f=(x=i==null?void 0:i.followUp)==null?void 0:x.label)==null?void 0:f.toLowerCase())==="yes"&&D(ve,{children:[a(ye,{size:6,children:a(he,{size:"small",label:"Callback Date",type:"date",slotProps:{inputLabel:{shrink:!0}},value:i.callbackDate,onChange:p=>g("callbackDate",p.target.value),fullWidth:!0})}),a(ye,{size:6,children:a(he,{size:"small",label:"Hours (0-23)",type:"text",inputProps:{min:0,max:23},value:i.callbackHrs,onChange:p=>g("callbackHrs",p.target.value),fullWidth:!0})}),a(ye,{size:6,children:a(he,{size:"small",label:"Minutes (0-59)",type:"text",inputProps:{min:0,max:59},value:i.callbackMins,onChange:p=>g("callbackMins",p.target.value),fullWidth:!0})})]})]})}),D(W,{textAlign:"right",m:2,children:[a(ee,{variant:"outlined",color:"error",size:"large",onClick:u,sx:{px:2,mx:1,borderRadius:"10px",textTransform:"capitalize"},children:"cancel"}),a(ee,{variant:"contained",color:"primary",size:"large",onClick:()=>s(i),sx:{px:2,borderRadius:"10px",textTransform:"capitalize"},children:"Submit"})]})]})})})}function Xo({open:e,setOpen:t,processList:s=null,handleSelectedProcessor:i}){var o,d;return a(ve,{children:a(Ne,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",maxWidth:"xs",children:D(be,{sx:{borderRadius:2},children:[D(W,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[a(J,{variant:"body1",children:" Process List"}),a(ge,{onClick:()=>{t(!1)},children:a(et,{})})]}),a(W,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:((o=s==null?void 0:s.processes)==null?void 0:o.length)>0?(d=s==null?void 0:s.processes)==null?void 0:d.map((g,h)=>a(W,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px",cursor:"pointer","&:hover":{bgcolor:"action.selected"}},onClick:()=>{i(g)},children:D(J,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(Ze,{sx:{marginRight:"4px"}}),g.process_name]})},h)):null})]})})})}function Jo({open:e,setOpen:t}){return a(ve,{children:a(Ne,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:D(be,{sx:{borderRadius:2},children:[D(W,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[a(J,{variant:"body1",children:" Call History"}),a(ge,{onClick:()=>{t(!1)},children:a(et,{})})]}),a(W,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",margin:"10px",borderRadius:"10px",textAlign:"center",fontSize:"16px",fontWeight:"bold"},p:6,children:"Coming Soon..."})]})})})}import{Fragment as ua,jsx as c,jsxs as ce}from"react/jsx-runtime";function os({onDataChange:e}){var ft,mt,xt,yt,ht,Ct,bt,vt,Tt,St,Et,Lt,Dt,It,Rt,_t,wt,kt,At,Nt,Pt,Ot,Mt,Ut,Bt,Ht,$t,zt,qt,Wt,Ft,Gt,Kt,jt,Yt,Xt,Jt,Vt,Qt,Zt,eo,to,oo,so,ao,no,io,lo,ro,co,po,uo,go,fo,mo,xo,yo,ho,Co,bo,vo,To,So,Eo,Lo,Do;let t=ca(),{disabled:s,enabled:i,outlined:l}=Ve(),o=xe(),d=da(null),[g,h]=ne(null),[u,x]=ne(!0),[f,p]=ne(null),[y,m]=ne(null),[L,H]=ne(!1),[M,A]=ne(!1),[w,z]=ne(!1),[V,Y]=ne(!1),[Q,b]=ne(!1),[C,I]=ne(""),[_,N]=ne(0),{position:v,isDragging:k,dragRef:$,handleMouseDown:U,handleTouchStart:R}=ct(o.controlPanelPosition,n=>E.setControlPanelPosition(n)),{position:S,isDragging:B,dragRef:F,handleMouseDown:G,handleTouchStart:K}=ct(o.iframePosition,n=>E.setIframePosition(n)),[ie,{data:Oe}]=oe({onSuccess:n=>{var T;console.log("res",n),n&&n.data&&((T=n==null?void 0:n.data)==null?void 0:T.length)>1?Y(!0):(E.setProcess(n==null?void 0:n.data[0]),Y(!1))},onError:()=>{Y(!1)}}),[Me,{isLoading:Ue}]=oe(),[Be,{isLoading:Se}]=oe({onSuccess:()=>{E.setHolding(!o.isHolding)},onError:n=>{console.log("error",n)}}),[He,{isLoading:Ee}]=oe({onSuccess:()=>{E.setMuted(!o.isMuted)},onError:n=>{console.log("error",n)}}),[$e,{isLoading:Le}]=oe(),[ze,{isLoading:qe}]=oe(),[We,{isLoading:De}]=oe(),Fe=pa(n=>{let T=Math.floor(n/60),j=n%60;return`${T.toString().padStart(2,"0")}:${j.toString().padStart(2,"0")}`},[]),Ge=()=>{h(null)},Ke=n=>{x(!0),m(n.currentTarget),E.setStatus("dial")},je=()=>{o.status!=="on call"&&E.setStatus("idle"),m(null)},Ye=n=>{p(n.currentTarget)},Xe=()=>{p(null)},fe=()=>{let n={action:"READYAGENT",userId:o.agentId};$e(O.READY_AGENT,n)},gt=n=>{p(null);let T={action:"AGENTBREAK",break_type:n,userId:o.agentId};ze(O.UPDATE_AGENT_BREAK,T)},ns=n=>{if(n.length!==10)alert("Invalid phone number");else if(/^\d+$/.test(n)){let T={action:"CALL",phone_number:n,userId:o.agentId};Me(O.CLICK_TO_CALL,T)}},is=()=>{let n={action:o.isHolding?"UNHOLD":"HOLD",userId:o.agentId};Be(O.HOLD_CALL,n)},ls=()=>{let n={action:o.isMuted?"UNMUTE":"MUTE",userId:o.agentId};He(O.MUTE_CALL,n)},rs=n=>{var j,se,ae,pe,de,Ie,Re,Io,Ro,_o,wo,ko,Ao,No,Po,Oo;console.log("data",n);let T={action:"ENDCALL",userId:o.agentId,processid:(ae=(se=(j=o.process)==null?void 0:j.process_id)==null?void 0:se.toString())!=null?ae:"",process_name:(de=(pe=o.process)==null?void 0:pe.process_name)!=null?de:"",callreferenceid:(Re=(Ie=o.callData)==null?void 0:Ie.convox_id)!=null?Re:"",mobile_number:(Ro=(Io=o.callData)==null?void 0:Io.phone_number)!=null?Ro:"",disposition:(wo=(_o=n==null?void 0:n.disposition)==null?void 0:_o.value)!=null?wo:"",set_followUp:(Ao=(ko=n==null?void 0:n.followUp)==null?void 0:ko.value)!=null?Ao:"",callback_date:(No=n==null?void 0:n.callbackDate)!=null?No:"",callback_hrs:(Po=n==null?void 0:n.callbackHrs)!=null?Po:"",callback_mins:(Oo=n==null?void 0:n.callbackMins)!=null?Oo:"",endcall_type:"CLOSE"};I(""),We(O.END_CALL,T),E.endCall(),z(!1)};return ot(()=>{let n;return o.callData.status&&o.callData.status==="ONCALL"?n=setInterval(()=>{let T=Math.floor((Date.now()-o.callStartTime)/1e3);N(T)},1e3):N(0),()=>{n&&clearInterval(n)}},[o.callData.status]),ot(()=>{e&&e(o.callData)},[o.callData,e]),ot(()=>{o.agentId?ie(O.PROCESS_LIST,{userId:o.agentId,action:"GETAGENTPROCESSLIST",refno:"1234221233"}):console.log("No agentId available, skipping API call")},[o.agentId]),ot(()=>(o.agentId&&(d.current=new WebSocket(`${Uo.WS}?agent_id=${o.agentId}`),d.current.onopen=()=>{console.log("WebSocket connection established")},d.current.onmessage=n=>{try{let T=JSON.parse(n.data);console.log("parsedJSON:",T),E.updateCallData(T),T.status==="ONCALL"&&E.startCall(),T.status==="WRAPUP"&&E.endCall()}catch(T){console.log("Raw message:",n.data)}},d.current.onclose=()=>{console.log("WebSocket connection closed")},d.current.onerror=n=>{console.error("WebSocket error:",n)}),()=>{var n;(n=d.current)==null||n.close()}),[o.agentId]),!o.isInitialized||!o.process?c(re,{children:!!V&&c(Xo,{processList:Oe,open:V,setOpen:Y,handleSelectedProcessor:n=>{E.setProcess(n)}})}):ce(ua,{children:[c(Qo,{in:!0,timeout:300,children:c(es,{ref:$,elevation:k?4:1,sx:{position:"fixed",left:v.x,top:v.y,p:.5,borderRadius:3,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),userSelect:"none"},children:ce(re,{sx:{display:"flex",alignItems:"center"},children:[ce(re,{sx:{display:"flex",alignItems:"center"},children:[ce(tt,{component:"div",size:"small",sx:{cursor:"all-scroll"},onMouseDown:U,onTouchStart:R,children:[c(Vo,{})," "]}),c(re,{sx:{marginRight:"10px"},children:c(me,{title:"Dial",children:c(tt,{size:"small",onClick:n=>{var T,j,se,ae,pe,de,Ie,Re;((j=(T=o.callData)==null?void 0:T.status)==null?void 0:j.toUpperCase())!=="ONCALL"&&((ae=(se=o.callData)==null?void 0:se.status)==null?void 0:ae.toUpperCase())!=="BREAK"&&((de=(pe=o.callData)==null?void 0:pe.status)==null?void 0:de.toUpperCase())!=="RINGING"&&((Re=(Ie=o.callData)==null?void 0:Ie.status)==null?void 0:Re.toUpperCase())!=="WRAPUP"&&Ke(n)},sx:{bgcolor:"action.hover","&:hover":{bgcolor:"warning"}},children:c(la,{sx:{color:((mt=(ft=o.callData)==null?void 0:ft.status)==null?void 0:mt.toUpperCase())==="ONCALL"||((yt=(xt=o.callData)==null?void 0:xt.status)==null?void 0:yt.toUpperCase())==="BREAK"||((Ct=(ht=o.callData)==null?void 0:ht.status)==null?void 0:Ct.toUpperCase())==="RINGING"||((vt=(bt=o.callData)==null?void 0:bt.status)==null?void 0:vt.toUpperCase())==="WRAPUP"?"action.selected":"success.main"}})})})}),c(ts,{sx:{color:"success.main",width:"40px",marginRight:"10px"},children:Fe(_)}),qe||Le?c(re,{sx:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},children:c(Pe,{size:"20px"})}):c(ts,{variant:"body2",sx:{fontWeight:"bold",textAlign:"right"},children:(Et=(St=(Tt=o.callData)==null?void 0:Tt.status)==null?void 0:St.toUpperCase())!=null?Et:"N/A"}),c(re,{onClick:Ye,sx:{display:"flex",alignItems:"center",margin:"6px",cursor:"pointer"},children:c(js,{})})]}),ce(re,{sx:{display:"flex",gap:1,justifyContent:"center",alignItems:"center"},children:[c(me,{title:"Agent Ready",children:c(Te,{variant:((Dt=(Lt=o.callData)==null?void 0:Lt.status)==null?void 0:Dt.toUpperCase())==="BREAK"||((Rt=(It=o.callData)==null?void 0:It.status)==null?void 0:Rt.toUpperCase())==="MISSED"?"outlined":"contained",onClick:n=>{var T,j,se,ae;(((j=(T=o.callData)==null?void 0:T.status)==null?void 0:j.toUpperCase())==="BREAK"||((ae=(se=o.callData)==null?void 0:se.status)==null?void 0:ae.toUpperCase())==="MISSED")&&(n.stopPropagation(),fe())},classes:{root:((wt=(_t=o.callData)==null?void 0:_t.status)==null?void 0:wt.toUpperCase())==="BREAK"||((At=(kt=o.callData)==null?void 0:kt.status)==null?void 0:At.toUpperCase())==="MISSED"?"outlined":"enabled"},sx:r({},((Pt=(Nt=o.callData)==null?void 0:Nt.status)==null?void 0:Pt.toUpperCase())==="BREAK"||((Mt=(Ot=o.callData)==null?void 0:Ot.status)==null?void 0:Mt.toUpperCase())==="MISSED"?l:i),disabled:Le,children:c(aa,{})})}),c(me,{title:o.isHolding?"Resume":"Hold",children:c(Te,{variant:o.isHolding&&((Bt=(Ut=o.callData)==null?void 0:Ut.status)==null?void 0:Bt.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:n=>{n.stopPropagation(),is()},sx:o.isHolding&&(($t=(Ht=o.callData)==null?void 0:Ht.status)==null?void 0:$t.toUpperCase())==="ONCALL"?r({},i):((qt=(zt=o.callData)==null?void 0:zt.status)==null?void 0:qt.toUpperCase())==="ONCALL"?r({},l):r({},s),disabled:((Ft=(Wt=o.callData)==null?void 0:Wt.status)==null?void 0:Ft.toUpperCase())!=="ONCALL"&&!o.isHolding||Se,children:Se?c(Pe,{size:"20px",sx:{color:t.palette.primary.main}}):o.isHolding?c(sa,{}):c(ea,{})})}),c(me,{title:o.isMuted?"Unmute":"Mute",children:c(Te,{variant:o.isMuted&&((Kt=(Gt=o.callData)==null?void 0:Gt.status)==null?void 0:Kt.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:n=>{n.stopPropagation(),ls()},sx:o.isMuted&&((Yt=(jt=o.callData)==null?void 0:jt.status)==null?void 0:Yt.toUpperCase())==="ONCALL"?r({},i):((Jt=(Xt=o.callData)==null?void 0:Xt.status)==null?void 0:Jt.toUpperCase())==="ONCALL"?r({},l):r({},s),disabled:((Qt=(Vt=o.callData)==null?void 0:Vt.status)==null?void 0:Qt.toUpperCase())!=="ONCALL"&&!o.isMuted||Ee,children:Ee?c(Pe,{size:"20px",sx:{color:t.palette.primary.main}}):o.isMuted?c(Zs,{}):c(Qs,{})})}),c(me,{title:"Transfer Call",children:c(Te,{variant:M?"contained":"outlined",onClick:n=>{var T,j;((j=(T=o.callData)==null?void 0:T.status)==null?void 0:j.toUpperCase())==="ONCALL"&&(n.stopPropagation(),A(!0))},sx:M?r({},i):((eo=(Zt=o.callData)==null?void 0:Zt.status)==null?void 0:eo.toUpperCase())==="ONCALL"?r({},l):r({},s),disabled:((oo=(to=o.callData)==null?void 0:to.status)==null?void 0:oo.toUpperCase())!=="ONCALL",children:c(na,{})})}),c(me,{title:"Conference Call",children:c(Te,{variant:L?"contained":"outlined",onClick:n=>{var T,j;((j=(T=o.callData)==null?void 0:T.status)==null?void 0:j.toUpperCase())==="ONCALL"&&(n.stopPropagation(),H(!0))},sx:L?r({},i):((ao=(so=o.callData)==null?void 0:so.status)==null?void 0:ao.toUpperCase())==="ONCALL"?r({},l):r({},s),disabled:((io=(no=o.callData)==null?void 0:no.status)==null?void 0:io.toUpperCase())!=="ONCALL",children:c(Js,{})})}),c(me,{title:"End Call",children:c(Te,{variant:((ro=(lo=o.callData)==null?void 0:lo.status)==null?void 0:ro.toUpperCase())==="ONCALL"||((po=(co=o.callData)==null?void 0:co.status)==null?void 0:po.toUpperCase())==="RINGING"||((go=(uo=o.callData)==null?void 0:uo.status)==null?void 0:go.toUpperCase())==="WRAPUP"?"contained":"outlined",onClick:n=>{var T,j,se,ae,pe,de;(((j=(T=o.callData)==null?void 0:T.status)==null?void 0:j.toUpperCase())==="ONCALL"||((ae=(se=o.callData)==null?void 0:se.status)==null?void 0:ae.toUpperCase())==="RINGING"||((de=(pe=o.callData)==null?void 0:pe.status)==null?void 0:de.toUpperCase())==="WRAPUP")&&(n.stopPropagation(),z(!0))},sx:((mo=(fo=o.callData)==null?void 0:fo.status)==null?void 0:mo.toUpperCase())==="ONCALL"||((yo=(xo=o.callData)==null?void 0:xo.status)==null?void 0:yo.toUpperCase())==="RINGING"||((Co=(ho=o.callData)==null?void 0:ho.status)==null?void 0:Co.toUpperCase())==="WRAPUP"?X(r({},i),{borderRight:"1px",backgroundColor:"error.main",minWidth:"60px !important",boxShadow:" 0px 2px 1px #5f3f3f",border:`1px solid ${t.palette.error.light}`,height:"40px","&:hover":{bgcolor:"error.light",boxShadow:" 0px 2px 1px #5f3f3f",border:`0px solid ${t.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${t.palette.primary.light}`}}):X(r({},s),{minWidth:"60px !important"}),disabled:((vo=(bo=o.callData)==null?void 0:bo.status)==null?void 0:vo.toUpperCase())!=="ONCALL"&&((So=(To=o.callData)==null?void 0:To.status)==null?void 0:So.toUpperCase())!=="RINGING"&&((Lo=(Eo=o.callData)==null?void 0:Eo.status)==null?void 0:Lo.toUpperCase())!=="WRAPUP"||De,children:De?c(Pe,{size:"20px",color:"error"}):c(Ys,{})})})]})]})})}),c(Qo,{in:!0,timeout:300,children:ce(es,{ref:F,elevation:B?4:1,sx:{position:"fixed",left:S.x,top:S.y,p:1,height:"auto",borderRadius:2,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),visibility:u?"visible":"hidden",userSelect:"none"},children:[ce(re,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"all-scroll"},onMouseDown:G,onTouchStart:K,children:[c(Vo,{sx:{transform:"rotate(90deg)"}})," ",c(tt,{onClick:()=>x(!1),children:c(Xs,{})})]}),c("iframe",{src:`https://h68.deepijatel.in/ConVoxCCS/iframe?agent_id=${o.agentId}&process_id=${(Do=o.process)==null?void 0:Do.process_id}`,height:380,width:420,allow:"camera; microphone; autoplay"})]})}),c(ut,{anchorEl:y,open:!!y,onClose:je,onClick:n=>n.stopPropagation(),sx:{zIndex:99999},children:ce(re,{sx:{all:"unset",padding:"10px","&hover":{backgroundColor:"white"}},children:[c(ra,{size:"small",value:C,placeholder:"Enter Mobile No.",onChange:n=>{I(n.target.value)}}),c(tt,{color:"info",onClick:()=>{ns(C)},children:Ue?c(Pe,{size:"20px",sx:{color:t.palette.success.main}}):c(oa,{color:"success"})})]})}),ce(ut,{anchorEl:f,open:!!f,onClose:Xe,onClick:n=>n.stopPropagation(),sx:{zIndex:99999},children:[c(Zo,{onClick:()=>gt("Lunch"),children:"- Lunch"}),c(Zo,{onClick:()=>gt("Tea"),children:"- Tea"})]}),c(ut,{anchorEl:g,open:!!g,onClose:Ge,onClick:n=>n.stopPropagation(),sx:{zIndex:99999},children:ce(re,{sx:{display:"flex",justifyContent:"flex-start",flexDirection:"column",padding:"0px 10px","&hover":{backgroundColor:"white"}},children:[c(dt,{icon:c(Vs,{color:"secondary"}),variant:"outlined",label:"Waiting - 25",sx:{margin:"4px 2px"}}),c(dt,{icon:c(ta,{color:"info"}),label:"Pending - 99+",variant:"outlined",sx:{margin:"4px 2px"}}),c(dt,{icon:c(ia,{color:"success"}),variant:"outlined",label:"Upcoming - 66",sx:{margin:"4px 2px"}})]})}),!!L&&c(Ko,{open:L,setOpen:H}),!!M&&c(jo,{open:M,setOpen:A}),!!w&&c(Yo,{open:w,setOpen:z,onSubmitDisposition:rs}),!!Q&&c(Jo,{open:Q,setOpen:b})]})}import{jsx as ga}from"react/jsx-runtime";var ss=({children:e})=>ga(zo,{children:e});import{jsx as as}from"react/jsx-runtime";function fa({onDataChange:e}){return as(ss,{children:as(os,{onDataChange:e})})}function Bn({apiKey:e,tenantId:t,agentId:s}){E.initialize(e,s),nt.init({apiKey:e,tenantId:t,agentId:s,baseUrl:P})}export{fa as CallControlPanel,Bn as initSDK,vs as useEndCall,Cs as useLogout};
|
|
1
|
+
var ps=Object.defineProperty,ds=Object.defineProperties;var us=Object.getOwnPropertyDescriptors;var Uo=Object.getOwnPropertySymbols;var gs=Object.prototype.hasOwnProperty,fs=Object.prototype.propertyIsEnumerable;var at=(e,t,s)=>t in e?ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,c=(e,t)=>{for(var s in t||(t={}))gs.call(t,s)&&at(e,s,t[s]);if(Uo)for(var s of Uo(t))fs.call(t,s)&&at(e,s,t[s]);return e},V=(e,t)=>ds(e,us(t));var te=(e,t,s)=>at(e,typeof t!="symbol"?t+"":t,s);var nt=class{constructor(){te(this,"config",null);te(this,"ticketId",null);te(this,"baseUrl","");te(this,"eventQueue",[]);te(this,"isOnline",!0);te(this,"retryQueue",[]);te(this,"flushTimer",null)}async init(t){this.config=c({autoTrack:!0,retryAttempts:3,queueSize:100,flushInterval:5e3},t),this.baseUrl=t.baseUrl||(typeof window!="undefined"?window.location.origin:""),this.setupNetworkDetection();let s=await this.createTicket();return this.startPeriodicFlush(),console.log("EventTracker SDK initialized successfully"),s}isInitialized(){return this.config!==null&&this.ticketId!==null}getConfig(){return this.config}getTicketId(){return this.ticketId}async createTicket(){if(!this.config)throw new Error("EventTracker not initialized");try{let t=await this.makeRequest("/api/v1/et/init",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({agentId:this.config.agentId,sessionId:this.config.sessionId})});if(!t.ok)throw new Error(`Failed to initialize: ${t.status} ${t.statusText}`);let s=await t.json();return this.ticketId=s.ticketId,this.config.autoTrack&&this.setupAutoTracking(),this.ticketId}catch(t){throw console.error("EventTracker initialization failed:",t),t}}async logEvent(t,s){if(!this.config||!this.ticketId){console.warn("EventTracker not initialized, skipping event:",t);return}let i={eventType:t,eventData:s,timestamp:Date.now()};if(this.eventQueue.push(i),this.eventQueue.length>(this.config.queueSize||100)&&this.eventQueue.shift(),this.isOnline)try{await this.sendEvent(i)}catch(r){console.warn("Failed to send event, will retry later:",r)}}async sendEvent(t){if(!(!this.config||!this.ticketId))try{let s=await this.makeRequest("/api/v1/et/event",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId,eventType:t.eventType,eventData:t.eventData})});if(!s.ok)throw new Error(`Failed to log event: ${s.status} ${s.statusText}`);let i=this.eventQueue.findIndex(r=>r.timestamp===t.timestamp);i>-1&&this.eventQueue.splice(i,1)}catch(s){console.error("Event logging failed:",s),this.retryQueue.push(()=>this.sendEvent(t))}}async closeTicket(){if(!this.config||!this.ticketId)throw new Error("EventTracker not initialized");await this.flush();try{let t=await this.makeRequest("/api/v1/et/close",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId})});if(!t.ok)throw new Error(`Failed to close ticket: ${t.status} ${t.statusText}`);this.ticketId=null,this.stopPeriodicFlush(),console.log("Ticket closed successfully")}catch(t){throw console.error("Ticket close failed:",t),t}}async flush(){if(!this.isOnline||this.eventQueue.length===0)return;let t=[...this.eventQueue];for(let i of t)await this.sendEvent(i);let s=[...this.retryQueue];this.retryQueue=[];for(let i of s)try{await i()}catch(r){console.error("Retry failed:",r)}}async makeRequest(t,s){var o;let i=`${this.baseUrl}${t}`,r=((o=this.config)==null?void 0:o.retryAttempts)||3;for(let d=1;d<=r;d++)try{return await fetch(i,s)}catch(m){if(d===r)throw m;let h=Math.min(1e3*Math.pow(2,d-1),1e4);await new Promise(u=>setTimeout(u,h))}throw new Error("Max retries exceeded")}setupAutoTracking(){var i;if(typeof window=="undefined"||!((i=this.config)!=null&&i.autoTrack))return;let t=this.config.autoTrack===!0?{}:this.config.autoTrack;if(t.pageVisits!==!1&&this.logEvent("pageVisit",{url:window.location.href,title:document.title,referrer:document.referrer,userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()}).catch(r=>console.warn("Failed to track page visit:",r)),t.clicks!==!1&&document.addEventListener("click",r=>{var d;let o=r.target;(o.tagName==="BUTTON"||o.tagName==="A"||o.onclick||o.getAttribute("role")==="button"||o instanceof HTMLButtonElement&&o.type==="button")&&this.logEvent("click",{element:o.tagName,text:(d=o.textContent)==null?void 0:d.trim().substring(0,100),href:o.getAttribute("href"),id:o.id,className:o.className,role:o.getAttribute("role"),position:{x:r.clientX,y:r.clientY},timestamp:new Date().toISOString()}).catch(m=>console.warn("Failed to track click:",m))}),t.forms!==!1&&document.addEventListener("submit",r=>{let o=r.target,d=new FormData(o),m={};d.forEach((h,u)=>{m[u]=h.toString()}),this.logEvent("formSubmission",{formId:o.id,action:o.action,method:o.method,fields:Object.keys(m),fieldCount:Object.keys(m).length,timestamp:new Date().toISOString()}).catch(h=>console.warn("Failed to track form submission:",h))}),t.inputs!==!1){let r;document.addEventListener("input",o=>{let d=o.target;(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.tagName==="SELECT")&&(clearTimeout(r),r=setTimeout(()=>{var m;this.logEvent("fieldChange",{element:d.tagName,type:d.getAttribute("type"),name:d.getAttribute("name"),id:d.id,valueLength:((m=d.value)==null?void 0:m.length)||0,timestamp:new Date().toISOString()}).catch(h=>console.warn("Failed to track field change:",h))},1e3))})}let s=Date.now();window.addEventListener("beforeunload",()=>{let r=Date.now()-s;this.logEvent("pageUnload",{url:window.location.href,sessionDuration:r,timestamp:new Date().toISOString()}),this.ticketId&&navigator.sendBeacon(`${this.baseUrl}/api/v1/et/close`,JSON.stringify({ticketId:this.ticketId}))}),t.visibility!==!1&&document.addEventListener("visibilitychange",()=>{this.logEvent("visibilityChange",{hidden:document.hidden,visibilityState:document.visibilityState,timestamp:new Date().toISOString()})}),t.errors!==!1&&(window.addEventListener("error",r=>{this.logEvent("jsError",{message:r.message,filename:r.filename,lineno:r.lineno,colno:r.colno,timestamp:new Date().toISOString()})}),window.addEventListener("unhandledrejection",r=>{var o;this.logEvent("unhandledRejection",{reason:(o=r.reason)==null?void 0:o.toString(),timestamp:new Date().toISOString()})})),t.performance!==!1&&typeof window.performance!="undefined"&&window.performance.navigation&&window.addEventListener("load",()=>{setTimeout(()=>{let r=window.performance.navigation,o=window.performance.timing;this.logEvent("performanceMetrics",{navigationTime:o.navigationStart,loadTime:o.loadEventEnd-o.navigationStart,domReady:o.domContentLoadedEventEnd-o.navigationStart,renderTime:o.loadEventEnd-o.domContentLoadedEventEnd,navigationType:r.type,redirectCount:r.redirectCount,timestamp:new Date().toISOString()})},1e3)})}setupNetworkDetection(){typeof window!="undefined"&&(this.isOnline=navigator.onLine,window.addEventListener("online",()=>{this.isOnline=!0,console.log("EventTracker: Back online, flushing queued events"),this.flush()}),window.addEventListener("offline",()=>{this.isOnline=!1,console.log("EventTracker: Offline, queueing events")}))}startPeriodicFlush(){var s;this.flushTimer&&clearInterval(this.flushTimer);let t=((s=this.config)==null?void 0:s.flushInterval)||5e3;this.flushTimer=setInterval(()=>{this.flush()},t)}stopPeriodicFlush(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}},it=new nt;typeof window!="undefined"&&(window.EventTracker=it);var lt=class{constructor(){te(this,"state");te(this,"listeners",[]);te(this,"STORAGE_KEY","call-control-sdk-state");this.state=this.getInitialState(),this.loadFromStorage()}getInitialState(){return{apiKey:null,process:null,agentId:"",isInitialized:!1,isHolding:!1,isMuted:!1,status:"idle",callStartTime:null,controlPanelPosition:{x:10,y:10},iframePosition:{x:10,y:80},callData:{agent_id:"",status:"",type:"",event_time:"",phone_number:""},conferenceLine:[{line:1,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:2,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:3,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:4,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:5,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1}]}}loadFromStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);if(t){let s=JSON.parse(t);this.state=V(c({},this.state),{apiKey:s.apiKey||"",agentId:s.agentId||"",process:s.process||null,isInitialized:s.isInitialized||!1,isHolding:s.isHolding||!1,isMuted:s.isMuted||!1,status:s.status||"idle",callStartTime:s.callStartTime||null,controlPanelPosition:s.controlPanelPosition||{x:10,y:10},iframePosition:s.iframePosition||{x:10,y:80},callData:s.callData||{mobileNumber:"",callReferenceId:"",agentLoginId:""},conferenceLine:s.conferenceLine&&Array.isArray(s.conferenceLine)&&s.conferenceLine.length>0?s.conferenceLine:this.state.conferenceLine})}}catch(t){console.warn("Failed to load SDK state from localStorage:",t)}}saveToStorage(){try{let t={apiKey:this.state.apiKey,agentId:this.state.agentId,process:this.state.process,isInitialized:this.state.isInitialized,isHolding:this.state.isHolding,isMuted:this.state.isMuted,status:this.state.status,callStartTime:this.state.callStartTime,controlPanelPosition:this.state.controlPanelPosition,iframePosition:this.state.iframePosition,callData:this.state.callData,conferenceLine:this.state.conferenceLine};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(t){console.warn("Failed to save SDK state to localStorage:",t)}}notifyListeners(){this.listeners.forEach(t=>t())}initialize(t,s){if(!t||typeof t!="string"||t.trim().length===0)throw new Error("API key not available");this.state.apiKey=t,this.state.agentId=s,this.state.isInitialized=!0,this.saveToStorage(),this.notifyListeners()}getState(){return c({},this.state)}subscribe(t){return this.listeners.push(t),()=>{let s=this.listeners.indexOf(t);s>-1&&this.listeners.splice(s,1)}}setHolding(t){this.state.isHolding=t,this.saveToStorage(),this.notifyListeners()}setMuted(t){this.state.isMuted=t,this.saveToStorage(),this.notifyListeners()}setStatus(t){this.state.status=t,this.saveToStorage(),this.notifyListeners()}setProcess(t){this.state.process=t,this.saveToStorage(),this.notifyListeners()}setControlPanelPosition(t){this.state.controlPanelPosition=t,this.saveToStorage(),this.notifyListeners()}setIframePosition(t){this.state.iframePosition=t,this.saveToStorage(),this.notifyListeners()}startCall(){this.state.callStartTime=Date.now(),this.state.status="on call",this.saveToStorage(),this.notifyListeners()}endCall(){this.state.callStartTime=null,this.state.status="idle",this.state.isHolding=!1,this.state.isMuted=!1,this.saveToStorage(),this.notifyListeners()}updateCallData(t){this.state.callData=c(c({},this.state.callData),t),this.saveToStorage(),this.notifyListeners()}setConferenceLine(t){var i;(!this.state.conferenceLine||!Array.isArray(this.state.conferenceLine))&&(console.warn("Conference line data corrupted, resetting to initial state"),this.state.conferenceLine=this.getInitialState().conferenceLine);let s=(i=this.state.conferenceLine)==null?void 0:i.map(r=>r.line===t.line?t:r);this.state.conferenceLine=s,this.saveToStorage(),this.notifyListeners()}resetConferenceLines(){this.state.conferenceLine=this.getInitialState().conferenceLine,this.saveToStorage(),this.notifyListeners()}clearStorageAndReset(){try{localStorage.removeItem(this.STORAGE_KEY),this.state=this.getInitialState(),this.notifyListeners()}catch(t){console.warn("Failed to clear localStorage:",t)}}debugStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);console.log("Current localStorage data:",t),t&&console.log("Parsed localStorage data:",JSON.parse(t)),console.log("Current state:",this.state)}catch(t){console.error("Error debugging storage:",t)}}getConferenceLines(){return this.state.conferenceLine||[]}},v=new lt;import{useCallback as Cs,useState as Re}from"react";var $="http://192.168.101.177:8095",ms="ws://192.168.101.177:8095",W={v1:"/api/v1"},A={LOGIN:`${$}${W.v1}/cti/login?provider=convox`,READY_AGENT:`${$}${W.v1}/cti/ready-agent?provider=convox`,UPDATE_AGENT_BREAK:`${$}${W.v1}/cti/update-agent-status?provider=convox`,CLICK_TO_CALL:`${$}${W.v1}/cti/calls?provider=convox`,HOLD_CALL:`${$}${W.v1}/cti/calls/hold?provider=convox`,MUTE_CALL:`${$}${W.v1}/cti/calls/mute?provider=convox`,UNMUTE_CALL:`${$}${W.v1}/cti/unmute-call?provider=convox`,END_CALL:`${$}${W.v1}/cti/calls/end?provider=convox`,LOGOUT:`${$}${W.v1}/cti/logout?provider=convox`,CONFERENCE_CALL:`${$}${W.v1}/cti/calls/conference?provider=convox`,CONFERENCE_CALL_HOLD_OR_UN_HOLD:`${$}${W.v1}/cti/calls/conference/hold?provider=convox`,CONFERENCE_CALL_MUTE_OT_UN_MUTE:`${$}${W.v1}/cti/calls/conference/mute?provider=convox`,CONFERENCE_CALL_END:`${$}${W.v1}/cti/calls/conference/hangup?provider=convox`,CONFERENCE_CALL_END_ALL:`${$}${W.v1}/cti/calls/conference/hangup/all?provider=convox`,TRANSFER_CALL:`${$}${W.v1}/cti/calls/transfer?provider=convox`,AGENTS_LIST:`${$}${W.v1}/cti/users`,PROCESS_LIST:`${$}${W.v1}/cti/processes-list`,TRANSFER_TO_DETAILS:`${$}${W.v1}/cti/transfer-to-details?provider=convox`,CALL_HISTORY:`${$}${W.v1}/dashboard/call-history`,SENTIMENTAL_ANALYSIS:`${$}${W.v1}/users/get_sentiment_analysis`},Bo={WS:`${ms}${W.v1}/cti/ws`};import xs from"axios";var ys="12345",rt=xs.create({baseURL:$,headers:{"Content-Type":"application/json",Authorization:ys},timeout:1e4});rt.interceptors.request.use(e=>{let t="12345";return t&&e.headers&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e instanceof Error?e:new Error(String(e))));rt.interceptors.response.use(e=>e,async e=>{var s;let t=e.config;return((s=e.response)==null?void 0:s.status)===401&&!t._retry&&(t._retry=!0),Promise.reject(e instanceof Error?e:new Error(String(e)))});var Z=rt;var hs=()=>{let[e,t]=Re(!1),[s,i]=Re(!1),[r,o]=Re(!1),[d,m]=Re(null),[h,u]=Re(null);return{logout:Cs(async()=>{var y;let g=JSON.parse((y=localStorage.getItem("call-control-sdk-state"))!=null?y:"");t(!0);let l={action:"LOGOUTUSER",userId:g.agentId||""};return Z.post(A.LOGOUT,l).then(x=>(v.clearStorageAndReset(),localStorage.clear(),sessionStorage.clear(),u(x==null?void 0:x.data),i(!0),x==null?void 0:x.data)).catch(x=>{var S;return o(!0),m(x),(S=x==null?void 0:x.response)==null?void 0:S.data}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:s,isError:r,error:d,data:h}},bs=hs;import{useCallback as vs,useState as we}from"react";var Ss=()=>{let[e,t]=we(!1),[s,i]=we(!1),[r,o]=we(!1),[d,m]=we(null),[h,u]=we(null);return{handleEndCall:vs(async g=>{var x,S,O,P,k,I,U,K,B,_,f,b,R,N,H;let l=JSON.parse((x=localStorage.getItem("call-control-sdk-state"))!=null?x:"");t(!0);let y={action:"ENDCALL",userId:l==null?void 0:l.agentId,processid:(P=(O=(S=l==null?void 0:l.process)==null?void 0:S.process_id)==null?void 0:O.toString())!=null?P:"",process_name:(I=(k=l==null?void 0:l.process)==null?void 0:k.process_name)!=null?I:"",callreferenceid:(K=(U=l==null?void 0:l.callData)==null?void 0:U.convox_id)!=null?K:"",mobile_number:(_=(B=l==null?void 0:l.callData)==null?void 0:B.phone_number)!=null?_:"",disposition:(f=g==null?void 0:g.disposition)!=null?f:"RES",set_followUp:(b=g==null?void 0:g.followUp)!=null?b:"N",callback_date:(R=g==null?void 0:g.callbackDate)!=null?R:"",callback_hrs:(N=g==null?void 0:g.callbackHrs)!=null?N:"",callback_mins:(H=g==null?void 0:g.callbackMins)!=null?H:"",endcall_type:"CLOSE"};return Z.post(A.END_CALL,y).then(E=>(v.endCall(),u(E==null?void 0:E.data),i(!0),E==null?void 0:E.data)).catch(E=>{var M;return o(!0),m(E),(M=E==null?void 0:E.response)==null?void 0:M.data}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:s,isError:r,error:d,data:h}};import{useCallback as Es,useState as ke}from"react";var Ts=()=>{let[e,t]=ke(!1),[s,i]=ke(!1),[r,o]=ke(!1),[d,m]=ke(null),[h,u]=ke(null);return{handleStartCall:Es(async g=>{var y,x,S,O,P,k,I,U,K;let l=JSON.parse((y=localStorage.getItem("call-control-sdk-state"))!=null?y:"");if(t(!0),((x=l==null?void 0:l.callData)==null?void 0:x.status)==="IDLE"){let B={action:"CALL",userId:l==null?void 0:l.agentId,phone_number:g==null?void 0:g.mobileNumber};return Z.post(A.CLICK_TO_CALL,B).then(_=>(u(_==null?void 0:_.data),i(!0),_==null?void 0:_.data)).catch(_=>{var f;return o(!0),m(_),(f=_==null?void 0:_.response)==null?void 0:f.data}).finally(()=>{t(!1)})}else if(((S=l==null?void 0:l.callData)==null?void 0:S.status)==="ONCALL"){let B=(P=(O=l==null?void 0:l.conferenceLine)==null?void 0:O.filter(f=>f.line!==1))==null?void 0:P.find(f=>f.status==="IDLE"&&!(f!=null&&f.isCallStart)),_={action:"EXTERNAL_CONFERENCE",operation:`CALL${B.line}`,line_used:String(B.line),thirdparty_no:g==null?void 0:g.mobileNumber,userid:(I=(k=l.callData)==null?void 0:k.agent_id)!=null?I:"",process:(K=(U=l.callData)==null?void 0:U.process_name)!=null?K:""};return Z.post(A.CONFERENCE_CALL,_).then(f=>(u(f==null?void 0:f.data),i(!0),v.setConferenceLine(V(c({},B),{isCallStart:!0,status:"ONCALL",phone:g==null?void 0:g.mobileNumber})),f==null?void 0:f.data)).catch(f=>{var b;return o(!0),m(f),(b=f==null?void 0:f.response)==null?void 0:b.data}).finally(()=>{t(!1)})}else alert("Agent is not ready")},[]),isLoading:e,isSuccess:s,isError:r,error:d,data:h}};import{ArrowDropDown as Js,CallEnd as Vs,Close as Qs,DragIndicator as Qo,Group as Zs,Layers as ea,Mic as ta,MicOff as oa,Pause as sa,Pending as aa,Phone as na,PlayArrow as ia,SupportAgent as la,TransferWithinAStation as ra,Upcoming as ca,WifiCalling3 as pa}from"@mui/icons-material";import{Box as re,Button as Se,Chip as ut,CircularProgress as Oe,Fade as Zo,IconButton as ot,Menu as gt,MenuItem as es,Paper as ts,TextField as da,Tooltip as me,Typography as os,useTheme as ua}from"@mui/material";import{useCallback as ga,useEffect as st,useRef as fa,useState as ne}from"react";import{useCallback as Ve,useRef as ct,useState as Ho}from"react";function pt(e,t){let[s,i]=Ho(e),[r,o]=Ho(!1),d=ct(),m=ct({x:0,y:0}),h=ct({x:0,y:0}),u=Ve(y=>{let x=d.current;if(!x)return;let S=x.getBoundingClientRect(),O=window.innerWidth,P=window.innerHeight,k={x:Math.max(0,Math.min(y.x,O-S.width)),y:Math.max(0,Math.min(y.y,P-S.height))};i(k),t==null||t(k)},[t]),C=Ve((y,x)=>{o(!0),m.current={x:y,y:x},h.current=s;let S=(I,U)=>{let K=I-m.current.x,B=U-m.current.y;u({x:h.current.x+K,y:h.current.y+B})},O=I=>{I.preventDefault(),S(I.clientX,I.clientY)},P=I=>{I.preventDefault();let U=I.touches[0];U&&S(U.clientX,U.clientY)},k=()=>{o(!1),document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",k),document.removeEventListener("touchmove",P),document.removeEventListener("touchend",k)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",k),document.addEventListener("touchmove",P,{passive:!1}),document.addEventListener("touchend",k)},[s,u]),g=Ve(y=>{y.preventDefault(),C(y.clientX,y.clientY)},[C]),l=Ve(y=>{y.preventDefault();let x=y.touches[0];x&&C(x.clientX,x.clientY)},[C]);return{position:s,isDragging:r,dragRef:d,handleMouseDown:g,handleTouchStart:l}}import{useState as Ls,useEffect as Ds}from"react";function xe(){let[e,t]=Ls(v.getState());return Ds(()=>v.subscribe(()=>{t(v.getState())}),[]),e}import{useCallback as Ns,useReducer as As}from"react";import{createContext as Is,useContext as _s,useState as dt}from"react";import{Snackbar as Rs,Alert as ws}from"@mui/material";import{jsx as $o,jsxs as ks}from"react/jsx-runtime";var zo=Is(void 0),Ne=()=>{let e=_s(zo);if(!e)throw new Error("useToast must be used inside ToastProvider");return e},qo=({children:e})=>{let[t,s]=dt(!1),[i,r]=dt(""),[o,d]=dt("info"),m=(h,u="info")=>{r(h),d(u),s(!0)};return ks(zo.Provider,{value:{showToast:m},children:[e,$o(Rs,{open:t,color:o,autoHideDuration:3e3,onClose:()=>s(!1),anchorOrigin:{vertical:"top",horizontal:"right"},children:$o(ws,{variant:"filled",severity:o,onClose:()=>s(!1),sx:{width:"100%"},children:i})})]})};var Ps={isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null},Os=(e,t)=>{if(t.type==="isLoading")return V(c({},e),{isLoading:t.payload});if(t.type==="isSuccess")return V(c({},e),{isSuccess:!0,data:t.payload});if(t.type==="isError")return V(c({},e),{isError:!0,error:t.payload});if(t.type==="reset")return{isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null};throw Error("Unknown action.")};var oe=(e={})=>{let{onSuccess:t=null,onError:s=null}=e,{showToast:i}=Ne(),[r,o]=As(Os,Ps);return[Ns((m,h,u={})=>{o({type:"isLoading",payload:!0}),Z.post(m,h,u).then(C=>{var g,l;o({type:"isSuccess",payload:C.data}),t==null||t(C.data,h),console.log((g=C.data)==null?void 0:g.message,"res45"),i((l=C.data)==null?void 0:l.message,"success")}).catch(C=>{var l,y,x,S,O,P,k,I,U,K,B,_;let g={status:(y=(l=C.response)==null?void 0:l.status)!=null?y:500,message:((S=(x=C.response)==null?void 0:x.data)==null?void 0:S.detail)||((P=(O=C.response)==null?void 0:O.data)==null?void 0:P.message)||C.message||"An unknown error occurred",data:(I=(k=C.response)==null?void 0:k.data)!=null?I:null,statusText:(K=(U=C.response)==null?void 0:U.statusText)!=null?K:"",code:(B=C==null?void 0:C.code)!=null?B:"",name:(_=C==null?void 0:C.name)!=null?_:""};i(g.message,"error"),o({type:"isError",payload:g}),s==null||s(g,h)}).finally(()=>{o({type:"isLoading",payload:!1})})},[t,s,i]),r]};import{Call as Ze,CallEnd as Fo,CallSplit as Bs,Close as tt,Mic as Hs,MicOff as $s,Pause as zs,PhoneDisabled as qs,PlayArrow as Fs,SupportAgent as et}from"@mui/icons-material";import{Box as G,Button as ee,Dialog as Pe,IconButton as ge,Paper as be,TextField as Ce,Typography as Q,Autocomplete as Wo,Grid as ye,Tooltip as Ae,useTheme as Ws,TableContainer as Gs,Table as Ks,TableHead as js,TableRow as Go,TableCell as le,TableBody as Ys,CircularProgress as he}from"@mui/material";import{useEffect as Ko,useState as ue}from"react";import{useTheme as Ms}from"@mui/material";var Us=()=>{let e=Ms();return{disabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",border:"1px solid rgb(206, 204, 204)",height:"40px","&:hover":{boxShadow:" 0px 2px 2px rgba(0, 0, 0, 0.79)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},enabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},outlined:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",backgroundColor:e.palette.grey[200],boxShadow:`0px 2px 1px ${e.palette.primary.light}`,border:`0px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:`0px 2px 1px ${e.palette.primary.main}`,border:`0px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}}}},Qe=Us;import{Fragment as ve,jsx as a,jsxs as D}from"react/jsx-runtime";var Xs=({each:e})=>{var _,f;let t=xe(),{showToast:s}=Ne(),{disabled:i,enabled:r,outlined:o}=Qe(),d=Ws(),[m,h]=ue(!1),[u,C]=ue(!1),[g,l]=ue(!1),[y,x]=ue(!1),[S,O]=ue(!1),P=(b,R)=>{v.setConferenceLine(c(c({},b),R))},k=(b,R)=>{var E,M,F,z;let N=c(c({},b),R);h(!0);let H={action:"EXTERNAL_CONFERENCE",operation:`CALL${N.line}`,line_used:String(N.line),thirdparty_no:N.phone,userid:(M=(E=t.callData)==null?void 0:E.agent_id)!=null?M:"",process:(z=(F=t.callData)==null?void 0:F.process_name)!=null?z:""};Z.post(A.CONFERENCE_CALL,H).then(w=>{var L;s((L=w.data)==null?void 0:L.message,"success"),v.setConferenceLine(c(c({},b),R))}).catch(w=>{var q,j,Y,X;let L=((j=(q=w.response)==null?void 0:q.data)==null?void 0:j.detail)||((X=(Y=w.response)==null?void 0:Y.data)==null?void 0:X.message)||w.message||"An unknown error occurred";s(L,"error")}).finally(()=>{h(!1)})},I=(b,R)=>{var E,M,F,z;let N=c(c({},b),R);C(!0);let H={action:"EXTERNAL_CONFERENCE",operation:"CONFERENCE",line_used:String(N.line),thirdparty_no:N.phone,userid:(M=(E=t.callData)==null?void 0:E.agent_id)!=null?M:"",process:(z=(F=t.callData)==null?void 0:F.process_name)!=null?z:""};Z.post(A.CONFERENCE_CALL,H).then(w=>{var L;s((L=w.data)==null?void 0:L.message,"success"),v.setConferenceLine(c(c({},b),R))}).catch(w=>{var q,j,Y,X;let L=((j=(q=w.response)==null?void 0:q.data)==null?void 0:j.detail)||((X=(Y=w.response)==null?void 0:Y.data)==null?void 0:X.message)||w.message||"An unknown error occurred";s(L,"error")}).finally(()=>{C(!1)})},U=(b,R,N)=>{var M,F,z,w;let H=c(c({},b),R);l(!0);let E={action:"EXTERNAL_CONFERENCE",operation:N,hold_channel_no:N==="HOLDUSER"?`hold${H.line}`:`unhold${H.line}`,userid:(F=(M=t.callData)==null?void 0:M.agent_id)!=null?F:"",process:(w=(z=t.callData)==null?void 0:z.process_name)!=null?w:""};Z.post(A.CONFERENCE_CALL_HOLD_OR_UN_HOLD,E).then(L=>{var q;s((q=L.data)==null?void 0:q.message,"success"),v.setConferenceLine(c(c({},b),R))}).catch(L=>{var j,Y,X,ie;let q=((Y=(j=L.response)==null?void 0:j.data)==null?void 0:Y.detail)||((ie=(X=L.response)==null?void 0:X.data)==null?void 0:ie.message)||L.message||"An unknown error occurred";s(q,"error")}).finally(()=>{l(!1)})},K=(b,R,N)=>{var M,F,z,w;let H=c(c({},b),R);x(!0);let E={action:"EXTERNAL_CONFERENCE",operation:N,channel_no:N==="MUTEUSER"?`mute${H.line}`:`play${H.line}`,userid:(F=(M=t.callData)==null?void 0:M.agent_id)!=null?F:"",thirdparty_no:H.phone,process:(w=(z=t.callData)==null?void 0:z.process_name)!=null?w:""};Z.post(A.CONFERENCE_CALL_MUTE_OT_UN_MUTE,E).then(L=>{var q;s((q=L.data)==null?void 0:q.message,"success"),v.setConferenceLine(c(c({},b),R))}).catch(L=>{var j,Y,X,ie;let q=((Y=(j=L.response)==null?void 0:j.data)==null?void 0:Y.detail)||((ie=(X=L.response)==null?void 0:X.data)==null?void 0:ie.message)||L.message||"An unknown error occurred";s(q,"error")}).finally(()=>{x(!1)})},B=(b,R)=>{var E,M,F,z;let N=c(c({},b),R);O(!0);let H={action:"EXTERNAL_CONFERENCE",operation:"HANGUP_CHANNEL",line_used:String(N.line-1),user_type:`THIRDPARTY${N.line-1}`,thirdparty_no:N.phone,userid:(M=(E=t.callData)==null?void 0:E.agent_id)!=null?M:"",process:(z=(F=t.callData)==null?void 0:F.process_name)!=null?z:""};Z.post(A.CONFERENCE_CALL_END,H).then(w=>{var L;s((L=w.data)==null?void 0:L.message,"success"),v.setConferenceLine(c(c({},b),R))}).catch(w=>{var q,j,Y,X;let L=((j=(q=w.response)==null?void 0:q.data)==null?void 0:j.detail)||((X=(Y=w.response)==null?void 0:Y.data)==null?void 0:X.message)||w.message||"An unknown error occurred";s(L,"error")}).finally(()=>{O(!1)})};return D(Go,{sx:{border:"2px solid #fff"},children:[a(le,{sx:{padding:"6px"},children:D(Q,{children:["Line ",(_=e==null?void 0:e.line)!=null?_:"",". "]})}),a(le,{sx:{padding:"6px"},children:a(Q,{variant:"body2",sx:{px:1,borderRadius:"10px",width:"80px",maxWidth:"100px"},children:(f=e==null?void 0:e.status)!=null?f:""})}),a(le,{sx:{padding:"6px"},children:a(ee,{sx:{textTransform:"capitalize"},size:"small",children:a(Q,{variant:"body2",children:(e==null?void 0:e.line)===1?"Internal":"External"})})}),a(le,{sx:{padding:"6px"},children:a(Ce,{size:"small",placeholder:"Phone Number",value:(e==null?void 0:e.phone)||"",disabled:(e==null?void 0:e.line)===1,onChange:b=>{P(e,{phone:b.target.value})}})}),a(le,{sx:{padding:"6px"},children:D(G,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around"},children:[a(Ae,{title:"Call",children:a(ee,{variant:e!=null&&e.isCallStart?"outlined":"contained",color:"success",sx:e!=null&&e.isCallStart?c({},i):V(c({},r),{border:`0px solid ${d.palette.success.light}`,"&:hover":{bgcolor:"success.light",boxShadow:`0px 2px 1px ${d.palette.success.light}`,border:`0px solid ${d.palette.success.light}`},"&:active":{bgcolor:"success.light",boxShadow:`inset 1px -2px 4px ${d.palette.primary.light}`}}),onClick:()=>{k(e,{isCallStart:!0,status:"ONCALL"})},disabled:(e==null?void 0:e.isCallStart)||m,children:m?a(he,{size:"20px",color:"success"}):a(Ze,{sx:{color:e!=null&&e.isCallStart?"default":"#e7e7e7ff"}})})}),a(Ae,{title:"Merge Call",children:a(ee,{variant:e!=null&&e.isMergeCall?"contained":"outlined",sx:e!=null&&e.isMergeCall&&(e!=null&&e.isCallStart)?c({},i):e!=null&&e.isCallStart?c({},o):c({},i),onClick:()=>{I(e,{isMergeCall:!0,status:"ONCALL"})},disabled:!(e!=null&&e.isCallStart)||u,children:u?a(he,{size:"20px",sx:{color:e!=null&&e.isMergeCall?"#e7e7e7ff":d.palette.primary.main}}):a(Bs,{})})}),a(Ae,{title:e.isHold?"Hold":"Un Hold",children:a(ee,{variant:e!=null&&e.isHold?"contained":"outlined",sx:e!=null&&e.isHold&&(e!=null&&e.isCallStart)?c({},i):e!=null&&e.isCallStart?c({},o):c({},i),onClick:()=>{e.isHold?U(e,{isHold:!1},"UNHOLDUSER"):U(e,{isHold:!0},"HOLDUSER")},disabled:!(e!=null&&e.isCallStart)||g,children:g?a(he,{size:"20px",sx:{color:d.palette.primary.main}}):e.isHold?a(Fs,{}):a(zs,{})})}),a(Ae,{title:e.isMute?"Mute":"Un Mute",children:a(ee,{variant:e!=null&&e.isMute?"contained":"outlined",sx:e!=null&&e.isMute&&(e!=null&&e.isCallStart)?c({},i):e!=null&&e.isCallStart?c({},o):c({},i),onClick:()=>{e.isMute?K(e,{isMute:!1},"PLAYUSER"):K(e,{isMute:!0},"MUTEUSER")},disabled:!(e!=null&&e.isCallStart)||y,children:y?a(he,{size:"20px",sx:{color:d.palette.primary.main}}):e.isMute?a($s,{}):a(Hs,{})})}),a(Ae,{title:"End Call",children:(e==null?void 0:e.line)!==1?a(ee,{variant:e!=null&&e.isCallStart?"contained":"outlined",color:"error",sx:e!=null&&e.isCallStart?V(c({},r),{minWidth:"60px !important",border:`0px solid ${d.palette.error.light}`,"&:hover":{bgcolor:"error.light",boxShadow:`0px 2px 1px ${d.palette.error.light}`,border:`0px solid ${d.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${d.palette.primary.light}`}}):V(c({},i),{minWidth:"60px !important"}),onClick:()=>{B(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart)||S,children:S?a(he,{size:"20px",color:"error"}):a(Fo,{})}):a(ee,{variant:e!=null&&e.isCallStart?"contained":"outlined",sx:V(c({},i),{visibility:"hidden",minWidth:"60px !important"}),onClick:()=>{B(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart),children:a(Q,{children:a(Fo,{sx:{visibility:"hidden"}})})})})]})})]},e.line)};function jo({open:e,setOpen:t}){var h;let s=xe(),{showToast:i}=Ne(),[r,o]=ue(!1),d=()=>{t(!1)},m=()=>{var C,g,l,y;o(!0);let u={action:"EXTERNAL_CONFERENCE",operation:"ENDCONFERENCE",userid:(g=(C=s.callData)==null?void 0:C.agent_id)!=null?g:"",process:(y=(l=s.callData)==null?void 0:l.process_name)!=null?y:""};Z.post(A.CONFERENCE_CALL_END_ALL,u).then(x=>{var S;i((S=x.data)==null?void 0:S.message,"success"),v.resetConferenceLines(),d()}).catch(x=>{var O,P,k,I;let S=((P=(O=x.response)==null?void 0:O.data)==null?void 0:P.detail)||((I=(k=x.response)==null?void 0:k.data)==null?void 0:I.message)||x.message||"An unknown error occurred";i(S,"error")}).finally(()=>{o(!1)})};return Ko(()=>{var C,g,l,y;let u={line:1,status:(g=(C=s.callData)==null?void 0:C.status)!=null?g:"",type:"internal",phone:(y=(l=s.callData)==null?void 0:l.phone_number)!=null?y:"",isMute:!1,isHold:!1,isMergeCall:!1,isCallStart:!0};v.setConferenceLine(u)},[]),a(ve,{children:a(Pe,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:D(be,{sx:{borderRadius:2},children:[D(G,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px"},children:[D(Q,{variant:"body1",children:[(h=s==null?void 0:s.agentId)!=null?h:""," conference"]}),a(ge,{onClick:d,children:a(tt,{})})]}),a(G,{sx:{boxShadow:"1px 1px 2px #e7e5e5ff",margin:"0px 15px",borderRadius:"20px"},children:a(Gs,{component:be,sx:{outline:"0px solid gray !important",boxShadow:"1px 1px 6px #e7e5e5ff"},children:D(Ks,{sx:{border:"4px solid #ffffff !important"},children:[a(js,{children:D(Go,{sx:{border:"2px solid #f3f3f3ff !important"},children:[a(le,{sx:{padding:"6px"},children:"Line"}),a(le,{sx:{padding:"6px"},children:"Status"}),a(le,{sx:{padding:"6px"},children:"Call Type"}),a(le,{sx:{padding:"6px"},children:"Mobile Number"}),a(le,{sx:{padding:"6px"},children:"Call Actions"})]})}),a(Ys,{children:s==null?void 0:s.conferenceLine.map(u=>a(Xs,{each:u}))})]})})}),a(G,{textAlign:"center",m:2,children:D(ee,{variant:"outlined",color:"error",size:"large",onClick:m,disabled:r,sx:{px:2,borderRadius:"20px",textTransform:"capitalize"},children:[r?a(he,{size:"20px",color:"error",sx:{marginRight:"8px"}}):a(ge,{sx:{bgcolor:"error.main","&:hover":{bgcolor:"error.dark"},marginRight:"8px",width:"28px",height:"28px",fontSize:"12px",fontWeight:"600",lineHeight:"16px",letterSpacing:"0.02em",textTransform:"capitalize",color:"white",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%"},children:a(qs,{sx:{color:"white",fontSize:"16px",fontWeight:"600"}})}),"End Conference"]})})]})})})}function Yo({open:e,setOpen:t}){var l,y,x,S,O,P,k,I,U,K,B,_;let[s]=oe({onSuccess:f=>{console.log("res",f),t(!1)},onError:f=>{console.log("error",f)}}),i=xe(),[r,o]=ue("process"),[d,{data:m}]=oe(),[h,{data:u}]=oe(),C=()=>{t(!1)},g=(f,b)=>{var R,N,H,E,M,F,z,w,L,q,j,Y,X,ie,Me,Ue,Be,He,Ee,$e,Te,ze,Le,qe,Fe,We,De,Ge,Ke,je,Ye,Xe,Je;if(console.log(f,"data34"),b==="PROCESS"){let fe={mobile_number:(N=(R=i.callData)==null?void 0:R.phone_number)!=null?N:"",userid:(E=(H=i.callData)==null?void 0:H.agent_id)!=null?E:"",type:"PROCESS",transfer_to:(M=f==null?void 0:f.process_name)!=null?M:"",callreferenceid:(z=(F=i.callData)==null?void 0:F.convox_id)!=null?z:"",processid:String((L=(w=i.callData)==null?void 0:w.process_id)!=null?L:""),process_name:(j=(q=i.callData)==null?void 0:q.process_name)!=null?j:""};s(A.TRANSFER_CALL,fe)}else if(b==="QUEUE"){let fe={mobile_number:(X=(Y=i.callData)==null?void 0:Y.phone_number)!=null?X:"",userid:(Me=(ie=i.callData)==null?void 0:ie.agent_id)!=null?Me:"",type:"QUEUE",transfer_to:(Ue=f==null?void 0:f.queue_name)!=null?Ue:"",callreferenceid:(He=(Be=i.callData)==null?void 0:Be.convox_id)!=null?He:"",processid:String(($e=(Ee=i.callData)==null?void 0:Ee.process_id)!=null?$e:""),process_name:(ze=(Te=i.callData)==null?void 0:Te.process_name)!=null?ze:""};s(A.TRANSFER_CALL,fe)}else if(b==="AGENT"){let fe={mobile_number:(qe=(Le=i.callData)==null?void 0:Le.phone_number)!=null?qe:"",userid:(We=(Fe=i.callData)==null?void 0:Fe.agent_id)!=null?We:"",type:"AGENT",transfer_to:(De=f==null?void 0:f.user_id)!=null?De:"",callreferenceid:(Ke=(Ge=i.callData)==null?void 0:Ge.convox_id)!=null?Ke:"",processid:String((Ye=(je=i.callData)==null?void 0:je.process_id)!=null?Ye:""),process_name:(Je=(Xe=i.callData)==null?void 0:Xe.process_name)!=null?Je:""};s(A.TRANSFER_CALL,fe)}};return Ko(()=>{d(A.AGENTS_LIST,{status:"IDLE",active:!0}),h(A.TRANSFER_TO_DETAILS,{status:"ACTIVE",active:!0})},[]),console.log(m,"idleAgentsList"),a(ve,{children:a(Pe,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:D(be,{sx:{borderRadius:2},children:[D(G,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[a(Q,{variant:"body1",children:" Call Transfer"}),a(ge,{onClick:C,children:a(tt,{})})]}),D(G,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:[D(G,{sx:{display:"flex",gap:1},children:[a(ee,{variant:r==="process"?"contained":"outlined",onClick:()=>o("process"),children:"Process"}),a(ee,{variant:r==="queues"?"contained":"outlined",onClick:()=>o("queues"),children:"Queues"}),a(ee,{variant:r==="agents"?"contained":"outlined",onClick:()=>o("agents"),children:"Agents"})]}),r==="process"&&a(G,{sx:{display:"flex",gap:1},children:(l=u==null?void 0:u.data)!=null&&l.process&&((x=(y=u==null?void 0:u.data)==null?void 0:y.process)==null?void 0:x.length)>0?(O=(S=u==null?void 0:u.data)==null?void 0:S.process)==null?void 0:O.map((f,b)=>D(G,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px","&:hover":{bgcolor:"action.selected"}},children:[D(Q,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(et,{sx:{marginRight:"4px"}}),f.process_name]}),a(ge,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{g(f,"PROCESS")},children:a(Ze,{})})]},b)):a(Q,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",textAlign:"center",width:"100%",margin:"10px 0px",color:"gray"},children:"No Process Found"})}),r==="queues"&&a(G,{sx:{display:"flex",gap:1},children:(P=u==null?void 0:u.data)!=null&&P.queue&&((I=(k=u==null?void 0:u.data)==null?void 0:k.queue)==null?void 0:I.length)>0?(K=(U=u==null?void 0:u.data)==null?void 0:U.queue)==null?void 0:K.map((f,b)=>{var R,N,H,E,M,F;return D(G,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px","&:hover":{bgcolor:"action.selected"}},children:[D(Q,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(et,{sx:{marginRight:"4px"}}),f.queue_name,(H=(N=(R=u==null?void 0:u.data)==null?void 0:R.process)==null?void 0:N.find(z=>z.process_id===f.process_id))!=null&&H.process_name?a(Q,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",color:"gray"},children:"("+((F=(M=(E=u==null?void 0:u.data)==null?void 0:E.process)==null?void 0:M.find(z=>z.process_id===f.process_id))==null?void 0:F.process_name)+")"}):""]}),a(ge,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{g(f,"QUEUE")},children:a(Ze,{})})]},b)}):a(Q,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",textAlign:"center",width:"100%",margin:"10px 0px",color:"gray"},children:"No Queues Found"})}),r==="agents"&&a(G,{sx:{display:"flex",gap:1},children:m!=null&&m.data&&((B=m==null?void 0:m.data)==null?void 0:B.length)>0?(_=m==null?void 0:m.data)==null?void 0:_.map((f,b)=>D(G,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px","&:hover":{bgcolor:"action.selected"}},children:[D(Q,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(et,{sx:{marginRight:"4px"}}),f.name]}),a(ge,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{g(f,"AGENT")},children:a(Ze,{})})]},b)):a(Q,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",textAlign:"center",width:"100%",margin:"10px 0px",color:"gray"},children:"No Agents Found"})})]})]})})})}function Xo({open:e,setOpen:t,onSubmitDisposition:s}){var C,g;let[i,r]=ue({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""}),o=[{label:"Not Interested",value:"NI"},{label:"Resolved",value:"RES"}],d=[{label:"Yes",value:"Y"},{label:"No",value:"N"}],m=(l,y)=>{r(x=>V(c({},x),{[l]:y}))},h=()=>{r({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""})},u=()=>{h(),t(!1)};return a(ve,{children:a(Pe,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"xs",children:D(be,{sx:{borderRadius:2},children:[a(G,{sx:{display:"flex",justifyContent:"center",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:D(Q,{variant:"body1",m:1,children:[" ","Call Disposition"]})}),a(G,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"10px",margin:"10px",borderRadius:"10px"},children:D(ye,{container:!0,spacing:2,children:[a(ye,{size:6,children:a(Wo,{value:i.disposition,options:o,getOptionLabel:l=>l.label,onChange:(l,y)=>m("disposition",y),size:"small",renderInput:l=>a(Ce,V(c({},l),{label:"Disposition",fullWidth:!0}))})}),a(ye,{size:6,children:a(Wo,{options:d,getOptionLabel:l=>l.label,value:i.followUp,onChange:(l,y)=>m("followUp",y),size:"small",renderInput:l=>a(Ce,V(c({},l),{label:"Follow Up",fullWidth:!0}))})}),((g=(C=i==null?void 0:i.followUp)==null?void 0:C.label)==null?void 0:g.toLowerCase())==="yes"&&D(ve,{children:[a(ye,{size:6,children:a(Ce,{size:"small",label:"Callback Date",type:"date",slotProps:{inputLabel:{shrink:!0}},value:i.callbackDate,onChange:l=>m("callbackDate",l.target.value),fullWidth:!0})}),a(ye,{size:6,children:a(Ce,{size:"small",label:"Hours (0-23)",type:"text",inputProps:{min:0,max:23},value:i.callbackHrs,onChange:l=>m("callbackHrs",l.target.value),fullWidth:!0})}),a(ye,{size:6,children:a(Ce,{size:"small",label:"Minutes (0-59)",type:"text",inputProps:{min:0,max:59},value:i.callbackMins,onChange:l=>m("callbackMins",l.target.value),fullWidth:!0})})]})]})}),D(G,{textAlign:"right",m:2,children:[a(ee,{variant:"outlined",color:"error",size:"large",onClick:u,sx:{px:2,mx:1,borderRadius:"10px",textTransform:"capitalize"},children:"cancel"}),a(ee,{variant:"contained",color:"primary",size:"large",onClick:()=>s(i),sx:{px:2,borderRadius:"10px",textTransform:"capitalize"},children:"Submit"})]})]})})})}function Jo({open:e,setOpen:t,processList:s=null,handleSelectedProcessor:i}){var o,d;return a(ve,{children:a(Pe,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",maxWidth:"xs",children:D(be,{sx:{borderRadius:2},children:[D(G,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[a(Q,{variant:"body1",children:" Process List"}),a(ge,{onClick:()=>{t(!1)},children:a(tt,{})})]}),a(G,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:((o=s==null?void 0:s.processes)==null?void 0:o.length)>0?(d=s==null?void 0:s.processes)==null?void 0:d.map((m,h)=>a(G,{sx:{p:1,display:"flex",alignItems:"center",boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px",margin:"10px 0px",borderRadius:"10px",cursor:"pointer","&:hover":{bgcolor:"action.selected"}},onClick:()=>{i(m)},children:D(Q,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[a(et,{sx:{marginRight:"4px"}}),m.process_name]})},h)):null})]})})})}function Vo({open:e,setOpen:t}){return a(ve,{children:a(Pe,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:D(be,{sx:{borderRadius:2},children:[D(G,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[a(Q,{variant:"body1",children:" Call History"}),a(ge,{onClick:()=>{t(!1)},children:a(tt,{})})]}),a(G,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",margin:"10px",borderRadius:"10px",textAlign:"center",fontSize:"16px",fontWeight:"bold"},p:6,children:"Coming Soon..."})]})})})}import{Fragment as ma,jsx as p,jsxs as ce}from"react/jsx-runtime";function ss({onDataChange:e}){var mt,xt,yt,Ct,ht,bt,vt,St,Et,Tt,Lt,Dt,It,_t,Rt,wt,kt,Nt,At,Pt,Ot,Mt,Ut,Bt,Ht,$t,zt,qt,Ft,Wt,Gt,Kt,jt,Yt,Xt,Jt,Vt,Qt,Zt,eo,to,oo,so,ao,no,io,lo,ro,co,po,uo,go,fo,mo,xo,yo,Co,ho,bo,vo,So,Eo,To,Lo,Do,Io;let t=ua(),{disabled:s,enabled:i,outlined:r}=Qe(),o=xe(),d=fa(null),[m,h]=ne(null),[u,C]=ne(!0),[g,l]=ne(null),[y,x]=ne(null),[S,O]=ne(!1),[P,k]=ne(!1),[I,U]=ne(!1),[K,B]=ne(!1),[_,f]=ne(!1),[b,R]=ne(""),[N,H]=ne(0),{position:E,isDragging:M,dragRef:F,handleMouseDown:z,handleTouchStart:w}=pt(o.controlPanelPosition,n=>v.setControlPanelPosition(n)),{position:L,isDragging:q,dragRef:j,handleMouseDown:Y,handleTouchStart:X}=pt(o.iframePosition,n=>v.setIframePosition(n)),[ie,{data:Me}]=oe({onSuccess:n=>{var T;console.log("res",n),n&&n.data&&((T=n==null?void 0:n.data)==null?void 0:T.length)>1?B(!0):(v.setProcess(n==null?void 0:n.data[0]),B(!1))},onError:()=>{B(!1)}}),[Ue,{isLoading:Be}]=oe(),[He,{isLoading:Ee}]=oe({onSuccess:()=>{v.setHolding(!o.isHolding)},onError:n=>{console.log("error",n)}}),[$e,{isLoading:Te}]=oe({onSuccess:()=>{v.setMuted(!o.isMuted)},onError:n=>{console.log("error",n)}}),[ze,{isLoading:Le}]=oe(),[qe,{isLoading:Fe}]=oe(),[We,{isLoading:De}]=oe(),Ge=ga(n=>{let T=Math.floor(n/60),J=n%60;return`${T.toString().padStart(2,"0")}:${J.toString().padStart(2,"0")}`},[]),Ke=()=>{h(null)},je=n=>{C(!0),x(n.currentTarget),v.setStatus("dial")},Ye=()=>{o.status!=="on call"&&v.setStatus("idle"),x(null)},Xe=n=>{l(n.currentTarget)},Je=()=>{l(null)},fe=()=>{let n={action:"READYAGENT",userId:o.agentId};ze(A.READY_AGENT,n)},ft=n=>{l(null);let T={action:"AGENTBREAK",break_type:n,userId:o.agentId};qe(A.UPDATE_AGENT_BREAK,T)},is=n=>{if(n.length!==10)alert("Invalid phone number");else if(/^\d+$/.test(n)){let T={action:"CALL",phone_number:n,userId:o.agentId};Ue(A.CLICK_TO_CALL,T)}},ls=()=>{let n={action:o.isHolding?"UNHOLD":"HOLD",userId:o.agentId};He(A.HOLD_CALL,n)},rs=()=>{let n={action:o.isMuted?"UNMUTE":"MUTE",userId:o.agentId};$e(A.MUTE_CALL,n)},cs=n=>{var J,se,ae,pe,de,Ie,_e,_o,Ro,wo,ko,No,Ao,Po,Oo,Mo;console.log("data",n);let T={action:"ENDCALL",userId:o.agentId,processid:(ae=(se=(J=o.process)==null?void 0:J.process_id)==null?void 0:se.toString())!=null?ae:"",process_name:(de=(pe=o.process)==null?void 0:pe.process_name)!=null?de:"",callreferenceid:(_e=(Ie=o.callData)==null?void 0:Ie.convox_id)!=null?_e:"",mobile_number:(Ro=(_o=o.callData)==null?void 0:_o.phone_number)!=null?Ro:"",disposition:(ko=(wo=n==null?void 0:n.disposition)==null?void 0:wo.value)!=null?ko:"",set_followUp:(Ao=(No=n==null?void 0:n.followUp)==null?void 0:No.value)!=null?Ao:"",callback_date:(Po=n==null?void 0:n.callbackDate)!=null?Po:"",callback_hrs:(Oo=n==null?void 0:n.callbackHrs)!=null?Oo:"",callback_mins:(Mo=n==null?void 0:n.callbackMins)!=null?Mo:"",endcall_type:"CLOSE"};R(""),We(A.END_CALL,T),v.endCall(),U(!1)};return st(()=>{let n;return o.callData.status&&o.callData.status==="ONCALL"?n=setInterval(()=>{let T=Math.floor((Date.now()-o.callStartTime)/1e3);H(T)},1e3):H(0),()=>{n&&clearInterval(n)}},[o.callData.status]),st(()=>{e&&e(o.callData)},[o.callData,e]),st(()=>{o.agentId?ie(A.PROCESS_LIST,{userId:o.agentId,action:"GETAGENTPROCESSLIST",refno:"1234221233"}):console.log("No agentId available, skipping API call")},[o.agentId]),st(()=>(o.agentId&&(d.current=new WebSocket(`${Bo.WS}?agent_id=${o.agentId}`),d.current.onopen=()=>{console.log("WebSocket connection established")},d.current.onmessage=n=>{try{let T=JSON.parse(n.data);console.log("parsedJSON:",T),v.updateCallData(T),T.status==="ONCALL"&&v.startCall(),T.status==="WRAPUP"&&v.endCall()}catch(T){console.log("Raw message:",n.data)}},d.current.onclose=()=>{console.log("WebSocket connection closed")},d.current.onerror=n=>{console.error("WebSocket error:",n)}),()=>{var n;(n=d.current)==null||n.close()}),[o.agentId]),!o.isInitialized||!o.process?p(re,{children:!!K&&p(Jo,{processList:Me,open:K,setOpen:B,handleSelectedProcessor:n=>{v.setProcess(n)}})}):ce(ma,{children:[p(Zo,{in:!0,timeout:300,children:p(ts,{ref:F,elevation:M?4:1,sx:{position:"fixed",left:E.x,top:E.y,p:.5,borderRadius:3,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),userSelect:"none"},children:ce(re,{sx:{display:"flex",alignItems:"center"},children:[ce(re,{sx:{display:"flex",alignItems:"center"},children:[ce(ot,{component:"div",size:"small",sx:{cursor:"all-scroll"},onMouseDown:z,onTouchStart:w,children:[p(Qo,{})," "]}),p(re,{sx:{marginRight:"10px"},children:p(me,{title:"Dial",children:p(ot,{size:"small",onClick:n=>{var T,J,se,ae,pe,de,Ie,_e;((J=(T=o.callData)==null?void 0:T.status)==null?void 0:J.toUpperCase())!=="ONCALL"&&((ae=(se=o.callData)==null?void 0:se.status)==null?void 0:ae.toUpperCase())!=="BREAK"&&((de=(pe=o.callData)==null?void 0:pe.status)==null?void 0:de.toUpperCase())!=="RINGING"&&((_e=(Ie=o.callData)==null?void 0:Ie.status)==null?void 0:_e.toUpperCase())!=="WRAPUP"&&je(n)},sx:{bgcolor:"action.hover","&:hover":{bgcolor:"warning"}},children:p(pa,{sx:{color:((xt=(mt=o.callData)==null?void 0:mt.status)==null?void 0:xt.toUpperCase())==="ONCALL"||((Ct=(yt=o.callData)==null?void 0:yt.status)==null?void 0:Ct.toUpperCase())==="BREAK"||((bt=(ht=o.callData)==null?void 0:ht.status)==null?void 0:bt.toUpperCase())==="RINGING"||((St=(vt=o.callData)==null?void 0:vt.status)==null?void 0:St.toUpperCase())==="WRAPUP"?"action.selected":"success.main"}})})})}),p(os,{sx:{color:"success.main",width:"40px",marginRight:"10px"},children:Ge(N)}),Fe||Le?p(re,{sx:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},children:p(Oe,{size:"20px"})}):p(os,{variant:"body2",sx:{fontWeight:"bold",textAlign:"right"},children:(Lt=(Tt=(Et=o.callData)==null?void 0:Et.status)==null?void 0:Tt.toUpperCase())!=null?Lt:"N/A"}),p(re,{onClick:Xe,sx:{display:"flex",alignItems:"center",margin:"6px",cursor:"pointer"},children:p(Js,{})})]}),ce(re,{sx:{display:"flex",gap:1,justifyContent:"center",alignItems:"center"},children:[p(me,{title:"Agent Ready",children:p(Se,{variant:((It=(Dt=o.callData)==null?void 0:Dt.status)==null?void 0:It.toUpperCase())==="BREAK"||((Rt=(_t=o.callData)==null?void 0:_t.status)==null?void 0:Rt.toUpperCase())==="MISSED"?"outlined":"contained",onClick:n=>{var T,J,se,ae;(((J=(T=o.callData)==null?void 0:T.status)==null?void 0:J.toUpperCase())==="BREAK"||((ae=(se=o.callData)==null?void 0:se.status)==null?void 0:ae.toUpperCase())==="MISSED")&&(n.stopPropagation(),fe())},classes:{root:((kt=(wt=o.callData)==null?void 0:wt.status)==null?void 0:kt.toUpperCase())==="BREAK"||((At=(Nt=o.callData)==null?void 0:Nt.status)==null?void 0:At.toUpperCase())==="MISSED"?"outlined":"enabled"},sx:c({},((Ot=(Pt=o.callData)==null?void 0:Pt.status)==null?void 0:Ot.toUpperCase())==="BREAK"||((Ut=(Mt=o.callData)==null?void 0:Mt.status)==null?void 0:Ut.toUpperCase())==="MISSED"?r:i),disabled:Le,children:p(la,{})})}),p(me,{title:o.isHolding?"Resume":"Hold",children:p(Se,{variant:o.isHolding&&((Ht=(Bt=o.callData)==null?void 0:Bt.status)==null?void 0:Ht.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:n=>{n.stopPropagation(),ls()},sx:o.isHolding&&((zt=($t=o.callData)==null?void 0:$t.status)==null?void 0:zt.toUpperCase())==="ONCALL"?c({},i):((Ft=(qt=o.callData)==null?void 0:qt.status)==null?void 0:Ft.toUpperCase())==="ONCALL"?c({},r):c({},s),disabled:((Gt=(Wt=o.callData)==null?void 0:Wt.status)==null?void 0:Gt.toUpperCase())!=="ONCALL"&&!o.isHolding||Ee,children:Ee?p(Oe,{size:"20px",sx:{color:t.palette.primary.main}}):o.isHolding?p(ia,{}):p(sa,{})})}),p(me,{title:o.isMuted?"Unmute":"Mute",children:p(Se,{variant:o.isMuted&&((jt=(Kt=o.callData)==null?void 0:Kt.status)==null?void 0:jt.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:n=>{n.stopPropagation(),rs()},sx:o.isMuted&&((Xt=(Yt=o.callData)==null?void 0:Yt.status)==null?void 0:Xt.toUpperCase())==="ONCALL"?c({},i):((Vt=(Jt=o.callData)==null?void 0:Jt.status)==null?void 0:Vt.toUpperCase())==="ONCALL"?c({},r):c({},s),disabled:((Zt=(Qt=o.callData)==null?void 0:Qt.status)==null?void 0:Zt.toUpperCase())!=="ONCALL"&&!o.isMuted||Te,children:Te?p(Oe,{size:"20px",sx:{color:t.palette.primary.main}}):o.isMuted?p(oa,{}):p(ta,{})})}),p(me,{title:"Transfer Call",children:p(Se,{variant:P?"contained":"outlined",onClick:n=>{var T,J;((J=(T=o.callData)==null?void 0:T.status)==null?void 0:J.toUpperCase())==="ONCALL"&&(n.stopPropagation(),k(!0))},sx:P?c({},i):((to=(eo=o.callData)==null?void 0:eo.status)==null?void 0:to.toUpperCase())==="ONCALL"?c({},r):c({},s),disabled:((so=(oo=o.callData)==null?void 0:oo.status)==null?void 0:so.toUpperCase())!=="ONCALL",children:p(ra,{})})}),p(me,{title:"Conference Call",children:p(Se,{variant:S?"contained":"outlined",onClick:n=>{var T,J;((J=(T=o.callData)==null?void 0:T.status)==null?void 0:J.toUpperCase())==="ONCALL"&&(n.stopPropagation(),O(!0))},sx:S?c({},i):((no=(ao=o.callData)==null?void 0:ao.status)==null?void 0:no.toUpperCase())==="ONCALL"?c({},r):c({},s),disabled:((lo=(io=o.callData)==null?void 0:io.status)==null?void 0:lo.toUpperCase())!=="ONCALL",children:p(Zs,{})})}),p(me,{title:"End Call",children:p(Se,{variant:((co=(ro=o.callData)==null?void 0:ro.status)==null?void 0:co.toUpperCase())==="ONCALL"||((uo=(po=o.callData)==null?void 0:po.status)==null?void 0:uo.toUpperCase())==="RINGING"||((fo=(go=o.callData)==null?void 0:go.status)==null?void 0:fo.toUpperCase())==="WRAPUP"?"contained":"outlined",onClick:n=>{var T,J,se,ae,pe,de;(((J=(T=o.callData)==null?void 0:T.status)==null?void 0:J.toUpperCase())==="ONCALL"||((ae=(se=o.callData)==null?void 0:se.status)==null?void 0:ae.toUpperCase())==="RINGING"||((de=(pe=o.callData)==null?void 0:pe.status)==null?void 0:de.toUpperCase())==="WRAPUP")&&(n.stopPropagation(),U(!0))},sx:((xo=(mo=o.callData)==null?void 0:mo.status)==null?void 0:xo.toUpperCase())==="ONCALL"||((Co=(yo=o.callData)==null?void 0:yo.status)==null?void 0:Co.toUpperCase())==="RINGING"||((bo=(ho=o.callData)==null?void 0:ho.status)==null?void 0:bo.toUpperCase())==="WRAPUP"?V(c({},i),{borderRight:"1px",backgroundColor:"error.main",minWidth:"60px !important",boxShadow:" 0px 2px 1px #5f3f3f",border:`1px solid ${t.palette.error.light}`,height:"40px","&:hover":{bgcolor:"error.light",boxShadow:" 0px 2px 1px #5f3f3f",border:`0px solid ${t.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${t.palette.primary.light}`}}):V(c({},s),{minWidth:"60px !important"}),disabled:((So=(vo=o.callData)==null?void 0:vo.status)==null?void 0:So.toUpperCase())!=="ONCALL"&&((To=(Eo=o.callData)==null?void 0:Eo.status)==null?void 0:To.toUpperCase())!=="RINGING"&&((Do=(Lo=o.callData)==null?void 0:Lo.status)==null?void 0:Do.toUpperCase())!=="WRAPUP"||De,children:De?p(Oe,{size:"20px",color:"error"}):p(Vs,{})})})]})]})})}),p(Zo,{in:!0,timeout:300,children:ce(ts,{ref:j,elevation:q?4:1,sx:{position:"fixed",left:L.x,top:L.y,p:1,height:"auto",borderRadius:2,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),visibility:u?"visible":"hidden",userSelect:"none"},children:[ce(re,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"all-scroll"},onMouseDown:Y,onTouchStart:X,children:[p(Qo,{sx:{transform:"rotate(90deg)"}})," ",p(ot,{onClick:()=>C(!1),children:p(Qs,{})})]}),p("iframe",{src:`https://h68.deepijatel.in/ConVoxCCS/iframe?agent_id=${o.agentId}&process_id=${(Io=o.process)==null?void 0:Io.process_id}`,height:380,width:420,allow:"camera; microphone; autoplay"})]})}),p(gt,{anchorEl:y,open:!!y,onClose:Ye,onClick:n=>n.stopPropagation(),sx:{zIndex:99999},children:ce(re,{sx:{all:"unset",padding:"10px","&hover":{backgroundColor:"white"}},children:[p(da,{size:"small",value:b,placeholder:"Enter Mobile No.",onChange:n=>{R(n.target.value)}}),p(ot,{color:"info",onClick:()=>{is(b)},children:Be?p(Oe,{size:"20px",sx:{color:t.palette.success.main}}):p(na,{color:"success"})})]})}),ce(gt,{anchorEl:g,open:!!g,onClose:Je,onClick:n=>n.stopPropagation(),sx:{zIndex:99999},children:[p(es,{onClick:()=>ft("Lunch"),children:"- Lunch"}),p(es,{onClick:()=>ft("Tea"),children:"- Tea"})]}),p(gt,{anchorEl:m,open:!!m,onClose:Ke,onClick:n=>n.stopPropagation(),sx:{zIndex:99999},children:ce(re,{sx:{display:"flex",justifyContent:"flex-start",flexDirection:"column",padding:"0px 10px","&hover":{backgroundColor:"white"}},children:[p(ut,{icon:p(ea,{color:"secondary"}),variant:"outlined",label:"Waiting - 25",sx:{margin:"4px 2px"}}),p(ut,{icon:p(aa,{color:"info"}),label:"Pending - 99+",variant:"outlined",sx:{margin:"4px 2px"}}),p(ut,{icon:p(ca,{color:"success"}),variant:"outlined",label:"Upcoming - 66",sx:{margin:"4px 2px"}})]})}),!!S&&p(jo,{open:S,setOpen:O}),!!P&&p(Yo,{open:P,setOpen:k}),!!I&&p(Xo,{open:I,setOpen:U,onSubmitDisposition:cs}),!!_&&p(Vo,{open:_,setOpen:f})]})}import{jsx as xa}from"react/jsx-runtime";var as=({children:e})=>xa(qo,{children:e});import{jsx as ns}from"react/jsx-runtime";function ya({onDataChange:e}){return ns(as,{children:ns(ss,{onDataChange:e})})}function Yn({apiKey:e,tenantId:t,agentId:s}){v.initialize(e,s),it.init({apiKey:e,tenantId:t,agentId:s,baseUrl:$})}export{ya as CallControlPanel,Yn as initSDK,Ts as useClickToCall,Ss as useEndCall,bs as useLogout};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|