call-control-sdk 4.1.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -49,17 +49,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
49
49
  var index_exports = {};
50
50
  __export(index_exports, {
51
51
  CallControlPanel: () => CallControlPanel,
52
- initSDK: () => initSDK
52
+ initSDK: () => initSDK,
53
+ useLogout: () => useLogout_default
53
54
  });
54
55
  module.exports = __toCommonJS(index_exports);
55
56
 
56
57
  // call-control-sdk/lib/components/callControlPanel.tsx
57
- var import_react6 = require("react");
58
- var import_material3 = require("@mui/material");
59
58
  var import_icons_material2 = require("@mui/icons-material");
60
-
61
- // call-control-sdk/lib/hooks/useSDKState.ts
62
- var import_react = require("react");
59
+ var import_material4 = require("@mui/material");
60
+ var import_react6 = require("react");
63
61
 
64
62
  // call-control-sdk/lib/hooks/sdk-state.ts
65
63
  var SDKStateManager = class {
@@ -73,6 +71,7 @@ var SDKStateManager = class {
73
71
  getInitialState() {
74
72
  return {
75
73
  apiKey: null,
74
+ process: null,
76
75
  agentId: "",
77
76
  isInitialized: false,
78
77
  isHolding: false,
@@ -82,9 +81,11 @@ var SDKStateManager = class {
82
81
  controlPanelPosition: { x: 10, y: 10 },
83
82
  iframePosition: { x: 10, y: 80 },
84
83
  callData: {
85
- mobileNumber: "",
86
- callReferenceId: "",
87
- agentLoginId: ""
84
+ agent_id: "",
85
+ status: "",
86
+ type: "",
87
+ event_time: "",
88
+ phone_number: ""
88
89
  },
89
90
  conferenceLine: [
90
91
  {
@@ -94,7 +95,8 @@ var SDKStateManager = class {
94
95
  phone: "",
95
96
  isMute: false,
96
97
  isHold: false,
97
- isCallStart: false
98
+ isCallStart: false,
99
+ isMergeCall: false
98
100
  },
99
101
  {
100
102
  line: 2,
@@ -103,7 +105,8 @@ var SDKStateManager = class {
103
105
  phone: "",
104
106
  isMute: false,
105
107
  isHold: false,
106
- isCallStart: false
108
+ isCallStart: false,
109
+ isMergeCall: false
107
110
  },
108
111
  {
109
112
  line: 3,
@@ -112,7 +115,8 @@ var SDKStateManager = class {
112
115
  phone: "",
113
116
  isMute: false,
114
117
  isHold: false,
115
- isCallStart: false
118
+ isCallStart: false,
119
+ isMergeCall: false
116
120
  },
117
121
  {
118
122
  line: 4,
@@ -121,7 +125,8 @@ var SDKStateManager = class {
121
125
  phone: "",
122
126
  isMute: false,
123
127
  isHold: false,
124
- isCallStart: false
128
+ isCallStart: false,
129
+ isMergeCall: false
125
130
  },
126
131
  {
127
132
  line: 5,
@@ -130,7 +135,8 @@ var SDKStateManager = class {
130
135
  phone: "",
131
136
  isMute: false,
132
137
  isHold: false,
133
- isCallStart: false
138
+ isCallStart: false,
139
+ isMergeCall: false
134
140
  }
135
141
  ]
136
142
  };
@@ -143,6 +149,7 @@ var SDKStateManager = class {
143
149
  this.state = __spreadProps(__spreadValues({}, this.state), {
144
150
  apiKey: parsedState.apiKey || "",
145
151
  agentId: parsedState.agentId || "",
152
+ process: parsedState.process || null,
146
153
  isInitialized: parsedState.isInitialized || false,
147
154
  isHolding: parsedState.isHolding || false,
148
155
  isMuted: parsedState.isMuted || false,
@@ -158,7 +165,8 @@ var SDKStateManager = class {
158
165
  callReferenceId: "",
159
166
  agentLoginId: ""
160
167
  },
161
- conferenceLine: parsedState.conferenceLine || []
168
+ // Fix: Properly handle conferenceLine with fallback to initial state
169
+ conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine
162
170
  });
163
171
  }
164
172
  } catch (error) {
@@ -170,6 +178,7 @@ var SDKStateManager = class {
170
178
  const persistentState = {
171
179
  apiKey: this.state.apiKey,
172
180
  agentId: this.state.agentId,
181
+ process: this.state.process,
173
182
  isInitialized: this.state.isInitialized,
174
183
  isHolding: this.state.isHolding,
175
184
  isMuted: this.state.isMuted,
@@ -225,6 +234,11 @@ var SDKStateManager = class {
225
234
  this.saveToStorage();
226
235
  this.notifyListeners();
227
236
  }
237
+ setProcess(process) {
238
+ this.state.process = process;
239
+ this.saveToStorage();
240
+ this.notifyListeners();
241
+ }
228
242
  setControlPanelPosition(position) {
229
243
  this.state.controlPanelPosition = position;
230
244
  this.saveToStorage();
@@ -251,46 +265,67 @@ var SDKStateManager = class {
251
265
  }
252
266
  updateCallData(data) {
253
267
  this.state.callData = __spreadValues(__spreadValues({}, this.state.callData), data);
268
+ this.saveToStorage();
254
269
  this.notifyListeners();
255
270
  }
256
271
  setConferenceLine(line) {
257
272
  var _a;
258
- const conferenceLineData = (_a = this.state.conferenceLine) == null ? void 0 : _a.map(
259
- (each) => {
260
- if (each.line === line.line) {
261
- return line;
262
- }
263
- return each;
273
+ if (!this.state.conferenceLine || !Array.isArray(this.state.conferenceLine)) {
274
+ console.warn("Conference line data corrupted, resetting to initial state");
275
+ this.state.conferenceLine = this.getInitialState().conferenceLine;
276
+ }
277
+ const conferenceLineData = (_a = this.state.conferenceLine) == null ? void 0 : _a.map((each) => {
278
+ if (each.line === line.line) {
279
+ return line;
264
280
  }
265
- );
281
+ return each;
282
+ });
266
283
  this.state.conferenceLine = conferenceLineData;
267
284
  this.saveToStorage();
268
285
  this.notifyListeners();
269
286
  }
287
+ resetConferenceLines() {
288
+ this.state.conferenceLine = this.getInitialState().conferenceLine;
289
+ this.saveToStorage();
290
+ this.notifyListeners();
291
+ }
292
+ clearStorageAndReset() {
293
+ try {
294
+ localStorage.removeItem(this.STORAGE_KEY);
295
+ this.state = this.getInitialState();
296
+ this.notifyListeners();
297
+ } catch (error) {
298
+ console.warn("Failed to clear localStorage:", error);
299
+ }
300
+ }
301
+ // Debug methods
302
+ debugStorage() {
303
+ try {
304
+ const stored = localStorage.getItem(this.STORAGE_KEY);
305
+ console.log("Current localStorage data:", stored);
306
+ if (stored) {
307
+ console.log("Parsed localStorage data:", JSON.parse(stored));
308
+ }
309
+ console.log("Current state:", this.state);
310
+ } catch (error) {
311
+ console.error("Error debugging storage:", error);
312
+ }
313
+ }
314
+ getConferenceLines() {
315
+ return this.state.conferenceLine || [];
316
+ }
270
317
  };
271
318
  var sdkStateManager = new SDKStateManager();
272
319
 
273
- // call-control-sdk/lib/hooks/useSDKState.ts
274
- function useSDKState() {
275
- const [state, setState] = (0, import_react.useState)(sdkStateManager.getState());
276
- (0, import_react.useEffect)(() => {
277
- const unsubscribe = sdkStateManager.subscribe(() => {
278
- setState(sdkStateManager.getState());
279
- });
280
- return unsubscribe;
281
- }, []);
282
- return state;
283
- }
284
-
285
320
  // call-control-sdk/lib/hooks/useDraggable.ts
286
- var import_react2 = require("react");
321
+ var import_react = require("react");
287
322
  function useDraggable(initialPosition, onPositionChange) {
288
- const [position, setPosition] = (0, import_react2.useState)(initialPosition);
289
- const [isDragging, setIsDragging] = (0, import_react2.useState)(false);
290
- const dragRef = (0, import_react2.useRef)(null);
291
- const dragStart = (0, import_react2.useRef)({ x: 0, y: 0 });
292
- const elementStart = (0, import_react2.useRef)({ x: 0, y: 0 });
293
- const updatePosition = (0, import_react2.useCallback)(
323
+ const [position, setPosition] = (0, import_react.useState)(initialPosition);
324
+ const [isDragging, setIsDragging] = (0, import_react.useState)(false);
325
+ const dragRef = (0, import_react.useRef)();
326
+ const dragStart = (0, import_react.useRef)({ x: 0, y: 0 });
327
+ const elementStart = (0, import_react.useRef)({ x: 0, y: 0 });
328
+ const updatePosition = (0, import_react.useCallback)(
294
329
  (newPosition) => {
295
330
  const element = dragRef.current;
296
331
  if (!element) return;
@@ -306,7 +341,7 @@ function useDraggable(initialPosition, onPositionChange) {
306
341
  },
307
342
  [onPositionChange]
308
343
  );
309
- const handleStart = (0, import_react2.useCallback)(
344
+ const handleStart = (0, import_react.useCallback)(
310
345
  (clientX, clientY) => {
311
346
  setIsDragging(true);
312
347
  dragStart.current = { x: clientX, y: clientY };
@@ -346,14 +381,14 @@ function useDraggable(initialPosition, onPositionChange) {
346
381
  },
347
382
  [position, updatePosition]
348
383
  );
349
- const handleMouseDown = (0, import_react2.useCallback)(
384
+ const handleMouseDown = (0, import_react.useCallback)(
350
385
  (e) => {
351
386
  e.preventDefault();
352
387
  handleStart(e.clientX, e.clientY);
353
388
  },
354
389
  [handleStart]
355
390
  );
356
- const handleTouchStart = (0, import_react2.useCallback)(
391
+ const handleTouchStart = (0, import_react.useCallback)(
357
392
  (e) => {
358
393
  e.preventDefault();
359
394
  const touch = e.touches[0];
@@ -372,14 +407,22 @@ function useDraggable(initialPosition, onPositionChange) {
372
407
  };
373
408
  }
374
409
 
375
- // call-control-sdk/lib/services/request.ts
376
- var import_react4 = require("react");
377
-
378
- // call-control-sdk/lib/services/axios.ts
379
- var import_axios = __toESM(require("axios"));
410
+ // call-control-sdk/lib/hooks/useSDKState.ts
411
+ var import_react2 = require("react");
412
+ function useSDKState() {
413
+ const [state, setState] = (0, import_react2.useState)(sdkStateManager.getState());
414
+ (0, import_react2.useEffect)(() => {
415
+ const unsubscribe = sdkStateManager.subscribe(() => {
416
+ setState(sdkStateManager.getState());
417
+ });
418
+ return unsubscribe;
419
+ }, []);
420
+ return state;
421
+ }
380
422
 
381
423
  // call-control-sdk/lib/services/endPoint.ts
382
424
  var BASE_URL = "http://192.168.100.143:8095";
425
+ var WS_BASE_URL = "ws://192.168.100.143:8095";
383
426
  var VERSION = {
384
427
  v1: "/api/v1"
385
428
  };
@@ -392,15 +435,26 @@ var END_POINT = {
392
435
  MUTE_CALL: `${BASE_URL}${VERSION.v1}/cti/mute-call?provider=convox`,
393
436
  UNMUTE_CALL: `${BASE_URL}${VERSION.v1}/cti/unmute-call?provider=convox`,
394
437
  END_CALL: `${BASE_URL}${VERSION.v1}/cti/end-call?provider=convox`,
395
- LOGOUT: `${BASE_URL}${VERSION.v1}/cti//logout?provider=convox`,
438
+ LOGOUT: `${BASE_URL}${VERSION.v1}/cti/logout?provider=convox`,
396
439
  CONFERENCE_CALL: `${BASE_URL}${VERSION.v1}/cti/conference-call?provider=convox`,
397
440
  CONFERENCE_CALL_HOLD_OR_UN_HOLD: `${BASE_URL}${VERSION.v1}/cti/conference-call/hold-unhold?provider=convox`,
398
441
  CONFERENCE_CALL_MUTE_OT_UN_MUTE: `${BASE_URL}${VERSION.v1}/cti/conference-call/mute-unmute?provider=convox`,
399
442
  CONFERENCE_CALL_END: `${BASE_URL}${VERSION.v1}/cti/conference-call/hangup?provider=convox`,
400
- TRANSFER_CALL: `${BASE_URL}${VERSION.v1}/cti/transfer?provider=convox`
443
+ CONFERENCE_CALL_END_ALL: `${BASE_URL}${VERSION.v1}/cti/conference-call/hangup-all-call?provider=convox`,
444
+ TRANSFER_CALL: `${BASE_URL}${VERSION.v1}/cti/transfer?provider=convox`,
445
+ AGENTS_LIST: `${BASE_URL}${VERSION.v1}/cti/users`,
446
+ PROCESS_LIST: `${BASE_URL}${VERSION.v1}/cti/processes-list`,
447
+ TRANSFER_TO_DETAILS: `${BASE_URL}${VERSION.v1}/cti/trasnfer-to-details?provider=convox`
401
448
  };
449
+ var WS_END_POINT = {
450
+ WS: `${WS_BASE_URL}${VERSION.v1}/cti/ws`
451
+ };
452
+
453
+ // call-control-sdk/lib/services/request.ts
454
+ var import_react4 = require("react");
402
455
 
403
456
  // call-control-sdk/lib/services/axios.ts
457
+ var import_axios = __toESM(require("axios"));
404
458
  var token = "12345";
405
459
  var axiosInstance = import_axios.default.create({
406
460
  baseURL: BASE_URL,
@@ -530,21 +584,11 @@ var usePostRequest = (props = {}) => {
530
584
  payload: true
531
585
  });
532
586
  axios_default.post(url, payload, config).then((res) => {
533
- var _a, _b;
534
- if ((_a = res.data) == null ? void 0 : _a.success) {
535
- dispatch({
536
- type: "isSuccess",
537
- payload: res.data
538
- });
539
- onSuccess == null ? void 0 : onSuccess(res.data, payload);
540
- } else {
541
- dispatch({
542
- type: "isError",
543
- payload: res.data
544
- });
545
- showToast((_b = res.data) == null ? void 0 : _b.message, "error");
546
- onError == null ? void 0 : onError(res.data, payload);
547
- }
587
+ dispatch({
588
+ type: "isSuccess",
589
+ payload: res.data
590
+ });
591
+ onSuccess == null ? void 0 : onSuccess(res.data, payload);
548
592
  }).catch((err) => {
549
593
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
550
594
  const error = {
@@ -576,35 +620,196 @@ var usePostRequest = (props = {}) => {
576
620
 
577
621
  // call-control-sdk/lib/components/dialog.tsx
578
622
  var import_icons_material = require("@mui/icons-material");
579
- var import_material2 = require("@mui/material");
623
+ var import_material3 = require("@mui/material");
580
624
  var import_react5 = require("react");
625
+
626
+ // call-control-sdk/lib/components/styles.ts
627
+ var import_material2 = require("@mui/material");
628
+ var useMyStyles = () => {
629
+ const theme = (0, import_material2.useTheme)();
630
+ return {
631
+ disabled: {
632
+ padding: "0px",
633
+ margin: "0px",
634
+ minWidth: "40px !important",
635
+ borderRadius: "16px",
636
+ border: `1px solid rgb(206, 204, 204)`,
637
+ height: "40px",
638
+ "&:hover": {
639
+ boxShadow: " 0px 2px 2px rgba(0, 0, 0, 0.79)",
640
+ border: `1px solid ${theme.palette.primary.main}`
641
+ },
642
+ "&:active": {
643
+ bgcolor: "primary.main",
644
+ boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
645
+ }
646
+ },
647
+ enabled: {
648
+ padding: "0px",
649
+ margin: "0px",
650
+ minWidth: "40px !important",
651
+ borderRadius: "16px",
652
+ boxShadow: " 0px 2px 1px rgba(0, 0, 0, 0.507)",
653
+ border: `1px solid ${theme.palette.primary.main}`,
654
+ height: "40px",
655
+ "&:hover": {
656
+ boxShadow: " 0px 2px 1px rgba(0, 0, 0, 0.507)",
657
+ border: `1px solid ${theme.palette.primary.main}`
658
+ },
659
+ "&:active": {
660
+ bgcolor: "primary.main",
661
+ boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
662
+ }
663
+ },
664
+ outlined: {
665
+ padding: "0px",
666
+ margin: "0px",
667
+ minWidth: "40px !important",
668
+ borderRadius: "16px",
669
+ backgroundColor: theme.palette.grey[200],
670
+ boxShadow: `0px 2px 1px ${theme.palette.primary.light}`,
671
+ border: `0px solid ${theme.palette.primary.main}`,
672
+ height: "40px",
673
+ "&:hover": {
674
+ boxShadow: `0px 2px 1px ${theme.palette.primary.main}`,
675
+ border: `0px solid ${theme.palette.primary.main}`
676
+ },
677
+ "&:active": {
678
+ bgcolor: "primary.main",
679
+ boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
680
+ }
681
+ }
682
+ };
683
+ };
684
+ var styles_default = useMyStyles;
685
+
686
+ // call-control-sdk/lib/components/dialog.tsx
581
687
  var import_jsx_runtime2 = require("react/jsx-runtime");
582
- function ConferenceDialog({
583
- onConference,
584
- onExit,
585
- onEndAllCalls,
586
- open,
587
- setOpen
588
- }) {
688
+ function ConferenceDialog({ open, setOpen }) {
589
689
  var _a, _b;
590
690
  const state = useSDKState();
691
+ const { disabled, enabled, outlined } = styles_default();
692
+ const theme = (0, import_material3.useTheme)();
591
693
  const handleClose = () => {
592
694
  setOpen(false);
593
695
  };
594
696
  const onConferenceLineUpdate = (line, data) => {
595
697
  sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
596
698
  };
699
+ const onConferenceCallStart = (line, data) => {
700
+ var _a2, _b2, _c, _d;
701
+ const line_used = __spreadValues(__spreadValues({}, line), data);
702
+ const payload = {
703
+ action: "EXTERNAL_CONFERENCE",
704
+ operation: `CALL${line_used.line}`,
705
+ line_used: String(line_used.line),
706
+ thirdparty_no: line_used.phone,
707
+ userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
708
+ process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
709
+ };
710
+ axios_default.post(END_POINT.CONFERENCE_CALL, payload).then(() => {
711
+ sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
712
+ });
713
+ };
714
+ const onMergeConferenceCall = (line, data) => {
715
+ var _a2, _b2, _c, _d;
716
+ const line_used = __spreadValues(__spreadValues({}, line), data);
717
+ const payload = {
718
+ action: "EXTERNAL_CONFERENCE",
719
+ operation: `CONFERENCE`,
720
+ line_used: String(line_used.line),
721
+ thirdparty_no: line_used.phone,
722
+ userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
723
+ process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
724
+ };
725
+ axios_default.post(END_POINT.CONFERENCE_CALL, payload).then(() => {
726
+ sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
727
+ });
728
+ };
729
+ const onHoldOrUnHoldConferenceCall = (line, data, type) => {
730
+ var _a2, _b2, _c, _d;
731
+ const line_used = __spreadValues(__spreadValues({}, line), data);
732
+ const payload = {
733
+ action: "EXTERNAL_CONFERENCE",
734
+ operation: type,
735
+ hold_channel_no: type === "HOLDUSER" ? `hold${line_used.line}` : `unhold${line_used.line}`,
736
+ // Change the line according where u intiated firstly
737
+ userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
738
+ process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
739
+ };
740
+ axios_default.post(END_POINT.CONFERENCE_CALL_HOLD_OR_UN_HOLD, payload).then(() => {
741
+ sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
742
+ });
743
+ };
744
+ const onMuteOrUnMuteConferenceCall = (line, data, type) => {
745
+ var _a2, _b2, _c, _d;
746
+ const line_used = __spreadValues(__spreadValues({}, line), data);
747
+ const payload = {
748
+ action: "EXTERNAL_CONFERENCE",
749
+ operation: type,
750
+ channel_no: type === "MUTEUSER" ? `mute${line_used.line}` : `play${line_used.line}`,
751
+ userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
752
+ thirdparty_no: line_used.phone,
753
+ process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
754
+ };
755
+ axios_default.post(END_POINT.CONFERENCE_CALL_MUTE_OT_UN_MUTE, payload).then(() => {
756
+ sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
757
+ });
758
+ };
759
+ const onEndConferenceCall = (line, data) => {
760
+ var _a2, _b2, _c, _d;
761
+ const line_used = __spreadValues(__spreadValues({}, line), data);
762
+ const payload = {
763
+ action: "EXTERNAL_CONFERENCE",
764
+ operation: "HANGUP_CHANNEL",
765
+ line_used: String(line_used.line - 1),
766
+ user_type: `THIRDPARTY${line_used.line - 1}`,
767
+ thirdparty_no: line_used.phone,
768
+ userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
769
+ process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
770
+ };
771
+ axios_default.post(END_POINT.CONFERENCE_CALL_END, payload).then(() => {
772
+ sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
773
+ });
774
+ };
775
+ const onEndAllConferenceCalls = () => {
776
+ var _a2, _b2, _c, _d;
777
+ const payload = {
778
+ action: "EXTERNAL_CONFERENCE",
779
+ operation: "ENDCONFERENCE",
780
+ userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
781
+ process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
782
+ };
783
+ axios_default.post(END_POINT.CONFERENCE_CALL_END_ALL, payload).then(() => {
784
+ sdkStateManager.resetConferenceLines();
785
+ handleClose();
786
+ });
787
+ };
788
+ (0, import_react5.useEffect)(() => {
789
+ var _a2, _b2, _c, _d;
790
+ const obj = {
791
+ line: 1,
792
+ status: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) != null ? _b2 : "",
793
+ type: "internal",
794
+ phone: (_d = (_c = state.callData) == null ? void 0 : _c.phone_number) != null ? _d : "",
795
+ isMute: false,
796
+ isHold: false,
797
+ isMergeCall: false,
798
+ isCallStart: true
799
+ };
800
+ sdkStateManager.setConferenceLine(obj);
801
+ }, []);
597
802
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
598
- import_material2.Dialog,
803
+ import_material3.Dialog,
599
804
  {
600
805
  open,
601
806
  "aria-labelledby": "alert-dialog-title",
602
807
  "aria-describedby": "alert-dialog-description",
603
808
  fullWidth: true,
604
809
  maxWidth: "md",
605
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Paper, { sx: { borderRadius: 2 }, children: [
810
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
606
811
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
607
- import_material2.Box,
812
+ import_material3.Box,
608
813
  {
609
814
  sx: {
610
815
  display: "flex",
@@ -613,80 +818,27 @@ function ConferenceDialog({
613
818
  padding: "4px 16px"
614
819
  },
615
820
  children: [
616
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Typography, { variant: "body1", children: [
821
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Typography, { variant: "body1", children: [
617
822
  (_a = state == null ? void 0 : state.agentId) != null ? _a : "",
618
823
  " conference"
619
824
  ] }),
620
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
825
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
621
826
  ]
622
827
  }
623
828
  ),
624
829
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
625
- import_material2.Stack,
626
- {
627
- direction: "row",
628
- alignItems: "center",
629
- justifyContent: "flex-end",
630
- mr: 2,
631
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
632
- import_material2.Stack,
633
- {
634
- display: "flex",
635
- direction: "row",
636
- alignItems: "center",
637
- justifyContent: "center",
638
- spacing: 1,
639
- children: [
640
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
641
- import_material2.Button,
642
- {
643
- variant: "contained",
644
- color: "success",
645
- onClick: onConference,
646
- sx: {
647
- borderRadius: "10px",
648
- textTransform: "capitalize"
649
- },
650
- children: [
651
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Group, { sx: { px: 0.5 } }),
652
- "Conference"
653
- ]
654
- }
655
- ),
656
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
657
- import_material2.Button,
658
- {
659
- variant: "contained",
660
- color: "error",
661
- onClick: onExit,
662
- sx: {
663
- borderRadius: "10px",
664
- textTransform: "capitalize"
665
- },
666
- children: [
667
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Logout, { sx: { px: 0.5 } }),
668
- "Exit Conference"
669
- ]
670
- }
671
- )
672
- ]
673
- }
674
- )
675
- }
676
- ),
677
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
678
- import_material2.Box,
830
+ import_material3.Box,
679
831
  {
680
832
  sx: {
681
833
  boxShadow: "0px 1px 2px #e7e5e5ff",
682
- padding: "6px",
834
+ padding: "2px 6px",
683
835
  margin: "0px 10px",
684
836
  borderRadius: "20px"
685
837
  },
686
838
  children: (_b = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _b.map((each, index) => {
687
839
  var _a2, _b2;
688
840
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
689
- import_material2.Box,
841
+ import_material3.Box,
690
842
  {
691
843
  sx: {
692
844
  p: 1,
@@ -697,7 +849,7 @@ function ConferenceDialog({
697
849
  },
698
850
  children: [
699
851
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
700
- import_material2.Box,
852
+ import_material3.Box,
701
853
  {
702
854
  sx: {
703
855
  color: "white",
@@ -709,11 +861,11 @@ function ConferenceDialog({
709
861
  border: "2px solid primary.main",
710
862
  borderRadius: "10px 50px 50px 10px"
711
863
  },
712
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { children: (_a2 = each == null ? void 0 : each.line) != null ? _a2 : "" })
864
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { children: (_a2 = each == null ? void 0 : each.line) != null ? _a2 : "" })
713
865
  }
714
866
  ),
715
867
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
716
- import_material2.Typography,
868
+ import_material3.Typography,
717
869
  {
718
870
  variant: "body2",
719
871
  sx: {
@@ -727,128 +879,145 @@ function ConferenceDialog({
727
879
  children: (_b2 = each == null ? void 0 : each.status) != null ? _b2 : ""
728
880
  }
729
881
  ),
730
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
731
- import_material2.Button,
732
- {
733
- sx: {
734
- textTransform: "capitalize"
735
- },
736
- size: "small",
737
- onClick: () => {
738
- onConferenceLineUpdate(each, { type: "internal" });
739
- },
740
- children: [
741
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Radio, { checked: (each == null ? void 0 : each.type) === "internal" }),
742
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { variant: "body2", children: "Internal" })
743
- ]
744
- }
745
- ),
746
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
747
- import_material2.Button,
882
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
883
+ import_material3.Button,
748
884
  {
749
885
  sx: {
750
886
  textTransform: "capitalize"
751
887
  },
752
888
  size: "small",
753
- onClick: () => {
754
- onConferenceLineUpdate(each, { type: "external" });
755
- },
756
- children: [
757
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Radio, { checked: each.type === "external" }),
758
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { variant: "body2", children: "External" })
759
- ]
889
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { variant: "body2", children: (each == null ? void 0 : each.line) === 1 ? "Internal" : "External" })
760
890
  }
761
891
  ),
762
892
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
763
- import_material2.TextField,
893
+ import_material3.TextField,
764
894
  {
765
895
  size: "small",
766
896
  placeholder: "Phone Number",
767
897
  value: (each == null ? void 0 : each.phone) || "",
898
+ disabled: (each == null ? void 0 : each.line) === 1,
768
899
  onChange: (e) => {
769
900
  onConferenceLineUpdate(each, { phone: e.target.value });
770
901
  }
771
902
  }
772
903
  ),
773
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Tooltip, { title: "Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
774
- import_material2.IconButton,
904
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
905
+ import_material3.Button,
775
906
  {
907
+ variant: (each == null ? void 0 : each.isCallStart) ? "outlined" : "contained",
776
908
  color: "success",
777
- sx: {
778
- bgcolor: "action.hover",
779
- "&:hover": { bgcolor: "action.selected" }
780
- },
909
+ sx: (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
910
+ border: `0px solid ${theme.palette.success.light}`,
911
+ "&:hover": {
912
+ bgcolor: "error.light",
913
+ boxShadow: `0px 2px 1px ${theme.palette.success.light}`,
914
+ border: `0px solid ${theme.palette.success.light}`
915
+ },
916
+ "&:active": {
917
+ bgcolor: "error.light",
918
+ boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
919
+ }
920
+ }),
781
921
  onClick: () => {
782
- onConferenceLineUpdate(each, {
922
+ onConferenceCallStart(each, {
783
923
  isCallStart: true,
784
- status: "ON CALL"
924
+ status: "ONCALL"
785
925
  });
786
926
  },
787
927
  disabled: each == null ? void 0 : each.isCallStart,
788
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
928
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
929
+ import_icons_material.Call,
930
+ {
931
+ sx: { color: (each == null ? void 0 : each.isCallStart) ? "defalult" : "#fff" }
932
+ }
933
+ )
789
934
  }
790
935
  ) }),
791
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Tooltip, { title: "Merge Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
792
- import_material2.IconButton,
936
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "Merge Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
937
+ import_material3.Button,
793
938
  {
794
- color: "info",
795
- sx: {
796
- bgcolor: "action.hover",
797
- "&:hover": { bgcolor: "action.selected" }
939
+ variant: (each == null ? void 0 : each.isMergeCall) ? "contained" : "outlined",
940
+ sx: (each == null ? void 0 : each.isMergeCall) && (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
941
+ onClick: () => {
942
+ onMergeConferenceCall(each, {
943
+ isMergeCall: true,
944
+ status: "ONCALL"
945
+ });
798
946
  },
799
947
  disabled: !(each == null ? void 0 : each.isCallStart),
800
948
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.CallSplit, {})
801
949
  }
802
950
  ) }),
803
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Tooltip, { title: each.isHold ? "Hold" : "Un Hold", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
804
- import_material2.IconButton,
951
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: each.isHold ? "Hold" : "Un Hold", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
952
+ import_material3.Button,
805
953
  {
806
- color: each.isHold ? "warning" : "info",
807
- sx: {
808
- bgcolor: "action.hover",
809
- "&:hover": { bgcolor: "action.selected" }
810
- },
954
+ variant: (each == null ? void 0 : each.isHold) ? "contained" : "outlined",
955
+ sx: (each == null ? void 0 : each.isHold) && (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
811
956
  onClick: () => {
812
957
  if (each.isHold) {
813
- onConferenceLineUpdate(each, { isHold: false });
958
+ onHoldOrUnHoldConferenceCall(
959
+ each,
960
+ { isHold: false },
961
+ "UNHOLDUSER"
962
+ );
814
963
  } else {
815
- onConferenceLineUpdate(each, { isHold: true });
964
+ onHoldOrUnHoldConferenceCall(
965
+ each,
966
+ { isHold: true },
967
+ "HOLDUSER"
968
+ );
816
969
  }
817
970
  },
818
971
  disabled: !(each == null ? void 0 : each.isCallStart),
819
- children: each.isHold ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PlayCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PauseCircle, {})
972
+ children: each.isHold ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Pause, {})
820
973
  }
821
974
  ) }),
822
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Tooltip, { title: each.isMute ? "Mute" : "Un Mute", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
823
- import_material2.IconButton,
975
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: each.isMute ? "Mute" : "Un Mute", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
976
+ import_material3.Button,
824
977
  {
825
- color: each.isMute ? "error" : "info",
826
- sx: {
827
- bgcolor: "action.hover",
828
- "&:hover": { bgcolor: "action.selected" }
829
- },
978
+ variant: (each == null ? void 0 : each.isMute) ? "contained" : "outlined",
979
+ sx: (each == null ? void 0 : each.isMute) && (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
830
980
  onClick: () => {
831
981
  if (each.isMute) {
832
- onConferenceLineUpdate(each, { isMute: false });
982
+ onMuteOrUnMuteConferenceCall(
983
+ each,
984
+ { isMute: false },
985
+ "PLAYUSER"
986
+ );
833
987
  } else {
834
- onConferenceLineUpdate(each, { isMute: true });
988
+ onMuteOrUnMuteConferenceCall(
989
+ each,
990
+ { isMute: true },
991
+ "MUTEUSER"
992
+ );
835
993
  }
836
994
  },
837
995
  disabled: !(each == null ? void 0 : each.isCallStart),
838
996
  children: each.isMute ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Mic, {})
839
997
  }
840
998
  ) }),
841
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
842
- import_material2.IconButton,
999
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "End Call", children: (each == null ? void 0 : each.line) !== 1 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1000
+ import_material3.Button,
843
1001
  {
1002
+ variant: (each == null ? void 0 : each.isCallStart) ? "contained" : "outlined",
844
1003
  color: "error",
845
- sx: {
846
- bgcolor: "action.hover",
847
- "&:hover": { bgcolor: "action.selected" }
848
- },
1004
+ sx: (each == null ? void 0 : each.isCallStart) ? __spreadProps(__spreadValues({}, enabled), {
1005
+ minWidth: "60px !important",
1006
+ border: `0px solid ${theme.palette.error.light}`,
1007
+ "&:hover": {
1008
+ bgcolor: "error.light",
1009
+ boxShadow: `0px 2px 1px ${theme.palette.error.light}`,
1010
+ border: `0px solid ${theme.palette.error.light}`
1011
+ },
1012
+ "&:active": {
1013
+ bgcolor: "error.light",
1014
+ boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
1015
+ }
1016
+ }) : __spreadProps(__spreadValues({}, disabled), { minWidth: "60px !important" }),
849
1017
  onClick: () => {
850
- onConferenceLineUpdate(each, {
1018
+ onEndConferenceCall(each, {
851
1019
  isCallStart: false,
1020
+ isMergeCall: false,
852
1021
  isMute: false,
853
1022
  isHold: false,
854
1023
  status: "IDLE"
@@ -857,6 +1026,33 @@ function ConferenceDialog({
857
1026
  disabled: !(each == null ? void 0 : each.isCallStart),
858
1027
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.CallEnd, {})
859
1028
  }
1029
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1030
+ import_material3.Button,
1031
+ {
1032
+ variant: (each == null ? void 0 : each.isCallStart) ? "contained" : "outlined",
1033
+ sx: __spreadProps(__spreadValues({}, disabled), {
1034
+ visibility: "hidden",
1035
+ minWidth: "60px !important"
1036
+ }),
1037
+ onClick: () => {
1038
+ onEndConferenceCall(each, {
1039
+ isCallStart: false,
1040
+ isMergeCall: false,
1041
+ isMute: false,
1042
+ isHold: false,
1043
+ status: "IDLE"
1044
+ });
1045
+ },
1046
+ disabled: !(each == null ? void 0 : each.isCallStart),
1047
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1048
+ import_icons_material.CallEnd,
1049
+ {
1050
+ sx: {
1051
+ visibility: "hidden"
1052
+ }
1053
+ }
1054
+ ) })
1055
+ }
860
1056
  ) })
861
1057
  ]
862
1058
  },
@@ -865,17 +1061,17 @@ function ConferenceDialog({
865
1061
  })
866
1062
  }
867
1063
  ),
868
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Box, { textAlign: "center", m: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
869
- import_material2.Button,
1064
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { textAlign: "center", m: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1065
+ import_material3.Button,
870
1066
  {
871
1067
  variant: "outlined",
872
1068
  color: "error",
873
1069
  size: "large",
874
- onClick: onEndAllCalls,
1070
+ onClick: onEndAllConferenceCalls,
875
1071
  sx: { px: 2, borderRadius: "20px", textTransform: "capitalize" },
876
1072
  children: [
877
1073
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
878
- import_material2.IconButton,
1074
+ import_material3.IconButton,
879
1075
  {
880
1076
  sx: {
881
1077
  bgcolor: "error.main",
@@ -906,7 +1102,7 @@ function ConferenceDialog({
906
1102
  )
907
1103
  }
908
1104
  ),
909
- "End Calls"
1105
+ "End Conference"
910
1106
  ]
911
1107
  }
912
1108
  ) })
@@ -915,45 +1111,82 @@ function ConferenceDialog({
915
1111
  ) });
916
1112
  }
917
1113
  function CallTransferDialog({ open, setOpen }) {
918
- const [transferCall] = usePostRequest();
919
- const agentList = [
920
- { name: "agent_ravi", status: "IDLE" },
921
- { name: "rajesh", status: "IDLE" },
922
- { name: "sudheer", status: "IDLE" },
923
- { name: "test_user", status: "IDLE" }
924
- ];
1114
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1115
+ const [transferCall] = usePostRequest({
1116
+ onSuccess: (res) => {
1117
+ console.log("res", res);
1118
+ setOpen(false);
1119
+ },
1120
+ onError: (error) => {
1121
+ console.log("error", error);
1122
+ }
1123
+ });
1124
+ const state = useSDKState();
1125
+ const [currentselecteTab, setCurrentselecteTab] = (0, import_react5.useState)("process");
1126
+ const [getIdelAgentsList, { data: idleAgentsList }] = usePostRequest();
1127
+ const [getProcessAndQueuesList, { data: processAndQueuesList }] = usePostRequest();
925
1128
  const handleClose = () => {
926
1129
  setOpen(false);
927
1130
  };
928
- const handleTransferCall = () => {
929
- const payload = {
930
- action: "CALL",
931
- endcall_type: "",
932
- mobile_number: "",
933
- userid: "",
934
- type: "",
935
- transfer_to_agent_id: "",
936
- transfer_to: "",
937
- disposition: "",
938
- set_followUp: "",
939
- callreferenceid: "",
940
- processid: "",
941
- process_name: "",
942
- refno: "",
943
- transfer_to_queue: ""
944
- };
945
- transferCall(END_POINT.TRANSFER_CALL, payload);
1131
+ const handleTransferCall = (data, type) => {
1132
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _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;
1133
+ console.log(data, "data34");
1134
+ if (type === "PROCESS") {
1135
+ const payload = {
1136
+ mobile_number: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.phone_number) != null ? _b2 : "",
1137
+ userid: (_d2 = (_c2 = state.callData) == null ? void 0 : _c2.agent_id) != null ? _d2 : "",
1138
+ type: "PROCESS",
1139
+ transfer_to: (_e2 = data == null ? void 0 : data.process_name) != null ? _e2 : "",
1140
+ callreferenceid: (_g2 = (_f2 = state.callData) == null ? void 0 : _f2.convox_id) != null ? _g2 : "",
1141
+ processid: String((_i = (_h2 = state.callData) == null ? void 0 : _h2.process_id) != null ? _i : ""),
1142
+ process_name: (_k = (_j = state.callData) == null ? void 0 : _j.process_name) != null ? _k : ""
1143
+ };
1144
+ transferCall(END_POINT.TRANSFER_CALL, payload);
1145
+ } else if (type === "QUEUE") {
1146
+ const payload = {
1147
+ mobile_number: (_m = (_l = state.callData) == null ? void 0 : _l.phone_number) != null ? _m : "",
1148
+ userid: (_o = (_n = state.callData) == null ? void 0 : _n.agent_id) != null ? _o : "",
1149
+ type: "QUEUE",
1150
+ transfer_to: (_p = data == null ? void 0 : data.queue_name) != null ? _p : "",
1151
+ callreferenceid: (_r = (_q = state.callData) == null ? void 0 : _q.convox_id) != null ? _r : "",
1152
+ processid: String((_t = (_s = state.callData) == null ? void 0 : _s.process_id) != null ? _t : ""),
1153
+ process_name: (_v = (_u = state.callData) == null ? void 0 : _u.process_name) != null ? _v : ""
1154
+ };
1155
+ transferCall(END_POINT.TRANSFER_CALL, payload);
1156
+ } else if (type === "AGENT") {
1157
+ const payload = {
1158
+ mobile_number: (_x = (_w = state.callData) == null ? void 0 : _w.phone_number) != null ? _x : "",
1159
+ userid: (_z = (_y = state.callData) == null ? void 0 : _y.agent_id) != null ? _z : "",
1160
+ type: "AGENT",
1161
+ transfer_to: (_A = data == null ? void 0 : data.user_id) != null ? _A : "",
1162
+ callreferenceid: (_C = (_B = state.callData) == null ? void 0 : _B.convox_id) != null ? _C : "",
1163
+ processid: String((_E = (_D = state.callData) == null ? void 0 : _D.process_id) != null ? _E : ""),
1164
+ process_name: (_G = (_F = state.callData) == null ? void 0 : _F.process_name) != null ? _G : ""
1165
+ };
1166
+ transferCall(END_POINT.TRANSFER_CALL, payload);
1167
+ }
946
1168
  };
1169
+ (0, import_react5.useEffect)(() => {
1170
+ getIdelAgentsList(END_POINT.AGENTS_LIST, {
1171
+ status: "IDLE",
1172
+ active: true
1173
+ });
1174
+ getProcessAndQueuesList(END_POINT.TRANSFER_TO_DETAILS, {
1175
+ status: "ACTIVE",
1176
+ active: true
1177
+ });
1178
+ }, []);
947
1179
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
948
- import_material2.Dialog,
1180
+ import_material3.Dialog,
949
1181
  {
950
1182
  open,
951
1183
  "aria-labelledby": "alert-dialog-title",
952
1184
  "aria-describedby": "alert-dialog-description",
953
- maxWidth: "xs",
954
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Paper, { sx: { borderRadius: 2 }, children: [
1185
+ fullWidth: true,
1186
+ maxWidth: "md",
1187
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
955
1188
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
956
- import_material2.Box,
1189
+ import_material3.Box,
957
1190
  {
958
1191
  sx: {
959
1192
  display: "flex",
@@ -963,13 +1196,13 @@ function CallTransferDialog({ open, setOpen }) {
963
1196
  boxShadow: "0px 1px 2px #f5f5f5ff"
964
1197
  },
965
1198
  children: [
966
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { variant: "body1", children: " Call Transfer" }),
967
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
1199
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { variant: "body1", children: " Call Transfer" }),
1200
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
968
1201
  ]
969
1202
  }
970
1203
  ),
971
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
972
- import_material2.Box,
1204
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1205
+ import_material3.Box,
973
1206
  {
974
1207
  sx: {
975
1208
  boxShadow: "1px 1px 4px #d3d3d3ff",
@@ -977,55 +1210,254 @@ function CallTransferDialog({ open, setOpen }) {
977
1210
  margin: "10px",
978
1211
  borderRadius: "10px"
979
1212
  },
980
- children: agentList.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
981
- import_material2.Box,
982
- {
983
- sx: {
984
- p: 1,
985
- display: "flex",
986
- alignItems: "center",
987
- boxShadow: "1px 1px 4px #d3d3d3ff",
988
- padding: "6px",
989
- margin: "10px 0px",
990
- borderRadius: "10px",
991
- "&:hover": { bgcolor: "action.selected" }
992
- },
993
- children: [
994
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
995
- import_material2.Typography,
996
- {
997
- variant: "body1",
998
- sx: {
999
- mx: 1,
1000
- width: "200px",
1001
- maxWidth: "250px",
1002
- display: "flex",
1003
- alignItems: "center"
1004
- },
1005
- children: [
1006
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
1007
- line.name
1008
- ]
1009
- }
1010
- ),
1011
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1012
- import_material2.IconButton,
1013
- {
1014
- color: "success",
1015
- sx: {
1016
- bgcolor: "action.hover",
1017
- "&:hover": { bgcolor: "action.selected" }
1018
- },
1019
- onClick: () => {
1020
- handleTransferCall();
1021
- },
1022
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
1023
- }
1024
- )
1025
- ]
1026
- },
1027
- index
1028
- ))
1213
+ children: [
1214
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "flex", gap: 1 }, children: [
1215
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1216
+ import_material3.Button,
1217
+ {
1218
+ variant: currentselecteTab === "process" ? "contained" : "outlined",
1219
+ onClick: () => setCurrentselecteTab("process"),
1220
+ children: "Process"
1221
+ }
1222
+ ),
1223
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1224
+ import_material3.Button,
1225
+ {
1226
+ variant: currentselecteTab === "queues" ? "contained" : "outlined",
1227
+ onClick: () => setCurrentselecteTab("queues"),
1228
+ children: "Queues"
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1232
+ import_material3.Button,
1233
+ {
1234
+ variant: currentselecteTab === "agents" ? "contained" : "outlined",
1235
+ onClick: () => setCurrentselecteTab("agents"),
1236
+ children: "Agents"
1237
+ }
1238
+ )
1239
+ ] }),
1240
+ currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { display: "flex", gap: 1 }, children: ((_b = (_a = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a.process) == null ? void 0 : _b.length) > 0 ? (_d = (_c = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _c.process) == null ? void 0 : _d.map(
1241
+ (process, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1242
+ import_material3.Box,
1243
+ {
1244
+ sx: {
1245
+ p: 1,
1246
+ display: "flex",
1247
+ alignItems: "center",
1248
+ boxShadow: "1px 1px 4px #d3d3d3ff",
1249
+ padding: "6px",
1250
+ margin: "10px 0px",
1251
+ borderRadius: "10px",
1252
+ "&:hover": { bgcolor: "action.selected" }
1253
+ },
1254
+ children: [
1255
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1256
+ import_material3.Typography,
1257
+ {
1258
+ variant: "body1",
1259
+ sx: {
1260
+ mx: 1,
1261
+ width: "200px",
1262
+ maxWidth: "250px",
1263
+ display: "flex",
1264
+ alignItems: "center"
1265
+ },
1266
+ children: [
1267
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
1268
+ process.process_name
1269
+ ]
1270
+ }
1271
+ ),
1272
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1273
+ import_material3.IconButton,
1274
+ {
1275
+ color: "success",
1276
+ sx: {
1277
+ bgcolor: "action.hover",
1278
+ "&:hover": { bgcolor: "action.selected" }
1279
+ },
1280
+ onClick: () => {
1281
+ handleTransferCall(process, "PROCESS");
1282
+ },
1283
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
1284
+ }
1285
+ )
1286
+ ]
1287
+ },
1288
+ index
1289
+ )
1290
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1291
+ import_material3.Typography,
1292
+ {
1293
+ variant: "body1",
1294
+ sx: {
1295
+ fontSize: "12px",
1296
+ fontWeight: "600",
1297
+ letterSpacing: "0.02em",
1298
+ textTransform: "capitalize",
1299
+ textAlign: "center",
1300
+ width: "100%",
1301
+ margin: "10px 0px",
1302
+ color: "gray"
1303
+ },
1304
+ children: "No Process Found"
1305
+ }
1306
+ ) }),
1307
+ currentselecteTab === "queues" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { display: "flex", gap: 1 }, children: ((_f = (_e = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _e.queue) == null ? void 0 : _f.length) > 0 ? (_h = (_g = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _g.queue) == null ? void 0 : _h.map(
1308
+ (queue, index) => {
1309
+ var _a2, _b2, _c2, _d2, _e2, _f2;
1310
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1311
+ import_material3.Box,
1312
+ {
1313
+ sx: {
1314
+ p: 1,
1315
+ display: "flex",
1316
+ alignItems: "center",
1317
+ boxShadow: "1px 1px 4px #d3d3d3ff",
1318
+ padding: "6px",
1319
+ margin: "10px 0px",
1320
+ borderRadius: "10px",
1321
+ "&:hover": { bgcolor: "action.selected" }
1322
+ },
1323
+ children: [
1324
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1325
+ import_material3.Typography,
1326
+ {
1327
+ variant: "body1",
1328
+ sx: {
1329
+ mx: 1,
1330
+ width: "200px",
1331
+ maxWidth: "250px",
1332
+ display: "flex",
1333
+ alignItems: "center"
1334
+ },
1335
+ children: [
1336
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
1337
+ queue.queue_name,
1338
+ ((_c2 = (_b2 = (_a2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a2.process) == null ? void 0 : _b2.find(
1339
+ (process) => process.process_id === queue.process_id
1340
+ )) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1341
+ import_material3.Typography,
1342
+ {
1343
+ variant: "body1",
1344
+ sx: {
1345
+ fontSize: "12px",
1346
+ fontWeight: "600",
1347
+ letterSpacing: "0.02em",
1348
+ textTransform: "capitalize",
1349
+ color: "gray"
1350
+ },
1351
+ children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
1352
+ (process) => process.process_id === queue.process_id
1353
+ )) == null ? void 0 : _f2.process_name) + ")"
1354
+ }
1355
+ ) : ""
1356
+ ]
1357
+ }
1358
+ ),
1359
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1360
+ import_material3.IconButton,
1361
+ {
1362
+ color: "success",
1363
+ sx: {
1364
+ bgcolor: "action.hover",
1365
+ "&:hover": { bgcolor: "action.selected" }
1366
+ },
1367
+ onClick: () => {
1368
+ handleTransferCall(queue, "QUEUE");
1369
+ },
1370
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
1371
+ }
1372
+ )
1373
+ ]
1374
+ },
1375
+ index
1376
+ );
1377
+ }
1378
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1379
+ import_material3.Typography,
1380
+ {
1381
+ variant: "body1",
1382
+ sx: {
1383
+ fontSize: "12px",
1384
+ fontWeight: "600",
1385
+ letterSpacing: "0.02em",
1386
+ textTransform: "capitalize",
1387
+ textAlign: "center",
1388
+ width: "100%",
1389
+ margin: "10px 0px",
1390
+ color: "gray"
1391
+ },
1392
+ children: "No Queues Found"
1393
+ }
1394
+ ) }),
1395
+ currentselecteTab === "agents" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { display: "flex", gap: 1 }, children: (idleAgentsList == null ? void 0 : idleAgentsList.length) > 0 ? idleAgentsList.map((agent, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1396
+ import_material3.Box,
1397
+ {
1398
+ sx: {
1399
+ p: 1,
1400
+ display: "flex",
1401
+ alignItems: "center",
1402
+ boxShadow: "1px 1px 4px #d3d3d3ff",
1403
+ padding: "6px",
1404
+ margin: "10px 0px",
1405
+ borderRadius: "10px",
1406
+ "&:hover": { bgcolor: "action.selected" }
1407
+ },
1408
+ children: [
1409
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1410
+ import_material3.Typography,
1411
+ {
1412
+ variant: "body1",
1413
+ sx: {
1414
+ mx: 1,
1415
+ width: "200px",
1416
+ maxWidth: "250px",
1417
+ display: "flex",
1418
+ alignItems: "center"
1419
+ },
1420
+ children: [
1421
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
1422
+ agent.name
1423
+ ]
1424
+ }
1425
+ ),
1426
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1427
+ import_material3.IconButton,
1428
+ {
1429
+ color: "success",
1430
+ sx: {
1431
+ bgcolor: "action.hover",
1432
+ "&:hover": { bgcolor: "action.selected" }
1433
+ },
1434
+ onClick: () => {
1435
+ handleTransferCall(agent, "AGENT");
1436
+ },
1437
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
1438
+ }
1439
+ )
1440
+ ]
1441
+ },
1442
+ index
1443
+ )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1444
+ import_material3.Typography,
1445
+ {
1446
+ variant: "body1",
1447
+ sx: {
1448
+ fontSize: "12px",
1449
+ fontWeight: "600",
1450
+ letterSpacing: "0.02em",
1451
+ textTransform: "capitalize",
1452
+ textAlign: "center",
1453
+ width: "100%",
1454
+ margin: "10px 0px",
1455
+ color: "gray"
1456
+ },
1457
+ children: "No Agents Found"
1458
+ }
1459
+ ) })
1460
+ ]
1029
1461
  }
1030
1462
  )
1031
1463
  ] })
@@ -1037,27 +1469,29 @@ function EndCallDispositionDialog({
1037
1469
  setOpen,
1038
1470
  onSubmitDisposition
1039
1471
  }) {
1472
+ var _a, _b;
1040
1473
  const [formData, setFormData] = (0, import_react5.useState)({
1041
- disposition: null,
1042
- followUp: { label: "no" },
1474
+ disposition: { label: "Resolved", value: "RES" },
1475
+ followUp: { label: "No", value: "N" },
1043
1476
  callbackDate: "",
1044
1477
  callbackHrs: "",
1045
1478
  callbackMins: ""
1046
1479
  });
1047
1480
  const dispositionOptions = [
1048
- { label: "Interested" },
1049
- { label: "Not Interested" },
1050
- { label: "Callback Later" },
1051
- { label: "Wrong Number" }
1481
+ { label: "Not Interested", value: "NI" },
1482
+ { label: "Resolved", value: "RES" }
1483
+ ];
1484
+ const followUpOptions = [
1485
+ { label: "Yes", value: "Y" },
1486
+ { label: "No", value: "N" }
1052
1487
  ];
1053
- const followUpOptions = [{ label: "yes" }, { label: "no" }];
1054
1488
  const handleChange = (field, value) => {
1055
1489
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [field]: value }));
1056
1490
  };
1057
1491
  const handleReset = () => {
1058
1492
  setFormData({
1059
- disposition: null,
1060
- followUp: { label: "no" },
1493
+ disposition: { label: "Resolved", value: "RES" },
1494
+ followUp: { label: "No", value: "N" },
1061
1495
  callbackDate: "",
1062
1496
  callbackHrs: "",
1063
1497
  callbackMins: ""
@@ -1068,16 +1502,16 @@ function EndCallDispositionDialog({
1068
1502
  setOpen(false);
1069
1503
  };
1070
1504
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1071
- import_material2.Dialog,
1505
+ import_material3.Dialog,
1072
1506
  {
1073
1507
  open,
1074
1508
  "aria-labelledby": "alert-dialog-title",
1075
1509
  "aria-describedby": "alert-dialog-description",
1076
1510
  fullWidth: true,
1077
1511
  maxWidth: "xs",
1078
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Paper, { sx: { borderRadius: 2 }, children: [
1512
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
1079
1513
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1080
- import_material2.Box,
1514
+ import_material3.Box,
1081
1515
  {
1082
1516
  sx: {
1083
1517
  display: "flex",
@@ -1086,14 +1520,14 @@ function EndCallDispositionDialog({
1086
1520
  padding: "4px 16px",
1087
1521
  boxShadow: "0px 1px 2px #f5f5f5ff"
1088
1522
  },
1089
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Typography, { variant: "body1", m: 1, children: [
1523
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Typography, { variant: "body1", m: 1, children: [
1090
1524
  " ",
1091
1525
  "Call Disposition"
1092
1526
  ] })
1093
1527
  }
1094
1528
  ),
1095
1529
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1096
- import_material2.Box,
1530
+ import_material3.Box,
1097
1531
  {
1098
1532
  sx: {
1099
1533
  boxShadow: "1px 1px 4px #d3d3d3ff",
@@ -1101,32 +1535,32 @@ function EndCallDispositionDialog({
1101
1535
  margin: "10px",
1102
1536
  borderRadius: "10px"
1103
1537
  },
1104
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Grid, { container: true, spacing: 2, children: [
1105
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1106
- import_material2.Autocomplete,
1538
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Grid, { container: true, spacing: 2, children: [
1539
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1540
+ import_material3.Autocomplete,
1107
1541
  {
1108
1542
  value: formData.disposition,
1109
1543
  options: dispositionOptions,
1110
1544
  getOptionLabel: (opt) => opt.label,
1111
1545
  onChange: (_, val) => handleChange("disposition", val),
1112
1546
  size: "small",
1113
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.TextField, __spreadProps(__spreadValues({}, params), { label: "Disposition", fullWidth: true }))
1547
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { label: "Disposition", fullWidth: true }))
1114
1548
  }
1115
1549
  ) }),
1116
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1117
- import_material2.Autocomplete,
1550
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1551
+ import_material3.Autocomplete,
1118
1552
  {
1119
1553
  options: followUpOptions,
1120
1554
  getOptionLabel: (opt) => opt.label,
1121
1555
  value: formData.followUp,
1122
1556
  onChange: (_, val) => handleChange("followUp", val),
1123
1557
  size: "small",
1124
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.TextField, __spreadProps(__spreadValues({}, params), { label: "Follow Up", fullWidth: true }))
1558
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { label: "Follow Up", fullWidth: true }))
1125
1559
  }
1126
1560
  ) }),
1127
- formData.followUp.label === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1128
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1129
- import_material2.TextField,
1561
+ ((_b = (_a = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a.label) == null ? void 0 : _b.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1562
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1563
+ import_material3.TextField,
1130
1564
  {
1131
1565
  size: "small",
1132
1566
  label: "Callback Date",
@@ -1139,8 +1573,8 @@ function EndCallDispositionDialog({
1139
1573
  fullWidth: true
1140
1574
  }
1141
1575
  ) }),
1142
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1143
- import_material2.TextField,
1576
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1577
+ import_material3.TextField,
1144
1578
  {
1145
1579
  size: "small",
1146
1580
  label: "Hours (0-23)",
@@ -1151,8 +1585,8 @@ function EndCallDispositionDialog({
1151
1585
  fullWidth: true
1152
1586
  }
1153
1587
  ) }),
1154
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1155
- import_material2.TextField,
1588
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Grid, { size: 6, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1589
+ import_material3.TextField,
1156
1590
  {
1157
1591
  size: "small",
1158
1592
  label: "Minutes (0-59)",
@@ -1167,9 +1601,9 @@ function EndCallDispositionDialog({
1167
1601
  ] })
1168
1602
  }
1169
1603
  ),
1170
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Box, { textAlign: "right", m: 2, children: [
1604
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { textAlign: "right", m: 2, children: [
1171
1605
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1172
- import_material2.Button,
1606
+ import_material3.Button,
1173
1607
  {
1174
1608
  variant: "outlined",
1175
1609
  color: "error",
@@ -1185,7 +1619,7 @@ function EndCallDispositionDialog({
1185
1619
  }
1186
1620
  ),
1187
1621
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1188
- import_material2.Button,
1622
+ import_material3.Button,
1189
1623
  {
1190
1624
  variant: "contained",
1191
1625
  color: "primary",
@@ -1200,24 +1634,158 @@ function EndCallDispositionDialog({
1200
1634
  }
1201
1635
  ) });
1202
1636
  }
1637
+ function ProcessorListDialog({
1638
+ open,
1639
+ setOpen,
1640
+ processList = [],
1641
+ handleSelectedProcessor
1642
+ }) {
1643
+ const handleClose = () => {
1644
+ setOpen(false);
1645
+ };
1646
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1647
+ import_material3.Dialog,
1648
+ {
1649
+ open,
1650
+ "aria-labelledby": "alert-dialog-title",
1651
+ "aria-describedby": "alert-dialog-description",
1652
+ maxWidth: "xs",
1653
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
1654
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1655
+ import_material3.Box,
1656
+ {
1657
+ sx: {
1658
+ display: "flex",
1659
+ justifyContent: "space-between",
1660
+ alignItems: "center",
1661
+ padding: "4px 16px",
1662
+ boxShadow: "0px 1px 2px #f5f5f5ff"
1663
+ },
1664
+ children: [
1665
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { variant: "body1", children: " Process List" }),
1666
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
1667
+ ]
1668
+ }
1669
+ ),
1670
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1671
+ import_material3.Box,
1672
+ {
1673
+ sx: {
1674
+ boxShadow: "1px 1px 4px #d3d3d3ff",
1675
+ padding: "6px 10px",
1676
+ margin: "10px",
1677
+ borderRadius: "10px"
1678
+ },
1679
+ children: (processList == null ? void 0 : processList.length) > 0 ? processList == null ? void 0 : processList.map((process, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1680
+ import_material3.Box,
1681
+ {
1682
+ sx: {
1683
+ p: 1,
1684
+ display: "flex",
1685
+ alignItems: "center",
1686
+ boxShadow: "1px 1px 4px #d3d3d3ff",
1687
+ padding: "6px",
1688
+ margin: "10px 0px",
1689
+ borderRadius: "10px",
1690
+ cursor: "pointer",
1691
+ "&:hover": { bgcolor: "action.selected" }
1692
+ },
1693
+ onClick: () => {
1694
+ handleSelectedProcessor(process);
1695
+ },
1696
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1697
+ import_material3.Typography,
1698
+ {
1699
+ variant: "body1",
1700
+ sx: {
1701
+ mx: 1,
1702
+ width: "200px",
1703
+ maxWidth: "250px",
1704
+ display: "flex",
1705
+ alignItems: "center"
1706
+ },
1707
+ children: [
1708
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
1709
+ process.process_name
1710
+ ]
1711
+ }
1712
+ )
1713
+ },
1714
+ index
1715
+ )) : null
1716
+ }
1717
+ )
1718
+ ] })
1719
+ }
1720
+ ) });
1721
+ }
1722
+ function CallHistoryDialog({ open, setOpen }) {
1723
+ const handleClose = () => {
1724
+ setOpen(false);
1725
+ };
1726
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1727
+ import_material3.Dialog,
1728
+ {
1729
+ open,
1730
+ "aria-labelledby": "alert-dialog-title",
1731
+ "aria-describedby": "alert-dialog-description",
1732
+ fullWidth: true,
1733
+ maxWidth: "md",
1734
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
1735
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1736
+ import_material3.Box,
1737
+ {
1738
+ sx: {
1739
+ display: "flex",
1740
+ justifyContent: "space-between",
1741
+ alignItems: "center",
1742
+ padding: "4px 16px",
1743
+ boxShadow: "0px 1px 2px #f5f5f5ff"
1744
+ },
1745
+ children: [
1746
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { variant: "body1", children: " Call History" }),
1747
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
1748
+ ]
1749
+ }
1750
+ ),
1751
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1752
+ import_material3.Box,
1753
+ {
1754
+ sx: {
1755
+ boxShadow: "1px 1px 4px #d3d3d3ff",
1756
+ margin: "10px",
1757
+ borderRadius: "10px",
1758
+ textAlign: "center",
1759
+ fontSize: "16px",
1760
+ fontWeight: "bold"
1761
+ },
1762
+ p: 6,
1763
+ children: "Comming Soon..."
1764
+ }
1765
+ )
1766
+ ] })
1767
+ }
1768
+ ) });
1769
+ }
1203
1770
 
1204
1771
  // call-control-sdk/lib/components/callControlPanel.tsx
1205
1772
  var import_jsx_runtime3 = require("react/jsx-runtime");
1206
1773
  function CallControlPanel({ onDataChange }) {
1207
- const theme = (0, import_material3.useTheme)();
1774
+ var _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, _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;
1775
+ const theme = (0, import_material4.useTheme)();
1776
+ const { disabled, enabled, outlined } = styles_default();
1208
1777
  const state = useSDKState();
1209
1778
  const { showToast } = useToast();
1779
+ const webSocketRef = (0, import_react6.useRef)(null);
1210
1780
  const [anchorEl, setAnchorEl] = (0, import_react6.useState)(null);
1211
1781
  const [showIframe, setShowIframe] = (0, import_react6.useState)(true);
1212
- const [statusAnchorEl, setStatusAnchorEl] = (0, import_react6.useState)(
1213
- null
1214
- );
1215
- const [dialerAnchorEl, setDialerAnchorEl] = (0, import_react6.useState)(
1216
- null
1217
- );
1782
+ const [statusAnchorEl, setStatusAnchorEl] = (0, import_react6.useState)(null);
1783
+ const [dialerAnchorEl, setDialerAnchorEl] = (0, import_react6.useState)(null);
1218
1784
  const [open, setOpen] = (0, import_react6.useState)(false);
1219
1785
  const [openCallTransfer, setOpenCallTransfer] = (0, import_react6.useState)(false);
1220
1786
  const [openCallDisposition, setOpenCallDisposition] = (0, import_react6.useState)(false);
1787
+ const [openProcessorDialog, setOpenProcessorDialog] = (0, import_react6.useState)(false);
1788
+ const [openCallHistoryDialog, setOpenCallHistoryDialog] = (0, import_react6.useState)(false);
1221
1789
  const [phoneNumber, setPhoneNumber] = (0, import_react6.useState)("");
1222
1790
  const [callDuration, setCallDuration] = (0, import_react6.useState)(0);
1223
1791
  const { position, isDragging, dragRef, handleMouseDown, handleTouchStart } = useDraggable(
@@ -1234,39 +1802,46 @@ function CallControlPanel({ onDataChange }) {
1234
1802
  state.iframePosition,
1235
1803
  (newPosition) => sdkStateManager.setIframePosition(newPosition)
1236
1804
  );
1805
+ const [getProcessList, { data: processList }] = usePostRequest({
1806
+ onSuccess: (res) => {
1807
+ var _a2;
1808
+ console.log("res", res);
1809
+ if (res && res.processes && ((_a2 = res == null ? void 0 : res.processes) == null ? void 0 : _a2.length) > 1) {
1810
+ setOpenProcessorDialog(true);
1811
+ } else {
1812
+ sdkStateManager.setProcess(res == null ? void 0 : res.processes[0]);
1813
+ setOpenProcessorDialog(false);
1814
+ }
1815
+ },
1816
+ onError: () => {
1817
+ setOpenProcessorDialog(false);
1818
+ }
1819
+ });
1237
1820
  const [clickToCall] = usePostRequest();
1238
- const [holdOrUnHold] = usePostRequest();
1239
- const [muteOrUnMute] = usePostRequest();
1821
+ const [holdOrUnHold] = usePostRequest({
1822
+ onSuccess: () => {
1823
+ sdkStateManager.setHolding(!state.isHolding);
1824
+ },
1825
+ onError: (error) => {
1826
+ console.log("error", error);
1827
+ }
1828
+ });
1829
+ const [muteOrUnMute] = usePostRequest({
1830
+ onSuccess: () => {
1831
+ sdkStateManager.setMuted(!state.isMuted);
1832
+ },
1833
+ onError: (error) => {
1834
+ console.log("error", error);
1835
+ }
1836
+ });
1240
1837
  const [readyAgentStatus] = usePostRequest();
1241
1838
  const [updateAgentStatus] = usePostRequest();
1242
1839
  const [endCall] = usePostRequest();
1243
- (0, import_react6.useEffect)(() => {
1244
- let interval;
1245
- if (state.callStartTime) {
1246
- interval = setInterval(() => {
1247
- const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
1248
- setCallDuration(elapsed);
1249
- }, 1e3);
1250
- } else {
1251
- setCallDuration(0);
1252
- }
1253
- return () => {
1254
- if (interval) clearInterval(interval);
1255
- };
1256
- }, [state.callStartTime]);
1257
- (0, import_react6.useEffect)(() => {
1258
- if (onDataChange) {
1259
- onDataChange(state.callData);
1260
- }
1261
- }, [state.callData, onDataChange]);
1262
1840
  const formatDuration = (0, import_react6.useCallback)((seconds) => {
1263
1841
  const mins = Math.floor(seconds / 60);
1264
1842
  const secs = seconds % 60;
1265
1843
  return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
1266
1844
  }, []);
1267
- const handleOpenQueueCounts = (event) => {
1268
- setAnchorEl(event.currentTarget);
1269
- };
1270
1845
  const handleCloseQueueCounts = () => {
1271
1846
  setAnchorEl(null);
1272
1847
  };
@@ -1287,24 +1862,19 @@ function CallControlPanel({ onDataChange }) {
1287
1862
  const handleCloseAgentStatus = () => {
1288
1863
  setStatusAnchorEl(null);
1289
1864
  };
1290
- const handleAgentReady = (status) => {
1865
+ const handleAgentReady = () => {
1291
1866
  const payload = {
1292
1867
  action: "READYAGENT",
1293
- username: "string",
1294
- refno: "string"
1868
+ userId: state.agentId
1295
1869
  };
1296
1870
  readyAgentStatus(END_POINT.READY_AGENT, payload);
1297
- sdkStateManager.setStatus(status);
1298
1871
  };
1299
1872
  const handleUpdateAgentStatus = (status) => {
1300
- sdkStateManager.setStatus(status);
1301
1873
  setStatusAnchorEl(null);
1302
1874
  const payload = {
1303
- action: "AGENTSTATUS",
1304
- phone_number: "string",
1305
- refno: "string",
1306
- username: "string",
1307
- ticket_id: 0
1875
+ action: "AGENTBREAK",
1876
+ break_type: status,
1877
+ userId: state.agentId
1308
1878
  };
1309
1879
  updateAgentStatus(END_POINT.UPDATE_AGENT_BREAK, payload);
1310
1880
  };
@@ -1318,415 +1888,423 @@ function CallControlPanel({ onDataChange }) {
1318
1888
  const payload = {
1319
1889
  action: "CALL",
1320
1890
  phone_number: number,
1321
- refno: "string",
1322
- username: "string",
1323
- ticket_id: 0
1891
+ userId: state.agentId
1324
1892
  };
1325
1893
  clickToCall(END_POINT.CLICK_TO_CALL, payload);
1326
- sdkStateManager.startCall();
1327
1894
  }
1328
1895
  };
1329
1896
  const handleHoldToggle = () => {
1330
1897
  const payload = {
1331
1898
  action: state.isHolding ? "UNHOLD" : "HOLD",
1332
- username: "string",
1333
- refno: "string"
1899
+ userId: state.agentId
1334
1900
  };
1335
1901
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
1336
- sdkStateManager.setHolding(!state.isHolding);
1337
1902
  };
1338
1903
  const handleMuteToggle = () => {
1339
1904
  const payload = {
1340
1905
  action: state.isMuted ? "UNMUTE" : "MUTE",
1341
- username: "string",
1342
- refno: "string"
1906
+ userId: state.agentId
1343
1907
  };
1344
- if (state.isMuted) {
1345
- muteOrUnMute(END_POINT.UNMUTE_CALL, payload);
1346
- } else {
1347
- muteOrUnMute(END_POINT.MUTE_CALL, payload);
1348
- }
1349
- sdkStateManager.setMuted(!state.isMuted);
1908
+ muteOrUnMute(END_POINT.MUTE_CALL, payload);
1350
1909
  };
1351
1910
  const handleEndCall = (data) => {
1352
- var _a, _b, _c, _d, _e, _f, _g;
1353
- console.log(data);
1911
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
1912
+ console.log("data", data);
1354
1913
  const payload = {
1355
1914
  action: "ENDCALL",
1356
- convoxid: "string",
1357
- username: "string",
1358
- processid: "101",
1359
- mobile_number: "string",
1360
- refno: "string",
1361
- disposition: (_b = (_a = data == null ? void 0 : data.disposition) == null ? void 0 : _a.label) != null ? _b : "",
1362
- set_followUp: (_d = (_c = data == null ? void 0 : data.followUp) == null ? void 0 : _c.label) != null ? _d : "",
1363
- callback_date: (_e = data == null ? void 0 : data.callbackDate) != null ? _e : "",
1364
- callback_hrs: (_f = data == null ? void 0 : data.callbackHrs) != null ? _f : "",
1365
- callback_mins: (_g = data == null ? void 0 : data.callbackMins) != null ? _g : ""
1915
+ userId: state.agentId,
1916
+ processid: (_c2 = (_b2 = (_a2 = state.process) == null ? void 0 : _a2.process_id) == null ? void 0 : _b2.toString()) != null ? _c2 : "",
1917
+ process_name: (_e2 = (_d2 = state.process) == null ? void 0 : _d2.process_name) != null ? _e2 : "",
1918
+ callreferenceid: (_g2 = (_f2 = state.callData) == null ? void 0 : _f2.convox_id) != null ? _g2 : "",
1919
+ mobile_number: (_i2 = (_h2 = state.callData) == null ? void 0 : _h2.phone_number) != null ? _i2 : "",
1920
+ disposition: (_k2 = (_j2 = data == null ? void 0 : data.disposition) == null ? void 0 : _j2.value) != null ? _k2 : "",
1921
+ set_followUp: (_m2 = (_l2 = data == null ? void 0 : data.followUp) == null ? void 0 : _l2.value) != null ? _m2 : "",
1922
+ callback_date: (_n2 = data == null ? void 0 : data.callbackDate) != null ? _n2 : "",
1923
+ callback_hrs: (_o2 = data == null ? void 0 : data.callbackHrs) != null ? _o2 : "",
1924
+ callback_mins: (_p2 = data == null ? void 0 : data.callbackMins) != null ? _p2 : "",
1925
+ endcall_type: "CLOSE"
1366
1926
  };
1367
1927
  setPhoneNumber("");
1368
1928
  endCall(END_POINT.END_CALL, payload);
1369
1929
  sdkStateManager.endCall();
1370
1930
  setOpenCallDisposition(false);
1371
1931
  };
1372
- if (!state.isInitialized) {
1373
- return null;
1932
+ (0, import_react6.useEffect)(() => {
1933
+ let interval;
1934
+ if (state.callData.status && state.callData.status === "ONCALL") {
1935
+ interval = setInterval(() => {
1936
+ const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
1937
+ setCallDuration(elapsed);
1938
+ }, 1e3);
1939
+ } else {
1940
+ setCallDuration(0);
1941
+ }
1942
+ return () => {
1943
+ if (interval) clearInterval(interval);
1944
+ };
1945
+ }, [state.callData.status]);
1946
+ (0, import_react6.useEffect)(() => {
1947
+ if (onDataChange) {
1948
+ onDataChange(state.callData);
1949
+ }
1950
+ }, [state.callData, onDataChange]);
1951
+ (0, import_react6.useEffect)(() => {
1952
+ if (state.agentId) {
1953
+ getProcessList(END_POINT.PROCESS_LIST, {
1954
+ userId: state.agentId,
1955
+ action: "GETAGENTPROCESSLIST",
1956
+ refno: "1234221233"
1957
+ });
1958
+ } else {
1959
+ console.log("No agentId available, skipping API call");
1960
+ }
1961
+ }, [state.agentId]);
1962
+ (0, import_react6.useEffect)(() => {
1963
+ if (state.agentId) {
1964
+ webSocketRef.current = new WebSocket(`${WS_END_POINT.WS}?agent_id=${state.agentId}`);
1965
+ webSocketRef.current.onopen = () => {
1966
+ console.log("WebSocket connection established");
1967
+ };
1968
+ webSocketRef.current.onmessage = (event) => {
1969
+ try {
1970
+ const data = JSON.parse(event.data);
1971
+ console.log("parsedJSON:", data);
1972
+ sdkStateManager.updateCallData(data);
1973
+ if (data.status === "ONCALL") {
1974
+ sdkStateManager.startCall();
1975
+ }
1976
+ if (data.status === "WRAPUP") {
1977
+ sdkStateManager.endCall();
1978
+ }
1979
+ } catch (e) {
1980
+ console.log("Raw message:", event.data);
1981
+ }
1982
+ };
1983
+ webSocketRef.current.onclose = () => {
1984
+ console.log("WebSocket connection closed");
1985
+ };
1986
+ webSocketRef.current.onerror = (error) => {
1987
+ console.error("WebSocket error:", error);
1988
+ };
1989
+ }
1990
+ return () => {
1991
+ var _a2;
1992
+ (_a2 = webSocketRef.current) == null ? void 0 : _a2.close();
1993
+ };
1994
+ }, [state.agentId]);
1995
+ if (!state.isInitialized || !state.process) {
1996
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { children: Boolean(openProcessorDialog) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1997
+ ProcessorListDialog,
1998
+ {
1999
+ processList: processList == null ? void 0 : processList.processes,
2000
+ open: openProcessorDialog,
2001
+ setOpen: setOpenProcessorDialog,
2002
+ handleSelectedProcessor: (data) => {
2003
+ sdkStateManager.setProcess(data);
2004
+ }
2005
+ }
2006
+ ) });
1374
2007
  }
1375
2008
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1376
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Fade, { in: true, timeout: 300, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1377
- import_material3.Paper,
2009
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2010
+ import_material4.Fade,
1378
2011
  {
1379
- ref: dragRef,
1380
- elevation: isDragging ? 4 : 1,
1381
- sx: {
1382
- position: "fixed",
1383
- left: position.x,
1384
- top: position.y,
1385
- p: 1,
1386
- borderRadius: 3,
1387
- bgcolor: "background.paper",
1388
- zIndex: 99999,
1389
- transition: theme.transitions.create(["box-shadow", "transform"], {
1390
- duration: theme.transitions.duration.short
1391
- }),
1392
- minWidth: 320,
1393
- userSelect: "none"
1394
- },
1395
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1396
- import_material3.Box,
2012
+ in: true,
2013
+ timeout: 300,
2014
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2015
+ import_material4.Paper,
1397
2016
  {
2017
+ ref: dragRef,
2018
+ elevation: isDragging ? 4 : 1,
1398
2019
  sx: {
1399
- display: "flex",
1400
- alignItems: "center"
2020
+ position: "fixed",
2021
+ left: position.x,
2022
+ top: position.y,
2023
+ p: 0.5,
2024
+ borderRadius: 3,
2025
+ bgcolor: "background.paper",
2026
+ zIndex: 99999,
2027
+ transition: theme.transitions.create(["box-shadow", "transform"], {
2028
+ duration: theme.transitions.duration.short
2029
+ }),
2030
+ userSelect: "none"
1401
2031
  },
1402
- children: [
1403
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1404
- import_material3.Box,
1405
- {
1406
- sx: {
1407
- display: "flex",
1408
- justifyContent: "space-between",
1409
- alignItems: "center"
1410
- },
1411
- children: [
1412
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1413
- import_material3.Typography,
1414
- {
1415
- variant: "h6",
1416
- sx: {
1417
- color: state.status === "on call" ? "success.main" : "text.secondary",
1418
- marginRight: "8px",
1419
- display: "flex",
1420
- justifyContent: "space-between",
1421
- alignItems: "center"
1422
- },
1423
- children: [
1424
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1425
- import_material3.IconButton,
1426
- {
1427
- component: "div",
1428
- sx: {
1429
- cursor: "all-scroll"
1430
- },
1431
- onMouseDown: handleMouseDown,
1432
- onTouchStart: handleTouchStart,
1433
- children: [
1434
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.DragIndicator, {}),
1435
- " "
1436
- ]
1437
- }
1438
- ),
1439
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1440
- import_material3.Box,
1441
- {
1442
- sx: {
1443
- marginRight: "10px"
1444
- },
1445
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: "Dial", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1446
- import_material3.IconButton,
1447
- {
1448
- onClick: (e) => {
1449
- if (state.status !== "on call" && state.status !== "break") {
1450
- handleOpenDialer(e);
1451
- }
1452
- },
1453
- sx: {
1454
- bgcolor: "action.hover",
1455
- "&:hover": {
1456
- bgcolor: "warning"
1457
- }
1458
- },
1459
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1460
- import_icons_material2.WifiCalling3,
1461
- {
1462
- sx: {
1463
- color: state.status === "on call" || state.status === "break" ? "action.selected" : "success.main"
1464
- }
2032
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2033
+ import_material4.Box,
2034
+ {
2035
+ sx: {
2036
+ display: "flex",
2037
+ alignItems: "center"
2038
+ },
2039
+ children: [
2040
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2041
+ import_material4.Box,
2042
+ {
2043
+ sx: {
2044
+ display: "flex",
2045
+ justifyContent: "space-between",
2046
+ alignItems: "center"
2047
+ },
2048
+ children: [
2049
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2050
+ import_material4.IconButton,
2051
+ {
2052
+ component: "div",
2053
+ size: "small",
2054
+ sx: {
2055
+ cursor: "all-scroll"
2056
+ },
2057
+ onMouseDown: handleMouseDown,
2058
+ onTouchStart: handleTouchStart,
2059
+ children: [
2060
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.DragIndicator, {}),
2061
+ " "
2062
+ ]
2063
+ }
2064
+ ),
2065
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2066
+ import_material4.Box,
2067
+ {
2068
+ sx: {
2069
+ marginRight: "10px"
2070
+ },
2071
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Dial", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2072
+ import_material4.IconButton,
2073
+ {
2074
+ size: "small",
2075
+ onClick: (e) => {
2076
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
2077
+ if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.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") {
2078
+ handleOpenDialer(e);
2079
+ }
2080
+ },
2081
+ sx: {
2082
+ bgcolor: "action.hover",
2083
+ "&:hover": {
2084
+ bgcolor: "warning"
2085
+ }
2086
+ },
2087
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2088
+ import_icons_material2.WifiCalling3,
2089
+ {
2090
+ sx: {
2091
+ color: ((_b = (_a = state.callData) == null ? void 0 : _a.status) == null ? void 0 : _b.toUpperCase()) === "ONCALL" || ((_d = (_c = state.callData) == null ? void 0 : _c.status) == null ? void 0 : _d.toUpperCase()) === "BREAK" || ((_f = (_e = state.callData) == null ? void 0 : _e.status) == null ? void 0 : _f.toUpperCase()) === "RINGING" || ((_h = (_g = state.callData) == null ? void 0 : _g.status) == null ? void 0 : _h.toUpperCase()) === "WRAPUP" ? "action.selected" : "success.main"
1465
2092
  }
1466
- )
1467
- }
1468
- ) })
1469
- }
1470
- ),
1471
- formatDuration(callDuration)
1472
- ]
1473
- }
1474
- ),
1475
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1476
- import_material3.ButtonGroup,
1477
- {
1478
- disableElevation: true,
1479
- variant: "contained",
1480
- "aria-label": "Disabled button group",
1481
- sx: {
1482
- marginRight: "10px"
1483
- },
1484
- children: [
1485
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1486
- import_material3.Button,
1487
- {
1488
- sx: {
1489
- fontWeight: "bold",
1490
- borderRadius: "16px",
1491
- display: "flex",
1492
- alignItems: "center",
1493
- justifyContent: "space-between"
1494
- },
1495
- variant: "outlined",
1496
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1497
- import_material3.Typography,
1498
- {
1499
- width: 70,
1500
- variant: "body2",
1501
- sx: {
1502
- fontWeight: "bold"
1503
- },
1504
- children: state.status.toUpperCase()
1505
- }
1506
- )
1507
- }
1508
- ),
1509
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1510
- import_material3.Button,
1511
- {
1512
- sx: {
1513
- borderRadius: "16px",
1514
- width: 20
1515
- },
1516
- variant: "outlined",
1517
- onClick: handleOpenAgentStatus,
1518
- disabled: Boolean(state.callStartTime),
1519
- children: [
1520
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.ArrowDropDown, {}),
1521
- " "
1522
- ]
1523
- }
1524
- )
1525
- ]
1526
- }
1527
- )
1528
- ]
1529
- }
1530
- ),
1531
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1532
- import_material3.Box,
1533
- {
1534
- sx: {
1535
- display: "flex",
1536
- gap: 1,
1537
- justifyContent: "center",
1538
- alignItems: "center"
1539
- },
1540
- children: [
1541
- state.status === "break" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: "Agent Ready", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1542
- import_material3.IconButton,
1543
- {
1544
- onClick: (e) => {
1545
- e.stopPropagation();
1546
- handleAgentReady("idle");
1547
- },
1548
- color: "default",
1549
- sx: {
1550
- bgcolor: "error.dark",
1551
- "&:hover": {
1552
- bgcolor: "error.light"
2093
+ }
2094
+ )
2095
+ }
2096
+ ) })
1553
2097
  }
1554
- },
1555
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1556
- import_icons_material2.SupportAgent,
2098
+ ),
2099
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2100
+ import_material4.Typography,
1557
2101
  {
1558
2102
  sx: {
1559
- color: "white"
1560
- }
2103
+ color: "success.main",
2104
+ width: "40px",
2105
+ marginRight: "10px"
2106
+ },
2107
+ children: formatDuration(callDuration)
2108
+ }
2109
+ ),
2110
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2111
+ import_material4.Typography,
2112
+ {
2113
+ variant: "body2",
2114
+ sx: {
2115
+ fontWeight: "bold"
2116
+ },
2117
+ children: (_k = (_j = (_i = state.callData) == null ? void 0 : _i.status) == null ? void 0 : _j.toUpperCase()) != null ? _k : "N/A"
2118
+ }
2119
+ ),
2120
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2121
+ import_material4.Button,
2122
+ {
2123
+ size: "small",
2124
+ variant: "text",
2125
+ onClick: handleOpenAgentStatus,
2126
+ disabled: Boolean(state.callStartTime),
2127
+ children: [
2128
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.ArrowDropDown, {}),
2129
+ " "
2130
+ ]
1561
2131
  }
1562
2132
  )
1563
- }
1564
- ) }),
1565
- state.status === "wrap up" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: "Redial", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1566
- import_material3.IconButton,
1567
- {
1568
- onClick: (e) => {
1569
- e.stopPropagation();
1570
- },
1571
- color: "default",
1572
- sx: {
1573
- bgcolor: "action.hover",
1574
- "&:hover": {
1575
- bgcolor: "warning"
2133
+ ]
2134
+ }
2135
+ ),
2136
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2137
+ import_material4.Box,
2138
+ {
2139
+ sx: {
2140
+ display: "flex",
2141
+ gap: 1,
2142
+ justifyContent: "center",
2143
+ alignItems: "center"
2144
+ },
2145
+ children: [
2146
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Agent Ready", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2147
+ import_material4.Button,
2148
+ {
2149
+ variant: ((_m = (_l = state.callData) == null ? void 0 : _l.status) == null ? void 0 : _m.toUpperCase()) === "BREAK" || ((_o = (_n = state.callData) == null ? void 0 : _n.status) == null ? void 0 : _o.toUpperCase()) === "MISSED" ? "outlined" : "contained",
2150
+ onClick: (e) => {
2151
+ var _a2, _b2, _c2, _d2;
2152
+ if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) === "BREAK" || ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) === "MISSED") {
2153
+ e.stopPropagation();
2154
+ handleAgentReady();
2155
+ }
2156
+ },
2157
+ classes: {
2158
+ root: ((_q = (_p = state.callData) == null ? void 0 : _p.status) == null ? void 0 : _q.toUpperCase()) === "BREAK" || ((_s = (_r = state.callData) == null ? void 0 : _r.status) == null ? void 0 : _s.toUpperCase()) === "MISSED" ? "outlined" : "enabled"
2159
+ },
2160
+ sx: __spreadValues({}, ((_u = (_t = state.callData) == null ? void 0 : _t.status) == null ? void 0 : _u.toUpperCase()) === "BREAK" || ((_w = (_v = state.callData) == null ? void 0 : _v.status) == null ? void 0 : _w.toUpperCase()) === "MISSED" ? outlined : enabled),
2161
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SupportAgent, {})
1576
2162
  }
1577
- },
1578
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Tty, {})
1579
- }
1580
- ) }),
1581
- state.status === "on call" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: state.isHolding ? "Resume" : "Hold", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1582
- import_material3.IconButton,
1583
- {
1584
- onClick: (e) => {
1585
- e.stopPropagation();
1586
- handleHoldToggle();
1587
- },
1588
- color: state.isHolding ? "warning" : "default",
1589
- sx: {
1590
- bgcolor: state.isHolding ? "warning.info" : "action.hover"
1591
- },
1592
- children: state.isHolding ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PlayCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PauseCircle, {})
1593
- }
1594
- ) }),
1595
- state.status === "on call" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: state.isMuted ? "Unmute" : "Mute", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1596
- import_material3.IconButton,
1597
- {
1598
- onClick: (e) => {
1599
- e.stopPropagation();
1600
- handleMuteToggle();
1601
- },
1602
- color: state.isMuted ? "error" : "default",
1603
- sx: {
1604
- bgcolor: state.isMuted ? "error.info" : "action.hover"
1605
- },
1606
- children: state.isMuted ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Mic, {})
1607
- }
1608
- ) }),
1609
- state.status !== "on call" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: "Queue", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1610
- import_material3.IconButton,
1611
- {
1612
- onClick: (e) => {
1613
- e.stopPropagation();
1614
- handleOpenQueueCounts(e);
1615
- },
1616
- color: "default",
1617
- sx: {
1618
- bgcolor: "action.hover",
1619
- "&:hover": {
1620
- bgcolor: "warning"
2163
+ ) }),
2164
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: state.isHolding ? "Resume" : "Hold", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2165
+ import_material4.Button,
2166
+ {
2167
+ variant: state.isHolding && ((_y = (_x = state.callData) == null ? void 0 : _x.status) == null ? void 0 : _y.toUpperCase()) === "ONCALL" ? "contained" : "outlined",
2168
+ onClick: (e) => {
2169
+ e.stopPropagation();
2170
+ handleHoldToggle();
2171
+ },
2172
+ sx: state.isHolding && ((_A = (_z = state.callData) == null ? void 0 : _z.status) == null ? void 0 : _A.toUpperCase()) === "ONCALL" ? __spreadValues({}, enabled) : ((_C = (_B = state.callData) == null ? void 0 : _B.status) == null ? void 0 : _C.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
2173
+ disabled: ((_E = (_D = state.callData) == null ? void 0 : _D.status) == null ? void 0 : _E.toUpperCase()) !== "ONCALL" && !state.isHolding,
2174
+ children: state.isHolding ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Pause, {})
1621
2175
  }
1622
- },
1623
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Layers, {})
1624
- }
1625
- ) }),
1626
- state.status === "on call" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1627
- import_material3.IconButton,
1628
- {
1629
- onClick: (e) => {
1630
- e.stopPropagation();
1631
- setOpenCallTransfer(true);
1632
- },
1633
- color: "default",
1634
- sx: {
1635
- bgcolor: "action.hover",
1636
- "&:hover": {
1637
- bgcolor: "warning"
2176
+ ) }),
2177
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: state.isMuted ? "Unmute" : "Mute", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2178
+ import_material4.Button,
2179
+ {
2180
+ variant: state.isMuted && ((_G = (_F = state.callData) == null ? void 0 : _F.status) == null ? void 0 : _G.toUpperCase()) === "ONCALL" ? "contained" : "outlined",
2181
+ onClick: (e) => {
2182
+ e.stopPropagation();
2183
+ handleMuteToggle();
2184
+ },
2185
+ sx: state.isMuted && ((_I = (_H = state.callData) == null ? void 0 : _H.status) == null ? void 0 : _I.toUpperCase()) === "ONCALL" ? __spreadValues({}, enabled) : ((_K = (_J = state.callData) == null ? void 0 : _J.status) == null ? void 0 : _K.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
2186
+ disabled: ((_M = (_L = state.callData) == null ? void 0 : _L.status) == null ? void 0 : _M.toUpperCase()) !== "ONCALL" && !state.isMuted,
2187
+ children: state.isMuted ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Mic, {})
1638
2188
  }
1639
- },
1640
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {})
1641
- }
1642
- ) }),
1643
- state.status === "on call" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1644
- import_material3.IconButton,
1645
- {
1646
- onClick: (e) => {
1647
- e.stopPropagation();
1648
- setOpen(true);
1649
- },
1650
- color: "default",
1651
- sx: {
1652
- bgcolor: "action.hover",
1653
- "&:hover": {
1654
- bgcolor: "warning"
2189
+ ) }),
2190
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Transfer Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2191
+ import_material4.Button,
2192
+ {
2193
+ variant: openCallTransfer ? "contained" : "outlined",
2194
+ onClick: (e) => {
2195
+ var _a2, _b2;
2196
+ if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
2197
+ e.stopPropagation();
2198
+ setOpenCallTransfer(true);
2199
+ }
2200
+ },
2201
+ sx: openCallTransfer ? __spreadValues({}, enabled) : ((_O = (_N = state.callData) == null ? void 0 : _N.status) == null ? void 0 : _O.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
2202
+ disabled: ((_Q = (_P = state.callData) == null ? void 0 : _P.status) == null ? void 0 : _Q.toUpperCase()) !== "ONCALL",
2203
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {})
1655
2204
  }
1656
- },
1657
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Groups, {})
1658
- }
1659
- ) }),
1660
- state.status === "on call" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1661
- import_material3.Tooltip,
1662
- {
1663
- title: state.status === "on call" ? "End Call" : "Start Call",
1664
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1665
- import_material3.IconButton,
2205
+ ) }),
2206
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2207
+ import_material4.Button,
2208
+ {
2209
+ variant: open ? "contained" : "outlined",
2210
+ onClick: (e) => {
2211
+ var _a2, _b2;
2212
+ if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
2213
+ e.stopPropagation();
2214
+ setOpen(true);
2215
+ }
2216
+ },
2217
+ sx: open ? __spreadValues({}, enabled) : ((_S = (_R = state.callData) == null ? void 0 : _R.status) == null ? void 0 : _S.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
2218
+ disabled: ((_U = (_T = state.callData) == null ? void 0 : _T.status) == null ? void 0 : _U.toUpperCase()) !== "ONCALL",
2219
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Group, {})
2220
+ }
2221
+ ) }),
2222
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Call History", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2223
+ import_material4.Button,
1666
2224
  {
2225
+ variant: openCallHistoryDialog ? "contained" : "outlined",
1667
2226
  onClick: (e) => {
1668
2227
  e.stopPropagation();
1669
- setOpenCallDisposition(true);
2228
+ setOpenCallHistoryDialog(true);
1670
2229
  },
1671
- color: "error",
1672
- sx: {
1673
- bgcolor: state.status === "on call" ? "error.main" : "gray",
1674
- color: "white",
1675
- "&:hover": {
1676
- bgcolor: state.status === "on call" ? "error.light" : "gray"
2230
+ sx: openCallHistoryDialog ? __spreadValues({}, enabled) : __spreadValues({}, outlined),
2231
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.History, {})
2232
+ }
2233
+ ) }),
2234
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2235
+ import_material4.Button,
2236
+ {
2237
+ variant: ((_W = (_V = state.callData) == null ? void 0 : _V.status) == null ? void 0 : _W.toUpperCase()) === "ONCALL" || ((_Y = (_X = state.callData) == null ? void 0 : _X.status) == null ? void 0 : _Y.toUpperCase()) === "RINGING" || ((__ = (_Z = state.callData) == null ? void 0 : _Z.status) == null ? void 0 : __.toUpperCase()) === "WRAPUP" ? "contained" : "outlined",
2238
+ onClick: (e) => {
2239
+ var _a2, _b2, _c2, _d2, _e2, _f2;
2240
+ if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.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") {
2241
+ e.stopPropagation();
2242
+ setOpenCallDisposition(true);
1677
2243
  }
1678
2244
  },
2245
+ sx: ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" || ((_ca = (_ba = state.callData) == null ? void 0 : _ba.status) == null ? void 0 : _ca.toUpperCase()) === "RINGING" || ((_ea = (_da = state.callData) == null ? void 0 : _da.status) == null ? void 0 : _ea.toUpperCase()) === "WRAPUP" ? __spreadProps(__spreadValues({}, enabled), {
2246
+ borderRight: "1px",
2247
+ backgroundColor: "error.main",
2248
+ minWidth: "60px !important",
2249
+ boxShadow: " 0px 2px 1px #5f3f3f",
2250
+ border: `1px solid ${theme.palette.error.light}`,
2251
+ height: "40px",
2252
+ "&:hover": {
2253
+ bgcolor: "error.light",
2254
+ boxShadow: " 0px 2px 1px #5f3f3f",
2255
+ border: `0px solid ${theme.palette.error.light}`
2256
+ },
2257
+ "&:active": {
2258
+ bgcolor: "error.light",
2259
+ boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
2260
+ }
2261
+ }) : __spreadProps(__spreadValues({}, disabled), {
2262
+ minWidth: "60px !important"
2263
+ }),
2264
+ disabled: ((_ga = (_fa = state.callData) == null ? void 0 : _fa.status) == null ? void 0 : _ga.toUpperCase()) !== "ONCALL" && ((_ia = (_ha = state.callData) == null ? void 0 : _ha.status) == null ? void 0 : _ia.toUpperCase()) !== "RINGING" && ((_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()) !== "WRAPUP",
1679
2265
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.CallEnd, {})
1680
2266
  }
1681
- )
1682
- }
1683
- )
1684
- ]
1685
- }
1686
- )
1687
- ]
2267
+ ) })
2268
+ ]
2269
+ }
2270
+ )
2271
+ ]
2272
+ }
2273
+ )
1688
2274
  }
1689
2275
  )
1690
2276
  }
1691
- ) }),
1692
- Boolean(showIframe) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Fade, { in: true, timeout: 300, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1693
- import_material3.Paper,
2277
+ ),
2278
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2279
+ import_material4.Fade,
1694
2280
  {
1695
- ref: iframeDragRef,
1696
- elevation: iframeIsDragging ? 4 : 1,
1697
- sx: {
1698
- position: "fixed",
1699
- left: iframePosition.x,
1700
- top: iframePosition.y,
1701
- p: 1,
1702
- height: "auto",
1703
- borderRadius: 2,
1704
- bgcolor: "background.paper",
1705
- zIndex: 99999,
1706
- transition: theme.transitions.create(
1707
- ["box-shadow", "transform"],
1708
- {
1709
- duration: theme.transitions.duration.short
1710
- }
1711
- ),
1712
- userSelect: "none"
1713
- },
2281
+ in: true,
2282
+ timeout: 300,
1714
2283
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1715
- import_material3.Box,
2284
+ import_material4.Paper,
1716
2285
  {
2286
+ ref: iframeDragRef,
2287
+ elevation: iframeIsDragging ? 4 : 1,
1717
2288
  sx: {
1718
- display: "flex",
1719
- alignItems: "center",
1720
- justifyContent: "center",
1721
- flexDirection: "column"
2289
+ position: "fixed",
2290
+ left: iframePosition.x,
2291
+ top: iframePosition.y,
2292
+ p: 1,
2293
+ height: "auto",
2294
+ borderRadius: 2,
2295
+ bgcolor: "background.paper",
2296
+ zIndex: 99999,
2297
+ transition: theme.transitions.create(["box-shadow", "transform"], {
2298
+ duration: theme.transitions.duration.short
2299
+ }),
2300
+ visibility: showIframe ? "visible" : "hidden",
2301
+ userSelect: "none"
1722
2302
  },
1723
2303
  children: [
1724
2304
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1725
- import_material3.Box,
2305
+ import_material4.Box,
1726
2306
  {
1727
2307
  sx: {
1728
- width: "100%",
1729
- height: "auto",
1730
2308
  display: "flex",
1731
2309
  alignItems: "center",
1732
2310
  justifyContent: "space-between",
@@ -1744,25 +2322,26 @@ function CallControlPanel({ onDataChange }) {
1744
2322
  }
1745
2323
  ),
1746
2324
  " ",
1747
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.IconButton, { onClick: () => setShowIframe(false), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Close, {}) })
2325
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.IconButton, { onClick: () => setShowIframe(false), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Close, {}) })
1748
2326
  ]
1749
2327
  }
1750
2328
  ),
1751
2329
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1752
2330
  "iframe",
1753
2331
  {
1754
- src: "https://h68.deepijatel.in/ConVoxCCS/iframe?agent_id=test&process_id=101",
1755
- height: 300,
1756
- width: 300
2332
+ src: `https://h68.deepijatel.in/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_la = state.process) == null ? void 0 : _la.process_id}`,
2333
+ height: 380,
2334
+ width: 420,
2335
+ allow: "camera; microphone; autoplay"
1757
2336
  }
1758
2337
  )
1759
2338
  ]
1760
2339
  }
1761
2340
  )
1762
2341
  }
1763
- ) }),
2342
+ ),
1764
2343
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1765
- import_material3.Menu,
2344
+ import_material4.Menu,
1766
2345
  {
1767
2346
  anchorEl: dialerAnchorEl,
1768
2347
  open: Boolean(dialerAnchorEl),
@@ -1772,7 +2351,7 @@ function CallControlPanel({ onDataChange }) {
1772
2351
  zIndex: 99999
1773
2352
  },
1774
2353
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1775
- import_material3.Box,
2354
+ import_material4.Box,
1776
2355
  {
1777
2356
  sx: {
1778
2357
  all: "unset",
@@ -1783,7 +2362,7 @@ function CallControlPanel({ onDataChange }) {
1783
2362
  },
1784
2363
  children: [
1785
2364
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1786
- import_material3.TextField,
2365
+ import_material4.TextField,
1787
2366
  {
1788
2367
  size: "small",
1789
2368
  value: phoneNumber,
@@ -1794,7 +2373,7 @@ function CallControlPanel({ onDataChange }) {
1794
2373
  }
1795
2374
  ),
1796
2375
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1797
- import_material3.IconButton,
2376
+ import_material4.IconButton,
1798
2377
  {
1799
2378
  color: "info",
1800
2379
  onClick: () => {
@@ -1809,7 +2388,7 @@ function CallControlPanel({ onDataChange }) {
1809
2388
  }
1810
2389
  ),
1811
2390
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1812
- import_material3.Menu,
2391
+ import_material4.Menu,
1813
2392
  {
1814
2393
  anchorEl: statusAnchorEl,
1815
2394
  open: Boolean(statusAnchorEl),
@@ -1819,13 +2398,13 @@ function CallControlPanel({ onDataChange }) {
1819
2398
  zIndex: 99999
1820
2399
  },
1821
2400
  children: [
1822
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.MenuItem, { onClick: () => handleUpdateAgentStatus("break"), children: "- Lunch Break" }),
1823
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.MenuItem, { onClick: () => handleUpdateAgentStatus("break"), children: "- Tea Break" })
2401
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.MenuItem, { onClick: () => handleUpdateAgentStatus("Lunch"), children: "- Lunch" }),
2402
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.MenuItem, { onClick: () => handleUpdateAgentStatus("Tea"), children: "- Tea" })
1824
2403
  ]
1825
2404
  }
1826
2405
  ),
1827
2406
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1828
- import_material3.Menu,
2407
+ import_material4.Menu,
1829
2408
  {
1830
2409
  anchorEl,
1831
2410
  open: Boolean(anchorEl),
@@ -1835,7 +2414,7 @@ function CallControlPanel({ onDataChange }) {
1835
2414
  zIndex: 99999
1836
2415
  },
1837
2416
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1838
- import_material3.Box,
2417
+ import_material4.Box,
1839
2418
  {
1840
2419
  sx: {
1841
2420
  display: "flex",
@@ -1848,7 +2427,7 @@ function CallControlPanel({ onDataChange }) {
1848
2427
  },
1849
2428
  children: [
1850
2429
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1851
- import_material3.Chip,
2430
+ import_material4.Chip,
1852
2431
  {
1853
2432
  icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Layers, { color: "secondary" }),
1854
2433
  variant: "outlined",
@@ -1859,7 +2438,7 @@ function CallControlPanel({ onDataChange }) {
1859
2438
  }
1860
2439
  ),
1861
2440
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1862
- import_material3.Chip,
2441
+ import_material4.Chip,
1863
2442
  {
1864
2443
  icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Pending, { color: "info" }),
1865
2444
  label: "Pending - 99+",
@@ -1870,7 +2449,7 @@ function CallControlPanel({ onDataChange }) {
1870
2449
  }
1871
2450
  ),
1872
2451
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1873
- import_material3.Chip,
2452
+ import_material4.Chip,
1874
2453
  {
1875
2454
  icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Upcoming, { color: "success" }),
1876
2455
  variant: "outlined",
@@ -1889,10 +2468,7 @@ function CallControlPanel({ onDataChange }) {
1889
2468
  ConferenceDialog,
1890
2469
  {
1891
2470
  open,
1892
- setOpen,
1893
- onConference: () => console.log("Conference"),
1894
- onExit: () => console.log("Exit"),
1895
- onEndAllCalls: () => console.log("End All Calls")
2471
+ setOpen
1896
2472
  }
1897
2473
  ),
1898
2474
  Boolean(openCallTransfer) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -1909,6 +2485,13 @@ function CallControlPanel({ onDataChange }) {
1909
2485
  setOpen: setOpenCallDisposition,
1910
2486
  onSubmitDisposition: handleEndCall
1911
2487
  }
2488
+ ),
2489
+ Boolean(openCallHistoryDialog) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2490
+ CallHistoryDialog,
2491
+ {
2492
+ open: openCallHistoryDialog,
2493
+ setOpen: setOpenCallHistoryDialog
2494
+ }
1912
2495
  )
1913
2496
  ] });
1914
2497
  }
@@ -2318,23 +2901,54 @@ if (typeof window !== "undefined") {
2318
2901
  window.EventTracker = eventTracker;
2319
2902
  }
2320
2903
 
2904
+ // call-control-sdk/lib/hooks/useLogout.ts
2905
+ var import_react7 = require("react");
2906
+ var useLogout = (options = {}) => {
2907
+ const { onSuccess, onError, onComplete } = options;
2908
+ const state = useSDKState();
2909
+ const [logOutAgent, logoutState] = usePostRequest({
2910
+ onSuccess: (response) => {
2911
+ onSuccess == null ? void 0 : onSuccess(response);
2912
+ onComplete == null ? void 0 : onComplete();
2913
+ sdkStateManager.clearStorageAndReset();
2914
+ localStorage.clear();
2915
+ },
2916
+ onError: (error) => {
2917
+ onError == null ? void 0 : onError(error);
2918
+ onComplete == null ? void 0 : onComplete();
2919
+ }
2920
+ });
2921
+ const handleLogout = (0, import_react7.useCallback)(() => {
2922
+ const payload = {
2923
+ action: "LOGOUTUSER",
2924
+ userId: state.agentId || ""
2925
+ };
2926
+ logOutAgent(END_POINT.LOGOUT, payload);
2927
+ }, [logOutAgent]);
2928
+ return {
2929
+ logout: handleLogout,
2930
+ isLoading: logoutState.isLoading,
2931
+ isSuccess: logoutState.isSuccess,
2932
+ isError: logoutState.isError,
2933
+ error: logoutState.error,
2934
+ data: logoutState.data
2935
+ };
2936
+ };
2937
+ var useLogout_default = useLogout;
2938
+
2321
2939
  // call-control-sdk/index.ts
2322
- function initSDK({
2323
- apiKey,
2324
- tenantId,
2325
- agentId,
2326
- baseUrl
2327
- }) {
2940
+ function initSDK({ apiKey, tenantId, agentId }) {
2328
2941
  sdkStateManager.initialize(apiKey, agentId);
2329
2942
  eventTracker.init({
2330
2943
  apiKey,
2331
2944
  tenantId,
2332
2945
  agentId,
2333
- baseUrl
2946
+ baseUrl: BASE_URL
2334
2947
  });
2335
2948
  }
2336
2949
  // Annotate the CommonJS export names for ESM import in node:
2337
2950
  0 && (module.exports = {
2338
2951
  CallControlPanel,
2339
- initSDK
2952
+ initSDK,
2953
+ useLogout
2340
2954
  });