call-control-sdk 6.5.3 → 6.5.5-beta.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
@@ -85,9 +85,11 @@ var END_POINT = {
85
85
  CONFERENCE_CALL_MUTE_OT_UN_MUTE: `${BASE_URL}${VERSION.v1}/cti/calls/conference/mute?provider=convox`,
86
86
  CONFERENCE_CALL_END: `${BASE_URL}${VERSION.v1}/cti/calls/conference/hangup?provider=convox`,
87
87
  CONFERENCE_CALL_END_ALL: `${BASE_URL}${VERSION.v1}/cti/calls/conference/hangup/all?provider=convox`,
88
+ CONFERENCE_CALL_TRANSFER: `${BASE_URL}${VERSION.v1}/cti/calls/conference/transfer?provider=convox`,
88
89
  TRANSFER_CALL: `${BASE_URL}${VERSION.v1}/cti/calls/transfer?provider=convox`,
89
90
  AGENTS_LIST: `${BASE_URL}${VERSION.v1}/cti/users`,
90
91
  PROCESS_LIST: `${BASE_URL}${VERSION.v1}/cti/processes-list`,
92
+ BREAKS_LIST: `${BASE_URL}${VERSION.v1}/cti/breaks`,
91
93
  TRANSFER_TO_DETAILS: `${BASE_URL}${VERSION.v1}/cti/transfer-to-details?provider=convox`,
92
94
  SEND_NOTIFICATIONS: `${BASE_URL}${VERSION.v1}/cti/notifications/send`,
93
95
  CALL_HISTORY: `${BASE_URL}${VERSION.v1}/dashboard/call-history`,
@@ -124,6 +126,7 @@ var SDKStateManager = class {
124
126
  sdkConfig: {
125
127
  disableEndCallButton: false,
126
128
  disabledDialButton: false,
129
+ disabledMoreOptionsButton: false,
127
130
  enableSmsServices: false,
128
131
  enableQueueName: false,
129
132
  disableCallTransferButton: false,
@@ -200,7 +203,8 @@ var SDKStateManager = class {
200
203
  }
201
204
  ],
202
205
  hold: 0,
203
- mute: 0
206
+ mute: 0,
207
+ agentStatus: ""
204
208
  };
205
209
  }
206
210
  loadFromStorage() {
@@ -218,6 +222,7 @@ var SDKStateManager = class {
218
222
  isInitialized: parsedState.isInitialized || false,
219
223
  sdkConfig: parsedState.sdkConfig || {
220
224
  disableEndCallButton: false,
225
+ disabledMoreOptionsButton: false,
221
226
  enableSmsServices: false,
222
227
  enableQueueName: false,
223
228
  disabledDialButton: false,
@@ -247,7 +252,8 @@ var SDKStateManager = class {
247
252
  event_time: "",
248
253
  phone_number: ""
249
254
  },
250
- conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine
255
+ conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine,
256
+ agentStatus: parsedState.agentStatus
251
257
  });
252
258
  }
253
259
  } catch (error) {
@@ -268,7 +274,8 @@ var SDKStateManager = class {
268
274
  controlPanelPosition: this.state.controlPanelPosition,
269
275
  iframePosition: this.state.iframePosition,
270
276
  callData: this.state.callData,
271
- conferenceLine: this.state.conferenceLine
277
+ conferenceLine: this.state.conferenceLine,
278
+ agentStatus: this.state.agentStatus
272
279
  };
273
280
  (0, import_vault.setItem)(this.STORAGE_KEY, persistentState);
274
281
  } catch (error) {
@@ -301,6 +308,7 @@ var SDKStateManager = class {
301
308
  disableEndCallButton: false,
302
309
  disabledDialButton: false,
303
310
  enableSmsServices: false,
311
+ disabledMoreOptionsButton: false,
304
312
  enableQueueName: false,
305
313
  disableCallTransferButton: false,
306
314
  isDraggable: true,
@@ -384,6 +392,11 @@ var SDKStateManager = class {
384
392
  this.saveToStorage();
385
393
  this.notifyListeners();
386
394
  }
395
+ setAgentStatus(status) {
396
+ this.state.agentStatus = status;
397
+ this.saveToStorage();
398
+ this.notifyListeners();
399
+ }
387
400
  updateCallData(data) {
388
401
  this.state.callData = __spreadValues(__spreadValues({}, this.state.callData), data);
389
402
  this.saveToStorage();
@@ -633,6 +646,23 @@ var axios_default = axiosInstance;
633
646
 
634
647
  // call-control-sdk/lib/hooks/useLogout.ts
635
648
  var import_vault2 = require("@react-solutions/vault");
649
+
650
+ // call-control-sdk/lib/services/usbLight.ts
651
+ var USB_LIGHT_BASE_URL = `http://localhost:5000`;
652
+ var USB_LIGHT_ON = (color) => {
653
+ return `${USB_LIGHT_BASE_URL}/light/${color}/on`;
654
+ };
655
+ var USB_LIGHT_FLASH = (color, number) => {
656
+ return `${USB_LIGHT_BASE_URL}/light/${color}/flash${number}`;
657
+ };
658
+ var USB_LIGHT_ALL_OFF = () => {
659
+ return `${USB_LIGHT_BASE_URL}/all/off`;
660
+ };
661
+ var USB_LIGHT_REQUEST = (url, init) => {
662
+ return fetch(url, init);
663
+ };
664
+
665
+ // call-control-sdk/lib/hooks/useLogout.ts
636
666
  var useLogout = () => {
637
667
  const [loading, setLoading] = (0, import_react.useState)(false);
638
668
  const [success, setSuccess] = (0, import_react.useState)(false);
@@ -640,6 +670,7 @@ var useLogout = () => {
640
670
  const [error, setError] = (0, import_react.useState)(null);
641
671
  const [data, setData] = (0, import_react.useState)(null);
642
672
  const handleLogout = (0, import_react.useCallback)(async () => {
673
+ USB_LIGHT_REQUEST(USB_LIGHT_ALL_OFF());
643
674
  const state = (0, import_vault2.getItem)(STORAGE_KEY);
644
675
  setLoading(true);
645
676
  const payload = {
@@ -653,10 +684,14 @@ var useLogout = () => {
653
684
  setSuccess(true);
654
685
  return res == null ? void 0 : res.data;
655
686
  }).catch((err) => {
656
- var _a2;
687
+ var _a2, _b, _c, _d;
657
688
  setIsError(true);
658
689
  setError(err);
659
- return (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data;
690
+ if ((_c = (_b = (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.clearAgentData) {
691
+ sdkStateManager.clearStorageAndReset();
692
+ (0, import_vault2.removeItem)(STORAGE_KEY);
693
+ }
694
+ return (_d = err == null ? void 0 : err.response) == null ? void 0 : _d.data;
660
695
  }).finally(() => {
661
696
  setLoading(false);
662
697
  });
@@ -1009,43 +1044,45 @@ var usePostRequest = (props = {}) => {
1009
1044
  const { showToast } = useToast();
1010
1045
  const [state, dispatch] = (0, import_react8.useReducer)(reducer, initialState);
1011
1046
  const postRequest = (0, import_react8.useCallback)(
1012
- (url, payload, config = {}) => {
1047
+ async (url, payload, config = {}) => {
1048
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1013
1049
  dispatch({
1014
1050
  type: "isLoading",
1015
1051
  payload: true
1016
1052
  });
1017
- axios_default.post(url, payload, config).then((res) => {
1018
- var _a2;
1019
- dispatch({
1020
- type: "isSuccess",
1021
- payload: res.data
1022
- });
1023
- onSuccess == null ? void 0 : onSuccess(res.data, payload);
1024
- if (!disabledSuccessToast) {
1025
- showToast((_a2 = res.data) == null ? void 0 : _a2.message, "success");
1053
+ try {
1054
+ try {
1055
+ const res = await axios_default.post(url, payload, config);
1056
+ dispatch({
1057
+ type: "isSuccess",
1058
+ payload: res.data
1059
+ });
1060
+ onSuccess == null ? void 0 : onSuccess(res.data, payload);
1061
+ if (!disabledSuccessToast) {
1062
+ showToast((_a2 = res.data) == null ? void 0 : _a2.message, "success");
1063
+ }
1064
+ } catch (err) {
1065
+ const error = {
1066
+ status: (_c = (_b = err.response) == null ? void 0 : _b.status) != null ? _c : 500,
1067
+ message: ((_e = (_d = err.response) == null ? void 0 : _d.data) == null ? void 0 : _e.detail) || ((_g = (_f = err.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || err.message || "An unknown error occurred",
1068
+ data: (_i = (_h = err.response) == null ? void 0 : _h.data) != null ? _i : null,
1069
+ statusText: (_k = (_j = err.response) == null ? void 0 : _j.statusText) != null ? _k : "",
1070
+ code: (_l = err == null ? void 0 : err.code) != null ? _l : "",
1071
+ name: (_m = err == null ? void 0 : err.name) != null ? _m : ""
1072
+ };
1073
+ showToast(error.message, "error");
1074
+ dispatch({
1075
+ type: "isError",
1076
+ payload: error
1077
+ });
1078
+ onError == null ? void 0 : onError(error, payload);
1026
1079
  }
1027
- }).catch((err) => {
1028
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1029
- const error = {
1030
- status: (_b = (_a2 = err.response) == null ? void 0 : _a2.status) != null ? _b : 500,
1031
- message: ((_d = (_c = err.response) == null ? void 0 : _c.data) == null ? void 0 : _d.detail) || ((_f = (_e = err.response) == null ? void 0 : _e.data) == null ? void 0 : _f.message) || err.message || "An unknown error occurred",
1032
- data: (_h = (_g = err.response) == null ? void 0 : _g.data) != null ? _h : null,
1033
- statusText: (_j = (_i = err.response) == null ? void 0 : _i.statusText) != null ? _j : "",
1034
- code: (_k = err == null ? void 0 : err.code) != null ? _k : "",
1035
- name: (_l = err == null ? void 0 : err.name) != null ? _l : ""
1036
- };
1037
- showToast(error.message, "error");
1038
- dispatch({
1039
- type: "isError",
1040
- payload: error
1041
- });
1042
- onError == null ? void 0 : onError(error, payload);
1043
- }).finally(() => {
1080
+ } finally {
1044
1081
  dispatch({
1045
1082
  type: "isLoading",
1046
1083
  payload: false
1047
1084
  });
1048
- });
1085
+ }
1049
1086
  },
1050
1087
  [onSuccess, onError, showToast]
1051
1088
  );
@@ -1118,7 +1155,7 @@ var styles_default = useStyles;
1118
1155
 
1119
1156
  // call-control-sdk/lib/components/dialog.tsx
1120
1157
  var import_jsx_runtime2 = require("react/jsx-runtime");
1121
- var ConferenceTableRow = ({ each }) => {
1158
+ var ConferenceTableRow = ({ each, isLineDialing }) => {
1122
1159
  var _a2, _b, _c, _d, _e, _f;
1123
1160
  const state = useSDKState();
1124
1161
  const theme = (0, import_material3.useTheme)();
@@ -1308,7 +1345,15 @@ var ConferenceTableRow = ({ each }) => {
1308
1345
  placeholder: "Phone Number",
1309
1346
  fullWidth: true,
1310
1347
  value: (each == null ? void 0 : each.phone) || "",
1311
- disabled: (each == null ? void 0 : each.line) === 1 || ["ONCALL" /* ONCALL */, "DISCONNECTED" /* DISCONNECTED */, "CONFERENCE" /* CONFERENCE */, "HOLD" /* HOLD */, "MUTE" /* MUTE */, "DIALING" /* DIALING */, "RINGING" /* RINGING */].includes((_f = each == null ? void 0 : each.status) != null ? _f : ""),
1348
+ disabled: (each == null ? void 0 : each.line) === 1 || [
1349
+ "ONCALL" /* ONCALL */,
1350
+ "DISCONNECTED" /* DISCONNECTED */,
1351
+ "CONFERENCE" /* CONFERENCE */,
1352
+ "HOLD" /* HOLD */,
1353
+ "MUTE" /* MUTE */,
1354
+ "DIALING" /* DIALING */,
1355
+ "RINGING" /* RINGING */
1356
+ ].includes((_f = each == null ? void 0 : each.status) != null ? _f : "") || isLineDialing,
1312
1357
  onChange: (e) => {
1313
1358
  onConferenceLineUpdate(each, { phone: e.target.value });
1314
1359
  }
@@ -1436,7 +1481,7 @@ var ConferenceTableRow = ({ each }) => {
1436
1481
  onClick: () => {
1437
1482
  onConferenceCallStart(each, {});
1438
1483
  },
1439
- disabled: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */,
1484
+ disabled: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ || isLineDialing,
1440
1485
  children: conferenceCallStart ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1441
1486
  import_material3.CircularProgress,
1442
1487
  {
@@ -1537,7 +1582,7 @@ var ConferenceTableRow = ({ each }) => {
1537
1582
  );
1538
1583
  };
1539
1584
  function ConferenceDialog() {
1540
- var _a2;
1585
+ var _a2, _b, _c, _d, _e, _f, _g;
1541
1586
  const state = useSDKState();
1542
1587
  const { showToast } = useToast();
1543
1588
  const [conferenceCallEndAll, setConferenceCallEndAll] = (0, import_react9.useState)(false);
@@ -1545,13 +1590,13 @@ function ConferenceDialog() {
1545
1590
  sdkStateManager.setOpenConferenceDialog(false);
1546
1591
  };
1547
1592
  const onEndAllConferenceCalls = () => {
1548
- var _a3, _b, _c, _d;
1593
+ var _a3, _b2, _c2, _d2;
1549
1594
  setConferenceCallEndAll(true);
1550
1595
  const payload = {
1551
1596
  action: "EXTERNAL_CONFERENCE",
1552
1597
  operation: "ENDCONFERENCE",
1553
- userid: (_b = (_a3 = state.callData) == null ? void 0 : _a3.agent_id) != null ? _b : "",
1554
- process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
1598
+ userid: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.agent_id) != null ? _b2 : "",
1599
+ process: (_d2 = (_c2 = state.callData) == null ? void 0 : _c2.process_name) != null ? _d2 : ""
1555
1600
  };
1556
1601
  axios_default.post(END_POINT.CONFERENCE_CALL_END_ALL, payload).then((res) => {
1557
1602
  var _a4;
@@ -1559,13 +1604,35 @@ function ConferenceDialog() {
1559
1604
  sdkStateManager.resetConferenceLines();
1560
1605
  handleClose();
1561
1606
  }).catch((err) => {
1562
- var _a4, _b2, _c2, _d2;
1563
- const message = ((_b2 = (_a4 = err.response) == null ? void 0 : _a4.data) == null ? void 0 : _b2.detail) || ((_d2 = (_c2 = err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || err.message || "An unknown error occurred";
1607
+ var _a4, _b3, _c3, _d3;
1608
+ const message = ((_b3 = (_a4 = err.response) == null ? void 0 : _a4.data) == null ? void 0 : _b3.detail) || ((_d3 = (_c3 = err.response) == null ? void 0 : _c3.data) == null ? void 0 : _d3.message) || err.message || "An unknown error occurred";
1564
1609
  showToast(message, "error");
1565
1610
  }).finally(() => {
1566
1611
  setConferenceCallEndAll(false);
1567
1612
  });
1568
1613
  };
1614
+ const handleTransferConferenceCall = () => {
1615
+ var _a3, _b2, _c2, _d2;
1616
+ const payload = {
1617
+ action: "TRANSFERAPI",
1618
+ userid: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.agent_id) != null ? _b2 : "",
1619
+ process_name: (_d2 = (_c2 = state.callData) == null ? void 0 : _c2.process_name) != null ? _d2 : ""
1620
+ };
1621
+ axios_default.post(END_POINT.CONFERENCE_CALL_TRANSFER, payload).then((res) => {
1622
+ var _a4;
1623
+ showToast((_a4 = res.data) == null ? void 0 : _a4.message, "success");
1624
+ sdkStateManager.resetConferenceLines();
1625
+ handleClose();
1626
+ }).catch((err) => {
1627
+ var _a4, _b3, _c3, _d3;
1628
+ const message = ((_b3 = (_a4 = err.response) == null ? void 0 : _a4.data) == null ? void 0 : _b3.detail) || ((_d3 = (_c3 = err.response) == null ? void 0 : _c3.data) == null ? void 0 : _d3.message) || err.message || "An unknown error occurred";
1629
+ showToast(message, "error");
1630
+ });
1631
+ };
1632
+ const isLineDialing = (_a2 = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _a2.some((item) => (item == null ? void 0 : item.status) === "DIALING" /* DIALING */);
1633
+ const conferenceLineCount = (_d = (_c = (_b = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _b.filter((item) => (item == null ? void 0 : item.status) === "CONFERENCE" /* CONFERENCE */)) == null ? void 0 : _c.length) != null ? _d : 0;
1634
+ const isHold = (_e = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _e.some((item) => (item == null ? void 0 : item.status) === "HOLD" /* HOLD */);
1635
+ const isOnCall = (_f = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _f.some((item) => (item == null ? void 0 : item.status) === "ONCALL" /* ONCALL */);
1569
1636
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1570
1637
  import_material3.Dialog,
1571
1638
  {
@@ -1581,14 +1648,45 @@ function ConferenceDialog() {
1581
1648
  display: "flex",
1582
1649
  justifyContent: "space-between",
1583
1650
  alignItems: "center",
1584
- padding: "10px 16px"
1651
+ padding: "0px 16px",
1652
+ paddingBottom: "6px",
1653
+ boxShadow: "1px 1px 2px #e7e5e5ff",
1654
+ margin: "10px 0px"
1585
1655
  },
1586
1656
  children: [
1587
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Typography, { variant: "body1", children: [
1588
- (_a2 = state == null ? void 0 : state.agentId) != null ? _a2 : "",
1589
- " conference"
1590
- ] }),
1591
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
1657
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1658
+ import_material3.Typography,
1659
+ {
1660
+ variant: "body1",
1661
+ color: "primary.main",
1662
+ sx: { textTransform: "uppercase", fontWeight: "bold", fontSize: "14px" },
1663
+ children: [
1664
+ (_g = state == null ? void 0 : state.agentId) != null ? _g : "",
1665
+ " conference"
1666
+ ]
1667
+ }
1668
+ ),
1669
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { children: [
1670
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1671
+ import_material3.Button,
1672
+ {
1673
+ color: "primary",
1674
+ variant: "outlined",
1675
+ onClick: handleTransferConferenceCall,
1676
+ disabled: conferenceLineCount <= 1 || isHold || isLineDialing || isOnCall,
1677
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.TransferWithinAStation, {}),
1678
+ children: "Transfer Conference"
1679
+ }
1680
+ ),
1681
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1682
+ import_material3.IconButton,
1683
+ {
1684
+ onClick: handleClose,
1685
+ color: "primary",
1686
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, { sx: { color: "primary.main" } })
1687
+ }
1688
+ )
1689
+ ] })
1592
1690
  ]
1593
1691
  }
1594
1692
  ),
@@ -1661,7 +1759,13 @@ function ConferenceDialog() {
1661
1759
  ]
1662
1760
  }
1663
1761
  ) }),
1664
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TableBody, { children: state == null ? void 0 : state.conferenceLine.map((each) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ConferenceTableRow, { each })) })
1762
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TableBody, { children: state == null ? void 0 : state.conferenceLine.map((each) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1763
+ ConferenceTableRow,
1764
+ {
1765
+ each,
1766
+ isLineDialing
1767
+ }
1768
+ )) })
1665
1769
  ]
1666
1770
  }
1667
1771
  )
@@ -1681,7 +1785,7 @@ function ConferenceDialog() {
1681
1785
  color: "error",
1682
1786
  size: "large",
1683
1787
  onClick: onEndAllConferenceCalls,
1684
- disabled: conferenceCallEndAll,
1788
+ disabled: conferenceCallEndAll || conferenceLineCount <= 0,
1685
1789
  sx: { px: 2, borderRadius: "20px", textTransform: "capitalize" },
1686
1790
  children: [
1687
1791
  conferenceCallEndAll ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -1753,7 +1857,10 @@ function CallTransferDialog({ open }) {
1753
1857
  const [getIdelAgentsList, { data: idleAgentsList, isLoading: isIdleAgentsListLoading }] = usePostRequest({
1754
1858
  disabledSuccessToast: true
1755
1859
  });
1756
- const [getHospitalsServicesList, { data: hospitalsServicesList, isLoading: isHospitalsServicesListLoading }] = useGetRequest({
1860
+ const [
1861
+ getHospitalsServicesList,
1862
+ { data: hospitalsServicesList, isLoading: isHospitalsServicesListLoading }
1863
+ ] = useGetRequest({
1757
1864
  disabledSuccessToast: true
1758
1865
  });
1759
1866
  const [
@@ -1807,7 +1914,6 @@ function CallTransferDialog({ open }) {
1807
1914
  callreferenceid: (_K = (_J = state.callData) == null ? void 0 : _J.convox_id) != null ? _K : "",
1808
1915
  blind_transfer_no: (_L = data == null ? void 0 : data.mobile_number) != null ? _L : ""
1809
1916
  };
1810
- console.log("payload", payload);
1811
1917
  blindTransferCall(END_POINT.BLIEND_TRANSFER, payload);
1812
1918
  }
1813
1919
  };
@@ -1916,274 +2022,230 @@ function CallTransferDialog({ open }) {
1916
2022
  ]
1917
2023
  }
1918
2024
  ),
1919
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { display: "grid", gridTemplateColumns: ((_a2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a2.process) && ((_c = (_b = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _b.process) == null ? void 0 : _c.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: ((_d = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d.process) && ((_f = (_e = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _e.process) == null ? void 0 : _f.length) > 0 ? (_h = (_g = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _g.process) == null ? void 0 : _h.map((process, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2025
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1920
2026
  import_material3.Box,
1921
2027
  {
1922
2028
  sx: {
1923
- p: 1,
1924
- display: "flex",
1925
- alignItems: "center",
2029
+ display: "grid",
2030
+ gridTemplateColumns: ((_a2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a2.process) && ((_c = (_b = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _b.process) == null ? void 0 : _c.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)",
2031
+ gap: 1,
2032
+ padding: "10px",
2033
+ flexWrap: "wrap",
1926
2034
  boxShadow: "1px 1px 4px #d3d3d3ff",
1927
- padding: "6px",
1928
- borderRadius: "10px",
1929
- "&:hover": { bgcolor: "action.selected" }
2035
+ borderRadius: "10px"
1930
2036
  },
1931
- children: [
1932
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1933
- import_material3.Typography,
1934
- {
1935
- variant: "body1",
1936
- sx: {
1937
- mx: 1,
1938
- width: "200px",
1939
- maxWidth: "250px",
1940
- display: "flex",
1941
- alignItems: "center"
1942
- },
1943
- children: [
1944
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MemoryOutlined, { sx: { marginRight: "4px" } }),
1945
- process.process_name
1946
- ]
1947
- }
1948
- ),
1949
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1950
- import_material3.IconButton,
1951
- {
1952
- color: "success",
1953
- sx: {
1954
- bgcolor: "action.hover",
1955
- "&:hover": { bgcolor: "action.selected" }
1956
- },
1957
- onClick: () => {
1958
- handleTransferCall(process, "PROCESS");
1959
- },
1960
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
1961
- }
1962
- )
1963
- ]
1964
- },
1965
- index
1966
- )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1967
- import_material3.Box,
1968
- {
1969
- sx: {
1970
- display: "flex",
1971
- alignItems: "center",
1972
- justifyContent: "center",
1973
- flexDirection: "column"
1974
- },
1975
- p: 2,
1976
- children: [
1977
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
1978
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1979
- import_material3.Typography,
1980
- {
1981
- variant: "body1",
1982
- sx: {
1983
- fontSize: "16px",
1984
- letterSpacing: "0.02em",
1985
- textTransform: "capitalize",
1986
- display: "flex",
1987
- alignItems: "center",
1988
- justifyContent: "center",
1989
- width: "100%",
1990
- margin: "10px 0px",
1991
- color: "primary.main",
1992
- height: "20px"
1993
- },
1994
- children: "No Process Found"
1995
- }
1996
- )
1997
- ]
1998
- }
1999
- ) }),
2000
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "queues" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { display: "grid", gridTemplateColumns: ((_i = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _i.queue) && ((_k = (_j = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _j.queue) == null ? void 0 : _k.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: ((_l = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _l.queue) && ((_n = (_m = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _m.queue) == null ? void 0 : _n.length) > 0 ? (_p = (_o = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _o.queue) == null ? void 0 : _p.map((queue, index) => {
2001
- var _a3, _b2, _c2, _d2, _e2, _f2;
2002
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2003
- import_material3.Box,
2004
- {
2005
- sx: {
2006
- p: 1,
2007
- display: "flex",
2008
- alignItems: "center",
2009
- boxShadow: "1px 1px 4px #d3d3d3ff",
2010
- padding: "6px",
2011
- borderRadius: "10px",
2012
- "&:hover": { bgcolor: "action.selected" }
2037
+ children: ((_d = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d.process) && ((_f = (_e = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _e.process) == null ? void 0 : _f.length) > 0 ? (_h = (_g = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _g.process) == null ? void 0 : _h.map((process, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2038
+ import_material3.Box,
2039
+ {
2040
+ sx: {
2041
+ p: 1,
2042
+ display: "flex",
2043
+ alignItems: "center",
2044
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2045
+ padding: "6px",
2046
+ borderRadius: "10px",
2047
+ "&:hover": { bgcolor: "action.selected" }
2048
+ },
2049
+ children: [
2050
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2051
+ import_material3.Typography,
2052
+ {
2053
+ variant: "body1",
2054
+ sx: {
2055
+ mx: 1,
2056
+ width: "200px",
2057
+ maxWidth: "250px",
2058
+ display: "flex",
2059
+ alignItems: "center"
2060
+ },
2061
+ children: [
2062
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MemoryOutlined, { sx: { marginRight: "4px" } }),
2063
+ process.process_name
2064
+ ]
2065
+ }
2066
+ ),
2067
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2068
+ import_material3.IconButton,
2069
+ {
2070
+ color: "success",
2071
+ sx: {
2072
+ bgcolor: "action.hover",
2073
+ "&:hover": { bgcolor: "action.selected" }
2074
+ },
2075
+ onClick: () => {
2076
+ handleTransferCall(process, "PROCESS");
2077
+ },
2078
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2079
+ }
2080
+ )
2081
+ ]
2013
2082
  },
2014
- children: [
2015
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2016
- import_material3.Typography,
2017
- {
2018
- variant: "body1",
2019
- sx: {
2020
- mx: 1,
2021
- width: "200px",
2022
- maxWidth: "250px",
2023
- display: "flex",
2024
- alignItems: "center"
2025
- },
2026
- children: [
2027
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Airlines, { sx: { marginRight: "4px" } }),
2028
- queue.queue_name,
2029
- ((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
2030
- (process) => process.process_id === queue.process_id
2031
- )) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2032
- import_material3.Typography,
2033
- {
2034
- variant: "body1",
2035
- sx: {
2036
- fontSize: "12px",
2037
- fontWeight: "600",
2038
- letterSpacing: "0.02em",
2039
- textTransform: "capitalize",
2040
- color: "gray"
2041
- },
2042
- children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
2043
- (process) => process.process_id === queue.process_id
2044
- )) == null ? void 0 : _f2.process_name) + ")"
2045
- }
2046
- ) : ""
2047
- ]
2048
- }
2049
- ),
2050
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2051
- import_material3.IconButton,
2052
- {
2053
- color: "success",
2054
- sx: {
2055
- bgcolor: "action.hover",
2056
- "&:hover": { bgcolor: "action.selected" }
2057
- },
2058
- onClick: () => {
2059
- handleTransferCall(queue, "QUEUE");
2060
- },
2061
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2062
- }
2063
- )
2064
- ]
2065
- },
2066
- index
2067
- );
2068
- }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2069
- import_material3.Box,
2070
- {
2071
- sx: {
2072
- display: "flex",
2073
- alignItems: "center",
2074
- justifyContent: "center",
2075
- flexDirection: "column"
2076
- },
2077
- p: 2,
2078
- children: [
2079
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2080
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2081
- import_material3.Typography,
2082
- {
2083
- variant: "body1",
2084
- sx: {
2085
- fontSize: "16px",
2086
- letterSpacing: "0.02em",
2087
- textTransform: "capitalize",
2088
- display: "flex",
2089
- alignItems: "center",
2090
- justifyContent: "center",
2091
- width: "100%",
2092
- margin: "10px 0px",
2093
- color: "primary.main",
2094
- height: "20px"
2095
- },
2096
- children: "No Queues Found"
2097
- }
2098
- )
2099
- ]
2083
+ index
2084
+ )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2085
+ import_material3.Box,
2086
+ {
2087
+ sx: {
2088
+ display: "flex",
2089
+ alignItems: "center",
2090
+ justifyContent: "center",
2091
+ flexDirection: "column"
2092
+ },
2093
+ p: 2,
2094
+ children: [
2095
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2096
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2097
+ import_material3.Typography,
2098
+ {
2099
+ variant: "body1",
2100
+ sx: {
2101
+ fontSize: "16px",
2102
+ letterSpacing: "0.02em",
2103
+ textTransform: "capitalize",
2104
+ display: "flex",
2105
+ alignItems: "center",
2106
+ justifyContent: "center",
2107
+ width: "100%",
2108
+ margin: "10px 0px",
2109
+ color: "primary.main",
2110
+ height: "20px"
2111
+ },
2112
+ children: "No Process Found"
2113
+ }
2114
+ )
2115
+ ]
2116
+ }
2117
+ )
2100
2118
  }
2101
- ) }),
2102
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "agents" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { display: "grid", gridTemplateColumns: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_q = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _q.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_r = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _r.length) > 0 ? (_s = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _s.map((agent, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2119
+ ),
2120
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "queues" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2103
2121
  import_material3.Box,
2104
2122
  {
2105
2123
  sx: {
2106
- p: 1,
2107
- display: "flex",
2108
- alignItems: "center",
2124
+ display: "grid",
2125
+ gridTemplateColumns: ((_i = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _i.queue) && ((_k = (_j = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _j.queue) == null ? void 0 : _k.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)",
2126
+ gap: 1,
2127
+ padding: "10px",
2128
+ flexWrap: "wrap",
2109
2129
  boxShadow: "1px 1px 4px #d3d3d3ff",
2110
- padding: "6px",
2111
- borderRadius: "10px",
2112
- "&:hover": { bgcolor: "action.selected" }
2130
+ borderRadius: "10px"
2113
2131
  },
2114
- children: [
2115
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2116
- import_material3.Typography,
2132
+ children: ((_l = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _l.queue) && ((_n = (_m = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _m.queue) == null ? void 0 : _n.length) > 0 ? (_p = (_o = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _o.queue) == null ? void 0 : _p.map((queue, index) => {
2133
+ var _a3, _b2, _c2, _d2, _e2, _f2;
2134
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2135
+ import_material3.Box,
2117
2136
  {
2118
- variant: "body1",
2119
2137
  sx: {
2120
- mx: 1,
2121
- width: "200px",
2122
- maxWidth: "250px",
2138
+ p: 1,
2123
2139
  display: "flex",
2124
- alignItems: "center"
2140
+ alignItems: "center",
2141
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2142
+ padding: "6px",
2143
+ borderRadius: "10px",
2144
+ "&:hover": { bgcolor: "action.selected" }
2125
2145
  },
2126
2146
  children: [
2127
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
2128
- agent.name
2147
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2148
+ import_material3.Typography,
2149
+ {
2150
+ variant: "body1",
2151
+ sx: {
2152
+ mx: 1,
2153
+ width: "200px",
2154
+ maxWidth: "250px",
2155
+ display: "flex",
2156
+ alignItems: "center"
2157
+ },
2158
+ children: [
2159
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Airlines, { sx: { marginRight: "4px" } }),
2160
+ queue.queue_name,
2161
+ ((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
2162
+ (process) => process.process_id === queue.process_id
2163
+ )) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2164
+ import_material3.Typography,
2165
+ {
2166
+ variant: "body1",
2167
+ sx: {
2168
+ fontSize: "12px",
2169
+ fontWeight: "600",
2170
+ letterSpacing: "0.02em",
2171
+ textTransform: "capitalize",
2172
+ color: "gray"
2173
+ },
2174
+ children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
2175
+ (process) => process.process_id === queue.process_id
2176
+ )) == null ? void 0 : _f2.process_name) + ")"
2177
+ }
2178
+ ) : ""
2179
+ ]
2180
+ }
2181
+ ),
2182
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2183
+ import_material3.IconButton,
2184
+ {
2185
+ color: "success",
2186
+ sx: {
2187
+ bgcolor: "action.hover",
2188
+ "&:hover": { bgcolor: "action.selected" }
2189
+ },
2190
+ onClick: () => {
2191
+ handleTransferCall(queue, "QUEUE");
2192
+ },
2193
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2194
+ }
2195
+ )
2129
2196
  ]
2130
- }
2131
- ),
2132
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2133
- import_material3.IconButton,
2134
- {
2135
- color: "success",
2136
- sx: {
2137
- bgcolor: "action.hover",
2138
- "&:hover": { bgcolor: "action.selected" }
2139
- },
2140
- onClick: () => {
2141
- handleTransferCall(agent, "AGENT");
2142
- },
2143
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2144
- }
2145
- )
2146
- ]
2147
- },
2148
- index
2149
- )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2197
+ },
2198
+ index
2199
+ );
2200
+ }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2201
+ import_material3.Box,
2202
+ {
2203
+ sx: {
2204
+ display: "flex",
2205
+ alignItems: "center",
2206
+ justifyContent: "center",
2207
+ flexDirection: "column"
2208
+ },
2209
+ p: 2,
2210
+ children: [
2211
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2212
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2213
+ import_material3.Typography,
2214
+ {
2215
+ variant: "body1",
2216
+ sx: {
2217
+ fontSize: "16px",
2218
+ letterSpacing: "0.02em",
2219
+ textTransform: "capitalize",
2220
+ display: "flex",
2221
+ alignItems: "center",
2222
+ justifyContent: "center",
2223
+ width: "100%",
2224
+ margin: "10px 0px",
2225
+ color: "primary.main",
2226
+ height: "20px"
2227
+ },
2228
+ children: "No Queues Found"
2229
+ }
2230
+ )
2231
+ ]
2232
+ }
2233
+ )
2234
+ }
2235
+ ),
2236
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "agents" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2150
2237
  import_material3.Box,
2151
2238
  {
2152
2239
  sx: {
2153
- display: "flex",
2154
- alignItems: "center",
2155
- justifyContent: "center",
2156
- flexDirection: "column"
2240
+ display: "grid",
2241
+ gridTemplateColumns: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_q = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _q.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)",
2242
+ gap: 1,
2243
+ padding: "10px",
2244
+ flexWrap: "wrap",
2245
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2246
+ borderRadius: "10px"
2157
2247
  },
2158
- p: 2,
2159
- children: [
2160
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2161
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2162
- import_material3.Typography,
2163
- {
2164
- variant: "body1",
2165
- sx: {
2166
- fontSize: "16px",
2167
- letterSpacing: "0.02em",
2168
- textTransform: "capitalize",
2169
- display: "flex",
2170
- alignItems: "center",
2171
- justifyContent: "center",
2172
- width: "100%",
2173
- margin: "10px 0px",
2174
- color: "primary.main",
2175
- height: "20px"
2176
- },
2177
- children: "No Agents Found"
2178
- }
2179
- )
2180
- ]
2181
- }
2182
- ) }),
2183
- !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "others" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 1, padding: "10px", flexWrap: "wrap", boxShadow: "1px 1px 4px #d3d3d3ff", borderRadius: "10px" }, children: [
2184
- (hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) && ((_t = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _t.length) > 0 && ((_u = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _u.map((service, index) => {
2185
- var _a3, _b2, _c2;
2186
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2248
+ children: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_r = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _r.length) > 0 ? (_s = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _s.map((agent, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2187
2249
  import_material3.Box,
2188
2250
  {
2189
2251
  sx: {
@@ -2208,25 +2270,12 @@ function CallTransferDialog({ open }) {
2208
2270
  alignItems: "center"
2209
2271
  },
2210
2272
  children: [
2211
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Roofing, { sx: { marginRight: "4px" } }),
2212
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: `${(_a3 = service == null ? void 0 : service.description) != null ? _a3 : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { color: "text.secondary" }, children: [
2213
- service.name,
2214
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: {
2215
- fontSize: "9px",
2216
- fontWeight: "600",
2217
- letterSpacing: "0.02em",
2218
- textTransform: "capitalize",
2219
- color: "gray",
2220
- textOverflow: "ellipsis",
2221
- whiteSpace: "nowrap",
2222
- overflow: "hidden",
2223
- maxWidth: "160px"
2224
- }, children: (_b2 = service == null ? void 0 : service.description) != null ? _b2 : "" })
2225
- ] }) })
2273
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
2274
+ agent.name
2226
2275
  ]
2227
2276
  }
2228
2277
  ),
2229
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (_c2 = service == null ? void 0 : service.phone_number) != null ? _c2 : "", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2278
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2230
2279
  import_material3.IconButton,
2231
2280
  {
2232
2281
  color: "success",
@@ -2235,89 +2284,220 @@ function CallTransferDialog({ open }) {
2235
2284
  "&:hover": { bgcolor: "action.selected" }
2236
2285
  },
2237
2286
  onClick: () => {
2238
- var _a4;
2239
- handleTransferCall({
2240
- mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : ""
2241
- }, "OTHER");
2287
+ handleTransferCall(agent, "AGENT");
2242
2288
  },
2243
2289
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2244
2290
  }
2245
- ) })
2291
+ )
2246
2292
  ]
2247
2293
  },
2248
2294
  index
2249
- );
2250
- })),
2251
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2252
- import_material3.Box,
2253
- {
2254
- sx: {
2255
- p: 1,
2256
- display: "flex",
2257
- alignItems: "center",
2258
- boxShadow: "1px 1px 4px #d3d3d3ff",
2259
- padding: "6px",
2260
- borderRadius: "10px"
2261
- },
2262
- children: [
2263
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2264
- import_material3.Typography,
2295
+ )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2296
+ import_material3.Box,
2297
+ {
2298
+ sx: {
2299
+ display: "flex",
2300
+ alignItems: "center",
2301
+ justifyContent: "center",
2302
+ flexDirection: "column"
2303
+ },
2304
+ p: 2,
2305
+ children: [
2306
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2307
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2308
+ import_material3.Typography,
2309
+ {
2310
+ variant: "body1",
2311
+ sx: {
2312
+ fontSize: "16px",
2313
+ letterSpacing: "0.02em",
2314
+ textTransform: "capitalize",
2315
+ display: "flex",
2316
+ alignItems: "center",
2317
+ justifyContent: "center",
2318
+ width: "100%",
2319
+ margin: "10px 0px",
2320
+ color: "primary.main",
2321
+ height: "20px"
2322
+ },
2323
+ children: "No Agents Found"
2324
+ }
2325
+ )
2326
+ ]
2327
+ }
2328
+ )
2329
+ }
2330
+ ),
2331
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "others" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2332
+ import_material3.Box,
2333
+ {
2334
+ sx: {
2335
+ display: "grid",
2336
+ gridTemplateColumns: "repeat(2, 1fr)",
2337
+ gap: 1,
2338
+ padding: "10px",
2339
+ flexWrap: "wrap",
2340
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2341
+ borderRadius: "10px"
2342
+ },
2343
+ children: [
2344
+ (hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) && ((_t = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _t.length) > 0 && ((_u = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _u.map((service, index) => {
2345
+ var _a3, _b2, _c2;
2346
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2347
+ import_material3.Box,
2265
2348
  {
2266
- variant: "body1",
2267
2349
  sx: {
2268
- mx: 1,
2269
- width: "200px",
2270
- maxWidth: "250px",
2350
+ p: 1,
2271
2351
  display: "flex",
2272
- alignItems: "center"
2352
+ alignItems: "center",
2353
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2354
+ padding: "6px",
2355
+ borderRadius: "10px",
2356
+ "&:hover": { bgcolor: "action.selected" }
2273
2357
  },
2274
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2275
- import_material3.TextField,
2358
+ children: [
2359
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2360
+ import_material3.Typography,
2361
+ {
2362
+ variant: "body1",
2363
+ sx: {
2364
+ mx: 1,
2365
+ width: "200px",
2366
+ maxWidth: "250px",
2367
+ display: "flex",
2368
+ alignItems: "center"
2369
+ },
2370
+ children: [
2371
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Roofing, { sx: { marginRight: "4px" } }),
2372
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: `${(_a3 = service == null ? void 0 : service.description) != null ? _a3 : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { color: "text.secondary" }, children: [
2373
+ service.name,
2374
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2375
+ import_material3.Box,
2376
+ {
2377
+ sx: {
2378
+ fontSize: "9px",
2379
+ fontWeight: "600",
2380
+ letterSpacing: "0.02em",
2381
+ textTransform: "capitalize",
2382
+ color: "gray",
2383
+ textOverflow: "ellipsis",
2384
+ whiteSpace: "nowrap",
2385
+ overflow: "hidden",
2386
+ maxWidth: "160px"
2387
+ },
2388
+ children: (_b2 = service == null ? void 0 : service.description) != null ? _b2 : ""
2389
+ }
2390
+ )
2391
+ ] }) })
2392
+ ]
2393
+ }
2394
+ ),
2395
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (_c2 = service == null ? void 0 : service.phone_number) != null ? _c2 : "", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2396
+ import_material3.IconButton,
2397
+ {
2398
+ color: "success",
2399
+ sx: {
2400
+ bgcolor: "action.hover",
2401
+ "&:hover": { bgcolor: "action.selected" }
2402
+ },
2403
+ onClick: () => {
2404
+ var _a4;
2405
+ handleTransferCall(
2406
+ {
2407
+ mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : ""
2408
+ },
2409
+ "OTHER"
2410
+ );
2411
+ },
2412
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2413
+ }
2414
+ ) })
2415
+ ]
2416
+ },
2417
+ index
2418
+ );
2419
+ })),
2420
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2421
+ import_material3.Box,
2422
+ {
2423
+ sx: {
2424
+ p: 1,
2425
+ display: "flex",
2426
+ alignItems: "center",
2427
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2428
+ padding: "6px",
2429
+ borderRadius: "10px"
2430
+ },
2431
+ children: [
2432
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2433
+ import_material3.Typography,
2276
2434
  {
2277
- size: "small",
2278
- name: "others",
2279
- label: "Mobile number",
2280
- variant: "outlined",
2281
- type: "tel",
2282
- value: mobileNumber,
2283
- onChange: (e) => {
2284
- const v = e.target.value;
2285
- if (/^\d*$/.test(v)) {
2286
- setMobileNumber(v);
2287
- }
2435
+ variant: "body1",
2436
+ sx: {
2437
+ mx: 1,
2438
+ width: "200px",
2439
+ maxWidth: "250px",
2440
+ display: "flex",
2441
+ alignItems: "center"
2288
2442
  },
2289
- slotProps: {
2290
- htmlInput: {
2291
- inputMode: "numeric",
2292
- maxLength: 11
2443
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2444
+ import_material3.TextField,
2445
+ {
2446
+ size: "small",
2447
+ name: "others",
2448
+ label: "Mobile number",
2449
+ variant: "outlined",
2450
+ type: "tel",
2451
+ value: mobileNumber,
2452
+ onChange: (e) => {
2453
+ const v = e.target.value;
2454
+ if (/^\d*$/.test(v)) {
2455
+ setMobileNumber(v);
2456
+ }
2457
+ },
2458
+ slotProps: {
2459
+ htmlInput: {
2460
+ inputMode: "numeric",
2461
+ maxLength: 11
2462
+ }
2463
+ },
2464
+ placeholder: "Enter mobile number",
2465
+ autoComplete: "off"
2293
2466
  }
2294
- },
2295
- placeholder: "Enter mobile number",
2296
- autoComplete: "off"
2467
+ )
2468
+ }
2469
+ ),
2470
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2471
+ import_material3.Tooltip,
2472
+ {
2473
+ title: mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number",
2474
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2475
+ import_material3.IconButton,
2476
+ {
2477
+ color: "success",
2478
+ sx: {
2479
+ bgcolor: "action.hover",
2480
+ "&:hover": { bgcolor: "action.selected" }
2481
+ },
2482
+ onClick: () => {
2483
+ handleTransferCall(
2484
+ {
2485
+ mobile_number: mobileNumber != null ? mobileNumber : ""
2486
+ },
2487
+ "OTHER"
2488
+ );
2489
+ },
2490
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2491
+ }
2492
+ )
2297
2493
  }
2298
2494
  )
2299
- }
2300
- ),
2301
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2302
- import_material3.IconButton,
2303
- {
2304
- color: "success",
2305
- sx: {
2306
- bgcolor: "action.hover",
2307
- "&:hover": { bgcolor: "action.selected" }
2308
- },
2309
- onClick: () => {
2310
- handleTransferCall({
2311
- mobile_number: mobileNumber != null ? mobileNumber : ""
2312
- }, "OTHER");
2313
- },
2314
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2315
- }
2316
- ) })
2317
- ]
2318
- }
2319
- )
2320
- ] })
2495
+ ]
2496
+ }
2497
+ )
2498
+ ]
2499
+ }
2500
+ )
2321
2501
  ]
2322
2502
  }
2323
2503
  )
@@ -2461,29 +2641,36 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2461
2641
  gap: 2,
2462
2642
  mt: 2,
2463
2643
  children: [
2464
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: {
2465
- flex: "1",
2466
- border: "1px solid #bdbdbd",
2467
- borderRadius: "5px"
2468
- }, children: [
2469
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2470
- import_material3.Checkbox,
2471
- {
2472
- name: "selected_break",
2473
- sx: {
2474
- padding: "6px"
2475
- },
2476
- checked: formData.selected_break,
2477
- onChange: (event) => {
2478
- handleChange("selected_break", event.target.checked);
2479
- },
2480
- slotProps: {
2481
- input: { "aria-label": "controlled" }
2482
- }
2483
- }
2484
- ),
2485
- " Mark as break"
2486
- ] }),
2644
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2645
+ import_material3.Box,
2646
+ {
2647
+ sx: {
2648
+ flex: "1",
2649
+ border: "1px solid #bdbdbd",
2650
+ borderRadius: "5px"
2651
+ },
2652
+ children: [
2653
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2654
+ import_material3.Checkbox,
2655
+ {
2656
+ name: "selected_break",
2657
+ sx: {
2658
+ padding: "6px"
2659
+ },
2660
+ checked: formData.selected_break,
2661
+ onChange: (event) => {
2662
+ handleChange("selected_break", event.target.checked);
2663
+ },
2664
+ slotProps: {
2665
+ input: { "aria-label": "controlled" }
2666
+ }
2667
+ }
2668
+ ),
2669
+ " ",
2670
+ "Mark as break"
2671
+ ]
2672
+ }
2673
+ ),
2487
2674
  ((_c = (_b = formData == null ? void 0 : formData.followUp) == null ? void 0 : _b.label) == null ? void 0 : _c.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2488
2675
  import_material3.TextField,
2489
2676
  {
@@ -2963,7 +3150,7 @@ var formatDuration = (seconds) => {
2963
3150
  return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
2964
3151
  };
2965
3152
  function CallControls({ onDataChange }) {
2966
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va;
3153
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa;
2967
3154
  const theme = (0, import_material4.useTheme)();
2968
3155
  const state = useSDKState();
2969
3156
  const { showToast } = useToast();
@@ -2978,6 +3165,8 @@ function CallControls({ onDataChange }) {
2978
3165
  const reconnectTimeoutRef = (0, import_react11.useRef)(null);
2979
3166
  const pingIntervalRef = (0, import_react11.useRef)(null);
2980
3167
  const reconnectAttemptsRef = (0, import_react11.useRef)(0);
3168
+ const hasFlashedRef = (0, import_react11.useRef)(false);
3169
+ const lastEventTimeRef = (0, import_react11.useRef)(null);
2981
3170
  const maxReconnectAttempts = 60;
2982
3171
  const baseReconnectDelay = 2e3;
2983
3172
  const maxReconnectDelay = 3e4;
@@ -2985,11 +3174,13 @@ function CallControls({ onDataChange }) {
2985
3174
  const [statusAnchorEl, setStatusAnchorEl] = (0, import_react11.useState)(null);
2986
3175
  const [dialerAnchorEl, setDialerAnchorEl] = (0, import_react11.useState)(null);
2987
3176
  const [ambulanceAnchorEl, setAmbulanceAnchorEl] = (0, import_react11.useState)(null);
3177
+ const [moreOptionsAnchorEl, setMoreOptionsAnchorEl] = (0, import_react11.useState)(null);
2988
3178
  const [showIframe, setShowIframe] = (0, import_react11.useState)(true);
2989
3179
  const [openCallDisposition, setOpenCallDisposition] = (0, import_react11.useState)(false);
2990
3180
  const [openProcessorDialog, setOpenProcessorDialog] = (0, import_react11.useState)(false);
2991
3181
  const [openCallHistoryDialog, setOpenCallHistoryDialog] = (0, import_react11.useState)(false);
2992
3182
  const [processList, setProcessList] = (0, import_react11.useState)(null);
3183
+ const [breaksList, setBreaksList] = (0, import_react11.useState)(null);
2993
3184
  const [phoneNumber, setPhoneNumber] = (0, import_react11.useState)("");
2994
3185
  const [callDuration, setCallDuration] = (0, import_react11.useState)(0);
2995
3186
  const [callWrapuptime, setCallWrapuptime] = (0, import_react11.useState)(null);
@@ -3013,17 +3204,13 @@ function CallControls({ onDataChange }) {
3013
3204
  setDialerAnchorEl(null);
3014
3205
  }
3015
3206
  });
3016
- const [holdOrUnHold, { isLoading: holdOrUnHoldLoading }] = usePostRequest({
3017
- // onSuccess: () => {
3018
- // sdkStateManager.setHolding(!state.isHolding);
3019
- // },
3020
- });
3021
- const [muteOrUnMute, { isLoading: muteOrUnMuteLoading }] = usePostRequest({
3022
- // onSuccess: () => {
3023
- // sdkStateManager.setMuted(!state.isMuted);
3024
- // },
3207
+ const [holdOrUnHold, { isLoading: holdOrUnHoldLoading }] = usePostRequest();
3208
+ const [muteOrUnMute, { isLoading: muteOrUnMuteLoading }] = usePostRequest();
3209
+ const [readyAgentStatus, { isLoading: agentReadyLoading }] = usePostRequest({
3210
+ onSuccess: () => {
3211
+ sdkStateManager.setAgentStatus("");
3212
+ }
3025
3213
  });
3026
- const [readyAgentStatus, { isLoading: agentReadyLoading }] = usePostRequest();
3027
3214
  const [updateAgentStatus, { isLoading }] = usePostRequest();
3028
3215
  const [sendNotification] = usePostRequest();
3029
3216
  const [endCall, { isLoading: endCallLoading }] = usePostRequest({
@@ -3043,12 +3230,18 @@ function CallControls({ onDataChange }) {
3043
3230
  const handleOpenAbulanceServices = (event) => {
3044
3231
  setAmbulanceAnchorEl(event.currentTarget);
3045
3232
  };
3233
+ const handleOpenMoreOptions = (event) => {
3234
+ setMoreOptionsAnchorEl(event.currentTarget);
3235
+ };
3046
3236
  const handleCloseDialer = () => {
3047
3237
  setDialerAnchorEl(null);
3048
3238
  };
3049
3239
  const handleCloseAmbulance = () => {
3050
3240
  setAmbulanceAnchorEl(null);
3051
3241
  };
3242
+ const handleCloseMoreOptions = () => {
3243
+ setMoreOptionsAnchorEl(null);
3244
+ };
3052
3245
  const handleOpenAgentStatus = (event) => {
3053
3246
  setStatusAnchorEl(event.currentTarget);
3054
3247
  };
@@ -3069,7 +3262,9 @@ function CallControls({ onDataChange }) {
3069
3262
  break_type: status,
3070
3263
  userId: state.agentId
3071
3264
  };
3072
- updateAgentStatus(END_POINT.UPDATE_AGENT_BREAK, payload);
3265
+ updateAgentStatus(END_POINT.UPDATE_AGENT_BREAK, payload).then(() => {
3266
+ sdkStateManager.setAgentStatus(status);
3267
+ });
3073
3268
  };
3074
3269
  const handleStartCall = (number) => {
3075
3270
  if (number.length !== 10) {
@@ -3203,7 +3398,7 @@ function CallControls({ onDataChange }) {
3203
3398
  if (prevTime === null || prevTime <= 1) {
3204
3399
  clearInterval(wrapUpinterval);
3205
3400
  handleEndCall({
3206
- disposition: { label: "Resolved", value: "RES" },
3401
+ disposition: { label: "Resolved", value: "AUTO_WRAPUP" },
3207
3402
  followUp: { label: "No", value: "N" },
3208
3403
  callbackDate: "",
3209
3404
  callbackHrs: "",
@@ -3258,17 +3453,25 @@ function CallControls({ onDataChange }) {
3258
3453
  action: "GETAGENTPROCESSLIST",
3259
3454
  refno: "1234221233"
3260
3455
  }).then((res) => {
3261
- var _a3, _b2;
3262
- if (res && res.data && ((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.length) > 1) {
3456
+ var _a3, _b2, _c2, _d2;
3457
+ if (res && ((_a3 = res.data) == null ? void 0 : _a3.data) && ((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.length) > 1) {
3263
3458
  setProcessList(res.data.data);
3264
3459
  setOpenProcessorDialog(true);
3265
3460
  } else {
3266
- sdkStateManager.setProcess((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data[0]);
3461
+ sdkStateManager.setProcess((_d2 = res == null ? void 0 : res.data) == null ? void 0 : _d2.data[0]);
3267
3462
  setOpenProcessorDialog(false);
3268
3463
  }
3269
3464
  }).catch((err) => {
3270
3465
  showToast(err.response.data.message, "error");
3271
3466
  });
3467
+ axios_default.get(END_POINT.BREAKS_LIST).then((res) => {
3468
+ var _a3, _b2, _c2;
3469
+ if (res && ((_a3 = res.data) == null ? void 0 : _a3.data) && ((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.length)) {
3470
+ setBreaksList(res.data.data);
3471
+ }
3472
+ }).catch((err) => {
3473
+ showToast(err.response.data.message, "error");
3474
+ });
3272
3475
  }
3273
3476
  }, [state.agentId]);
3274
3477
  const connectWebSocket = () => {
@@ -3298,7 +3501,7 @@ function CallControls({ onDataChange }) {
3298
3501
  }, 3e4);
3299
3502
  };
3300
3503
  webSocketRef.current.onmessage = (event) => {
3301
- var _a3, _b2;
3504
+ var _a3, _b2, _c2, _d2, _e2;
3302
3505
  try {
3303
3506
  const data = JSON.parse(event.data);
3304
3507
  if (data.type === "pong") {
@@ -3307,79 +3510,77 @@ function CallControls({ onDataChange }) {
3307
3510
  const sdkState = (0, import_vault5.getItem)(STORAGE_KEY);
3308
3511
  const confrence = getCombineConfrenceData(sdkState, data);
3309
3512
  const callData = {
3310
- "agent_id": data == null ? void 0 : data.agent_id,
3311
- "status": data == null ? void 0 : data.status,
3312
- "type": data == null ? void 0 : data.type,
3313
- "event_time": data == null ? void 0 : data.event_time,
3314
- "phone_number": data == null ? void 0 : data.phone_number,
3315
- "convox_id": data == null ? void 0 : data.convox_id,
3316
- "process_id": data == null ? void 0 : data.process_id,
3317
- "process_name": data == null ? void 0 : data.process_name,
3318
- "hold": data == null ? void 0 : data.hold,
3319
- "mute": data == null ? void 0 : data.mute,
3320
- "mode": data == null ? void 0 : data.mode,
3321
- "queue_name": data == null ? void 0 : data.queue_name
3513
+ agent_id: data == null ? void 0 : data.agent_id,
3514
+ status: data == null ? void 0 : data.status,
3515
+ type: data == null ? void 0 : data.type,
3516
+ event_time: data == null ? void 0 : data.event_time,
3517
+ phone_number: data == null ? void 0 : data.phone_number,
3518
+ convox_id: data == null ? void 0 : data.convox_id,
3519
+ process_id: data == null ? void 0 : data.process_id,
3520
+ process_name: data == null ? void 0 : data.process_name,
3521
+ hold: data == null ? void 0 : data.hold,
3522
+ mute: data == null ? void 0 : data.mute,
3523
+ mode: data == null ? void 0 : data.mode,
3524
+ queue_name: data == null ? void 0 : data.queue_name
3322
3525
  };
3323
3526
  sdkStateManager.updateCallData(callData);
3324
3527
  sdkStateManager.updateConferenceData([...confrence]);
3325
3528
  if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
3326
3529
  setShowIframe(true);
3327
3530
  setCallWrapuptime((_b2 = (_a3 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _a3.auto_wrapup_time) != null ? _b2 : null);
3328
- sdkStateManager.updateConferenceData(
3329
- [
3330
- {
3331
- line: 1,
3332
- status: "IDLE",
3333
- type: "",
3334
- phone: "",
3335
- isMute: false,
3336
- isHold: false,
3337
- isCallStart: false,
3338
- isMergeCall: false
3339
- },
3340
- {
3341
- line: 2,
3342
- status: "IDLE",
3343
- type: "",
3344
- phone: "",
3345
- isMute: false,
3346
- isHold: false,
3347
- isCallStart: false,
3348
- isMergeCall: false
3349
- },
3350
- {
3351
- line: 3,
3352
- status: "IDLE",
3353
- type: "",
3354
- phone: "",
3355
- isMute: false,
3356
- isHold: false,
3357
- isCallStart: false,
3358
- isMergeCall: false
3359
- },
3360
- {
3361
- line: 4,
3362
- status: "IDLE",
3363
- type: "",
3364
- phone: "",
3365
- isMute: false,
3366
- isHold: false,
3367
- isCallStart: false,
3368
- isMergeCall: false
3369
- },
3370
- {
3371
- line: 5,
3372
- status: "IDLE",
3373
- type: "",
3374
- phone: "",
3375
- isMute: false,
3376
- isHold: false,
3377
- isCallStart: false,
3378
- isMergeCall: false
3379
- }
3380
- ]
3381
- );
3382
- if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current) {
3531
+ sdkStateManager.updateConferenceData([
3532
+ {
3533
+ line: 1,
3534
+ status: "IDLE",
3535
+ type: "",
3536
+ phone: "",
3537
+ isMute: false,
3538
+ isHold: false,
3539
+ isCallStart: false,
3540
+ isMergeCall: false
3541
+ },
3542
+ {
3543
+ line: 2,
3544
+ status: "IDLE",
3545
+ type: "",
3546
+ phone: "",
3547
+ isMute: false,
3548
+ isHold: false,
3549
+ isCallStart: false,
3550
+ isMergeCall: false
3551
+ },
3552
+ {
3553
+ line: 3,
3554
+ status: "IDLE",
3555
+ type: "",
3556
+ phone: "",
3557
+ isMute: false,
3558
+ isHold: false,
3559
+ isCallStart: false,
3560
+ isMergeCall: false
3561
+ },
3562
+ {
3563
+ line: 4,
3564
+ status: "IDLE",
3565
+ type: "",
3566
+ phone: "",
3567
+ isMute: false,
3568
+ isHold: false,
3569
+ isCallStart: false,
3570
+ isMergeCall: false
3571
+ },
3572
+ {
3573
+ line: 5,
3574
+ status: "IDLE",
3575
+ type: "",
3576
+ phone: "",
3577
+ isMute: false,
3578
+ isHold: false,
3579
+ isCallStart: false,
3580
+ isMergeCall: false
3581
+ }
3582
+ ]);
3583
+ if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((_c2 = state == null ? void 0 : state.sdkConfig) == null ? void 0 : _c2.enableRingtone)) {
3383
3584
  audioRef.current.play().catch((error) => {
3384
3585
  console.error("Failed to play ringtone:", error);
3385
3586
  });
@@ -3390,13 +3591,40 @@ function CallControls({ onDataChange }) {
3390
3591
  audioRef.current.currentTime = 0;
3391
3592
  }
3392
3593
  }
3393
- if (data.status === "ONCALL" /* ONCALL */) {
3594
+ if (data.status === "IDLE" /* IDLE */) {
3595
+ USB_LIGHT_REQUEST(USB_LIGHT_ON("green"));
3596
+ } else if ((data == null ? void 0 : data.mute) !== 1 && (data == null ? void 0 : data.hold) !== 1 && data.status === "ONCALL" /* ONCALL */) {
3597
+ USB_LIGHT_REQUEST(USB_LIGHT_ON("red"));
3394
3598
  sdkStateManager.startCall();
3395
3599
  if (!showIframe) {
3396
3600
  setShowIframe(true);
3397
3601
  }
3398
- }
3399
- if (data.status === "WRAPUP" /* WRAPUP */) {
3602
+ } else if (((data == null ? void 0 : data.mute) === 1 || (data == null ? void 0 : data.hold) === 1) && data.status === "ONCALL" /* ONCALL */) {
3603
+ USB_LIGHT_REQUEST(USB_LIGHT_FLASH("red", 1));
3604
+ } else if (data.status === "BREAK" /* BREAK */) {
3605
+ const breakTime = (_d2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _d2.break_time;
3606
+ const eventTime = (_e2 = data == null ? void 0 : data.event_time) != null ? _e2 : null;
3607
+ if (eventTime !== lastEventTimeRef.current) {
3608
+ hasFlashedRef.current = false;
3609
+ lastEventTimeRef.current = eventTime;
3610
+ }
3611
+ let isOverLimit = false;
3612
+ if (breakTime && eventTime) {
3613
+ const differenceInMinutes = ((/* @__PURE__ */ new Date()).getTime() - new Date(eventTime).getTime()) / 6e4;
3614
+ if (Number(differenceInMinutes.toFixed(0)) >= Number(breakTime)) {
3615
+ isOverLimit = true;
3616
+ }
3617
+ }
3618
+ if (isOverLimit) {
3619
+ if (!hasFlashedRef.current) {
3620
+ USB_LIGHT_REQUEST(USB_LIGHT_FLASH("yellow", 1));
3621
+ hasFlashedRef.current = true;
3622
+ }
3623
+ } else {
3624
+ USB_LIGHT_REQUEST(USB_LIGHT_ON("yellow"));
3625
+ }
3626
+ } else if (data.status === "WRAPUP" /* WRAPUP */) {
3627
+ USB_LIGHT_REQUEST(USB_LIGHT_FLASH("green", 1));
3400
3628
  sdkStateManager.endCall();
3401
3629
  }
3402
3630
  } catch (e) {
@@ -3549,18 +3777,31 @@ function CallControls({ onDataChange }) {
3549
3777
  size: "small",
3550
3778
  onClick: (e) => {
3551
3779
  var _a3, _b2;
3552
- if (!["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(
3553
- (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3554
- )) {
3780
+ if (![
3781
+ "BREAK" /* BREAK */,
3782
+ "ONCALL" /* ONCALL */,
3783
+ "RINGING" /* RINGING */,
3784
+ "WRAPUP" /* WRAPUP */
3785
+ ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3555
3786
  handleOpenDialer(e);
3556
3787
  }
3557
3788
  },
3558
- disabled: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()),
3789
+ disabled: [
3790
+ "BREAK" /* BREAK */,
3791
+ "ONCALL" /* ONCALL */,
3792
+ "RINGING" /* RINGING */,
3793
+ "WRAPUP" /* WRAPUP */
3794
+ ].includes(state.callData.status.toUpperCase()),
3559
3795
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3560
3796
  import_icons_material2.WifiCalling3,
3561
3797
  {
3562
3798
  sx: {
3563
- color: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()) ? "action.selected" : "success.main"
3799
+ color: [
3800
+ "BREAK" /* BREAK */,
3801
+ "ONCALL" /* ONCALL */,
3802
+ "RINGING" /* RINGING */,
3803
+ "WRAPUP" /* WRAPUP */
3804
+ ].includes(state.callData.status.toUpperCase()) ? "action.selected" : "success.main"
3564
3805
  }
3565
3806
  }
3566
3807
  )
@@ -3631,18 +3872,26 @@ function CallControls({ onDataChange }) {
3631
3872
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Agent Ready", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3632
3873
  import_material4.Button,
3633
3874
  {
3634
- variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_t = (_s = state.callData) == null ? void 0 : _s.status) == null ? void 0 : _t.toUpperCase()) ? "outlined" : "contained",
3875
+ variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3876
+ (_t = (_s = state.callData) == null ? void 0 : _s.status) == null ? void 0 : _t.toUpperCase()
3877
+ ) ? "outlined" : "contained",
3635
3878
  onClick: (e) => {
3636
3879
  var _a3, _b2;
3637
- if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3880
+ if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3881
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3882
+ )) {
3638
3883
  e.stopPropagation();
3639
3884
  handleAgentReady();
3640
3885
  }
3641
3886
  },
3642
3887
  classes: {
3643
- root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_v = (_u = state.callData) == null ? void 0 : _u.status) == null ? void 0 : _v.toUpperCase()) ? "outlined" : "enabled"
3888
+ root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3889
+ (_v = (_u = state.callData) == null ? void 0 : _u.status) == null ? void 0 : _v.toUpperCase()
3890
+ ) ? "outlined" : "enabled"
3644
3891
  },
3645
- sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_x = (_w = state.callData) == null ? void 0 : _w.status) == null ? void 0 : _x.toUpperCase()) ? outlined : enabled),
3892
+ sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3893
+ (_x = (_w = state.callData) == null ? void 0 : _w.status) == null ? void 0 : _x.toUpperCase()
3894
+ ) ? outlined : enabled),
3646
3895
  disabled: agentReadyLoading,
3647
3896
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SupportAgent, {})
3648
3897
  }
@@ -3694,18 +3943,18 @@ function CallControls({ onDataChange }) {
3694
3943
  {
3695
3944
  variant: state.openCallTransferDialog ? "contained" : "outlined",
3696
3945
  onClick: (e) => {
3697
- var _a3, _b2;
3698
- if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */) {
3946
+ var _a3, _b2, _c2;
3947
+ if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */ || ((_c2 = state == null ? void 0 : state.conferenceLine[0]) == null ? void 0 : _c2.status) === "HOLD" /* HOLD */) {
3699
3948
  e.stopPropagation();
3700
3949
  sdkStateManager.setOpenCallTransferDialog(true);
3701
3950
  }
3702
3951
  },
3703
- sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3704
- disabled: ((_ca = (_ba = state.callData) == null ? void 0 : _ba.status) == null ? void 0 : _ca.toUpperCase()) !== "ONCALL" /* ONCALL */,
3952
+ sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" /* ONCALL */ || ((_ba = state == null ? void 0 : state.conferenceLine[0]) == null ? void 0 : _ba.status) === "HOLD" /* HOLD */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3953
+ disabled: ((_da = (_ca = state.callData) == null ? void 0 : _ca.status) == null ? void 0 : _da.toUpperCase()) !== "ONCALL" /* ONCALL */ || ((_ea = state == null ? void 0 : state.conferenceLine[0]) == null ? void 0 : _ea.status) === "HOLD" /* HOLD */,
3705
3954
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {})
3706
3955
  }
3707
3956
  ) }),
3708
- !((_da = state.sdkConfig) == null ? void 0 : _da.disableConferenceButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3957
+ !((_fa = state.sdkConfig) == null ? void 0 : _fa.disableConferenceButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3709
3958
  import_material4.Button,
3710
3959
  {
3711
3960
  variant: state.openConferenceDialog ? "contained" : "outlined",
@@ -3716,37 +3965,34 @@ function CallControls({ onDataChange }) {
3716
3965
  sdkStateManager.setOpenConferenceDialog(true);
3717
3966
  }
3718
3967
  },
3719
- sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((_fa = (_ea = state.callData) == null ? void 0 : _ea.status) == null ? void 0 : _fa.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3720
- disabled: ((_ha = (_ga = state.callData) == null ? void 0 : _ga.status) == null ? void 0 : _ha.toUpperCase()) !== "ONCALL" /* ONCALL */,
3968
+ sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((_ha = (_ga = state.callData) == null ? void 0 : _ga.status) == null ? void 0 : _ha.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3969
+ disabled: ((_ja = (_ia = state.callData) == null ? void 0 : _ia.status) == null ? void 0 : _ja.toUpperCase()) !== "ONCALL" /* ONCALL */,
3721
3970
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Group, {})
3722
3971
  }
3723
3972
  ) }),
3724
- ((_ia = state.sdkConfig) == null ? void 0 : _ia.enableSmsServices) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Send SMS", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3973
+ ((_ka = state.sdkConfig) == null ? void 0 : _ka.enableSmsServices) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Send SMS", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3725
3974
  import_material4.Button,
3726
3975
  {
3727
3976
  variant: Boolean(ambulanceAnchorEl) ? "contained" : "outlined",
3728
3977
  onClick: (e) => {
3729
3978
  var _a3, _b2;
3730
- if ([
3731
- "ONCALL" /* ONCALL */,
3732
- "WRAPUP" /* WRAPUP */
3733
- ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3979
+ if (["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
3980
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3981
+ )) {
3734
3982
  e.stopPropagation();
3735
3983
  handleOpenAbulanceServices(e);
3736
3984
  }
3737
3985
  },
3738
- sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : [
3739
- "ONCALL" /* ONCALL */,
3740
- "WRAPUP" /* WRAPUP */
3741
- ].includes((_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3742
- disabled: ![
3743
- "ONCALL" /* ONCALL */,
3744
- "WRAPUP" /* WRAPUP */
3745
- ].includes((_ma = (_la = state.callData) == null ? void 0 : _la.status) == null ? void 0 : _ma.toUpperCase()),
3986
+ sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : ["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
3987
+ (_ma = (_la = state.callData) == null ? void 0 : _la.status) == null ? void 0 : _ma.toUpperCase()
3988
+ ) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3989
+ disabled: !["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
3990
+ (_oa = (_na = state.callData) == null ? void 0 : _na.status) == null ? void 0 : _oa.toUpperCase()
3991
+ ),
3746
3992
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SmsSharp, {})
3747
3993
  }
3748
3994
  ) }),
3749
- !((_na = state.sdkConfig) == null ? void 0 : _na.disableEndCallButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3995
+ !((_pa = state.sdkConfig) == null ? void 0 : _pa.disableEndCallButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3750
3996
  import_material4.Button,
3751
3997
  {
3752
3998
  variant: [
@@ -3754,7 +4000,7 @@ function CallControls({ onDataChange }) {
3754
4000
  "RINGING" /* RINGING */,
3755
4001
  "DIALING" /* DIALING */,
3756
4002
  "WRAPUP" /* WRAPUP */
3757
- ].includes((_pa = (_oa = state.callData) == null ? void 0 : _oa.status) == null ? void 0 : _pa.toUpperCase()) ? "contained" : "outlined",
4003
+ ].includes((_ra = (_qa = state.callData) == null ? void 0 : _qa.status) == null ? void 0 : _ra.toUpperCase()) ? "contained" : "outlined",
3758
4004
  onClick: (e) => {
3759
4005
  var _a3, _b2;
3760
4006
  if ([
@@ -3772,7 +4018,7 @@ function CallControls({ onDataChange }) {
3772
4018
  "RINGING" /* RINGING */,
3773
4019
  "DIALING" /* DIALING */,
3774
4020
  "WRAPUP" /* WRAPUP */
3775
- ].includes((_ra = (_qa = state.callData) == null ? void 0 : _qa.status) == null ? void 0 : _ra.toUpperCase()) ? __spreadProps(__spreadValues({}, enabled), {
4021
+ ].includes((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) ? __spreadProps(__spreadValues({}, enabled), {
3776
4022
  borderRight: "1px",
3777
4023
  backgroundColor: "error.main",
3778
4024
  minWidth: "60px !important",
@@ -3796,7 +4042,7 @@ function CallControls({ onDataChange }) {
3796
4042
  "RINGING" /* RINGING */,
3797
4043
  "DIALING" /* DIALING */,
3798
4044
  "WRAPUP" /* WRAPUP */
3799
- ].includes((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) || endCallLoading,
4045
+ ].includes((_va = (_ua = state.callData) == null ? void 0 : _ua.status) == null ? void 0 : _va.toUpperCase()) || endCallLoading,
3800
4046
  children: endCallLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3801
4047
  import_material4.CircularProgress,
3802
4048
  {
@@ -3805,6 +4051,26 @@ function CallControls({ onDataChange }) {
3805
4051
  }
3806
4052
  ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.CallEnd, {})
3807
4053
  }
4054
+ ) }),
4055
+ !((_wa = state.sdkConfig) == null ? void 0 : _wa.disabledMoreOptionsButton) && processList && (processList == null ? void 0 : processList.length) > 1 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Switch Process", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4056
+ import_material4.Button,
4057
+ {
4058
+ variant: Boolean(moreOptionsAnchorEl) ? "contained" : "outlined",
4059
+ onClick: (e) => {
4060
+ var _a3, _b2;
4061
+ if (["BREAK" /* BREAK */, "IDLE" /* IDLE */].includes(
4062
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
4063
+ )) {
4064
+ e.stopPropagation();
4065
+ handleOpenMoreOptions(e);
4066
+ }
4067
+ },
4068
+ sx: Boolean(moreOptionsAnchorEl) ? __spreadValues({}, enabled) : __spreadValues({}, outlined),
4069
+ disabled: !["BREAK" /* BREAK */, "IDLE" /* IDLE */].includes(
4070
+ (_ya = (_xa = state.callData) == null ? void 0 : _xa.status) == null ? void 0 : _ya.toUpperCase()
4071
+ ),
4072
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MoreVert, {})
4073
+ }
3808
4074
  ) })
3809
4075
  ]
3810
4076
  }
@@ -3836,7 +4102,7 @@ function CallControls({ onDataChange }) {
3836
4102
  transition: theme.transitions.create(["box-shadow", "transform"], {
3837
4103
  duration: theme.transitions.duration.short
3838
4104
  }),
3839
- visibility: showIframe && !((_ua = state.sdkConfig) == null ? void 0 : _ua.disableSoftPhone) ? "visible" : "hidden",
4105
+ visibility: showIframe && !((_za = state.sdkConfig) == null ? void 0 : _za.disableSoftPhone) ? "visible" : "hidden",
3840
4106
  userSelect: "none"
3841
4107
  },
3842
4108
  children: [
@@ -3870,7 +4136,7 @@ function CallControls({ onDataChange }) {
3870
4136
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3871
4137
  "iframe",
3872
4138
  {
3873
- src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_va = state.process) == null ? void 0 : _va.process_id}`,
4139
+ src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_Aa = state.process) == null ? void 0 : _Aa.process_id}`,
3874
4140
  height: 380,
3875
4141
  width: 420,
3876
4142
  allow: "camera; microphone; autoplay",
@@ -3912,7 +4178,13 @@ function CallControls({ onDataChange }) {
3912
4178
  value: phoneNumber,
3913
4179
  placeholder: "Enter Mobile No.",
3914
4180
  onChange: (e) => {
3915
- setPhoneNumber(e.target.value);
4181
+ const value = e.target.value;
4182
+ setPhoneNumber(value);
4183
+ },
4184
+ onKeyDown: (e) => {
4185
+ if (e.key === "Enter") {
4186
+ handleStartCall(phoneNumber);
4187
+ }
3916
4188
  }
3917
4189
  }
3918
4190
  ),
@@ -4005,6 +4277,60 @@ function CallControls({ onDataChange }) {
4005
4277
  )
4006
4278
  }
4007
4279
  ),
4280
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4281
+ import_material4.Menu,
4282
+ {
4283
+ anchorEl: moreOptionsAnchorEl,
4284
+ open: Boolean(moreOptionsAnchorEl),
4285
+ onClose: handleCloseMoreOptions,
4286
+ onClick: (e) => e.stopPropagation(),
4287
+ sx: {
4288
+ zIndex: 99999
4289
+ },
4290
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4291
+ import_material4.Box,
4292
+ {
4293
+ sx: {
4294
+ all: "unset",
4295
+ padding: " 0px 20px",
4296
+ "&hover": {
4297
+ backgroundColor: "white"
4298
+ },
4299
+ display: "flex",
4300
+ alignItems: "center",
4301
+ flexDirection: "column",
4302
+ gap: 1
4303
+ },
4304
+ children: processList == null ? void 0 : processList.map((item) => {
4305
+ var _a3, _b2, _c2;
4306
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4307
+ import_material4.Box,
4308
+ {
4309
+ sx: {
4310
+ width: "100%"
4311
+ },
4312
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: (_a3 = item == null ? void 0 : item.process_name) != null ? _a3 : "", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4313
+ import_material4.Button,
4314
+ {
4315
+ color: "primary",
4316
+ variant: ((_b2 = state == null ? void 0 : state.process) == null ? void 0 : _b2.process_id) === (item == null ? void 0 : item.process_id) ? "contained" : "outlined",
4317
+ onClick: () => {
4318
+ sdkStateManager.setProcess(item);
4319
+ },
4320
+ sx: {
4321
+ width: "100%"
4322
+ },
4323
+ children: (_c2 = item == null ? void 0 : item.process_name) != null ? _c2 : ""
4324
+ }
4325
+ ) })
4326
+ },
4327
+ item == null ? void 0 : item.process_id
4328
+ );
4329
+ })
4330
+ }
4331
+ )
4332
+ }
4333
+ ),
4008
4334
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4009
4335
  import_material4.Menu,
4010
4336
  {
@@ -4015,7 +4341,32 @@ function CallControls({ onDataChange }) {
4015
4341
  sx: {
4016
4342
  zIndex: 99999
4017
4343
  },
4018
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.MenuItem, { onClick: () => handleUpdateAgentStatus("Lunch"), children: "- Break" })
4344
+ children: !breaksList || (breaksList == null ? void 0 : breaksList.length) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.MenuItem, { onClick: () => handleUpdateAgentStatus("Lunch"), children: "- Break" }) : breaksList == null ? void 0 : breaksList.map((item) => {
4345
+ var _a3, _b2, _c2;
4346
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4347
+ import_material4.MenuItem,
4348
+ {
4349
+ sx: {
4350
+ // hilight background of selected
4351
+ backgroundColor: ((_a3 = state == null ? void 0 : state.callData) == null ? void 0 : _a3.status) === "BREAK" && (state == null ? void 0 : state.agentStatus) === (item == null ? void 0 : item.type) ? "primary.main" : "transparent",
4352
+ color: ((_b2 = state == null ? void 0 : state.callData) == null ? void 0 : _b2.status) === "BREAK" && (state == null ? void 0 : state.agentStatus) === (item == null ? void 0 : item.type) ? "white" : "primary.main",
4353
+ ":hover": {
4354
+ backgroundColor: ((_c2 = state == null ? void 0 : state.callData) == null ? void 0 : _c2.status) === "BREAK" && (state == null ? void 0 : state.agentStatus) === (item == null ? void 0 : item.type) ? "primary.dark" : "selected.hover"
4355
+ // color:
4356
+ // state?.callData?.status === "BREAK" && state?.agentStatus === item?.type ?
4357
+ // "primary.main"
4358
+ // : "primary.main",
4359
+ }
4360
+ },
4361
+ onClick: () => handleUpdateAgentStatus(item == null ? void 0 : item.type),
4362
+ children: [
4363
+ "- ",
4364
+ item == null ? void 0 : item.type
4365
+ ]
4366
+ },
4367
+ item == null ? void 0 : item.type
4368
+ );
4369
+ })
4019
4370
  }
4020
4371
  ),
4021
4372
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(