call-control-sdk 6.5.2 → 6.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -60,8 +60,11 @@ __export(index_exports, {
60
60
  });
61
61
  module.exports = __toCommonJS(index_exports);
62
62
 
63
+ // call-control-sdk/lib/hooks/sdk-state.ts
64
+ var import_vault = require("@react-solutions/vault");
65
+
63
66
  // call-control-sdk/lib/services/endPoint.ts
64
- var IP = "cti.aighospitals.com";
67
+ var IP = "uat-cti.aighospitals.com";
65
68
  var BASE_URL = `https://${IP}:8095`;
66
69
  var WS_BASE_URL = `wss://${IP}:8095`;
67
70
  var VERSION = {
@@ -88,7 +91,10 @@ var END_POINT = {
88
91
  TRANSFER_TO_DETAILS: `${BASE_URL}${VERSION.v1}/cti/transfer-to-details?provider=convox`,
89
92
  SEND_NOTIFICATIONS: `${BASE_URL}${VERSION.v1}/cti/notifications/send`,
90
93
  CALL_HISTORY: `${BASE_URL}${VERSION.v1}/dashboard/call-history`,
91
- SENTIMENTAL_ANALYSIS: `${BASE_URL}${VERSION.v1}/users/get_sentiment_analysis`
94
+ SENTIMENTAL_ANALYSIS: `${BASE_URL}${VERSION.v1}/users/get_sentiment_analysis`,
95
+ DISPOSITIONS: `${BASE_URL}${VERSION.v1}/cti/calls/dispositions`,
96
+ HOSPITALS_SERVICES: `${BASE_URL}${VERSION.v1}/cti/hospital/services`,
97
+ BLIEND_TRANSFER: `${BASE_URL}${VERSION.v1}/cti/calls/blind_transfer?provider=convox`
92
98
  };
93
99
  var WS_END_POINT = {
94
100
  WS: `${WS_BASE_URL}${VERSION.v1}/cti/ws`
@@ -128,9 +134,6 @@ var SDKStateManager = class {
128
134
  enabled: {},
129
135
  outlined: {}
130
136
  },
131
- isHolding: false,
132
- isMuted: false,
133
- status: "idle",
134
137
  callStartTime: null,
135
138
  controlPanelPosition: { x: 10, y: 10 },
136
139
  iframePosition: { x: ((_a2 = window.screen) == null ? void 0 : _a2.availWidth) - 460, y: ((_b = window.screen) == null ? void 0 : _b.height) - 580 },
@@ -203,9 +206,9 @@ var SDKStateManager = class {
203
206
  loadFromStorage() {
204
207
  var _a2, _b;
205
208
  try {
206
- const stored = localStorage.getItem(this.STORAGE_KEY);
209
+ const stored = (0, import_vault.getItem)(this.STORAGE_KEY);
207
210
  if (stored) {
208
- const parsedState = JSON.parse(stored);
211
+ const parsedState = stored;
209
212
  this.state = __spreadProps(__spreadValues({}, this.state), {
210
213
  agentId: parsedState.agentId || "",
211
214
  authorization: parsedState.authorization || void 0,
@@ -226,9 +229,6 @@ var SDKStateManager = class {
226
229
  enabled: {},
227
230
  outlined: {}
228
231
  },
229
- isHolding: parsedState.isHolding || false,
230
- isMuted: parsedState.isMuted || false,
231
- status: parsedState.status || "idle",
232
232
  callStartTime: parsedState.callStartTime || null,
233
233
  controlPanelPosition: parsedState.controlPanelPosition || {
234
234
  x: 10,
@@ -247,12 +247,11 @@ var SDKStateManager = class {
247
247
  event_time: "",
248
248
  phone_number: ""
249
249
  },
250
- // Fix: Properly handle conferenceLine with fallback to initial state
251
250
  conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine
252
251
  });
253
252
  }
254
253
  } catch (error) {
255
- console.warn("Failed to load SDK state from localStorage:", error);
254
+ console.warn("Failed to load SDK state:", error);
256
255
  }
257
256
  }
258
257
  saveToStorage() {
@@ -265,18 +264,15 @@ var SDKStateManager = class {
265
264
  openConferenceDialog: this.state.openConferenceDialog,
266
265
  openCallTransferDialog: this.state.openCallTransferDialog,
267
266
  sdkConfig: this.state.sdkConfig,
268
- isHolding: this.state.isHolding,
269
- isMuted: this.state.isMuted,
270
- status: this.state.status,
271
267
  callStartTime: this.state.callStartTime,
272
268
  controlPanelPosition: this.state.controlPanelPosition,
273
269
  iframePosition: this.state.iframePosition,
274
270
  callData: this.state.callData,
275
271
  conferenceLine: this.state.conferenceLine
276
272
  };
277
- localStorage.setItem(this.STORAGE_KEY, JSON.stringify(persistentState));
273
+ (0, import_vault.setItem)(this.STORAGE_KEY, persistentState);
278
274
  } catch (error) {
279
- console.warn("Failed to save SDK state to localStorage:", error);
275
+ console.warn("Failed to save SDK state:", error);
280
276
  }
281
277
  }
282
278
  notifyListeners() {
@@ -338,21 +334,16 @@ var SDKStateManager = class {
338
334
  }
339
335
  };
340
336
  }
341
- setHolding(isHolding) {
342
- this.state.isHolding = isHolding;
343
- this.saveToStorage();
344
- this.notifyListeners();
345
- }
346
- setMuted(isMuted) {
347
- this.state.isMuted = isMuted;
348
- this.saveToStorage();
349
- this.notifyListeners();
350
- }
351
- setStatus(status) {
352
- this.state.status = status;
353
- this.saveToStorage();
354
- this.notifyListeners();
355
- }
337
+ // public setHolding(isHolding: boolean): void {
338
+ // this.state.isHolding = isHolding;
339
+ // this.saveToStorage();
340
+ // this.notifyListeners();
341
+ // }
342
+ // public setMuted(isMuted: boolean): void {
343
+ // this.state.isMuted = isMuted;
344
+ // this.saveToStorage();
345
+ // this.notifyListeners();
346
+ // }
356
347
  setProcess(process) {
357
348
  this.state.process = process;
358
349
  this.saveToStorage();
@@ -370,15 +361,11 @@ var SDKStateManager = class {
370
361
  }
371
362
  startCall() {
372
363
  this.state.callStartTime = Date.now();
373
- this.state.status = "on call";
374
364
  this.saveToStorage();
375
365
  this.notifyListeners();
376
366
  }
377
367
  endCall() {
378
368
  this.state.callStartTime = null;
379
- this.state.status = "idle";
380
- this.state.isHolding = false;
381
- this.state.isMuted = false;
382
369
  this.saveToStorage();
383
370
  this.notifyListeners();
384
371
  }
@@ -410,7 +397,6 @@ var SDKStateManager = class {
410
397
  setConferenceLine(line) {
411
398
  var _a2;
412
399
  if (!this.state.conferenceLine || !Array.isArray(this.state.conferenceLine)) {
413
- console.warn("Conference line data corrupted, resetting to initial state");
414
400
  this.state.conferenceLine = this.getInitialState().conferenceLine;
415
401
  }
416
402
  const conferenceLineData = (_a2 = this.state.conferenceLine) == null ? void 0 : _a2.map((each) => {
@@ -481,23 +467,11 @@ var SDKStateManager = class {
481
467
  }
482
468
  clearStorageAndReset() {
483
469
  try {
484
- localStorage.removeItem(this.STORAGE_KEY);
470
+ (0, import_vault.removeItem)(this.STORAGE_KEY);
485
471
  this.state = this.getInitialState();
486
472
  this.notifyListeners();
487
473
  } catch (error) {
488
- console.warn("Failed to clear localStorage:", error);
489
- }
490
- }
491
- debugStorage() {
492
- try {
493
- const stored = localStorage.getItem(this.STORAGE_KEY);
494
- console.log("Current localStorage data:", stored);
495
- if (stored) {
496
- console.log("Parsed localStorage data:", JSON.parse(stored));
497
- }
498
- console.log("Current state:", this.state);
499
- } catch (error) {
500
- console.error("Error debugging storage:", error);
474
+ console.warn("Failed to clear:", error);
501
475
  }
502
476
  }
503
477
  getConferenceLines() {
@@ -512,23 +486,17 @@ var EventTrackerSDK = class {
512
486
  __publicField(this, "config", null);
513
487
  __publicField(this, "ticketId", null);
514
488
  __publicField(this, "baseUrl", "");
515
- __publicField(this, "eventQueue", []);
516
- // private isOnline: boolean = true;
517
- // private retryQueue: Array<() => Promise<void>> = [];
518
489
  __publicField(this, "flushTimer", null);
519
490
  }
520
491
  async init(config) {
521
492
  this.config = __spreadValues({
522
- autoTrack: true,
523
493
  retryAttempts: 3,
524
494
  queueSize: 100,
525
495
  flushInterval: 5e3
526
496
  }, config);
527
497
  this.baseUrl = config.baseUrl || (typeof window !== "undefined" ? window.location.origin : "");
528
- this.setupNetworkDetection();
529
498
  const ticket = await this.createTicket();
530
499
  this.startPeriodicFlush();
531
- console.log("EventTracker SDK initialized successfully");
532
500
  return ticket;
533
501
  }
534
502
  isInitialized() {
@@ -562,104 +530,11 @@ var EventTrackerSDK = class {
562
530
  }
563
531
  const data = await response.json();
564
532
  this.ticketId = data.ticketId;
565
- if (this.config.autoTrack) {
566
- this.setupAutoTracking();
567
- }
568
533
  return data;
569
534
  } catch (error) {
570
- console.error("EventTracker initialization failed:", error);
571
535
  throw error;
572
536
  }
573
537
  }
574
- async logEvent(eventType, eventData) {
575
- if (!this.config || !this.ticketId) {
576
- console.warn("EventTracker not initialized, skipping event:", eventType);
577
- return;
578
- }
579
- const event = {
580
- eventType,
581
- eventData,
582
- timestamp: Date.now()
583
- };
584
- this.eventQueue.push(event);
585
- if (this.eventQueue.length > (this.config.queueSize || 100)) {
586
- this.eventQueue.shift();
587
- }
588
- }
589
- // private async sendEvent(event: {
590
- // eventType: string;
591
- // eventData?: EventData;
592
- // timestamp: number;
593
- // }): Promise<void> {
594
- // if (!this.config || !this.ticketId) return;
595
- // try {
596
- // const response = await this.makeRequest("/api/v1/et/event", {
597
- // method: "POST",
598
- // headers: {
599
- // "Content-Type": "application/json",
600
- // "X-API-Key": this.config.apiKey,
601
- // },
602
- // body: JSON.stringify({
603
- // ticketId: this.ticketId,
604
- // eventType: event.eventType,
605
- // eventData: event.eventData,
606
- // }),
607
- // });
608
- // if (!response.ok) {
609
- // throw new Error(`Failed to log event: ${response.status} ${response.statusText}`);
610
- // }
611
- // const index = this.eventQueue.findIndex((e) => e.timestamp === event.timestamp);
612
- // if (index > -1) {
613
- // this.eventQueue.splice(index, 1);
614
- // }
615
- // } catch (error) {
616
- // console.error("Event logging failed:", error);
617
- // // this.retryQueue.push(() => this.sendEvent(event));
618
- // }
619
- // }
620
- // async closeTicket(): Promise<void> {
621
- // if (!this.config || !this.ticketId) {
622
- // throw new Error("EventTracker not initialized");
623
- // }
624
- // await this.flush();
625
- // try {
626
- // const response = await this.makeRequest("/api/v1/et/close", {
627
- // method: "POST",
628
- // headers: {
629
- // "Content-Type": "application/json",
630
- // "X-API-Key": this.config.apiKey,
631
- // },
632
- // body: JSON.stringify({
633
- // ticketId: this.ticketId,
634
- // }),
635
- // });
636
- // if (!response.ok) {
637
- // throw new Error(`Failed to close ticket: ${response.status} ${response.statusText}`);
638
- // }
639
- // this.ticketId = null;
640
- // this.stopPeriodicFlush();
641
- // console.log("Ticket closed successfully");
642
- // } catch (error) {
643
- // console.error("Ticket close failed:", error);
644
- // throw error;
645
- // }
646
- // }
647
- // async flush(): Promise<void> {
648
- // if (!this.isOnline || this.eventQueue.length === 0) return;
649
- // // const eventsToFlush = [...this.eventQueue];
650
- // // for (const event of eventsToFlush) {
651
- // // await this.sendEvent(event);
652
- // // }
653
- // const retryItems = [...this.retryQueue];
654
- // this.retryQueue = [];
655
- // for (const retryFn of retryItems) {
656
- // try {
657
- // await retryFn();
658
- // } catch (error) {
659
- // console.error("Retry failed:", error);
660
- // }
661
- // }
662
- // }
663
538
  async makeRequest(url, options) {
664
539
  var _a2;
665
540
  const fullUrl = `${this.baseUrl}${url}`;
@@ -678,156 +553,11 @@ var EventTrackerSDK = class {
678
553
  }
679
554
  throw new Error("Max retries exceeded");
680
555
  }
681
- setupAutoTracking() {
682
- var _a2;
683
- if (typeof window === "undefined" || !((_a2 = this.config) == null ? void 0 : _a2.autoTrack)) return;
684
- const autoTrackConfig = this.config.autoTrack === true ? {} : this.config.autoTrack;
685
- if (autoTrackConfig.pageVisits !== false) {
686
- this.logEvent("pageVisit", {
687
- url: window.location.href,
688
- title: document.title,
689
- referrer: document.referrer,
690
- userAgent: navigator.userAgent,
691
- viewport: {
692
- width: window.innerWidth,
693
- height: window.innerHeight
694
- },
695
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
696
- }).catch((error) => console.warn("Failed to track page visit:", error));
697
- }
698
- if (autoTrackConfig.clicks !== false) {
699
- document.addEventListener("click", (event) => {
700
- var _a3;
701
- const target = event.target;
702
- if (target.tagName === "BUTTON" || target.tagName === "A" || target.onclick || target.getAttribute("role") === "button" || target instanceof HTMLButtonElement && target.type === "button") {
703
- this.logEvent("click", {
704
- element: target.tagName,
705
- text: (_a3 = target.textContent) == null ? void 0 : _a3.trim().substring(0, 100),
706
- href: target.getAttribute("href"),
707
- id: target.id,
708
- className: target.className,
709
- role: target.getAttribute("role"),
710
- position: {
711
- x: event.clientX,
712
- y: event.clientY
713
- },
714
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
715
- }).catch((error) => console.warn("Failed to track click:", error));
716
- }
717
- });
718
- }
719
- if (autoTrackConfig.forms !== false) {
720
- document.addEventListener("submit", (event) => {
721
- const target = event.target;
722
- const formData = new FormData(target);
723
- const formFields = {};
724
- formData.forEach((value, key) => {
725
- formFields[key] = value.toString();
726
- });
727
- this.logEvent("formSubmission", {
728
- formId: target.id,
729
- action: target.action,
730
- method: target.method,
731
- fields: Object.keys(formFields),
732
- fieldCount: Object.keys(formFields).length,
733
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
734
- }).catch((error) => console.warn("Failed to track form submission:", error));
735
- });
736
- }
737
- if (autoTrackConfig.inputs !== false) {
738
- let inputTimer;
739
- document.addEventListener("input", (event) => {
740
- const target = event.target;
741
- if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT") {
742
- clearTimeout(inputTimer);
743
- inputTimer = setTimeout(() => {
744
- var _a3;
745
- this.logEvent("fieldChange", {
746
- element: target.tagName,
747
- type: target.getAttribute("type"),
748
- name: target.getAttribute("name"),
749
- id: target.id,
750
- valueLength: ((_a3 = target.value) == null ? void 0 : _a3.length) || 0,
751
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
752
- }).catch((error) => console.warn("Failed to track field change:", error));
753
- }, 1e3);
754
- }
755
- });
756
- }
757
- const sessionStartTime = Date.now();
758
- window.addEventListener("beforeunload", () => {
759
- const sessionDuration = Date.now() - sessionStartTime;
760
- this.logEvent("pageUnload", {
761
- url: window.location.href,
762
- sessionDuration,
763
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
764
- });
765
- });
766
- if (autoTrackConfig.visibility !== false) {
767
- document.addEventListener("visibilitychange", () => {
768
- this.logEvent("visibilityChange", {
769
- hidden: document.hidden,
770
- visibilityState: document.visibilityState,
771
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
772
- });
773
- });
774
- }
775
- if (autoTrackConfig.errors !== false) {
776
- window.addEventListener("error", (event) => {
777
- this.logEvent("jsError", {
778
- message: event.message,
779
- filename: event.filename,
780
- lineno: event.lineno,
781
- colno: event.colno,
782
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
783
- });
784
- });
785
- window.addEventListener("unhandledrejection", (event) => {
786
- var _a3;
787
- this.logEvent("unhandledRejection", {
788
- reason: (_a3 = event.reason) == null ? void 0 : _a3.toString(),
789
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
790
- });
791
- });
792
- }
793
- if (autoTrackConfig.performance !== false && typeof window.performance !== "undefined" && window.performance.navigation) {
794
- window.addEventListener("load", () => {
795
- setTimeout(() => {
796
- const navigation = window.performance.navigation;
797
- const timing = window.performance.timing;
798
- this.logEvent("performanceMetrics", {
799
- navigationTime: timing.navigationStart,
800
- loadTime: timing.loadEventEnd - timing.navigationStart,
801
- domReady: timing.domContentLoadedEventEnd - timing.navigationStart,
802
- renderTime: timing.loadEventEnd - timing.domContentLoadedEventEnd,
803
- navigationType: navigation.type,
804
- redirectCount: navigation.redirectCount,
805
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
806
- });
807
- }, 1e3);
808
- });
809
- }
810
- }
811
- setupNetworkDetection() {
812
- if (typeof window === "undefined") return;
813
- window.addEventListener("online", () => {
814
- console.log("EventTracker: Back online, flushing queued events");
815
- });
816
- window.addEventListener("offline", () => {
817
- console.log("EventTracker: Offline, queueing events");
818
- });
819
- }
820
556
  startPeriodicFlush() {
821
557
  if (this.flushTimer) {
822
558
  clearInterval(this.flushTimer);
823
559
  }
824
560
  }
825
- // private stopPeriodicFlush(): void {
826
- // if (this.flushTimer) {
827
- // clearInterval(this.flushTimer);
828
- // this.flushTimer = null;
829
- // }
830
- // }
831
561
  };
832
562
  var eventTracker = new EventTrackerSDK();
833
563
  if (typeof window !== "undefined") {
@@ -876,12 +606,6 @@ function createAxiosInstance() {
876
606
  );
877
607
  instance.interceptors.response.use(
878
608
  (response) => {
879
- var _a3;
880
- const endTime = (/* @__PURE__ */ new Date()).getTime();
881
- const startTime = (_a3 = response.config.metadata) == null ? void 0 : _a3.startTime;
882
- if (startTime) {
883
- console.log(`Request to ${response.config.url} took ${endTime - startTime}ms`);
884
- }
885
609
  return response;
886
610
  },
887
611
  async (error) => {
@@ -908,6 +632,7 @@ var axiosInstance = createAxiosInstance();
908
632
  var axios_default = axiosInstance;
909
633
 
910
634
  // call-control-sdk/lib/hooks/useLogout.ts
635
+ var import_vault2 = require("@react-solutions/vault");
911
636
  var useLogout = () => {
912
637
  const [loading, setLoading] = (0, import_react.useState)(false);
913
638
  const [success, setSuccess] = (0, import_react.useState)(false);
@@ -915,8 +640,7 @@ var useLogout = () => {
915
640
  const [error, setError] = (0, import_react.useState)(null);
916
641
  const [data, setData] = (0, import_react.useState)(null);
917
642
  const handleLogout = (0, import_react.useCallback)(async () => {
918
- var _a2;
919
- const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
643
+ const state = (0, import_vault2.getItem)(STORAGE_KEY);
920
644
  setLoading(true);
921
645
  const payload = {
922
646
  action: "LOGOUTUSER",
@@ -924,16 +648,15 @@ var useLogout = () => {
924
648
  };
925
649
  return axios_default.post(END_POINT.LOGOUT, payload).then((res) => {
926
650
  sdkStateManager.clearStorageAndReset();
927
- localStorage.clear();
928
- sessionStorage.clear();
651
+ (0, import_vault2.removeItem)(STORAGE_KEY);
929
652
  setData(res == null ? void 0 : res.data);
930
653
  setSuccess(true);
931
654
  return res == null ? void 0 : res.data;
932
655
  }).catch((err) => {
933
- var _a3;
656
+ var _a2;
934
657
  setIsError(true);
935
658
  setError(err);
936
- return (_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.data;
659
+ return (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data;
937
660
  }).finally(() => {
938
661
  setLoading(false);
939
662
  });
@@ -950,6 +673,7 @@ var useLogout = () => {
950
673
 
951
674
  // call-control-sdk/lib/hooks/useEndCall.ts
952
675
  var import_react2 = require("react");
676
+ var import_vault3 = require("@react-solutions/vault");
953
677
  var useEndCall = () => {
954
678
  const [loading, setLoading] = (0, import_react2.useState)(false);
955
679
  const [success, setSuccess] = (0, import_react2.useState)(false);
@@ -958,24 +682,29 @@ var useEndCall = () => {
958
682
  const [data, setData] = (0, import_react2.useState)(null);
959
683
  const handleEndCall = (0, import_react2.useCallback)(
960
684
  async (data2) => {
961
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
962
- const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
685
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
686
+ const state = (0, import_vault3.getItem)(STORAGE_KEY);
963
687
  setLoading(true);
964
688
  const payload = {
965
689
  action: "ENDCALL",
966
690
  userId: state == null ? void 0 : state.agentId,
967
- processid: (_d = (_c = (_b = state == null ? void 0 : state.process) == null ? void 0 : _b.process_id) == null ? void 0 : _c.toString()) != null ? _d : "",
968
- process_name: (_f = (_e = state == null ? void 0 : state.process) == null ? void 0 : _e.process_name) != null ? _f : "",
969
- callreferenceid: (_h = (_g = state == null ? void 0 : state.callData) == null ? void 0 : _g.convox_id) != null ? _h : "",
970
- mobile_number: (_j = (_i = state == null ? void 0 : state.callData) == null ? void 0 : _i.phone_number) != null ? _j : "",
971
- disposition: (_k = data2 == null ? void 0 : data2.disposition) != null ? _k : "RES",
972
- set_followUp: (_l = data2 == null ? void 0 : data2.followUp) != null ? _l : "N",
973
- callback_date: (_m = data2 == null ? void 0 : data2.callbackDate) != null ? _m : "",
974
- callback_hrs: (_n = data2 == null ? void 0 : data2.callbackHrs) != null ? _n : "",
975
- callback_mins: (_o = data2 == null ? void 0 : data2.callbackMins) != null ? _o : "",
976
- endcall_type: "CLOSE"
691
+ processid: (_c = (_b = (_a2 = state == null ? void 0 : state.process) == null ? void 0 : _a2.process_id) == null ? void 0 : _b.toString()) != null ? _c : "",
692
+ process_name: (_e = (_d = state == null ? void 0 : state.process) == null ? void 0 : _d.process_name) != null ? _e : "",
693
+ callreferenceid: (_g = (_f = state == null ? void 0 : state.callData) == null ? void 0 : _f.convox_id) != null ? _g : "",
694
+ mobile_number: (_i = (_h = state == null ? void 0 : state.callData) == null ? void 0 : _h.phone_number) != null ? _i : "",
695
+ disposition: (_j = data2 == null ? void 0 : data2.disposition) != null ? _j : "RES",
696
+ set_followUp: (_k = data2 == null ? void 0 : data2.followUp) != null ? _k : "N",
697
+ callback_date: (_l = data2 == null ? void 0 : data2.callbackDate) != null ? _l : "",
698
+ callback_hrs: (_m = data2 == null ? void 0 : data2.callbackHrs) != null ? _m : "",
699
+ callback_mins: (_n = data2 == null ? void 0 : data2.callbackMins) != null ? _n : "",
700
+ endcall_type: "CLOSE",
701
+ patient_enquiry: (_o = data2 == null ? void 0 : data2.patientLog) != null ? _o : null
977
702
  };
978
- return axios_default.post(END_POINT.END_CALL, payload).then((res) => {
703
+ return axios_default.post(END_POINT.END_CALL, payload, {
704
+ params: {
705
+ isBreak: (_p = data2 == null ? void 0 : data2.isBreak) != null ? _p : false
706
+ }
707
+ }).then((res) => {
979
708
  sdkStateManager.resetConferenceLines();
980
709
  sdkStateManager.endCall();
981
710
  setData(res == null ? void 0 : res.data);
@@ -1004,6 +733,7 @@ var useEndCall = () => {
1004
733
 
1005
734
  // call-control-sdk/lib/hooks/useClickToCall.ts
1006
735
  var import_react3 = require("react");
736
+ var import_vault4 = require("@react-solutions/vault");
1007
737
  var useClickToCall = () => {
1008
738
  const [loading, setLoading] = (0, import_react3.useState)(false);
1009
739
  const [success, setSuccess] = (0, import_react3.useState)(false);
@@ -1011,10 +741,10 @@ var useClickToCall = () => {
1011
741
  const [error, setError] = (0, import_react3.useState)(null);
1012
742
  const [data, setData] = (0, import_react3.useState)(null);
1013
743
  const handleStartCall = (0, import_react3.useCallback)(async (data2) => {
1014
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
1015
- const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
744
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
745
+ const state = (0, import_vault4.getItem)(STORAGE_KEY);
1016
746
  setLoading(true);
1017
- if (((_b = state == null ? void 0 : state.callData) == null ? void 0 : _b.status) === "IDLE") {
747
+ if (((_a2 = state == null ? void 0 : state.callData) == null ? void 0 : _a2.status) === "IDLE") {
1018
748
  const payload = {
1019
749
  action: "CALL",
1020
750
  userId: state == null ? void 0 : state.agentId,
@@ -1033,15 +763,15 @@ var useClickToCall = () => {
1033
763
  }).finally(() => {
1034
764
  setLoading(false);
1035
765
  });
1036
- } else if (((_c = state == null ? void 0 : state.callData) == null ? void 0 : _c.status) === "ONCALL") {
1037
- 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));
766
+ } else if (((_b = state == null ? void 0 : state.callData) == null ? void 0 : _b.status) === "ONCALL") {
767
+ 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));
1038
768
  const payload = {
1039
769
  action: "EXTERNAL_CONFERENCE",
1040
770
  operation: `CALL${line_used.line}`,
1041
771
  line_used: String(line_used.line),
1042
772
  thirdparty_no: data2 == null ? void 0 : data2.mobileNumber,
1043
- userid: (_g = (_f = state.callData) == null ? void 0 : _f.agent_id) != null ? _g : "",
1044
- process: (_i = (_h = state.callData) == null ? void 0 : _h.process_name) != null ? _i : ""
773
+ userid: (_f = (_e = state.callData) == null ? void 0 : _e.agent_id) != null ? _f : "",
774
+ process: (_h = (_g = state.callData) == null ? void 0 : _g.process_name) != null ? _h : ""
1045
775
  };
1046
776
  return axios_default.post(END_POINT.CONFERENCE_CALL, payload).then((res) => {
1047
777
  setData(res == null ? void 0 : res.data);
@@ -1122,101 +852,16 @@ var import_icons_material2 = require("@mui/icons-material");
1122
852
  var import_material4 = require("@mui/material");
1123
853
  var import_react11 = require("react");
1124
854
 
1125
- // call-control-sdk/lib/hooks/useDraggable.ts
1126
- var import_react6 = require("react");
1127
- function useDraggable(initialPosition, onPositionChange) {
1128
- const [position, setPosition] = (0, import_react6.useState)(initialPosition);
1129
- const [isDragging, setIsDragging] = (0, import_react6.useState)(false);
1130
- const dragRef = (0, import_react6.useRef)();
1131
- const dragStart = (0, import_react6.useRef)({ x: 0, y: 0 });
1132
- const elementStart = (0, import_react6.useRef)({ x: 0, y: 0 });
1133
- const updatePosition = (0, import_react6.useCallback)(
1134
- (newPosition) => {
1135
- const element = dragRef.current;
1136
- if (!element) return;
1137
- const rect = element.getBoundingClientRect();
1138
- const viewportWidth = window.innerWidth;
1139
- const viewportHeight = window.innerHeight;
1140
- const constrainedPosition = {
1141
- x: Math.max(0, Math.min(newPosition.x, viewportWidth - rect.width)),
1142
- y: Math.max(0, Math.min(newPosition.y, viewportHeight - rect.height))
1143
- };
1144
- setPosition(constrainedPosition);
1145
- onPositionChange == null ? void 0 : onPositionChange(constrainedPosition);
1146
- },
1147
- [onPositionChange]
1148
- );
1149
- const handleStart = (0, import_react6.useCallback)(
1150
- (clientX, clientY) => {
1151
- setIsDragging(true);
1152
- dragStart.current = { x: clientX, y: clientY };
1153
- elementStart.current = position;
1154
- const handleMove = (moveClientX, moveClientY) => {
1155
- const deltaX = moveClientX - dragStart.current.x;
1156
- const deltaY = moveClientY - dragStart.current.y;
1157
- updatePosition({
1158
- x: elementStart.current.x + deltaX,
1159
- y: elementStart.current.y + deltaY
1160
- });
1161
- };
1162
- const handleMouseMove = (e) => {
1163
- e.preventDefault();
1164
- handleMove(e.clientX, e.clientY);
1165
- };
1166
- const handleTouchMove = (e) => {
1167
- e.preventDefault();
1168
- const touch = e.touches[0];
1169
- if (touch) {
1170
- handleMove(touch.clientX, touch.clientY);
1171
- }
1172
- };
1173
- const handleEnd = () => {
1174
- setIsDragging(false);
1175
- document.removeEventListener("mousemove", handleMouseMove);
1176
- document.removeEventListener("mouseup", handleEnd);
1177
- document.removeEventListener("touchmove", handleTouchMove);
1178
- document.removeEventListener("touchend", handleEnd);
1179
- };
1180
- document.addEventListener("mousemove", handleMouseMove);
1181
- document.addEventListener("mouseup", handleEnd);
1182
- document.addEventListener("touchmove", handleTouchMove, {
1183
- passive: false
1184
- });
1185
- document.addEventListener("touchend", handleEnd);
1186
- },
1187
- [position, updatePosition]
1188
- );
1189
- const handleMouseDown = (0, import_react6.useCallback)(
1190
- (e) => {
1191
- e.preventDefault();
1192
- handleStart(e.clientX, e.clientY);
1193
- },
1194
- [handleStart]
1195
- );
1196
- const handleTouchStart = (0, import_react6.useCallback)(
1197
- (e) => {
1198
- e.preventDefault();
1199
- const touch = e.touches[0];
1200
- if (touch) {
1201
- handleStart(touch.clientX, touch.clientY);
1202
- }
1203
- },
1204
- [handleStart]
1205
- );
1206
- return {
1207
- position,
1208
- isDragging,
1209
- dragRef,
1210
- handleMouseDown,
1211
- handleTouchStart
1212
- };
1213
- }
855
+ // call-control-sdk/lib/components/dialog.tsx
856
+ var import_icons_material = require("@mui/icons-material");
857
+ var import_material3 = require("@mui/material");
858
+ var import_react9 = require("react");
1214
859
 
1215
860
  // call-control-sdk/lib/hooks/useSDKState.ts
1216
- var import_react7 = require("react");
861
+ var import_react6 = require("react");
1217
862
  function useSDKState() {
1218
- const [state, setState] = (0, import_react7.useState)(sdkStateManager.getState());
1219
- (0, import_react7.useEffect)(() => {
863
+ const [state, setState] = (0, import_react6.useState)(sdkStateManager.getState());
864
+ (0, import_react6.useEffect)(() => {
1220
865
  const unsubscribe = sdkStateManager.subscribe(() => {
1221
866
  setState(sdkStateManager.getState());
1222
867
  });
@@ -1226,22 +871,22 @@ function useSDKState() {
1226
871
  }
1227
872
 
1228
873
  // call-control-sdk/lib/services/request.ts
1229
- var import_react9 = require("react");
874
+ var import_react8 = require("react");
1230
875
 
1231
876
  // call-control-sdk/lib/services/toastMessage.tsx
1232
- var import_react8 = require("react");
877
+ var import_react7 = require("react");
1233
878
  var import_material = require("@mui/material");
1234
879
  var import_jsx_runtime = require("react/jsx-runtime");
1235
- var ToastContext = (0, import_react8.createContext)(void 0);
880
+ var ToastContext = (0, import_react7.createContext)(void 0);
1236
881
  var useToast = () => {
1237
- const ctx = (0, import_react8.useContext)(ToastContext);
882
+ const ctx = (0, import_react7.useContext)(ToastContext);
1238
883
  if (!ctx) throw new Error("useToast must be used inside ToastProvider");
1239
884
  return ctx;
1240
885
  };
1241
886
  var ToastProvider = ({ children }) => {
1242
- const [open, setOpen] = (0, import_react8.useState)(false);
1243
- const [message, setMessage] = (0, import_react8.useState)("");
1244
- const [severity, setSeverity] = (0, import_react8.useState)("info");
887
+ const [open, setOpen] = (0, import_react7.useState)(false);
888
+ const [message, setMessage] = (0, import_react7.useState)("");
889
+ const [severity, setSeverity] = (0, import_react7.useState)("info");
1245
890
  const showToast = (msg, sev = "info") => {
1246
891
  setMessage(msg);
1247
892
  setSeverity(sev);
@@ -1306,11 +951,64 @@ var reducer = (state, action) => {
1306
951
  }
1307
952
  throw Error("Unknown action.");
1308
953
  };
954
+ var useGetRequest = (props = {}) => {
955
+ const { onSuccess = null, onError = null } = props;
956
+ const { showToast } = useToast();
957
+ const [state, dispatch] = (0, import_react8.useReducer)(reducer, initialState);
958
+ const getRequest = (0, import_react8.useCallback)(
959
+ (url, config = {}) => {
960
+ dispatch({
961
+ type: "isLoading",
962
+ payload: true
963
+ });
964
+ axios_default.get(url, config).then((res) => {
965
+ var _a2, _b;
966
+ if ((_a2 = res.data) == null ? void 0 : _a2.success) {
967
+ dispatch({
968
+ type: "isSuccess",
969
+ payload: res.data
970
+ });
971
+ onSuccess == null ? void 0 : onSuccess(res.data, config);
972
+ } else {
973
+ dispatch({
974
+ type: "isError",
975
+ payload: res.data
976
+ });
977
+ showToast((_b = res.data) == null ? void 0 : _b.message, "error");
978
+ onError == null ? void 0 : onError(res.data, config);
979
+ }
980
+ }).catch((err) => {
981
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
982
+ const error = {
983
+ status: (_b = (_a2 = err.response) == null ? void 0 : _a2.status) != null ? _b : 500,
984
+ 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",
985
+ data: (_h = (_g = err.response) == null ? void 0 : _g.data) != null ? _h : null,
986
+ statusText: (_j = (_i = err.response) == null ? void 0 : _i.statusText) != null ? _j : "",
987
+ code: (_k = err == null ? void 0 : err.code) != null ? _k : "",
988
+ name: (_l = err == null ? void 0 : err.name) != null ? _l : ""
989
+ };
990
+ showToast(error.message, "error");
991
+ dispatch({
992
+ type: "isError",
993
+ payload: error
994
+ });
995
+ onError == null ? void 0 : onError(error, config);
996
+ }).finally(() => {
997
+ dispatch({
998
+ type: "isLoading",
999
+ payload: false
1000
+ });
1001
+ });
1002
+ },
1003
+ [onSuccess, onError, showToast]
1004
+ );
1005
+ return [getRequest, state];
1006
+ };
1309
1007
  var usePostRequest = (props = {}) => {
1310
1008
  const { onSuccess = null, onError = null, disabledSuccessToast = false } = props;
1311
1009
  const { showToast } = useToast();
1312
- const [state, dispatch] = (0, import_react9.useReducer)(reducer, initialState);
1313
- const postRequest = (0, import_react9.useCallback)(
1010
+ const [state, dispatch] = (0, import_react8.useReducer)(reducer, initialState);
1011
+ const postRequest = (0, import_react8.useCallback)(
1314
1012
  (url, payload, config = {}) => {
1315
1013
  dispatch({
1316
1014
  type: "isLoading",
@@ -1354,11 +1052,6 @@ var usePostRequest = (props = {}) => {
1354
1052
  return [postRequest, state];
1355
1053
  };
1356
1054
 
1357
- // call-control-sdk/lib/components/dialog.tsx
1358
- var import_icons_material = require("@mui/icons-material");
1359
- var import_material3 = require("@mui/material");
1360
- var import_react10 = require("react");
1361
-
1362
1055
  // call-control-sdk/lib/components/styles.ts
1363
1056
  var import_material2 = require("@mui/material");
1364
1057
  var useStyles = ({
@@ -1426,19 +1119,19 @@ var styles_default = useStyles;
1426
1119
  // call-control-sdk/lib/components/dialog.tsx
1427
1120
  var import_jsx_runtime2 = require("react/jsx-runtime");
1428
1121
  var ConferenceTableRow = ({ each }) => {
1429
- var _a2, _b, _c, _d, _e;
1122
+ var _a2, _b, _c, _d, _e, _f;
1430
1123
  const state = useSDKState();
1124
+ const theme = (0, import_material3.useTheme)();
1431
1125
  const { showToast } = useToast();
1432
1126
  const { disabled, enabled, outlined } = styles_default({
1433
1127
  disabled: ((_a2 = state.sdkConfig) == null ? void 0 : _a2.disabled) || {},
1434
1128
  enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
1435
1129
  outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
1436
1130
  });
1437
- const theme = (0, import_material3.useTheme)();
1438
- const [conferenceCallStart, setConferenceCallStart] = (0, import_react10.useState)(false);
1439
- const [conferenceCallMerge, setConferenceCallMerge] = (0, import_react10.useState)(false);
1440
- const [conferenceCallHoldOrUnHold, setConferenceCallHoldOrUnHold] = (0, import_react10.useState)(false);
1441
- const [conferenceCallEnd, setConferenceCallEnd] = (0, import_react10.useState)(false);
1131
+ const [conferenceCallStart, setConferenceCallStart] = (0, import_react9.useState)(false);
1132
+ const [conferenceCallMerge, setConferenceCallMerge] = (0, import_react9.useState)(false);
1133
+ const [conferenceCallHoldOrUnHold, setConferenceCallHoldOrUnHold] = (0, import_react9.useState)(false);
1134
+ const [conferenceCallEnd, setConferenceCallEnd] = (0, import_react9.useState)(false);
1442
1135
  const onConferenceLineUpdate = (line, data) => {
1443
1136
  sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
1444
1137
  };
@@ -1540,26 +1233,12 @@ var ConferenceTableRow = ({ each }) => {
1540
1233
  setConferenceCallEnd(false);
1541
1234
  });
1542
1235
  };
1543
- const [holdOrUnHold] = usePostRequest({
1544
- onSuccess: () => {
1545
- sdkStateManager.setHolding(!state.isHolding);
1546
- },
1547
- onError: (error) => {
1548
- console.log("\u274C Hold operation error:", error);
1549
- }
1550
- });
1551
- const [muteOrUnMute] = usePostRequest({
1552
- onSuccess: () => {
1553
- sdkStateManager.setMuted(!state.isMuted);
1554
- },
1555
- onError: (error) => {
1556
- console.log("\u274C Mute operation error:", error);
1557
- }
1558
- });
1236
+ const [holdOrUnHold] = usePostRequest();
1237
+ const [muteOrUnMute] = usePostRequest();
1559
1238
  const handleHoldToggle = () => {
1560
1239
  var _a3;
1561
1240
  const payload = {
1562
- action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" : "HOLD",
1241
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" /* UNHOLD */ : "HOLD" /* HOLD */,
1563
1242
  userId: state.agentId
1564
1243
  };
1565
1244
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
@@ -1567,7 +1246,7 @@ var ConferenceTableRow = ({ each }) => {
1567
1246
  const handleMuteToggle = () => {
1568
1247
  var _a3;
1569
1248
  const payload = {
1570
- action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" : "MUTE",
1249
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" /* UNMUTE */ : "MUTE" /* MUTE */,
1571
1250
  userId: state.agentId
1572
1251
  };
1573
1252
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
@@ -1629,7 +1308,7 @@ var ConferenceTableRow = ({ each }) => {
1629
1308
  placeholder: "Phone Number",
1630
1309
  fullWidth: true,
1631
1310
  value: (each == null ? void 0 : each.phone) || "",
1632
- 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",
1311
+ 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 : ""),
1633
1312
  onChange: (e) => {
1634
1313
  onConferenceLineUpdate(each, { phone: e.target.value });
1635
1314
  }
@@ -1642,7 +1321,6 @@ var ConferenceTableRow = ({ each }) => {
1642
1321
  {
1643
1322
  sx: {
1644
1323
  padding: "6px",
1645
- // width: "200px",
1646
1324
  flex: 1
1647
1325
  },
1648
1326
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -1656,20 +1334,20 @@ var ConferenceTableRow = ({ each }) => {
1656
1334
  gap: "10px"
1657
1335
  },
1658
1336
  children: [
1659
- (each == null ? void 0 : each.line) === 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1337
+ (each == null ? void 0 : each.line) === 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1660
1338
  import_material3.Button,
1661
1339
  {
1662
- variant: (each == null ? void 0 : each.status) === "HOLD" ? "contained" : "outlined",
1663
- sx: (each == null ? void 0 : each.status) === "CONFERENCE" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1340
+ variant: (each == null ? void 0 : each.status) === "HOLD" /* HOLD */ ? "contained" : "outlined",
1341
+ sx: (each == null ? void 0 : each.status) === "CONFERENCE" /* CONFERENCE */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1664
1342
  onClick: () => {
1665
- if (each.status === "HOLD") {
1343
+ if (each.status === "HOLD" /* HOLD */) {
1666
1344
  onHoldOrUnHoldConferenceCall(each, { isHold: false }, "UNHOLDUSER");
1667
1345
  } else {
1668
1346
  onHoldOrUnHoldConferenceCall(each, { isHold: true }, "HOLDUSER");
1669
1347
  }
1670
1348
  },
1671
- disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" && (each == null ? void 0 : each.status) !== "HOLD" || conferenceCallHoldOrUnHold,
1672
- children: each.status === "HOLD" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1349
+ disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" /* CONFERENCE */ && (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ || conferenceCallHoldOrUnHold,
1350
+ children: each.status === "HOLD" /* HOLD */ ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1673
1351
  import_material3.Box,
1674
1352
  {
1675
1353
  sx: {
@@ -1686,7 +1364,7 @@ var ConferenceTableRow = ({ each }) => {
1686
1364
  variant: "body2",
1687
1365
  sx: {
1688
1366
  fontSize: "12px",
1689
- color: each.status === "HOLD" ? "#fff" : "initial"
1367
+ color: each.status === "HOLD" /* HOLD */ ? "#fff" : "initial"
1690
1368
  },
1691
1369
  children: "Unhold"
1692
1370
  }
@@ -1718,7 +1396,7 @@ var ConferenceTableRow = ({ each }) => {
1718
1396
  {
1719
1397
  variant: "body2",
1720
1398
  sx: {
1721
- color: each.status === "HOLD" ? "#fff" : "#000",
1399
+ color: each.status === "HOLD" /* HOLD */ ? "#fff" : "#000",
1722
1400
  fontSize: "12px"
1723
1401
  },
1724
1402
  children: "Hold"
@@ -1741,9 +1419,9 @@ var ConferenceTableRow = ({ each }) => {
1741
1419
  (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1742
1420
  import_material3.Button,
1743
1421
  {
1744
- variant: (each == null ? void 0 : each.status) !== "IDLE" ? "outlined" : "contained",
1422
+ variant: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? "outlined" : "contained",
1745
1423
  color: "success",
1746
- sx: (each == null ? void 0 : each.status) !== "IDLE" ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
1424
+ sx: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
1747
1425
  border: `0px solid ${theme.palette.success.light}`,
1748
1426
  "&:hover": {
1749
1427
  bgcolor: "success.light",
@@ -1758,7 +1436,7 @@ var ConferenceTableRow = ({ each }) => {
1758
1436
  onClick: () => {
1759
1437
  onConferenceCallStart(each, {});
1760
1438
  },
1761
- disabled: (each == null ? void 0 : each.status) !== "IDLE",
1439
+ disabled: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */,
1762
1440
  children: conferenceCallStart ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1763
1441
  import_material3.CircularProgress,
1764
1442
  {
@@ -1769,7 +1447,7 @@ var ConferenceTableRow = ({ each }) => {
1769
1447
  import_icons_material.Call,
1770
1448
  {
1771
1449
  sx: {
1772
- color: (each == null ? void 0 : each.status) !== "IDLE" ? "default" : "#f3f2f2"
1450
+ color: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? "default" : "#f3f2f2"
1773
1451
  }
1774
1452
  }
1775
1453
  )
@@ -1778,34 +1456,30 @@ var ConferenceTableRow = ({ each }) => {
1778
1456
  (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "Merge Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1779
1457
  import_material3.Button,
1780
1458
  {
1781
- variant: (each == null ? void 0 : each.status) === "ONCALL" ? "contained" : "outlined",
1782
- sx: (each == null ? void 0 : each.status) === "ONCALL" ? __spreadValues({}, enabled) : __spreadValues({}, disabled),
1459
+ variant: (each == null ? void 0 : each.status) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
1460
+ sx: (each == null ? void 0 : each.status) === "ONCALL" /* ONCALL */ ? __spreadValues({}, enabled) : __spreadValues({}, disabled),
1783
1461
  onClick: () => {
1784
1462
  onMergeConferenceCall(each, {
1785
1463
  isMergeCall: true
1786
1464
  });
1787
1465
  },
1788
- disabled: (each == null ? void 0 : each.status) !== "ONCALL",
1466
+ disabled: (each == null ? void 0 : each.status) !== "ONCALL" /* ONCALL */,
1789
1467
  children: conferenceCallMerge ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.CircularProgress, { size: "20px" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.CallSplit, {})
1790
1468
  }
1791
1469
  ) }),
1792
- (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1470
+ (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1793
1471
  import_material3.Button,
1794
1472
  {
1795
- variant: (each == null ? void 0 : each.status) === "HOLD" ? "contained" : "outlined",
1796
- sx: (each == null ? void 0 : each.status) === "CONFERENCE" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1473
+ variant: (each == null ? void 0 : each.status) === "HOLD" /* HOLD */ ? "contained" : "outlined",
1474
+ sx: (each == null ? void 0 : each.status) === "CONFERENCE" /* CONFERENCE */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
1797
1475
  onClick: () => {
1798
- if (each.status === "HOLD") {
1476
+ if (each.status === "HOLD" /* HOLD */) {
1799
1477
  onHoldOrUnHoldConferenceCall(each, { isHold: false }, "UNHOLDUSER");
1800
1478
  } else {
1801
1479
  onHoldOrUnHoldConferenceCall(each, { isHold: true }, "HOLDUSER");
1802
1480
  }
1803
1481
  },
1804
- disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" && (each == null ? void 0 : each.status) !== "HOLD" || // each?.status === "IDLE" ||
1805
- // each?.status === "ONCALL" ||
1806
- // each?.status === "DIALING" ||
1807
- // each?.status === "RINGING" ||
1808
- conferenceCallHoldOrUnHold,
1482
+ disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" /* CONFERENCE */ && (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ || conferenceCallHoldOrUnHold,
1809
1483
  children: conferenceCallHoldOrUnHold ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1810
1484
  import_material3.CircularProgress,
1811
1485
  {
@@ -1814,15 +1488,15 @@ var ConferenceTableRow = ({ each }) => {
1814
1488
  color: theme.palette.primary.main
1815
1489
  }
1816
1490
  }
1817
- ) : each.status === "HOLD" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Pause, {})
1491
+ ) : each.status === "HOLD" /* HOLD */ ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Pause, {})
1818
1492
  }
1819
1493
  ) }),
1820
1494
  (each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1821
1495
  import_material3.Button,
1822
1496
  {
1823
- variant: (each == null ? void 0 : each.status) !== "IDLE" && (each == null ? void 0 : each.status) !== "DISCONNECTED" ? "contained" : "outlined",
1497
+ variant: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ && (each == null ? void 0 : each.status) !== "DISCONNECTED" /* DISCONNECTED */ ? "contained" : "outlined",
1824
1498
  color: "error",
1825
- sx: (each == null ? void 0 : each.status) !== "IDLE" && (each == null ? void 0 : each.status) !== "DISCONNECTED" ? __spreadProps(__spreadValues({}, enabled), {
1499
+ sx: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ && (each == null ? void 0 : each.status) !== "DISCONNECTED" /* DISCONNECTED */ ? __spreadProps(__spreadValues({}, enabled), {
1826
1500
  border: `0px solid ${theme.palette.error.light}`,
1827
1501
  "&:hover": {
1828
1502
  bgcolor: "error.light",
@@ -1842,7 +1516,7 @@ var ConferenceTableRow = ({ each }) => {
1842
1516
  isHold: false
1843
1517
  });
1844
1518
  },
1845
- disabled: (each == null ? void 0 : each.status) === "IDLE" || (each == null ? void 0 : each.status) === "DISCONNECTED" || conferenceCallEnd,
1519
+ disabled: (each == null ? void 0 : each.status) === "IDLE" /* IDLE */ || (each == null ? void 0 : each.status) === "DISCONNECTED" /* DISCONNECTED */ || conferenceCallEnd,
1846
1520
  children: conferenceCallEnd ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1847
1521
  import_material3.CircularProgress,
1848
1522
  {
@@ -1866,7 +1540,7 @@ function ConferenceDialog() {
1866
1540
  var _a2;
1867
1541
  const state = useSDKState();
1868
1542
  const { showToast } = useToast();
1869
- const [conferenceCallEndAll, setConferenceCallEndAll] = (0, import_react10.useState)(false);
1543
+ const [conferenceCallEndAll, setConferenceCallEndAll] = (0, import_react9.useState)(false);
1870
1544
  const handleClose = () => {
1871
1545
  sdkStateManager.setOpenConferenceDialog(false);
1872
1546
  };
@@ -2062,17 +1736,26 @@ function ConferenceDialog() {
2062
1736
  ) });
2063
1737
  }
2064
1738
  function CallTransferDialog({ open }) {
2065
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1739
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2066
1740
  const state = useSDKState();
1741
+ const [mobileNumber, setMobileNumber] = (0, import_react9.useState)("");
2067
1742
  const [transferCall] = usePostRequest({
2068
1743
  onSuccess: () => {
2069
1744
  sdkStateManager.setOpenCallTransferDialog(false);
2070
1745
  }
2071
1746
  });
2072
- const [currentselecteTab, setCurrentselecteTab] = (0, import_react10.useState)("process");
1747
+ const [blindTransferCall] = usePostRequest({
1748
+ onSuccess: () => {
1749
+ sdkStateManager.setOpenCallTransferDialog(false);
1750
+ }
1751
+ });
1752
+ const [currentselecteTab, setCurrentselecteTab] = (0, import_react9.useState)("process");
2073
1753
  const [getIdelAgentsList, { data: idleAgentsList, isLoading: isIdleAgentsListLoading }] = usePostRequest({
2074
1754
  disabledSuccessToast: true
2075
1755
  });
1756
+ const [getHospitalsServicesList, { data: hospitalsServicesList, isLoading: isHospitalsServicesListLoading }] = useGetRequest({
1757
+ disabledSuccessToast: true
1758
+ });
2076
1759
  const [
2077
1760
  getProcessAndQueuesList,
2078
1761
  { data: processAndQueuesList, isLoading: isProcessAndQueuesListLoading }
@@ -2083,7 +1766,7 @@ function CallTransferDialog({ open }) {
2083
1766
  sdkStateManager.setOpenCallTransferDialog(false);
2084
1767
  };
2085
1768
  const handleTransferCall = (data, type) => {
2086
- 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;
1769
+ 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;
2087
1770
  if (type === "PROCESS") {
2088
1771
  const payload = {
2089
1772
  mobile_number: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.phone_number) != null ? _b2 : "",
@@ -2097,13 +1780,13 @@ function CallTransferDialog({ open }) {
2097
1780
  transferCall(END_POINT.TRANSFER_CALL, payload);
2098
1781
  } else if (type === "QUEUE") {
2099
1782
  const payload = {
2100
- mobile_number: (_m = (_l2 = state.callData) == null ? void 0 : _l2.phone_number) != null ? _m : "",
2101
- userid: (_o = (_n = state.callData) == null ? void 0 : _n.agent_id) != null ? _o : "",
1783
+ mobile_number: (_m2 = (_l2 = state.callData) == null ? void 0 : _l2.phone_number) != null ? _m2 : "",
1784
+ userid: (_o2 = (_n2 = state.callData) == null ? void 0 : _n2.agent_id) != null ? _o2 : "",
2102
1785
  type: "QUEUE",
2103
- transfer_to: (_p = data == null ? void 0 : data.queue_name) != null ? _p : "",
2104
- callreferenceid: (_r = (_q = state.callData) == null ? void 0 : _q.convox_id) != null ? _r : "",
2105
- processid: String((_t = (_s = state.callData) == null ? void 0 : _s.process_id) != null ? _t : ""),
2106
- process_name: (_v = (_u = state.callData) == null ? void 0 : _u.process_name) != null ? _v : ""
1786
+ transfer_to: (_p2 = data == null ? void 0 : data.queue_name) != null ? _p2 : "",
1787
+ callreferenceid: (_r2 = (_q2 = state.callData) == null ? void 0 : _q2.convox_id) != null ? _r2 : "",
1788
+ processid: String((_t2 = (_s2 = state.callData) == null ? void 0 : _s2.process_id) != null ? _t2 : ""),
1789
+ process_name: (_v = (_u2 = state.callData) == null ? void 0 : _u2.process_name) != null ? _v : ""
2107
1790
  };
2108
1791
  transferCall(END_POINT.TRANSFER_CALL, payload);
2109
1792
  } else if (type === "AGENT") {
@@ -2117,9 +1800,18 @@ function CallTransferDialog({ open }) {
2117
1800
  process_name: (_G = (_F = state.callData) == null ? void 0 : _F.process_name) != null ? _G : ""
2118
1801
  };
2119
1802
  transferCall(END_POINT.TRANSFER_CALL, payload);
1803
+ } else if (type === "OTHER") {
1804
+ const payload = {
1805
+ action: "BLIND_TRANSFER",
1806
+ userid: (_I = (_H = state.callData) == null ? void 0 : _H.agent_id) != null ? _I : "",
1807
+ callreferenceid: (_K = (_J = state.callData) == null ? void 0 : _J.convox_id) != null ? _K : "",
1808
+ blind_transfer_no: (_L = data == null ? void 0 : data.mobile_number) != null ? _L : ""
1809
+ };
1810
+ console.log("payload", payload);
1811
+ blindTransferCall(END_POINT.BLIEND_TRANSFER, payload);
2120
1812
  }
2121
1813
  };
2122
- (0, import_react10.useEffect)(() => {
1814
+ (0, import_react9.useEffect)(() => {
2123
1815
  getIdelAgentsList(END_POINT.AGENTS_LIST, {
2124
1816
  status: "IDLE",
2125
1817
  active: true
@@ -2128,6 +1820,7 @@ function CallTransferDialog({ open }) {
2128
1820
  status: "ACTIVE",
2129
1821
  active: true
2130
1822
  });
1823
+ getHospitalsServicesList(END_POINT.HOSPITALS_SERVICES);
2131
1824
  }, []);
2132
1825
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2133
1826
  import_material3.Dialog,
@@ -2136,7 +1829,7 @@ function CallTransferDialog({ open }) {
2136
1829
  "aria-labelledby": "alert-dialog-title",
2137
1830
  "aria-describedby": "alert-dialog-description",
2138
1831
  fullWidth: true,
2139
- maxWidth: "md",
1832
+ maxWidth: "sm",
2140
1833
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
2141
1834
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2142
1835
  import_material3.Box,
@@ -2158,23 +1851,17 @@ function CallTransferDialog({ open }) {
2158
1851
  import_material3.Box,
2159
1852
  {
2160
1853
  sx: {
2161
- boxShadow: "1px 1px 4px #d3d3d3ff",
2162
- padding: "6px 10px",
2163
1854
  margin: "10px",
2164
1855
  borderRadius: "10px"
2165
1856
  },
2166
1857
  children: [
2167
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "flex", gap: 1 }, children: [
1858
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "flex", gap: 1, margin: "10px" }, children: [
2168
1859
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2169
1860
  import_material3.Button,
2170
1861
  {
2171
1862
  variant: currentselecteTab === "process" ? "contained" : "outlined",
2172
1863
  onClick: () => {
2173
1864
  setCurrentselecteTab("process");
2174
- getProcessAndQueuesList(END_POINT.TRANSFER_TO_DETAILS, {
2175
- status: "ACTIVE",
2176
- active: true
2177
- });
2178
1865
  },
2179
1866
  children: "Process"
2180
1867
  }
@@ -2185,10 +1872,6 @@ function CallTransferDialog({ open }) {
2185
1872
  variant: currentselecteTab === "queues" ? "contained" : "outlined",
2186
1873
  onClick: () => {
2187
1874
  setCurrentselecteTab("queues");
2188
- getProcessAndQueuesList(END_POINT.TRANSFER_TO_DETAILS, {
2189
- status: "ACTIVE",
2190
- active: true
2191
- });
2192
1875
  },
2193
1876
  children: "Queues"
2194
1877
  }
@@ -2206,9 +1889,19 @@ function CallTransferDialog({ open }) {
2206
1889
  },
2207
1890
  children: "Agents"
2208
1891
  }
1892
+ ),
1893
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1894
+ import_material3.Button,
1895
+ {
1896
+ variant: currentselecteTab === "others" ? "contained" : "outlined",
1897
+ onClick: () => {
1898
+ setCurrentselecteTab("others");
1899
+ },
1900
+ children: "Others"
1901
+ }
2209
1902
  )
2210
1903
  ] }),
2211
- (isProcessAndQueuesListLoading || isIdleAgentsListLoading) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1904
+ (isProcessAndQueuesListLoading || isIdleAgentsListLoading || isHospitalsServicesListLoading) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2212
1905
  import_material3.Box,
2213
1906
  {
2214
1907
  sx: {
@@ -2223,7 +1916,7 @@ function CallTransferDialog({ open }) {
2223
1916
  ]
2224
1917
  }
2225
1918
  ),
2226
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.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__ */ (0, import_jsx_runtime2.jsxs)(
1919
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.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__ */ (0, import_jsx_runtime2.jsxs)(
2227
1920
  import_material3.Box,
2228
1921
  {
2229
1922
  sx: {
@@ -2248,7 +1941,7 @@ function CallTransferDialog({ open }) {
2248
1941
  alignItems: "center"
2249
1942
  },
2250
1943
  children: [
2251
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
1944
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MemoryOutlined, { sx: { marginRight: "4px" } }),
2252
1945
  process.process_name
2253
1946
  ]
2254
1947
  }
@@ -2270,26 +1963,41 @@ function CallTransferDialog({ open }) {
2270
1963
  ]
2271
1964
  },
2272
1965
  index
2273
- )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2274
- import_material3.Typography,
1966
+ )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1967
+ import_material3.Box,
2275
1968
  {
2276
- variant: "body1",
2277
1969
  sx: {
2278
- fontSize: "16px",
2279
- letterSpacing: "0.02em",
2280
- textTransform: "capitalize",
2281
1970
  display: "flex",
2282
1971
  alignItems: "center",
2283
1972
  justifyContent: "center",
2284
- width: "100%",
2285
- margin: "10px 0px",
2286
- color: "gray",
2287
- height: "60px"
1973
+ flexDirection: "column"
2288
1974
  },
2289
- children: "No Process Found"
1975
+ p: 2,
1976
+ children: [
1977
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
1978
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1979
+ import_material3.Typography,
1980
+ {
1981
+ variant: "body1",
1982
+ sx: {
1983
+ fontSize: "16px",
1984
+ letterSpacing: "0.02em",
1985
+ textTransform: "capitalize",
1986
+ display: "flex",
1987
+ alignItems: "center",
1988
+ justifyContent: "center",
1989
+ width: "100%",
1990
+ margin: "10px 0px",
1991
+ color: "primary.main",
1992
+ height: "20px"
1993
+ },
1994
+ children: "No Process Found"
1995
+ }
1996
+ )
1997
+ ]
2290
1998
  }
2291
1999
  ) }),
2292
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && currentselecteTab === "queues" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.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) => {
2000
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "queues" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.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) => {
2293
2001
  var _a3, _b2, _c2, _d2, _e2, _f2;
2294
2002
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2295
2003
  import_material3.Box,
@@ -2316,7 +2024,7 @@ function CallTransferDialog({ open }) {
2316
2024
  alignItems: "center"
2317
2025
  },
2318
2026
  children: [
2319
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
2027
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Airlines, { sx: { marginRight: "4px" } }),
2320
2028
  queue.queue_name,
2321
2029
  ((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
2322
2030
  (process) => process.process_id === queue.process_id
@@ -2357,26 +2065,41 @@ function CallTransferDialog({ open }) {
2357
2065
  },
2358
2066
  index
2359
2067
  );
2360
- }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2361
- import_material3.Typography,
2068
+ }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2069
+ import_material3.Box,
2362
2070
  {
2363
- variant: "body1",
2364
2071
  sx: {
2365
- fontSize: "16px",
2366
- letterSpacing: "0.02em",
2367
- textTransform: "capitalize",
2368
2072
  display: "flex",
2369
2073
  alignItems: "center",
2370
2074
  justifyContent: "center",
2371
- width: "100%",
2372
- margin: "10px 0px",
2373
- color: "gray",
2374
- height: "60px"
2075
+ flexDirection: "column"
2375
2076
  },
2376
- children: "No Queues Found"
2077
+ p: 2,
2078
+ children: [
2079
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2080
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2081
+ import_material3.Typography,
2082
+ {
2083
+ variant: "body1",
2084
+ sx: {
2085
+ fontSize: "16px",
2086
+ letterSpacing: "0.02em",
2087
+ textTransform: "capitalize",
2088
+ display: "flex",
2089
+ alignItems: "center",
2090
+ justifyContent: "center",
2091
+ width: "100%",
2092
+ margin: "10px 0px",
2093
+ color: "primary.main",
2094
+ height: "20px"
2095
+ },
2096
+ children: "No Queues Found"
2097
+ }
2098
+ )
2099
+ ]
2377
2100
  }
2378
2101
  ) }),
2379
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && currentselecteTab === "agents" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.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__ */ (0, import_jsx_runtime2.jsxs)(
2102
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "agents" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.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__ */ (0, import_jsx_runtime2.jsxs)(
2380
2103
  import_material3.Box,
2381
2104
  {
2382
2105
  sx: {
@@ -2423,25 +2146,178 @@ function CallTransferDialog({ open }) {
2423
2146
  ]
2424
2147
  },
2425
2148
  index
2426
- )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2427
- import_material3.Typography,
2149
+ )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2150
+ import_material3.Box,
2428
2151
  {
2429
- variant: "body1",
2430
2152
  sx: {
2431
- fontSize: "16px",
2432
- letterSpacing: "0.02em",
2433
- textTransform: "capitalize",
2434
2153
  display: "flex",
2435
2154
  alignItems: "center",
2436
2155
  justifyContent: "center",
2437
- width: "100%",
2438
- margin: "10px 0px",
2439
- color: "gray",
2440
- height: "60px"
2156
+ flexDirection: "column"
2441
2157
  },
2442
- children: "No Agents Found"
2443
- }
2444
- ) })
2158
+ p: 2,
2159
+ children: [
2160
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2161
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2162
+ import_material3.Typography,
2163
+ {
2164
+ variant: "body1",
2165
+ sx: {
2166
+ fontSize: "16px",
2167
+ letterSpacing: "0.02em",
2168
+ textTransform: "capitalize",
2169
+ display: "flex",
2170
+ alignItems: "center",
2171
+ justifyContent: "center",
2172
+ width: "100%",
2173
+ margin: "10px 0px",
2174
+ color: "primary.main",
2175
+ height: "20px"
2176
+ },
2177
+ children: "No Agents Found"
2178
+ }
2179
+ )
2180
+ ]
2181
+ }
2182
+ ) }),
2183
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "others" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: [
2184
+ (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) => {
2185
+ var _a3, _b2, _c2;
2186
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2187
+ import_material3.Box,
2188
+ {
2189
+ sx: {
2190
+ p: 1,
2191
+ display: "flex",
2192
+ alignItems: "center",
2193
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2194
+ padding: "6px",
2195
+ borderRadius: "10px",
2196
+ "&:hover": { bgcolor: "action.selected" }
2197
+ },
2198
+ children: [
2199
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2200
+ import_material3.Typography,
2201
+ {
2202
+ variant: "body1",
2203
+ sx: {
2204
+ mx: 1,
2205
+ width: "200px",
2206
+ maxWidth: "250px",
2207
+ display: "flex",
2208
+ alignItems: "center"
2209
+ },
2210
+ children: [
2211
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Roofing, { sx: { marginRight: "4px" } }),
2212
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: `${(_a3 = service == null ? void 0 : service.description) != null ? _a3 : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { color: "text.secondary" }, children: [
2213
+ service.name,
2214
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: {
2215
+ fontSize: "9px",
2216
+ fontWeight: "600",
2217
+ letterSpacing: "0.02em",
2218
+ textTransform: "capitalize",
2219
+ color: "gray",
2220
+ textOverflow: "ellipsis",
2221
+ whiteSpace: "nowrap",
2222
+ overflow: "hidden",
2223
+ maxWidth: "160px"
2224
+ }, children: (_b2 = service == null ? void 0 : service.description) != null ? _b2 : "" })
2225
+ ] }) })
2226
+ ]
2227
+ }
2228
+ ),
2229
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (_c2 = service == null ? void 0 : service.phone_number) != null ? _c2 : "", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2230
+ import_material3.IconButton,
2231
+ {
2232
+ color: "success",
2233
+ sx: {
2234
+ bgcolor: "action.hover",
2235
+ "&:hover": { bgcolor: "action.selected" }
2236
+ },
2237
+ onClick: () => {
2238
+ var _a4;
2239
+ handleTransferCall({
2240
+ mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : ""
2241
+ }, "OTHER");
2242
+ },
2243
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2244
+ }
2245
+ ) })
2246
+ ]
2247
+ },
2248
+ index
2249
+ );
2250
+ })),
2251
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2252
+ import_material3.Box,
2253
+ {
2254
+ sx: {
2255
+ p: 1,
2256
+ display: "flex",
2257
+ alignItems: "center",
2258
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2259
+ padding: "6px",
2260
+ borderRadius: "10px"
2261
+ },
2262
+ children: [
2263
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2264
+ import_material3.Typography,
2265
+ {
2266
+ variant: "body1",
2267
+ sx: {
2268
+ mx: 1,
2269
+ width: "200px",
2270
+ maxWidth: "250px",
2271
+ display: "flex",
2272
+ alignItems: "center"
2273
+ },
2274
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2275
+ import_material3.TextField,
2276
+ {
2277
+ size: "small",
2278
+ name: "others",
2279
+ label: "Mobile number",
2280
+ variant: "outlined",
2281
+ type: "tel",
2282
+ value: mobileNumber,
2283
+ onChange: (e) => {
2284
+ const v = e.target.value;
2285
+ if (/^\d*$/.test(v)) {
2286
+ setMobileNumber(v);
2287
+ }
2288
+ },
2289
+ slotProps: {
2290
+ htmlInput: {
2291
+ inputMode: "numeric",
2292
+ maxLength: 11
2293
+ }
2294
+ },
2295
+ placeholder: "Enter mobile number",
2296
+ autoComplete: "off"
2297
+ }
2298
+ )
2299
+ }
2300
+ ),
2301
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2302
+ import_material3.IconButton,
2303
+ {
2304
+ color: "success",
2305
+ sx: {
2306
+ bgcolor: "action.hover",
2307
+ "&:hover": { bgcolor: "action.selected" }
2308
+ },
2309
+ onClick: () => {
2310
+ handleTransferCall({
2311
+ mobile_number: mobileNumber != null ? mobileNumber : ""
2312
+ }, "OTHER");
2313
+ },
2314
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2315
+ }
2316
+ ) })
2317
+ ]
2318
+ }
2319
+ )
2320
+ ] })
2445
2321
  ]
2446
2322
  }
2447
2323
  )
@@ -2450,18 +2326,16 @@ function CallTransferDialog({ open }) {
2450
2326
  ) });
2451
2327
  }
2452
2328
  function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2453
- var _a2, _b, _c, _d;
2454
- const [formData, setFormData] = (0, import_react10.useState)({
2329
+ var _a2, _b, _c, _d, _e;
2330
+ const [getDispositions, data] = useGetRequest();
2331
+ const [formData, setFormData] = (0, import_react9.useState)({
2455
2332
  disposition: { label: "Resolved", value: "RES" },
2456
2333
  followUp: { label: "No", value: "N" },
2457
2334
  callbackDate: "",
2458
2335
  callbackHrs: "",
2459
- callbackMins: ""
2336
+ callbackMins: "",
2337
+ selected_break: false
2460
2338
  });
2461
- const dispositionOptions = [
2462
- { label: "Not Interested", value: "NI" },
2463
- { label: "Resolved", value: "RES" }
2464
- ];
2465
2339
  const followUpOptions = [
2466
2340
  { label: "Yes", value: "Y" },
2467
2341
  { label: "No", value: "N" }
@@ -2475,13 +2349,24 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2475
2349
  followUp: { label: "No", value: "N" },
2476
2350
  callbackDate: "",
2477
2351
  callbackHrs: "",
2478
- callbackMins: ""
2352
+ callbackMins: "",
2353
+ selected_break: false
2479
2354
  });
2480
2355
  };
2481
2356
  const handleClose = () => {
2482
2357
  handleReset();
2483
2358
  setOpen(false);
2484
2359
  };
2360
+ (0, import_react9.useEffect)(() => {
2361
+ getDispositions(END_POINT.DISPOSITIONS);
2362
+ }, []);
2363
+ const dispositionsOptions = (0, import_react9.useMemo)(() => {
2364
+ var _a3, _b2;
2365
+ return ((_b2 = (_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.data) == null ? void 0 : _b2.map((item) => ({
2366
+ label: item.name,
2367
+ value: item.code
2368
+ }))) || [];
2369
+ }, [(_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.data]);
2485
2370
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2486
2371
  import_material3.Dialog,
2487
2372
  {
@@ -2534,7 +2419,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2534
2419
  import_material3.Autocomplete,
2535
2420
  {
2536
2421
  value: formData.disposition,
2537
- options: dispositionOptions,
2422
+ options: dispositionsOptions,
2538
2423
  getOptionLabel: (opt) => opt.label,
2539
2424
  onChange: (_, val) => handleChange("disposition", val),
2540
2425
  size: "small",
@@ -2569,14 +2454,37 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2569
2454
  ]
2570
2455
  }
2571
2456
  ),
2572
- ((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2457
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2573
2458
  import_material3.Box,
2574
2459
  {
2575
2460
  display: "flex",
2576
2461
  gap: 2,
2577
2462
  mt: 2,
2578
2463
  children: [
2579
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2464
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: {
2465
+ flex: "1",
2466
+ border: "1px solid #bdbdbd",
2467
+ borderRadius: "5px"
2468
+ }, children: [
2469
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2470
+ import_material3.Checkbox,
2471
+ {
2472
+ name: "selected_break",
2473
+ sx: {
2474
+ padding: "6px"
2475
+ },
2476
+ checked: formData.selected_break,
2477
+ onChange: (event) => {
2478
+ handleChange("selected_break", event.target.checked);
2479
+ },
2480
+ slotProps: {
2481
+ input: { "aria-label": "controlled" }
2482
+ }
2483
+ }
2484
+ ),
2485
+ " Mark as break"
2486
+ ] }),
2487
+ ((_c = (_b = formData == null ? void 0 : formData.followUp) == null ? void 0 : _b.label) == null ? void 0 : _c.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2580
2488
  import_material3.TextField,
2581
2489
  {
2582
2490
  size: "small",
@@ -2590,7 +2498,17 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2590
2498
  fullWidth: true,
2591
2499
  sx: { flex: 1 }
2592
2500
  }
2593
- ),
2501
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
2502
+ ]
2503
+ }
2504
+ ),
2505
+ ((_e = (_d = formData == null ? void 0 : formData.followUp) == null ? void 0 : _d.label) == null ? void 0 : _e.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2506
+ import_material3.Box,
2507
+ {
2508
+ display: "flex",
2509
+ gap: 2,
2510
+ mt: 2,
2511
+ children: [
2594
2512
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2595
2513
  import_material3.TextField,
2596
2514
  {
@@ -2602,17 +2520,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2602
2520
  fullWidth: true,
2603
2521
  sx: { flex: 1 }
2604
2522
  }
2605
- )
2606
- ]
2607
- }
2608
- ),
2609
- ((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2610
- import_material3.Box,
2611
- {
2612
- display: "flex",
2613
- gap: 2,
2614
- mt: 2,
2615
- children: [
2523
+ ),
2616
2524
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2617
2525
  import_material3.TextField,
2618
2526
  {
@@ -2624,8 +2532,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2624
2532
  fullWidth: true,
2625
2533
  sx: { flex: 1 }
2626
2534
  }
2627
- ),
2628
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
2535
+ )
2629
2536
  ]
2630
2537
  }
2631
2538
  )
@@ -2806,6 +2713,147 @@ function CallHistoryDialog({ open, setOpen }) {
2806
2713
  ) });
2807
2714
  }
2808
2715
 
2716
+ // call-control-sdk/lib/hooks/useDraggable.ts
2717
+ var import_react10 = require("react");
2718
+ function useDraggable(initialPosition, onPositionChange) {
2719
+ const [position, setPosition] = (0, import_react10.useState)(initialPosition);
2720
+ const [isDragging, setIsDragging] = (0, import_react10.useState)(false);
2721
+ const dragRef = (0, import_react10.useRef)();
2722
+ const dragStart = (0, import_react10.useRef)({ x: 0, y: 0 });
2723
+ const elementStart = (0, import_react10.useRef)({ x: 0, y: 0 });
2724
+ const updatePosition = (0, import_react10.useCallback)(
2725
+ (newPosition) => {
2726
+ const element = dragRef.current;
2727
+ if (!element) return;
2728
+ const rect = element.getBoundingClientRect();
2729
+ const viewportWidth = window.innerWidth;
2730
+ const viewportHeight = window.innerHeight;
2731
+ const constrainedPosition = {
2732
+ x: Math.max(0, Math.min(newPosition.x, viewportWidth - rect.width)),
2733
+ y: Math.max(0, Math.min(newPosition.y, viewportHeight - rect.height))
2734
+ };
2735
+ setPosition(constrainedPosition);
2736
+ onPositionChange == null ? void 0 : onPositionChange(constrainedPosition);
2737
+ },
2738
+ [onPositionChange]
2739
+ );
2740
+ const handleStart = (0, import_react10.useCallback)(
2741
+ (clientX, clientY) => {
2742
+ setIsDragging(true);
2743
+ dragStart.current = { x: clientX, y: clientY };
2744
+ elementStart.current = position;
2745
+ const handleMove = (moveClientX, moveClientY) => {
2746
+ const deltaX = moveClientX - dragStart.current.x;
2747
+ const deltaY = moveClientY - dragStart.current.y;
2748
+ updatePosition({
2749
+ x: elementStart.current.x + deltaX,
2750
+ y: elementStart.current.y + deltaY
2751
+ });
2752
+ };
2753
+ const handleMouseMove = (e) => {
2754
+ e.preventDefault();
2755
+ handleMove(e.clientX, e.clientY);
2756
+ };
2757
+ const handleTouchMove = (e) => {
2758
+ e.preventDefault();
2759
+ const touch = e.touches[0];
2760
+ if (touch) {
2761
+ handleMove(touch.clientX, touch.clientY);
2762
+ }
2763
+ };
2764
+ const handleEnd = () => {
2765
+ setIsDragging(false);
2766
+ document.removeEventListener("mousemove", handleMouseMove);
2767
+ document.removeEventListener("mouseup", handleEnd);
2768
+ document.removeEventListener("touchmove", handleTouchMove);
2769
+ document.removeEventListener("touchend", handleEnd);
2770
+ };
2771
+ document.addEventListener("mousemove", handleMouseMove);
2772
+ document.addEventListener("mouseup", handleEnd);
2773
+ document.addEventListener("touchmove", handleTouchMove, {
2774
+ passive: false
2775
+ });
2776
+ document.addEventListener("touchend", handleEnd);
2777
+ },
2778
+ [position, updatePosition]
2779
+ );
2780
+ const handleMouseDown = (0, import_react10.useCallback)(
2781
+ (e) => {
2782
+ e.preventDefault();
2783
+ handleStart(e.clientX, e.clientY);
2784
+ },
2785
+ [handleStart]
2786
+ );
2787
+ const handleTouchStart = (0, import_react10.useCallback)(
2788
+ (e) => {
2789
+ e.preventDefault();
2790
+ const touch = e.touches[0];
2791
+ if (touch) {
2792
+ handleStart(touch.clientX, touch.clientY);
2793
+ }
2794
+ },
2795
+ [handleStart]
2796
+ );
2797
+ return {
2798
+ position,
2799
+ isDragging,
2800
+ dragRef,
2801
+ handleMouseDown,
2802
+ handleTouchStart
2803
+ };
2804
+ }
2805
+
2806
+ // call-control-sdk/lib/services/micController.ts
2807
+ function createMicController(constraints = { audio: true }) {
2808
+ let stream = null;
2809
+ let muted = false;
2810
+ async function start() {
2811
+ if (stream) return;
2812
+ stream = await navigator.mediaDevices.getUserMedia(constraints);
2813
+ stream.getAudioTracks().forEach((track) => track.enabled = true);
2814
+ muted = false;
2815
+ }
2816
+ function setEnabled(enabled) {
2817
+ if (!stream) return;
2818
+ stream.getAudioTracks().forEach((track) => track.enabled = enabled);
2819
+ muted = !enabled;
2820
+ }
2821
+ function mute() {
2822
+ setEnabled(false);
2823
+ }
2824
+ function unmute() {
2825
+ setEnabled(true);
2826
+ }
2827
+ function toggleMute() {
2828
+ if (muted) {
2829
+ unmute();
2830
+ } else {
2831
+ mute();
2832
+ }
2833
+ }
2834
+ function stop() {
2835
+ if (!stream) return;
2836
+ stream.getTracks().forEach((t) => t.stop());
2837
+ stream = null;
2838
+ muted = false;
2839
+ }
2840
+ function isMuted() {
2841
+ return muted;
2842
+ }
2843
+ function getStream() {
2844
+ return stream;
2845
+ }
2846
+ return {
2847
+ start,
2848
+ stop,
2849
+ mute,
2850
+ unmute,
2851
+ toggleMute,
2852
+ isMuted,
2853
+ getStream
2854
+ };
2855
+ }
2856
+
2809
2857
  // call-control-sdk/lib/utils/audioLoader.ts
2810
2858
  var import_incoming = __toESM(require("./incoming-4WP3FJI4.mp3"));
2811
2859
  var audioBlobUrl = null;
@@ -2829,7 +2877,7 @@ async function loadAudioAsBlob() {
2829
2877
  audioBlobUrl = URL.createObjectURL(blob);
2830
2878
  return audioBlobUrl;
2831
2879
  } catch (error) {
2832
- console.warn("Could not create blob URL, using direct URL:", error);
2880
+ console.error("Could not create blob URL, using direct URL:", error);
2833
2881
  return import_incoming.default;
2834
2882
  }
2835
2883
  }
@@ -2868,15 +2916,11 @@ async function createAudioElement() {
2868
2916
  };
2869
2917
  let loaded = await tryLoadAudio(audioUrl);
2870
2918
  if (!loaded && audioUrl !== import_incoming.default) {
2871
- console.log("Primary URL failed, trying original import URL:", import_incoming.default);
2872
2919
  loaded = await tryLoadAudio(import_incoming.default);
2873
2920
  if (loaded) {
2874
2921
  audioUrl = import_incoming.default;
2875
2922
  }
2876
2923
  }
2877
- if (!loaded) {
2878
- console.error("Failed to load audio with all methods. URL:", audioUrl);
2879
- }
2880
2924
  return audio;
2881
2925
  }
2882
2926
  function cleanupAudioResources() {
@@ -2888,6 +2932,7 @@ function cleanupAudioResources() {
2888
2932
  }
2889
2933
 
2890
2934
  // call-control-sdk/lib/components/callControls.tsx
2935
+ var import_vault5 = require("@react-solutions/vault");
2891
2936
  var import_jsx_runtime3 = require("react/jsx-runtime");
2892
2937
  var getCombineConfrenceData = (localState, apiData) => {
2893
2938
  const localConfrenceData = localState == null ? void 0 : localState.conferenceLine;
@@ -2918,7 +2963,7 @@ var formatDuration = (seconds) => {
2918
2963
  return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
2919
2964
  };
2920
2965
  function CallControls({ onDataChange }) {
2921
- 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;
2966
+ 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;
2922
2967
  const theme = (0, import_material4.useTheme)();
2923
2968
  const state = useSDKState();
2924
2969
  const { showToast } = useToast();
@@ -2927,6 +2972,7 @@ function CallControls({ onDataChange }) {
2927
2972
  enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
2928
2973
  outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
2929
2974
  });
2975
+ const micRef = (0, import_react11.useRef)(null);
2930
2976
  const webSocketRef = (0, import_react11.useRef)(null);
2931
2977
  const audioRef = (0, import_react11.useRef)(null);
2932
2978
  const reconnectTimeoutRef = (0, import_react11.useRef)(null);
@@ -2936,16 +2982,17 @@ function CallControls({ onDataChange }) {
2936
2982
  const baseReconnectDelay = 2e3;
2937
2983
  const maxReconnectDelay = 3e4;
2938
2984
  const [anchorEl, setAnchorEl] = (0, import_react11.useState)(null);
2939
- const [showIframe, setShowIframe] = (0, import_react11.useState)(true);
2940
2985
  const [statusAnchorEl, setStatusAnchorEl] = (0, import_react11.useState)(null);
2941
2986
  const [dialerAnchorEl, setDialerAnchorEl] = (0, import_react11.useState)(null);
2942
2987
  const [ambulanceAnchorEl, setAmbulanceAnchorEl] = (0, import_react11.useState)(null);
2988
+ const [showIframe, setShowIframe] = (0, import_react11.useState)(true);
2943
2989
  const [openCallDisposition, setOpenCallDisposition] = (0, import_react11.useState)(false);
2944
2990
  const [openProcessorDialog, setOpenProcessorDialog] = (0, import_react11.useState)(false);
2945
2991
  const [openCallHistoryDialog, setOpenCallHistoryDialog] = (0, import_react11.useState)(false);
2946
2992
  const [processList, setProcessList] = (0, import_react11.useState)(null);
2947
2993
  const [phoneNumber, setPhoneNumber] = (0, import_react11.useState)("");
2948
2994
  const [callDuration, setCallDuration] = (0, import_react11.useState)(0);
2995
+ const [callWrapuptime, setCallWrapuptime] = (0, import_react11.useState)(null);
2949
2996
  const { position, isDragging, dragRef, handleMouseDown, handleTouchStart } = useDraggable(
2950
2997
  state.controlPanelPosition,
2951
2998
  (newPosition) => sdkStateManager.setControlPanelPosition(newPosition)
@@ -2967,26 +3014,22 @@ function CallControls({ onDataChange }) {
2967
3014
  }
2968
3015
  });
2969
3016
  const [holdOrUnHold, { isLoading: holdOrUnHoldLoading }] = usePostRequest({
2970
- onSuccess: () => {
2971
- sdkStateManager.setHolding(!state.isHolding);
2972
- },
2973
- onError: (error) => {
2974
- console.log("\u274C Hold operation error:", error);
2975
- }
3017
+ // onSuccess: () => {
3018
+ // sdkStateManager.setHolding(!state.isHolding);
3019
+ // },
2976
3020
  });
2977
3021
  const [muteOrUnMute, { isLoading: muteOrUnMuteLoading }] = usePostRequest({
2978
- onSuccess: () => {
2979
- sdkStateManager.setMuted(!state.isMuted);
2980
- },
2981
- onError: (error) => {
2982
- console.log("\u274C Mute operation error:", error);
2983
- }
3022
+ // onSuccess: () => {
3023
+ // sdkStateManager.setMuted(!state.isMuted);
3024
+ // },
2984
3025
  });
2985
3026
  const [readyAgentStatus, { isLoading: agentReadyLoading }] = usePostRequest();
2986
3027
  const [updateAgentStatus, { isLoading }] = usePostRequest();
2987
3028
  const [sendNotification] = usePostRequest();
2988
3029
  const [endCall, { isLoading: endCallLoading }] = usePostRequest({
2989
3030
  onSuccess: () => {
3031
+ sdkStateManager.endCall();
3032
+ setOpenCallDisposition(false);
2990
3033
  sdkStateManager.resetConferenceLines();
2991
3034
  }
2992
3035
  });
@@ -2996,15 +3039,11 @@ function CallControls({ onDataChange }) {
2996
3039
  const handleOpenDialer = (event) => {
2997
3040
  setShowIframe(true);
2998
3041
  setDialerAnchorEl(event.currentTarget);
2999
- sdkStateManager.setStatus("dial");
3000
3042
  };
3001
3043
  const handleOpenAbulanceServices = (event) => {
3002
3044
  setAmbulanceAnchorEl(event.currentTarget);
3003
3045
  };
3004
3046
  const handleCloseDialer = () => {
3005
- if (state.status !== "on call") {
3006
- sdkStateManager.setStatus("idle");
3007
- }
3008
3047
  setDialerAnchorEl(null);
3009
3048
  };
3010
3049
  const handleCloseAmbulance = () => {
@@ -3049,7 +3088,7 @@ function CallControls({ onDataChange }) {
3049
3088
  const handleHoldToggle = () => {
3050
3089
  var _a3;
3051
3090
  const payload = {
3052
- action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" : "HOLD",
3091
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" /* UNHOLD */ : "HOLD" /* HOLD */,
3053
3092
  userId: state.agentId
3054
3093
  };
3055
3094
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
@@ -3057,13 +3096,13 @@ function CallControls({ onDataChange }) {
3057
3096
  const handleMuteToggle = () => {
3058
3097
  var _a3;
3059
3098
  const payload = {
3060
- action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" : "MUTE",
3099
+ action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" /* UNMUTE */ : "MUTE" /* MUTE */,
3061
3100
  userId: state.agentId
3062
3101
  };
3063
3102
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
3064
3103
  };
3065
3104
  const handleEndCall = (data) => {
3066
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
3105
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
3067
3106
  const payload = {
3068
3107
  action: "ENDCALL",
3069
3108
  userId: state.agentId,
@@ -3079,9 +3118,11 @@ function CallControls({ onDataChange }) {
3079
3118
  endcall_type: "CLOSE"
3080
3119
  };
3081
3120
  setPhoneNumber("");
3082
- endCall(END_POINT.END_CALL, payload);
3083
- sdkStateManager.endCall();
3084
- setOpenCallDisposition(false);
3121
+ endCall(END_POINT.END_CALL, payload, {
3122
+ params: {
3123
+ isBreak: (_q2 = data == null ? void 0 : data.selected_break) != null ? _q2 : false
3124
+ }
3125
+ });
3085
3126
  };
3086
3127
  (0, import_react11.useEffect)(() => {
3087
3128
  const handleBeforeUnload = (e) => {
@@ -3093,17 +3134,23 @@ function CallControls({ onDataChange }) {
3093
3134
  };
3094
3135
  }, []);
3095
3136
  (0, import_react11.useEffect)(() => {
3137
+ const mic = createMicController();
3138
+ micRef.current = mic;
3139
+ mic.start().catch((err) => {
3140
+ console.error("Failed to start mic:", err);
3141
+ });
3096
3142
  const handleKeyDown = (event) => {
3097
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2;
3098
- const fullState = JSON.parse((_a3 = localStorage.getItem("call-control-sdk-state")) != null ? _a3 : "");
3099
- const key = (_b2 = event.key) == null ? void 0 : _b2.toLowerCase();
3100
- if (!event.altKey || ((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.status) !== "ONCALL") {
3143
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
3144
+ const fullState = (0, import_vault5.getItem)(STORAGE_KEY);
3145
+ const key = (_a3 = event.key) == null ? void 0 : _a3.toLowerCase();
3146
+ if (!event.altKey || ((_b2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _b2.status) !== "ONCALL" /* ONCALL */) {
3101
3147
  return;
3102
3148
  }
3103
- if (key === "m" && String((_d2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _d2.mute) === "0") {
3149
+ if (key === "m" && String((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.mute) === "0") {
3104
3150
  event.preventDefault();
3151
+ (_d2 = micRef.current) == null ? void 0 : _d2.mute();
3105
3152
  const payload = {
3106
- action: "MUTE",
3153
+ action: "MUTE" /* MUTE */,
3107
3154
  userId: fullState.agentId
3108
3155
  };
3109
3156
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
@@ -3111,23 +3158,24 @@ function CallControls({ onDataChange }) {
3111
3158
  if (key === "u" && String((_e2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _e2.mute) === "1") {
3112
3159
  event.preventDefault();
3113
3160
  const payload = {
3114
- action: "UNMUTE",
3161
+ action: "UNMUTE" /* UNMUTE */,
3115
3162
  userId: fullState.agentId
3116
3163
  };
3117
3164
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
3165
+ (_f2 = micRef.current) == null ? void 0 : _f2.unmute();
3118
3166
  }
3119
- if (key === "h" && String((_f2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _f2.hold) === "0") {
3167
+ if (key === "h" && String((_g2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _g2.hold) === "0") {
3120
3168
  event.preventDefault();
3121
3169
  const payload = {
3122
- action: "HOLD",
3170
+ action: "HOLD" /* HOLD */,
3123
3171
  userId: fullState.agentId
3124
3172
  };
3125
3173
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
3126
3174
  }
3127
- if (key === "r" && String((_g2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _g2.hold) === "1") {
3175
+ if (key === "r" && String((_h2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _h2.hold) === "1") {
3128
3176
  event.preventDefault();
3129
3177
  const payload = {
3130
- action: "UNHOLD",
3178
+ action: "UNHOLD" /* UNHOLD */,
3131
3179
  userId: fullState.agentId
3132
3180
  };
3133
3181
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
@@ -3140,7 +3188,8 @@ function CallControls({ onDataChange }) {
3140
3188
  }, []);
3141
3189
  (0, import_react11.useEffect)(() => {
3142
3190
  let interval;
3143
- if (state.callData.status && state.callData.status === "ONCALL") {
3191
+ let wrapUpinterval;
3192
+ if (state.callData.status && state.callData.status === "ONCALL" /* ONCALL */) {
3144
3193
  interval = setInterval(() => {
3145
3194
  const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
3146
3195
  setCallDuration(elapsed);
@@ -3148,8 +3197,28 @@ function CallControls({ onDataChange }) {
3148
3197
  } else {
3149
3198
  setCallDuration(0);
3150
3199
  }
3200
+ if (state.callData.status && state.callData.status === "WRAPUP" /* WRAPUP */ && callWrapuptime !== null) {
3201
+ wrapUpinterval = setInterval(() => {
3202
+ setCallWrapuptime((prevTime) => {
3203
+ if (prevTime === null || prevTime <= 1) {
3204
+ clearInterval(wrapUpinterval);
3205
+ handleEndCall({
3206
+ disposition: { label: "Resolved", value: "RES" },
3207
+ followUp: { label: "No", value: "N" },
3208
+ callbackDate: "",
3209
+ callbackHrs: "",
3210
+ callbackMins: "",
3211
+ selected_break: false
3212
+ });
3213
+ return null;
3214
+ }
3215
+ return prevTime - 1;
3216
+ });
3217
+ }, 1e3);
3218
+ }
3151
3219
  return () => {
3152
3220
  if (interval) clearInterval(interval);
3221
+ if (wrapUpinterval) clearInterval(wrapUpinterval);
3153
3222
  };
3154
3223
  }, [state.callData.status]);
3155
3224
  (0, import_react11.useEffect)(() => {
@@ -3200,13 +3269,10 @@ function CallControls({ onDataChange }) {
3200
3269
  }).catch((err) => {
3201
3270
  showToast(err.response.data.message, "error");
3202
3271
  });
3203
- } else {
3204
- console.log("No agentId available, skipping API call");
3205
3272
  }
3206
3273
  }, [state.agentId]);
3207
3274
  const connectWebSocket = () => {
3208
3275
  if (!state.agentId) {
3209
- console.log("No agentId available, cannot connect WebSocket");
3210
3276
  return;
3211
3277
  }
3212
3278
  if (reconnectTimeoutRef.current) {
@@ -3225,7 +3291,6 @@ function CallControls({ onDataChange }) {
3225
3291
  if (webSocketRef.current && webSocketRef.current.readyState === WebSocket.OPEN) {
3226
3292
  try {
3227
3293
  webSocketRef.current.send(JSON.stringify({ type: "ping" }));
3228
- console.log("\u{1F4E1} WebSocket ping sent");
3229
3294
  } catch (error) {
3230
3295
  console.error("Failed to send ping:", error);
3231
3296
  }
@@ -3233,71 +3298,88 @@ function CallControls({ onDataChange }) {
3233
3298
  }, 3e4);
3234
3299
  };
3235
3300
  webSocketRef.current.onmessage = (event) => {
3301
+ var _a3, _b2;
3236
3302
  try {
3237
3303
  const data = JSON.parse(event.data);
3238
3304
  if (data.type === "pong") {
3239
- console.log("\u{1F4E1} WebSocket pong received");
3240
3305
  return;
3241
3306
  }
3242
- const rls = localStorage.getItem("call-control-sdk-state");
3243
- const confrence = getCombineConfrenceData(JSON.parse(rls || "{}"), data);
3244
- sdkStateManager.updateCallData(data);
3307
+ const sdkState = (0, import_vault5.getItem)(STORAGE_KEY);
3308
+ const confrence = getCombineConfrenceData(sdkState, data);
3309
+ const callData = {
3310
+ "agent_id": data == null ? void 0 : data.agent_id,
3311
+ "status": data == null ? void 0 : data.status,
3312
+ "type": data == null ? void 0 : data.type,
3313
+ "event_time": data == null ? void 0 : data.event_time,
3314
+ "phone_number": data == null ? void 0 : data.phone_number,
3315
+ "convox_id": data == null ? void 0 : data.convox_id,
3316
+ "process_id": data == null ? void 0 : data.process_id,
3317
+ "process_name": data == null ? void 0 : data.process_name,
3318
+ "hold": data == null ? void 0 : data.hold,
3319
+ "mute": data == null ? void 0 : data.mute,
3320
+ "mode": data == null ? void 0 : data.mode,
3321
+ "queue_name": data == null ? void 0 : data.queue_name
3322
+ };
3323
+ sdkStateManager.updateCallData(callData);
3245
3324
  sdkStateManager.updateConferenceData([...confrence]);
3246
- if ((data.status === "RINGING" || data.status === "DIALING") && (data == null ? void 0 : data.mode) !== "manual") {
3325
+ if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
3247
3326
  setShowIframe(true);
3248
- sdkStateManager.updateConferenceData([
3249
- {
3250
- line: 1,
3251
- status: "IDLE",
3252
- type: "",
3253
- phone: "",
3254
- isMute: false,
3255
- isHold: false,
3256
- isCallStart: false,
3257
- isMergeCall: false
3258
- },
3259
- {
3260
- line: 2,
3261
- status: "IDLE",
3262
- type: "",
3263
- phone: "",
3264
- isMute: false,
3265
- isHold: false,
3266
- isCallStart: false,
3267
- isMergeCall: false
3268
- },
3269
- {
3270
- line: 3,
3271
- status: "IDLE",
3272
- type: "",
3273
- phone: "",
3274
- isMute: false,
3275
- isHold: false,
3276
- isCallStart: false,
3277
- isMergeCall: false
3278
- },
3279
- {
3280
- line: 4,
3281
- status: "IDLE",
3282
- type: "",
3283
- phone: "",
3284
- isMute: false,
3285
- isHold: false,
3286
- isCallStart: false,
3287
- isMergeCall: false
3288
- },
3289
- {
3290
- line: 5,
3291
- status: "IDLE",
3292
- type: "",
3293
- phone: "",
3294
- isMute: false,
3295
- isHold: false,
3296
- isCallStart: false,
3297
- isMergeCall: false
3298
- }
3299
- ]);
3300
- if (audioRef.current) {
3327
+ setCallWrapuptime((_b2 = (_a3 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _a3.auto_wrapup_time) != null ? _b2 : null);
3328
+ sdkStateManager.updateConferenceData(
3329
+ [
3330
+ {
3331
+ line: 1,
3332
+ status: "IDLE",
3333
+ type: "",
3334
+ phone: "",
3335
+ isMute: false,
3336
+ isHold: false,
3337
+ isCallStart: false,
3338
+ isMergeCall: false
3339
+ },
3340
+ {
3341
+ line: 2,
3342
+ status: "IDLE",
3343
+ type: "",
3344
+ phone: "",
3345
+ isMute: false,
3346
+ isHold: false,
3347
+ isCallStart: false,
3348
+ isMergeCall: false
3349
+ },
3350
+ {
3351
+ line: 3,
3352
+ status: "IDLE",
3353
+ type: "",
3354
+ phone: "",
3355
+ isMute: false,
3356
+ isHold: false,
3357
+ isCallStart: false,
3358
+ isMergeCall: false
3359
+ },
3360
+ {
3361
+ line: 4,
3362
+ status: "IDLE",
3363
+ type: "",
3364
+ phone: "",
3365
+ isMute: false,
3366
+ isHold: false,
3367
+ isCallStart: false,
3368
+ isMergeCall: false
3369
+ },
3370
+ {
3371
+ line: 5,
3372
+ status: "IDLE",
3373
+ type: "",
3374
+ phone: "",
3375
+ isMute: false,
3376
+ isHold: false,
3377
+ isCallStart: false,
3378
+ isMergeCall: false
3379
+ }
3380
+ ]
3381
+ );
3382
+ if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current) {
3301
3383
  audioRef.current.play().catch((error) => {
3302
3384
  console.error("Failed to play ringtone:", error);
3303
3385
  });
@@ -3308,21 +3390,20 @@ function CallControls({ onDataChange }) {
3308
3390
  audioRef.current.currentTime = 0;
3309
3391
  }
3310
3392
  }
3311
- if (data.status === "ONCALL") {
3393
+ if (data.status === "ONCALL" /* ONCALL */) {
3312
3394
  sdkStateManager.startCall();
3313
3395
  if (!showIframe) {
3314
3396
  setShowIframe(true);
3315
3397
  }
3316
3398
  }
3317
- if (data.status === "WRAPUP") {
3399
+ if (data.status === "WRAPUP" /* WRAPUP */) {
3318
3400
  sdkStateManager.endCall();
3319
3401
  }
3320
3402
  } catch (e) {
3321
- console.log("\u{1F4E8} Raw message:", event.data);
3403
+ console.error("\u{1F4E8} Raw message:", event.data);
3322
3404
  }
3323
3405
  };
3324
3406
  webSocketRef.current.onclose = (event) => {
3325
- console.log("\u{1F50C} WebSocket connection closed", event.code, event.reason);
3326
3407
  if (pingIntervalRef.current) {
3327
3408
  clearInterval(pingIntervalRef.current);
3328
3409
  pingIntervalRef.current = null;
@@ -3333,14 +3414,13 @@ function CallControls({ onDataChange }) {
3333
3414
  baseReconnectDelay * Math.pow(2, reconnectAttemptsRef.current - 1),
3334
3415
  maxReconnectDelay
3335
3416
  );
3336
- console.log(
3417
+ console.warn(
3337
3418
  `\u{1F504} Attempting to reconnect WebSocket (attempt ${reconnectAttemptsRef.current}/${maxReconnectAttempts}) in ${delay}ms`
3338
3419
  );
3339
3420
  reconnectTimeoutRef.current = setTimeout(() => {
3340
3421
  connectWebSocket();
3341
3422
  }, delay);
3342
3423
  } else if (reconnectAttemptsRef.current >= maxReconnectAttempts) {
3343
- console.error("\u274C Maximum reconnection attempts reached. Please refresh the page.");
3344
3424
  showToast("WebSocket connection failed. Please refresh the page.", "error");
3345
3425
  }
3346
3426
  };
@@ -3348,7 +3428,6 @@ function CallControls({ onDataChange }) {
3348
3428
  console.error("\u274C WebSocket error:", error);
3349
3429
  };
3350
3430
  } catch (error) {
3351
- console.error("\u274C Failed to create WebSocket:", error);
3352
3431
  if (reconnectAttemptsRef.current < maxReconnectAttempts) {
3353
3432
  reconnectAttemptsRef.current += 1;
3354
3433
  const delay = Math.min(
@@ -3464,32 +3543,29 @@ function CallControls({ onDataChange }) {
3464
3543
  }
3465
3544
  ),
3466
3545
  ((_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__ */ (0, import_jsx_runtime3.jsx)(import_material4.Chip, { label: (_n = state == null ? void 0 : state.callData) == null ? void 0 : _n.queue_name }),
3467
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { children: !((_o = state.sdkConfig) == null ? void 0 : _o.disabledDialButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Dial", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3546
+ !((_o = state.sdkConfig) == null ? void 0 : _o.disabledDialButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Dial", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3468
3547
  import_material4.IconButton,
3469
3548
  {
3470
3549
  size: "small",
3471
3550
  onClick: (e) => {
3472
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
3473
- 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") {
3551
+ var _a3, _b2;
3552
+ if (!["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(
3553
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3554
+ )) {
3474
3555
  handleOpenDialer(e);
3475
3556
  }
3476
3557
  },
3477
- sx: {
3478
- bgcolor: "action.hover",
3479
- "&:hover": {
3480
- bgcolor: "warning"
3481
- }
3482
- },
3558
+ disabled: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()),
3483
3559
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3484
3560
  import_icons_material2.WifiCalling3,
3485
3561
  {
3486
3562
  sx: {
3487
- 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"
3563
+ color: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()) ? "action.selected" : "success.main"
3488
3564
  }
3489
3565
  }
3490
3566
  )
3491
3567
  }
3492
- ) }) }),
3568
+ ) }),
3493
3569
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { onClick: () => setShowIframe(true), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3494
3570
  import_material4.Typography,
3495
3571
  {
@@ -3501,7 +3577,7 @@ function CallControls({ onDataChange }) {
3501
3577
  fontWeight: "600",
3502
3578
  cursor: "pointer"
3503
3579
  },
3504
- children: formatDuration(callDuration)
3580
+ children: state.callData.status === "WRAPUP" /* WRAPUP */ && callWrapuptime !== null ? formatDuration(callWrapuptime) : formatDuration(callDuration)
3505
3581
  }
3506
3582
  ) }),
3507
3583
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -3531,7 +3607,7 @@ function CallControls({ onDataChange }) {
3531
3607
  width: "60px",
3532
3608
  textAlign: "center"
3533
3609
  },
3534
- children: (_z = (_y = (_x = state.callData) == null ? void 0 : _x.status) == null ? void 0 : _y.toUpperCase()) != null ? _z : "N/A"
3610
+ children: (_r = (_q = (_p = state.callData) == null ? void 0 : _p.status) == null ? void 0 : _q.toUpperCase()) != null ? _r : "N/A"
3535
3611
  }
3536
3612
  ),
3537
3613
  onClick: handleOpenAgentStatus,
@@ -3555,32 +3631,32 @@ function CallControls({ onDataChange }) {
3555
3631
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Agent Ready", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3556
3632
  import_material4.Button,
3557
3633
  {
3558
- 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",
3634
+ variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_t = (_s = state.callData) == null ? void 0 : _s.status) == null ? void 0 : _t.toUpperCase()) ? "outlined" : "contained",
3559
3635
  onClick: (e) => {
3560
- var _a3, _b2, _c2, _d2;
3561
- 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") {
3636
+ var _a3, _b2;
3637
+ if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3562
3638
  e.stopPropagation();
3563
3639
  handleAgentReady();
3564
3640
  }
3565
3641
  },
3566
3642
  classes: {
3567
- 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"
3643
+ root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_v = (_u = state.callData) == null ? void 0 : _u.status) == null ? void 0 : _v.toUpperCase()) ? "outlined" : "enabled"
3568
3644
  },
3569
- 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),
3645
+ sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_x = (_w = state.callData) == null ? void 0 : _w.status) == null ? void 0 : _x.toUpperCase()) ? outlined : enabled),
3570
3646
  disabled: agentReadyLoading,
3571
3647
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SupportAgent, {})
3572
3648
  }
3573
3649
  ) }),
3574
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_M = state.callData) == null ? void 0 : _M.hold) === 1 ? "Resume" : "Hold", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3650
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_y = state.callData) == null ? void 0 : _y.hold) === 1 ? "Resume" : "Hold", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3575
3651
  import_material4.Button,
3576
3652
  {
3577
- 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",
3653
+ 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",
3578
3654
  onClick: (e) => {
3579
3655
  e.stopPropagation();
3580
3656
  handleHoldToggle();
3581
3657
  },
3582
- 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),
3583
- 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,
3658
+ 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),
3659
+ 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,
3584
3660
  children: holdOrUnHoldLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3585
3661
  import_material4.CircularProgress,
3586
3662
  {
@@ -3589,19 +3665,19 @@ function CallControls({ onDataChange }) {
3589
3665
  color: theme.palette.primary.main
3590
3666
  }
3591
3667
  }
3592
- ) : ((_Y = state.callData) == null ? void 0 : _Y.hold) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Pause, {})
3668
+ ) : ((_K = state.callData) == null ? void 0 : _K.hold) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Pause, {})
3593
3669
  }
3594
3670
  ) }),
3595
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_Z = state.callData) == null ? void 0 : _Z.mute) === 1 ? "Unmute" : "Mute", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3671
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_L = state.callData) == null ? void 0 : _L.mute) === 1 ? "Unmute" : "Mute", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3596
3672
  import_material4.Button,
3597
3673
  {
3598
- variant: ((__ = state.callData) == null ? void 0 : __.mute) === 1 && ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" ? "contained" : "outlined",
3674
+ 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",
3599
3675
  onClick: (e) => {
3600
3676
  e.stopPropagation();
3601
3677
  handleMuteToggle();
3602
3678
  },
3603
- 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),
3604
- 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,
3679
+ 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),
3680
+ 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,
3605
3681
  children: muteOrUnMuteLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3606
3682
  import_material4.CircularProgress,
3607
3683
  {
@@ -3610,69 +3686,93 @@ function CallControls({ onDataChange }) {
3610
3686
  color: theme.palette.primary.main
3611
3687
  }
3612
3688
  }
3613
- ) : ((_la = state.callData) == null ? void 0 : _la.mute) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Mic, {})
3689
+ ) : ((_Z = state.callData) == null ? void 0 : _Z.mute) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Mic, {})
3614
3690
  }
3615
3691
  ) }),
3616
- !((_ma = state.sdkConfig) == null ? void 0 : _ma.disableCallTransferButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Transfer Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3692
+ !((__ = state.sdkConfig) == null ? void 0 : __.disableCallTransferButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Transfer Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3617
3693
  import_material4.Button,
3618
3694
  {
3619
3695
  variant: state.openCallTransferDialog ? "contained" : "outlined",
3620
3696
  onClick: (e) => {
3621
3697
  var _a3, _b2;
3622
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
3698
+ if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */) {
3623
3699
  e.stopPropagation();
3624
3700
  sdkStateManager.setOpenCallTransferDialog(true);
3625
3701
  }
3626
3702
  },
3627
- sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((_oa = (_na = state.callData) == null ? void 0 : _na.status) == null ? void 0 : _oa.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3628
- disabled: ((_qa = (_pa = state.callData) == null ? void 0 : _pa.status) == null ? void 0 : _qa.toUpperCase()) !== "ONCALL",
3703
+ sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3704
+ disabled: ((_ca = (_ba = state.callData) == null ? void 0 : _ba.status) == null ? void 0 : _ca.toUpperCase()) !== "ONCALL" /* ONCALL */,
3629
3705
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {})
3630
3706
  }
3631
3707
  ) }),
3632
- !((_ra = state.sdkConfig) == null ? void 0 : _ra.disableConferenceButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3708
+ !((_da = state.sdkConfig) == null ? void 0 : _da.disableConferenceButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3633
3709
  import_material4.Button,
3634
3710
  {
3635
3711
  variant: state.openConferenceDialog ? "contained" : "outlined",
3636
3712
  onClick: (e) => {
3637
3713
  var _a3, _b2;
3638
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
3714
+ if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */) {
3639
3715
  e.stopPropagation();
3640
3716
  sdkStateManager.setOpenConferenceDialog(true);
3641
3717
  }
3642
3718
  },
3643
- sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3644
- disabled: ((_va = (_ua = state.callData) == null ? void 0 : _ua.status) == null ? void 0 : _va.toUpperCase()) !== "ONCALL",
3719
+ 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),
3720
+ disabled: ((_ha = (_ga = state.callData) == null ? void 0 : _ga.status) == null ? void 0 : _ha.toUpperCase()) !== "ONCALL" /* ONCALL */,
3645
3721
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Group, {})
3646
3722
  }
3647
3723
  ) }),
3648
- ((_wa = state.sdkConfig) == null ? void 0 : _wa.enableSmsServices) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Send SMS", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3724
+ ((_ia = state.sdkConfig) == null ? void 0 : _ia.enableSmsServices) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Send SMS", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3649
3725
  import_material4.Button,
3650
3726
  {
3651
3727
  variant: Boolean(ambulanceAnchorEl) ? "contained" : "outlined",
3652
3728
  onClick: (e) => {
3653
- var _a3, _b2, _c2, _d2;
3654
- 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") {
3729
+ var _a3, _b2;
3730
+ if ([
3731
+ "ONCALL" /* ONCALL */,
3732
+ "WRAPUP" /* WRAPUP */
3733
+ ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3655
3734
  e.stopPropagation();
3656
3735
  handleOpenAbulanceServices(e);
3657
3736
  }
3658
3737
  },
3659
- 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),
3660
- 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",
3738
+ sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : [
3739
+ "ONCALL" /* ONCALL */,
3740
+ "WRAPUP" /* WRAPUP */
3741
+ ].includes((_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3742
+ disabled: ![
3743
+ "ONCALL" /* ONCALL */,
3744
+ "WRAPUP" /* WRAPUP */
3745
+ ].includes((_ma = (_la = state.callData) == null ? void 0 : _la.status) == null ? void 0 : _ma.toUpperCase()),
3661
3746
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SmsSharp, {})
3662
3747
  }
3663
3748
  ) }),
3664
- !((_Fa = state.sdkConfig) == null ? void 0 : _Fa.disableEndCallButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3749
+ !((_na = state.sdkConfig) == null ? void 0 : _na.disableEndCallButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3665
3750
  import_material4.Button,
3666
3751
  {
3667
- 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",
3752
+ variant: [
3753
+ "ONCALL" /* ONCALL */,
3754
+ "RINGING" /* RINGING */,
3755
+ "DIALING" /* DIALING */,
3756
+ "WRAPUP" /* WRAPUP */
3757
+ ].includes((_pa = (_oa = state.callData) == null ? void 0 : _oa.status) == null ? void 0 : _pa.toUpperCase()) ? "contained" : "outlined",
3668
3758
  onClick: (e) => {
3669
- var _a3, _b2, _c2, _d2, _e2, _f2;
3670
- 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") {
3759
+ var _a3, _b2;
3760
+ if ([
3761
+ "ONCALL" /* ONCALL */,
3762
+ "RINGING" /* RINGING */,
3763
+ "DIALING" /* DIALING */,
3764
+ "WRAPUP" /* WRAPUP */
3765
+ ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3671
3766
  e.stopPropagation();
3672
3767
  setOpenCallDisposition(true);
3673
3768
  }
3674
3769
  },
3675
- 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), {
3770
+ sx: [
3771
+ "ONCALL" /* ONCALL */,
3772
+ "RINGING" /* RINGING */,
3773
+ "DIALING" /* DIALING */,
3774
+ "WRAPUP" /* WRAPUP */
3775
+ ].includes((_ra = (_qa = state.callData) == null ? void 0 : _qa.status) == null ? void 0 : _ra.toUpperCase()) ? __spreadProps(__spreadValues({}, enabled), {
3676
3776
  borderRight: "1px",
3677
3777
  backgroundColor: "error.main",
3678
3778
  minWidth: "60px !important",
@@ -3691,7 +3791,12 @@ function CallControls({ onDataChange }) {
3691
3791
  }) : __spreadProps(__spreadValues({}, disabled), {
3692
3792
  minWidth: "60px !important"
3693
3793
  }),
3694
- 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,
3794
+ disabled: ![
3795
+ "ONCALL" /* ONCALL */,
3796
+ "RINGING" /* RINGING */,
3797
+ "DIALING" /* DIALING */,
3798
+ "WRAPUP" /* WRAPUP */
3799
+ ].includes((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) || endCallLoading,
3695
3800
  children: endCallLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3696
3801
  import_material4.CircularProgress,
3697
3802
  {
@@ -3731,7 +3836,7 @@ function CallControls({ onDataChange }) {
3731
3836
  transition: theme.transitions.create(["box-shadow", "transform"], {
3732
3837
  duration: theme.transitions.duration.short
3733
3838
  }),
3734
- visibility: showIframe && !((_Ya = state.sdkConfig) == null ? void 0 : _Ya.disableSoftPhone) ? "visible" : "hidden",
3839
+ visibility: showIframe && !((_ua = state.sdkConfig) == null ? void 0 : _ua.disableSoftPhone) ? "visible" : "hidden",
3735
3840
  userSelect: "none"
3736
3841
  },
3737
3842
  children: [
@@ -3765,7 +3870,7 @@ function CallControls({ onDataChange }) {
3765
3870
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3766
3871
  "iframe",
3767
3872
  {
3768
- src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_Za = state.process) == null ? void 0 : _Za.process_id}`,
3873
+ src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_va = state.process) == null ? void 0 : _va.process_id}`,
3769
3874
  height: 380,
3770
3875
  width: 420,
3771
3876
  allow: "camera; microphone; autoplay",
@@ -4050,24 +4155,27 @@ async function initSDK({
4050
4155
  agentId: agentId.trim(),
4051
4156
  baseUrl: BASE_URL
4052
4157
  });
4158
+ const res = {
4159
+ accessToken: initResult == null ? void 0 : initResult.accessToken,
4160
+ expiration: initResult == null ? void 0 : initResult.expiration,
4161
+ ticketId: initResult == null ? void 0 : initResult.ticketId
4162
+ };
4053
4163
  if (initResult) {
4054
- console.log("SDK initialized successfully");
4164
+ console.info("SDK initialized successfully");
4055
4165
  sdkStateManager.initialize(
4056
4166
  apiKey.trim(),
4057
4167
  tenantId.trim(),
4058
4168
  agentId.trim(),
4059
- sdkConfig,
4060
- initResult
4169
+ __spreadValues(__spreadValues({}, initResult == null ? void 0 : initResult.call_controls), sdkConfig),
4170
+ res
4061
4171
  );
4062
4172
  } else {
4063
- console.error("SDK initialization failed: Event tracker initialization returned false");
4064
4173
  sdkStateManager.setInitCheck();
4065
4174
  throw new Error(
4066
4175
  "SDK initialization failed: Unable to establish connection with the CTI system"
4067
4176
  );
4068
4177
  }
4069
4178
  } catch (error) {
4070
- console.error("SDK initialization error:", error);
4071
4179
  sdkStateManager.setInitCheck();
4072
4180
  if (error instanceof Error) {
4073
4181
  throw error;