call-control-sdk 6.5.2 → 6.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -19,6 +19,9 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
21
 
22
+ // call-control-sdk/lib/hooks/sdk-state.ts
23
+ import { getItem, removeItem, setItem } from "@react-solutions/vault";
24
+
22
25
  // call-control-sdk/lib/services/endPoint.ts
23
26
  var IP = "cti.aighospitals.com";
24
27
  var BASE_URL = `https://${IP}:8095`;
@@ -47,7 +50,10 @@ var END_POINT = {
47
50
  TRANSFER_TO_DETAILS: `${BASE_URL}${VERSION.v1}/cti/transfer-to-details?provider=convox`,
48
51
  SEND_NOTIFICATIONS: `${BASE_URL}${VERSION.v1}/cti/notifications/send`,
49
52
  CALL_HISTORY: `${BASE_URL}${VERSION.v1}/dashboard/call-history`,
50
- SENTIMENTAL_ANALYSIS: `${BASE_URL}${VERSION.v1}/users/get_sentiment_analysis`
53
+ SENTIMENTAL_ANALYSIS: `${BASE_URL}${VERSION.v1}/users/get_sentiment_analysis`,
54
+ DISPOSITIONS: `${BASE_URL}${VERSION.v1}/cti/calls/dispositions`,
55
+ HOSPITALS_SERVICES: `${BASE_URL}${VERSION.v1}/cti/hospital/services`,
56
+ BLIEND_TRANSFER: `${BASE_URL}${VERSION.v1}/cti/calls/blind_transfer?provider=convox`
51
57
  };
52
58
  var WS_END_POINT = {
53
59
  WS: `${WS_BASE_URL}${VERSION.v1}/cti/ws`
@@ -87,9 +93,6 @@ var SDKStateManager = class {
87
93
  enabled: {},
88
94
  outlined: {}
89
95
  },
90
- isHolding: false,
91
- isMuted: false,
92
- status: "idle",
93
96
  callStartTime: null,
94
97
  controlPanelPosition: { x: 10, y: 10 },
95
98
  iframePosition: { x: ((_a2 = window.screen) == null ? void 0 : _a2.availWidth) - 460, y: ((_b = window.screen) == null ? void 0 : _b.height) - 580 },
@@ -162,9 +165,9 @@ var SDKStateManager = class {
162
165
  loadFromStorage() {
163
166
  var _a2, _b;
164
167
  try {
165
- const stored = localStorage.getItem(this.STORAGE_KEY);
168
+ const stored = getItem(this.STORAGE_KEY);
166
169
  if (stored) {
167
- const parsedState = JSON.parse(stored);
170
+ const parsedState = stored;
168
171
  this.state = __spreadProps(__spreadValues({}, this.state), {
169
172
  agentId: parsedState.agentId || "",
170
173
  authorization: parsedState.authorization || void 0,
@@ -185,9 +188,6 @@ var SDKStateManager = class {
185
188
  enabled: {},
186
189
  outlined: {}
187
190
  },
188
- isHolding: parsedState.isHolding || false,
189
- isMuted: parsedState.isMuted || false,
190
- status: parsedState.status || "idle",
191
191
  callStartTime: parsedState.callStartTime || null,
192
192
  controlPanelPosition: parsedState.controlPanelPosition || {
193
193
  x: 10,
@@ -206,12 +206,11 @@ var SDKStateManager = class {
206
206
  event_time: "",
207
207
  phone_number: ""
208
208
  },
209
- // Fix: Properly handle conferenceLine with fallback to initial state
210
209
  conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine
211
210
  });
212
211
  }
213
212
  } catch (error) {
214
- console.warn("Failed to load SDK state from localStorage:", error);
213
+ console.warn("Failed to load SDK state:", error);
215
214
  }
216
215
  }
217
216
  saveToStorage() {
@@ -224,18 +223,15 @@ var SDKStateManager = class {
224
223
  openConferenceDialog: this.state.openConferenceDialog,
225
224
  openCallTransferDialog: this.state.openCallTransferDialog,
226
225
  sdkConfig: this.state.sdkConfig,
227
- isHolding: this.state.isHolding,
228
- isMuted: this.state.isMuted,
229
- status: this.state.status,
230
226
  callStartTime: this.state.callStartTime,
231
227
  controlPanelPosition: this.state.controlPanelPosition,
232
228
  iframePosition: this.state.iframePosition,
233
229
  callData: this.state.callData,
234
230
  conferenceLine: this.state.conferenceLine
235
231
  };
236
- localStorage.setItem(this.STORAGE_KEY, JSON.stringify(persistentState));
232
+ setItem(this.STORAGE_KEY, persistentState);
237
233
  } catch (error) {
238
- console.warn("Failed to save SDK state to localStorage:", error);
234
+ console.warn("Failed to save SDK state:", error);
239
235
  }
240
236
  }
241
237
  notifyListeners() {
@@ -297,21 +293,16 @@ var SDKStateManager = class {
297
293
  }
298
294
  };
299
295
  }
300
- setHolding(isHolding) {
301
- this.state.isHolding = isHolding;
302
- this.saveToStorage();
303
- this.notifyListeners();
304
- }
305
- setMuted(isMuted) {
306
- this.state.isMuted = isMuted;
307
- this.saveToStorage();
308
- this.notifyListeners();
309
- }
310
- setStatus(status) {
311
- this.state.status = status;
312
- this.saveToStorage();
313
- this.notifyListeners();
314
- }
296
+ // public setHolding(isHolding: boolean): void {
297
+ // this.state.isHolding = isHolding;
298
+ // this.saveToStorage();
299
+ // this.notifyListeners();
300
+ // }
301
+ // public setMuted(isMuted: boolean): void {
302
+ // this.state.isMuted = isMuted;
303
+ // this.saveToStorage();
304
+ // this.notifyListeners();
305
+ // }
315
306
  setProcess(process) {
316
307
  this.state.process = process;
317
308
  this.saveToStorage();
@@ -329,15 +320,11 @@ var SDKStateManager = class {
329
320
  }
330
321
  startCall() {
331
322
  this.state.callStartTime = Date.now();
332
- this.state.status = "on call";
333
323
  this.saveToStorage();
334
324
  this.notifyListeners();
335
325
  }
336
326
  endCall() {
337
327
  this.state.callStartTime = null;
338
- this.state.status = "idle";
339
- this.state.isHolding = false;
340
- this.state.isMuted = false;
341
328
  this.saveToStorage();
342
329
  this.notifyListeners();
343
330
  }
@@ -369,7 +356,6 @@ var SDKStateManager = class {
369
356
  setConferenceLine(line) {
370
357
  var _a2;
371
358
  if (!this.state.conferenceLine || !Array.isArray(this.state.conferenceLine)) {
372
- console.warn("Conference line data corrupted, resetting to initial state");
373
359
  this.state.conferenceLine = this.getInitialState().conferenceLine;
374
360
  }
375
361
  const conferenceLineData = (_a2 = this.state.conferenceLine) == null ? void 0 : _a2.map((each) => {
@@ -440,23 +426,11 @@ var SDKStateManager = class {
440
426
  }
441
427
  clearStorageAndReset() {
442
428
  try {
443
- localStorage.removeItem(this.STORAGE_KEY);
429
+ removeItem(this.STORAGE_KEY);
444
430
  this.state = this.getInitialState();
445
431
  this.notifyListeners();
446
432
  } catch (error) {
447
- console.warn("Failed to clear localStorage:", error);
448
- }
449
- }
450
- debugStorage() {
451
- try {
452
- const stored = localStorage.getItem(this.STORAGE_KEY);
453
- console.log("Current localStorage data:", stored);
454
- if (stored) {
455
- console.log("Parsed localStorage data:", JSON.parse(stored));
456
- }
457
- console.log("Current state:", this.state);
458
- } catch (error) {
459
- console.error("Error debugging storage:", error);
433
+ console.warn("Failed to clear:", error);
460
434
  }
461
435
  }
462
436
  getConferenceLines() {
@@ -471,23 +445,17 @@ var EventTrackerSDK = class {
471
445
  __publicField(this, "config", null);
472
446
  __publicField(this, "ticketId", null);
473
447
  __publicField(this, "baseUrl", "");
474
- __publicField(this, "eventQueue", []);
475
- // private isOnline: boolean = true;
476
- // private retryQueue: Array<() => Promise<void>> = [];
477
448
  __publicField(this, "flushTimer", null);
478
449
  }
479
450
  async init(config) {
480
451
  this.config = __spreadValues({
481
- autoTrack: true,
482
452
  retryAttempts: 3,
483
453
  queueSize: 100,
484
454
  flushInterval: 5e3
485
455
  }, config);
486
456
  this.baseUrl = config.baseUrl || (typeof window !== "undefined" ? window.location.origin : "");
487
- this.setupNetworkDetection();
488
457
  const ticket = await this.createTicket();
489
458
  this.startPeriodicFlush();
490
- console.log("EventTracker SDK initialized successfully");
491
459
  return ticket;
492
460
  }
493
461
  isInitialized() {
@@ -521,104 +489,11 @@ var EventTrackerSDK = class {
521
489
  }
522
490
  const data = await response.json();
523
491
  this.ticketId = data.ticketId;
524
- if (this.config.autoTrack) {
525
- this.setupAutoTracking();
526
- }
527
492
  return data;
528
493
  } catch (error) {
529
- console.error("EventTracker initialization failed:", error);
530
494
  throw error;
531
495
  }
532
496
  }
533
- async logEvent(eventType, eventData) {
534
- if (!this.config || !this.ticketId) {
535
- console.warn("EventTracker not initialized, skipping event:", eventType);
536
- return;
537
- }
538
- const event = {
539
- eventType,
540
- eventData,
541
- timestamp: Date.now()
542
- };
543
- this.eventQueue.push(event);
544
- if (this.eventQueue.length > (this.config.queueSize || 100)) {
545
- this.eventQueue.shift();
546
- }
547
- }
548
- // private async sendEvent(event: {
549
- // eventType: string;
550
- // eventData?: EventData;
551
- // timestamp: number;
552
- // }): Promise<void> {
553
- // if (!this.config || !this.ticketId) return;
554
- // try {
555
- // const response = await this.makeRequest("/api/v1/et/event", {
556
- // method: "POST",
557
- // headers: {
558
- // "Content-Type": "application/json",
559
- // "X-API-Key": this.config.apiKey,
560
- // },
561
- // body: JSON.stringify({
562
- // ticketId: this.ticketId,
563
- // eventType: event.eventType,
564
- // eventData: event.eventData,
565
- // }),
566
- // });
567
- // if (!response.ok) {
568
- // throw new Error(`Failed to log event: ${response.status} ${response.statusText}`);
569
- // }
570
- // const index = this.eventQueue.findIndex((e) => e.timestamp === event.timestamp);
571
- // if (index > -1) {
572
- // this.eventQueue.splice(index, 1);
573
- // }
574
- // } catch (error) {
575
- // console.error("Event logging failed:", error);
576
- // // this.retryQueue.push(() => this.sendEvent(event));
577
- // }
578
- // }
579
- // async closeTicket(): Promise<void> {
580
- // if (!this.config || !this.ticketId) {
581
- // throw new Error("EventTracker not initialized");
582
- // }
583
- // await this.flush();
584
- // try {
585
- // const response = await this.makeRequest("/api/v1/et/close", {
586
- // method: "POST",
587
- // headers: {
588
- // "Content-Type": "application/json",
589
- // "X-API-Key": this.config.apiKey,
590
- // },
591
- // body: JSON.stringify({
592
- // ticketId: this.ticketId,
593
- // }),
594
- // });
595
- // if (!response.ok) {
596
- // throw new Error(`Failed to close ticket: ${response.status} ${response.statusText}`);
597
- // }
598
- // this.ticketId = null;
599
- // this.stopPeriodicFlush();
600
- // console.log("Ticket closed successfully");
601
- // } catch (error) {
602
- // console.error("Ticket close failed:", error);
603
- // throw error;
604
- // }
605
- // }
606
- // async flush(): Promise<void> {
607
- // if (!this.isOnline || this.eventQueue.length === 0) return;
608
- // // const eventsToFlush = [...this.eventQueue];
609
- // // for (const event of eventsToFlush) {
610
- // // await this.sendEvent(event);
611
- // // }
612
- // const retryItems = [...this.retryQueue];
613
- // this.retryQueue = [];
614
- // for (const retryFn of retryItems) {
615
- // try {
616
- // await retryFn();
617
- // } catch (error) {
618
- // console.error("Retry failed:", error);
619
- // }
620
- // }
621
- // }
622
497
  async makeRequest(url, options) {
623
498
  var _a2;
624
499
  const fullUrl = `${this.baseUrl}${url}`;
@@ -637,156 +512,11 @@ var EventTrackerSDK = class {
637
512
  }
638
513
  throw new Error("Max retries exceeded");
639
514
  }
640
- setupAutoTracking() {
641
- var _a2;
642
- if (typeof window === "undefined" || !((_a2 = this.config) == null ? void 0 : _a2.autoTrack)) return;
643
- const autoTrackConfig = this.config.autoTrack === true ? {} : this.config.autoTrack;
644
- if (autoTrackConfig.pageVisits !== false) {
645
- this.logEvent("pageVisit", {
646
- url: window.location.href,
647
- title: document.title,
648
- referrer: document.referrer,
649
- userAgent: navigator.userAgent,
650
- viewport: {
651
- width: window.innerWidth,
652
- height: window.innerHeight
653
- },
654
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
655
- }).catch((error) => console.warn("Failed to track page visit:", error));
656
- }
657
- if (autoTrackConfig.clicks !== false) {
658
- document.addEventListener("click", (event) => {
659
- var _a3;
660
- const target = event.target;
661
- if (target.tagName === "BUTTON" || target.tagName === "A" || target.onclick || target.getAttribute("role") === "button" || target instanceof HTMLButtonElement && target.type === "button") {
662
- this.logEvent("click", {
663
- element: target.tagName,
664
- text: (_a3 = target.textContent) == null ? void 0 : _a3.trim().substring(0, 100),
665
- href: target.getAttribute("href"),
666
- id: target.id,
667
- className: target.className,
668
- role: target.getAttribute("role"),
669
- position: {
670
- x: event.clientX,
671
- y: event.clientY
672
- },
673
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
674
- }).catch((error) => console.warn("Failed to track click:", error));
675
- }
676
- });
677
- }
678
- if (autoTrackConfig.forms !== false) {
679
- document.addEventListener("submit", (event) => {
680
- const target = event.target;
681
- const formData = new FormData(target);
682
- const formFields = {};
683
- formData.forEach((value, key) => {
684
- formFields[key] = value.toString();
685
- });
686
- this.logEvent("formSubmission", {
687
- formId: target.id,
688
- action: target.action,
689
- method: target.method,
690
- fields: Object.keys(formFields),
691
- fieldCount: Object.keys(formFields).length,
692
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
693
- }).catch((error) => console.warn("Failed to track form submission:", error));
694
- });
695
- }
696
- if (autoTrackConfig.inputs !== false) {
697
- let inputTimer;
698
- document.addEventListener("input", (event) => {
699
- const target = event.target;
700
- if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT") {
701
- clearTimeout(inputTimer);
702
- inputTimer = setTimeout(() => {
703
- var _a3;
704
- this.logEvent("fieldChange", {
705
- element: target.tagName,
706
- type: target.getAttribute("type"),
707
- name: target.getAttribute("name"),
708
- id: target.id,
709
- valueLength: ((_a3 = target.value) == null ? void 0 : _a3.length) || 0,
710
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
711
- }).catch((error) => console.warn("Failed to track field change:", error));
712
- }, 1e3);
713
- }
714
- });
715
- }
716
- const sessionStartTime = Date.now();
717
- window.addEventListener("beforeunload", () => {
718
- const sessionDuration = Date.now() - sessionStartTime;
719
- this.logEvent("pageUnload", {
720
- url: window.location.href,
721
- sessionDuration,
722
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
723
- });
724
- });
725
- if (autoTrackConfig.visibility !== false) {
726
- document.addEventListener("visibilitychange", () => {
727
- this.logEvent("visibilityChange", {
728
- hidden: document.hidden,
729
- visibilityState: document.visibilityState,
730
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
731
- });
732
- });
733
- }
734
- if (autoTrackConfig.errors !== false) {
735
- window.addEventListener("error", (event) => {
736
- this.logEvent("jsError", {
737
- message: event.message,
738
- filename: event.filename,
739
- lineno: event.lineno,
740
- colno: event.colno,
741
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
742
- });
743
- });
744
- window.addEventListener("unhandledrejection", (event) => {
745
- var _a3;
746
- this.logEvent("unhandledRejection", {
747
- reason: (_a3 = event.reason) == null ? void 0 : _a3.toString(),
748
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
749
- });
750
- });
751
- }
752
- if (autoTrackConfig.performance !== false && typeof window.performance !== "undefined" && window.performance.navigation) {
753
- window.addEventListener("load", () => {
754
- setTimeout(() => {
755
- const navigation = window.performance.navigation;
756
- const timing = window.performance.timing;
757
- this.logEvent("performanceMetrics", {
758
- navigationTime: timing.navigationStart,
759
- loadTime: timing.loadEventEnd - timing.navigationStart,
760
- domReady: timing.domContentLoadedEventEnd - timing.navigationStart,
761
- renderTime: timing.loadEventEnd - timing.domContentLoadedEventEnd,
762
- navigationType: navigation.type,
763
- redirectCount: navigation.redirectCount,
764
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
765
- });
766
- }, 1e3);
767
- });
768
- }
769
- }
770
- setupNetworkDetection() {
771
- if (typeof window === "undefined") return;
772
- window.addEventListener("online", () => {
773
- console.log("EventTracker: Back online, flushing queued events");
774
- });
775
- window.addEventListener("offline", () => {
776
- console.log("EventTracker: Offline, queueing events");
777
- });
778
- }
779
515
  startPeriodicFlush() {
780
516
  if (this.flushTimer) {
781
517
  clearInterval(this.flushTimer);
782
518
  }
783
519
  }
784
- // private stopPeriodicFlush(): void {
785
- // if (this.flushTimer) {
786
- // clearInterval(this.flushTimer);
787
- // this.flushTimer = null;
788
- // }
789
- // }
790
520
  };
791
521
  var eventTracker = new EventTrackerSDK();
792
522
  if (typeof window !== "undefined") {
@@ -835,12 +565,6 @@ function createAxiosInstance() {
835
565
  );
836
566
  instance.interceptors.response.use(
837
567
  (response) => {
838
- var _a3;
839
- const endTime = (/* @__PURE__ */ new Date()).getTime();
840
- const startTime = (_a3 = response.config.metadata) == null ? void 0 : _a3.startTime;
841
- if (startTime) {
842
- console.log(`Request to ${response.config.url} took ${endTime - startTime}ms`);
843
- }
844
568
  return response;
845
569
  },
846
570
  async (error) => {
@@ -867,6 +591,7 @@ var axiosInstance = createAxiosInstance();
867
591
  var axios_default = axiosInstance;
868
592
 
869
593
  // call-control-sdk/lib/hooks/useLogout.ts
594
+ import { getItem as getItem2, removeItem as removeItem2 } from "@react-solutions/vault";
870
595
  var useLogout = () => {
871
596
  const [loading, setLoading] = useState(false);
872
597
  const [success, setSuccess] = useState(false);
@@ -874,8 +599,7 @@ var useLogout = () => {
874
599
  const [error, setError] = useState(null);
875
600
  const [data, setData] = useState(null);
876
601
  const handleLogout = useCallback(async () => {
877
- var _a2;
878
- const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
602
+ const state = getItem2(STORAGE_KEY);
879
603
  setLoading(true);
880
604
  const payload = {
881
605
  action: "LOGOUTUSER",
@@ -883,16 +607,15 @@ var useLogout = () => {
883
607
  };
884
608
  return axios_default.post(END_POINT.LOGOUT, payload).then((res) => {
885
609
  sdkStateManager.clearStorageAndReset();
886
- localStorage.clear();
887
- sessionStorage.clear();
610
+ removeItem2(STORAGE_KEY);
888
611
  setData(res == null ? void 0 : res.data);
889
612
  setSuccess(true);
890
613
  return res == null ? void 0 : res.data;
891
614
  }).catch((err) => {
892
- var _a3;
615
+ var _a2;
893
616
  setIsError(true);
894
617
  setError(err);
895
- return (_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.data;
618
+ return (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data;
896
619
  }).finally(() => {
897
620
  setLoading(false);
898
621
  });
@@ -909,6 +632,7 @@ var useLogout = () => {
909
632
 
910
633
  // call-control-sdk/lib/hooks/useEndCall.ts
911
634
  import { useCallback as useCallback2, useState as useState2 } from "react";
635
+ import { getItem as getItem3 } from "@react-solutions/vault";
912
636
  var useEndCall = () => {
913
637
  const [loading, setLoading] = useState2(false);
914
638
  const [success, setSuccess] = useState2(false);
@@ -917,24 +641,29 @@ var useEndCall = () => {
917
641
  const [data, setData] = useState2(null);
918
642
  const handleEndCall = useCallback2(
919
643
  async (data2) => {
920
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
921
- const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
644
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
645
+ const state = getItem3(STORAGE_KEY);
922
646
  setLoading(true);
923
647
  const payload = {
924
648
  action: "ENDCALL",
925
649
  userId: state == null ? void 0 : state.agentId,
926
- processid: (_d = (_c = (_b = state == null ? void 0 : state.process) == null ? void 0 : _b.process_id) == null ? void 0 : _c.toString()) != null ? _d : "",
927
- process_name: (_f = (_e = state == null ? void 0 : state.process) == null ? void 0 : _e.process_name) != null ? _f : "",
928
- callreferenceid: (_h = (_g = state == null ? void 0 : state.callData) == null ? void 0 : _g.convox_id) != null ? _h : "",
929
- mobile_number: (_j = (_i = state == null ? void 0 : state.callData) == null ? void 0 : _i.phone_number) != null ? _j : "",
930
- disposition: (_k = data2 == null ? void 0 : data2.disposition) != null ? _k : "RES",
931
- set_followUp: (_l = data2 == null ? void 0 : data2.followUp) != null ? _l : "N",
932
- callback_date: (_m = data2 == null ? void 0 : data2.callbackDate) != null ? _m : "",
933
- callback_hrs: (_n = data2 == null ? void 0 : data2.callbackHrs) != null ? _n : "",
934
- callback_mins: (_o = data2 == null ? void 0 : data2.callbackMins) != null ? _o : "",
935
- endcall_type: "CLOSE"
650
+ processid: (_c = (_b = (_a2 = state == null ? void 0 : state.process) == null ? void 0 : _a2.process_id) == null ? void 0 : _b.toString()) != null ? _c : "",
651
+ process_name: (_e = (_d = state == null ? void 0 : state.process) == null ? void 0 : _d.process_name) != null ? _e : "",
652
+ callreferenceid: (_g = (_f = state == null ? void 0 : state.callData) == null ? void 0 : _f.convox_id) != null ? _g : "",
653
+ mobile_number: (_i = (_h = state == null ? void 0 : state.callData) == null ? void 0 : _h.phone_number) != null ? _i : "",
654
+ disposition: (_j = data2 == null ? void 0 : data2.disposition) != null ? _j : "RES",
655
+ set_followUp: (_k = data2 == null ? void 0 : data2.followUp) != null ? _k : "N",
656
+ callback_date: (_l = data2 == null ? void 0 : data2.callbackDate) != null ? _l : "",
657
+ callback_hrs: (_m = data2 == null ? void 0 : data2.callbackHrs) != null ? _m : "",
658
+ callback_mins: (_n = data2 == null ? void 0 : data2.callbackMins) != null ? _n : "",
659
+ endcall_type: "CLOSE",
660
+ patient_enquiry: (_o = data2 == null ? void 0 : data2.patientLog) != null ? _o : null
936
661
  };
937
- return axios_default.post(END_POINT.END_CALL, payload).then((res) => {
662
+ return axios_default.post(END_POINT.END_CALL, payload, {
663
+ params: {
664
+ isBreak: (_p = data2 == null ? void 0 : data2.isBreak) != null ? _p : false
665
+ }
666
+ }).then((res) => {
938
667
  sdkStateManager.resetConferenceLines();
939
668
  sdkStateManager.endCall();
940
669
  setData(res == null ? void 0 : res.data);
@@ -963,6 +692,7 @@ var useEndCall = () => {
963
692
 
964
693
  // call-control-sdk/lib/hooks/useClickToCall.ts
965
694
  import { useCallback as useCallback3, useState as useState3 } from "react";
695
+ import { getItem as getItem4 } from "@react-solutions/vault";
966
696
  var useClickToCall = () => {
967
697
  const [loading, setLoading] = useState3(false);
968
698
  const [success, setSuccess] = useState3(false);
@@ -970,10 +700,10 @@ var useClickToCall = () => {
970
700
  const [error, setError] = useState3(null);
971
701
  const [data, setData] = useState3(null);
972
702
  const handleStartCall = useCallback3(async (data2) => {
973
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
974
- const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
703
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
704
+ const state = getItem4(STORAGE_KEY);
975
705
  setLoading(true);
976
- if (((_b = state == null ? void 0 : state.callData) == null ? void 0 : _b.status) === "IDLE") {
706
+ if (((_a2 = state == null ? void 0 : state.callData) == null ? void 0 : _a2.status) === "IDLE") {
977
707
  const payload = {
978
708
  action: "CALL",
979
709
  userId: state == null ? void 0 : state.agentId,
@@ -992,15 +722,15 @@ var useClickToCall = () => {
992
722
  }).finally(() => {
993
723
  setLoading(false);
994
724
  });
995
- } else if (((_c = state == null ? void 0 : state.callData) == null ? void 0 : _c.status) === "ONCALL") {
996
- const line_used = (_e = (_d = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _d.filter((each) => each.line !== 1)) == null ? void 0 : _e.find((each) => each.status === "IDLE" && !(each == null ? void 0 : each.isCallStart));
725
+ } else if (((_b = state == null ? void 0 : state.callData) == null ? void 0 : _b.status) === "ONCALL") {
726
+ const line_used = (_d = (_c = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _c.filter((each) => each.line !== 1)) == null ? void 0 : _d.find((each) => each.status === "IDLE" && !(each == null ? void 0 : each.isCallStart));
997
727
  const payload = {
998
728
  action: "EXTERNAL_CONFERENCE",
999
729
  operation: `CALL${line_used.line}`,
1000
730
  line_used: String(line_used.line),
1001
731
  thirdparty_no: data2 == null ? void 0 : data2.mobileNumber,
1002
- userid: (_g = (_f = state.callData) == null ? void 0 : _f.agent_id) != null ? _g : "",
1003
- process: (_i = (_h = state.callData) == null ? void 0 : _h.process_name) != null ? _i : ""
732
+ userid: (_f = (_e = state.callData) == null ? void 0 : _e.agent_id) != null ? _f : "",
733
+ process: (_h = (_g = state.callData) == null ? void 0 : _g.process_name) != null ? _h : ""
1004
734
  };
1005
735
  return axios_default.post(END_POINT.CONFERENCE_CALL, payload).then((res) => {
1006
736
  setData(res == null ? void 0 : res.data);
@@ -1084,15 +814,15 @@ import {
1084
814
  Group,
1085
815
  KeyboardArrowDown,
1086
816
  Layers,
1087
- Mic as Mic2,
1088
- MicOff as MicOff2,
817
+ Mic,
818
+ MicOff,
1089
819
  Pause as Pause2,
1090
820
  Pending,
1091
821
  Phone,
1092
822
  PlayArrow as PlayArrow2,
1093
823
  SupportAgent as SupportAgent2,
1094
824
  TransferWithinAStation,
1095
- Upcoming,
825
+ Upcoming as Upcoming2,
1096
826
  WifiCalling3,
1097
827
  SendRounded,
1098
828
  SmsSharp
@@ -1114,100 +844,47 @@ import {
1114
844
  } from "@mui/material";
1115
845
  import { useEffect as useEffect5, useRef as useRef2, useState as useState10 } from "react";
1116
846
 
1117
- // call-control-sdk/lib/hooks/useDraggable.ts
1118
- import { useCallback as useCallback4, useRef, useState as useState6 } from "react";
1119
- function useDraggable(initialPosition, onPositionChange) {
1120
- const [position, setPosition] = useState6(initialPosition);
1121
- const [isDragging, setIsDragging] = useState6(false);
1122
- const dragRef = useRef();
1123
- const dragStart = useRef({ x: 0, y: 0 });
1124
- const elementStart = useRef({ x: 0, y: 0 });
1125
- const updatePosition = useCallback4(
1126
- (newPosition) => {
1127
- const element = dragRef.current;
1128
- if (!element) return;
1129
- const rect = element.getBoundingClientRect();
1130
- const viewportWidth = window.innerWidth;
1131
- const viewportHeight = window.innerHeight;
1132
- const constrainedPosition = {
1133
- x: Math.max(0, Math.min(newPosition.x, viewportWidth - rect.width)),
1134
- y: Math.max(0, Math.min(newPosition.y, viewportHeight - rect.height))
1135
- };
1136
- setPosition(constrainedPosition);
1137
- onPositionChange == null ? void 0 : onPositionChange(constrainedPosition);
1138
- },
1139
- [onPositionChange]
1140
- );
1141
- const handleStart = useCallback4(
1142
- (clientX, clientY) => {
1143
- setIsDragging(true);
1144
- dragStart.current = { x: clientX, y: clientY };
1145
- elementStart.current = position;
1146
- const handleMove = (moveClientX, moveClientY) => {
1147
- const deltaX = moveClientX - dragStart.current.x;
1148
- const deltaY = moveClientY - dragStart.current.y;
1149
- updatePosition({
1150
- x: elementStart.current.x + deltaX,
1151
- y: elementStart.current.y + deltaY
1152
- });
1153
- };
1154
- const handleMouseMove = (e) => {
1155
- e.preventDefault();
1156
- handleMove(e.clientX, e.clientY);
1157
- };
1158
- const handleTouchMove = (e) => {
1159
- e.preventDefault();
1160
- const touch = e.touches[0];
1161
- if (touch) {
1162
- handleMove(touch.clientX, touch.clientY);
1163
- }
1164
- };
1165
- const handleEnd = () => {
1166
- setIsDragging(false);
1167
- document.removeEventListener("mousemove", handleMouseMove);
1168
- document.removeEventListener("mouseup", handleEnd);
1169
- document.removeEventListener("touchmove", handleTouchMove);
1170
- document.removeEventListener("touchend", handleEnd);
1171
- };
1172
- document.addEventListener("mousemove", handleMouseMove);
1173
- document.addEventListener("mouseup", handleEnd);
1174
- document.addEventListener("touchmove", handleTouchMove, {
1175
- passive: false
1176
- });
1177
- document.addEventListener("touchend", handleEnd);
1178
- },
1179
- [position, updatePosition]
1180
- );
1181
- const handleMouseDown = useCallback4(
1182
- (e) => {
1183
- e.preventDefault();
1184
- handleStart(e.clientX, e.clientY);
1185
- },
1186
- [handleStart]
1187
- );
1188
- const handleTouchStart = useCallback4(
1189
- (e) => {
1190
- e.preventDefault();
1191
- const touch = e.touches[0];
1192
- if (touch) {
1193
- handleStart(touch.clientX, touch.clientY);
1194
- }
1195
- },
1196
- [handleStart]
1197
- );
1198
- return {
1199
- position,
1200
- isDragging,
1201
- dragRef,
1202
- handleMouseDown,
1203
- handleTouchStart
1204
- };
1205
- }
847
+ // call-control-sdk/lib/components/dialog.tsx
848
+ import {
849
+ Airlines,
850
+ Call,
851
+ CallEnd,
852
+ CallSplit,
853
+ Close,
854
+ MemoryOutlined,
855
+ Pause,
856
+ PhoneDisabled,
857
+ PlayArrow,
858
+ Roofing,
859
+ SupportAgent,
860
+ Upcoming
861
+ } from "@mui/icons-material";
862
+ import {
863
+ Box,
864
+ Button,
865
+ Dialog,
866
+ IconButton,
867
+ Paper,
868
+ TextField,
869
+ Typography,
870
+ Autocomplete,
871
+ Tooltip,
872
+ useTheme as useTheme2,
873
+ TableContainer,
874
+ Table,
875
+ TableHead,
876
+ TableRow,
877
+ TableCell,
878
+ TableBody,
879
+ CircularProgress,
880
+ Checkbox
881
+ } from "@mui/material";
882
+ import { useEffect as useEffect4, useMemo, useState as useState8 } from "react";
1206
883
 
1207
884
  // call-control-sdk/lib/hooks/useSDKState.ts
1208
- import { useState as useState7, useEffect as useEffect3 } from "react";
885
+ import { useState as useState6, useEffect as useEffect3 } from "react";
1209
886
  function useSDKState() {
1210
- const [state, setState] = useState7(sdkStateManager.getState());
887
+ const [state, setState] = useState6(sdkStateManager.getState());
1211
888
  useEffect3(() => {
1212
889
  const unsubscribe = sdkStateManager.subscribe(() => {
1213
890
  setState(sdkStateManager.getState());
@@ -1218,10 +895,10 @@ function useSDKState() {
1218
895
  }
1219
896
 
1220
897
  // call-control-sdk/lib/services/request.ts
1221
- import { useCallback as useCallback5, useReducer } from "react";
898
+ import { useCallback as useCallback4, useReducer } from "react";
1222
899
 
1223
900
  // call-control-sdk/lib/services/toastMessage.tsx
1224
- import { createContext, useContext, useState as useState8 } from "react";
901
+ import { createContext, useContext, useState as useState7 } from "react";
1225
902
  import { Snackbar, Alert } from "@mui/material";
1226
903
  import { jsx, jsxs } from "react/jsx-runtime";
1227
904
  var ToastContext = createContext(void 0);
@@ -1231,9 +908,9 @@ var useToast = () => {
1231
908
  return ctx;
1232
909
  };
1233
910
  var ToastProvider = ({ children }) => {
1234
- const [open, setOpen] = useState8(false);
1235
- const [message, setMessage] = useState8("");
1236
- const [severity, setSeverity] = useState8("info");
911
+ const [open, setOpen] = useState7(false);
912
+ const [message, setMessage] = useState7("");
913
+ const [severity, setSeverity] = useState7("info");
1237
914
  const showToast = (msg, sev = "info") => {
1238
915
  setMessage(msg);
1239
916
  setSeverity(sev);
@@ -1298,11 +975,64 @@ var reducer = (state, action) => {
1298
975
  }
1299
976
  throw Error("Unknown action.");
1300
977
  };
978
+ var useGetRequest = (props = {}) => {
979
+ const { onSuccess = null, onError = null } = props;
980
+ const { showToast } = useToast();
981
+ const [state, dispatch] = useReducer(reducer, initialState);
982
+ const getRequest = useCallback4(
983
+ (url, config = {}) => {
984
+ dispatch({
985
+ type: "isLoading",
986
+ payload: true
987
+ });
988
+ axios_default.get(url, config).then((res) => {
989
+ var _a2, _b;
990
+ if ((_a2 = res.data) == null ? void 0 : _a2.success) {
991
+ dispatch({
992
+ type: "isSuccess",
993
+ payload: res.data
994
+ });
995
+ onSuccess == null ? void 0 : onSuccess(res.data, config);
996
+ } else {
997
+ dispatch({
998
+ type: "isError",
999
+ payload: res.data
1000
+ });
1001
+ showToast((_b = res.data) == null ? void 0 : _b.message, "error");
1002
+ onError == null ? void 0 : onError(res.data, config);
1003
+ }
1004
+ }).catch((err) => {
1005
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1006
+ const error = {
1007
+ status: (_b = (_a2 = err.response) == null ? void 0 : _a2.status) != null ? _b : 500,
1008
+ message: ((_d = (_c = err.response) == null ? void 0 : _c.data) == null ? void 0 : _d.detail) || ((_f = (_e = err.response) == null ? void 0 : _e.data) == null ? void 0 : _f.message) || err.message || "An unknown error occurred",
1009
+ data: (_h = (_g = err.response) == null ? void 0 : _g.data) != null ? _h : null,
1010
+ statusText: (_j = (_i = err.response) == null ? void 0 : _i.statusText) != null ? _j : "",
1011
+ code: (_k = err == null ? void 0 : err.code) != null ? _k : "",
1012
+ name: (_l = err == null ? void 0 : err.name) != null ? _l : ""
1013
+ };
1014
+ showToast(error.message, "error");
1015
+ dispatch({
1016
+ type: "isError",
1017
+ payload: error
1018
+ });
1019
+ onError == null ? void 0 : onError(error, config);
1020
+ }).finally(() => {
1021
+ dispatch({
1022
+ type: "isLoading",
1023
+ payload: false
1024
+ });
1025
+ });
1026
+ },
1027
+ [onSuccess, onError, showToast]
1028
+ );
1029
+ return [getRequest, state];
1030
+ };
1301
1031
  var usePostRequest = (props = {}) => {
1302
1032
  const { onSuccess = null, onError = null, disabledSuccessToast = false } = props;
1303
1033
  const { showToast } = useToast();
1304
1034
  const [state, dispatch] = useReducer(reducer, initialState);
1305
- const postRequest = useCallback5(
1035
+ const postRequest = useCallback4(
1306
1036
  (url, payload, config = {}) => {
1307
1037
  dispatch({
1308
1038
  type: "isLoading",
@@ -1346,38 +1076,6 @@ var usePostRequest = (props = {}) => {
1346
1076
  return [postRequest, state];
1347
1077
  };
1348
1078
 
1349
- // call-control-sdk/lib/components/dialog.tsx
1350
- import {
1351
- Call,
1352
- CallEnd,
1353
- CallSplit,
1354
- Close,
1355
- Pause,
1356
- PhoneDisabled,
1357
- PlayArrow,
1358
- SupportAgent
1359
- } from "@mui/icons-material";
1360
- import {
1361
- Box,
1362
- Button,
1363
- Dialog,
1364
- IconButton,
1365
- Paper,
1366
- TextField,
1367
- Typography,
1368
- Autocomplete,
1369
- Tooltip,
1370
- useTheme as useTheme2,
1371
- TableContainer,
1372
- Table,
1373
- TableHead,
1374
- TableRow,
1375
- TableCell,
1376
- TableBody,
1377
- CircularProgress
1378
- } from "@mui/material";
1379
- import { useEffect as useEffect4, useState as useState9 } from "react";
1380
-
1381
1079
  // call-control-sdk/lib/components/styles.ts
1382
1080
  import { useTheme } from "@mui/material";
1383
1081
  var useStyles = ({
@@ -1445,19 +1143,19 @@ var styles_default = useStyles;
1445
1143
  // call-control-sdk/lib/components/dialog.tsx
1446
1144
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
1447
1145
  var ConferenceTableRow = ({ each }) => {
1448
- var _a2, _b, _c, _d, _e;
1146
+ var _a2, _b, _c, _d, _e, _f;
1449
1147
  const state = useSDKState();
1148
+ const theme = useTheme2();
1450
1149
  const { showToast } = useToast();
1451
1150
  const { disabled, enabled, outlined } = styles_default({
1452
1151
  disabled: ((_a2 = state.sdkConfig) == null ? void 0 : _a2.disabled) || {},
1453
1152
  enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
1454
1153
  outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
1455
1154
  });
1456
- const theme = useTheme2();
1457
- const [conferenceCallStart, setConferenceCallStart] = useState9(false);
1458
- const [conferenceCallMerge, setConferenceCallMerge] = useState9(false);
1459
- const [conferenceCallHoldOrUnHold, setConferenceCallHoldOrUnHold] = useState9(false);
1460
- const [conferenceCallEnd, setConferenceCallEnd] = useState9(false);
1155
+ const [conferenceCallStart, setConferenceCallStart] = useState8(false);
1156
+ const [conferenceCallMerge, setConferenceCallMerge] = useState8(false);
1157
+ const [conferenceCallHoldOrUnHold, setConferenceCallHoldOrUnHold] = useState8(false);
1158
+ const [conferenceCallEnd, setConferenceCallEnd] = useState8(false);
1461
1159
  const onConferenceLineUpdate = (line, data) => {
1462
1160
  sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
1463
1161
  };
@@ -1559,26 +1257,12 @@ var ConferenceTableRow = ({ each }) => {
1559
1257
  setConferenceCallEnd(false);
1560
1258
  });
1561
1259
  };
1562
- const [holdOrUnHold] = usePostRequest({
1563
- onSuccess: () => {
1564
- sdkStateManager.setHolding(!state.isHolding);
1565
- },
1566
- onError: (error) => {
1567
- console.log("\u274C Hold operation error:", error);
1568
- }
1569
- });
1570
- const [muteOrUnMute] = usePostRequest({
1571
- onSuccess: () => {
1572
- sdkStateManager.setMuted(!state.isMuted);
1573
- },
1574
- onError: (error) => {
1575
- console.log("\u274C Mute operation error:", error);
1576
- }
1577
- });
1260
+ const [holdOrUnHold] = usePostRequest();
1261
+ const [muteOrUnMute] = usePostRequest();
1578
1262
  const handleHoldToggle = () => {
1579
1263
  var _a3;
1580
1264
  const payload = {
1581
- action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" : "HOLD",
1265
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" /* UNHOLD */ : "HOLD" /* HOLD */,
1582
1266
  userId: state.agentId
1583
1267
  };
1584
1268
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
@@ -1586,7 +1270,7 @@ var ConferenceTableRow = ({ each }) => {
1586
1270
  const handleMuteToggle = () => {
1587
1271
  var _a3;
1588
1272
  const payload = {
1589
- action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" : "MUTE",
1273
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" /* UNMUTE */ : "MUTE" /* MUTE */,
1590
1274
  userId: state.agentId
1591
1275
  };
1592
1276
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
@@ -1648,7 +1332,7 @@ var ConferenceTableRow = ({ each }) => {
1648
1332
  placeholder: "Phone Number",
1649
1333
  fullWidth: true,
1650
1334
  value: (each == null ? void 0 : each.phone) || "",
1651
- disabled: (each == null ? void 0 : each.line) === 1 || (each == null ? void 0 : each.status) === "ONCALL" || (each == null ? void 0 : each.status) === "DISCONNECTED" || (each == null ? void 0 : each.status) === "CONFERENCE" || (each == null ? void 0 : each.status) === "HOLD" || (each == null ? void 0 : each.status) === "MUTE" || (each == null ? void 0 : each.status) === "DIALING" || (each == null ? void 0 : each.status) === "RINGING",
1335
+ disabled: (each == null ? void 0 : each.line) === 1 || ["ONCALL" /* ONCALL */, "DISCONNECTED" /* DISCONNECTED */, "CONFERENCE" /* CONFERENCE */, "HOLD" /* HOLD */, "MUTE" /* MUTE */, "DIALING" /* DIALING */, "RINGING" /* RINGING */].includes((_f = each == null ? void 0 : each.status) != null ? _f : ""),
1652
1336
  onChange: (e) => {
1653
1337
  onConferenceLineUpdate(each, { phone: e.target.value });
1654
1338
  }
@@ -1661,7 +1345,6 @@ var ConferenceTableRow = ({ each }) => {
1661
1345
  {
1662
1346
  sx: {
1663
1347
  padding: "6px",
1664
- // width: "200px",
1665
1348
  flex: 1
1666
1349
  },
1667
1350
  children: /* @__PURE__ */ jsxs2(
@@ -1675,20 +1358,20 @@ var ConferenceTableRow = ({ each }) => {
1675
1358
  gap: "10px"
1676
1359
  },
1677
1360
  children: [
1678
- (each == null ? void 0 : each.line) === 1 && /* @__PURE__ */ jsx2(Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" ? "Hold" : "Resume", children: /* @__PURE__ */ jsx2(
1361
+ (each == null ? void 0 : each.line) === 1 && /* @__PURE__ */ jsx2(Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ ? "Hold" : "Resume", children: /* @__PURE__ */ jsx2(
1679
1362
  Button,
1680
1363
  {
1681
- variant: (each == null ? void 0 : each.status) === "HOLD" ? "contained" : "outlined",
1682
- sx: (each == null ? void 0 : each.status) === "CONFERENCE" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1364
+ variant: (each == null ? void 0 : each.status) === "HOLD" /* HOLD */ ? "contained" : "outlined",
1365
+ sx: (each == null ? void 0 : each.status) === "CONFERENCE" /* CONFERENCE */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1683
1366
  onClick: () => {
1684
- if (each.status === "HOLD") {
1367
+ if (each.status === "HOLD" /* HOLD */) {
1685
1368
  onHoldOrUnHoldConferenceCall(each, { isHold: false }, "UNHOLDUSER");
1686
1369
  } else {
1687
1370
  onHoldOrUnHoldConferenceCall(each, { isHold: true }, "HOLDUSER");
1688
1371
  }
1689
1372
  },
1690
- disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" && (each == null ? void 0 : each.status) !== "HOLD" || conferenceCallHoldOrUnHold,
1691
- children: each.status === "HOLD" ? /* @__PURE__ */ jsxs2(
1373
+ disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" /* CONFERENCE */ && (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ || conferenceCallHoldOrUnHold,
1374
+ children: each.status === "HOLD" /* HOLD */ ? /* @__PURE__ */ jsxs2(
1692
1375
  Box,
1693
1376
  {
1694
1377
  sx: {
@@ -1705,7 +1388,7 @@ var ConferenceTableRow = ({ each }) => {
1705
1388
  variant: "body2",
1706
1389
  sx: {
1707
1390
  fontSize: "12px",
1708
- color: each.status === "HOLD" ? "#fff" : "initial"
1391
+ color: each.status === "HOLD" /* HOLD */ ? "#fff" : "initial"
1709
1392
  },
1710
1393
  children: "Unhold"
1711
1394
  }
@@ -1737,7 +1420,7 @@ var ConferenceTableRow = ({ each }) => {
1737
1420
  {
1738
1421
  variant: "body2",
1739
1422
  sx: {
1740
- color: each.status === "HOLD" ? "#fff" : "#000",
1423
+ color: each.status === "HOLD" /* HOLD */ ? "#fff" : "#000",
1741
1424
  fontSize: "12px"
1742
1425
  },
1743
1426
  children: "Hold"
@@ -1760,9 +1443,9 @@ var ConferenceTableRow = ({ each }) => {
1760
1443
  (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ jsx2(Tooltip, { title: "Call", children: /* @__PURE__ */ jsx2(
1761
1444
  Button,
1762
1445
  {
1763
- variant: (each == null ? void 0 : each.status) !== "IDLE" ? "outlined" : "contained",
1446
+ variant: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? "outlined" : "contained",
1764
1447
  color: "success",
1765
- sx: (each == null ? void 0 : each.status) !== "IDLE" ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
1448
+ sx: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
1766
1449
  border: `0px solid ${theme.palette.success.light}`,
1767
1450
  "&:hover": {
1768
1451
  bgcolor: "success.light",
@@ -1777,7 +1460,7 @@ var ConferenceTableRow = ({ each }) => {
1777
1460
  onClick: () => {
1778
1461
  onConferenceCallStart(each, {});
1779
1462
  },
1780
- disabled: (each == null ? void 0 : each.status) !== "IDLE",
1463
+ disabled: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */,
1781
1464
  children: conferenceCallStart ? /* @__PURE__ */ jsx2(
1782
1465
  CircularProgress,
1783
1466
  {
@@ -1788,7 +1471,7 @@ var ConferenceTableRow = ({ each }) => {
1788
1471
  Call,
1789
1472
  {
1790
1473
  sx: {
1791
- color: (each == null ? void 0 : each.status) !== "IDLE" ? "default" : "#f3f2f2"
1474
+ color: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? "default" : "#f3f2f2"
1792
1475
  }
1793
1476
  }
1794
1477
  )
@@ -1797,34 +1480,30 @@ var ConferenceTableRow = ({ each }) => {
1797
1480
  (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ jsx2(Tooltip, { title: "Merge Call", children: /* @__PURE__ */ jsx2(
1798
1481
  Button,
1799
1482
  {
1800
- variant: (each == null ? void 0 : each.status) === "ONCALL" ? "contained" : "outlined",
1801
- sx: (each == null ? void 0 : each.status) === "ONCALL" ? __spreadValues({}, enabled) : __spreadValues({}, disabled),
1483
+ variant: (each == null ? void 0 : each.status) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
1484
+ sx: (each == null ? void 0 : each.status) === "ONCALL" /* ONCALL */ ? __spreadValues({}, enabled) : __spreadValues({}, disabled),
1802
1485
  onClick: () => {
1803
1486
  onMergeConferenceCall(each, {
1804
1487
  isMergeCall: true
1805
1488
  });
1806
1489
  },
1807
- disabled: (each == null ? void 0 : each.status) !== "ONCALL",
1490
+ disabled: (each == null ? void 0 : each.status) !== "ONCALL" /* ONCALL */,
1808
1491
  children: conferenceCallMerge ? /* @__PURE__ */ jsx2(CircularProgress, { size: "20px" }) : /* @__PURE__ */ jsx2(CallSplit, {})
1809
1492
  }
1810
1493
  ) }),
1811
- (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ jsx2(Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" ? "Hold" : "Resume", children: /* @__PURE__ */ jsx2(
1494
+ (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ jsx2(Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ ? "Hold" : "Resume", children: /* @__PURE__ */ jsx2(
1812
1495
  Button,
1813
1496
  {
1814
- variant: (each == null ? void 0 : each.status) === "HOLD" ? "contained" : "outlined",
1815
- sx: (each == null ? void 0 : each.status) === "CONFERENCE" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1497
+ variant: (each == null ? void 0 : each.status) === "HOLD" /* HOLD */ ? "contained" : "outlined",
1498
+ sx: (each == null ? void 0 : each.status) === "CONFERENCE" /* CONFERENCE */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1816
1499
  onClick: () => {
1817
- if (each.status === "HOLD") {
1500
+ if (each.status === "HOLD" /* HOLD */) {
1818
1501
  onHoldOrUnHoldConferenceCall(each, { isHold: false }, "UNHOLDUSER");
1819
1502
  } else {
1820
1503
  onHoldOrUnHoldConferenceCall(each, { isHold: true }, "HOLDUSER");
1821
1504
  }
1822
1505
  },
1823
- disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" && (each == null ? void 0 : each.status) !== "HOLD" || // each?.status === "IDLE" ||
1824
- // each?.status === "ONCALL" ||
1825
- // each?.status === "DIALING" ||
1826
- // each?.status === "RINGING" ||
1827
- conferenceCallHoldOrUnHold,
1506
+ disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" /* CONFERENCE */ && (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ || conferenceCallHoldOrUnHold,
1828
1507
  children: conferenceCallHoldOrUnHold ? /* @__PURE__ */ jsx2(
1829
1508
  CircularProgress,
1830
1509
  {
@@ -1833,15 +1512,15 @@ var ConferenceTableRow = ({ each }) => {
1833
1512
  color: theme.palette.primary.main
1834
1513
  }
1835
1514
  }
1836
- ) : each.status === "HOLD" ? /* @__PURE__ */ jsx2(PlayArrow, {}) : /* @__PURE__ */ jsx2(Pause, {})
1515
+ ) : each.status === "HOLD" /* HOLD */ ? /* @__PURE__ */ jsx2(PlayArrow, {}) : /* @__PURE__ */ jsx2(Pause, {})
1837
1516
  }
1838
1517
  ) }),
1839
1518
  (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ jsx2(Tooltip, { title: "End Call", children: /* @__PURE__ */ jsx2(
1840
1519
  Button,
1841
1520
  {
1842
- variant: (each == null ? void 0 : each.status) !== "IDLE" && (each == null ? void 0 : each.status) !== "DISCONNECTED" ? "contained" : "outlined",
1521
+ variant: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ && (each == null ? void 0 : each.status) !== "DISCONNECTED" /* DISCONNECTED */ ? "contained" : "outlined",
1843
1522
  color: "error",
1844
- sx: (each == null ? void 0 : each.status) !== "IDLE" && (each == null ? void 0 : each.status) !== "DISCONNECTED" ? __spreadProps(__spreadValues({}, enabled), {
1523
+ sx: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ && (each == null ? void 0 : each.status) !== "DISCONNECTED" /* DISCONNECTED */ ? __spreadProps(__spreadValues({}, enabled), {
1845
1524
  border: `0px solid ${theme.palette.error.light}`,
1846
1525
  "&:hover": {
1847
1526
  bgcolor: "error.light",
@@ -1861,7 +1540,7 @@ var ConferenceTableRow = ({ each }) => {
1861
1540
  isHold: false
1862
1541
  });
1863
1542
  },
1864
- disabled: (each == null ? void 0 : each.status) === "IDLE" || (each == null ? void 0 : each.status) === "DISCONNECTED" || conferenceCallEnd,
1543
+ disabled: (each == null ? void 0 : each.status) === "IDLE" /* IDLE */ || (each == null ? void 0 : each.status) === "DISCONNECTED" /* DISCONNECTED */ || conferenceCallEnd,
1865
1544
  children: conferenceCallEnd ? /* @__PURE__ */ jsx2(
1866
1545
  CircularProgress,
1867
1546
  {
@@ -1885,7 +1564,7 @@ function ConferenceDialog() {
1885
1564
  var _a2;
1886
1565
  const state = useSDKState();
1887
1566
  const { showToast } = useToast();
1888
- const [conferenceCallEndAll, setConferenceCallEndAll] = useState9(false);
1567
+ const [conferenceCallEndAll, setConferenceCallEndAll] = useState8(false);
1889
1568
  const handleClose = () => {
1890
1569
  sdkStateManager.setOpenConferenceDialog(false);
1891
1570
  };
@@ -2081,17 +1760,26 @@ function ConferenceDialog() {
2081
1760
  ) });
2082
1761
  }
2083
1762
  function CallTransferDialog({ open }) {
2084
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1763
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2085
1764
  const state = useSDKState();
1765
+ const [mobileNumber, setMobileNumber] = useState8("");
2086
1766
  const [transferCall] = usePostRequest({
2087
1767
  onSuccess: () => {
2088
1768
  sdkStateManager.setOpenCallTransferDialog(false);
2089
1769
  }
2090
1770
  });
2091
- const [currentselecteTab, setCurrentselecteTab] = useState9("process");
1771
+ const [blindTransferCall] = usePostRequest({
1772
+ onSuccess: () => {
1773
+ sdkStateManager.setOpenCallTransferDialog(false);
1774
+ }
1775
+ });
1776
+ const [currentselecteTab, setCurrentselecteTab] = useState8("process");
2092
1777
  const [getIdelAgentsList, { data: idleAgentsList, isLoading: isIdleAgentsListLoading }] = usePostRequest({
2093
1778
  disabledSuccessToast: true
2094
1779
  });
1780
+ const [getHospitalsServicesList, { data: hospitalsServicesList, isLoading: isHospitalsServicesListLoading }] = useGetRequest({
1781
+ disabledSuccessToast: true
1782
+ });
2095
1783
  const [
2096
1784
  getProcessAndQueuesList,
2097
1785
  { data: processAndQueuesList, isLoading: isProcessAndQueuesListLoading }
@@ -2102,7 +1790,7 @@ function CallTransferDialog({ open }) {
2102
1790
  sdkStateManager.setOpenCallTransferDialog(false);
2103
1791
  };
2104
1792
  const handleTransferCall = (data, type) => {
2105
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
1793
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
2106
1794
  if (type === "PROCESS") {
2107
1795
  const payload = {
2108
1796
  mobile_number: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.phone_number) != null ? _b2 : "",
@@ -2116,13 +1804,13 @@ function CallTransferDialog({ open }) {
2116
1804
  transferCall(END_POINT.TRANSFER_CALL, payload);
2117
1805
  } else if (type === "QUEUE") {
2118
1806
  const payload = {
2119
- mobile_number: (_m = (_l2 = state.callData) == null ? void 0 : _l2.phone_number) != null ? _m : "",
2120
- userid: (_o = (_n = state.callData) == null ? void 0 : _n.agent_id) != null ? _o : "",
1807
+ mobile_number: (_m2 = (_l2 = state.callData) == null ? void 0 : _l2.phone_number) != null ? _m2 : "",
1808
+ userid: (_o2 = (_n2 = state.callData) == null ? void 0 : _n2.agent_id) != null ? _o2 : "",
2121
1809
  type: "QUEUE",
2122
- transfer_to: (_p = data == null ? void 0 : data.queue_name) != null ? _p : "",
2123
- callreferenceid: (_r = (_q = state.callData) == null ? void 0 : _q.convox_id) != null ? _r : "",
2124
- processid: String((_t = (_s = state.callData) == null ? void 0 : _s.process_id) != null ? _t : ""),
2125
- process_name: (_v = (_u = state.callData) == null ? void 0 : _u.process_name) != null ? _v : ""
1810
+ transfer_to: (_p2 = data == null ? void 0 : data.queue_name) != null ? _p2 : "",
1811
+ callreferenceid: (_r2 = (_q2 = state.callData) == null ? void 0 : _q2.convox_id) != null ? _r2 : "",
1812
+ processid: String((_t2 = (_s2 = state.callData) == null ? void 0 : _s2.process_id) != null ? _t2 : ""),
1813
+ process_name: (_v = (_u2 = state.callData) == null ? void 0 : _u2.process_name) != null ? _v : ""
2126
1814
  };
2127
1815
  transferCall(END_POINT.TRANSFER_CALL, payload);
2128
1816
  } else if (type === "AGENT") {
@@ -2136,6 +1824,15 @@ function CallTransferDialog({ open }) {
2136
1824
  process_name: (_G = (_F = state.callData) == null ? void 0 : _F.process_name) != null ? _G : ""
2137
1825
  };
2138
1826
  transferCall(END_POINT.TRANSFER_CALL, payload);
1827
+ } else if (type === "OTHER") {
1828
+ const payload = {
1829
+ action: "BLIND_TRANSFER",
1830
+ userid: (_I = (_H = state.callData) == null ? void 0 : _H.agent_id) != null ? _I : "",
1831
+ callreferenceid: (_K = (_J = state.callData) == null ? void 0 : _J.convox_id) != null ? _K : "",
1832
+ blind_transfer_no: (_L = data == null ? void 0 : data.mobile_number) != null ? _L : ""
1833
+ };
1834
+ console.log("payload", payload);
1835
+ blindTransferCall(END_POINT.BLIEND_TRANSFER, payload);
2139
1836
  }
2140
1837
  };
2141
1838
  useEffect4(() => {
@@ -2147,6 +1844,7 @@ function CallTransferDialog({ open }) {
2147
1844
  status: "ACTIVE",
2148
1845
  active: true
2149
1846
  });
1847
+ getHospitalsServicesList(END_POINT.HOSPITALS_SERVICES);
2150
1848
  }, []);
2151
1849
  return /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
2152
1850
  Dialog,
@@ -2155,7 +1853,7 @@ function CallTransferDialog({ open }) {
2155
1853
  "aria-labelledby": "alert-dialog-title",
2156
1854
  "aria-describedby": "alert-dialog-description",
2157
1855
  fullWidth: true,
2158
- maxWidth: "md",
1856
+ maxWidth: "sm",
2159
1857
  children: /* @__PURE__ */ jsxs2(Paper, { sx: { borderRadius: 2 }, children: [
2160
1858
  /* @__PURE__ */ jsxs2(
2161
1859
  Box,
@@ -2177,23 +1875,17 @@ function CallTransferDialog({ open }) {
2177
1875
  Box,
2178
1876
  {
2179
1877
  sx: {
2180
- boxShadow: "1px 1px 4px #d3d3d3ff",
2181
- padding: "6px 10px",
2182
1878
  margin: "10px",
2183
1879
  borderRadius: "10px"
2184
1880
  },
2185
1881
  children: [
2186
- /* @__PURE__ */ jsxs2(Box, { sx: { display: "flex", gap: 1 }, children: [
1882
+ /* @__PURE__ */ jsxs2(Box, { sx: { display: "flex", gap: 1, margin: "10px" }, children: [
2187
1883
  /* @__PURE__ */ jsx2(
2188
1884
  Button,
2189
1885
  {
2190
1886
  variant: currentselecteTab === "process" ? "contained" : "outlined",
2191
1887
  onClick: () => {
2192
1888
  setCurrentselecteTab("process");
2193
- getProcessAndQueuesList(END_POINT.TRANSFER_TO_DETAILS, {
2194
- status: "ACTIVE",
2195
- active: true
2196
- });
2197
1889
  },
2198
1890
  children: "Process"
2199
1891
  }
@@ -2204,10 +1896,6 @@ function CallTransferDialog({ open }) {
2204
1896
  variant: currentselecteTab === "queues" ? "contained" : "outlined",
2205
1897
  onClick: () => {
2206
1898
  setCurrentselecteTab("queues");
2207
- getProcessAndQueuesList(END_POINT.TRANSFER_TO_DETAILS, {
2208
- status: "ACTIVE",
2209
- active: true
2210
- });
2211
1899
  },
2212
1900
  children: "Queues"
2213
1901
  }
@@ -2225,9 +1913,19 @@ function CallTransferDialog({ open }) {
2225
1913
  },
2226
1914
  children: "Agents"
2227
1915
  }
1916
+ ),
1917
+ /* @__PURE__ */ jsx2(
1918
+ Button,
1919
+ {
1920
+ variant: currentselecteTab === "others" ? "contained" : "outlined",
1921
+ onClick: () => {
1922
+ setCurrentselecteTab("others");
1923
+ },
1924
+ children: "Others"
1925
+ }
2228
1926
  )
2229
1927
  ] }),
2230
- (isProcessAndQueuesListLoading || isIdleAgentsListLoading) && /* @__PURE__ */ jsxs2(
1928
+ (isProcessAndQueuesListLoading || isIdleAgentsListLoading || isHospitalsServicesListLoading) && /* @__PURE__ */ jsxs2(
2231
1929
  Box,
2232
1930
  {
2233
1931
  sx: {
@@ -2242,7 +1940,7 @@ function CallTransferDialog({ open }) {
2242
1940
  ]
2243
1941
  }
2244
1942
  ),
2245
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && currentselecteTab === "process" && /* @__PURE__ */ jsx2(Box, { sx: { display: "flex", gap: 1, flexWrap: "wrap" }, children: ((_a2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a2.process) && ((_c = (_b = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _b.process) == null ? void 0 : _c.length) > 0 ? (_e = (_d = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d.process) == null ? void 0 : _e.map((process, index) => /* @__PURE__ */ jsxs2(
1943
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "process" && /* @__PURE__ */ jsx2(Box, { sx: { display: "grid", gridTemplateColumns: ((_a2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a2.process) && ((_c = (_b = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _b.process) == null ? void 0 : _c.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: ((_d = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d.process) && ((_f = (_e = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _e.process) == null ? void 0 : _f.length) > 0 ? (_h = (_g = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _g.process) == null ? void 0 : _h.map((process, index) => /* @__PURE__ */ jsxs2(
2246
1944
  Box,
2247
1945
  {
2248
1946
  sx: {
@@ -2267,7 +1965,7 @@ function CallTransferDialog({ open }) {
2267
1965
  alignItems: "center"
2268
1966
  },
2269
1967
  children: [
2270
- /* @__PURE__ */ jsx2(SupportAgent, { sx: { marginRight: "4px" } }),
1968
+ /* @__PURE__ */ jsx2(MemoryOutlined, { sx: { marginRight: "4px" } }),
2271
1969
  process.process_name
2272
1970
  ]
2273
1971
  }
@@ -2289,26 +1987,41 @@ function CallTransferDialog({ open }) {
2289
1987
  ]
2290
1988
  },
2291
1989
  index
2292
- )) : /* @__PURE__ */ jsx2(
2293
- Typography,
1990
+ )) : /* @__PURE__ */ jsxs2(
1991
+ Box,
2294
1992
  {
2295
- variant: "body1",
2296
1993
  sx: {
2297
- fontSize: "16px",
2298
- letterSpacing: "0.02em",
2299
- textTransform: "capitalize",
2300
1994
  display: "flex",
2301
1995
  alignItems: "center",
2302
1996
  justifyContent: "center",
2303
- width: "100%",
2304
- margin: "10px 0px",
2305
- color: "gray",
2306
- height: "60px"
1997
+ flexDirection: "column"
2307
1998
  },
2308
- children: "No Process Found"
1999
+ p: 2,
2000
+ children: [
2001
+ /* @__PURE__ */ jsx2(Upcoming, { color: "primary" }),
2002
+ /* @__PURE__ */ jsx2(
2003
+ Typography,
2004
+ {
2005
+ variant: "body1",
2006
+ sx: {
2007
+ fontSize: "16px",
2008
+ letterSpacing: "0.02em",
2009
+ textTransform: "capitalize",
2010
+ display: "flex",
2011
+ alignItems: "center",
2012
+ justifyContent: "center",
2013
+ width: "100%",
2014
+ margin: "10px 0px",
2015
+ color: "primary.main",
2016
+ height: "20px"
2017
+ },
2018
+ children: "No Process Found"
2019
+ }
2020
+ )
2021
+ ]
2309
2022
  }
2310
2023
  ) }),
2311
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && currentselecteTab === "queues" && /* @__PURE__ */ jsx2(Box, { sx: { display: "flex", gap: 1, flexWrap: "wrap" }, children: ((_f = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _f.queue) && ((_h = (_g = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _g.queue) == null ? void 0 : _h.length) > 0 ? (_j = (_i = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _i.queue) == null ? void 0 : _j.map((queue, index) => {
2024
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "queues" && /* @__PURE__ */ jsx2(Box, { sx: { display: "grid", gridTemplateColumns: ((_i = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _i.queue) && ((_k = (_j = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _j.queue) == null ? void 0 : _k.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: ((_l = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _l.queue) && ((_n = (_m = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _m.queue) == null ? void 0 : _n.length) > 0 ? (_p = (_o = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _o.queue) == null ? void 0 : _p.map((queue, index) => {
2312
2025
  var _a3, _b2, _c2, _d2, _e2, _f2;
2313
2026
  return /* @__PURE__ */ jsxs2(
2314
2027
  Box,
@@ -2335,7 +2048,7 @@ function CallTransferDialog({ open }) {
2335
2048
  alignItems: "center"
2336
2049
  },
2337
2050
  children: [
2338
- /* @__PURE__ */ jsx2(SupportAgent, { sx: { marginRight: "4px" } }),
2051
+ /* @__PURE__ */ jsx2(Airlines, { sx: { marginRight: "4px" } }),
2339
2052
  queue.queue_name,
2340
2053
  ((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
2341
2054
  (process) => process.process_id === queue.process_id
@@ -2376,26 +2089,41 @@ function CallTransferDialog({ open }) {
2376
2089
  },
2377
2090
  index
2378
2091
  );
2379
- }) : /* @__PURE__ */ jsx2(
2380
- Typography,
2092
+ }) : /* @__PURE__ */ jsxs2(
2093
+ Box,
2381
2094
  {
2382
- variant: "body1",
2383
2095
  sx: {
2384
- fontSize: "16px",
2385
- letterSpacing: "0.02em",
2386
- textTransform: "capitalize",
2387
2096
  display: "flex",
2388
2097
  alignItems: "center",
2389
2098
  justifyContent: "center",
2390
- width: "100%",
2391
- margin: "10px 0px",
2392
- color: "gray",
2393
- height: "60px"
2099
+ flexDirection: "column"
2394
2100
  },
2395
- children: "No Queues Found"
2101
+ p: 2,
2102
+ children: [
2103
+ /* @__PURE__ */ jsx2(Upcoming, { color: "primary" }),
2104
+ /* @__PURE__ */ jsx2(
2105
+ Typography,
2106
+ {
2107
+ variant: "body1",
2108
+ sx: {
2109
+ fontSize: "16px",
2110
+ letterSpacing: "0.02em",
2111
+ textTransform: "capitalize",
2112
+ display: "flex",
2113
+ alignItems: "center",
2114
+ justifyContent: "center",
2115
+ width: "100%",
2116
+ margin: "10px 0px",
2117
+ color: "primary.main",
2118
+ height: "20px"
2119
+ },
2120
+ children: "No Queues Found"
2121
+ }
2122
+ )
2123
+ ]
2396
2124
  }
2397
2125
  ) }),
2398
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && currentselecteTab === "agents" && /* @__PURE__ */ jsx2(Box, { sx: { display: "flex", gap: 1, flexWrap: "wrap" }, children: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_k = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _k.length) > 0 ? (_l = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _l.map((agent, index) => /* @__PURE__ */ jsxs2(
2126
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "agents" && /* @__PURE__ */ jsx2(Box, { sx: { display: "grid", gridTemplateColumns: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_q = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _q.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_r = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _r.length) > 0 ? (_s = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _s.map((agent, index) => /* @__PURE__ */ jsxs2(
2399
2127
  Box,
2400
2128
  {
2401
2129
  sx: {
@@ -2442,25 +2170,178 @@ function CallTransferDialog({ open }) {
2442
2170
  ]
2443
2171
  },
2444
2172
  index
2445
- )) : /* @__PURE__ */ jsx2(
2446
- Typography,
2173
+ )) : /* @__PURE__ */ jsxs2(
2174
+ Box,
2447
2175
  {
2448
- variant: "body1",
2449
2176
  sx: {
2450
- fontSize: "16px",
2451
- letterSpacing: "0.02em",
2452
- textTransform: "capitalize",
2453
2177
  display: "flex",
2454
2178
  alignItems: "center",
2455
2179
  justifyContent: "center",
2456
- width: "100%",
2457
- margin: "10px 0px",
2458
- color: "gray",
2459
- height: "60px"
2180
+ flexDirection: "column"
2460
2181
  },
2461
- children: "No Agents Found"
2182
+ p: 2,
2183
+ children: [
2184
+ /* @__PURE__ */ jsx2(Upcoming, { color: "primary" }),
2185
+ /* @__PURE__ */ jsx2(
2186
+ Typography,
2187
+ {
2188
+ variant: "body1",
2189
+ sx: {
2190
+ fontSize: "16px",
2191
+ letterSpacing: "0.02em",
2192
+ textTransform: "capitalize",
2193
+ display: "flex",
2194
+ alignItems: "center",
2195
+ justifyContent: "center",
2196
+ width: "100%",
2197
+ margin: "10px 0px",
2198
+ color: "primary.main",
2199
+ height: "20px"
2200
+ },
2201
+ children: "No Agents Found"
2202
+ }
2203
+ )
2204
+ ]
2462
2205
  }
2463
- ) })
2206
+ ) }),
2207
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "others" && /* @__PURE__ */ jsxs2(Box, { sx: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: [
2208
+ (hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) && ((_t = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _t.length) > 0 && ((_u = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _u.map((service, index) => {
2209
+ var _a3, _b2, _c2;
2210
+ return /* @__PURE__ */ jsxs2(
2211
+ Box,
2212
+ {
2213
+ sx: {
2214
+ p: 1,
2215
+ display: "flex",
2216
+ alignItems: "center",
2217
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2218
+ padding: "6px",
2219
+ borderRadius: "10px",
2220
+ "&:hover": { bgcolor: "action.selected" }
2221
+ },
2222
+ children: [
2223
+ /* @__PURE__ */ jsxs2(
2224
+ Typography,
2225
+ {
2226
+ variant: "body1",
2227
+ sx: {
2228
+ mx: 1,
2229
+ width: "200px",
2230
+ maxWidth: "250px",
2231
+ display: "flex",
2232
+ alignItems: "center"
2233
+ },
2234
+ children: [
2235
+ /* @__PURE__ */ jsx2(Roofing, { sx: { marginRight: "4px" } }),
2236
+ /* @__PURE__ */ jsx2(Tooltip, { title: `${(_a3 = service == null ? void 0 : service.description) != null ? _a3 : ""}`, children: /* @__PURE__ */ jsxs2(Box, { sx: { color: "text.secondary" }, children: [
2237
+ service.name,
2238
+ /* @__PURE__ */ jsx2(Box, { sx: {
2239
+ fontSize: "9px",
2240
+ fontWeight: "600",
2241
+ letterSpacing: "0.02em",
2242
+ textTransform: "capitalize",
2243
+ color: "gray",
2244
+ textOverflow: "ellipsis",
2245
+ whiteSpace: "nowrap",
2246
+ overflow: "hidden",
2247
+ maxWidth: "160px"
2248
+ }, children: (_b2 = service == null ? void 0 : service.description) != null ? _b2 : "" })
2249
+ ] }) })
2250
+ ]
2251
+ }
2252
+ ),
2253
+ /* @__PURE__ */ jsx2(Tooltip, { title: (_c2 = service == null ? void 0 : service.phone_number) != null ? _c2 : "", children: /* @__PURE__ */ jsx2(
2254
+ IconButton,
2255
+ {
2256
+ color: "success",
2257
+ sx: {
2258
+ bgcolor: "action.hover",
2259
+ "&:hover": { bgcolor: "action.selected" }
2260
+ },
2261
+ onClick: () => {
2262
+ var _a4;
2263
+ handleTransferCall({
2264
+ mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : ""
2265
+ }, "OTHER");
2266
+ },
2267
+ children: /* @__PURE__ */ jsx2(Call, {})
2268
+ }
2269
+ ) })
2270
+ ]
2271
+ },
2272
+ index
2273
+ );
2274
+ })),
2275
+ /* @__PURE__ */ jsxs2(
2276
+ Box,
2277
+ {
2278
+ sx: {
2279
+ p: 1,
2280
+ display: "flex",
2281
+ alignItems: "center",
2282
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2283
+ padding: "6px",
2284
+ borderRadius: "10px"
2285
+ },
2286
+ children: [
2287
+ /* @__PURE__ */ jsx2(
2288
+ Typography,
2289
+ {
2290
+ variant: "body1",
2291
+ sx: {
2292
+ mx: 1,
2293
+ width: "200px",
2294
+ maxWidth: "250px",
2295
+ display: "flex",
2296
+ alignItems: "center"
2297
+ },
2298
+ children: /* @__PURE__ */ jsx2(
2299
+ TextField,
2300
+ {
2301
+ size: "small",
2302
+ name: "others",
2303
+ label: "Mobile number",
2304
+ variant: "outlined",
2305
+ type: "tel",
2306
+ value: mobileNumber,
2307
+ onChange: (e) => {
2308
+ const v = e.target.value;
2309
+ if (/^\d*$/.test(v)) {
2310
+ setMobileNumber(v);
2311
+ }
2312
+ },
2313
+ slotProps: {
2314
+ htmlInput: {
2315
+ inputMode: "numeric",
2316
+ maxLength: 11
2317
+ }
2318
+ },
2319
+ placeholder: "Enter mobile number",
2320
+ autoComplete: "off"
2321
+ }
2322
+ )
2323
+ }
2324
+ ),
2325
+ /* @__PURE__ */ jsx2(Tooltip, { title: mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number", children: /* @__PURE__ */ jsx2(
2326
+ IconButton,
2327
+ {
2328
+ color: "success",
2329
+ sx: {
2330
+ bgcolor: "action.hover",
2331
+ "&:hover": { bgcolor: "action.selected" }
2332
+ },
2333
+ onClick: () => {
2334
+ handleTransferCall({
2335
+ mobile_number: mobileNumber != null ? mobileNumber : ""
2336
+ }, "OTHER");
2337
+ },
2338
+ children: /* @__PURE__ */ jsx2(Call, {})
2339
+ }
2340
+ ) })
2341
+ ]
2342
+ }
2343
+ )
2344
+ ] })
2464
2345
  ]
2465
2346
  }
2466
2347
  )
@@ -2469,18 +2350,16 @@ function CallTransferDialog({ open }) {
2469
2350
  ) });
2470
2351
  }
2471
2352
  function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2472
- var _a2, _b, _c, _d;
2473
- const [formData, setFormData] = useState9({
2353
+ var _a2, _b, _c, _d, _e;
2354
+ const [getDispositions, data] = useGetRequest();
2355
+ const [formData, setFormData] = useState8({
2474
2356
  disposition: { label: "Resolved", value: "RES" },
2475
2357
  followUp: { label: "No", value: "N" },
2476
2358
  callbackDate: "",
2477
2359
  callbackHrs: "",
2478
- callbackMins: ""
2360
+ callbackMins: "",
2361
+ selected_break: false
2479
2362
  });
2480
- const dispositionOptions = [
2481
- { label: "Not Interested", value: "NI" },
2482
- { label: "Resolved", value: "RES" }
2483
- ];
2484
2363
  const followUpOptions = [
2485
2364
  { label: "Yes", value: "Y" },
2486
2365
  { label: "No", value: "N" }
@@ -2494,13 +2373,24 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2494
2373
  followUp: { label: "No", value: "N" },
2495
2374
  callbackDate: "",
2496
2375
  callbackHrs: "",
2497
- callbackMins: ""
2376
+ callbackMins: "",
2377
+ selected_break: false
2498
2378
  });
2499
2379
  };
2500
2380
  const handleClose = () => {
2501
2381
  handleReset();
2502
2382
  setOpen(false);
2503
2383
  };
2384
+ useEffect4(() => {
2385
+ getDispositions(END_POINT.DISPOSITIONS);
2386
+ }, []);
2387
+ const dispositionsOptions = useMemo(() => {
2388
+ var _a3, _b2;
2389
+ return ((_b2 = (_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.data) == null ? void 0 : _b2.map((item) => ({
2390
+ label: item.name,
2391
+ value: item.code
2392
+ }))) || [];
2393
+ }, [(_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.data]);
2504
2394
  return /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
2505
2395
  Dialog,
2506
2396
  {
@@ -2553,7 +2443,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2553
2443
  Autocomplete,
2554
2444
  {
2555
2445
  value: formData.disposition,
2556
- options: dispositionOptions,
2446
+ options: dispositionsOptions,
2557
2447
  getOptionLabel: (opt) => opt.label,
2558
2448
  onChange: (_, val) => handleChange("disposition", val),
2559
2449
  size: "small",
@@ -2588,14 +2478,37 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2588
2478
  ]
2589
2479
  }
2590
2480
  ),
2591
- ((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" && /* @__PURE__ */ jsxs2(
2481
+ /* @__PURE__ */ jsxs2(
2592
2482
  Box,
2593
2483
  {
2594
2484
  display: "flex",
2595
2485
  gap: 2,
2596
2486
  mt: 2,
2597
2487
  children: [
2598
- /* @__PURE__ */ jsx2(
2488
+ /* @__PURE__ */ jsxs2(Box, { sx: {
2489
+ flex: "1",
2490
+ border: "1px solid #bdbdbd",
2491
+ borderRadius: "5px"
2492
+ }, children: [
2493
+ /* @__PURE__ */ jsx2(
2494
+ Checkbox,
2495
+ {
2496
+ name: "selected_break",
2497
+ sx: {
2498
+ padding: "6px"
2499
+ },
2500
+ checked: formData.selected_break,
2501
+ onChange: (event) => {
2502
+ handleChange("selected_break", event.target.checked);
2503
+ },
2504
+ slotProps: {
2505
+ input: { "aria-label": "controlled" }
2506
+ }
2507
+ }
2508
+ ),
2509
+ " Mark as break"
2510
+ ] }),
2511
+ ((_c = (_b = formData == null ? void 0 : formData.followUp) == null ? void 0 : _b.label) == null ? void 0 : _c.toLowerCase()) === "yes" ? /* @__PURE__ */ jsx2(
2599
2512
  TextField,
2600
2513
  {
2601
2514
  size: "small",
@@ -2609,7 +2522,17 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2609
2522
  fullWidth: true,
2610
2523
  sx: { flex: 1 }
2611
2524
  }
2612
- ),
2525
+ ) : /* @__PURE__ */ jsx2(Box, { sx: { flex: 1 } })
2526
+ ]
2527
+ }
2528
+ ),
2529
+ ((_e = (_d = formData == null ? void 0 : formData.followUp) == null ? void 0 : _d.label) == null ? void 0 : _e.toLowerCase()) === "yes" && /* @__PURE__ */ jsxs2(
2530
+ Box,
2531
+ {
2532
+ display: "flex",
2533
+ gap: 2,
2534
+ mt: 2,
2535
+ children: [
2613
2536
  /* @__PURE__ */ jsx2(
2614
2537
  TextField,
2615
2538
  {
@@ -2621,17 +2544,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2621
2544
  fullWidth: true,
2622
2545
  sx: { flex: 1 }
2623
2546
  }
2624
- )
2625
- ]
2626
- }
2627
- ),
2628
- ((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ jsxs2(
2629
- Box,
2630
- {
2631
- display: "flex",
2632
- gap: 2,
2633
- mt: 2,
2634
- children: [
2547
+ ),
2635
2548
  /* @__PURE__ */ jsx2(
2636
2549
  TextField,
2637
2550
  {
@@ -2643,8 +2556,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2643
2556
  fullWidth: true,
2644
2557
  sx: { flex: 1 }
2645
2558
  }
2646
- ),
2647
- /* @__PURE__ */ jsx2(Box, { sx: { flex: 1 } })
2559
+ )
2648
2560
  ]
2649
2561
  }
2650
2562
  )
@@ -2825,6 +2737,147 @@ function CallHistoryDialog({ open, setOpen }) {
2825
2737
  ) });
2826
2738
  }
2827
2739
 
2740
+ // call-control-sdk/lib/hooks/useDraggable.ts
2741
+ import { useCallback as useCallback5, useRef, useState as useState9 } from "react";
2742
+ function useDraggable(initialPosition, onPositionChange) {
2743
+ const [position, setPosition] = useState9(initialPosition);
2744
+ const [isDragging, setIsDragging] = useState9(false);
2745
+ const dragRef = useRef();
2746
+ const dragStart = useRef({ x: 0, y: 0 });
2747
+ const elementStart = useRef({ x: 0, y: 0 });
2748
+ const updatePosition = useCallback5(
2749
+ (newPosition) => {
2750
+ const element = dragRef.current;
2751
+ if (!element) return;
2752
+ const rect = element.getBoundingClientRect();
2753
+ const viewportWidth = window.innerWidth;
2754
+ const viewportHeight = window.innerHeight;
2755
+ const constrainedPosition = {
2756
+ x: Math.max(0, Math.min(newPosition.x, viewportWidth - rect.width)),
2757
+ y: Math.max(0, Math.min(newPosition.y, viewportHeight - rect.height))
2758
+ };
2759
+ setPosition(constrainedPosition);
2760
+ onPositionChange == null ? void 0 : onPositionChange(constrainedPosition);
2761
+ },
2762
+ [onPositionChange]
2763
+ );
2764
+ const handleStart = useCallback5(
2765
+ (clientX, clientY) => {
2766
+ setIsDragging(true);
2767
+ dragStart.current = { x: clientX, y: clientY };
2768
+ elementStart.current = position;
2769
+ const handleMove = (moveClientX, moveClientY) => {
2770
+ const deltaX = moveClientX - dragStart.current.x;
2771
+ const deltaY = moveClientY - dragStart.current.y;
2772
+ updatePosition({
2773
+ x: elementStart.current.x + deltaX,
2774
+ y: elementStart.current.y + deltaY
2775
+ });
2776
+ };
2777
+ const handleMouseMove = (e) => {
2778
+ e.preventDefault();
2779
+ handleMove(e.clientX, e.clientY);
2780
+ };
2781
+ const handleTouchMove = (e) => {
2782
+ e.preventDefault();
2783
+ const touch = e.touches[0];
2784
+ if (touch) {
2785
+ handleMove(touch.clientX, touch.clientY);
2786
+ }
2787
+ };
2788
+ const handleEnd = () => {
2789
+ setIsDragging(false);
2790
+ document.removeEventListener("mousemove", handleMouseMove);
2791
+ document.removeEventListener("mouseup", handleEnd);
2792
+ document.removeEventListener("touchmove", handleTouchMove);
2793
+ document.removeEventListener("touchend", handleEnd);
2794
+ };
2795
+ document.addEventListener("mousemove", handleMouseMove);
2796
+ document.addEventListener("mouseup", handleEnd);
2797
+ document.addEventListener("touchmove", handleTouchMove, {
2798
+ passive: false
2799
+ });
2800
+ document.addEventListener("touchend", handleEnd);
2801
+ },
2802
+ [position, updatePosition]
2803
+ );
2804
+ const handleMouseDown = useCallback5(
2805
+ (e) => {
2806
+ e.preventDefault();
2807
+ handleStart(e.clientX, e.clientY);
2808
+ },
2809
+ [handleStart]
2810
+ );
2811
+ const handleTouchStart = useCallback5(
2812
+ (e) => {
2813
+ e.preventDefault();
2814
+ const touch = e.touches[0];
2815
+ if (touch) {
2816
+ handleStart(touch.clientX, touch.clientY);
2817
+ }
2818
+ },
2819
+ [handleStart]
2820
+ );
2821
+ return {
2822
+ position,
2823
+ isDragging,
2824
+ dragRef,
2825
+ handleMouseDown,
2826
+ handleTouchStart
2827
+ };
2828
+ }
2829
+
2830
+ // call-control-sdk/lib/services/micController.ts
2831
+ function createMicController(constraints = { audio: true }) {
2832
+ let stream = null;
2833
+ let muted = false;
2834
+ async function start() {
2835
+ if (stream) return;
2836
+ stream = await navigator.mediaDevices.getUserMedia(constraints);
2837
+ stream.getAudioTracks().forEach((track) => track.enabled = true);
2838
+ muted = false;
2839
+ }
2840
+ function setEnabled(enabled) {
2841
+ if (!stream) return;
2842
+ stream.getAudioTracks().forEach((track) => track.enabled = enabled);
2843
+ muted = !enabled;
2844
+ }
2845
+ function mute() {
2846
+ setEnabled(false);
2847
+ }
2848
+ function unmute() {
2849
+ setEnabled(true);
2850
+ }
2851
+ function toggleMute() {
2852
+ if (muted) {
2853
+ unmute();
2854
+ } else {
2855
+ mute();
2856
+ }
2857
+ }
2858
+ function stop() {
2859
+ if (!stream) return;
2860
+ stream.getTracks().forEach((t) => t.stop());
2861
+ stream = null;
2862
+ muted = false;
2863
+ }
2864
+ function isMuted() {
2865
+ return muted;
2866
+ }
2867
+ function getStream() {
2868
+ return stream;
2869
+ }
2870
+ return {
2871
+ start,
2872
+ stop,
2873
+ mute,
2874
+ unmute,
2875
+ toggleMute,
2876
+ isMuted,
2877
+ getStream
2878
+ };
2879
+ }
2880
+
2828
2881
  // call-control-sdk/lib/utils/audioLoader.ts
2829
2882
  import incomingRingtoneUrl from "./incoming-4WP3FJI4.mp3";
2830
2883
  var audioBlobUrl = null;
@@ -2848,7 +2901,7 @@ async function loadAudioAsBlob() {
2848
2901
  audioBlobUrl = URL.createObjectURL(blob);
2849
2902
  return audioBlobUrl;
2850
2903
  } catch (error) {
2851
- console.warn("Could not create blob URL, using direct URL:", error);
2904
+ console.error("Could not create blob URL, using direct URL:", error);
2852
2905
  return incomingRingtoneUrl;
2853
2906
  }
2854
2907
  }
@@ -2887,15 +2940,11 @@ async function createAudioElement() {
2887
2940
  };
2888
2941
  let loaded = await tryLoadAudio(audioUrl);
2889
2942
  if (!loaded && audioUrl !== incomingRingtoneUrl) {
2890
- console.log("Primary URL failed, trying original import URL:", incomingRingtoneUrl);
2891
2943
  loaded = await tryLoadAudio(incomingRingtoneUrl);
2892
2944
  if (loaded) {
2893
2945
  audioUrl = incomingRingtoneUrl;
2894
2946
  }
2895
2947
  }
2896
- if (!loaded) {
2897
- console.error("Failed to load audio with all methods. URL:", audioUrl);
2898
- }
2899
2948
  return audio;
2900
2949
  }
2901
2950
  function cleanupAudioResources() {
@@ -2907,6 +2956,7 @@ function cleanupAudioResources() {
2907
2956
  }
2908
2957
 
2909
2958
  // call-control-sdk/lib/components/callControls.tsx
2959
+ import { getItem as getItem5 } from "@react-solutions/vault";
2910
2960
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2911
2961
  var getCombineConfrenceData = (localState, apiData) => {
2912
2962
  const localConfrenceData = localState == null ? void 0 : localState.conferenceLine;
@@ -2937,7 +2987,7 @@ var formatDuration = (seconds) => {
2937
2987
  return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
2938
2988
  };
2939
2989
  function CallControls({ onDataChange }) {
2940
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za;
2990
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va;
2941
2991
  const theme = useTheme3();
2942
2992
  const state = useSDKState();
2943
2993
  const { showToast } = useToast();
@@ -2946,6 +2996,7 @@ function CallControls({ onDataChange }) {
2946
2996
  enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
2947
2997
  outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
2948
2998
  });
2999
+ const micRef = useRef2(null);
2949
3000
  const webSocketRef = useRef2(null);
2950
3001
  const audioRef = useRef2(null);
2951
3002
  const reconnectTimeoutRef = useRef2(null);
@@ -2955,16 +3006,17 @@ function CallControls({ onDataChange }) {
2955
3006
  const baseReconnectDelay = 2e3;
2956
3007
  const maxReconnectDelay = 3e4;
2957
3008
  const [anchorEl, setAnchorEl] = useState10(null);
2958
- const [showIframe, setShowIframe] = useState10(true);
2959
3009
  const [statusAnchorEl, setStatusAnchorEl] = useState10(null);
2960
3010
  const [dialerAnchorEl, setDialerAnchorEl] = useState10(null);
2961
3011
  const [ambulanceAnchorEl, setAmbulanceAnchorEl] = useState10(null);
3012
+ const [showIframe, setShowIframe] = useState10(true);
2962
3013
  const [openCallDisposition, setOpenCallDisposition] = useState10(false);
2963
3014
  const [openProcessorDialog, setOpenProcessorDialog] = useState10(false);
2964
3015
  const [openCallHistoryDialog, setOpenCallHistoryDialog] = useState10(false);
2965
3016
  const [processList, setProcessList] = useState10(null);
2966
3017
  const [phoneNumber, setPhoneNumber] = useState10("");
2967
3018
  const [callDuration, setCallDuration] = useState10(0);
3019
+ const [callWrapuptime, setCallWrapuptime] = useState10(null);
2968
3020
  const { position, isDragging, dragRef, handleMouseDown, handleTouchStart } = useDraggable(
2969
3021
  state.controlPanelPosition,
2970
3022
  (newPosition) => sdkStateManager.setControlPanelPosition(newPosition)
@@ -2986,26 +3038,22 @@ function CallControls({ onDataChange }) {
2986
3038
  }
2987
3039
  });
2988
3040
  const [holdOrUnHold, { isLoading: holdOrUnHoldLoading }] = usePostRequest({
2989
- onSuccess: () => {
2990
- sdkStateManager.setHolding(!state.isHolding);
2991
- },
2992
- onError: (error) => {
2993
- console.log("\u274C Hold operation error:", error);
2994
- }
3041
+ // onSuccess: () => {
3042
+ // sdkStateManager.setHolding(!state.isHolding);
3043
+ // },
2995
3044
  });
2996
3045
  const [muteOrUnMute, { isLoading: muteOrUnMuteLoading }] = usePostRequest({
2997
- onSuccess: () => {
2998
- sdkStateManager.setMuted(!state.isMuted);
2999
- },
3000
- onError: (error) => {
3001
- console.log("\u274C Mute operation error:", error);
3002
- }
3046
+ // onSuccess: () => {
3047
+ // sdkStateManager.setMuted(!state.isMuted);
3048
+ // },
3003
3049
  });
3004
3050
  const [readyAgentStatus, { isLoading: agentReadyLoading }] = usePostRequest();
3005
3051
  const [updateAgentStatus, { isLoading }] = usePostRequest();
3006
3052
  const [sendNotification] = usePostRequest();
3007
3053
  const [endCall, { isLoading: endCallLoading }] = usePostRequest({
3008
3054
  onSuccess: () => {
3055
+ sdkStateManager.endCall();
3056
+ setOpenCallDisposition(false);
3009
3057
  sdkStateManager.resetConferenceLines();
3010
3058
  }
3011
3059
  });
@@ -3015,15 +3063,11 @@ function CallControls({ onDataChange }) {
3015
3063
  const handleOpenDialer = (event) => {
3016
3064
  setShowIframe(true);
3017
3065
  setDialerAnchorEl(event.currentTarget);
3018
- sdkStateManager.setStatus("dial");
3019
3066
  };
3020
3067
  const handleOpenAbulanceServices = (event) => {
3021
3068
  setAmbulanceAnchorEl(event.currentTarget);
3022
3069
  };
3023
3070
  const handleCloseDialer = () => {
3024
- if (state.status !== "on call") {
3025
- sdkStateManager.setStatus("idle");
3026
- }
3027
3071
  setDialerAnchorEl(null);
3028
3072
  };
3029
3073
  const handleCloseAmbulance = () => {
@@ -3068,7 +3112,7 @@ function CallControls({ onDataChange }) {
3068
3112
  const handleHoldToggle = () => {
3069
3113
  var _a3;
3070
3114
  const payload = {
3071
- action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" : "HOLD",
3115
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" /* UNHOLD */ : "HOLD" /* HOLD */,
3072
3116
  userId: state.agentId
3073
3117
  };
3074
3118
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
@@ -3076,13 +3120,13 @@ function CallControls({ onDataChange }) {
3076
3120
  const handleMuteToggle = () => {
3077
3121
  var _a3;
3078
3122
  const payload = {
3079
- action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" : "MUTE",
3123
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" /* UNMUTE */ : "MUTE" /* MUTE */,
3080
3124
  userId: state.agentId
3081
3125
  };
3082
3126
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
3083
3127
  };
3084
3128
  const handleEndCall = (data) => {
3085
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
3129
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
3086
3130
  const payload = {
3087
3131
  action: "ENDCALL",
3088
3132
  userId: state.agentId,
@@ -3098,9 +3142,11 @@ function CallControls({ onDataChange }) {
3098
3142
  endcall_type: "CLOSE"
3099
3143
  };
3100
3144
  setPhoneNumber("");
3101
- endCall(END_POINT.END_CALL, payload);
3102
- sdkStateManager.endCall();
3103
- setOpenCallDisposition(false);
3145
+ endCall(END_POINT.END_CALL, payload, {
3146
+ params: {
3147
+ isBreak: (_q2 = data == null ? void 0 : data.selected_break) != null ? _q2 : false
3148
+ }
3149
+ });
3104
3150
  };
3105
3151
  useEffect5(() => {
3106
3152
  const handleBeforeUnload = (e) => {
@@ -3112,17 +3158,23 @@ function CallControls({ onDataChange }) {
3112
3158
  };
3113
3159
  }, []);
3114
3160
  useEffect5(() => {
3161
+ const mic = createMicController();
3162
+ micRef.current = mic;
3163
+ mic.start().catch((err) => {
3164
+ console.error("Failed to start mic:", err);
3165
+ });
3115
3166
  const handleKeyDown = (event) => {
3116
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2;
3117
- const fullState = JSON.parse((_a3 = localStorage.getItem("call-control-sdk-state")) != null ? _a3 : "");
3118
- const key = (_b2 = event.key) == null ? void 0 : _b2.toLowerCase();
3119
- if (!event.altKey || ((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.status) !== "ONCALL") {
3167
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
3168
+ const fullState = getItem5(STORAGE_KEY);
3169
+ const key = (_a3 = event.key) == null ? void 0 : _a3.toLowerCase();
3170
+ if (!event.altKey || ((_b2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _b2.status) !== "ONCALL" /* ONCALL */) {
3120
3171
  return;
3121
3172
  }
3122
- if (key === "m" && String((_d2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _d2.mute) === "0") {
3173
+ if (key === "m" && String((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.mute) === "0") {
3123
3174
  event.preventDefault();
3175
+ (_d2 = micRef.current) == null ? void 0 : _d2.mute();
3124
3176
  const payload = {
3125
- action: "MUTE",
3177
+ action: "MUTE" /* MUTE */,
3126
3178
  userId: fullState.agentId
3127
3179
  };
3128
3180
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
@@ -3130,23 +3182,24 @@ function CallControls({ onDataChange }) {
3130
3182
  if (key === "u" && String((_e2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _e2.mute) === "1") {
3131
3183
  event.preventDefault();
3132
3184
  const payload = {
3133
- action: "UNMUTE",
3185
+ action: "UNMUTE" /* UNMUTE */,
3134
3186
  userId: fullState.agentId
3135
3187
  };
3136
3188
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
3189
+ (_f2 = micRef.current) == null ? void 0 : _f2.unmute();
3137
3190
  }
3138
- if (key === "h" && String((_f2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _f2.hold) === "0") {
3191
+ if (key === "h" && String((_g2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _g2.hold) === "0") {
3139
3192
  event.preventDefault();
3140
3193
  const payload = {
3141
- action: "HOLD",
3194
+ action: "HOLD" /* HOLD */,
3142
3195
  userId: fullState.agentId
3143
3196
  };
3144
3197
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
3145
3198
  }
3146
- if (key === "r" && String((_g2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _g2.hold) === "1") {
3199
+ if (key === "r" && String((_h2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _h2.hold) === "1") {
3147
3200
  event.preventDefault();
3148
3201
  const payload = {
3149
- action: "UNHOLD",
3202
+ action: "UNHOLD" /* UNHOLD */,
3150
3203
  userId: fullState.agentId
3151
3204
  };
3152
3205
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
@@ -3159,7 +3212,8 @@ function CallControls({ onDataChange }) {
3159
3212
  }, []);
3160
3213
  useEffect5(() => {
3161
3214
  let interval;
3162
- if (state.callData.status && state.callData.status === "ONCALL") {
3215
+ let wrapUpinterval;
3216
+ if (state.callData.status && state.callData.status === "ONCALL" /* ONCALL */) {
3163
3217
  interval = setInterval(() => {
3164
3218
  const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
3165
3219
  setCallDuration(elapsed);
@@ -3167,8 +3221,28 @@ function CallControls({ onDataChange }) {
3167
3221
  } else {
3168
3222
  setCallDuration(0);
3169
3223
  }
3224
+ if (state.callData.status && state.callData.status === "WRAPUP" /* WRAPUP */ && callWrapuptime !== null) {
3225
+ wrapUpinterval = setInterval(() => {
3226
+ setCallWrapuptime((prevTime) => {
3227
+ if (prevTime === null || prevTime <= 1) {
3228
+ clearInterval(wrapUpinterval);
3229
+ handleEndCall({
3230
+ disposition: { label: "Resolved", value: "RES" },
3231
+ followUp: { label: "No", value: "N" },
3232
+ callbackDate: "",
3233
+ callbackHrs: "",
3234
+ callbackMins: "",
3235
+ selected_break: false
3236
+ });
3237
+ return null;
3238
+ }
3239
+ return prevTime - 1;
3240
+ });
3241
+ }, 1e3);
3242
+ }
3170
3243
  return () => {
3171
3244
  if (interval) clearInterval(interval);
3245
+ if (wrapUpinterval) clearInterval(wrapUpinterval);
3172
3246
  };
3173
3247
  }, [state.callData.status]);
3174
3248
  useEffect5(() => {
@@ -3219,13 +3293,10 @@ function CallControls({ onDataChange }) {
3219
3293
  }).catch((err) => {
3220
3294
  showToast(err.response.data.message, "error");
3221
3295
  });
3222
- } else {
3223
- console.log("No agentId available, skipping API call");
3224
3296
  }
3225
3297
  }, [state.agentId]);
3226
3298
  const connectWebSocket = () => {
3227
3299
  if (!state.agentId) {
3228
- console.log("No agentId available, cannot connect WebSocket");
3229
3300
  return;
3230
3301
  }
3231
3302
  if (reconnectTimeoutRef.current) {
@@ -3244,7 +3315,6 @@ function CallControls({ onDataChange }) {
3244
3315
  if (webSocketRef.current && webSocketRef.current.readyState === WebSocket.OPEN) {
3245
3316
  try {
3246
3317
  webSocketRef.current.send(JSON.stringify({ type: "ping" }));
3247
- console.log("\u{1F4E1} WebSocket ping sent");
3248
3318
  } catch (error) {
3249
3319
  console.error("Failed to send ping:", error);
3250
3320
  }
@@ -3252,71 +3322,88 @@ function CallControls({ onDataChange }) {
3252
3322
  }, 3e4);
3253
3323
  };
3254
3324
  webSocketRef.current.onmessage = (event) => {
3325
+ var _a3, _b2;
3255
3326
  try {
3256
3327
  const data = JSON.parse(event.data);
3257
3328
  if (data.type === "pong") {
3258
- console.log("\u{1F4E1} WebSocket pong received");
3259
3329
  return;
3260
3330
  }
3261
- const rls = localStorage.getItem("call-control-sdk-state");
3262
- const confrence = getCombineConfrenceData(JSON.parse(rls || "{}"), data);
3263
- sdkStateManager.updateCallData(data);
3331
+ const sdkState = getItem5(STORAGE_KEY);
3332
+ const confrence = getCombineConfrenceData(sdkState, data);
3333
+ const callData = {
3334
+ "agent_id": data == null ? void 0 : data.agent_id,
3335
+ "status": data == null ? void 0 : data.status,
3336
+ "type": data == null ? void 0 : data.type,
3337
+ "event_time": data == null ? void 0 : data.event_time,
3338
+ "phone_number": data == null ? void 0 : data.phone_number,
3339
+ "convox_id": data == null ? void 0 : data.convox_id,
3340
+ "process_id": data == null ? void 0 : data.process_id,
3341
+ "process_name": data == null ? void 0 : data.process_name,
3342
+ "hold": data == null ? void 0 : data.hold,
3343
+ "mute": data == null ? void 0 : data.mute,
3344
+ "mode": data == null ? void 0 : data.mode,
3345
+ "queue_name": data == null ? void 0 : data.queue_name
3346
+ };
3347
+ sdkStateManager.updateCallData(callData);
3264
3348
  sdkStateManager.updateConferenceData([...confrence]);
3265
- if ((data.status === "RINGING" || data.status === "DIALING") && (data == null ? void 0 : data.mode) !== "manual") {
3349
+ if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
3266
3350
  setShowIframe(true);
3267
- sdkStateManager.updateConferenceData([
3268
- {
3269
- line: 1,
3270
- status: "IDLE",
3271
- type: "",
3272
- phone: "",
3273
- isMute: false,
3274
- isHold: false,
3275
- isCallStart: false,
3276
- isMergeCall: false
3277
- },
3278
- {
3279
- line: 2,
3280
- status: "IDLE",
3281
- type: "",
3282
- phone: "",
3283
- isMute: false,
3284
- isHold: false,
3285
- isCallStart: false,
3286
- isMergeCall: false
3287
- },
3288
- {
3289
- line: 3,
3290
- status: "IDLE",
3291
- type: "",
3292
- phone: "",
3293
- isMute: false,
3294
- isHold: false,
3295
- isCallStart: false,
3296
- isMergeCall: false
3297
- },
3298
- {
3299
- line: 4,
3300
- status: "IDLE",
3301
- type: "",
3302
- phone: "",
3303
- isMute: false,
3304
- isHold: false,
3305
- isCallStart: false,
3306
- isMergeCall: false
3307
- },
3308
- {
3309
- line: 5,
3310
- status: "IDLE",
3311
- type: "",
3312
- phone: "",
3313
- isMute: false,
3314
- isHold: false,
3315
- isCallStart: false,
3316
- isMergeCall: false
3317
- }
3318
- ]);
3319
- if (audioRef.current) {
3351
+ setCallWrapuptime((_b2 = (_a3 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _a3.auto_wrapup_time) != null ? _b2 : null);
3352
+ sdkStateManager.updateConferenceData(
3353
+ [
3354
+ {
3355
+ line: 1,
3356
+ status: "IDLE",
3357
+ type: "",
3358
+ phone: "",
3359
+ isMute: false,
3360
+ isHold: false,
3361
+ isCallStart: false,
3362
+ isMergeCall: false
3363
+ },
3364
+ {
3365
+ line: 2,
3366
+ status: "IDLE",
3367
+ type: "",
3368
+ phone: "",
3369
+ isMute: false,
3370
+ isHold: false,
3371
+ isCallStart: false,
3372
+ isMergeCall: false
3373
+ },
3374
+ {
3375
+ line: 3,
3376
+ status: "IDLE",
3377
+ type: "",
3378
+ phone: "",
3379
+ isMute: false,
3380
+ isHold: false,
3381
+ isCallStart: false,
3382
+ isMergeCall: false
3383
+ },
3384
+ {
3385
+ line: 4,
3386
+ status: "IDLE",
3387
+ type: "",
3388
+ phone: "",
3389
+ isMute: false,
3390
+ isHold: false,
3391
+ isCallStart: false,
3392
+ isMergeCall: false
3393
+ },
3394
+ {
3395
+ line: 5,
3396
+ status: "IDLE",
3397
+ type: "",
3398
+ phone: "",
3399
+ isMute: false,
3400
+ isHold: false,
3401
+ isCallStart: false,
3402
+ isMergeCall: false
3403
+ }
3404
+ ]
3405
+ );
3406
+ if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current) {
3320
3407
  audioRef.current.play().catch((error) => {
3321
3408
  console.error("Failed to play ringtone:", error);
3322
3409
  });
@@ -3327,21 +3414,20 @@ function CallControls({ onDataChange }) {
3327
3414
  audioRef.current.currentTime = 0;
3328
3415
  }
3329
3416
  }
3330
- if (data.status === "ONCALL") {
3417
+ if (data.status === "ONCALL" /* ONCALL */) {
3331
3418
  sdkStateManager.startCall();
3332
3419
  if (!showIframe) {
3333
3420
  setShowIframe(true);
3334
3421
  }
3335
3422
  }
3336
- if (data.status === "WRAPUP") {
3423
+ if (data.status === "WRAPUP" /* WRAPUP */) {
3337
3424
  sdkStateManager.endCall();
3338
3425
  }
3339
3426
  } catch (e) {
3340
- console.log("\u{1F4E8} Raw message:", event.data);
3427
+ console.error("\u{1F4E8} Raw message:", event.data);
3341
3428
  }
3342
3429
  };
3343
3430
  webSocketRef.current.onclose = (event) => {
3344
- console.log("\u{1F50C} WebSocket connection closed", event.code, event.reason);
3345
3431
  if (pingIntervalRef.current) {
3346
3432
  clearInterval(pingIntervalRef.current);
3347
3433
  pingIntervalRef.current = null;
@@ -3352,14 +3438,13 @@ function CallControls({ onDataChange }) {
3352
3438
  baseReconnectDelay * Math.pow(2, reconnectAttemptsRef.current - 1),
3353
3439
  maxReconnectDelay
3354
3440
  );
3355
- console.log(
3441
+ console.warn(
3356
3442
  `\u{1F504} Attempting to reconnect WebSocket (attempt ${reconnectAttemptsRef.current}/${maxReconnectAttempts}) in ${delay}ms`
3357
3443
  );
3358
3444
  reconnectTimeoutRef.current = setTimeout(() => {
3359
3445
  connectWebSocket();
3360
3446
  }, delay);
3361
3447
  } else if (reconnectAttemptsRef.current >= maxReconnectAttempts) {
3362
- console.error("\u274C Maximum reconnection attempts reached. Please refresh the page.");
3363
3448
  showToast("WebSocket connection failed. Please refresh the page.", "error");
3364
3449
  }
3365
3450
  };
@@ -3367,7 +3452,6 @@ function CallControls({ onDataChange }) {
3367
3452
  console.error("\u274C WebSocket error:", error);
3368
3453
  };
3369
3454
  } catch (error) {
3370
- console.error("\u274C Failed to create WebSocket:", error);
3371
3455
  if (reconnectAttemptsRef.current < maxReconnectAttempts) {
3372
3456
  reconnectAttemptsRef.current += 1;
3373
3457
  const delay = Math.min(
@@ -3483,32 +3567,29 @@ function CallControls({ onDataChange }) {
3483
3567
  }
3484
3568
  ),
3485
3569
  ((_k = state.sdkConfig) == null ? void 0 : _k.enableQueueName) && ((_l = state == null ? void 0 : state.callData) == null ? void 0 : _l.queue_name) && ((_m = state == null ? void 0 : state.callData) == null ? void 0 : _m.mode) !== "manual" && /* @__PURE__ */ jsx3(Chip, { label: (_n = state == null ? void 0 : state.callData) == null ? void 0 : _n.queue_name }),
3486
- /* @__PURE__ */ jsx3(Box2, { children: !((_o = state.sdkConfig) == null ? void 0 : _o.disabledDialButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Dial", children: /* @__PURE__ */ jsx3(
3570
+ !((_o = state.sdkConfig) == null ? void 0 : _o.disabledDialButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Dial", children: /* @__PURE__ */ jsx3(
3487
3571
  IconButton2,
3488
3572
  {
3489
3573
  size: "small",
3490
3574
  onClick: (e) => {
3491
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
3492
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) !== "ONCALL" && ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) !== "BREAK" && ((_f2 = (_e2 = state.callData) == null ? void 0 : _e2.status) == null ? void 0 : _f2.toUpperCase()) !== "RINGING" && ((_h2 = (_g2 = state.callData) == null ? void 0 : _g2.status) == null ? void 0 : _h2.toUpperCase()) !== "WRAPUP") {
3575
+ var _a3, _b2;
3576
+ if (!["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(
3577
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3578
+ )) {
3493
3579
  handleOpenDialer(e);
3494
3580
  }
3495
3581
  },
3496
- sx: {
3497
- bgcolor: "action.hover",
3498
- "&:hover": {
3499
- bgcolor: "warning"
3500
- }
3501
- },
3582
+ disabled: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()),
3502
3583
  children: /* @__PURE__ */ jsx3(
3503
3584
  WifiCalling3,
3504
3585
  {
3505
3586
  sx: {
3506
- color: ((_q = (_p = state.callData) == null ? void 0 : _p.status) == null ? void 0 : _q.toUpperCase()) === "ONCALL" || ((_s = (_r = state.callData) == null ? void 0 : _r.status) == null ? void 0 : _s.toUpperCase()) === "BREAK" || ((_u = (_t = state.callData) == null ? void 0 : _t.status) == null ? void 0 : _u.toUpperCase()) === "RINGING" || ((_w = (_v = state.callData) == null ? void 0 : _v.status) == null ? void 0 : _w.toUpperCase()) === "WRAPUP" ? "action.selected" : "success.main"
3587
+ color: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()) ? "action.selected" : "success.main"
3507
3588
  }
3508
3589
  }
3509
3590
  )
3510
3591
  }
3511
- ) }) }),
3592
+ ) }),
3512
3593
  /* @__PURE__ */ jsx3(Box2, { onClick: () => setShowIframe(true), children: /* @__PURE__ */ jsx3(
3513
3594
  Typography2,
3514
3595
  {
@@ -3520,7 +3601,7 @@ function CallControls({ onDataChange }) {
3520
3601
  fontWeight: "600",
3521
3602
  cursor: "pointer"
3522
3603
  },
3523
- children: formatDuration(callDuration)
3604
+ children: state.callData.status === "WRAPUP" /* WRAPUP */ && callWrapuptime !== null ? formatDuration(callWrapuptime) : formatDuration(callDuration)
3524
3605
  }
3525
3606
  ) }),
3526
3607
  /* @__PURE__ */ jsx3(
@@ -3550,7 +3631,7 @@ function CallControls({ onDataChange }) {
3550
3631
  width: "60px",
3551
3632
  textAlign: "center"
3552
3633
  },
3553
- children: (_z = (_y = (_x = state.callData) == null ? void 0 : _x.status) == null ? void 0 : _y.toUpperCase()) != null ? _z : "N/A"
3634
+ children: (_r = (_q = (_p = state.callData) == null ? void 0 : _p.status) == null ? void 0 : _q.toUpperCase()) != null ? _r : "N/A"
3554
3635
  }
3555
3636
  ),
3556
3637
  onClick: handleOpenAgentStatus,
@@ -3574,32 +3655,32 @@ function CallControls({ onDataChange }) {
3574
3655
  /* @__PURE__ */ jsx3(Tooltip2, { title: "Agent Ready", children: /* @__PURE__ */ jsx3(
3575
3656
  Button2,
3576
3657
  {
3577
- variant: ((_B = (_A = state.callData) == null ? void 0 : _A.status) == null ? void 0 : _B.toUpperCase()) === "BREAK" || ((_D = (_C = state.callData) == null ? void 0 : _C.status) == null ? void 0 : _D.toUpperCase()) === "MISSED" ? "outlined" : "contained",
3658
+ variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_t = (_s = state.callData) == null ? void 0 : _s.status) == null ? void 0 : _t.toUpperCase()) ? "outlined" : "contained",
3578
3659
  onClick: (e) => {
3579
- var _a3, _b2, _c2, _d2;
3580
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "BREAK" || ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) === "MISSED") {
3660
+ var _a3, _b2;
3661
+ if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3581
3662
  e.stopPropagation();
3582
3663
  handleAgentReady();
3583
3664
  }
3584
3665
  },
3585
3666
  classes: {
3586
- root: ((_F = (_E = state.callData) == null ? void 0 : _E.status) == null ? void 0 : _F.toUpperCase()) === "BREAK" || ((_H = (_G = state.callData) == null ? void 0 : _G.status) == null ? void 0 : _H.toUpperCase()) === "MISSED" ? "outlined" : "enabled"
3667
+ root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_v = (_u = state.callData) == null ? void 0 : _u.status) == null ? void 0 : _v.toUpperCase()) ? "outlined" : "enabled"
3587
3668
  },
3588
- sx: __spreadValues({}, ((_J = (_I = state.callData) == null ? void 0 : _I.status) == null ? void 0 : _J.toUpperCase()) === "BREAK" || ((_L = (_K = state.callData) == null ? void 0 : _K.status) == null ? void 0 : _L.toUpperCase()) === "MISSED" ? outlined : enabled),
3669
+ sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_x = (_w = state.callData) == null ? void 0 : _w.status) == null ? void 0 : _x.toUpperCase()) ? outlined : enabled),
3589
3670
  disabled: agentReadyLoading,
3590
3671
  children: /* @__PURE__ */ jsx3(SupportAgent2, {})
3591
3672
  }
3592
3673
  ) }),
3593
- /* @__PURE__ */ jsx3(Tooltip2, { title: ((_M = state.callData) == null ? void 0 : _M.hold) === 1 ? "Resume" : "Hold", children: /* @__PURE__ */ jsx3(
3674
+ /* @__PURE__ */ jsx3(Tooltip2, { title: ((_y = state.callData) == null ? void 0 : _y.hold) === 1 ? "Resume" : "Hold", children: /* @__PURE__ */ jsx3(
3594
3675
  Button2,
3595
3676
  {
3596
- variant: ((_N = state.callData) == null ? void 0 : _N.hold) === 1 && ((_P = (_O = state.callData) == null ? void 0 : _O.status) == null ? void 0 : _P.toUpperCase()) === "ONCALL" ? "contained" : "outlined",
3677
+ variant: ((_z = state.callData) == null ? void 0 : _z.hold) === 1 && ((_B = (_A = state.callData) == null ? void 0 : _A.status) == null ? void 0 : _B.toUpperCase()) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
3597
3678
  onClick: (e) => {
3598
3679
  e.stopPropagation();
3599
3680
  handleHoldToggle();
3600
3681
  },
3601
- sx: ((_Q = state.callData) == null ? void 0 : _Q.hold) === 1 && ((_S = (_R = state.callData) == null ? void 0 : _R.status) == null ? void 0 : _S.toUpperCase()) === "ONCALL" ? __spreadValues({}, enabled) : ((_U = (_T = state.callData) == null ? void 0 : _T.status) == null ? void 0 : _U.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3602
- disabled: ((_W = (_V = state.callData) == null ? void 0 : _V.status) == null ? void 0 : _W.toUpperCase()) !== "ONCALL" && ((_X = state.callData) == null ? void 0 : _X.hold) !== 1 || holdOrUnHoldLoading,
3682
+ sx: ((_C = state.callData) == null ? void 0 : _C.hold) === 1 && ((_E = (_D = state.callData) == null ? void 0 : _D.status) == null ? void 0 : _E.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, enabled) : ((_G = (_F = state.callData) == null ? void 0 : _F.status) == null ? void 0 : _G.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3683
+ disabled: ((_I = (_H = state.callData) == null ? void 0 : _H.status) == null ? void 0 : _I.toUpperCase()) !== "ONCALL" /* ONCALL */ && ((_J = state.callData) == null ? void 0 : _J.hold) !== 1 || holdOrUnHoldLoading,
3603
3684
  children: holdOrUnHoldLoading ? /* @__PURE__ */ jsx3(
3604
3685
  CircularProgress2,
3605
3686
  {
@@ -3608,19 +3689,19 @@ function CallControls({ onDataChange }) {
3608
3689
  color: theme.palette.primary.main
3609
3690
  }
3610
3691
  }
3611
- ) : ((_Y = state.callData) == null ? void 0 : _Y.hold) === 1 ? /* @__PURE__ */ jsx3(PlayArrow2, {}) : /* @__PURE__ */ jsx3(Pause2, {})
3692
+ ) : ((_K = state.callData) == null ? void 0 : _K.hold) === 1 ? /* @__PURE__ */ jsx3(PlayArrow2, {}) : /* @__PURE__ */ jsx3(Pause2, {})
3612
3693
  }
3613
3694
  ) }),
3614
- /* @__PURE__ */ jsx3(Tooltip2, { title: ((_Z = state.callData) == null ? void 0 : _Z.mute) === 1 ? "Unmute" : "Mute", children: /* @__PURE__ */ jsx3(
3695
+ /* @__PURE__ */ jsx3(Tooltip2, { title: ((_L = state.callData) == null ? void 0 : _L.mute) === 1 ? "Unmute" : "Mute", children: /* @__PURE__ */ jsx3(
3615
3696
  Button2,
3616
3697
  {
3617
- variant: ((__ = state.callData) == null ? void 0 : __.mute) === 1 && ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" ? "contained" : "outlined",
3698
+ variant: ((_M = state.callData) == null ? void 0 : _M.mute) === 1 && ((_O = (_N = state.callData) == null ? void 0 : _N.status) == null ? void 0 : _O.toUpperCase()) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
3618
3699
  onClick: (e) => {
3619
3700
  e.stopPropagation();
3620
3701
  handleMuteToggle();
3621
3702
  },
3622
- sx: ((_ba = state.callData) == null ? void 0 : _ba.hold) === 1 ? __spreadValues({}, disabled) : ((_ca = state.callData) == null ? void 0 : _ca.mute) === 1 && ((_ea = (_da = state.callData) == null ? void 0 : _da.status) == null ? void 0 : _ea.toUpperCase()) === "ONCALL" ? __spreadValues({}, enabled) : ((_ga = (_fa = state.callData) == null ? void 0 : _fa.status) == null ? void 0 : _ga.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3623
- disabled: ((_ia = (_ha = state.callData) == null ? void 0 : _ha.status) == null ? void 0 : _ia.toUpperCase()) !== "ONCALL" && ((_ja = state.callData) == null ? void 0 : _ja.mute) !== 1 || muteOrUnMuteLoading || ((_ka = state.callData) == null ? void 0 : _ka.hold) === 1,
3703
+ sx: ((_P = state.callData) == null ? void 0 : _P.hold) === 1 ? __spreadValues({}, disabled) : ((_Q = state.callData) == null ? void 0 : _Q.mute) === 1 && ((_S = (_R = state.callData) == null ? void 0 : _R.status) == null ? void 0 : _S.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, enabled) : ((_U = (_T = state.callData) == null ? void 0 : _T.status) == null ? void 0 : _U.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3704
+ disabled: ((_W = (_V = state.callData) == null ? void 0 : _V.status) == null ? void 0 : _W.toUpperCase()) !== "ONCALL" /* ONCALL */ && ((_X = state.callData) == null ? void 0 : _X.mute) !== 1 || muteOrUnMuteLoading || ((_Y = state.callData) == null ? void 0 : _Y.hold) === 1,
3624
3705
  children: muteOrUnMuteLoading ? /* @__PURE__ */ jsx3(
3625
3706
  CircularProgress2,
3626
3707
  {
@@ -3629,69 +3710,93 @@ function CallControls({ onDataChange }) {
3629
3710
  color: theme.palette.primary.main
3630
3711
  }
3631
3712
  }
3632
- ) : ((_la = state.callData) == null ? void 0 : _la.mute) === 1 ? /* @__PURE__ */ jsx3(MicOff2, {}) : /* @__PURE__ */ jsx3(Mic2, {})
3713
+ ) : ((_Z = state.callData) == null ? void 0 : _Z.mute) === 1 ? /* @__PURE__ */ jsx3(MicOff, {}) : /* @__PURE__ */ jsx3(Mic, {})
3633
3714
  }
3634
3715
  ) }),
3635
- !((_ma = state.sdkConfig) == null ? void 0 : _ma.disableCallTransferButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Transfer Call", children: /* @__PURE__ */ jsx3(
3716
+ !((__ = state.sdkConfig) == null ? void 0 : __.disableCallTransferButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Transfer Call", children: /* @__PURE__ */ jsx3(
3636
3717
  Button2,
3637
3718
  {
3638
3719
  variant: state.openCallTransferDialog ? "contained" : "outlined",
3639
3720
  onClick: (e) => {
3640
3721
  var _a3, _b2;
3641
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
3722
+ if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */) {
3642
3723
  e.stopPropagation();
3643
3724
  sdkStateManager.setOpenCallTransferDialog(true);
3644
3725
  }
3645
3726
  },
3646
- sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((_oa = (_na = state.callData) == null ? void 0 : _na.status) == null ? void 0 : _oa.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3647
- disabled: ((_qa = (_pa = state.callData) == null ? void 0 : _pa.status) == null ? void 0 : _qa.toUpperCase()) !== "ONCALL",
3727
+ sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3728
+ disabled: ((_ca = (_ba = state.callData) == null ? void 0 : _ba.status) == null ? void 0 : _ca.toUpperCase()) !== "ONCALL" /* ONCALL */,
3648
3729
  children: /* @__PURE__ */ jsx3(TransferWithinAStation, {})
3649
3730
  }
3650
3731
  ) }),
3651
- !((_ra = state.sdkConfig) == null ? void 0 : _ra.disableConferenceButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Conference Call", children: /* @__PURE__ */ jsx3(
3732
+ !((_da = state.sdkConfig) == null ? void 0 : _da.disableConferenceButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Conference Call", children: /* @__PURE__ */ jsx3(
3652
3733
  Button2,
3653
3734
  {
3654
3735
  variant: state.openConferenceDialog ? "contained" : "outlined",
3655
3736
  onClick: (e) => {
3656
3737
  var _a3, _b2;
3657
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
3738
+ if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */) {
3658
3739
  e.stopPropagation();
3659
3740
  sdkStateManager.setOpenConferenceDialog(true);
3660
3741
  }
3661
3742
  },
3662
- sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3663
- disabled: ((_va = (_ua = state.callData) == null ? void 0 : _ua.status) == null ? void 0 : _va.toUpperCase()) !== "ONCALL",
3743
+ sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((_fa = (_ea = state.callData) == null ? void 0 : _ea.status) == null ? void 0 : _fa.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3744
+ disabled: ((_ha = (_ga = state.callData) == null ? void 0 : _ga.status) == null ? void 0 : _ha.toUpperCase()) !== "ONCALL" /* ONCALL */,
3664
3745
  children: /* @__PURE__ */ jsx3(Group, {})
3665
3746
  }
3666
3747
  ) }),
3667
- ((_wa = state.sdkConfig) == null ? void 0 : _wa.enableSmsServices) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Send SMS", children: /* @__PURE__ */ jsx3(
3748
+ ((_ia = state.sdkConfig) == null ? void 0 : _ia.enableSmsServices) && /* @__PURE__ */ jsx3(Tooltip2, { title: "Send SMS", children: /* @__PURE__ */ jsx3(
3668
3749
  Button2,
3669
3750
  {
3670
3751
  variant: Boolean(ambulanceAnchorEl) ? "contained" : "outlined",
3671
3752
  onClick: (e) => {
3672
- var _a3, _b2, _c2, _d2;
3673
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" || ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) === "WRAPUP") {
3753
+ var _a3, _b2;
3754
+ if ([
3755
+ "ONCALL" /* ONCALL */,
3756
+ "WRAPUP" /* WRAPUP */
3757
+ ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3674
3758
  e.stopPropagation();
3675
3759
  handleOpenAbulanceServices(e);
3676
3760
  }
3677
3761
  },
3678
- sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : ((_ya = (_xa = state.callData) == null ? void 0 : _xa.status) == null ? void 0 : _ya.toUpperCase()) === "ONCALL" || ((_Aa = (_za = state.callData) == null ? void 0 : _za.status) == null ? void 0 : _Aa.toUpperCase()) === "WRAPUP" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3679
- disabled: ((_Ca = (_Ba = state.callData) == null ? void 0 : _Ba.status) == null ? void 0 : _Ca.toUpperCase()) !== "ONCALL" && ((_Ea = (_Da = state.callData) == null ? void 0 : _Da.status) == null ? void 0 : _Ea.toUpperCase()) !== "WRAPUP",
3762
+ sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : [
3763
+ "ONCALL" /* ONCALL */,
3764
+ "WRAPUP" /* WRAPUP */
3765
+ ].includes((_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3766
+ disabled: ![
3767
+ "ONCALL" /* ONCALL */,
3768
+ "WRAPUP" /* WRAPUP */
3769
+ ].includes((_ma = (_la = state.callData) == null ? void 0 : _la.status) == null ? void 0 : _ma.toUpperCase()),
3680
3770
  children: /* @__PURE__ */ jsx3(SmsSharp, {})
3681
3771
  }
3682
3772
  ) }),
3683
- !((_Fa = state.sdkConfig) == null ? void 0 : _Fa.disableEndCallButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "End Call", children: /* @__PURE__ */ jsx3(
3773
+ !((_na = state.sdkConfig) == null ? void 0 : _na.disableEndCallButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "End Call", children: /* @__PURE__ */ jsx3(
3684
3774
  Button2,
3685
3775
  {
3686
- variant: ((_Ha = (_Ga = state.callData) == null ? void 0 : _Ga.status) == null ? void 0 : _Ha.toUpperCase()) === "ONCALL" || ((_Ja = (_Ia = state.callData) == null ? void 0 : _Ia.status) == null ? void 0 : _Ja.toUpperCase()) === "RINGING" || ((_La = (_Ka = state.callData) == null ? void 0 : _Ka.status) == null ? void 0 : _La.toUpperCase()) === "WRAPUP" ? "contained" : "outlined",
3776
+ variant: [
3777
+ "ONCALL" /* ONCALL */,
3778
+ "RINGING" /* RINGING */,
3779
+ "DIALING" /* DIALING */,
3780
+ "WRAPUP" /* WRAPUP */
3781
+ ].includes((_pa = (_oa = state.callData) == null ? void 0 : _oa.status) == null ? void 0 : _pa.toUpperCase()) ? "contained" : "outlined",
3687
3782
  onClick: (e) => {
3688
- var _a3, _b2, _c2, _d2, _e2, _f2;
3689
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" || ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) === "RINGING" || ((_f2 = (_e2 = state.callData) == null ? void 0 : _e2.status) == null ? void 0 : _f2.toUpperCase()) === "WRAPUP") {
3783
+ var _a3, _b2;
3784
+ if ([
3785
+ "ONCALL" /* ONCALL */,
3786
+ "RINGING" /* RINGING */,
3787
+ "DIALING" /* DIALING */,
3788
+ "WRAPUP" /* WRAPUP */
3789
+ ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3690
3790
  e.stopPropagation();
3691
3791
  setOpenCallDisposition(true);
3692
3792
  }
3693
3793
  },
3694
- sx: ((_Na = (_Ma = state.callData) == null ? void 0 : _Ma.status) == null ? void 0 : _Na.toUpperCase()) === "ONCALL" || ((_Pa = (_Oa = state.callData) == null ? void 0 : _Oa.status) == null ? void 0 : _Pa.toUpperCase()) === "RINGING" || ((_Ra = (_Qa = state.callData) == null ? void 0 : _Qa.status) == null ? void 0 : _Ra.toUpperCase()) === "WRAPUP" ? __spreadProps(__spreadValues({}, enabled), {
3794
+ sx: [
3795
+ "ONCALL" /* ONCALL */,
3796
+ "RINGING" /* RINGING */,
3797
+ "DIALING" /* DIALING */,
3798
+ "WRAPUP" /* WRAPUP */
3799
+ ].includes((_ra = (_qa = state.callData) == null ? void 0 : _qa.status) == null ? void 0 : _ra.toUpperCase()) ? __spreadProps(__spreadValues({}, enabled), {
3695
3800
  borderRight: "1px",
3696
3801
  backgroundColor: "error.main",
3697
3802
  minWidth: "60px !important",
@@ -3710,7 +3815,12 @@ function CallControls({ onDataChange }) {
3710
3815
  }) : __spreadProps(__spreadValues({}, disabled), {
3711
3816
  minWidth: "60px !important"
3712
3817
  }),
3713
- disabled: ((_Ta = (_Sa = state.callData) == null ? void 0 : _Sa.status) == null ? void 0 : _Ta.toUpperCase()) !== "ONCALL" && ((_Va = (_Ua = state.callData) == null ? void 0 : _Ua.status) == null ? void 0 : _Va.toUpperCase()) !== "RINGING" && ((_Xa = (_Wa = state.callData) == null ? void 0 : _Wa.status) == null ? void 0 : _Xa.toUpperCase()) !== "WRAPUP" || endCallLoading,
3818
+ disabled: ![
3819
+ "ONCALL" /* ONCALL */,
3820
+ "RINGING" /* RINGING */,
3821
+ "DIALING" /* DIALING */,
3822
+ "WRAPUP" /* WRAPUP */
3823
+ ].includes((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) || endCallLoading,
3714
3824
  children: endCallLoading ? /* @__PURE__ */ jsx3(
3715
3825
  CircularProgress2,
3716
3826
  {
@@ -3750,7 +3860,7 @@ function CallControls({ onDataChange }) {
3750
3860
  transition: theme.transitions.create(["box-shadow", "transform"], {
3751
3861
  duration: theme.transitions.duration.short
3752
3862
  }),
3753
- visibility: showIframe && !((_Ya = state.sdkConfig) == null ? void 0 : _Ya.disableSoftPhone) ? "visible" : "hidden",
3863
+ visibility: showIframe && !((_ua = state.sdkConfig) == null ? void 0 : _ua.disableSoftPhone) ? "visible" : "hidden",
3754
3864
  userSelect: "none"
3755
3865
  },
3756
3866
  children: [
@@ -3784,7 +3894,7 @@ function CallControls({ onDataChange }) {
3784
3894
  /* @__PURE__ */ jsx3(Box2, { children: /* @__PURE__ */ jsx3(
3785
3895
  "iframe",
3786
3896
  {
3787
- src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_Za = state.process) == null ? void 0 : _Za.process_id}`,
3897
+ src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_va = state.process) == null ? void 0 : _va.process_id}`,
3788
3898
  height: 380,
3789
3899
  width: 420,
3790
3900
  allow: "camera; microphone; autoplay",
@@ -3980,7 +4090,7 @@ function CallControls({ onDataChange }) {
3980
4090
  /* @__PURE__ */ jsx3(
3981
4091
  Chip,
3982
4092
  {
3983
- icon: /* @__PURE__ */ jsx3(Upcoming, { color: "success" }),
4093
+ icon: /* @__PURE__ */ jsx3(Upcoming2, { color: "success" }),
3984
4094
  variant: "outlined",
3985
4095
  label: "Upcoming - 66",
3986
4096
  sx: {
@@ -4069,24 +4179,27 @@ async function initSDK({
4069
4179
  agentId: agentId.trim(),
4070
4180
  baseUrl: BASE_URL
4071
4181
  });
4182
+ const res = {
4183
+ accessToken: initResult == null ? void 0 : initResult.accessToken,
4184
+ expiration: initResult == null ? void 0 : initResult.expiration,
4185
+ ticketId: initResult == null ? void 0 : initResult.ticketId
4186
+ };
4072
4187
  if (initResult) {
4073
- console.log("SDK initialized successfully");
4188
+ console.info("SDK initialized successfully");
4074
4189
  sdkStateManager.initialize(
4075
4190
  apiKey.trim(),
4076
4191
  tenantId.trim(),
4077
4192
  agentId.trim(),
4078
- sdkConfig,
4079
- initResult
4193
+ __spreadValues(__spreadValues({}, initResult == null ? void 0 : initResult.call_controls), sdkConfig),
4194
+ res
4080
4195
  );
4081
4196
  } else {
4082
- console.error("SDK initialization failed: Event tracker initialization returned false");
4083
4197
  sdkStateManager.setInitCheck();
4084
4198
  throw new Error(
4085
4199
  "SDK initialization failed: Unable to establish connection with the CTI system"
4086
4200
  );
4087
4201
  }
4088
4202
  } catch (error) {
4089
- console.error("SDK initialization error:", error);
4090
4203
  sdkStateManager.setInitCheck();
4091
4204
  if (error instanceof Error) {
4092
4205
  throw error;