call-control-sdk 6.5.5-uat.4 → 6.5.5-uat.6

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,6 +85,7 @@ 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`,
@@ -212,7 +213,6 @@ var SDKStateManager = class {
212
213
  const stored = (0, import_vault.getItem)(this.STORAGE_KEY);
213
214
  if (stored) {
214
215
  const parsedState = stored;
215
- console.log("loading from storage", parsedState);
216
216
  this.state = __spreadProps(__spreadValues({}, this.state), {
217
217
  agentId: parsedState.agentId || "",
218
218
  authorization: parsedState.authorization || void 0,
@@ -646,6 +646,23 @@ var axios_default = axiosInstance;
646
646
 
647
647
  // call-control-sdk/lib/hooks/useLogout.ts
648
648
  var import_vault2 = require("@react-solutions/vault");
649
+
650
+ // call-control-sdk/lib/services/usbLight.ts
651
+ var USB_LIGHT_BASE_URL = `/usb-light`;
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
649
666
  var useLogout = () => {
650
667
  const [loading, setLoading] = (0, import_react.useState)(false);
651
668
  const [success, setSuccess] = (0, import_react.useState)(false);
@@ -653,6 +670,7 @@ var useLogout = () => {
653
670
  const [error, setError] = (0, import_react.useState)(null);
654
671
  const [data, setData] = (0, import_react.useState)(null);
655
672
  const handleLogout = (0, import_react.useCallback)(async () => {
673
+ USB_LIGHT_REQUEST(USB_LIGHT_ALL_OFF());
656
674
  const state = (0, import_vault2.getItem)(STORAGE_KEY);
657
675
  setLoading(true);
658
676
  const payload = {
@@ -1327,7 +1345,15 @@ var ConferenceTableRow = ({ each, isLineDialing }) => {
1327
1345
  placeholder: "Phone Number",
1328
1346
  fullWidth: true,
1329
1347
  value: (each == null ? void 0 : each.phone) || "",
1330
- 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 : "") || isLineDialing,
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,
1331
1357
  onChange: (e) => {
1332
1358
  onConferenceLineUpdate(each, { phone: e.target.value });
1333
1359
  }
@@ -1585,8 +1611,26 @@ function ConferenceDialog() {
1585
1611
  setConferenceCallEndAll(false);
1586
1612
  });
1587
1613
  };
1614
+ const handleTransferConferenceCall = () => {
1615
+ var _a3, _b2, _c, _d;
1616
+ const payload = {
1617
+ action: "TRANSFERAPI",
1618
+ userid: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.agent_id) != null ? _b2 : "",
1619
+ process_name: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
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
+ handleClose();
1625
+ }).catch((err) => {
1626
+ var _a4, _b3, _c2, _d2;
1627
+ const message = ((_b3 = (_a4 = err.response) == null ? void 0 : _a4.data) == null ? void 0 : _b3.detail) || ((_d2 = (_c2 = err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || err.message || "An unknown error occurred";
1628
+ showToast(message, "error");
1629
+ }).finally(() => {
1630
+ setConferenceCallEndAll(false);
1631
+ });
1632
+ };
1588
1633
  const isLineDialing = (_a2 = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _a2.some((item) => (item == null ? void 0 : item.status) === "DIALING" /* DIALING */);
1589
- console.log("dataaaaa", state == null ? void 0 : state.conferenceLine, isLineDialing);
1590
1634
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1591
1635
  import_material3.Dialog,
1592
1636
  {
@@ -1602,14 +1646,45 @@ function ConferenceDialog() {
1602
1646
  display: "flex",
1603
1647
  justifyContent: "space-between",
1604
1648
  alignItems: "center",
1605
- padding: "10px 16px"
1649
+ padding: "0px 16px",
1650
+ paddingBottom: "6px",
1651
+ boxShadow: "1px 1px 2px #e7e5e5ff",
1652
+ margin: "10px 0px"
1606
1653
  },
1607
1654
  children: [
1608
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Typography, { variant: "body1", children: [
1609
- (_b = state == null ? void 0 : state.agentId) != null ? _b : "",
1610
- " conference"
1611
- ] }),
1612
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
1655
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1656
+ import_material3.Typography,
1657
+ {
1658
+ variant: "body1",
1659
+ color: "primary.main",
1660
+ sx: { textTransform: "uppercase", fontWeight: "bold", fontSize: "14px" },
1661
+ children: [
1662
+ (_b = state == null ? void 0 : state.agentId) != null ? _b : "",
1663
+ " conference"
1664
+ ]
1665
+ }
1666
+ ),
1667
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { children: [
1668
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1669
+ import_material3.Button,
1670
+ {
1671
+ color: "primary",
1672
+ variant: "outlined",
1673
+ onClick: handleTransferConferenceCall,
1674
+ disabled: conferenceCallEndAll,
1675
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.TransferWithinAStation, {}),
1676
+ children: "Exit Conference"
1677
+ }
1678
+ ),
1679
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1680
+ import_material3.IconButton,
1681
+ {
1682
+ onClick: handleClose,
1683
+ color: "primary",
1684
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, { sx: { color: "primary.main" } })
1685
+ }
1686
+ )
1687
+ ] })
1613
1688
  ]
1614
1689
  }
1615
1690
  ),
@@ -1682,7 +1757,13 @@ function ConferenceDialog() {
1682
1757
  ]
1683
1758
  }
1684
1759
  ) }),
1685
- /* @__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, isLineDialing })) })
1760
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TableBody, { children: state == null ? void 0 : state.conferenceLine.map((each) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1761
+ ConferenceTableRow,
1762
+ {
1763
+ each,
1764
+ isLineDialing
1765
+ }
1766
+ )) })
1686
1767
  ]
1687
1768
  }
1688
1769
  )
@@ -1774,7 +1855,10 @@ function CallTransferDialog({ open }) {
1774
1855
  const [getIdelAgentsList, { data: idleAgentsList, isLoading: isIdleAgentsListLoading }] = usePostRequest({
1775
1856
  disabledSuccessToast: true
1776
1857
  });
1777
- const [getHospitalsServicesList, { data: hospitalsServicesList, isLoading: isHospitalsServicesListLoading }] = useGetRequest({
1858
+ const [
1859
+ getHospitalsServicesList,
1860
+ { data: hospitalsServicesList, isLoading: isHospitalsServicesListLoading }
1861
+ ] = useGetRequest({
1778
1862
  disabledSuccessToast: true
1779
1863
  });
1780
1864
  const [
@@ -1828,7 +1912,6 @@ function CallTransferDialog({ open }) {
1828
1912
  callreferenceid: (_K = (_J = state.callData) == null ? void 0 : _J.convox_id) != null ? _K : "",
1829
1913
  blind_transfer_no: (_L = data == null ? void 0 : data.mobile_number) != null ? _L : ""
1830
1914
  };
1831
- console.log("payload", payload);
1832
1915
  blindTransferCall(END_POINT.BLIEND_TRANSFER, payload);
1833
1916
  }
1834
1917
  };
@@ -1937,274 +2020,230 @@ function CallTransferDialog({ open }) {
1937
2020
  ]
1938
2021
  }
1939
2022
  ),
1940
- !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)(
2023
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1941
2024
  import_material3.Box,
1942
2025
  {
1943
2026
  sx: {
1944
- p: 1,
1945
- display: "flex",
1946
- alignItems: "center",
2027
+ display: "grid",
2028
+ 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)",
2029
+ gap: 1,
2030
+ padding: "10px",
2031
+ flexWrap: "wrap",
1947
2032
  boxShadow: "1px 1px 4px #d3d3d3ff",
1948
- padding: "6px",
1949
- borderRadius: "10px",
1950
- "&:hover": { bgcolor: "action.selected" }
2033
+ borderRadius: "10px"
1951
2034
  },
1952
- children: [
1953
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1954
- import_material3.Typography,
1955
- {
1956
- variant: "body1",
1957
- sx: {
1958
- mx: 1,
1959
- width: "200px",
1960
- maxWidth: "250px",
1961
- display: "flex",
1962
- alignItems: "center"
1963
- },
1964
- children: [
1965
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MemoryOutlined, { sx: { marginRight: "4px" } }),
1966
- process.process_name
1967
- ]
1968
- }
1969
- ),
1970
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1971
- import_material3.IconButton,
1972
- {
1973
- color: "success",
1974
- sx: {
1975
- bgcolor: "action.hover",
1976
- "&:hover": { bgcolor: "action.selected" }
1977
- },
1978
- onClick: () => {
1979
- handleTransferCall(process, "PROCESS");
1980
- },
1981
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
1982
- }
1983
- )
1984
- ]
1985
- },
1986
- index
1987
- )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1988
- import_material3.Box,
1989
- {
1990
- sx: {
1991
- display: "flex",
1992
- alignItems: "center",
1993
- justifyContent: "center",
1994
- flexDirection: "column"
1995
- },
1996
- p: 2,
1997
- children: [
1998
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
1999
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2000
- import_material3.Typography,
2001
- {
2002
- variant: "body1",
2003
- sx: {
2004
- fontSize: "16px",
2005
- letterSpacing: "0.02em",
2006
- textTransform: "capitalize",
2007
- display: "flex",
2008
- alignItems: "center",
2009
- justifyContent: "center",
2010
- width: "100%",
2011
- margin: "10px 0px",
2012
- color: "primary.main",
2013
- height: "20px"
2014
- },
2015
- children: "No Process Found"
2016
- }
2017
- )
2018
- ]
2019
- }
2020
- ) }),
2021
- !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) => {
2022
- var _a3, _b2, _c2, _d2, _e2, _f2;
2023
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2024
- import_material3.Box,
2025
- {
2026
- sx: {
2027
- p: 1,
2028
- display: "flex",
2029
- alignItems: "center",
2030
- boxShadow: "1px 1px 4px #d3d3d3ff",
2031
- padding: "6px",
2032
- borderRadius: "10px",
2033
- "&:hover": { bgcolor: "action.selected" }
2035
+ 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)(
2036
+ import_material3.Box,
2037
+ {
2038
+ sx: {
2039
+ p: 1,
2040
+ display: "flex",
2041
+ alignItems: "center",
2042
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2043
+ padding: "6px",
2044
+ borderRadius: "10px",
2045
+ "&:hover": { bgcolor: "action.selected" }
2046
+ },
2047
+ children: [
2048
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2049
+ import_material3.Typography,
2050
+ {
2051
+ variant: "body1",
2052
+ sx: {
2053
+ mx: 1,
2054
+ width: "200px",
2055
+ maxWidth: "250px",
2056
+ display: "flex",
2057
+ alignItems: "center"
2058
+ },
2059
+ children: [
2060
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MemoryOutlined, { sx: { marginRight: "4px" } }),
2061
+ process.process_name
2062
+ ]
2063
+ }
2064
+ ),
2065
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2066
+ import_material3.IconButton,
2067
+ {
2068
+ color: "success",
2069
+ sx: {
2070
+ bgcolor: "action.hover",
2071
+ "&:hover": { bgcolor: "action.selected" }
2072
+ },
2073
+ onClick: () => {
2074
+ handleTransferCall(process, "PROCESS");
2075
+ },
2076
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2077
+ }
2078
+ )
2079
+ ]
2034
2080
  },
2035
- children: [
2036
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2037
- import_material3.Typography,
2038
- {
2039
- variant: "body1",
2040
- sx: {
2041
- mx: 1,
2042
- width: "200px",
2043
- maxWidth: "250px",
2044
- display: "flex",
2045
- alignItems: "center"
2046
- },
2047
- children: [
2048
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Airlines, { sx: { marginRight: "4px" } }),
2049
- queue.queue_name,
2050
- ((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
2051
- (process) => process.process_id === queue.process_id
2052
- )) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2053
- import_material3.Typography,
2054
- {
2055
- variant: "body1",
2056
- sx: {
2057
- fontSize: "12px",
2058
- fontWeight: "600",
2059
- letterSpacing: "0.02em",
2060
- textTransform: "capitalize",
2061
- color: "gray"
2062
- },
2063
- children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
2064
- (process) => process.process_id === queue.process_id
2065
- )) == null ? void 0 : _f2.process_name) + ")"
2066
- }
2067
- ) : ""
2068
- ]
2069
- }
2070
- ),
2071
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2072
- import_material3.IconButton,
2073
- {
2074
- color: "success",
2075
- sx: {
2076
- bgcolor: "action.hover",
2077
- "&:hover": { bgcolor: "action.selected" }
2078
- },
2079
- onClick: () => {
2080
- handleTransferCall(queue, "QUEUE");
2081
- },
2082
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2083
- }
2084
- )
2085
- ]
2086
- },
2087
- index
2088
- );
2089
- }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2090
- import_material3.Box,
2091
- {
2092
- sx: {
2093
- display: "flex",
2094
- alignItems: "center",
2095
- justifyContent: "center",
2096
- flexDirection: "column"
2097
- },
2098
- p: 2,
2099
- children: [
2100
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2101
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2102
- import_material3.Typography,
2103
- {
2104
- variant: "body1",
2105
- sx: {
2106
- fontSize: "16px",
2107
- letterSpacing: "0.02em",
2108
- textTransform: "capitalize",
2109
- display: "flex",
2110
- alignItems: "center",
2111
- justifyContent: "center",
2112
- width: "100%",
2113
- margin: "10px 0px",
2114
- color: "primary.main",
2115
- height: "20px"
2116
- },
2117
- children: "No Queues Found"
2118
- }
2119
- )
2120
- ]
2081
+ index
2082
+ )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2083
+ import_material3.Box,
2084
+ {
2085
+ sx: {
2086
+ display: "flex",
2087
+ alignItems: "center",
2088
+ justifyContent: "center",
2089
+ flexDirection: "column"
2090
+ },
2091
+ p: 2,
2092
+ children: [
2093
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2094
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2095
+ import_material3.Typography,
2096
+ {
2097
+ variant: "body1",
2098
+ sx: {
2099
+ fontSize: "16px",
2100
+ letterSpacing: "0.02em",
2101
+ textTransform: "capitalize",
2102
+ display: "flex",
2103
+ alignItems: "center",
2104
+ justifyContent: "center",
2105
+ width: "100%",
2106
+ margin: "10px 0px",
2107
+ color: "primary.main",
2108
+ height: "20px"
2109
+ },
2110
+ children: "No Process Found"
2111
+ }
2112
+ )
2113
+ ]
2114
+ }
2115
+ )
2121
2116
  }
2122
- ) }),
2123
- !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)(
2117
+ ),
2118
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "queues" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2124
2119
  import_material3.Box,
2125
2120
  {
2126
2121
  sx: {
2127
- p: 1,
2128
- display: "flex",
2129
- alignItems: "center",
2122
+ display: "grid",
2123
+ 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)",
2124
+ gap: 1,
2125
+ padding: "10px",
2126
+ flexWrap: "wrap",
2130
2127
  boxShadow: "1px 1px 4px #d3d3d3ff",
2131
- padding: "6px",
2132
- borderRadius: "10px",
2133
- "&:hover": { bgcolor: "action.selected" }
2128
+ borderRadius: "10px"
2134
2129
  },
2135
- children: [
2136
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2137
- import_material3.Typography,
2130
+ 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) => {
2131
+ var _a3, _b2, _c2, _d2, _e2, _f2;
2132
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2133
+ import_material3.Box,
2138
2134
  {
2139
- variant: "body1",
2140
2135
  sx: {
2141
- mx: 1,
2142
- width: "200px",
2143
- maxWidth: "250px",
2136
+ p: 1,
2144
2137
  display: "flex",
2145
- alignItems: "center"
2138
+ alignItems: "center",
2139
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2140
+ padding: "6px",
2141
+ borderRadius: "10px",
2142
+ "&:hover": { bgcolor: "action.selected" }
2146
2143
  },
2147
2144
  children: [
2148
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
2149
- agent.name
2145
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2146
+ import_material3.Typography,
2147
+ {
2148
+ variant: "body1",
2149
+ sx: {
2150
+ mx: 1,
2151
+ width: "200px",
2152
+ maxWidth: "250px",
2153
+ display: "flex",
2154
+ alignItems: "center"
2155
+ },
2156
+ children: [
2157
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Airlines, { sx: { marginRight: "4px" } }),
2158
+ queue.queue_name,
2159
+ ((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
2160
+ (process) => process.process_id === queue.process_id
2161
+ )) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2162
+ import_material3.Typography,
2163
+ {
2164
+ variant: "body1",
2165
+ sx: {
2166
+ fontSize: "12px",
2167
+ fontWeight: "600",
2168
+ letterSpacing: "0.02em",
2169
+ textTransform: "capitalize",
2170
+ color: "gray"
2171
+ },
2172
+ children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
2173
+ (process) => process.process_id === queue.process_id
2174
+ )) == null ? void 0 : _f2.process_name) + ")"
2175
+ }
2176
+ ) : ""
2177
+ ]
2178
+ }
2179
+ ),
2180
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2181
+ import_material3.IconButton,
2182
+ {
2183
+ color: "success",
2184
+ sx: {
2185
+ bgcolor: "action.hover",
2186
+ "&:hover": { bgcolor: "action.selected" }
2187
+ },
2188
+ onClick: () => {
2189
+ handleTransferCall(queue, "QUEUE");
2190
+ },
2191
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2192
+ }
2193
+ )
2150
2194
  ]
2151
- }
2152
- ),
2153
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2154
- import_material3.IconButton,
2155
- {
2156
- color: "success",
2157
- sx: {
2158
- bgcolor: "action.hover",
2159
- "&:hover": { bgcolor: "action.selected" }
2160
- },
2161
- onClick: () => {
2162
- handleTransferCall(agent, "AGENT");
2163
- },
2164
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2165
- }
2166
- )
2167
- ]
2168
- },
2169
- index
2170
- )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2195
+ },
2196
+ index
2197
+ );
2198
+ }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2199
+ import_material3.Box,
2200
+ {
2201
+ sx: {
2202
+ display: "flex",
2203
+ alignItems: "center",
2204
+ justifyContent: "center",
2205
+ flexDirection: "column"
2206
+ },
2207
+ p: 2,
2208
+ children: [
2209
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2210
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2211
+ import_material3.Typography,
2212
+ {
2213
+ variant: "body1",
2214
+ sx: {
2215
+ fontSize: "16px",
2216
+ letterSpacing: "0.02em",
2217
+ textTransform: "capitalize",
2218
+ display: "flex",
2219
+ alignItems: "center",
2220
+ justifyContent: "center",
2221
+ width: "100%",
2222
+ margin: "10px 0px",
2223
+ color: "primary.main",
2224
+ height: "20px"
2225
+ },
2226
+ children: "No Queues Found"
2227
+ }
2228
+ )
2229
+ ]
2230
+ }
2231
+ )
2232
+ }
2233
+ ),
2234
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "agents" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2171
2235
  import_material3.Box,
2172
2236
  {
2173
2237
  sx: {
2174
- display: "flex",
2175
- alignItems: "center",
2176
- justifyContent: "center",
2177
- flexDirection: "column"
2238
+ display: "grid",
2239
+ 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)",
2240
+ gap: 1,
2241
+ padding: "10px",
2242
+ flexWrap: "wrap",
2243
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2244
+ borderRadius: "10px"
2178
2245
  },
2179
- p: 2,
2180
- children: [
2181
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2182
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2183
- import_material3.Typography,
2184
- {
2185
- variant: "body1",
2186
- sx: {
2187
- fontSize: "16px",
2188
- letterSpacing: "0.02em",
2189
- textTransform: "capitalize",
2190
- display: "flex",
2191
- alignItems: "center",
2192
- justifyContent: "center",
2193
- width: "100%",
2194
- margin: "10px 0px",
2195
- color: "primary.main",
2196
- height: "20px"
2197
- },
2198
- children: "No Agents Found"
2199
- }
2200
- )
2201
- ]
2202
- }
2203
- ) }),
2204
- !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: [
2205
- (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) => {
2206
- var _a3, _b2, _c2;
2207
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2246
+ 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)(
2208
2247
  import_material3.Box,
2209
2248
  {
2210
2249
  sx: {
@@ -2229,25 +2268,12 @@ function CallTransferDialog({ open }) {
2229
2268
  alignItems: "center"
2230
2269
  },
2231
2270
  children: [
2232
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Roofing, { sx: { marginRight: "4px" } }),
2233
- /* @__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: [
2234
- service.name,
2235
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: {
2236
- fontSize: "9px",
2237
- fontWeight: "600",
2238
- letterSpacing: "0.02em",
2239
- textTransform: "capitalize",
2240
- color: "gray",
2241
- textOverflow: "ellipsis",
2242
- whiteSpace: "nowrap",
2243
- overflow: "hidden",
2244
- maxWidth: "160px"
2245
- }, children: (_b2 = service == null ? void 0 : service.description) != null ? _b2 : "" })
2246
- ] }) })
2271
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
2272
+ agent.name
2247
2273
  ]
2248
2274
  }
2249
2275
  ),
2250
- /* @__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)(
2276
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2251
2277
  import_material3.IconButton,
2252
2278
  {
2253
2279
  color: "success",
@@ -2256,89 +2282,220 @@ function CallTransferDialog({ open }) {
2256
2282
  "&:hover": { bgcolor: "action.selected" }
2257
2283
  },
2258
2284
  onClick: () => {
2259
- var _a4;
2260
- handleTransferCall({
2261
- mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : ""
2262
- }, "OTHER");
2285
+ handleTransferCall(agent, "AGENT");
2263
2286
  },
2264
2287
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2265
2288
  }
2266
- ) })
2289
+ )
2267
2290
  ]
2268
2291
  },
2269
2292
  index
2270
- );
2271
- })),
2272
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2273
- import_material3.Box,
2274
- {
2275
- sx: {
2276
- p: 1,
2277
- display: "flex",
2278
- alignItems: "center",
2279
- boxShadow: "1px 1px 4px #d3d3d3ff",
2280
- padding: "6px",
2281
- borderRadius: "10px"
2282
- },
2283
- children: [
2284
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2285
- import_material3.Typography,
2293
+ )) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2294
+ import_material3.Box,
2295
+ {
2296
+ sx: {
2297
+ display: "flex",
2298
+ alignItems: "center",
2299
+ justifyContent: "center",
2300
+ flexDirection: "column"
2301
+ },
2302
+ p: 2,
2303
+ children: [
2304
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
2305
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2306
+ import_material3.Typography,
2307
+ {
2308
+ variant: "body1",
2309
+ sx: {
2310
+ fontSize: "16px",
2311
+ letterSpacing: "0.02em",
2312
+ textTransform: "capitalize",
2313
+ display: "flex",
2314
+ alignItems: "center",
2315
+ justifyContent: "center",
2316
+ width: "100%",
2317
+ margin: "10px 0px",
2318
+ color: "primary.main",
2319
+ height: "20px"
2320
+ },
2321
+ children: "No Agents Found"
2322
+ }
2323
+ )
2324
+ ]
2325
+ }
2326
+ )
2327
+ }
2328
+ ),
2329
+ !isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && currentselecteTab === "others" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2330
+ import_material3.Box,
2331
+ {
2332
+ sx: {
2333
+ display: "grid",
2334
+ gridTemplateColumns: "repeat(2, 1fr)",
2335
+ gap: 1,
2336
+ padding: "10px",
2337
+ flexWrap: "wrap",
2338
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2339
+ borderRadius: "10px"
2340
+ },
2341
+ children: [
2342
+ (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) => {
2343
+ var _a3, _b2, _c2;
2344
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2345
+ import_material3.Box,
2286
2346
  {
2287
- variant: "body1",
2288
2347
  sx: {
2289
- mx: 1,
2290
- width: "200px",
2291
- maxWidth: "250px",
2348
+ p: 1,
2292
2349
  display: "flex",
2293
- alignItems: "center"
2350
+ alignItems: "center",
2351
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2352
+ padding: "6px",
2353
+ borderRadius: "10px",
2354
+ "&:hover": { bgcolor: "action.selected" }
2294
2355
  },
2295
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2296
- import_material3.TextField,
2356
+ children: [
2357
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2358
+ import_material3.Typography,
2359
+ {
2360
+ variant: "body1",
2361
+ sx: {
2362
+ mx: 1,
2363
+ width: "200px",
2364
+ maxWidth: "250px",
2365
+ display: "flex",
2366
+ alignItems: "center"
2367
+ },
2368
+ children: [
2369
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Roofing, { sx: { marginRight: "4px" } }),
2370
+ /* @__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: [
2371
+ service.name,
2372
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2373
+ import_material3.Box,
2374
+ {
2375
+ sx: {
2376
+ fontSize: "9px",
2377
+ fontWeight: "600",
2378
+ letterSpacing: "0.02em",
2379
+ textTransform: "capitalize",
2380
+ color: "gray",
2381
+ textOverflow: "ellipsis",
2382
+ whiteSpace: "nowrap",
2383
+ overflow: "hidden",
2384
+ maxWidth: "160px"
2385
+ },
2386
+ children: (_b2 = service == null ? void 0 : service.description) != null ? _b2 : ""
2387
+ }
2388
+ )
2389
+ ] }) })
2390
+ ]
2391
+ }
2392
+ ),
2393
+ /* @__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)(
2394
+ import_material3.IconButton,
2395
+ {
2396
+ color: "success",
2397
+ sx: {
2398
+ bgcolor: "action.hover",
2399
+ "&:hover": { bgcolor: "action.selected" }
2400
+ },
2401
+ onClick: () => {
2402
+ var _a4;
2403
+ handleTransferCall(
2404
+ {
2405
+ mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : ""
2406
+ },
2407
+ "OTHER"
2408
+ );
2409
+ },
2410
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2411
+ }
2412
+ ) })
2413
+ ]
2414
+ },
2415
+ index
2416
+ );
2417
+ })),
2418
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2419
+ import_material3.Box,
2420
+ {
2421
+ sx: {
2422
+ p: 1,
2423
+ display: "flex",
2424
+ alignItems: "center",
2425
+ boxShadow: "1px 1px 4px #d3d3d3ff",
2426
+ padding: "6px",
2427
+ borderRadius: "10px"
2428
+ },
2429
+ children: [
2430
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2431
+ import_material3.Typography,
2297
2432
  {
2298
- size: "small",
2299
- name: "others",
2300
- label: "Mobile number",
2301
- variant: "outlined",
2302
- type: "tel",
2303
- value: mobileNumber,
2304
- onChange: (e) => {
2305
- const v = e.target.value;
2306
- if (/^\d*$/.test(v)) {
2307
- setMobileNumber(v);
2308
- }
2433
+ variant: "body1",
2434
+ sx: {
2435
+ mx: 1,
2436
+ width: "200px",
2437
+ maxWidth: "250px",
2438
+ display: "flex",
2439
+ alignItems: "center"
2309
2440
  },
2310
- slotProps: {
2311
- htmlInput: {
2312
- inputMode: "numeric",
2313
- maxLength: 11
2441
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2442
+ import_material3.TextField,
2443
+ {
2444
+ size: "small",
2445
+ name: "others",
2446
+ label: "Mobile number",
2447
+ variant: "outlined",
2448
+ type: "tel",
2449
+ value: mobileNumber,
2450
+ onChange: (e) => {
2451
+ const v = e.target.value;
2452
+ if (/^\d*$/.test(v)) {
2453
+ setMobileNumber(v);
2454
+ }
2455
+ },
2456
+ slotProps: {
2457
+ htmlInput: {
2458
+ inputMode: "numeric",
2459
+ maxLength: 11
2460
+ }
2461
+ },
2462
+ placeholder: "Enter mobile number",
2463
+ autoComplete: "off"
2314
2464
  }
2315
- },
2316
- placeholder: "Enter mobile number",
2317
- autoComplete: "off"
2465
+ )
2466
+ }
2467
+ ),
2468
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2469
+ import_material3.Tooltip,
2470
+ {
2471
+ title: mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number",
2472
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2473
+ import_material3.IconButton,
2474
+ {
2475
+ color: "success",
2476
+ sx: {
2477
+ bgcolor: "action.hover",
2478
+ "&:hover": { bgcolor: "action.selected" }
2479
+ },
2480
+ onClick: () => {
2481
+ handleTransferCall(
2482
+ {
2483
+ mobile_number: mobileNumber != null ? mobileNumber : ""
2484
+ },
2485
+ "OTHER"
2486
+ );
2487
+ },
2488
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2489
+ }
2490
+ )
2318
2491
  }
2319
2492
  )
2320
- }
2321
- ),
2322
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2323
- import_material3.IconButton,
2324
- {
2325
- color: "success",
2326
- sx: {
2327
- bgcolor: "action.hover",
2328
- "&:hover": { bgcolor: "action.selected" }
2329
- },
2330
- onClick: () => {
2331
- handleTransferCall({
2332
- mobile_number: mobileNumber != null ? mobileNumber : ""
2333
- }, "OTHER");
2334
- },
2335
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
2336
- }
2337
- ) })
2338
- ]
2339
- }
2340
- )
2341
- ] })
2493
+ ]
2494
+ }
2495
+ )
2496
+ ]
2497
+ }
2498
+ )
2342
2499
  ]
2343
2500
  }
2344
2501
  )
@@ -2482,29 +2639,36 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2482
2639
  gap: 2,
2483
2640
  mt: 2,
2484
2641
  children: [
2485
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: {
2486
- flex: "1",
2487
- border: "1px solid #bdbdbd",
2488
- borderRadius: "5px"
2489
- }, children: [
2490
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2491
- import_material3.Checkbox,
2492
- {
2493
- name: "selected_break",
2494
- sx: {
2495
- padding: "6px"
2496
- },
2497
- checked: formData.selected_break,
2498
- onChange: (event) => {
2499
- handleChange("selected_break", event.target.checked);
2500
- },
2501
- slotProps: {
2502
- input: { "aria-label": "controlled" }
2503
- }
2504
- }
2505
- ),
2506
- " Mark as break"
2507
- ] }),
2642
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2643
+ import_material3.Box,
2644
+ {
2645
+ sx: {
2646
+ flex: "1",
2647
+ border: "1px solid #bdbdbd",
2648
+ borderRadius: "5px"
2649
+ },
2650
+ children: [
2651
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2652
+ import_material3.Checkbox,
2653
+ {
2654
+ name: "selected_break",
2655
+ sx: {
2656
+ padding: "6px"
2657
+ },
2658
+ checked: formData.selected_break,
2659
+ onChange: (event) => {
2660
+ handleChange("selected_break", event.target.checked);
2661
+ },
2662
+ slotProps: {
2663
+ input: { "aria-label": "controlled" }
2664
+ }
2665
+ }
2666
+ ),
2667
+ " ",
2668
+ "Mark as break"
2669
+ ]
2670
+ }
2671
+ ),
2508
2672
  ((_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)(
2509
2673
  import_material3.TextField,
2510
2674
  {
@@ -2875,83 +3039,6 @@ function createMicController(constraints = { audio: true }) {
2875
3039
  };
2876
3040
  }
2877
3041
 
2878
- // call-control-sdk/lib/utils/audioLoader.ts
2879
- var import_incoming = __toESM(require("./incoming-4WP3FJI4.mp3"));
2880
- var audioBlobUrl = null;
2881
- var audioBuffer = null;
2882
- async function loadAudioAsBlob() {
2883
- if (audioBlobUrl) {
2884
- return audioBlobUrl;
2885
- }
2886
- if (import_incoming.default.startsWith("data:") || import_incoming.default.startsWith("http://") || import_incoming.default.startsWith("https://") || import_incoming.default.startsWith("blob:")) {
2887
- return import_incoming.default;
2888
- }
2889
- try {
2890
- const response = await fetch(import_incoming.default);
2891
- if (!response.ok) {
2892
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
2893
- }
2894
- const blob = await response.blob();
2895
- if (blob.size === 0) {
2896
- throw new Error("Empty blob");
2897
- }
2898
- audioBlobUrl = URL.createObjectURL(blob);
2899
- return audioBlobUrl;
2900
- } catch (error) {
2901
- console.error("Could not create blob URL, using direct URL:", error);
2902
- return import_incoming.default;
2903
- }
2904
- }
2905
- async function createAudioElement() {
2906
- const audio = new Audio();
2907
- audio.loop = true;
2908
- audio.volume = 0.7;
2909
- audio.preload = "auto";
2910
- let audioUrl = "";
2911
- try {
2912
- audioUrl = await loadAudioAsBlob();
2913
- } catch (error) {
2914
- console.warn("Failed to load audio as blob, trying direct URL:", error);
2915
- audioUrl = import_incoming.default;
2916
- }
2917
- const tryLoadAudio = async (url) => {
2918
- return new Promise((resolve) => {
2919
- const checkCanPlay = () => {
2920
- const canPlay = audio.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA;
2921
- if (canPlay) {
2922
- resolve(true);
2923
- return;
2924
- }
2925
- if (audio.error) {
2926
- resolve(false);
2927
- return;
2928
- }
2929
- setTimeout(checkCanPlay, 100);
2930
- };
2931
- audio.addEventListener("canplay", () => resolve(true), { once: true });
2932
- audio.addEventListener("error", () => resolve(false), { once: true });
2933
- audio.src = url;
2934
- audio.load();
2935
- setTimeout(() => resolve(false), 2e3);
2936
- });
2937
- };
2938
- let loaded = await tryLoadAudio(audioUrl);
2939
- if (!loaded && audioUrl !== import_incoming.default) {
2940
- loaded = await tryLoadAudio(import_incoming.default);
2941
- if (loaded) {
2942
- audioUrl = import_incoming.default;
2943
- }
2944
- }
2945
- return audio;
2946
- }
2947
- function cleanupAudioResources() {
2948
- if (audioBlobUrl) {
2949
- URL.revokeObjectURL(audioBlobUrl);
2950
- audioBlobUrl = null;
2951
- }
2952
- audioBuffer = null;
2953
- }
2954
-
2955
3042
  // call-control-sdk/lib/components/callControls.tsx
2956
3043
  var import_vault5 = require("@react-solutions/vault");
2957
3044
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -2995,10 +3082,11 @@ function CallControls({ onDataChange }) {
2995
3082
  });
2996
3083
  const micRef = (0, import_react11.useRef)(null);
2997
3084
  const webSocketRef = (0, import_react11.useRef)(null);
2998
- const audioRef = (0, import_react11.useRef)(null);
2999
3085
  const reconnectTimeoutRef = (0, import_react11.useRef)(null);
3000
3086
  const pingIntervalRef = (0, import_react11.useRef)(null);
3001
3087
  const reconnectAttemptsRef = (0, import_react11.useRef)(0);
3088
+ const hasFlashedRef = (0, import_react11.useRef)(false);
3089
+ const lastEventTimeRef = (0, import_react11.useRef)(null);
3002
3090
  const maxReconnectAttempts = 60;
3003
3091
  const baseReconnectDelay = 2e3;
3004
3092
  const maxReconnectDelay = 3e4;
@@ -3256,22 +3344,6 @@ function CallControls({ onDataChange }) {
3256
3344
  if (wrapUpinterval) clearInterval(wrapUpinterval);
3257
3345
  };
3258
3346
  }, [state.callData.status]);
3259
- (0, import_react11.useEffect)(() => {
3260
- createAudioElement().then((audio) => {
3261
- audioRef.current = audio;
3262
- }).catch((error) => {
3263
- console.error("Failed to load audio element:", error);
3264
- });
3265
- return () => {
3266
- if (audioRef.current) {
3267
- audioRef.current.pause();
3268
- audioRef.current.currentTime = 0;
3269
- audioRef.current.src = "";
3270
- audioRef.current = null;
3271
- }
3272
- cleanupAudioResources();
3273
- };
3274
- }, []);
3275
3347
  (0, import_react11.useEffect)(() => {
3276
3348
  if (onDataChange && state.callData) {
3277
3349
  const { process_id, process_name, status, phone_number, agent_id, convox_id } = state.callData;
@@ -3341,7 +3413,7 @@ function CallControls({ onDataChange }) {
3341
3413
  }, 3e4);
3342
3414
  };
3343
3415
  webSocketRef.current.onmessage = (event) => {
3344
- var _a3, _b2;
3416
+ var _a3, _b2, _c2, _d2;
3345
3417
  try {
3346
3418
  const data = JSON.parse(event.data);
3347
3419
  if (data.type === "pong") {
@@ -3420,24 +3492,41 @@ function CallControls({ onDataChange }) {
3420
3492
  isMergeCall: false
3421
3493
  }
3422
3494
  ]);
3423
- if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current) {
3424
- audioRef.current.play().catch((error) => {
3425
- console.error("Failed to play ringtone:", error);
3426
- });
3427
- }
3428
- } else {
3429
- if (audioRef.current) {
3430
- audioRef.current.pause();
3431
- audioRef.current.currentTime = 0;
3432
- }
3433
3495
  }
3434
- if (data.status === "ONCALL" /* ONCALL */) {
3496
+ if (data.status === "IDLE" /* IDLE */) {
3497
+ USB_LIGHT_REQUEST(USB_LIGHT_ON("green"));
3498
+ } else if ((data == null ? void 0 : data.mute) !== 1 && (data == null ? void 0 : data.hold) !== 1 && data.status === "ONCALL" /* ONCALL */) {
3499
+ USB_LIGHT_REQUEST(USB_LIGHT_ON("red"));
3435
3500
  sdkStateManager.startCall();
3436
3501
  if (!showIframe) {
3437
3502
  setShowIframe(true);
3438
3503
  }
3439
- }
3440
- if (data.status === "WRAPUP" /* WRAPUP */) {
3504
+ } else if (((data == null ? void 0 : data.mute) === 1 || (data == null ? void 0 : data.hold) === 1) && data.status === "ONCALL" /* ONCALL */) {
3505
+ USB_LIGHT_REQUEST(USB_LIGHT_FLASH("red", 1));
3506
+ } else if (data.status === "BREAK" /* BREAK */) {
3507
+ const breakTime = (_c2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _c2.break_time;
3508
+ const eventTime = (_d2 = data == null ? void 0 : data.event_time) != null ? _d2 : null;
3509
+ if (eventTime !== lastEventTimeRef.current) {
3510
+ hasFlashedRef.current = false;
3511
+ lastEventTimeRef.current = eventTime;
3512
+ }
3513
+ let isOverLimit = false;
3514
+ if (breakTime && eventTime) {
3515
+ const differenceInMinutes = ((/* @__PURE__ */ new Date()).getTime() - new Date(eventTime).getTime()) / 6e4;
3516
+ if (Number(differenceInMinutes.toFixed(0)) >= Number(breakTime)) {
3517
+ isOverLimit = true;
3518
+ }
3519
+ }
3520
+ if (isOverLimit) {
3521
+ if (!hasFlashedRef.current) {
3522
+ USB_LIGHT_REQUEST(USB_LIGHT_FLASH("yellow", 1));
3523
+ hasFlashedRef.current = true;
3524
+ }
3525
+ } else {
3526
+ USB_LIGHT_REQUEST(USB_LIGHT_ON("yellow"));
3527
+ }
3528
+ } else if (data.status === "WRAPUP" /* WRAPUP */) {
3529
+ USB_LIGHT_REQUEST(USB_LIGHT_FLASH("green", 1));
3441
3530
  sdkStateManager.endCall();
3442
3531
  }
3443
3532
  } catch (e) {