ahs-cti 1.0.1-beta.2 → 1.0.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,13 +34,11 @@ import {
34
34
  useTheme,
35
35
  Paper
36
36
  } from "@mui/material";
37
- import {
38
- KeyboardArrowDown,
39
- PlayArrow,
40
- ExpandLess,
41
- Search,
42
- Phone
43
- } from "@mui/icons-material";
37
+ import KeyboardArrowDown from "@mui/icons-material/KeyboardArrowDown";
38
+ import PlayArrow from "@mui/icons-material/PlayArrow";
39
+ import ExpandLess from "@mui/icons-material/ExpandLess";
40
+ import Search from "@mui/icons-material/Search";
41
+ import Phone from "@mui/icons-material/Phone";
44
42
 
45
43
  // call-control-sdk/lib/pages/callHistory/useCallHistory.ts
46
44
  import { useState, useCallback } from "react";
@@ -368,4 +366,4 @@ var callHistory_default = CallHistory;
368
366
  export {
369
367
  callHistory_default as default
370
368
  };
371
- //# sourceMappingURL=callHistory-A5CBDPZR.mjs.map
369
+ //# sourceMappingURL=callHistory-Z5ABHFDQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../call-control-sdk/lib/pages/callHistory/index.tsx","../call-control-sdk/lib/pages/callHistory/useCallHistory.ts"],"sourcesContent":["import React, { memo, useEffect, useState } from \"react\";\r\nimport {\r\n\tBox,\r\n\tTypography,\r\n\tTable,\r\n\tTableBody,\r\n\tTableCell,\r\n\tTableContainer,\r\n\tTableHead,\r\n\tTableRow,\r\n\tTablePagination,\r\n\tToggleButton,\r\n\tToggleButtonGroup,\r\n\tIconButton,\r\n\tCollapse,\r\n\tCircularProgress,\r\n\tChip,\r\n\tStack,\r\n\tSwitch,\r\n\tFormControlLabel,\r\n\tTooltip,\r\n\tInputAdornment,\r\n\tOutlinedInput,\r\n\tuseTheme,\r\n\tPaper,\r\n} from \"@mui/material\";\r\nimport KeyboardArrowDown from \"@mui/icons-material/KeyboardArrowDown\";\r\nimport PlayArrow from \"@mui/icons-material/PlayArrow\";\r\nimport ExpandLess from \"@mui/icons-material/ExpandLess\";\r\nimport Search from \"@mui/icons-material/Search\";\r\nimport Phone from \"@mui/icons-material/Phone\";\r\nimport { SDKProvider } from \"../../components/SDKProvider\";\r\nimport { useToast } from \"../../services/toastMessage\";\r\nimport { useCallHistory } from \"./useCallHistory\";\r\nimport type { CallHistoryItem, MissedCallDetails, CallFilter } from \"./types\";\r\n\r\n// ──── Header cell columns ────────────────────────────────────────────────────\r\n\r\nconst CALL_HISTORY_COLS = [\"Call UID\", \"Mobile\", \"Type\", \"Start Time\", \"End Time\", \"Recording\", \"Agent\", \"Details\"] as const;\r\nconst MISSED_CALLS_COLS = [\"Agent ID\", \"Agent Name\", \"Mobile No\", \"Type\", \"Actions\"] as const;\r\nconst CENTER_COLS = new Set([\"Type\", \"Recording\", \"Agent\", \"Details\", \"Actions\"]);\r\n\r\n// ──── Main content (needs SDKProvider above it for useToast) ─────────────────\r\n\r\nconst CallHistoryContent = memo(() => {\r\n\tconst theme = useTheme();\r\n\tconst { showToast } = useToast();\r\n\tconst { calls, missedCalls, loading, fetchCallHistory, fetchMissedCalls, fetchRecording } =\r\n\t\tuseCallHistory();\r\n\r\n\tconst [filter, setFilter] = useState<CallFilter>(\"ALL\");\r\n\tconst [search, setSearch] = useState(\"\");\r\n\tconst [showMissedCalls, setShowMissedCalls] = useState(false);\r\n\tconst [page, setPage] = useState(0);\r\n\tconst [rowsPerPage, setRowsPerPage] = useState(10);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (showMissedCalls) {\r\n\t\t\tfetchMissedCalls();\r\n\t\t} else {\r\n\t\t\tfetchCallHistory();\r\n\t\t}\r\n\t}, [showMissedCalls, fetchCallHistory, fetchMissedCalls]);\r\n\r\n\tconst filteredCalls = calls\r\n\t\t.filter((c) => filter === \"ALL\" || c.call_type === filter)\r\n\t\t.filter((c) => c.mobile_no.toLowerCase().includes(search.toLowerCase()));\r\n\r\n\tconst filteredMissedCalls = missedCalls\r\n\t\t.filter((c) => filter === \"ALL\" || c.callType?.toUpperCase() === filter)\r\n\t\t.filter((c) => {\r\n\t\t\tconst q = search.toLowerCase();\r\n\t\t\treturn (\r\n\t\t\t\tc.agentId?.toLowerCase().includes(q) ||\r\n\t\t\t\tc.username?.toLowerCase().includes(q) ||\r\n\t\t\t\tc.mobileNumber?.toLowerCase().includes(q)\r\n\t\t\t);\r\n\t\t});\r\n\r\n\treturn (\r\n\t\t<Box>\r\n\t\t\t{/* PAGE HEADER */}\r\n\t\t\t<Box\r\n\t\t\t\tdisplay=\"flex\"\r\n\t\t\t\talignItems=\"center\"\r\n\t\t\t\tjustifyContent=\"space-between\"\r\n\t\t\t\tpx={2}\r\n\t\t\t\tpy={1.5}\r\n\t\t\t\tborderBottom=\"1px solid #eee\"\r\n\t\t\t>\r\n\t\t\t\t<Typography fontWeight={700} fontSize=\"1rem\">\r\n\t\t\t\t\tCall History\r\n\t\t\t\t</Typography>\r\n\t\t\t\t<OutlinedInput\r\n\t\t\t\t\tsize=\"small\"\r\n\t\t\t\t\tvalue={search}\r\n\t\t\t\t\tonChange={(e) => { setSearch(e.target.value); setPage(0); }}\r\n\t\t\t\t\tplaceholder=\"Search\"\r\n\t\t\t\t\tsx={{ width: 220, fontSize: \"0.82rem\", height: 36 }}\r\n\t\t\t\t\tendAdornment={\r\n\t\t\t\t\t\t<InputAdornment position=\"end\">\r\n\t\t\t\t\t\t\t<Search sx={{ fontSize: 18, color: \"#999\" }} />\r\n\t\t\t\t\t\t</InputAdornment>\r\n\t\t\t\t\t}\r\n\t\t\t\t/>\r\n\t\t\t</Box>\r\n\r\n\t\t\t<Box py={1.5} px={2}>\r\n\t\t\t\t{/* FILTER BAR */}\r\n\t\t\t\t<Stack direction=\"row\" spacing={2} alignItems=\"center\" mb={2}>\r\n\t\t\t\t\t<FormControlLabel\r\n\t\t\t\t\t\tcontrol={\r\n\t\t\t\t\t\t\t<Switch\r\n\t\t\t\t\t\t\t\tsize=\"small\"\r\n\t\t\t\t\t\t\t\tchecked={showMissedCalls}\r\n\t\t\t\t\t\t\t\tonChange={(_, checked) => { setShowMissedCalls(checked); setPage(0); }}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tlabel={\r\n\t\t\t\t\t\t\t<Typography sx={{ fontSize: \"0.8rem\", color: \"#555\" }}>\r\n\t\t\t\t\t\t\t\tMissed Calls\r\n\t\t\t\t\t\t\t</Typography>\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tsx={{ ml: 0 }}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<ToggleButtonGroup\r\n\t\t\t\t\t\tvalue={filter}\r\n\t\t\t\t\t\texclusive\r\n\t\t\t\t\t\tonChange={(_, v) => { if (v) { setFilter(v); setPage(0); } }}\r\n\t\t\t\t\t\tsize=\"small\"\r\n\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\tborder: \"1px solid #ccc\",\r\n\t\t\t\t\t\t\tborderRadius: \"50px\",\r\n\t\t\t\t\t\t\toverflow: \"hidden\",\r\n\t\t\t\t\t\t\t\"& .MuiToggleButton-root\": {\r\n\t\t\t\t\t\t\t\tborder: \"none\",\r\n\t\t\t\t\t\t\t\tborderRight: \"1px solid #ccc\",\r\n\t\t\t\t\t\t\t\tcolor: \"#555\",\r\n\t\t\t\t\t\t\t\tfontWeight: 600,\r\n\t\t\t\t\t\t\t\ttextTransform: \"uppercase\",\r\n\t\t\t\t\t\t\t\tfontSize: \"0.72rem\",\r\n\t\t\t\t\t\t\t\tpx: 2,\r\n\t\t\t\t\t\t\t\tpy: 0.5,\r\n\t\t\t\t\t\t\t\tborderRadius: 0,\r\n\t\t\t\t\t\t\t\t\"&:last-of-type\": { borderRight: \"none\" },\r\n\t\t\t\t\t\t\t\t\"&.Mui-selected\": {\r\n\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette.primary.main,\r\n\t\t\t\t\t\t\t\t\tcolor: \"#fff\",\r\n\t\t\t\t\t\t\t\t\t\"&:hover\": { backgroundColor: theme.palette.primary.dark },\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t}}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<ToggleButton value=\"ALL\">All</ToggleButton>\r\n\t\t\t\t\t\t<ToggleButton value=\"INCOMING\">Inbound</ToggleButton>\r\n\t\t\t\t\t\t<ToggleButton value=\"OUTGOING\">Outbound</ToggleButton>\r\n\t\t\t\t\t</ToggleButtonGroup>\r\n\t\t\t\t</Stack>\r\n\r\n\t\t\t\t{/* TABLE */}\r\n\t\t\t\t<TableContainer component={Paper} variant=\"outlined\" sx={{ display: 'flex', flexDirection: 'column' }}>\r\n\t\t\t\t <Box sx={{ overflowY: 'auto', maxHeight: 600 }}>\r\n\t\t\t\t\t<Table stickyHeader size=\"small\">\r\n\t\t\t\t\t\t{showMissedCalls ? (\r\n\t\t\t\t\t\t\t<>\r\n\t\t\t\t\t\t\t\t<TableHead>\r\n\t\t\t\t\t\t\t\t\t<TableRow>\r\n\t\t\t\t\t\t\t\t\t\t{MISSED_CALLS_COLS.map((col) => (\r\n\t\t\t\t\t\t\t\t\t\t\t<TableCell\r\n\t\t\t\t\t\t\t\t\t\t\t\tkey={col}\r\n\t\t\t\t\t\t\t\t\t\t\t\talign={CENTER_COLS.has(col) ? \"center\" : \"left\"}\r\n\t\t\t\t\t\t\t\t\t\t\t\tsx={{ fontWeight: 600, backgroundColor: \"#f1f1f1\", fontSize: \"0.8rem\" }}\r\n\t\t\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t\t\t{col}\r\n\t\t\t\t\t\t\t\t\t\t\t</TableCell>\r\n\t\t\t\t\t\t\t\t\t\t))}\r\n\t\t\t\t\t\t\t\t\t</TableRow>\r\n\t\t\t\t\t\t\t\t</TableHead>\r\n\t\t\t\t\t\t\t\t<TableBody>\r\n\t\t\t\t\t\t\t\t\t{loading ? (\r\n\t\t\t\t\t\t\t\t\t\t<TableRow>\r\n\t\t\t\t\t\t\t\t\t\t\t<TableCell colSpan={5} align=\"center\" sx={{ py: 4 }}>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<CircularProgress size={24} />\r\n\t\t\t\t\t\t\t\t\t\t\t</TableCell>\r\n\t\t\t\t\t\t\t\t\t\t</TableRow>\r\n\t\t\t\t\t\t\t\t\t) : filteredMissedCalls.length === 0 ? (\r\n\t\t\t\t\t\t\t\t\t\t<TableRow>\r\n\t\t\t\t\t\t\t\t\t\t\t<TableCell colSpan={5} align=\"center\" sx={{ py: 4, color: \"#999\", fontSize: \"0.82rem\" }}>\r\n\t\t\t\t\t\t\t\t\t\t\t\tNo Records Found\r\n\t\t\t\t\t\t\t\t\t\t\t</TableCell>\r\n\t\t\t\t\t\t\t\t\t\t</TableRow>\r\n\t\t\t\t\t\t\t\t\t) : (\r\n\t\t\t\t\t\t\t\t\t\tfilteredMissedCalls.slice(page * rowsPerPage, (page + 1) * rowsPerPage).map((row, i) => (\r\n\t\t\t\t\t\t\t\t\t\t\t<MissedCallRow key={`${row.agentId}-${row.mobileNumber}-${i}`} row={row} />\r\n\t\t\t\t\t\t\t\t\t\t))\r\n\t\t\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\t\t</TableBody>\r\n\t\t\t\t\t\t\t</>\r\n\t\t\t\t\t\t) : (\r\n\t\t\t\t\t\t\t<>\r\n\t\t\t\t\t\t\t\t<TableHead>\r\n\t\t\t\t\t\t\t\t\t<TableRow>\r\n\t\t\t\t\t\t\t\t\t\t{CALL_HISTORY_COLS.map((col) => (\r\n\t\t\t\t\t\t\t\t\t\t\t<TableCell\r\n\t\t\t\t\t\t\t\t\t\t\t\tkey={col}\r\n\t\t\t\t\t\t\t\t\t\t\t\talign={CENTER_COLS.has(col) ? \"center\" : \"left\"}\r\n\t\t\t\t\t\t\t\t\t\t\t\tsx={{ fontWeight: 600, backgroundColor: \"#f1f1f1\", fontSize: \"0.8rem\" }}\r\n\t\t\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t\t\t{col}\r\n\t\t\t\t\t\t\t\t\t\t\t</TableCell>\r\n\t\t\t\t\t\t\t\t\t\t))}\r\n\t\t\t\t\t\t\t\t\t</TableRow>\r\n\t\t\t\t\t\t\t\t</TableHead>\r\n\t\t\t\t\t\t\t\t<TableBody>\r\n\t\t\t\t\t\t\t\t\t{loading ? (\r\n\t\t\t\t\t\t\t\t\t\t<TableRow>\r\n\t\t\t\t\t\t\t\t\t\t\t<TableCell colSpan={8} align=\"center\" sx={{ py: 4 }}>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<CircularProgress />\r\n\t\t\t\t\t\t\t\t\t\t\t</TableCell>\r\n\t\t\t\t\t\t\t\t\t\t</TableRow>\r\n\t\t\t\t\t\t\t\t\t) : filteredCalls.length === 0 ? (\r\n\t\t\t\t\t\t\t\t\t\t<TableRow>\r\n\t\t\t\t\t\t\t\t\t\t\t<TableCell colSpan={8} align=\"center\" sx={{ py: 4, color: \"#999\", fontSize: \"0.82rem\" }}>\r\n\t\t\t\t\t\t\t\t\t\t\t\tNo Records Found\r\n\t\t\t\t\t\t\t\t\t\t\t</TableCell>\r\n\t\t\t\t\t\t\t\t\t\t</TableRow>\r\n\t\t\t\t\t\t\t\t\t) : (\r\n\t\t\t\t\t\t\t\t\t\tfilteredCalls.slice(page * rowsPerPage, (page + 1) * rowsPerPage).map((row, i) => (\r\n\t\t\t\t\t\t\t\t\t\t\t<ExpandableRow\r\n\t\t\t\t\t\t\t\t\t\t\t\tkey={row.call_uuid}\r\n\t\t\t\t\t\t\t\t\t\t\t\trow={row}\r\n\t\t\t\t\t\t\t\t\t\t\t\tstriped={i % 2 === 0}\r\n\t\t\t\t\t\t\t\t\t\t\t\tfetchRecording={fetchRecording}\r\n\t\t\t\t\t\t\t\t\t\t\t\tonError={(msg) => showToast(msg, \"error\")}\r\n\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t))\r\n\t\t\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\t\t</TableBody>\r\n\t\t\t\t\t\t\t</>\r\n\t\t\t\t\t\t)}\r\n\t\t\t\t\t</Table>\r\n\t\t\t\t </Box>\r\n\t\t\t\t <TablePagination\r\n\t\t\t\t\t\tcomponent=\"div\"\r\n\t\t\t\t\t\tcount={showMissedCalls ? filteredMissedCalls.length : filteredCalls.length}\r\n\t\t\t\t\t\tpage={page}\r\n\t\t\t\t\t\trowsPerPage={rowsPerPage}\r\n\t\t\t\t\t\tonPageChange={(_, p) => setPage(p)}\r\n\t\t\t\t\t\tonRowsPerPageChange={(e) => { setRowsPerPage(parseInt(e.target.value, 10)); setPage(0); }}\r\n\t\t\t\t\t\trowsPerPageOptions={[10, 25, 50]}\r\n\t\t\t\t\t\tsx={{ borderTop: '1px solid #e0e0e0' }}\r\n\t\t\t\t />\r\n\t\t\t\t</TableContainer>\r\n\t\t\t</Box>\r\n\t\t</Box>\r\n\t);\r\n});\r\n\r\nCallHistoryContent.displayName = \"CallHistoryContent\";\r\n\r\n// ──── Missed Call Row ─────────────────────────────────────────────────────────\r\n\r\nconst MissedCallRow = memo(({ row }: { row: MissedCallDetails }) => {\r\n\tconst theme = useTheme();\r\n\treturn (\r\n\t\t<TableRow hover>\r\n\t\t\t<TableCell sx={{ fontSize: \"0.82rem\", color: theme.palette.primary.main }}>\r\n\t\t\t\t{row.agentId}\r\n\t\t\t</TableCell>\r\n\t\t\t<TableCell sx={{ fontSize: \"0.82rem\" }}>{row.username}</TableCell>\r\n\t\t\t<TableCell sx={{ fontSize: \"0.82rem\" }}>\r\n\t\t\t\t{row.mobileNumber} ({row.callCount})\r\n\t\t\t</TableCell>\r\n\t\t\t<TableCell sx={{ fontSize: \"0.82rem\", textTransform: \"uppercase\" }}>\r\n\t\t\t\t{row.callType}\r\n\t\t\t</TableCell>\r\n\t\t\t<TableCell align=\"center\">\r\n\t\t\t\t<Phone sx={{ color: \"#c0392b\", fontSize: 20, cursor: \"pointer\" }} />\r\n\t\t\t</TableCell>\r\n\t\t</TableRow>\r\n\t);\r\n});\r\n\r\nMissedCallRow.displayName = \"MissedCallRow\";\r\n\r\n// ──── Expandable Row ──────────────────────────────────────────────────────────\r\n\r\nfunction ExpandableRow({\r\n\trow,\r\n\tstriped,\r\n\tfetchRecording,\r\n\tonError,\r\n}: {\r\n\trow: CallHistoryItem;\r\n\tstriped: boolean;\r\n\tfetchRecording: (call_uuid: string) => Promise<Blob>;\r\n\tonError: (msg: string) => void;\r\n}) {\r\n\tconst [open, setOpen] = useState(false);\r\n\tconst [audioURL, setAudioURL] = useState<string | null>(null);\r\n\tconst [loadingAudio, setLoadingAudio] = useState(false);\r\n\r\n\tconst handlePlay = async () => {\r\n\t\tif (!row.recording.available) return;\r\n\t\tsetLoadingAudio(true);\r\n\t\ttry {\r\n\t\t\tconst blob = await fetchRecording(row.call_uuid);\r\n\t\t\tsetAudioURL(URL.createObjectURL(blob));\r\n\t\t} catch {\r\n\t\t\tonError(\"Recording not available\");\r\n\t\t} finally {\r\n\t\t\tsetLoadingAudio(false);\r\n\t\t}\r\n\t};\r\n\r\n\tconst bg = striped ? \"#fafafa\" : \"white\";\r\n\tconst cellSx = { fontSize: \"0.82rem\", backgroundColor: bg };\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<TableRow hover>\r\n\t\t\t\t<TableCell sx={{ ...cellSx, maxWidth: 130 }}>\r\n\t\t\t\t\t<Tooltip title={row.call_uuid} arrow>\r\n\t\t\t\t\t\t<Typography\r\n\t\t\t\t\t\t\tnoWrap\r\n\t\t\t\t\t\t\tsx={{ fontSize: 13, maxWidth: 130, overflow: \"hidden\", textOverflow: \"ellipsis\" }}\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t{row.call_uuid}\r\n\t\t\t\t\t\t</Typography>\r\n\t\t\t\t\t</Tooltip>\r\n\t\t\t\t</TableCell>\r\n\r\n\t\t\t\t<TableCell sx={cellSx}>{row.mobile_no}</TableCell>\r\n\r\n\t\t\t\t<TableCell align=\"center\" sx={cellSx}>\r\n\t\t\t\t\t<Chip\r\n\t\t\t\t\t\tsize=\"small\"\r\n\t\t\t\t\t\tlabel={row.call_type}\r\n\t\t\t\t\t\tcolor={row.call_type === \"INCOMING\" ? \"success\" : \"primary\"}\r\n\t\t\t\t\t/>\r\n\t\t\t\t</TableCell>\r\n\r\n\t\t\t\t<TableCell sx={cellSx}>\r\n\t\t\t\t\t{new Date(row.start_time).toLocaleString()}\r\n\t\t\t\t</TableCell>\r\n\r\n\t\t\t\t<TableCell sx={cellSx}>\r\n\t\t\t\t\t{row.end_time ? new Date(row.end_time).toLocaleString() : \"—\"}\r\n\t\t\t\t</TableCell>\r\n\r\n\t\t\t\t<TableCell align=\"center\" sx={cellSx}>\r\n\t\t\t\t\t{row.recording.available ? (\r\n\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\tcolor=\"primary\"\r\n\t\t\t\t\t\t\tonClick={handlePlay}\r\n\t\t\t\t\t\t\tdisabled={loadingAudio}\r\n\t\t\t\t\t\t\tsize=\"small\"\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t{loadingAudio ? <CircularProgress size={18} /> : <PlayArrow />}\r\n\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t) : (\r\n\t\t\t\t\t\t<Chip size=\"small\" label=\"No File\" />\r\n\t\t\t\t\t)}\r\n\t\t\t\t</TableCell>\r\n\r\n\t\t\t\t<TableCell align=\"center\" sx={cellSx}>\r\n\t\t\t\t\t{row.agent_id ?? \"—\"}\r\n\t\t\t\t</TableCell>\r\n\r\n\t\t\t\t<TableCell align=\"center\" sx={cellSx}>\r\n\t\t\t\t\t<IconButton onClick={() => setOpen((o) => !o)} size=\"small\">\r\n\t\t\t\t\t\t{open ? <ExpandLess /> : <KeyboardArrowDown />}\r\n\t\t\t\t\t</IconButton>\r\n\t\t\t\t</TableCell>\r\n\t\t\t</TableRow>\r\n\r\n\t\t\t{/* Audio player row */}\r\n\t\t\t{audioURL && (\r\n\t\t\t\t<TableRow>\r\n\t\t\t\t\t<TableCell colSpan={8} sx={{ p: 0 }}>\r\n\t\t\t\t\t\t<Box p={2}>\r\n\t\t\t\t\t\t\t<audio\r\n\t\t\t\t\t\t\t\tcontrols\r\n\t\t\t\t\t\t\t\tautoPlay\r\n\t\t\t\t\t\t\t\tsrc={audioURL}\r\n\t\t\t\t\t\t\t\tonEnded={() => {\r\n\t\t\t\t\t\t\t\t\tURL.revokeObjectURL(audioURL);\r\n\t\t\t\t\t\t\t\t\tsetAudioURL(null);\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\tstyle={{ width: \"100%\" }}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t</Box>\r\n\t\t\t\t\t</TableCell>\r\n\t\t\t\t</TableRow>\r\n\t\t\t)}\r\n\r\n\t\t\t{/* Details collapse row */}\r\n\t\t\t<TableRow>\r\n\t\t\t\t<TableCell colSpan={8} sx={{ p: 0 }}>\r\n\t\t\t\t\t<Collapse in={open} unmountOnExit>\r\n\t\t\t\t\t\t<Box p={2} bgcolor=\"#f9fafc\" borderTop=\"1px solid #eee\">\r\n\t\t\t\t\t\t\t<Typography fontWeight={600} fontSize=\"0.85rem\" mb={0.5}>\r\n\t\t\t\t\t\t\t\tCall Details\r\n\t\t\t\t\t\t\t</Typography>\r\n\t\t\t\t\t\t\t<Typography variant=\"body2\" fontSize=\"0.82rem\">\r\n\t\t\t\t\t\t\t\tCall UID: {row.call_uuid}\r\n\t\t\t\t\t\t\t</Typography>\r\n\t\t\t\t\t\t\t<Typography variant=\"body2\" fontSize=\"0.82rem\">\r\n\t\t\t\t\t\t\t\tAgent: {row.agent_id ?? \"Unassigned\"}\r\n\t\t\t\t\t\t\t</Typography>\r\n\t\t\t\t\t\t</Box>\r\n\t\t\t\t\t</Collapse>\r\n\t\t\t\t</TableCell>\r\n\t\t\t</TableRow>\r\n\t\t</>\r\n\t);\r\n}\r\n\r\n// ──── Default Export — wraps with SDKProvider for toast context ───────────────\r\n\r\nconst CallHistory: React.FC = () => (\r\n\t<SDKProvider>\r\n\t\t<CallHistoryContent />\r\n\t</SDKProvider>\r\n);\r\n\r\nexport default CallHistory;\r\n","import { useState, useCallback } from \"react\";\r\nimport axiosInstance from \"../../services/axios\";\r\nimport { END_POINT } from \"../../services/endPoint\";\r\nimport type { CallHistoryItem, MissedCallDetails } from \"./types\";\r\n\r\nexport function useCallHistory() {\r\n\tconst [calls, setCalls] = useState<CallHistoryItem[]>([]);\r\n\tconst [missedCalls, setMissedCalls] = useState<MissedCallDetails[]>([]);\r\n\tconst [loading, setLoading] = useState(false);\r\n\r\n\tconst fetchCallHistory = useCallback(async () => {\r\n\t\tsetLoading(true);\r\n\t\ttry {\r\n\t\t\tconst res = await axiosInstance.post(END_POINT.CALLS_HISTORY, {});\r\n\t\t\tsetCalls(Array.isArray(res.data?.records) ? res.data.records : []);\r\n\t\t} catch {\r\n\t\t\tsetCalls([]);\r\n\t\t} finally {\r\n\t\t\tsetLoading(false);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst fetchMissedCalls = useCallback(async () => {\r\n\t\tsetLoading(true);\r\n\t\ttry {\r\n\t\t\tconst res = await axiosInstance.get(END_POINT.MISSED_CALLS);\r\n\t\t\tsetMissedCalls(Array.isArray(res.data?.data) ? res.data.data : []);\r\n\t\t} catch {\r\n\t\t\tsetMissedCalls([]);\r\n\t\t} finally {\r\n\t\t\tsetLoading(false);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst fetchRecording = useCallback(async (call_uuid: string): Promise<Blob> => {\r\n\t\tconst res = await axiosInstance.get(END_POINT.RECORDING_BY_CALL(call_uuid), {\r\n\t\t\tresponseType: \"blob\",\r\n\t\t});\r\n\t\treturn res.data;\r\n\t}, []);\r\n\r\n\treturn {\r\n\t\tcalls,\r\n\t\tmissedCalls,\r\n\t\tloading,\r\n\t\tfetchCallHistory,\r\n\t\tfetchMissedCalls,\r\n\t\tf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,IAAI,MAAM,eAAa,MAChC,+BAAC,OAAI,GAAG,GAAG,SAAQ,WAAU,WAAU,kBACtC;AAAA,0BAAC,cAAW,YAAY,KAAK,UAAS,WAAU,IAAI,KAAK,0BAEzD;AAAA,MACA,qBAAC,cAAW,SAAQ,SAAQ,UAAS,WAAU;AAAA;AAAA,QACnC,IAAI;AAAA,SAChB;AAAA,MACA,qBAAC,cAAW,SAAQ,SAAQ,UAAS,WAAU;AAAA;AAAA,SACtC,SAAI,aAAJ,YAAgB;AAAA,SACzB;AAAA,OACD,GACD,GACD,GACD;AAAA,KACD;AAEF;AAIA,IAAM,cAAwB,MAC7B,oBAAC,eACA,8BAAC,sBAAmB,GACrB;AAGD,IAAO,sBAAQ;","names":["useState","useState"]}
package/dist/index.d.mts CHANGED
@@ -708,126 +708,64 @@ interface CallControlPanelProps {
708
708
  */
709
709
 
710
710
  /**
711
- * 📞 End Call Payload Interface
711
+ * End Call Payload Interface
712
712
  *
713
713
  * @interface EndCallPayload
714
- * @description 📊 Defines the structure for call termination API payload data
715
- * Contains all necessary information for ending a call with proper disposition
714
+ * @description Defines the options for ending a call. All fields are optional —
715
+ * any omitted field falls back to the current session/call state automatically.
716
716
  *
717
717
  * @properties
718
- * - `action: string` - 🎯 API action type ("ENDCALL")
719
- * - `disposition: string` - 📝 Call outcome classification
720
- * - `userId: string` - 👤 Agent identifier
721
- * - `processid: string` - ⚙️ Process identifier
722
- * - `mobile_number: string` - 📱 Customer phone number
723
- * - `set_followUp: string` - 📅 Follow-up requirement ("Y" or "N")
724
- * - `callback_date: string` - 📅 Scheduled callback date
725
- * - `callback_hrs: string` - 🕐 Scheduled callback hour
726
- * - `callback_mins: string` - 🕐 Scheduled callback minute
727
- * - `refno?: string` - 🔗 Optional call reference number
718
+ * - `convox_id?: string` - Convox call ID (defaults to active call's convox_id)
719
+ * - `agent_id?: string` - Agent identifier (defaults to logged-in agent)
720
+ * - `set_followUp?: string` - Whether a follow-up is required: "Y" or "N" (default: "N")
721
+ * - `callback_date?: string` - Scheduled callback date (YYYY-MM-DD)
722
+ * - `callback_hrs?: number` - Scheduled callback hour (0–23)
723
+ * - `callback_mins?: number` - Scheduled callback minute (0–59)
724
+ * - `mobile_number?: string` - Customer phone number (defaults to active call's phone_number)
725
+ * - `list_comments?: string` - Optional comments for the call log
726
+ * - `call_reference_id?: string` - Call reference ID (defaults to active call's convox_id)
727
+ * - `disposition?: string` - Call outcome code (default: "RES")
728
+ * - `line_number?: number` - Conference line number (default: 0)
729
+ * - `reason?: string` - End reason sent to server (default: "normal")
730
+ * - `isBreak?: boolean` - Whether agent is going on break after the call
731
+ * - `patientLog?: any` - Optional patient/contact log data
728
732
  *
729
733
  * @example
730
734
  * ```typescript
731
- * // Basic end call payload
732
- * const endCallPayload: EndCallPayload = {
733
- * action: "ENDCALL",
734
- * disposition: "RES",
735
- * userId: "agent123",
736
- * processid: "proc001",
737
- * mobile_number: "1234567890",
738
- * set_followUp: "N",
739
- * callback_date: "",
740
- * callback_hrs: "",
741
- * callback_mins: ""
742
- * };
735
+ * // Minimal all defaults applied from session state
736
+ * await endCall();
743
737
  *
744
- * // With callback scheduling
745
- * const endCallWithCallback: EndCallPayload = {
746
- * action: "ENDCALL",
738
+ * // With disposition and follow-up callback
739
+ * await endCall({
747
740
  * disposition: "RES",
748
- * userId: "agent123",
749
- * processid: "proc001",
750
- * mobile_number: "1234567890",
751
741
  * set_followUp: "Y",
752
- * callback_date: "2024-01-15",
753
- * callback_hrs: "14",
754
- * callback_mins: "30"
755
- * };
742
+ * callback_date: "2026-05-20",
743
+ * callback_hrs: 10,
744
+ * callback_mins: 30,
745
+ * });
746
+ *
747
+ * // Agent going on break after call
748
+ * await endCall({ disposition: "RES", isBreak: true });
756
749
  * ```
757
750
  *
758
751
  * @since 1.0.0
759
752
  * @author CTI SDK Team
760
753
  */
761
754
  interface EndCallPayload {
762
- /**
763
- * 🎯 API action type
764
- * @description The action type for the API call
765
- * @type {string}
766
- */
767
- action: string;
768
-
769
- /**
770
- * 📝 Call outcome classification
771
- * @description Classification of how the call ended
772
- * @type {string}
773
- */
774
- disposition: string;
775
-
776
- /**
777
- * 👤 Agent identifier
778
- * @description Unique identifier for the agent ending the call
779
- * @type {string}
780
- */
781
- userId: string;
782
-
783
- /**
784
- * ⚙️ Process identifier
785
- * @description Unique identifier for the process
786
- * @type {string}
787
- */
788
- processid: string;
789
-
790
- /**
791
- * 📱 Customer phone number
792
- * @description Phone number of the customer
793
- * @type {string}
794
- */
795
- mobile_number: string;
796
-
797
- /**
798
- * 📅 Follow-up requirement
799
- * @description Whether a follow-up is required ("Y" or "N")
800
- * @type {string}
801
- */
802
- set_followUp: string;
803
-
804
- /**
805
- * 📅 Scheduled callback date
806
- * @description Date for scheduled callback (YYYY-MM-DD format)
807
- * @type {string}
808
- */
809
- callback_date: string;
810
-
811
- /**
812
- * 🕐 Scheduled callback hour
813
- * @description Hour for scheduled callback (0-23)
814
- * @type {string}
815
- */
816
- callback_hrs: string;
817
-
818
- /**
819
- * 🕐 Scheduled callback minute
820
- * @description Minute for scheduled callback (0-59)
821
- * @type {string}
822
- */
823
- callback_mins: string;
824
-
825
- /**
826
- * 🔗 Optional call reference number
827
- * @description Optional reference number for the call
828
- * @type {string | undefined}
829
- */
830
- refno?: string;
755
+ convox_id?: string;
756
+ agent_id?: string;
757
+ set_followUp?: string;
758
+ callback_date?: string;
759
+ callback_hrs?: number;
760
+ callback_mins?: number;
761
+ mobile_number?: string;
762
+ list_comments?: string;
763
+ call_reference_id?: string;
764
+ disposition?: string;
765
+ line_number?: number;
766
+ reason?: string;
767
+ isBreak?: boolean;
768
+ patientLog?: any;
831
769
  }
832
770
 
833
771
  /**
@@ -2237,16 +2175,6 @@ interface ErrorResponse {
2237
2175
  // ⚡ FRAMEWORK-AGNOSTIC ACTION EXPORTS (for Angular / non-React consumers)
2238
2176
  // =============================================================================
2239
2177
 
2240
- interface EndCallOptions {
2241
- disposition?: string;
2242
- followUp?: string;
2243
- callbackDate?: string;
2244
- callbackHrs?: string;
2245
- callbackMins?: string;
2246
- isBreak?: boolean;
2247
- patientLog?: any;
2248
- }
2249
-
2250
2178
  type SupervisorMonitorMode = "listen" | "whisper" | "barge";
2251
2179
 
2252
2180
  interface StartMonitoringPayload {
@@ -2269,7 +2197,7 @@ interface ChangeModePayload {
2269
2197
 
2270
2198
  declare function clickToCall(payload: StartCallPayload): Promise<any>;
2271
2199
  declare function clickToConference(payload: ConferenceCallPayload): Promise<any>;
2272
- declare function endCall(options?: EndCallOptions): Promise<any>;
2200
+ declare function endCall(options?: EndCallPayload): Promise<any>;
2273
2201
  declare function logout(): Promise<void>;
2274
2202
  declare function startMonitoring(payload: StartMonitoringPayload): Promise<any>;
2275
2203
  declare function stopMonitoring(payload: StopMonitoringPayload): Promise<any>;
@@ -2290,4 +2218,4 @@ interface UseClickToConferenceReturn {
2290
2218
 
2291
2219
  declare function useClickToConference(): UseClickToConferenceReturn;
2292
2220
 
2293
- export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type ChangeModePayload, type CleanupOperation, type ConferenceCallPayload, type ConferenceLine, type DispositionType, type EndCallData, type EndCallOptions, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, type SDKConfig, SDKPages, type SDKState, SDKStateManager, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StartMonitoringPayload, type StopMonitoringPayload, type StorageType, type SupervisorMonitorMode, type URLConfig, type UseClickToCallReturn, type UseClickToConferenceReturn, type UseEndCallReturn, type UseLogoutReturn, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, startMonitoring, stopMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };
2221
+ export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type ChangeModePayload, type CleanupOperation, type ConferenceCallPayload, type ConferenceLine, type DispositionType, type EndCallData, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, type SDKConfig, SDKPages, type SDKState, SDKStateManager, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StartMonitoringPayload, type StopMonitoringPayload, type StorageType, type SupervisorMonitorMode, type URLConfig, type UseClickToCallReturn, type UseClickToConferenceReturn, type UseEndCallReturn, type UseLogoutReturn, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, startMonitoring, stopMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };
package/dist/index.d.ts CHANGED
@@ -708,126 +708,64 @@ interface CallControlPanelProps {
708
708
  */
709
709
 
710
710
  /**
711
- * 📞 End Call Payload Interface
711
+ * End Call Payload Interface
712
712
  *
713
713
  * @interface EndCallPayload
714
- * @description 📊 Defines the structure for call termination API payload data
715
- * Contains all necessary information for ending a call with proper disposition
714
+ * @description Defines the options for ending a call. All fields are optional —
715
+ * any omitted field falls back to the current session/call state automatically.
716
716
  *
717
717
  * @properties
718
- * - `action: string` - 🎯 API action type ("ENDCALL")
719
- * - `disposition: string` - 📝 Call outcome classification
720
- * - `userId: string` - 👤 Agent identifier
721
- * - `processid: string` - ⚙️ Process identifier
722
- * - `mobile_number: string` - 📱 Customer phone number
723
- * - `set_followUp: string` - 📅 Follow-up requirement ("Y" or "N")
724
- * - `callback_date: string` - 📅 Scheduled callback date
725
- * - `callback_hrs: string` - 🕐 Scheduled callback hour
726
- * - `callback_mins: string` - 🕐 Scheduled callback minute
727
- * - `refno?: string` - 🔗 Optional call reference number
718
+ * - `convox_id?: string` - Convox call ID (defaults to active call's convox_id)
719
+ * - `agent_id?: string` - Agent identifier (defaults to logged-in agent)
720
+ * - `set_followUp?: string` - Whether a follow-up is required: "Y" or "N" (default: "N")
721
+ * - `callback_date?: string` - Scheduled callback date (YYYY-MM-DD)
722
+ * - `callback_hrs?: number` - Scheduled callback hour (0–23)
723
+ * - `callback_mins?: number` - Scheduled callback minute (0–59)
724
+ * - `mobile_number?: string` - Customer phone number (defaults to active call's phone_number)
725
+ * - `list_comments?: string` - Optional comments for the call log
726
+ * - `call_reference_id?: string` - Call reference ID (defaults to active call's convox_id)
727
+ * - `disposition?: string` - Call outcome code (default: "RES")
728
+ * - `line_number?: number` - Conference line number (default: 0)
729
+ * - `reason?: string` - End reason sent to server (default: "normal")
730
+ * - `isBreak?: boolean` - Whether agent is going on break after the call
731
+ * - `patientLog?: any` - Optional patient/contact log data
728
732
  *
729
733
  * @example
730
734
  * ```typescript
731
- * // Basic end call payload
732
- * const endCallPayload: EndCallPayload = {
733
- * action: "ENDCALL",
734
- * disposition: "RES",
735
- * userId: "agent123",
736
- * processid: "proc001",
737
- * mobile_number: "1234567890",
738
- * set_followUp: "N",
739
- * callback_date: "",
740
- * callback_hrs: "",
741
- * callback_mins: ""
742
- * };
735
+ * // Minimal all defaults applied from session state
736
+ * await endCall();
743
737
  *
744
- * // With callback scheduling
745
- * const endCallWithCallback: EndCallPayload = {
746
- * action: "ENDCALL",
738
+ * // With disposition and follow-up callback
739
+ * await endCall({
747
740
  * disposition: "RES",
748
- * userId: "agent123",
749
- * processid: "proc001",
750
- * mobile_number: "1234567890",
751
741
  * set_followUp: "Y",
752
- * callback_date: "2024-01-15",
753
- * callback_hrs: "14",
754
- * callback_mins: "30"
755
- * };
742
+ * callback_date: "2026-05-20",
743
+ * callback_hrs: 10,
744
+ * callback_mins: 30,
745
+ * });
746
+ *
747
+ * // Agent going on break after call
748
+ * await endCall({ disposition: "RES", isBreak: true });
756
749
  * ```
757
750
  *
758
751
  * @since 1.0.0
759
752
  * @author CTI SDK Team
760
753
  */
761
754
  interface EndCallPayload {
762
- /**
763
- * 🎯 API action type
764
- * @description The action type for the API call
765
- * @type {string}
766
- */
767
- action: string;
768
-
769
- /**
770
- * 📝 Call outcome classification
771
- * @description Classification of how the call ended
772
- * @type {string}
773
- */
774
- disposition: string;
775
-
776
- /**
777
- * 👤 Agent identifier
778
- * @description Unique identifier for the agent ending the call
779
- * @type {string}
780
- */
781
- userId: string;
782
-
783
- /**
784
- * ⚙️ Process identifier
785
- * @description Unique identifier for the process
786
- * @type {string}
787
- */
788
- processid: string;
789
-
790
- /**
791
- * 📱 Customer phone number
792
- * @description Phone number of the customer
793
- * @type {string}
794
- */
795
- mobile_number: string;
796
-
797
- /**
798
- * 📅 Follow-up requirement
799
- * @description Whether a follow-up is required ("Y" or "N")
800
- * @type {string}
801
- */
802
- set_followUp: string;
803
-
804
- /**
805
- * 📅 Scheduled callback date
806
- * @description Date for scheduled callback (YYYY-MM-DD format)
807
- * @type {string}
808
- */
809
- callback_date: string;
810
-
811
- /**
812
- * 🕐 Scheduled callback hour
813
- * @description Hour for scheduled callback (0-23)
814
- * @type {string}
815
- */
816
- callback_hrs: string;
817
-
818
- /**
819
- * 🕐 Scheduled callback minute
820
- * @description Minute for scheduled callback (0-59)
821
- * @type {string}
822
- */
823
- callback_mins: string;
824
-
825
- /**
826
- * 🔗 Optional call reference number
827
- * @description Optional reference number for the call
828
- * @type {string | undefined}
829
- */
830
- refno?: string;
755
+ convox_id?: string;
756
+ agent_id?: string;
757
+ set_followUp?: string;
758
+ callback_date?: string;
759
+ callback_hrs?: number;
760
+ callback_mins?: number;
761
+ mobile_number?: string;
762
+ list_comments?: string;
763
+ call_reference_id?: string;
764
+ disposition?: string;
765
+ line_number?: number;
766
+ reason?: string;
767
+ isBreak?: boolean;
768
+ patientLog?: any;
831
769
  }
832
770
 
833
771
  /**
@@ -2237,16 +2175,6 @@ interface ErrorResponse {
2237
2175
  // ⚡ FRAMEWORK-AGNOSTIC ACTION EXPORTS (for Angular / non-React consumers)
2238
2176
  // =============================================================================
2239
2177
 
2240
- interface EndCallOptions {
2241
- disposition?: string;
2242
- followUp?: string;
2243
- callbackDate?: string;
2244
- callbackHrs?: string;
2245
- callbackMins?: string;
2246
- isBreak?: boolean;
2247
- patientLog?: any;
2248
- }
2249
-
2250
2178
  type SupervisorMonitorMode = "listen" | "whisper" | "barge";
2251
2179
 
2252
2180
  interface StartMonitoringPayload {
@@ -2269,7 +2197,7 @@ interface ChangeModePayload {
2269
2197
 
2270
2198
  declare function clickToCall(payload: StartCallPayload): Promise<any>;
2271
2199
  declare function clickToConference(payload: ConferenceCallPayload): Promise<any>;
2272
- declare function endCall(options?: EndCallOptions): Promise<any>;
2200
+ declare function endCall(options?: EndCallPayload): Promise<any>;
2273
2201
  declare function logout(): Promise<void>;
2274
2202
  declare function startMonitoring(payload: StartMonitoringPayload): Promise<any>;
2275
2203
  declare function stopMonitoring(payload: StopMonitoringPayload): Promise<any>;
@@ -2290,5 +2218,5 @@ interface UseClickToConferenceReturn {
2290
2218
 
2291
2219
  declare function useClickToConference(): UseClickToConferenceReturn;
2292
2220
 
2293
- export type { APIResponse, AgentStatus, CallControlPanelProps, CallData, CallInitiationFunction, CallTerminationFunction, ChangeModePayload, CleanupOperation, ConferenceCallPayload, ConferenceLine, DispositionType, EndCallData, EndCallOptions, EndCallPayLoadData, EndCallPayload, ErrorResponse, FollowUpType, HookStateTypes, InitSDKParams, LogoutFunction, LogoutHookStateTypes, LogoutPayload, ProcessData, SDKConfig, SDKState, StartCallPayload, StartCalltData, StartCalltHookStateTypes, StartMonitoringPayload, StopMonitoringPayload, StorageType, SupervisorMonitorMode, URLConfig, UseClickToCallReturn, UseClickToConferenceReturn, UseEndCallReturn, UseLogoutReturn }
2221
+ export type { APIResponse, AgentStatus, CallControlPanelProps, CallData, CallInitiationFunction, CallTerminationFunction, ChangeModePayload, CleanupOperation, ConferenceCallPayload, ConferenceLine, DispositionType, EndCallData, EndCallPayLoadData, EndCallPayload, ErrorResponse, FollowUpType, HookStateTypes, InitSDKParams, LogoutFunction, LogoutHookStateTypes, LogoutPayload, ProcessData, SDKConfig, SDKState, StartCallPayload, StartCalltData, StartCalltHookStateTypes, StartMonitoringPayload, StopMonitoringPayload, StorageType, SupervisorMonitorMode, URLConfig, UseClickToCallReturn, UseClickToConferenceReturn, UseEndCallReturn, UseLogoutReturn }
2294
2222
  export { CallControlPanel, SDKPages, SDKStateManager, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, startMonitoring, stopMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };