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