call-control-sdk 5.2.5 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- ### Call Control SDK [![npm version](https://img.shields.io/npm/v/call-control-sdk.svg?color=blue)](https://www.npmjs.com/package/call-control-sdk) [![npm downloads](https://img.shields.io/npm/dm/call-control-sdk.svg?color=green)](https://www.npmjs.com/package/call-control-sdk)
1
+ ### Call Control SDK [![npm version](https://img.shields.io/npm/v/call-control-sdk.svg?color=blue)](https://www.npmjs.com/package/call-control-sdk) [![npm downloads](https://img.shields.io/npm/dm/call-control-sdk.svg?color=green)](https://www.npmjs.com/package/call-control-sdk)
2
2
 
3
3
  A lightweight SDK that provides a **draggable call control panel** and utility hooks for managing calls in real-time. Built with **TypeScript**, **Material-UI**, and designed for **agent productivity**.
4
4
 
5
- #### ✨ Features
5
+ ### ✨ Features
6
6
 
7
7
  - 🎯 **Complete Call Control** – Hold, Mute, Status management, and End Call
8
8
  - 🖱️ **Draggable Interface** – Movable panel with persisted position
@@ -13,21 +13,21 @@ A lightweight SDK that provides a **draggable call control panel** and utility h
13
13
  - 🔧 **TypeScript Support** – Full type safety and IntelliSense
14
14
  - 🎪 **Singleton State** – Consistent shared state across components
15
15
 
16
- [![bundle size](https://img.shields.io/bundlephobia/minzip/call-control-sdk?color=orange&fontSize=12px)](https://bundlephobia.com/package/call-control-sdk)
17
16
 
18
- ##### 📦 Installation
17
+
18
+ ### 📦 Installation [![bundle size](https://img.shields.io/bundlephobia/minzip/call-control-sdk?color=orange&fontSize=12px)](https://bundlephobia.com/package/call-control-sdk)
19
19
 
20
20
  ```bash
21
21
  npm install call-control-sdk
22
22
  ```
23
23
 
24
- ###### 🔑 Peer Dependencies
24
+ ### 🔑 Peer Dependencies
25
25
 
26
26
  ```bash
27
27
  npm install react react-dom axios @mui/material @mui/icons-material @emotion/react @emotion/styled
28
28
  ```
29
29
 
30
- ##### 📚 Table of Contents
30
+ ### 📚 Table of Contents
31
31
 
32
32
  1. [Getting Started](#-getting-started)
33
33
  2. [Core API](#-core-api)
@@ -36,15 +36,16 @@ npm install react react-dom axios @mui/material @mui/icons-material @emotion/rea
36
36
  - [updateCallData](#updatecalldata)
37
37
  3. [Hooks](#-hooks)
38
38
  - [useLogout](#uselogout)
39
+ - [useClickToCall](#useClickToCall)
39
40
  - [useEndCall](#useendcall)
40
41
  4. [Payloads](#-payloads)
41
42
  5. [Control Features](#-control-features)
42
43
  6. [Browser Support](#-browser-support)
43
44
  7. [License](#-license)
44
45
 
45
- ##### 🚀 Getting Started
46
+ ### 🚀 Getting Started
46
47
 
47
- ### 1. Initialize the SDK
48
+ #### 1. Initialize the SDK
48
49
 
49
50
  ```tsx
50
51
  import { useEffect } from "react";
@@ -70,7 +71,7 @@ function App() {
70
71
  }
71
72
  ```
72
73
 
73
- ### 2. Add the Call Control Panel
74
+ #### 2. Add the Call Control Panel
74
75
 
75
76
  ```tsx
76
77
  import { CallControlPanel } from "call-control-sdk";
@@ -89,7 +90,7 @@ export default function App() {
89
90
  }
90
91
  ```
91
92
 
92
- ### 3. Logout Agent
93
+ #### 3. Logout Agent
93
94
 
94
95
  ```tsx
95
96
  import { useLogout } from "call-control-sdk";
@@ -100,7 +101,30 @@ export default function LogoutButton() {
100
101
  }
101
102
  ```
102
103
 
103
- ### 4. End Call
104
+ #### 4. Start Call
105
+
106
+ ```tsx
107
+ import { useClickToCall } from "call-control-sdk";
108
+
109
+ export default function CallButton() {
110
+ const { handleStartCall, isLoading, isSuccess, isError, error } = useClickToCall();
111
+
112
+ const onStartCall = () => {
113
+ handleStartCall({ mobileNumber: "1111111111" });
114
+ };
115
+
116
+ return (
117
+ <div>
118
+ <button onClick={onStartCall} disabled={isLoading}>
119
+ { "Call"}
120
+ </button>
121
+ {isSuccess && <p>✅ Call ended successfully</p>}
122
+ {isError && <p>❌ Error: {error?.message}</p>}
123
+ </div>
124
+ );
125
+ }
126
+ ```
127
+ #### 5. End Call
104
128
 
105
129
  ```tsx
106
130
  import { useEndCall } from "call-control-sdk";
@@ -126,9 +150,9 @@ export default function EndCallButton() {
126
150
  }
127
151
  ```
128
152
 
129
- ##### 🛠 Core API
153
+ ### 🛠 Core API
130
154
 
131
- ### `initSDK(config)`
155
+ #### `initSDK(config)`
132
156
 
133
157
  Initializes the SDK. Must be called **before using any components or hooks**.
134
158
 
@@ -140,7 +164,7 @@ Initializes the SDK. Must be called **before using any components or hooks**.
140
164
  | `tenantId` | string | ✅ | Tenant ID for events/authentication |
141
165
  | `agentId` | string | ✅ | Agent ID for call controls |
142
166
 
143
- ### `CallControlPanel`
167
+ #### `CallControlPanel`
144
168
 
145
169
  Draggable control panel for call management.
146
170
 
@@ -150,7 +174,7 @@ Draggable control panel for call management.
150
174
  | --------------- | -------- | -------- | -------------------------------------------------------------------------------------------------- |
151
175
  | `onDataChange?` | function | ❌ | Callback fired when call data changes. Receives `{ mobileNumber, callReferenceId, agentLoginId }`. |
152
176
 
153
- ### `updateCallData(data: Partial<CallData>)`
177
+ #### `updateCallData(data: Partial<CallData>)`
154
178
 
155
179
  Update call data programmatically.
156
180
 
@@ -162,9 +186,9 @@ Update call data programmatically.
162
186
  | `callReferenceId?` | string | Unique call reference |
163
187
  | `agentLoginId?` | string | Agent login identifier |
164
188
 
165
- ##### 🪝 Hooks
189
+ ### 🪝 Hooks
166
190
 
167
- ### `useLogout()`
191
+ #### `useLogout()`
168
192
 
169
193
  Logs out the current agent.
170
194
 
@@ -173,7 +197,22 @@ const { logOut } = useLogout();
173
197
  <button onClick={logOut}>Logout</button>;
174
198
  ```
175
199
 
176
- ### `useEndCall()`
200
+ #### `useStartCall()`
201
+
202
+ Hook for call to mobile number.
203
+
204
+ **Returns**:
205
+
206
+ | Key | Type | Description |
207
+ | --------------- | -------- | --------------------------------------------------------------- |
208
+ | `handleStartCall` | function | `(payload: StartCallPayload) => void` – triggers end-call request |
209
+ | `isLoading` | boolean | True while request is pending |
210
+ | `isSuccess` | boolean | True if request succeeded |
211
+ | `isError` | boolean | True if request failed |
212
+ | `error` | any | Error object if failed |
213
+ | `data` | any | API response on success |
214
+
215
+ #### `useEndCall()`
177
216
 
178
217
  Hook for ending an active call.
179
218
 
@@ -188,9 +227,17 @@ Hook for ending an active call.
188
227
  | `error` | any | Error object if failed |
189
228
  | `data` | any | API response on success |
190
229
 
191
- ##### 📦 Payloads
230
+ ### 📦 Payloads
231
+
232
+ #### `StartCallPayload`
233
+
234
+ ```ts
235
+ interface EndCallPayload {
236
+ mobileNumber?: string; // Mobile number
237
+ }
238
+ ```
192
239
 
193
- ### `EndCallPayload`
240
+ #### `EndCallPayload`
194
241
 
195
242
  ```ts
196
243
  interface EndCallPayload {
@@ -198,21 +245,21 @@ interface EndCallPayload {
198
245
  }
199
246
  ```
200
247
 
201
- ## 🎛 Control Features
248
+ ### 🎛 Control Features
202
249
 
203
- - **Status Management**: Idle / Break
204
- - **Call Controls**: Hold / Resume, Mute / Unmute, End Call, Agent Status
205
- - **Persistent State**: Hold, mute, agent status, panel position, call timer
250
+ **Status Management**: Idle / Break
251
+ **Call Controls**: Hold / Resume, Mute / Unmute, End Call, Agent Status
252
+ **Persistent State**: Hold, mute, agent status, panel position, call timer
206
253
 
207
- ##### 🌍 Browser Support
254
+ ### 🌍 Browser Support
208
255
 
209
- - ✅ Chrome 60+
210
- - ✅ Firefox 60+
211
- - ✅ Safari 12+
212
- - ✅ Edge 79+
256
+ ✅ Chrome 60+
257
+ ✅ Firefox 60+
258
+ ✅ Safari 12+
259
+ ✅ Edge 79+
213
260
 
214
261
  ---
215
262
 
216
- ##### 📄 License
263
+ ### 📄 License
217
264
 
218
265
  MIT © 2025 [![license](https://img.shields.io/npm/l/call-control-sdk.svg)](#-license)
package/dist/index.d.mts CHANGED
@@ -6,7 +6,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  * @returns Object containing logout function and loading state
7
7
  */
8
8
  declare const useLogout: () => {
9
- logout: () => void;
9
+ logout: () => Promise<any>;
10
10
  isLoading: boolean;
11
11
  isSuccess: boolean;
12
12
  isError: boolean;
@@ -26,7 +26,26 @@ declare const useEndCall: () => {
26
26
  callbackDate?: string;
27
27
  callbackHrs?: string;
28
28
  callbackMins?: string;
29
- }) => void;
29
+ }) => Promise<any>;
30
+ isLoading: boolean;
31
+ isSuccess: boolean;
32
+ isError: boolean;
33
+ error: null;
34
+ data: null;
35
+ };
36
+
37
+ interface StartCallPayload {
38
+ mobileNumber: string;
39
+ }
40
+ /**
41
+ * Custom hook for handling end call functionality
42
+ * @param options - Optional callbacks for success, error, and completion
43
+ * @returns Object containing logout function and loading state
44
+ * @example
45
+ * handleStartCall({ mobileNumber: "1111111111" });
46
+ */
47
+ declare const useClickToCall: () => {
48
+ handleStartCall: (data: StartCallPayload) => Promise<any>;
30
49
  isLoading: boolean;
31
50
  isSuccess: boolean;
32
51
  isError: boolean;
@@ -66,4 +85,4 @@ type intiSDKParams = {
66
85
  };
67
86
  declare function initSDK({ apiKey, tenantId, agentId }: intiSDKParams): void;
68
87
 
69
- export { CallControlPanel, type CallControlPanelProps, type CallData, type CallStatus, initSDK, useEndCall, useLogout };
88
+ export { CallControlPanel, type CallControlPanelProps, type CallData, type CallStatus, initSDK, useClickToCall, useEndCall, useLogout };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  * @returns Object containing logout function and loading state
7
7
  */
8
8
  declare const useLogout: () => {
9
- logout: () => void;
9
+ logout: () => Promise<any>;
10
10
  isLoading: boolean;
11
11
  isSuccess: boolean;
12
12
  isError: boolean;
@@ -26,7 +26,26 @@ declare const useEndCall: () => {
26
26
  callbackDate?: string;
27
27
  callbackHrs?: string;
28
28
  callbackMins?: string;
29
- }) => void;
29
+ }) => Promise<any>;
30
+ isLoading: boolean;
31
+ isSuccess: boolean;
32
+ isError: boolean;
33
+ error: null;
34
+ data: null;
35
+ };
36
+
37
+ interface StartCallPayload {
38
+ mobileNumber: string;
39
+ }
40
+ /**
41
+ * Custom hook for handling end call functionality
42
+ * @param options - Optional callbacks for success, error, and completion
43
+ * @returns Object containing logout function and loading state
44
+ * @example
45
+ * handleStartCall({ mobileNumber: "1111111111" });
46
+ */
47
+ declare const useClickToCall: () => {
48
+ handleStartCall: (data: StartCallPayload) => Promise<any>;
30
49
  isLoading: boolean;
31
50
  isSuccess: boolean;
32
51
  isError: boolean;
@@ -66,4 +85,4 @@ type intiSDKParams = {
66
85
  };
67
86
  declare function initSDK({ apiKey, tenantId, agentId }: intiSDKParams): void;
68
87
 
69
- export { CallControlPanel, type CallControlPanelProps, type CallData, type CallStatus, initSDK, useEndCall, useLogout };
88
+ export { CallControlPanel, type CallControlPanelProps, type CallData, type CallStatus, initSDK, useClickToCall, useEndCall, useLogout };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Wo=Object.create;var Te=Object.defineProperty,Fo=Object.defineProperties,Go=Object.getOwnPropertyDescriptor,Ko=Object.getOwnPropertyDescriptors,jo=Object.getOwnPropertyNames,bo=Object.getOwnPropertySymbols,Yo=Object.getPrototypeOf,vo=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable;var Fe=(e,t,a)=>t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,p=(e,t)=>{for(var a in t||(t={}))vo.call(t,a)&&Fe(e,a,t[a]);if(bo)for(var a of bo(t))Xo.call(t,a)&&Fe(e,a,t[a]);return e},Q=(e,t)=>Fo(e,Ko(t));var Jo=(e,t)=>{for(var a in t)Te(e,a,{get:t[a],enumerable:!0})},To=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of jo(t))!vo.call(e,c)&&c!==a&&Te(e,c,{get:()=>t[c],enumerable:!(l=Go(t,c))||l.enumerable});return e};var Vo=(e,t,a)=>(a=e!=null?Wo(Yo(e)):{},To(t||!e||!e.__esModule?Te(a,"default",{value:e,enumerable:!0}):a,e)),Qo=e=>To(Te({},"__esModule",{value:!0}),e);var oe=(e,t,a)=>Fe(e,typeof t!="symbol"?t+"":t,a);var ls={};Jo(ls,{CallControlPanel:()=>Bo,initSDK:()=>is,useEndCall:()=>Do,useLogout:()=>Lo});module.exports=Qo(ls);var Ge=class{constructor(){oe(this,"config",null);oe(this,"ticketId",null);oe(this,"baseUrl","");oe(this,"eventQueue",[]);oe(this,"isOnline",!0);oe(this,"retryQueue",[]);oe(this,"flushTimer",null)}async init(t){this.config=p({autoTrack:!0,retryAttempts:3,queueSize:100,flushInterval:5e3},t),this.baseUrl=t.baseUrl||(typeof window!="undefined"?window.location.origin:""),this.setupNetworkDetection();let a=await this.createTicket();return this.startPeriodicFlush(),console.log("EventTracker SDK initialized successfully"),a}isInitialized(){return this.config!==null&&this.ticketId!==null}getConfig(){return this.config}getTicketId(){return this.ticketId}async createTicket(){if(!this.config)throw new Error("EventTracker not initialized");try{let t=await this.makeRequest("/api/v1/et/init",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({agentId:this.config.agentId,sessionId:this.config.sessionId})});if(!t.ok)throw new Error(`Failed to initialize: ${t.status} ${t.statusText}`);let a=await t.json();return this.ticketId=a.ticketId,this.config.autoTrack&&this.setupAutoTracking(),this.ticketId}catch(t){throw console.error("EventTracker initialization failed:",t),t}}async logEvent(t,a){if(!this.config||!this.ticketId){console.warn("EventTracker not initialized, skipping event:",t);return}let l={eventType:t,eventData:a,timestamp:Date.now()};if(this.eventQueue.push(l),this.eventQueue.length>(this.config.queueSize||100)&&this.eventQueue.shift(),this.isOnline)try{await this.sendEvent(l)}catch(c){console.warn("Failed to send event, will retry later:",c)}}async sendEvent(t){if(!(!this.config||!this.ticketId))try{let a=await this.makeRequest("/api/v1/et/event",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId,eventType:t.eventType,eventData:t.eventData})});if(!a.ok)throw new Error(`Failed to log event: ${a.status} ${a.statusText}`);let l=this.eventQueue.findIndex(c=>c.timestamp===t.timestamp);l>-1&&this.eventQueue.splice(l,1)}catch(a){console.error("Event logging failed:",a),this.retryQueue.push(()=>this.sendEvent(t))}}async closeTicket(){if(!this.config||!this.ticketId)throw new Error("EventTracker not initialized");await this.flush();try{let t=await this.makeRequest("/api/v1/et/close",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId})});if(!t.ok)throw new Error(`Failed to close ticket: ${t.status} ${t.statusText}`);this.ticketId=null,this.stopPeriodicFlush(),console.log("Ticket closed successfully")}catch(t){throw console.error("Ticket close failed:",t),t}}async flush(){if(!this.isOnline||this.eventQueue.length===0)return;let t=[...this.eventQueue];for(let l of t)await this.sendEvent(l);let a=[...this.retryQueue];this.retryQueue=[];for(let l of a)try{await l()}catch(c){console.error("Retry failed:",c)}}async makeRequest(t,a){var o;let l=`${this.baseUrl}${t}`,c=((o=this.config)==null?void 0:o.retryAttempts)||3;for(let g=1;g<=c;g++)try{return await fetch(l,a)}catch(m){if(g===c)throw m;let b=Math.min(1e3*Math.pow(2,g-1),1e4);await new Promise(f=>setTimeout(f,b))}throw new Error("Max retries exceeded")}setupAutoTracking(){var l;if(typeof window=="undefined"||!((l=this.config)!=null&&l.autoTrack))return;let t=this.config.autoTrack===!0?{}:this.config.autoTrack;if(t.pageVisits!==!1&&this.logEvent("pageVisit",{url:window.location.href,title:document.title,referrer:document.referrer,userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()}).catch(c=>console.warn("Failed to track page visit:",c)),t.clicks!==!1&&document.addEventListener("click",c=>{var g;let o=c.target;(o.tagName==="BUTTON"||o.tagName==="A"||o.onclick||o.getAttribute("role")==="button"||o instanceof HTMLButtonElement&&o.type==="button")&&this.logEvent("click",{element:o.tagName,text:(g=o.textContent)==null?void 0:g.trim().substring(0,100),href:o.getAttribute("href"),id:o.id,className:o.className,role:o.getAttribute("role"),position:{x:c.clientX,y:c.clientY},timestamp:new Date().toISOString()}).catch(m=>console.warn("Failed to track click:",m))}),t.forms!==!1&&document.addEventListener("submit",c=>{let o=c.target,g=new FormData(o),m={};g.forEach((b,f)=>{m[f]=b.toString()}),this.logEvent("formSubmission",{formId:o.id,action:o.action,method:o.method,fields:Object.keys(m),fieldCount:Object.keys(m).length,timestamp:new Date().toISOString()}).catch(b=>console.warn("Failed to track form submission:",b))}),t.inputs!==!1){let c;document.addEventListener("input",o=>{let g=o.target;(g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.tagName==="SELECT")&&(clearTimeout(c),c=setTimeout(()=>{var m;this.logEvent("fieldChange",{element:g.tagName,type:g.getAttribute("type"),name:g.getAttribute("name"),id:g.id,valueLength:((m=g.value)==null?void 0:m.length)||0,timestamp:new Date().toISOString()}).catch(b=>console.warn("Failed to track field change:",b))},1e3))})}let a=Date.now();window.addEventListener("beforeunload",()=>{let c=Date.now()-a;this.logEvent("pageUnload",{url:window.location.href,sessionDuration:c,timestamp:new Date().toISOString()}),this.ticketId&&navigator.sendBeacon(`${this.baseUrl}/api/v1/et/close`,JSON.stringify({ticketId:this.ticketId}))}),t.visibility!==!1&&document.addEventListener("visibilitychange",()=>{this.logEvent("visibilityChange",{hidden:document.hidden,visibilityState:document.visibilityState,timestamp:new Date().toISOString()})}),t.errors!==!1&&(window.addEventListener("error",c=>{this.logEvent("jsError",{message:c.message,filename:c.filename,lineno:c.lineno,colno:c.colno,timestamp:new Date().toISOString()})}),window.addEventListener("unhandledrejection",c=>{var o;this.logEvent("unhandledRejection",{reason:(o=c.reason)==null?void 0:o.toString(),timestamp:new Date().toISOString()})})),t.performance!==!1&&typeof window.performance!="undefined"&&window.performance.navigation&&window.addEventListener("load",()=>{setTimeout(()=>{let c=window.performance.navigation,o=window.performance.timing;this.logEvent("performanceMetrics",{navigationTime:o.navigationStart,loadTime:o.loadEventEnd-o.navigationStart,domReady:o.domContentLoadedEventEnd-o.navigationStart,renderTime:o.loadEventEnd-o.domContentLoadedEventEnd,navigationType:c.type,redirectCount:c.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 a;this.flushTimer&&clearInterval(this.flushTimer);let t=((a=this.config)==null?void 0:a.flushInterval)||5e3;this.flushTimer=setInterval(()=>{this.flush()},t)}stopPeriodicFlush(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}},Ke=new Ge;typeof window!="undefined"&&(window.EventTracker=Ke);var je=class{constructor(){oe(this,"state");oe(this,"listeners",[]);oe(this,"STORAGE_KEY","call-control-sdk-state");this.state=this.getInitialState(),this.loadFromStorage()}getInitialState(){return{apiKey:null,process:null,agentId:"",isInitialized:!1,isHolding:!1,isMuted:!1,status:"idle",callStartTime:null,controlPanelPosition:{x:10,y:10},iframePosition:{x:10,y:80},callData:{agent_id:"",status:"",type:"",event_time:"",phone_number:""},conferenceLine:[{line:1,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:2,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:3,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:4,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:5,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1}]}}loadFromStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);if(t){let a=JSON.parse(t);this.state=Q(p({},this.state),{apiKey:a.apiKey||"",agentId:a.agentId||"",process:a.process||null,isInitialized:a.isInitialized||!1,isHolding:a.isHolding||!1,isMuted:a.isMuted||!1,status:a.status||"idle",callStartTime:a.callStartTime||null,controlPanelPosition:a.controlPanelPosition||{x:10,y:10},iframePosition:a.iframePosition||{x:10,y:80},callData:a.callData||{mobileNumber:"",callReferenceId:"",agentLoginId:""},conferenceLine:a.conferenceLine&&Array.isArray(a.conferenceLine)&&a.conferenceLine.length>0?a.conferenceLine:this.state.conferenceLine})}}catch(t){console.warn("Failed to load SDK state from localStorage:",t)}}saveToStorage(){try{let t={apiKey:this.state.apiKey,agentId:this.state.agentId,process:this.state.process,isInitialized:this.state.isInitialized,isHolding:this.state.isHolding,isMuted:this.state.isMuted,status:this.state.status,callStartTime:this.state.callStartTime,controlPanelPosition:this.state.controlPanelPosition,iframePosition:this.state.iframePosition,callData:this.state.callData,conferenceLine:this.state.conferenceLine};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(t){console.warn("Failed to save SDK state to localStorage:",t)}}notifyListeners(){this.listeners.forEach(t=>t())}initialize(t,a){if(!t||typeof t!="string"||t.trim().length===0)throw new Error("API key not available");this.state.apiKey=t,this.state.agentId=a,this.state.isInitialized=!0,this.saveToStorage(),this.notifyListeners()}getState(){return p({},this.state)}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1)}}setHolding(t){this.state.isHolding=t,this.saveToStorage(),this.notifyListeners()}setMuted(t){this.state.isMuted=t,this.saveToStorage(),this.notifyListeners()}setStatus(t){this.state.status=t,this.saveToStorage(),this.notifyListeners()}setProcess(t){this.state.process=t,this.saveToStorage(),this.notifyListeners()}setControlPanelPosition(t){this.state.controlPanelPosition=t,this.saveToStorage(),this.notifyListeners()}setIframePosition(t){this.state.iframePosition=t,this.saveToStorage(),this.notifyListeners()}startCall(){this.state.callStartTime=Date.now(),this.state.status="on call",this.saveToStorage(),this.notifyListeners()}endCall(){this.state.callStartTime=null,this.state.status="idle",this.state.isHolding=!1,this.state.isMuted=!1,this.saveToStorage(),this.notifyListeners()}updateCallData(t){this.state.callData=p(p({},this.state.callData),t),this.saveToStorage(),this.notifyListeners()}setConferenceLine(t){var l;(!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 a=(l=this.state.conferenceLine)==null?void 0:l.map(c=>c.line===t.line?t:c);this.state.conferenceLine=a,this.saveToStorage(),this.notifyListeners()}resetConferenceLines(){this.state.conferenceLine=this.getInitialState().conferenceLine,this.saveToStorage(),this.notifyListeners()}clearStorageAndReset(){try{localStorage.removeItem(this.STORAGE_KEY),this.state=this.getInitialState(),this.notifyListeners()}catch(t){console.warn("Failed to clear localStorage:",t)}}debugStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);console.log("Current localStorage data:",t),t&&console.log("Parsed localStorage data:",JSON.parse(t)),console.log("Current state:",this.state)}catch(t){console.error("Error debugging storage:",t)}}getConferenceLines(){return this.state.conferenceLine||[]}},D=new je;var de=require("react");var M="http://192.168.101.177:8095",Zo="ws://192.168.101.177:8095",G={v1:"/api/v1"},U={LOGIN:`${M}${G.v1}/cti/login?provider=convox`,READY_AGENT:`${M}${G.v1}/cti/ready-agent?provider=convox`,UPDATE_AGENT_BREAK:`${M}${G.v1}/cti/update-agent-status?provider=convox`,CLICK_TO_CALL:`${M}${G.v1}/cti/calls?provider=convox`,HOLD_CALL:`${M}${G.v1}/cti/calls/hold?provider=convox`,MUTE_CALL:`${M}${G.v1}/cti/calls/mute?provider=convox`,UNMUTE_CALL:`${M}${G.v1}/cti/unmute-call?provider=convox`,END_CALL:`${M}${G.v1}/cti/calls/end?provider=convox`,LOGOUT:`${M}${G.v1}/cti/logout?provider=convox`,CONFERENCE_CALL:`${M}${G.v1}/cti/calls/conference?provider=convox`,CONFERENCE_CALL_HOLD_OR_UN_HOLD:`${M}${G.v1}/cti/calls/conference/hold?provider=convox`,CONFERENCE_CALL_MUTE_OT_UN_MUTE:`${M}${G.v1}/cti/calls/conference/mute?provider=convox`,CONFERENCE_CALL_END:`${M}${G.v1}/cti/calls/conference/hangup?provider=convox`,CONFERENCE_CALL_END_ALL:`${M}${G.v1}/cti/calls/conference/hangup/all?provider=convox`,TRANSFER_CALL:`${M}${G.v1}/cti/calls/transfer?provider=convox`,AGENTS_LIST:`${M}${G.v1}/cti/users`,PROCESS_LIST:`${M}${G.v1}/cti/processes-list`,TRANSFER_TO_DETAILS:`${M}${G.v1}/cti/transfer-to-details?provider=convox`,CALL_HISTORY:`${M}${G.v1}/dashboard/call-history`,SENTIMENTAL_ANALYSIS:`${M}${G.v1}/users/get_sentiment_analysis`},So={WS:`${Zo}${G.v1}/cti/ws`};var Eo=Vo(require("axios"));var es="12345",Ye=Eo.default.create({baseURL:M,headers:{"Content-Type":"application/json",Authorization:es},timeout:1e4});Ye.interceptors.request.use(e=>{let t="12345";return t&&e.headers&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e instanceof Error?e:new Error(String(e))));Ye.interceptors.response.use(e=>e,async e=>{var a;let t=e.config;return((a=e.response)==null?void 0:a.status)===401&&!t._retry&&(t._retry=!0),Promise.reject(e instanceof Error?e:new Error(String(e)))});var te=Ye;var ts=()=>{let[e,t]=(0,de.useState)(!1),[a,l]=(0,de.useState)(!1),[c,o]=(0,de.useState)(!1),[g,m]=(0,de.useState)(null),[b,f]=(0,de.useState)(null);return{logout:(0,de.useCallback)(()=>{var h;let x=JSON.parse((h=localStorage.getItem("call-control-sdk-state"))!=null?h:"");t(!0);let u={action:"LOGOUTUSER",userId:x.agentId||""};te.post(U.LOGOUT,u).then(C=>{D.clearStorageAndReset(),localStorage.clear(),sessionStorage.clear(),f(C==null?void 0:C.data),l(!0)}).catch(C=>{o(!0),m(C)}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:a,isError:c,error:g,data:b}},Lo=ts;var ue=require("react");var Do=()=>{let[e,t]=(0,ue.useState)(!1),[a,l]=(0,ue.useState)(!1),[c,o]=(0,ue.useState)(!1),[g,m]=(0,ue.useState)(null),[b,f]=(0,ue.useState)(null);return{handleEndCall:(0,ue.useCallback)(x=>{var C,w,z,B,P,N,F,Z,V,ee,T,v,R,k,O;let u=JSON.parse((C=localStorage.getItem("call-control-sdk-state"))!=null?C:"");t(!0);let h={action:"ENDCALL",userId:u==null?void 0:u.agentId,processid:(B=(z=(w=u==null?void 0:u.process)==null?void 0:w.process_id)==null?void 0:z.toString())!=null?B:"",process_name:(N=(P=u==null?void 0:u.process)==null?void 0:P.process_name)!=null?N:"",callreferenceid:(Z=(F=u==null?void 0:u.callData)==null?void 0:F.convox_id)!=null?Z:"",mobile_number:(ee=(V=u==null?void 0:u.callData)==null?void 0:V.phone_number)!=null?ee:"",disposition:(T=x==null?void 0:x.disposition)!=null?T:"RES",set_followUp:(v=x==null?void 0:x.followUp)!=null?v:"N",callback_date:(R=x==null?void 0:x.callbackDate)!=null?R:"",callback_hrs:(k=x==null?void 0:x.callbackHrs)!=null?k:"",callback_mins:(O=x==null?void 0:x.callbackMins)!=null?O:"",endcall_type:"CLOSE"};te.post(U.END_CALL,h).then(A=>{f(A==null?void 0:A.data),D.endCall(),l(!0)}).catch(A=>{o(!0),m(A)}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:a,isError:c,error:g,data:b}};var E=require("@mui/icons-material"),d=require("@mui/material"),K=require("react");var se=require("react");function Xe(e,t){let[a,l]=(0,se.useState)(e),[c,o]=(0,se.useState)(!1),g=(0,se.useRef)(),m=(0,se.useRef)({x:0,y:0}),b=(0,se.useRef)({x:0,y:0}),f=(0,se.useCallback)(h=>{let C=g.current;if(!C)return;let w=C.getBoundingClientRect(),z=window.innerWidth,B=window.innerHeight,P={x:Math.max(0,Math.min(h.x,z-w.width)),y:Math.max(0,Math.min(h.y,B-w.height))};l(P),t==null||t(P)},[t]),y=(0,se.useCallback)((h,C)=>{o(!0),m.current={x:h,y:C},b.current=a;let w=(N,F)=>{let Z=N-m.current.x,V=F-m.current.y;f({x:b.current.x+Z,y:b.current.y+V})},z=N=>{N.preventDefault(),w(N.clientX,N.clientY)},B=N=>{N.preventDefault();let F=N.touches[0];F&&w(F.clientX,F.clientY)},P=()=>{o(!1),document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",B),document.removeEventListener("touchend",P)};document.addEventListener("mousemove",z),document.addEventListener("mouseup",P),document.addEventListener("touchmove",B,{passive:!1}),document.addEventListener("touchend",P)},[a,f]),x=(0,se.useCallback)(h=>{h.preventDefault(),y(h.clientX,h.clientY)},[y]),u=(0,se.useCallback)(h=>{h.preventDefault();let C=h.touches[0];C&&y(C.clientX,C.clientY)},[y]);return{position:a,isDragging:c,dragRef:g,handleMouseDown:x,handleTouchStart:u}}var $e=require("react");function me(){let[e,t]=(0,$e.useState)(D.getState());return(0,$e.useEffect)(()=>D.subscribe(()=>{t(D.getState())}),[]),e}var qe=require("react");var ge=require("react"),ze=require("@mui/material"),Se=require("react/jsx-runtime"),Io=(0,ge.createContext)(void 0),Ee=()=>{let e=(0,ge.useContext)(Io);if(!e)throw new Error("useToast must be used inside ToastProvider");return e},Ro=({children:e})=>{let[t,a]=(0,ge.useState)(!1),[l,c]=(0,ge.useState)(""),[o,g]=(0,ge.useState)("info"),m=(b,f="info")=>{c(b),g(f),a(!0)};return(0,Se.jsxs)(Io.Provider,{value:{showToast:m},children:[e,(0,Se.jsx)(ze.Snackbar,{open:t,color:o,autoHideDuration:3e3,onClose:()=>a(!1),anchorOrigin:{vertical:"top",horizontal:"right"},children:(0,Se.jsx)(ze.Alert,{variant:"filled",severity:o,onClose:()=>a(!1),sx:{width:"100%"},children:l})})]})};var os={isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null},ss=(e,t)=>{if(t.type==="isLoading")return Q(p({},e),{isLoading:t.payload});if(t.type==="isSuccess")return Q(p({},e),{isSuccess:!0,data:t.payload});if(t.type==="isError")return Q(p({},e),{isError:!0,error:t.payload});if(t.type==="reset")return{isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null};throw Error("Unknown action.")};var ae=(e={})=>{let{onSuccess:t=null,onError:a=null}=e,{showToast:l}=Ee(),[c,o]=(0,qe.useReducer)(ss,os);return[(0,qe.useCallback)((m,b,f={})=>{o({type:"isLoading",payload:!0}),te.post(m,b,f).then(y=>{var x,u;o({type:"isSuccess",payload:y.data}),t==null||t(y.data,b),console.log((x=y.data)==null?void 0:x.message,"res45"),l((u=y.data)==null?void 0:u.message,"success")}).catch(y=>{var u,h,C,w,z,B,P,N,F,Z,V,ee;let x={status:(h=(u=y.response)==null?void 0:u.status)!=null?h:500,message:((w=(C=y.response)==null?void 0:C.data)==null?void 0:w.detail)||((B=(z=y.response)==null?void 0:z.data)==null?void 0:B.message)||y.message||"An unknown error occurred",data:(N=(P=y.response)==null?void 0:P.data)!=null?N:null,statusText:(Z=(F=y.response)==null?void 0:F.statusText)!=null?Z:"",code:(V=y==null?void 0:y.code)!=null?V:"",name:(ee=y==null?void 0:y.name)!=null?ee:""};l(x.message,"error"),o({type:"isError",payload:x}),a==null||a(x,b)}).finally(()=>{o({type:"isLoading",payload:!1})})},[t,a,l]),c]};var I=require("@mui/icons-material"),n=require("@mui/material"),ne=require("react");var _o=require("@mui/material"),as=()=>{let e=(0,_o.useTheme)();return{disabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",border:"1px solid rgb(206, 204, 204)",height:"40px","&:hover":{boxShadow:" 0px 2px 2px rgba(0, 0, 0, 0.79)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},enabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},outlined:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",backgroundColor:e.palette.grey[200],boxShadow:`0px 2px 1px ${e.palette.primary.light}`,border:`0px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:`0px 2px 1px ${e.palette.primary.main}`,border:`0px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}}}},We=as;var s=require("react/jsx-runtime"),ns=({each:e})=>{var ee,T;let t=me(),{showToast:a}=Ee(),{disabled:l,enabled:c,outlined:o}=We(),g=(0,n.useTheme)(),[m,b]=(0,ne.useState)(!1),[f,y]=(0,ne.useState)(!1),[x,u]=(0,ne.useState)(!1),[h,C]=(0,ne.useState)(!1),[w,z]=(0,ne.useState)(!1),B=(v,R)=>{D.setConferenceLine(p(p({},v),R))},P=(v,R)=>{var A,q,W,H;let k=p(p({},v),R);b(!0);let O={action:"EXTERNAL_CONFERENCE",operation:`CALL${k.line}`,line_used:String(k.line),thirdparty_no:k.phone,userid:(q=(A=t.callData)==null?void 0:A.agent_id)!=null?q:"",process:(H=(W=t.callData)==null?void 0:W.process_name)!=null?H:""};te.post(U.CONFERENCE_CALL,O).then(_=>{var L;a((L=_.data)==null?void 0:L.message,"success"),D.setConferenceLine(p(p({},v),R))}).catch(_=>{var $,j,Y,X;let L=((j=($=_.response)==null?void 0:$.data)==null?void 0:j.detail)||((X=(Y=_.response)==null?void 0:Y.data)==null?void 0:X.message)||_.message||"An unknown error occurred";a(L,"error")}).finally(()=>{b(!1)})},N=(v,R)=>{var A,q,W,H;let k=p(p({},v),R);y(!0);let O={action:"EXTERNAL_CONFERENCE",operation:"CONFERENCE",line_used:String(k.line),thirdparty_no:k.phone,userid:(q=(A=t.callData)==null?void 0:A.agent_id)!=null?q:"",process:(H=(W=t.callData)==null?void 0:W.process_name)!=null?H:""};te.post(U.CONFERENCE_CALL,O).then(_=>{var L;a((L=_.data)==null?void 0:L.message,"success"),D.setConferenceLine(p(p({},v),R))}).catch(_=>{var $,j,Y,X;let L=((j=($=_.response)==null?void 0:$.data)==null?void 0:j.detail)||((X=(Y=_.response)==null?void 0:Y.data)==null?void 0:X.message)||_.message||"An unknown error occurred";a(L,"error")}).finally(()=>{y(!1)})},F=(v,R,k)=>{var q,W,H,_;let O=p(p({},v),R);u(!0);let A={action:"EXTERNAL_CONFERENCE",operation:k,hold_channel_no:k==="HOLDUSER"?`hold${O.line}`:`unhold${O.line}`,userid:(W=(q=t.callData)==null?void 0:q.agent_id)!=null?W:"",process:(_=(H=t.callData)==null?void 0:H.process_name)!=null?_:""};te.post(U.CONFERENCE_CALL_HOLD_OR_UN_HOLD,A).then(L=>{var $;a(($=L.data)==null?void 0:$.message,"success"),D.setConferenceLine(p(p({},v),R))}).catch(L=>{var j,Y,X,re;let $=((Y=(j=L.response)==null?void 0:j.data)==null?void 0:Y.detail)||((re=(X=L.response)==null?void 0:X.data)==null?void 0:re.message)||L.message||"An unknown error occurred";a($,"error")}).finally(()=>{u(!1)})},Z=(v,R,k)=>{var q,W,H,_;let O=p(p({},v),R);C(!0);let A={action:"EXTERNAL_CONFERENCE",operation:k,channel_no:k==="MUTEUSER"?`mute${O.line}`:`play${O.line}`,userid:(W=(q=t.callData)==null?void 0:q.agent_id)!=null?W:"",thirdparty_no:O.phone,process:(_=(H=t.callData)==null?void 0:H.process_name)!=null?_:""};te.post(U.CONFERENCE_CALL_MUTE_OT_UN_MUTE,A).then(L=>{var $;a(($=L.data)==null?void 0:$.message,"success"),D.setConferenceLine(p(p({},v),R))}).catch(L=>{var j,Y,X,re;let $=((Y=(j=L.response)==null?void 0:j.data)==null?void 0:Y.detail)||((re=(X=L.response)==null?void 0:X.data)==null?void 0:re.message)||L.message||"An unknown error occurred";a($,"error")}).finally(()=>{C(!1)})},V=(v,R)=>{var A,q,W,H;let k=p(p({},v),R);z(!0);let O={action:"EXTERNAL_CONFERENCE",operation:"HANGUP_CHANNEL",line_used:String(k.line-1),user_type:`THIRDPARTY${k.line-1}`,thirdparty_no:k.phone,userid:(q=(A=t.callData)==null?void 0:A.agent_id)!=null?q:"",process:(H=(W=t.callData)==null?void 0:W.process_name)!=null?H:""};te.post(U.CONFERENCE_CALL_END,O).then(_=>{var L;a((L=_.data)==null?void 0:L.message,"success"),D.setConferenceLine(p(p({},v),R))}).catch(_=>{var $,j,Y,X;let L=((j=($=_.response)==null?void 0:$.data)==null?void 0:j.detail)||((X=(Y=_.response)==null?void 0:Y.data)==null?void 0:X.message)||_.message||"An unknown error occurred";a(L,"error")}).finally(()=>{z(!1)})};return(0,s.jsxs)(n.TableRow,{sx:{border:"2px solid #fff"},children:[(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsxs)(n.Typography,{children:["Line ",(ee=e==null?void 0:e.line)!=null?ee:"",". "]})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsx)(n.Typography,{variant:"body2",sx:{px:1,borderRadius:"10px",width:"80px",maxWidth:"100px"},children:(T=e==null?void 0:e.status)!=null?T:""})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsx)(n.Button,{sx:{textTransform:"capitalize"},size:"small",children:(0,s.jsx)(n.Typography,{variant:"body2",children:(e==null?void 0:e.line)===1?"Internal":"External"})})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsx)(n.TextField,{size:"small",placeholder:"Phone Number",value:(e==null?void 0:e.phone)||"",disabled:(e==null?void 0:e.line)===1,onChange:v=>{B(e,{phone:v.target.value})}})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around"},children:[(0,s.jsx)(n.Tooltip,{title:"Call",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isCallStart?"outlined":"contained",color:"success",sx:e!=null&&e.isCallStart?p({},l):Q(p({},c),{border:`0px solid ${g.palette.success.light}`,"&:hover":{bgcolor:"success.light",boxShadow:`0px 2px 1px ${g.palette.success.light}`,border:`0px solid ${g.palette.success.light}`},"&:active":{bgcolor:"success.light",boxShadow:`inset 1px -2px 4px ${g.palette.primary.light}`}}),onClick:()=>{P(e,{isCallStart:!0,status:"ONCALL"})},disabled:(e==null?void 0:e.isCallStart)||m,children:m?(0,s.jsx)(n.CircularProgress,{size:"20px",color:"success"}):(0,s.jsx)(I.Call,{sx:{color:e!=null&&e.isCallStart?"default":"#e7e7e7ff"}})})}),(0,s.jsx)(n.Tooltip,{title:"Merge Call",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isMergeCall?"contained":"outlined",sx:e!=null&&e.isMergeCall&&(e!=null&&e.isCallStart)?p({},l):e!=null&&e.isCallStart?p({},o):p({},l),onClick:()=>{N(e,{isMergeCall:!0,status:"ONCALL"})},disabled:!(e!=null&&e.isCallStart)||f,children:f?(0,s.jsx)(n.CircularProgress,{size:"20px",sx:{color:e!=null&&e.isMergeCall?"#e7e7e7ff":g.palette.primary.main}}):(0,s.jsx)(I.CallSplit,{})})}),(0,s.jsx)(n.Tooltip,{title:e.isHold?"Hold":"Un Hold",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isHold?"contained":"outlined",sx:e!=null&&e.isHold&&(e!=null&&e.isCallStart)?p({},l):e!=null&&e.isCallStart?p({},o):p({},l),onClick:()=>{e.isHold?F(e,{isHold:!1},"UNHOLDUSER"):F(e,{isHold:!0},"HOLDUSER")},disabled:!(e!=null&&e.isCallStart)||x,children:x?(0,s.jsx)(n.CircularProgress,{size:"20px",sx:{color:g.palette.primary.main}}):e.isHold?(0,s.jsx)(I.PlayArrow,{}):(0,s.jsx)(I.Pause,{})})}),(0,s.jsx)(n.Tooltip,{title:e.isMute?"Mute":"Un Mute",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isMute?"contained":"outlined",sx:e!=null&&e.isMute&&(e!=null&&e.isCallStart)?p({},l):e!=null&&e.isCallStart?p({},o):p({},l),onClick:()=>{e.isMute?Z(e,{isMute:!1},"PLAYUSER"):Z(e,{isMute:!0},"MUTEUSER")},disabled:!(e!=null&&e.isCallStart)||h,children:h?(0,s.jsx)(n.CircularProgress,{size:"20px",sx:{color:g.palette.primary.main}}):e.isMute?(0,s.jsx)(I.MicOff,{}):(0,s.jsx)(I.Mic,{})})}),(0,s.jsx)(n.Tooltip,{title:"End Call",children:(e==null?void 0:e.line)!==1?(0,s.jsx)(n.Button,{variant:e!=null&&e.isCallStart?"contained":"outlined",color:"error",sx:e!=null&&e.isCallStart?Q(p({},c),{minWidth:"60px !important",border:`0px solid ${g.palette.error.light}`,"&:hover":{bgcolor:"error.light",boxShadow:`0px 2px 1px ${g.palette.error.light}`,border:`0px solid ${g.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${g.palette.primary.light}`}}):Q(p({},l),{minWidth:"60px !important"}),onClick:()=>{V(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart)||w,children:w?(0,s.jsx)(n.CircularProgress,{size:"20px",color:"error"}):(0,s.jsx)(I.CallEnd,{})}):(0,s.jsx)(n.Button,{variant:e!=null&&e.isCallStart?"contained":"outlined",sx:Q(p({},l),{visibility:"hidden",minWidth:"60px !important"}),onClick:()=>{V(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart),children:(0,s.jsx)(n.Typography,{children:(0,s.jsx)(I.CallEnd,{sx:{visibility:"hidden"}})})})})]})})]},e.line)};function wo({open:e,setOpen:t}){var b;let a=me(),{showToast:l}=Ee(),[c,o]=(0,ne.useState)(!1),g=()=>{t(!1)},m=()=>{var y,x,u,h;o(!0);let f={action:"EXTERNAL_CONFERENCE",operation:"ENDCONFERENCE",userid:(x=(y=a.callData)==null?void 0:y.agent_id)!=null?x:"",process:(h=(u=a.callData)==null?void 0:u.process_name)!=null?h:""};te.post(U.CONFERENCE_CALL_END_ALL,f).then(C=>{var w;l((w=C.data)==null?void 0:w.message,"success"),D.resetConferenceLines(),g()}).catch(C=>{var z,B,P,N;let w=((B=(z=C.response)==null?void 0:z.data)==null?void 0:B.detail)||((N=(P=C.response)==null?void 0:P.data)==null?void 0:N.message)||C.message||"An unknown error occurred";l(w,"error")}).finally(()=>{o(!1)})};return(0,ne.useEffect)(()=>{var y,x,u,h;let f={line:1,status:(x=(y=a.callData)==null?void 0:y.status)!=null?x:"",type:"internal",phone:(h=(u=a.callData)==null?void 0:u.phone_number)!=null?h:"",isMute:!1,isHold:!1,isMergeCall:!1,isCallStart:!0};D.setConferenceLine(f)},[]),(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px"},children:[(0,s.jsxs)(n.Typography,{variant:"body1",children:[(b=a==null?void 0:a.agentId)!=null?b:""," conference"]}),(0,s.jsx)(n.IconButton,{onClick:g,children:(0,s.jsx)(I.Close,{})})]}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 2px #e7e5e5ff",margin:"0px 15px",borderRadius:"20px"},children:(0,s.jsx)(n.TableContainer,{component:n.Paper,sx:{outline:"0px solid gray !important",boxShadow:"1px 1px 6px #e7e5e5ff"},children:(0,s.jsxs)(n.Table,{sx:{border:"4px solid #ffffff !important"},children:[(0,s.jsx)(n.TableHead,{children:(0,s.jsxs)(n.TableRow,{sx:{border:"2px solid #f3f3f3ff !important"},children:[(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Line"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Status"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Call Type"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Mobile Number"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Call Actions"})]})}),(0,s.jsx)(n.TableBody,{children:a==null?void 0:a.conferenceLine.map(f=>(0,s.jsx)(ns,{each:f}))})]})})}),(0,s.jsx)(n.Box,{textAlign:"center",m:2,children:(0,s.jsxs)(n.Button,{variant:"outlined",color:"error",size:"large",onClick:m,disabled:c,sx:{px:2,borderRadius:"20px",textTransform:"capitalize"},children:[c?(0,s.jsx)(n.CircularProgress,{size:"20px",color:"error",sx:{marginRight:"8px"}}):(0,s.jsx)(n.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)(I.PhoneDisabled,{sx:{color:"white",fontSize:"16px",fontWeight:"600"}})}),"End Conference"]})})]})})})}function ko({open:e,setOpen:t}){var u,h,C,w,z,B,P,N,F,Z,V,ee;let[a]=ae({onSuccess:T=>{console.log("res",T),t(!1)},onError:T=>{console.log("error",T)}}),l=me(),[c,o]=(0,ne.useState)("process"),[g,{data:m}]=ae(),[b,{data:f}]=ae(),y=()=>{t(!1)},x=(T,v)=>{var R,k,O,A,q,W,H,_,L,$,j,Y,X,re,Le,De,Ie,Re,xe,_e,ye,we,he,ke,Ae,Ne,Ce,Pe,Oe,Me,Ue,Be,He;if(console.log(T,"data34"),v==="PROCESS"){let fe={mobile_number:(k=(R=l.callData)==null?void 0:R.phone_number)!=null?k:"",userid:(A=(O=l.callData)==null?void 0:O.agent_id)!=null?A:"",type:"PROCESS",transfer_to:(q=T==null?void 0:T.process_name)!=null?q:"",callreferenceid:(H=(W=l.callData)==null?void 0:W.convox_id)!=null?H:"",processid:String((L=(_=l.callData)==null?void 0:_.process_id)!=null?L:""),process_name:(j=($=l.callData)==null?void 0:$.process_name)!=null?j:""};a(U.TRANSFER_CALL,fe)}else if(v==="QUEUE"){let fe={mobile_number:(X=(Y=l.callData)==null?void 0:Y.phone_number)!=null?X:"",userid:(Le=(re=l.callData)==null?void 0:re.agent_id)!=null?Le:"",type:"QUEUE",transfer_to:(De=T==null?void 0:T.queue_name)!=null?De:"",callreferenceid:(Re=(Ie=l.callData)==null?void 0:Ie.convox_id)!=null?Re:"",processid:String((_e=(xe=l.callData)==null?void 0:xe.process_id)!=null?_e:""),process_name:(we=(ye=l.callData)==null?void 0:ye.process_name)!=null?we:""};a(U.TRANSFER_CALL,fe)}else if(v==="AGENT"){let fe={mobile_number:(ke=(he=l.callData)==null?void 0:he.phone_number)!=null?ke:"",userid:(Ne=(Ae=l.callData)==null?void 0:Ae.agent_id)!=null?Ne:"",type:"AGENT",transfer_to:(Ce=T==null?void 0:T.user_id)!=null?Ce:"",callreferenceid:(Oe=(Pe=l.callData)==null?void 0:Pe.convox_id)!=null?Oe:"",processid:String((Ue=(Me=l.callData)==null?void 0:Me.process_id)!=null?Ue:""),process_name:(He=(Be=l.callData)==null?void 0:Be.process_name)!=null?He:""};a(U.TRANSFER_CALL,fe)}};return(0,ne.useEffect)(()=>{g(U.AGENTS_LIST,{status:"IDLE",active:!0}),b(U.TRANSFER_TO_DETAILS,{status:"ACTIVE",active:!0})},[]),console.log(m,"idleAgentsList"),(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[(0,s.jsx)(n.Typography,{variant:"body1",children:" Call Transfer"}),(0,s.jsx)(n.IconButton,{onClick:y,children:(0,s.jsx)(I.Close,{})})]}),(0,s.jsxs)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",gap:1},children:[(0,s.jsx)(n.Button,{variant:c==="process"?"contained":"outlined",onClick:()=>o("process"),children:"Process"}),(0,s.jsx)(n.Button,{variant:c==="queues"?"contained":"outlined",onClick:()=>o("queues"),children:"Queues"}),(0,s.jsx)(n.Button,{variant:c==="agents"?"contained":"outlined",onClick:()=>o("agents"),children:"Agents"})]}),c==="process"&&(0,s.jsx)(n.Box,{sx:{display:"flex",gap:1},children:(u=f==null?void 0:f.data)!=null&&u.process&&((C=(h=f==null?void 0:f.data)==null?void 0:h.process)==null?void 0:C.length)>0?(z=(w=f==null?void 0:f.data)==null?void 0:w.process)==null?void 0:z.map((T,v)=>(0,s.jsxs)(n.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)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(I.SupportAgent,{sx:{marginRight:"4px"}}),T.process_name]}),(0,s.jsx)(n.IconButton,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{x(T,"PROCESS")},children:(0,s.jsx)(I.Call,{})})]},v)):(0,s.jsx)(n.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==="queues"&&(0,s.jsx)(n.Box,{sx:{display:"flex",gap:1},children:(B=f==null?void 0:f.data)!=null&&B.queue&&((N=(P=f==null?void 0:f.data)==null?void 0:P.queue)==null?void 0:N.length)>0?(Z=(F=f==null?void 0:f.data)==null?void 0:F.queue)==null?void 0:Z.map((T,v)=>{var R,k,O,A,q,W;return(0,s.jsxs)(n.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)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(I.SupportAgent,{sx:{marginRight:"4px"}}),T.queue_name,(O=(k=(R=f==null?void 0:f.data)==null?void 0:R.process)==null?void 0:k.find(H=>H.process_id===T.process_id))!=null&&O.process_name?(0,s.jsx)(n.Typography,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",color:"gray"},children:"("+((W=(q=(A=f==null?void 0:f.data)==null?void 0:A.process)==null?void 0:q.find(H=>H.process_id===T.process_id))==null?void 0:W.process_name)+")"}):""]}),(0,s.jsx)(n.IconButton,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{x(T,"QUEUE")},children:(0,s.jsx)(I.Call,{})})]},v)}):(0,s.jsx)(n.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==="agents"&&(0,s.jsx)(n.Box,{sx:{display:"flex",gap:1},children:m!=null&&m.data&&((V=m==null?void 0:m.data)==null?void 0:V.length)>0?(ee=m==null?void 0:m.data)==null?void 0:ee.map((T,v)=>(0,s.jsxs)(n.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)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(I.SupportAgent,{sx:{marginRight:"4px"}}),T.name]}),(0,s.jsx)(n.IconButton,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{x(T,"AGENT")},children:(0,s.jsx)(I.Call,{})})]},v)):(0,s.jsx)(n.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 Ao({open:e,setOpen:t,onSubmitDisposition:a}){var y,x;let[l,c]=(0,ne.useState)({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""}),o=[{label:"Not Interested",value:"NI"},{label:"Resolved",value:"RES"}],g=[{label:"Yes",value:"Y"},{label:"No",value:"N"}],m=(u,h)=>{c(C=>Q(p({},C),{[u]:h}))},b=()=>{c({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""})},f=()=>{b(),t(!1)};return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"xs",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsx)(n.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:(0,s.jsxs)(n.Typography,{variant:"body1",m:1,children:[" ","Call Disposition"]})}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"10px",margin:"10px",borderRadius:"10px"},children:(0,s.jsxs)(n.Grid,{container:!0,spacing:2,children:[(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.Autocomplete,{value:l.disposition,options:o,getOptionLabel:u=>u.label,onChange:(u,h)=>m("disposition",h),size:"small",renderInput:u=>(0,s.jsx)(n.TextField,Q(p({},u),{label:"Disposition",fullWidth:!0}))})}),(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.Autocomplete,{options:g,getOptionLabel:u=>u.label,value:l.followUp,onChange:(u,h)=>m("followUp",h),size:"small",renderInput:u=>(0,s.jsx)(n.TextField,Q(p({},u),{label:"Follow Up",fullWidth:!0}))})}),((x=(y=l==null?void 0:l.followUp)==null?void 0:y.label)==null?void 0:x.toLowerCase())==="yes"&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.TextField,{size:"small",label:"Callback Date",type:"date",slotProps:{inputLabel:{shrink:!0}},value:l.callbackDate,onChange:u=>m("callbackDate",u.target.value),fullWidth:!0})}),(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.TextField,{size:"small",label:"Hours (0-23)",type:"text",inputProps:{min:0,max:23},value:l.callbackHrs,onChange:u=>m("callbackHrs",u.target.value),fullWidth:!0})}),(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.TextField,{size:"small",label:"Minutes (0-59)",type:"text",inputProps:{min:0,max:59},value:l.callbackMins,onChange:u=>m("callbackMins",u.target.value),fullWidth:!0})})]})]})}),(0,s.jsxs)(n.Box,{textAlign:"right",m:2,children:[(0,s.jsx)(n.Button,{variant:"outlined",color:"error",size:"large",onClick:f,sx:{px:2,mx:1,borderRadius:"10px",textTransform:"capitalize"},children:"cancel"}),(0,s.jsx)(n.Button,{variant:"contained",color:"primary",size:"large",onClick:()=>a(l),sx:{px:2,borderRadius:"10px",textTransform:"capitalize"},children:"Submit"})]})]})})})}function No({open:e,setOpen:t,processList:a=null,handleSelectedProcessor:l}){var o,g;return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",maxWidth:"xs",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[(0,s.jsx)(n.Typography,{variant:"body1",children:" Process List"}),(0,s.jsx)(n.IconButton,{onClick:()=>{t(!1)},children:(0,s.jsx)(I.Close,{})})]}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:((o=a==null?void 0:a.processes)==null?void 0:o.length)>0?(g=a==null?void 0:a.processes)==null?void 0:g.map((m,b)=>(0,s.jsx)(n.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:()=>{l(m)},children:(0,s.jsxs)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(I.SupportAgent,{sx:{marginRight:"4px"}}),m.process_name]})},b)):null})]})})})}function Po({open:e,setOpen:t}){return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[(0,s.jsx)(n.Typography,{variant:"body1",children:" Call History"}),(0,s.jsx)(n.IconButton,{onClick:()=>{t(!1)},children:(0,s.jsx)(I.Close,{})})]}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",margin:"10px",borderRadius:"10px",textAlign:"center",fontSize:"16px",fontWeight:"bold"},p:6,children:"Coming Soon..."})]})})})}var r=require("react/jsx-runtime");function Oo({onDataChange:e}){var Qe,Ze,et,tt,ot,st,at,nt,it,lt,rt,ct,pt,dt,ut,gt,ft,mt,xt,yt,ht,Ct,bt,vt,Tt,St,Et,Lt,Dt,It,Rt,_t,wt,kt,At,Nt,Pt,Ot,Mt,Ut,Bt,Ht,$t,zt,qt,Wt,Ft,Gt,Kt,jt,Yt,Xt,Jt,Vt,Qt,Zt,eo,to,oo,so,ao,no,io,lo,ro,co;let t=(0,d.useTheme)(),{disabled:a,enabled:l,outlined:c}=We(),o=me(),g=(0,K.useRef)(null),[m,b]=(0,K.useState)(null),[f,y]=(0,K.useState)(!0),[x,u]=(0,K.useState)(null),[h,C]=(0,K.useState)(null),[w,z]=(0,K.useState)(!1),[B,P]=(0,K.useState)(!1),[N,F]=(0,K.useState)(!1),[Z,V]=(0,K.useState)(!1),[ee,T]=(0,K.useState)(!1),[v,R]=(0,K.useState)(""),[k,O]=(0,K.useState)(0),{position:A,isDragging:q,dragRef:W,handleMouseDown:H,handleTouchStart:_}=Xe(o.controlPanelPosition,i=>D.setControlPanelPosition(i)),{position:L,isDragging:$,dragRef:j,handleMouseDown:Y,handleTouchStart:X}=Xe(o.iframePosition,i=>D.setIframePosition(i)),[re,{data:Le}]=ae({onSuccess:i=>{var S;console.log("res",i),i&&i.data&&((S=i==null?void 0:i.data)==null?void 0:S.length)>1?V(!0):(D.setProcess(i==null?void 0:i.data[0]),V(!1))},onError:()=>{V(!1)}}),[De,{isLoading:Ie}]=ae(),[Re,{isLoading:xe}]=ae({onSuccess:()=>{D.setHolding(!o.isHolding)},onError:i=>{console.log("error",i)}}),[_e,{isLoading:ye}]=ae({onSuccess:()=>{D.setMuted(!o.isMuted)},onError:i=>{console.log("error",i)}}),[we,{isLoading:he}]=ae(),[ke,{isLoading:Ae}]=ae(),[Ne,{isLoading:Ce}]=ae(),Pe=(0,K.useCallback)(i=>{let S=Math.floor(i/60),J=i%60;return`${S.toString().padStart(2,"0")}:${J.toString().padStart(2,"0")}`},[]),Oe=()=>{b(null)},Me=i=>{y(!0),C(i.currentTarget),D.setStatus("dial")},Ue=()=>{o.status!=="on call"&&D.setStatus("idle"),C(null)},Be=i=>{u(i.currentTarget)},He=()=>{u(null)},fe=()=>{let i={action:"READYAGENT",userId:o.agentId};we(U.READY_AGENT,i)},Ve=i=>{u(null);let S={action:"AGENTBREAK",break_type:i,userId:o.agentId};ke(U.UPDATE_AGENT_BREAK,S)},Ho=i=>{if(i.length!==10)alert("Invalid phone number");else if(/^\d+$/.test(i)){let S={action:"CALL",phone_number:i,userId:o.agentId};De(U.CLICK_TO_CALL,S)}},$o=()=>{let i={action:o.isHolding?"UNHOLD":"HOLD",userId:o.agentId};Re(U.HOLD_CALL,i)},zo=()=>{let i={action:o.isMuted?"UNMUTE":"MUTE",userId:o.agentId};_e(U.MUTE_CALL,i)},qo=i=>{var J,ie,le,ce,pe,be,ve,po,uo,go,fo,mo,xo,yo,ho,Co;console.log("data",i);let S={action:"ENDCALL",userId:o.agentId,processid:(le=(ie=(J=o.process)==null?void 0:J.process_id)==null?void 0:ie.toString())!=null?le:"",process_name:(pe=(ce=o.process)==null?void 0:ce.process_name)!=null?pe:"",callreferenceid:(ve=(be=o.callData)==null?void 0:be.convox_id)!=null?ve:"",mobile_number:(uo=(po=o.callData)==null?void 0:po.phone_number)!=null?uo:"",disposition:(fo=(go=i==null?void 0:i.disposition)==null?void 0:go.value)!=null?fo:"",set_followUp:(xo=(mo=i==null?void 0:i.followUp)==null?void 0:mo.value)!=null?xo:"",callback_date:(yo=i==null?void 0:i.callbackDate)!=null?yo:"",callback_hrs:(ho=i==null?void 0:i.callbackHrs)!=null?ho:"",callback_mins:(Co=i==null?void 0:i.callbackMins)!=null?Co:"",endcall_type:"CLOSE"};R(""),Ne(U.END_CALL,S),D.endCall(),F(!1)};return(0,K.useEffect)(()=>{let i;return o.callData.status&&o.callData.status==="ONCALL"?i=setInterval(()=>{let S=Math.floor((Date.now()-o.callStartTime)/1e3);O(S)},1e3):O(0),()=>{i&&clearInterval(i)}},[o.callData.status]),(0,K.useEffect)(()=>{e&&e(o.callData)},[o.callData,e]),(0,K.useEffect)(()=>{o.agentId?re(U.PROCESS_LIST,{userId:o.agentId,action:"GETAGENTPROCESSLIST",refno:"1234221233"}):console.log("No agentId available, skipping API call")},[o.agentId]),(0,K.useEffect)(()=>(o.agentId&&(g.current=new WebSocket(`${So.WS}?agent_id=${o.agentId}`),g.current.onopen=()=>{console.log("WebSocket connection established")},g.current.onmessage=i=>{try{let S=JSON.parse(i.data);console.log("parsedJSON:",S),D.updateCallData(S),S.status==="ONCALL"&&D.startCall(),S.status==="WRAPUP"&&D.endCall()}catch(S){console.log("Raw message:",i.data)}},g.current.onclose=()=>{console.log("WebSocket connection closed")},g.current.onerror=i=>{console.error("WebSocket error:",i)}),()=>{var i;(i=g.current)==null||i.close()}),[o.agentId]),!o.isInitialized||!o.process?(0,r.jsx)(d.Box,{children:!!Z&&(0,r.jsx)(No,{processList:Le,open:Z,setOpen:V,handleSelectedProcessor:i=>{D.setProcess(i)}})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Fade,{in:!0,timeout:300,children:(0,r.jsx)(d.Paper,{ref:W,elevation:q?4:1,sx:{position:"fixed",left:A.x,top:A.y,p:.5,borderRadius:3,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),userSelect:"none"},children:(0,r.jsxs)(d.Box,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsxs)(d.Box,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsxs)(d.IconButton,{component:"div",size:"small",sx:{cursor:"all-scroll"},onMouseDown:H,onTouchStart:_,children:[(0,r.jsx)(E.DragIndicator,{})," "]}),(0,r.jsx)(d.Box,{sx:{marginRight:"10px"},children:(0,r.jsx)(d.Tooltip,{title:"Dial",children:(0,r.jsx)(d.IconButton,{size:"small",onClick:i=>{var S,J,ie,le,ce,pe,be,ve;((J=(S=o.callData)==null?void 0:S.status)==null?void 0:J.toUpperCase())!=="ONCALL"&&((le=(ie=o.callData)==null?void 0:ie.status)==null?void 0:le.toUpperCase())!=="BREAK"&&((pe=(ce=o.callData)==null?void 0:ce.status)==null?void 0:pe.toUpperCase())!=="RINGING"&&((ve=(be=o.callData)==null?void 0:be.status)==null?void 0:ve.toUpperCase())!=="WRAPUP"&&Me(i)},sx:{bgcolor:"action.hover","&:hover":{bgcolor:"warning"}},children:(0,r.jsx)(E.WifiCalling3,{sx:{color:((Ze=(Qe=o.callData)==null?void 0:Qe.status)==null?void 0:Ze.toUpperCase())==="ONCALL"||((tt=(et=o.callData)==null?void 0:et.status)==null?void 0:tt.toUpperCase())==="BREAK"||((st=(ot=o.callData)==null?void 0:ot.status)==null?void 0:st.toUpperCase())==="RINGING"||((nt=(at=o.callData)==null?void 0:at.status)==null?void 0:nt.toUpperCase())==="WRAPUP"?"action.selected":"success.main"}})})})}),(0,r.jsx)(d.Typography,{sx:{color:"success.main",width:"40px",marginRight:"10px"},children:Pe(k)}),Ae||he?(0,r.jsx)(d.Box,{sx:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(d.CircularProgress,{size:"20px"})}):(0,r.jsx)(d.Typography,{variant:"body2",sx:{fontWeight:"bold",textAlign:"right"},children:(rt=(lt=(it=o.callData)==null?void 0:it.status)==null?void 0:lt.toUpperCase())!=null?rt:"N/A"}),(0,r.jsx)(d.Box,{onClick:Be,sx:{display:"flex",alignItems:"center",margin:"6px",cursor:"pointer"},children:(0,r.jsx)(E.ArrowDropDown,{})})]}),(0,r.jsxs)(d.Box,{sx:{display:"flex",gap:1,justifyContent:"center",alignItems:"center"},children:[(0,r.jsx)(d.Tooltip,{title:"Agent Ready",children:(0,r.jsx)(d.Button,{variant:((pt=(ct=o.callData)==null?void 0:ct.status)==null?void 0:pt.toUpperCase())==="BREAK"||((ut=(dt=o.callData)==null?void 0:dt.status)==null?void 0:ut.toUpperCase())==="MISSED"?"outlined":"contained",onClick:i=>{var S,J,ie,le;(((J=(S=o.callData)==null?void 0:S.status)==null?void 0:J.toUpperCase())==="BREAK"||((le=(ie=o.callData)==null?void 0:ie.status)==null?void 0:le.toUpperCase())==="MISSED")&&(i.stopPropagation(),fe())},classes:{root:((ft=(gt=o.callData)==null?void 0:gt.status)==null?void 0:ft.toUpperCase())==="BREAK"||((xt=(mt=o.callData)==null?void 0:mt.status)==null?void 0:xt.toUpperCase())==="MISSED"?"outlined":"enabled"},sx:p({},((ht=(yt=o.callData)==null?void 0:yt.status)==null?void 0:ht.toUpperCase())==="BREAK"||((bt=(Ct=o.callData)==null?void 0:Ct.status)==null?void 0:bt.toUpperCase())==="MISSED"?c:l),disabled:he,children:(0,r.jsx)(E.SupportAgent,{})})}),(0,r.jsx)(d.Tooltip,{title:o.isHolding?"Resume":"Hold",children:(0,r.jsx)(d.Button,{variant:o.isHolding&&((Tt=(vt=o.callData)==null?void 0:vt.status)==null?void 0:Tt.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:i=>{i.stopPropagation(),$o()},sx:o.isHolding&&((Et=(St=o.callData)==null?void 0:St.status)==null?void 0:Et.toUpperCase())==="ONCALL"?p({},l):((Dt=(Lt=o.callData)==null?void 0:Lt.status)==null?void 0:Dt.toUpperCase())==="ONCALL"?p({},c):p({},a),disabled:((Rt=(It=o.callData)==null?void 0:It.status)==null?void 0:Rt.toUpperCase())!=="ONCALL"&&!o.isHolding||xe,children:xe?(0,r.jsx)(d.CircularProgress,{size:"20px",sx:{color:t.palette.primary.main}}):o.isHolding?(0,r.jsx)(E.PlayArrow,{}):(0,r.jsx)(E.Pause,{})})}),(0,r.jsx)(d.Tooltip,{title:o.isMuted?"Unmute":"Mute",children:(0,r.jsx)(d.Button,{variant:o.isMuted&&((wt=(_t=o.callData)==null?void 0:_t.status)==null?void 0:wt.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:i=>{i.stopPropagation(),zo()},sx:o.isMuted&&((At=(kt=o.callData)==null?void 0:kt.status)==null?void 0:At.toUpperCase())==="ONCALL"?p({},l):((Pt=(Nt=o.callData)==null?void 0:Nt.status)==null?void 0:Pt.toUpperCase())==="ONCALL"?p({},c):p({},a),disabled:((Mt=(Ot=o.callData)==null?void 0:Ot.status)==null?void 0:Mt.toUpperCase())!=="ONCALL"&&!o.isMuted||ye,children:ye?(0,r.jsx)(d.CircularProgress,{size:"20px",sx:{color:t.palette.primary.main}}):o.isMuted?(0,r.jsx)(E.MicOff,{}):(0,r.jsx)(E.Mic,{})})}),(0,r.jsx)(d.Tooltip,{title:"Transfer Call",children:(0,r.jsx)(d.Button,{variant:B?"contained":"outlined",onClick:i=>{var S,J;((J=(S=o.callData)==null?void 0:S.status)==null?void 0:J.toUpperCase())==="ONCALL"&&(i.stopPropagation(),P(!0))},sx:B?p({},l):((Bt=(Ut=o.callData)==null?void 0:Ut.status)==null?void 0:Bt.toUpperCase())==="ONCALL"?p({},c):p({},a),disabled:(($t=(Ht=o.callData)==null?void 0:Ht.status)==null?void 0:$t.toUpperCase())!=="ONCALL",children:(0,r.jsx)(E.TransferWithinAStation,{})})}),(0,r.jsx)(d.Tooltip,{title:"Conference Call",children:(0,r.jsx)(d.Button,{variant:w?"contained":"outlined",onClick:i=>{var S,J;((J=(S=o.callData)==null?void 0:S.status)==null?void 0:J.toUpperCase())==="ONCALL"&&(i.stopPropagation(),z(!0))},sx:w?p({},l):((qt=(zt=o.callData)==null?void 0:zt.status)==null?void 0:qt.toUpperCase())==="ONCALL"?p({},c):p({},a),disabled:((Ft=(Wt=o.callData)==null?void 0:Wt.status)==null?void 0:Ft.toUpperCase())!=="ONCALL",children:(0,r.jsx)(E.Group,{})})}),(0,r.jsx)(d.Tooltip,{title:"End Call",children:(0,r.jsx)(d.Button,{variant:((Kt=(Gt=o.callData)==null?void 0:Gt.status)==null?void 0:Kt.toUpperCase())==="ONCALL"||((Yt=(jt=o.callData)==null?void 0:jt.status)==null?void 0:Yt.toUpperCase())==="RINGING"||((Jt=(Xt=o.callData)==null?void 0:Xt.status)==null?void 0:Jt.toUpperCase())==="WRAPUP"?"contained":"outlined",onClick:i=>{var S,J,ie,le,ce,pe;(((J=(S=o.callData)==null?void 0:S.status)==null?void 0:J.toUpperCase())==="ONCALL"||((le=(ie=o.callData)==null?void 0:ie.status)==null?void 0:le.toUpperCase())==="RINGING"||((pe=(ce=o.callData)==null?void 0:ce.status)==null?void 0:pe.toUpperCase())==="WRAPUP")&&(i.stopPropagation(),F(!0))},sx:((Qt=(Vt=o.callData)==null?void 0:Vt.status)==null?void 0:Qt.toUpperCase())==="ONCALL"||((eo=(Zt=o.callData)==null?void 0:Zt.status)==null?void 0:eo.toUpperCase())==="RINGING"||((oo=(to=o.callData)==null?void 0:to.status)==null?void 0:oo.toUpperCase())==="WRAPUP"?Q(p({},l),{borderRight:"1px",backgroundColor:"error.main",minWidth:"60px !important",boxShadow:" 0px 2px 1px #5f3f3f",border:`1px solid ${t.palette.error.light}`,height:"40px","&:hover":{bgcolor:"error.light",boxShadow:" 0px 2px 1px #5f3f3f",border:`0px solid ${t.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${t.palette.primary.light}`}}):Q(p({},a),{minWidth:"60px !important"}),disabled:((ao=(so=o.callData)==null?void 0:so.status)==null?void 0:ao.toUpperCase())!=="ONCALL"&&((io=(no=o.callData)==null?void 0:no.status)==null?void 0:io.toUpperCase())!=="RINGING"&&((ro=(lo=o.callData)==null?void 0:lo.status)==null?void 0:ro.toUpperCase())!=="WRAPUP"||Ce,children:Ce?(0,r.jsx)(d.CircularProgress,{size:"20px",color:"error"}):(0,r.jsx)(E.CallEnd,{})})})]})]})})}),(0,r.jsx)(d.Fade,{in:!0,timeout:300,children:(0,r.jsxs)(d.Paper,{ref:j,elevation:$?4:1,sx:{position:"fixed",left:L.x,top:L.y,p:1,height:"auto",borderRadius:2,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),visibility:f?"visible":"hidden",userSelect:"none"},children:[(0,r.jsxs)(d.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"all-scroll"},onMouseDown:Y,onTouchStart:X,children:[(0,r.jsx)(E.DragIndicator,{sx:{transform:"rotate(90deg)"}})," ",(0,r.jsx)(d.IconButton,{onClick:()=>y(!1),children:(0,r.jsx)(E.Close,{})})]}),(0,r.jsx)("iframe",{src:`https://h68.deepijatel.in/ConVoxCCS/iframe?agent_id=${o.agentId}&process_id=${(co=o.process)==null?void 0:co.process_id}`,height:380,width:420,allow:"camera; microphone; autoplay"})]})}),(0,r.jsx)(d.Menu,{anchorEl:h,open:!!h,onClose:Ue,onClick:i=>i.stopPropagation(),sx:{zIndex:99999},children:(0,r.jsxs)(d.Box,{sx:{all:"unset",padding:"10px","&hover":{backgroundColor:"white"}},children:[(0,r.jsx)(d.TextField,{size:"small",value:v,placeholder:"Enter Mobile No.",onChange:i=>{R(i.target.value)}}),(0,r.jsx)(d.IconButton,{color:"info",onClick:()=>{Ho(v)},children:Ie?(0,r.jsx)(d.CircularProgress,{size:"20px",sx:{color:t.palette.success.main}}):(0,r.jsx)(E.Phone,{color:"success"})})]})}),(0,r.jsxs)(d.Menu,{anchorEl:x,open:!!x,onClose:He,onClick:i=>i.stopPropagation(),sx:{zIndex:99999},children:[(0,r.jsx)(d.MenuItem,{onClick:()=>Ve("Lunch"),children:"- Lunch"}),(0,r.jsx)(d.MenuItem,{onClick:()=>Ve("Tea"),children:"- Tea"})]}),(0,r.jsx)(d.Menu,{anchorEl:m,open:!!m,onClose:Oe,onClick:i=>i.stopPropagation(),sx:{zIndex:99999},children:(0,r.jsxs)(d.Box,{sx:{display:"flex",justifyContent:"flex-start",flexDirection:"column",padding:"0px 10px","&hover":{backgroundColor:"white"}},children:[(0,r.jsx)(d.Chip,{icon:(0,r.jsx)(E.Layers,{color:"secondary"}),variant:"outlined",label:"Waiting - 25",sx:{margin:"4px 2px"}}),(0,r.jsx)(d.Chip,{icon:(0,r.jsx)(E.Pending,{color:"info"}),label:"Pending - 99+",variant:"outlined",sx:{margin:"4px 2px"}}),(0,r.jsx)(d.Chip,{icon:(0,r.jsx)(E.Upcoming,{color:"success"}),variant:"outlined",label:"Upcoming - 66",sx:{margin:"4px 2px"}})]})}),!!w&&(0,r.jsx)(wo,{open:w,setOpen:z}),!!B&&(0,r.jsx)(ko,{open:B,setOpen:P}),!!N&&(0,r.jsx)(Ao,{open:N,setOpen:F,onSubmitDisposition:qo}),!!ee&&(0,r.jsx)(Po,{open:ee,setOpen:T})]})}var Uo=require("react/jsx-runtime"),Mo=({children:e})=>(0,Uo.jsx)(Ro,{children:e});var Je=require("react/jsx-runtime");function Bo({onDataChange:e}){return(0,Je.jsx)(Mo,{children:(0,Je.jsx)(Oo,{onDataChange:e})})}function is({apiKey:e,tenantId:t,agentId:a}){D.initialize(e,a),Ke.init({apiKey:e,tenantId:t,agentId:a,baseUrl:M})}0&&(module.exports={CallControlPanel,initSDK,useEndCall,useLogout});
1
+ "use strict";var Go=Object.create;var Ee=Object.defineProperty,Ko=Object.defineProperties,jo=Object.getOwnPropertyDescriptor,Yo=Object.getOwnPropertyDescriptors,Xo=Object.getOwnPropertyNames,vo=Object.getOwnPropertySymbols,Jo=Object.getPrototypeOf,So=Object.prototype.hasOwnProperty,Vo=Object.prototype.propertyIsEnumerable;var Ge=(e,t,a)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,d=(e,t)=>{for(var a in t||(t={}))So.call(t,a)&&Ge(e,a,t[a]);if(vo)for(var a of vo(t))Vo.call(t,a)&&Ge(e,a,t[a]);return e},ee=(e,t)=>Ko(e,Yo(t));var Qo=(e,t)=>{for(var a in t)Ee(e,a,{get:t[a],enumerable:!0})},Eo=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Xo(t))!So.call(e,r)&&r!==a&&Ee(e,r,{get:()=>t[r],enumerable:!(l=jo(t,r))||l.enumerable});return e};var Zo=(e,t,a)=>(a=e!=null?Go(Jo(e)):{},Eo(t||!e||!e.__esModule?Ee(a,"default",{value:e,enumerable:!0}):a,e)),es=e=>Eo(Ee({},"__esModule",{value:!0}),e);var oe=(e,t,a)=>Ge(e,typeof t!="symbol"?t+"":t,a);var cs={};Qo(cs,{CallControlPanel:()=>$o,initSDK:()=>rs,useClickToCall:()=>_o,useEndCall:()=>Io,useLogout:()=>Do});module.exports=es(cs);var Ke=class{constructor(){oe(this,"config",null);oe(this,"ticketId",null);oe(this,"baseUrl","");oe(this,"eventQueue",[]);oe(this,"isOnline",!0);oe(this,"retryQueue",[]);oe(this,"flushTimer",null)}async init(t){this.config=d({autoTrack:!0,retryAttempts:3,queueSize:100,flushInterval:5e3},t),this.baseUrl=t.baseUrl||(typeof window!="undefined"?window.location.origin:""),this.setupNetworkDetection();let a=await this.createTicket();return this.startPeriodicFlush(),console.log("EventTracker SDK initialized successfully"),a}isInitialized(){return this.config!==null&&this.ticketId!==null}getConfig(){return this.config}getTicketId(){return this.ticketId}async createTicket(){if(!this.config)throw new Error("EventTracker not initialized");try{let t=await this.makeRequest("/api/v1/et/init",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({agentId:this.config.agentId,sessionId:this.config.sessionId})});if(!t.ok)throw new Error(`Failed to initialize: ${t.status} ${t.statusText}`);let a=await t.json();return this.ticketId=a.ticketId,this.config.autoTrack&&this.setupAutoTracking(),this.ticketId}catch(t){throw console.error("EventTracker initialization failed:",t),t}}async logEvent(t,a){if(!this.config||!this.ticketId){console.warn("EventTracker not initialized, skipping event:",t);return}let l={eventType:t,eventData:a,timestamp:Date.now()};if(this.eventQueue.push(l),this.eventQueue.length>(this.config.queueSize||100)&&this.eventQueue.shift(),this.isOnline)try{await this.sendEvent(l)}catch(r){console.warn("Failed to send event, will retry later:",r)}}async sendEvent(t){if(!(!this.config||!this.ticketId))try{let a=await this.makeRequest("/api/v1/et/event",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId,eventType:t.eventType,eventData:t.eventData})});if(!a.ok)throw new Error(`Failed to log event: ${a.status} ${a.statusText}`);let l=this.eventQueue.findIndex(r=>r.timestamp===t.timestamp);l>-1&&this.eventQueue.splice(l,1)}catch(a){console.error("Event logging failed:",a),this.retryQueue.push(()=>this.sendEvent(t))}}async closeTicket(){if(!this.config||!this.ticketId)throw new Error("EventTracker not initialized");await this.flush();try{let t=await this.makeRequest("/api/v1/et/close",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({ticketId:this.ticketId})});if(!t.ok)throw new Error(`Failed to close ticket: ${t.status} ${t.statusText}`);this.ticketId=null,this.stopPeriodicFlush(),console.log("Ticket closed successfully")}catch(t){throw console.error("Ticket close failed:",t),t}}async flush(){if(!this.isOnline||this.eventQueue.length===0)return;let t=[...this.eventQueue];for(let l of t)await this.sendEvent(l);let a=[...this.retryQueue];this.retryQueue=[];for(let l of a)try{await l()}catch(r){console.error("Retry failed:",r)}}async makeRequest(t,a){var o;let l=`${this.baseUrl}${t}`,r=((o=this.config)==null?void 0:o.retryAttempts)||3;for(let g=1;g<=r;g++)try{return await fetch(l,a)}catch(y){if(g===r)throw y;let v=Math.min(1e3*Math.pow(2,g-1),1e4);await new Promise(f=>setTimeout(f,v))}throw new Error("Max retries exceeded")}setupAutoTracking(){var l;if(typeof window=="undefined"||!((l=this.config)!=null&&l.autoTrack))return;let t=this.config.autoTrack===!0?{}:this.config.autoTrack;if(t.pageVisits!==!1&&this.logEvent("pageVisit",{url:window.location.href,title:document.title,referrer:document.referrer,userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()}).catch(r=>console.warn("Failed to track page visit:",r)),t.clicks!==!1&&document.addEventListener("click",r=>{var g;let o=r.target;(o.tagName==="BUTTON"||o.tagName==="A"||o.onclick||o.getAttribute("role")==="button"||o instanceof HTMLButtonElement&&o.type==="button")&&this.logEvent("click",{element:o.tagName,text:(g=o.textContent)==null?void 0:g.trim().substring(0,100),href:o.getAttribute("href"),id:o.id,className:o.className,role:o.getAttribute("role"),position:{x:r.clientX,y:r.clientY},timestamp:new Date().toISOString()}).catch(y=>console.warn("Failed to track click:",y))}),t.forms!==!1&&document.addEventListener("submit",r=>{let o=r.target,g=new FormData(o),y={};g.forEach((v,f)=>{y[f]=v.toString()}),this.logEvent("formSubmission",{formId:o.id,action:o.action,method:o.method,fields:Object.keys(y),fieldCount:Object.keys(y).length,timestamp:new Date().toISOString()}).catch(v=>console.warn("Failed to track form submission:",v))}),t.inputs!==!1){let r;document.addEventListener("input",o=>{let g=o.target;(g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.tagName==="SELECT")&&(clearTimeout(r),r=setTimeout(()=>{var y;this.logEvent("fieldChange",{element:g.tagName,type:g.getAttribute("type"),name:g.getAttribute("name"),id:g.id,valueLength:((y=g.value)==null?void 0:y.length)||0,timestamp:new Date().toISOString()}).catch(v=>console.warn("Failed to track field change:",v))},1e3))})}let a=Date.now();window.addEventListener("beforeunload",()=>{let r=Date.now()-a;this.logEvent("pageUnload",{url:window.location.href,sessionDuration:r,timestamp:new Date().toISOString()}),this.ticketId&&navigator.sendBeacon(`${this.baseUrl}/api/v1/et/close`,JSON.stringify({ticketId:this.ticketId}))}),t.visibility!==!1&&document.addEventListener("visibilitychange",()=>{this.logEvent("visibilityChange",{hidden:document.hidden,visibilityState:document.visibilityState,timestamp:new Date().toISOString()})}),t.errors!==!1&&(window.addEventListener("error",r=>{this.logEvent("jsError",{message:r.message,filename:r.filename,lineno:r.lineno,colno:r.colno,timestamp:new Date().toISOString()})}),window.addEventListener("unhandledrejection",r=>{var o;this.logEvent("unhandledRejection",{reason:(o=r.reason)==null?void 0:o.toString(),timestamp:new Date().toISOString()})})),t.performance!==!1&&typeof window.performance!="undefined"&&window.performance.navigation&&window.addEventListener("load",()=>{setTimeout(()=>{let r=window.performance.navigation,o=window.performance.timing;this.logEvent("performanceMetrics",{navigationTime:o.navigationStart,loadTime:o.loadEventEnd-o.navigationStart,domReady:o.domContentLoadedEventEnd-o.navigationStart,renderTime:o.loadEventEnd-o.domContentLoadedEventEnd,navigationType:r.type,redirectCount:r.redirectCount,timestamp:new Date().toISOString()})},1e3)})}setupNetworkDetection(){typeof window!="undefined"&&(this.isOnline=navigator.onLine,window.addEventListener("online",()=>{this.isOnline=!0,console.log("EventTracker: Back online, flushing queued events"),this.flush()}),window.addEventListener("offline",()=>{this.isOnline=!1,console.log("EventTracker: Offline, queueing events")}))}startPeriodicFlush(){var a;this.flushTimer&&clearInterval(this.flushTimer);let t=((a=this.config)==null?void 0:a.flushInterval)||5e3;this.flushTimer=setInterval(()=>{this.flush()},t)}stopPeriodicFlush(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}},je=new Ke;typeof window!="undefined"&&(window.EventTracker=je);var Ye=class{constructor(){oe(this,"state");oe(this,"listeners",[]);oe(this,"STORAGE_KEY","call-control-sdk-state");this.state=this.getInitialState(),this.loadFromStorage()}getInitialState(){return{apiKey:null,process:null,agentId:"",isInitialized:!1,isHolding:!1,isMuted:!1,status:"idle",callStartTime:null,controlPanelPosition:{x:10,y:10},iframePosition:{x:10,y:80},callData:{agent_id:"",status:"",type:"",event_time:"",phone_number:""},conferenceLine:[{line:1,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:2,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:3,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:4,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1},{line:5,status:"IDLE",type:"",phone:"",isMute:!1,isHold:!1,isCallStart:!1,isMergeCall:!1}]}}loadFromStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);if(t){let a=JSON.parse(t);this.state=ee(d({},this.state),{apiKey:a.apiKey||"",agentId:a.agentId||"",process:a.process||null,isInitialized:a.isInitialized||!1,isHolding:a.isHolding||!1,isMuted:a.isMuted||!1,status:a.status||"idle",callStartTime:a.callStartTime||null,controlPanelPosition:a.controlPanelPosition||{x:10,y:10},iframePosition:a.iframePosition||{x:10,y:80},callData:a.callData||{mobileNumber:"",callReferenceId:"",agentLoginId:""},conferenceLine:a.conferenceLine&&Array.isArray(a.conferenceLine)&&a.conferenceLine.length>0?a.conferenceLine:this.state.conferenceLine})}}catch(t){console.warn("Failed to load SDK state from localStorage:",t)}}saveToStorage(){try{let t={apiKey:this.state.apiKey,agentId:this.state.agentId,process:this.state.process,isInitialized:this.state.isInitialized,isHolding:this.state.isHolding,isMuted:this.state.isMuted,status:this.state.status,callStartTime:this.state.callStartTime,controlPanelPosition:this.state.controlPanelPosition,iframePosition:this.state.iframePosition,callData:this.state.callData,conferenceLine:this.state.conferenceLine};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(t){console.warn("Failed to save SDK state to localStorage:",t)}}notifyListeners(){this.listeners.forEach(t=>t())}initialize(t,a){if(!t||typeof t!="string"||t.trim().length===0)throw new Error("API key not available");this.state.apiKey=t,this.state.agentId=a,this.state.isInitialized=!0,this.saveToStorage(),this.notifyListeners()}getState(){return d({},this.state)}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1)}}setHolding(t){this.state.isHolding=t,this.saveToStorage(),this.notifyListeners()}setMuted(t){this.state.isMuted=t,this.saveToStorage(),this.notifyListeners()}setStatus(t){this.state.status=t,this.saveToStorage(),this.notifyListeners()}setProcess(t){this.state.process=t,this.saveToStorage(),this.notifyListeners()}setControlPanelPosition(t){this.state.controlPanelPosition=t,this.saveToStorage(),this.notifyListeners()}setIframePosition(t){this.state.iframePosition=t,this.saveToStorage(),this.notifyListeners()}startCall(){this.state.callStartTime=Date.now(),this.state.status="on call",this.saveToStorage(),this.notifyListeners()}endCall(){this.state.callStartTime=null,this.state.status="idle",this.state.isHolding=!1,this.state.isMuted=!1,this.saveToStorage(),this.notifyListeners()}updateCallData(t){this.state.callData=d(d({},this.state.callData),t),this.saveToStorage(),this.notifyListeners()}setConferenceLine(t){var l;(!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 a=(l=this.state.conferenceLine)==null?void 0:l.map(r=>r.line===t.line?t:r);this.state.conferenceLine=a,this.saveToStorage(),this.notifyListeners()}resetConferenceLines(){this.state.conferenceLine=this.getInitialState().conferenceLine,this.saveToStorage(),this.notifyListeners()}clearStorageAndReset(){try{localStorage.removeItem(this.STORAGE_KEY),this.state=this.getInitialState(),this.notifyListeners()}catch(t){console.warn("Failed to clear localStorage:",t)}}debugStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);console.log("Current localStorage data:",t),t&&console.log("Parsed localStorage data:",JSON.parse(t)),console.log("Current state:",this.state)}catch(t){console.error("Error debugging storage:",t)}}getConferenceLines(){return this.state.conferenceLine||[]}},E=new Ye;var de=require("react");var F="http://192.168.101.177:8095",ts="ws://192.168.101.177:8095",j={v1:"/api/v1"},M={LOGIN:`${F}${j.v1}/cti/login?provider=convox`,READY_AGENT:`${F}${j.v1}/cti/ready-agent?provider=convox`,UPDATE_AGENT_BREAK:`${F}${j.v1}/cti/update-agent-status?provider=convox`,CLICK_TO_CALL:`${F}${j.v1}/cti/calls?provider=convox`,HOLD_CALL:`${F}${j.v1}/cti/calls/hold?provider=convox`,MUTE_CALL:`${F}${j.v1}/cti/calls/mute?provider=convox`,UNMUTE_CALL:`${F}${j.v1}/cti/unmute-call?provider=convox`,END_CALL:`${F}${j.v1}/cti/calls/end?provider=convox`,LOGOUT:`${F}${j.v1}/cti/logout?provider=convox`,CONFERENCE_CALL:`${F}${j.v1}/cti/calls/conference?provider=convox`,CONFERENCE_CALL_HOLD_OR_UN_HOLD:`${F}${j.v1}/cti/calls/conference/hold?provider=convox`,CONFERENCE_CALL_MUTE_OT_UN_MUTE:`${F}${j.v1}/cti/calls/conference/mute?provider=convox`,CONFERENCE_CALL_END:`${F}${j.v1}/cti/calls/conference/hangup?provider=convox`,CONFERENCE_CALL_END_ALL:`${F}${j.v1}/cti/calls/conference/hangup/all?provider=convox`,TRANSFER_CALL:`${F}${j.v1}/cti/calls/transfer?provider=convox`,AGENTS_LIST:`${F}${j.v1}/cti/users`,PROCESS_LIST:`${F}${j.v1}/cti/processes-list`,TRANSFER_TO_DETAILS:`${F}${j.v1}/cti/transfer-to-details?provider=convox`,CALL_HISTORY:`${F}${j.v1}/dashboard/call-history`,SENTIMENTAL_ANALYSIS:`${F}${j.v1}/users/get_sentiment_analysis`},To={WS:`${ts}${j.v1}/cti/ws`};var Lo=Zo(require("axios"));var os="12345",Xe=Lo.default.create({baseURL:F,headers:{"Content-Type":"application/json",Authorization:os},timeout:1e4});Xe.interceptors.request.use(e=>{let t="12345";return t&&e.headers&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e instanceof Error?e:new Error(String(e))));Xe.interceptors.response.use(e=>e,async e=>{var a;let t=e.config;return((a=e.response)==null?void 0:a.status)===401&&!t._retry&&(t._retry=!0),Promise.reject(e instanceof Error?e:new Error(String(e)))});var te=Xe;var ss=()=>{let[e,t]=(0,de.useState)(!1),[a,l]=(0,de.useState)(!1),[r,o]=(0,de.useState)(!1),[g,y]=(0,de.useState)(null),[v,f]=(0,de.useState)(null);return{logout:(0,de.useCallback)(async()=>{var h;let m=JSON.parse((h=localStorage.getItem("call-control-sdk-state"))!=null?h:"");t(!0);let p={action:"LOGOUTUSER",userId:m.agentId||""};return te.post(M.LOGOUT,p).then(C=>(E.clearStorageAndReset(),localStorage.clear(),sessionStorage.clear(),f(C==null?void 0:C.data),l(!0),C==null?void 0:C.data)).catch(C=>{var T;return o(!0),y(C),(T=C==null?void 0:C.response)==null?void 0:T.data}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:a,isError:r,error:g,data:v}},Do=ss;var ue=require("react");var Io=()=>{let[e,t]=(0,ue.useState)(!1),[a,l]=(0,ue.useState)(!1),[r,o]=(0,ue.useState)(!1),[g,y]=(0,ue.useState)(null),[v,f]=(0,ue.useState)(null);return{handleEndCall:(0,ue.useCallback)(async m=>{var C,T,B,U,P,w,$,X,z,k,x,S,N,O,q;let p=JSON.parse((C=localStorage.getItem("call-control-sdk-state"))!=null?C:"");t(!0);let h={action:"ENDCALL",userId:p==null?void 0:p.agentId,processid:(U=(B=(T=p==null?void 0:p.process)==null?void 0:T.process_id)==null?void 0:B.toString())!=null?U:"",process_name:(w=(P=p==null?void 0:p.process)==null?void 0:P.process_name)!=null?w:"",callreferenceid:(X=($=p==null?void 0:p.callData)==null?void 0:$.convox_id)!=null?X:"",mobile_number:(k=(z=p==null?void 0:p.callData)==null?void 0:z.phone_number)!=null?k:"",disposition:(x=m==null?void 0:m.disposition)!=null?x:"RES",set_followUp:(S=m==null?void 0:m.followUp)!=null?S:"N",callback_date:(N=m==null?void 0:m.callbackDate)!=null?N:"",callback_hrs:(O=m==null?void 0:m.callbackHrs)!=null?O:"",callback_mins:(q=m==null?void 0:m.callbackMins)!=null?q:"",endcall_type:"CLOSE"};return te.post(M.END_CALL,h).then(L=>(E.endCall(),f(L==null?void 0:L.data),l(!0),L==null?void 0:L.data)).catch(L=>{var H;return o(!0),y(L),(H=L==null?void 0:L.response)==null?void 0:H.data}).finally(()=>{t(!1)})},[]),isLoading:e,isSuccess:a,isError:r,error:g,data:v}};var ge=require("react");var _o=()=>{let[e,t]=(0,ge.useState)(!1),[a,l]=(0,ge.useState)(!1),[r,o]=(0,ge.useState)(!1),[g,y]=(0,ge.useState)(null),[v,f]=(0,ge.useState)(null);return{handleStartCall:(0,ge.useCallback)(async m=>{var h,C,T,B,U,P,w,$,X;let p=JSON.parse((h=localStorage.getItem("call-control-sdk-state"))!=null?h:"");if(t(!0),((C=p==null?void 0:p.callData)==null?void 0:C.status)==="IDLE"){let z={action:"CALL",userId:p==null?void 0:p.agentId,phone_number:m==null?void 0:m.mobileNumber};return te.post(M.CLICK_TO_CALL,z).then(k=>(f(k==null?void 0:k.data),l(!0),k==null?void 0:k.data)).catch(k=>{var x;return o(!0),y(k),(x=k==null?void 0:k.response)==null?void 0:x.data}).finally(()=>{t(!1)})}else if(((T=p==null?void 0:p.callData)==null?void 0:T.status)==="ONCALL"){let z=(U=(B=p==null?void 0:p.conferenceLine)==null?void 0:B.filter(x=>x.line!==1))==null?void 0:U.find(x=>x.status==="IDLE"&&!(x!=null&&x.isCallStart)),k={action:"EXTERNAL_CONFERENCE",operation:`CALL${z.line}`,line_used:String(z.line),thirdparty_no:m==null?void 0:m.mobileNumber,userid:(w=(P=p.callData)==null?void 0:P.agent_id)!=null?w:"",process:(X=($=p.callData)==null?void 0:$.process_name)!=null?X:""};return te.post(M.CONFERENCE_CALL,k).then(x=>(f(x==null?void 0:x.data),l(!0),E.setConferenceLine(ee(d({},z),{isCallStart:!0,status:"ONCALL",phone:m==null?void 0:m.mobileNumber})),x==null?void 0:x.data)).catch(x=>{var S;return o(!0),y(x),(S=x==null?void 0:x.response)==null?void 0:S.data}).finally(()=>{t(!1)})}else alert("Agent is not ready")},[]),isLoading:e,isSuccess:a,isError:r,error:g,data:v}};var I=require("@mui/icons-material"),u=require("@mui/material"),Y=require("react");var se=require("react");function Je(e,t){let[a,l]=(0,se.useState)(e),[r,o]=(0,se.useState)(!1),g=(0,se.useRef)(),y=(0,se.useRef)({x:0,y:0}),v=(0,se.useRef)({x:0,y:0}),f=(0,se.useCallback)(h=>{let C=g.current;if(!C)return;let T=C.getBoundingClientRect(),B=window.innerWidth,U=window.innerHeight,P={x:Math.max(0,Math.min(h.x,B-T.width)),y:Math.max(0,Math.min(h.y,U-T.height))};l(P),t==null||t(P)},[t]),b=(0,se.useCallback)((h,C)=>{o(!0),y.current={x:h,y:C},v.current=a;let T=(w,$)=>{let X=w-y.current.x,z=$-y.current.y;f({x:v.current.x+X,y:v.current.y+z})},B=w=>{w.preventDefault(),T(w.clientX,w.clientY)},U=w=>{w.preventDefault();let $=w.touches[0];$&&T($.clientX,$.clientY)},P=()=>{o(!1),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",U),document.removeEventListener("touchend",P)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",P),document.addEventListener("touchmove",U,{passive:!1}),document.addEventListener("touchend",P)},[a,f]),m=(0,se.useCallback)(h=>{h.preventDefault(),b(h.clientX,h.clientY)},[b]),p=(0,se.useCallback)(h=>{h.preventDefault();let C=h.touches[0];C&&b(C.clientX,C.clientY)},[b]);return{position:a,isDragging:r,dragRef:g,handleMouseDown:m,handleTouchStart:p}}var ze=require("react");function xe(){let[e,t]=(0,ze.useState)(E.getState());return(0,ze.useEffect)(()=>E.subscribe(()=>{t(E.getState())}),[]),e}var Fe=require("react");var fe=require("react"),qe=require("@mui/material"),Te=require("react/jsx-runtime"),Ro=(0,fe.createContext)(void 0),Le=()=>{let e=(0,fe.useContext)(Ro);if(!e)throw new Error("useToast must be used inside ToastProvider");return e},wo=({children:e})=>{let[t,a]=(0,fe.useState)(!1),[l,r]=(0,fe.useState)(""),[o,g]=(0,fe.useState)("info"),y=(v,f="info")=>{r(v),g(f),a(!0)};return(0,Te.jsxs)(Ro.Provider,{value:{showToast:y},children:[e,(0,Te.jsx)(qe.Snackbar,{open:t,color:o,autoHideDuration:3e3,onClose:()=>a(!1),anchorOrigin:{vertical:"top",horizontal:"right"},children:(0,Te.jsx)(qe.Alert,{variant:"filled",severity:o,onClose:()=>a(!1),sx:{width:"100%"},children:l})})]})};var as={isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null},ns=(e,t)=>{if(t.type==="isLoading")return ee(d({},e),{isLoading:t.payload});if(t.type==="isSuccess")return ee(d({},e),{isSuccess:!0,data:t.payload});if(t.type==="isError")return ee(d({},e),{isError:!0,error:t.payload});if(t.type==="reset")return{isLoading:!1,isSuccess:!1,isError:!1,error:null,data:null};throw Error("Unknown action.")};var ae=(e={})=>{let{onSuccess:t=null,onError:a=null}=e,{showToast:l}=Le(),[r,o]=(0,Fe.useReducer)(ns,as);return[(0,Fe.useCallback)((y,v,f={})=>{o({type:"isLoading",payload:!0}),te.post(y,v,f).then(b=>{var m,p;o({type:"isSuccess",payload:b.data}),t==null||t(b.data,v),console.log((m=b.data)==null?void 0:m.message,"res45"),l((p=b.data)==null?void 0:p.message,"success")}).catch(b=>{var p,h,C,T,B,U,P,w,$,X,z,k;let m={status:(h=(p=b.response)==null?void 0:p.status)!=null?h:500,message:((T=(C=b.response)==null?void 0:C.data)==null?void 0:T.detail)||((U=(B=b.response)==null?void 0:B.data)==null?void 0:U.message)||b.message||"An unknown error occurred",data:(w=(P=b.response)==null?void 0:P.data)!=null?w:null,statusText:(X=($=b.response)==null?void 0:$.statusText)!=null?X:"",code:(z=b==null?void 0:b.code)!=null?z:"",name:(k=b==null?void 0:b.name)!=null?k:""};l(m.message,"error"),o({type:"isError",payload:m}),a==null||a(m,v)}).finally(()=>{o({type:"isLoading",payload:!1})})},[t,a,l]),r]};var R=require("@mui/icons-material"),n=require("@mui/material"),ne=require("react");var ko=require("@mui/material"),is=()=>{let e=(0,ko.useTheme)();return{disabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",border:"1px solid rgb(206, 204, 204)",height:"40px","&:hover":{boxShadow:" 0px 2px 2px rgba(0, 0, 0, 0.79)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},enabled:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:" 0px 2px 1px rgba(0, 0, 0, 0.507)",border:`1px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}},outlined:{padding:"0px",margin:"0px",minWidth:"40px !important",borderRadius:"16px",backgroundColor:e.palette.grey[200],boxShadow:`0px 2px 1px ${e.palette.primary.light}`,border:`0px solid ${e.palette.primary.main}`,height:"40px","&:hover":{boxShadow:`0px 2px 1px ${e.palette.primary.main}`,border:`0px solid ${e.palette.primary.main}`},"&:active":{bgcolor:"primary.main",boxShadow:`inset 1px -2px 4px ${e.palette.primary.light}`}}}},We=is;var s=require("react/jsx-runtime"),ls=({each:e})=>{var k,x;let t=xe(),{showToast:a}=Le(),{disabled:l,enabled:r,outlined:o}=We(),g=(0,n.useTheme)(),[y,v]=(0,ne.useState)(!1),[f,b]=(0,ne.useState)(!1),[m,p]=(0,ne.useState)(!1),[h,C]=(0,ne.useState)(!1),[T,B]=(0,ne.useState)(!1),U=(S,N)=>{E.setConferenceLine(d(d({},S),N))},P=(S,N)=>{var L,H,K,W;let O=d(d({},S),N);v(!0);let q={action:"EXTERNAL_CONFERENCE",operation:`CALL${O.line}`,line_used:String(O.line),thirdparty_no:O.phone,userid:(H=(L=t.callData)==null?void 0:L.agent_id)!=null?H:"",process:(W=(K=t.callData)==null?void 0:K.process_name)!=null?W:""};te.post(M.CONFERENCE_CALL,q).then(A=>{var _;a((_=A.data)==null?void 0:_.message,"success"),E.setConferenceLine(d(d({},S),N))}).catch(A=>{var G,J,V,Q;let _=((J=(G=A.response)==null?void 0:G.data)==null?void 0:J.detail)||((Q=(V=A.response)==null?void 0:V.data)==null?void 0:Q.message)||A.message||"An unknown error occurred";a(_,"error")}).finally(()=>{v(!1)})},w=(S,N)=>{var L,H,K,W;let O=d(d({},S),N);b(!0);let q={action:"EXTERNAL_CONFERENCE",operation:"CONFERENCE",line_used:String(O.line),thirdparty_no:O.phone,userid:(H=(L=t.callData)==null?void 0:L.agent_id)!=null?H:"",process:(W=(K=t.callData)==null?void 0:K.process_name)!=null?W:""};te.post(M.CONFERENCE_CALL,q).then(A=>{var _;a((_=A.data)==null?void 0:_.message,"success"),E.setConferenceLine(d(d({},S),N))}).catch(A=>{var G,J,V,Q;let _=((J=(G=A.response)==null?void 0:G.data)==null?void 0:J.detail)||((Q=(V=A.response)==null?void 0:V.data)==null?void 0:Q.message)||A.message||"An unknown error occurred";a(_,"error")}).finally(()=>{b(!1)})},$=(S,N,O)=>{var H,K,W,A;let q=d(d({},S),N);p(!0);let L={action:"EXTERNAL_CONFERENCE",operation:O,hold_channel_no:O==="HOLDUSER"?`hold${q.line}`:`unhold${q.line}`,userid:(K=(H=t.callData)==null?void 0:H.agent_id)!=null?K:"",process:(A=(W=t.callData)==null?void 0:W.process_name)!=null?A:""};te.post(M.CONFERENCE_CALL_HOLD_OR_UN_HOLD,L).then(_=>{var G;a((G=_.data)==null?void 0:G.message,"success"),E.setConferenceLine(d(d({},S),N))}).catch(_=>{var J,V,Q,re;let G=((V=(J=_.response)==null?void 0:J.data)==null?void 0:V.detail)||((re=(Q=_.response)==null?void 0:Q.data)==null?void 0:re.message)||_.message||"An unknown error occurred";a(G,"error")}).finally(()=>{p(!1)})},X=(S,N,O)=>{var H,K,W,A;let q=d(d({},S),N);C(!0);let L={action:"EXTERNAL_CONFERENCE",operation:O,channel_no:O==="MUTEUSER"?`mute${q.line}`:`play${q.line}`,userid:(K=(H=t.callData)==null?void 0:H.agent_id)!=null?K:"",thirdparty_no:q.phone,process:(A=(W=t.callData)==null?void 0:W.process_name)!=null?A:""};te.post(M.CONFERENCE_CALL_MUTE_OT_UN_MUTE,L).then(_=>{var G;a((G=_.data)==null?void 0:G.message,"success"),E.setConferenceLine(d(d({},S),N))}).catch(_=>{var J,V,Q,re;let G=((V=(J=_.response)==null?void 0:J.data)==null?void 0:V.detail)||((re=(Q=_.response)==null?void 0:Q.data)==null?void 0:re.message)||_.message||"An unknown error occurred";a(G,"error")}).finally(()=>{C(!1)})},z=(S,N)=>{var L,H,K,W;let O=d(d({},S),N);B(!0);let q={action:"EXTERNAL_CONFERENCE",operation:"HANGUP_CHANNEL",line_used:String(O.line-1),user_type:`THIRDPARTY${O.line-1}`,thirdparty_no:O.phone,userid:(H=(L=t.callData)==null?void 0:L.agent_id)!=null?H:"",process:(W=(K=t.callData)==null?void 0:K.process_name)!=null?W:""};te.post(M.CONFERENCE_CALL_END,q).then(A=>{var _;a((_=A.data)==null?void 0:_.message,"success"),E.setConferenceLine(d(d({},S),N))}).catch(A=>{var G,J,V,Q;let _=((J=(G=A.response)==null?void 0:G.data)==null?void 0:J.detail)||((Q=(V=A.response)==null?void 0:V.data)==null?void 0:Q.message)||A.message||"An unknown error occurred";a(_,"error")}).finally(()=>{B(!1)})};return(0,s.jsxs)(n.TableRow,{sx:{border:"2px solid #fff"},children:[(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsxs)(n.Typography,{children:["Line ",(k=e==null?void 0:e.line)!=null?k:"",". "]})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsx)(n.Typography,{variant:"body2",sx:{px:1,borderRadius:"10px",width:"80px",maxWidth:"100px"},children:(x=e==null?void 0:e.status)!=null?x:""})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsx)(n.Button,{sx:{textTransform:"capitalize"},size:"small",children:(0,s.jsx)(n.Typography,{variant:"body2",children:(e==null?void 0:e.line)===1?"Internal":"External"})})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsx)(n.TextField,{size:"small",placeholder:"Phone Number",value:(e==null?void 0:e.phone)||"",disabled:(e==null?void 0:e.line)===1,onChange:S=>{U(e,{phone:S.target.value})}})}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:(0,s.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around"},children:[(0,s.jsx)(n.Tooltip,{title:"Call",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isCallStart?"outlined":"contained",color:"success",sx:e!=null&&e.isCallStart?d({},l):ee(d({},r),{border:`0px solid ${g.palette.success.light}`,"&:hover":{bgcolor:"success.light",boxShadow:`0px 2px 1px ${g.palette.success.light}`,border:`0px solid ${g.palette.success.light}`},"&:active":{bgcolor:"success.light",boxShadow:`inset 1px -2px 4px ${g.palette.primary.light}`}}),onClick:()=>{P(e,{isCallStart:!0,status:"ONCALL"})},disabled:(e==null?void 0:e.isCallStart)||y,children:y?(0,s.jsx)(n.CircularProgress,{size:"20px",color:"success"}):(0,s.jsx)(R.Call,{sx:{color:e!=null&&e.isCallStart?"default":"#e7e7e7ff"}})})}),(0,s.jsx)(n.Tooltip,{title:"Merge Call",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isMergeCall?"contained":"outlined",sx:e!=null&&e.isMergeCall&&(e!=null&&e.isCallStart)?d({},l):e!=null&&e.isCallStart?d({},o):d({},l),onClick:()=>{w(e,{isMergeCall:!0,status:"ONCALL"})},disabled:!(e!=null&&e.isCallStart)||f,children:f?(0,s.jsx)(n.CircularProgress,{size:"20px",sx:{color:e!=null&&e.isMergeCall?"#e7e7e7ff":g.palette.primary.main}}):(0,s.jsx)(R.CallSplit,{})})}),(0,s.jsx)(n.Tooltip,{title:e.isHold?"Hold":"Un Hold",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isHold?"contained":"outlined",sx:e!=null&&e.isHold&&(e!=null&&e.isCallStart)?d({},l):e!=null&&e.isCallStart?d({},o):d({},l),onClick:()=>{e.isHold?$(e,{isHold:!1},"UNHOLDUSER"):$(e,{isHold:!0},"HOLDUSER")},disabled:!(e!=null&&e.isCallStart)||m,children:m?(0,s.jsx)(n.CircularProgress,{size:"20px",sx:{color:g.palette.primary.main}}):e.isHold?(0,s.jsx)(R.PlayArrow,{}):(0,s.jsx)(R.Pause,{})})}),(0,s.jsx)(n.Tooltip,{title:e.isMute?"Mute":"Un Mute",children:(0,s.jsx)(n.Button,{variant:e!=null&&e.isMute?"contained":"outlined",sx:e!=null&&e.isMute&&(e!=null&&e.isCallStart)?d({},l):e!=null&&e.isCallStart?d({},o):d({},l),onClick:()=>{e.isMute?X(e,{isMute:!1},"PLAYUSER"):X(e,{isMute:!0},"MUTEUSER")},disabled:!(e!=null&&e.isCallStart)||h,children:h?(0,s.jsx)(n.CircularProgress,{size:"20px",sx:{color:g.palette.primary.main}}):e.isMute?(0,s.jsx)(R.MicOff,{}):(0,s.jsx)(R.Mic,{})})}),(0,s.jsx)(n.Tooltip,{title:"End Call",children:(e==null?void 0:e.line)!==1?(0,s.jsx)(n.Button,{variant:e!=null&&e.isCallStart?"contained":"outlined",color:"error",sx:e!=null&&e.isCallStart?ee(d({},r),{minWidth:"60px !important",border:`0px solid ${g.palette.error.light}`,"&:hover":{bgcolor:"error.light",boxShadow:`0px 2px 1px ${g.palette.error.light}`,border:`0px solid ${g.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${g.palette.primary.light}`}}):ee(d({},l),{minWidth:"60px !important"}),onClick:()=>{z(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart)||T,children:T?(0,s.jsx)(n.CircularProgress,{size:"20px",color:"error"}):(0,s.jsx)(R.CallEnd,{})}):(0,s.jsx)(n.Button,{variant:e!=null&&e.isCallStart?"contained":"outlined",sx:ee(d({},l),{visibility:"hidden",minWidth:"60px !important"}),onClick:()=>{z(e,{isCallStart:!1,isMergeCall:!1,isMute:!1,isHold:!1,status:"IDLE",phone:""})},disabled:!(e!=null&&e.isCallStart),children:(0,s.jsx)(n.Typography,{children:(0,s.jsx)(R.CallEnd,{sx:{visibility:"hidden"}})})})})]})})]},e.line)};function No({open:e,setOpen:t}){var v;let a=xe(),{showToast:l}=Le(),[r,o]=(0,ne.useState)(!1),g=()=>{t(!1)},y=()=>{var b,m,p,h;o(!0);let f={action:"EXTERNAL_CONFERENCE",operation:"ENDCONFERENCE",userid:(m=(b=a.callData)==null?void 0:b.agent_id)!=null?m:"",process:(h=(p=a.callData)==null?void 0:p.process_name)!=null?h:""};te.post(M.CONFERENCE_CALL_END_ALL,f).then(C=>{var T;l((T=C.data)==null?void 0:T.message,"success"),E.resetConferenceLines(),g()}).catch(C=>{var B,U,P,w;let T=((U=(B=C.response)==null?void 0:B.data)==null?void 0:U.detail)||((w=(P=C.response)==null?void 0:P.data)==null?void 0:w.message)||C.message||"An unknown error occurred";l(T,"error")}).finally(()=>{o(!1)})};return(0,ne.useEffect)(()=>{var b,m,p,h;let f={line:1,status:(m=(b=a.callData)==null?void 0:b.status)!=null?m:"",type:"internal",phone:(h=(p=a.callData)==null?void 0:p.phone_number)!=null?h:"",isMute:!1,isHold:!1,isMergeCall:!1,isCallStart:!0};E.setConferenceLine(f)},[]),(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px"},children:[(0,s.jsxs)(n.Typography,{variant:"body1",children:[(v=a==null?void 0:a.agentId)!=null?v:""," conference"]}),(0,s.jsx)(n.IconButton,{onClick:g,children:(0,s.jsx)(R.Close,{})})]}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 2px #e7e5e5ff",margin:"0px 15px",borderRadius:"20px"},children:(0,s.jsx)(n.TableContainer,{component:n.Paper,sx:{outline:"0px solid gray !important",boxShadow:"1px 1px 6px #e7e5e5ff"},children:(0,s.jsxs)(n.Table,{sx:{border:"4px solid #ffffff !important"},children:[(0,s.jsx)(n.TableHead,{children:(0,s.jsxs)(n.TableRow,{sx:{border:"2px solid #f3f3f3ff !important"},children:[(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Line"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Status"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Call Type"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Mobile Number"}),(0,s.jsx)(n.TableCell,{sx:{padding:"6px"},children:"Call Actions"})]})}),(0,s.jsx)(n.TableBody,{children:a==null?void 0:a.conferenceLine.map(f=>(0,s.jsx)(ls,{each:f}))})]})})}),(0,s.jsx)(n.Box,{textAlign:"center",m:2,children:(0,s.jsxs)(n.Button,{variant:"outlined",color:"error",size:"large",onClick:y,disabled:r,sx:{px:2,borderRadius:"20px",textTransform:"capitalize"},children:[r?(0,s.jsx)(n.CircularProgress,{size:"20px",color:"error",sx:{marginRight:"8px"}}):(0,s.jsx)(n.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)(R.PhoneDisabled,{sx:{color:"white",fontSize:"16px",fontWeight:"600"}})}),"End Conference"]})})]})})})}function Ao({open:e,setOpen:t}){var p,h,C,T,B,U,P,w,$,X,z,k;let[a]=ae({onSuccess:x=>{console.log("res",x),t(!1)},onError:x=>{console.log("error",x)}}),l=xe(),[r,o]=(0,ne.useState)("process"),[g,{data:y}]=ae(),[v,{data:f}]=ae(),b=()=>{t(!1)},m=(x,S)=>{var N,O,q,L,H,K,W,A,_,G,J,V,Q,re,De,Ie,_e,Re,ye,we,Ce,ke,he,Ne,Ae,Pe,be,Oe,Me,Ue,Be,He,$e;if(console.log(x,"data34"),S==="PROCESS"){let me={mobile_number:(O=(N=l.callData)==null?void 0:N.phone_number)!=null?O:"",userid:(L=(q=l.callData)==null?void 0:q.agent_id)!=null?L:"",type:"PROCESS",transfer_to:(H=x==null?void 0:x.process_name)!=null?H:"",callreferenceid:(W=(K=l.callData)==null?void 0:K.convox_id)!=null?W:"",processid:String((_=(A=l.callData)==null?void 0:A.process_id)!=null?_:""),process_name:(J=(G=l.callData)==null?void 0:G.process_name)!=null?J:""};a(M.TRANSFER_CALL,me)}else if(S==="QUEUE"){let me={mobile_number:(Q=(V=l.callData)==null?void 0:V.phone_number)!=null?Q:"",userid:(De=(re=l.callData)==null?void 0:re.agent_id)!=null?De:"",type:"QUEUE",transfer_to:(Ie=x==null?void 0:x.queue_name)!=null?Ie:"",callreferenceid:(Re=(_e=l.callData)==null?void 0:_e.convox_id)!=null?Re:"",processid:String((we=(ye=l.callData)==null?void 0:ye.process_id)!=null?we:""),process_name:(ke=(Ce=l.callData)==null?void 0:Ce.process_name)!=null?ke:""};a(M.TRANSFER_CALL,me)}else if(S==="AGENT"){let me={mobile_number:(Ne=(he=l.callData)==null?void 0:he.phone_number)!=null?Ne:"",userid:(Pe=(Ae=l.callData)==null?void 0:Ae.agent_id)!=null?Pe:"",type:"AGENT",transfer_to:(be=x==null?void 0:x.user_id)!=null?be:"",callreferenceid:(Me=(Oe=l.callData)==null?void 0:Oe.convox_id)!=null?Me:"",processid:String((Be=(Ue=l.callData)==null?void 0:Ue.process_id)!=null?Be:""),process_name:($e=(He=l.callData)==null?void 0:He.process_name)!=null?$e:""};a(M.TRANSFER_CALL,me)}};return(0,ne.useEffect)(()=>{g(M.AGENTS_LIST,{status:"IDLE",active:!0}),v(M.TRANSFER_TO_DETAILS,{status:"ACTIVE",active:!0})},[]),console.log(y,"idleAgentsList"),(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[(0,s.jsx)(n.Typography,{variant:"body1",children:" Call Transfer"}),(0,s.jsx)(n.IconButton,{onClick:b,children:(0,s.jsx)(R.Close,{})})]}),(0,s.jsxs)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",gap:1},children:[(0,s.jsx)(n.Button,{variant:r==="process"?"contained":"outlined",onClick:()=>o("process"),children:"Process"}),(0,s.jsx)(n.Button,{variant:r==="queues"?"contained":"outlined",onClick:()=>o("queues"),children:"Queues"}),(0,s.jsx)(n.Button,{variant:r==="agents"?"contained":"outlined",onClick:()=>o("agents"),children:"Agents"})]}),r==="process"&&(0,s.jsx)(n.Box,{sx:{display:"flex",gap:1},children:(p=f==null?void 0:f.data)!=null&&p.process&&((C=(h=f==null?void 0:f.data)==null?void 0:h.process)==null?void 0:C.length)>0?(B=(T=f==null?void 0:f.data)==null?void 0:T.process)==null?void 0:B.map((x,S)=>(0,s.jsxs)(n.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)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(R.SupportAgent,{sx:{marginRight:"4px"}}),x.process_name]}),(0,s.jsx)(n.IconButton,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{m(x,"PROCESS")},children:(0,s.jsx)(R.Call,{})})]},S)):(0,s.jsx)(n.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"})}),r==="queues"&&(0,s.jsx)(n.Box,{sx:{display:"flex",gap:1},children:(U=f==null?void 0:f.data)!=null&&U.queue&&((w=(P=f==null?void 0:f.data)==null?void 0:P.queue)==null?void 0:w.length)>0?(X=($=f==null?void 0:f.data)==null?void 0:$.queue)==null?void 0:X.map((x,S)=>{var N,O,q,L,H,K;return(0,s.jsxs)(n.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)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(R.SupportAgent,{sx:{marginRight:"4px"}}),x.queue_name,(q=(O=(N=f==null?void 0:f.data)==null?void 0:N.process)==null?void 0:O.find(W=>W.process_id===x.process_id))!=null&&q.process_name?(0,s.jsx)(n.Typography,{variant:"body1",sx:{fontSize:"12px",fontWeight:"600",letterSpacing:"0.02em",textTransform:"capitalize",color:"gray"},children:"("+((K=(H=(L=f==null?void 0:f.data)==null?void 0:L.process)==null?void 0:H.find(W=>W.process_id===x.process_id))==null?void 0:K.process_name)+")"}):""]}),(0,s.jsx)(n.IconButton,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{m(x,"QUEUE")},children:(0,s.jsx)(R.Call,{})})]},S)}):(0,s.jsx)(n.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"})}),r==="agents"&&(0,s.jsx)(n.Box,{sx:{display:"flex",gap:1},children:y!=null&&y.data&&((z=y==null?void 0:y.data)==null?void 0:z.length)>0?(k=y==null?void 0:y.data)==null?void 0:k.map((x,S)=>(0,s.jsxs)(n.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)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(R.SupportAgent,{sx:{marginRight:"4px"}}),x.name]}),(0,s.jsx)(n.IconButton,{color:"success",sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},onClick:()=>{m(x,"AGENT")},children:(0,s.jsx)(R.Call,{})})]},S)):(0,s.jsx)(n.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 Po({open:e,setOpen:t,onSubmitDisposition:a}){var b,m;let[l,r]=(0,ne.useState)({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""}),o=[{label:"Not Interested",value:"NI"},{label:"Resolved",value:"RES"}],g=[{label:"Yes",value:"Y"},{label:"No",value:"N"}],y=(p,h)=>{r(C=>ee(d({},C),{[p]:h}))},v=()=>{r({disposition:{label:"Resolved",value:"RES"},followUp:{label:"No",value:"N"},callbackDate:"",callbackHrs:"",callbackMins:""})},f=()=>{v(),t(!1)};return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"xs",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsx)(n.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:(0,s.jsxs)(n.Typography,{variant:"body1",m:1,children:[" ","Call Disposition"]})}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"10px",margin:"10px",borderRadius:"10px"},children:(0,s.jsxs)(n.Grid,{container:!0,spacing:2,children:[(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.Autocomplete,{value:l.disposition,options:o,getOptionLabel:p=>p.label,onChange:(p,h)=>y("disposition",h),size:"small",renderInput:p=>(0,s.jsx)(n.TextField,ee(d({},p),{label:"Disposition",fullWidth:!0}))})}),(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.Autocomplete,{options:g,getOptionLabel:p=>p.label,value:l.followUp,onChange:(p,h)=>y("followUp",h),size:"small",renderInput:p=>(0,s.jsx)(n.TextField,ee(d({},p),{label:"Follow Up",fullWidth:!0}))})}),((m=(b=l==null?void 0:l.followUp)==null?void 0:b.label)==null?void 0:m.toLowerCase())==="yes"&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.TextField,{size:"small",label:"Callback Date",type:"date",slotProps:{inputLabel:{shrink:!0}},value:l.callbackDate,onChange:p=>y("callbackDate",p.target.value),fullWidth:!0})}),(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.TextField,{size:"small",label:"Hours (0-23)",type:"text",inputProps:{min:0,max:23},value:l.callbackHrs,onChange:p=>y("callbackHrs",p.target.value),fullWidth:!0})}),(0,s.jsx)(n.Grid,{size:6,children:(0,s.jsx)(n.TextField,{size:"small",label:"Minutes (0-59)",type:"text",inputProps:{min:0,max:59},value:l.callbackMins,onChange:p=>y("callbackMins",p.target.value),fullWidth:!0})})]})]})}),(0,s.jsxs)(n.Box,{textAlign:"right",m:2,children:[(0,s.jsx)(n.Button,{variant:"outlined",color:"error",size:"large",onClick:f,sx:{px:2,mx:1,borderRadius:"10px",textTransform:"capitalize"},children:"cancel"}),(0,s.jsx)(n.Button,{variant:"contained",color:"primary",size:"large",onClick:()=>a(l),sx:{px:2,borderRadius:"10px",textTransform:"capitalize"},children:"Submit"})]})]})})})}function Oo({open:e,setOpen:t,processList:a=null,handleSelectedProcessor:l}){var o,g;return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",maxWidth:"xs",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[(0,s.jsx)(n.Typography,{variant:"body1",children:" Process List"}),(0,s.jsx)(n.IconButton,{onClick:()=>{t(!1)},children:(0,s.jsx)(R.Close,{})})]}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",padding:"6px 10px",margin:"10px",borderRadius:"10px"},children:((o=a==null?void 0:a.processes)==null?void 0:o.length)>0?(g=a==null?void 0:a.processes)==null?void 0:g.map((y,v)=>(0,s.jsx)(n.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:()=>{l(y)},children:(0,s.jsxs)(n.Typography,{variant:"body1",sx:{mx:1,width:"200px",maxWidth:"250px",display:"flex",alignItems:"center"},children:[(0,s.jsx)(R.SupportAgent,{sx:{marginRight:"4px"}}),y.process_name]})},v)):null})]})})})}function Mo({open:e,setOpen:t}){return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(n.Dialog,{open:e,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:"md",children:(0,s.jsxs)(n.Paper,{sx:{borderRadius:2},children:[(0,s.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 16px",boxShadow:"0px 1px 2px #f5f5f5ff"},children:[(0,s.jsx)(n.Typography,{variant:"body1",children:" Call History"}),(0,s.jsx)(n.IconButton,{onClick:()=>{t(!1)},children:(0,s.jsx)(R.Close,{})})]}),(0,s.jsx)(n.Box,{sx:{boxShadow:"1px 1px 4px #d3d3d3ff",margin:"10px",borderRadius:"10px",textAlign:"center",fontSize:"16px",fontWeight:"bold"},p:6,children:"Coming Soon..."})]})})})}var c=require("react/jsx-runtime");function Uo({onDataChange:e}){var Ze,et,tt,ot,st,at,nt,it,lt,rt,ct,pt,dt,ut,gt,ft,mt,xt,yt,Ct,ht,bt,vt,St,Et,Tt,Lt,Dt,It,_t,Rt,wt,kt,Nt,At,Pt,Ot,Mt,Ut,Bt,Ht,$t,zt,qt,Ft,Wt,Gt,Kt,jt,Yt,Xt,Jt,Vt,Qt,Zt,eo,to,oo,so,ao,no,io,lo,ro,co,po;let t=(0,u.useTheme)(),{disabled:a,enabled:l,outlined:r}=We(),o=xe(),g=(0,Y.useRef)(null),[y,v]=(0,Y.useState)(null),[f,b]=(0,Y.useState)(!0),[m,p]=(0,Y.useState)(null),[h,C]=(0,Y.useState)(null),[T,B]=(0,Y.useState)(!1),[U,P]=(0,Y.useState)(!1),[w,$]=(0,Y.useState)(!1),[X,z]=(0,Y.useState)(!1),[k,x]=(0,Y.useState)(!1),[S,N]=(0,Y.useState)(""),[O,q]=(0,Y.useState)(0),{position:L,isDragging:H,dragRef:K,handleMouseDown:W,handleTouchStart:A}=Je(o.controlPanelPosition,i=>E.setControlPanelPosition(i)),{position:_,isDragging:G,dragRef:J,handleMouseDown:V,handleTouchStart:Q}=Je(o.iframePosition,i=>E.setIframePosition(i)),[re,{data:De}]=ae({onSuccess:i=>{var D;console.log("res",i),i&&i.data&&((D=i==null?void 0:i.data)==null?void 0:D.length)>1?z(!0):(E.setProcess(i==null?void 0:i.data[0]),z(!1))},onError:()=>{z(!1)}}),[Ie,{isLoading:_e}]=ae(),[Re,{isLoading:ye}]=ae({onSuccess:()=>{E.setHolding(!o.isHolding)},onError:i=>{console.log("error",i)}}),[we,{isLoading:Ce}]=ae({onSuccess:()=>{E.setMuted(!o.isMuted)},onError:i=>{console.log("error",i)}}),[ke,{isLoading:he}]=ae(),[Ne,{isLoading:Ae}]=ae(),[Pe,{isLoading:be}]=ae(),Oe=(0,Y.useCallback)(i=>{let D=Math.floor(i/60),Z=i%60;return`${D.toString().padStart(2,"0")}:${Z.toString().padStart(2,"0")}`},[]),Me=()=>{v(null)},Ue=i=>{b(!0),C(i.currentTarget),E.setStatus("dial")},Be=()=>{o.status!=="on call"&&E.setStatus("idle"),C(null)},He=i=>{p(i.currentTarget)},$e=()=>{p(null)},me=()=>{let i={action:"READYAGENT",userId:o.agentId};ke(M.READY_AGENT,i)},Qe=i=>{p(null);let D={action:"AGENTBREAK",break_type:i,userId:o.agentId};Ne(M.UPDATE_AGENT_BREAK,D)},zo=i=>{if(i.length!==10)alert("Invalid phone number");else if(/^\d+$/.test(i)){let D={action:"CALL",phone_number:i,userId:o.agentId};Ie(M.CLICK_TO_CALL,D)}},qo=()=>{let i={action:o.isHolding?"UNHOLD":"HOLD",userId:o.agentId};Re(M.HOLD_CALL,i)},Fo=()=>{let i={action:o.isMuted?"UNMUTE":"MUTE",userId:o.agentId};we(M.MUTE_CALL,i)},Wo=i=>{var Z,ie,le,ce,pe,ve,Se,uo,go,fo,mo,xo,yo,Co,ho,bo;console.log("data",i);let D={action:"ENDCALL",userId:o.agentId,processid:(le=(ie=(Z=o.process)==null?void 0:Z.process_id)==null?void 0:ie.toString())!=null?le:"",process_name:(pe=(ce=o.process)==null?void 0:ce.process_name)!=null?pe:"",callreferenceid:(Se=(ve=o.callData)==null?void 0:ve.convox_id)!=null?Se:"",mobile_number:(go=(uo=o.callData)==null?void 0:uo.phone_number)!=null?go:"",disposition:(mo=(fo=i==null?void 0:i.disposition)==null?void 0:fo.value)!=null?mo:"",set_followUp:(yo=(xo=i==null?void 0:i.followUp)==null?void 0:xo.value)!=null?yo:"",callback_date:(Co=i==null?void 0:i.callbackDate)!=null?Co:"",callback_hrs:(ho=i==null?void 0:i.callbackHrs)!=null?ho:"",callback_mins:(bo=i==null?void 0:i.callbackMins)!=null?bo:"",endcall_type:"CLOSE"};N(""),Pe(M.END_CALL,D),E.endCall(),$(!1)};return(0,Y.useEffect)(()=>{let i;return o.callData.status&&o.callData.status==="ONCALL"?i=setInterval(()=>{let D=Math.floor((Date.now()-o.callStartTime)/1e3);q(D)},1e3):q(0),()=>{i&&clearInterval(i)}},[o.callData.status]),(0,Y.useEffect)(()=>{e&&e(o.callData)},[o.callData,e]),(0,Y.useEffect)(()=>{o.agentId?re(M.PROCESS_LIST,{userId:o.agentId,action:"GETAGENTPROCESSLIST",refno:"1234221233"}):console.log("No agentId available, skipping API call")},[o.agentId]),(0,Y.useEffect)(()=>(o.agentId&&(g.current=new WebSocket(`${To.WS}?agent_id=${o.agentId}`),g.current.onopen=()=>{console.log("WebSocket connection established")},g.current.onmessage=i=>{try{let D=JSON.parse(i.data);console.log("parsedJSON:",D),E.updateCallData(D),D.status==="ONCALL"&&E.startCall(),D.status==="WRAPUP"&&E.endCall()}catch(D){console.log("Raw message:",i.data)}},g.current.onclose=()=>{console.log("WebSocket connection closed")},g.current.onerror=i=>{console.error("WebSocket error:",i)}),()=>{var i;(i=g.current)==null||i.close()}),[o.agentId]),!o.isInitialized||!o.process?(0,c.jsx)(u.Box,{children:!!X&&(0,c.jsx)(Oo,{processList:De,open:X,setOpen:z,handleSelectedProcessor:i=>{E.setProcess(i)}})}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(u.Fade,{in:!0,timeout:300,children:(0,c.jsx)(u.Paper,{ref:K,elevation:H?4:1,sx:{position:"fixed",left:L.x,top:L.y,p:.5,borderRadius:3,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),userSelect:"none"},children:(0,c.jsxs)(u.Box,{sx:{display:"flex",alignItems:"center"},children:[(0,c.jsxs)(u.Box,{sx:{display:"flex",alignItems:"center"},children:[(0,c.jsxs)(u.IconButton,{component:"div",size:"small",sx:{cursor:"all-scroll"},onMouseDown:W,onTouchStart:A,children:[(0,c.jsx)(I.DragIndicator,{})," "]}),(0,c.jsx)(u.Box,{sx:{marginRight:"10px"},children:(0,c.jsx)(u.Tooltip,{title:"Dial",children:(0,c.jsx)(u.IconButton,{size:"small",onClick:i=>{var D,Z,ie,le,ce,pe,ve,Se;((Z=(D=o.callData)==null?void 0:D.status)==null?void 0:Z.toUpperCase())!=="ONCALL"&&((le=(ie=o.callData)==null?void 0:ie.status)==null?void 0:le.toUpperCase())!=="BREAK"&&((pe=(ce=o.callData)==null?void 0:ce.status)==null?void 0:pe.toUpperCase())!=="RINGING"&&((Se=(ve=o.callData)==null?void 0:ve.status)==null?void 0:Se.toUpperCase())!=="WRAPUP"&&Ue(i)},sx:{bgcolor:"action.hover","&:hover":{bgcolor:"warning"}},children:(0,c.jsx)(I.WifiCalling3,{sx:{color:((et=(Ze=o.callData)==null?void 0:Ze.status)==null?void 0:et.toUpperCase())==="ONCALL"||((ot=(tt=o.callData)==null?void 0:tt.status)==null?void 0:ot.toUpperCase())==="BREAK"||((at=(st=o.callData)==null?void 0:st.status)==null?void 0:at.toUpperCase())==="RINGING"||((it=(nt=o.callData)==null?void 0:nt.status)==null?void 0:it.toUpperCase())==="WRAPUP"?"action.selected":"success.main"}})})})}),(0,c.jsx)(u.Typography,{sx:{color:"success.main",width:"40px",marginRight:"10px"},children:Oe(O)}),Ae||he?(0,c.jsx)(u.Box,{sx:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,c.jsx)(u.CircularProgress,{size:"20px"})}):(0,c.jsx)(u.Typography,{variant:"body2",sx:{fontWeight:"bold",textAlign:"right"},children:(ct=(rt=(lt=o.callData)==null?void 0:lt.status)==null?void 0:rt.toUpperCase())!=null?ct:"N/A"}),(0,c.jsx)(u.Box,{onClick:He,sx:{display:"flex",alignItems:"center",margin:"6px",cursor:"pointer"},children:(0,c.jsx)(I.ArrowDropDown,{})})]}),(0,c.jsxs)(u.Box,{sx:{display:"flex",gap:1,justifyContent:"center",alignItems:"center"},children:[(0,c.jsx)(u.Tooltip,{title:"Agent Ready",children:(0,c.jsx)(u.Button,{variant:((dt=(pt=o.callData)==null?void 0:pt.status)==null?void 0:dt.toUpperCase())==="BREAK"||((gt=(ut=o.callData)==null?void 0:ut.status)==null?void 0:gt.toUpperCase())==="MISSED"?"outlined":"contained",onClick:i=>{var D,Z,ie,le;(((Z=(D=o.callData)==null?void 0:D.status)==null?void 0:Z.toUpperCase())==="BREAK"||((le=(ie=o.callData)==null?void 0:ie.status)==null?void 0:le.toUpperCase())==="MISSED")&&(i.stopPropagation(),me())},classes:{root:((mt=(ft=o.callData)==null?void 0:ft.status)==null?void 0:mt.toUpperCase())==="BREAK"||((yt=(xt=o.callData)==null?void 0:xt.status)==null?void 0:yt.toUpperCase())==="MISSED"?"outlined":"enabled"},sx:d({},((ht=(Ct=o.callData)==null?void 0:Ct.status)==null?void 0:ht.toUpperCase())==="BREAK"||((vt=(bt=o.callData)==null?void 0:bt.status)==null?void 0:vt.toUpperCase())==="MISSED"?r:l),disabled:he,children:(0,c.jsx)(I.SupportAgent,{})})}),(0,c.jsx)(u.Tooltip,{title:o.isHolding?"Resume":"Hold",children:(0,c.jsx)(u.Button,{variant:o.isHolding&&((Et=(St=o.callData)==null?void 0:St.status)==null?void 0:Et.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:i=>{i.stopPropagation(),qo()},sx:o.isHolding&&((Lt=(Tt=o.callData)==null?void 0:Tt.status)==null?void 0:Lt.toUpperCase())==="ONCALL"?d({},l):((It=(Dt=o.callData)==null?void 0:Dt.status)==null?void 0:It.toUpperCase())==="ONCALL"?d({},r):d({},a),disabled:((Rt=(_t=o.callData)==null?void 0:_t.status)==null?void 0:Rt.toUpperCase())!=="ONCALL"&&!o.isHolding||ye,children:ye?(0,c.jsx)(u.CircularProgress,{size:"20px",sx:{color:t.palette.primary.main}}):o.isHolding?(0,c.jsx)(I.PlayArrow,{}):(0,c.jsx)(I.Pause,{})})}),(0,c.jsx)(u.Tooltip,{title:o.isMuted?"Unmute":"Mute",children:(0,c.jsx)(u.Button,{variant:o.isMuted&&((kt=(wt=o.callData)==null?void 0:wt.status)==null?void 0:kt.toUpperCase())==="ONCALL"?"contained":"outlined",onClick:i=>{i.stopPropagation(),Fo()},sx:o.isMuted&&((At=(Nt=o.callData)==null?void 0:Nt.status)==null?void 0:At.toUpperCase())==="ONCALL"?d({},l):((Ot=(Pt=o.callData)==null?void 0:Pt.status)==null?void 0:Ot.toUpperCase())==="ONCALL"?d({},r):d({},a),disabled:((Ut=(Mt=o.callData)==null?void 0:Mt.status)==null?void 0:Ut.toUpperCase())!=="ONCALL"&&!o.isMuted||Ce,children:Ce?(0,c.jsx)(u.CircularProgress,{size:"20px",sx:{color:t.palette.primary.main}}):o.isMuted?(0,c.jsx)(I.MicOff,{}):(0,c.jsx)(I.Mic,{})})}),(0,c.jsx)(u.Tooltip,{title:"Transfer Call",children:(0,c.jsx)(u.Button,{variant:U?"contained":"outlined",onClick:i=>{var D,Z;((Z=(D=o.callData)==null?void 0:D.status)==null?void 0:Z.toUpperCase())==="ONCALL"&&(i.stopPropagation(),P(!0))},sx:U?d({},l):((Ht=(Bt=o.callData)==null?void 0:Bt.status)==null?void 0:Ht.toUpperCase())==="ONCALL"?d({},r):d({},a),disabled:((zt=($t=o.callData)==null?void 0:$t.status)==null?void 0:zt.toUpperCase())!=="ONCALL",children:(0,c.jsx)(I.TransferWithinAStation,{})})}),(0,c.jsx)(u.Tooltip,{title:"Conference Call",children:(0,c.jsx)(u.Button,{variant:T?"contained":"outlined",onClick:i=>{var D,Z;((Z=(D=o.callData)==null?void 0:D.status)==null?void 0:Z.toUpperCase())==="ONCALL"&&(i.stopPropagation(),B(!0))},sx:T?d({},l):((Ft=(qt=o.callData)==null?void 0:qt.status)==null?void 0:Ft.toUpperCase())==="ONCALL"?d({},r):d({},a),disabled:((Gt=(Wt=o.callData)==null?void 0:Wt.status)==null?void 0:Gt.toUpperCase())!=="ONCALL",children:(0,c.jsx)(I.Group,{})})}),(0,c.jsx)(u.Tooltip,{title:"End Call",children:(0,c.jsx)(u.Button,{variant:((jt=(Kt=o.callData)==null?void 0:Kt.status)==null?void 0:jt.toUpperCase())==="ONCALL"||((Xt=(Yt=o.callData)==null?void 0:Yt.status)==null?void 0:Xt.toUpperCase())==="RINGING"||((Vt=(Jt=o.callData)==null?void 0:Jt.status)==null?void 0:Vt.toUpperCase())==="WRAPUP"?"contained":"outlined",onClick:i=>{var D,Z,ie,le,ce,pe;(((Z=(D=o.callData)==null?void 0:D.status)==null?void 0:Z.toUpperCase())==="ONCALL"||((le=(ie=o.callData)==null?void 0:ie.status)==null?void 0:le.toUpperCase())==="RINGING"||((pe=(ce=o.callData)==null?void 0:ce.status)==null?void 0:pe.toUpperCase())==="WRAPUP")&&(i.stopPropagation(),$(!0))},sx:((Zt=(Qt=o.callData)==null?void 0:Qt.status)==null?void 0:Zt.toUpperCase())==="ONCALL"||((to=(eo=o.callData)==null?void 0:eo.status)==null?void 0:to.toUpperCase())==="RINGING"||((so=(oo=o.callData)==null?void 0:oo.status)==null?void 0:so.toUpperCase())==="WRAPUP"?ee(d({},l),{borderRight:"1px",backgroundColor:"error.main",minWidth:"60px !important",boxShadow:" 0px 2px 1px #5f3f3f",border:`1px solid ${t.palette.error.light}`,height:"40px","&:hover":{bgcolor:"error.light",boxShadow:" 0px 2px 1px #5f3f3f",border:`0px solid ${t.palette.error.light}`},"&:active":{bgcolor:"error.light",boxShadow:`inset 1px -2px 4px ${t.palette.primary.light}`}}):ee(d({},a),{minWidth:"60px !important"}),disabled:((no=(ao=o.callData)==null?void 0:ao.status)==null?void 0:no.toUpperCase())!=="ONCALL"&&((lo=(io=o.callData)==null?void 0:io.status)==null?void 0:lo.toUpperCase())!=="RINGING"&&((co=(ro=o.callData)==null?void 0:ro.status)==null?void 0:co.toUpperCase())!=="WRAPUP"||be,children:be?(0,c.jsx)(u.CircularProgress,{size:"20px",color:"error"}):(0,c.jsx)(I.CallEnd,{})})})]})]})})}),(0,c.jsx)(u.Fade,{in:!0,timeout:300,children:(0,c.jsxs)(u.Paper,{ref:J,elevation:G?4:1,sx:{position:"fixed",left:_.x,top:_.y,p:1,height:"auto",borderRadius:2,bgcolor:"background.paper",zIndex:99999,transition:t.transitions.create(["box-shadow","transform"],{duration:t.transitions.duration.short}),visibility:f?"visible":"hidden",userSelect:"none"},children:[(0,c.jsxs)(u.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"all-scroll"},onMouseDown:V,onTouchStart:Q,children:[(0,c.jsx)(I.DragIndicator,{sx:{transform:"rotate(90deg)"}})," ",(0,c.jsx)(u.IconButton,{onClick:()=>b(!1),children:(0,c.jsx)(I.Close,{})})]}),(0,c.jsx)("iframe",{src:`https://h68.deepijatel.in/ConVoxCCS/iframe?agent_id=${o.agentId}&process_id=${(po=o.process)==null?void 0:po.process_id}`,height:380,width:420,allow:"camera; microphone; autoplay"})]})}),(0,c.jsx)(u.Menu,{anchorEl:h,open:!!h,onClose:Be,onClick:i=>i.stopPropagation(),sx:{zIndex:99999},children:(0,c.jsxs)(u.Box,{sx:{all:"unset",padding:"10px","&hover":{backgroundColor:"white"}},children:[(0,c.jsx)(u.TextField,{size:"small",value:S,placeholder:"Enter Mobile No.",onChange:i=>{N(i.target.value)}}),(0,c.jsx)(u.IconButton,{color:"info",onClick:()=>{zo(S)},children:_e?(0,c.jsx)(u.CircularProgress,{size:"20px",sx:{color:t.palette.success.main}}):(0,c.jsx)(I.Phone,{color:"success"})})]})}),(0,c.jsxs)(u.Menu,{anchorEl:m,open:!!m,onClose:$e,onClick:i=>i.stopPropagation(),sx:{zIndex:99999},children:[(0,c.jsx)(u.MenuItem,{onClick:()=>Qe("Lunch"),children:"- Lunch"}),(0,c.jsx)(u.MenuItem,{onClick:()=>Qe("Tea"),children:"- Tea"})]}),(0,c.jsx)(u.Menu,{anchorEl:y,open:!!y,onClose:Me,onClick:i=>i.stopPropagation(),sx:{zIndex:99999},children:(0,c.jsxs)(u.Box,{sx:{display:"flex",justifyContent:"flex-start",flexDirection:"column",padding:"0px 10px","&hover":{backgroundColor:"white"}},children:[(0,c.jsx)(u.Chip,{icon:(0,c.jsx)(I.Layers,{color:"secondary"}),variant:"outlined",label:"Waiting - 25",sx:{margin:"4px 2px"}}),(0,c.jsx)(u.Chip,{icon:(0,c.jsx)(I.Pending,{color:"info"}),label:"Pending - 99+",variant:"outlined",sx:{margin:"4px 2px"}}),(0,c.jsx)(u.Chip,{icon:(0,c.jsx)(I.Upcoming,{color:"success"}),variant:"outlined",label:"Upcoming - 66",sx:{margin:"4px 2px"}})]})}),!!T&&(0,c.jsx)(No,{open:T,setOpen:B}),!!U&&(0,c.jsx)(Ao,{open:U,setOpen:P}),!!w&&(0,c.jsx)(Po,{open:w,setOpen:$,onSubmitDisposition:Wo}),!!k&&(0,c.jsx)(Mo,{open:k,setOpen:x})]})}var Ho=require("react/jsx-runtime"),Bo=({children:e})=>(0,Ho.jsx)(wo,{children:e});var Ve=require("react/jsx-runtime");function $o({onDataChange:e}){return(0,Ve.jsx)(Bo,{children:(0,Ve.jsx)(Uo,{onDataChange:e})})}function rs({apiKey:e,tenantId:t,agentId:a}){E.initialize(e,a),je.init({apiKey:e,tenantId:t,agentId:a,baseUrl:F})}0&&(module.exports={CallControlPanel,initSDK,useClickToCall,useEndCall,useLogout});
2
2
  //# sourceMappingURL=index.js.map