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