ahs-cti 1.0.1-beta.44 → 1.0.1-beta.46

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useGetCallerData
3
- } from "./chunk-BI4BLVVA.mjs";
3
+ } from "./chunk-IY5NGMWS.mjs";
4
4
  import {
5
5
  SDKPageHeader
6
6
  } from "./chunk-I5VT6XXH.mjs";
@@ -2767,4 +2767,4 @@ var campaigns_default = Campaigns;
2767
2767
  export {
2768
2768
  campaigns_default as default
2769
2769
  };
2770
- //# sourceMappingURL=campaigns-6OW7BOTF.mjs.map
2770
+ //# sourceMappingURL=campaigns-6G56DSDE.mjs.map
@@ -75,9 +75,9 @@ import {
75
75
  } from "@mui/material";
76
76
  import { alpha } from "@mui/material/styles";
77
77
  import CloseIcon from "@mui/icons-material/Close";
78
- import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
78
+ import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutlined";
79
79
  import HighlightOffIcon from "@mui/icons-material/HighlightOff";
80
- import RemoveCircleOutlineIcon from "@mui/icons-material/RemoveCircleOutline";
80
+ import RemoveCircleOutlineIcon from "@mui/icons-material/RemoveCircleOutlined";
81
81
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
82
82
  var STATUS_COLOUR = {
83
83
  completed: { color: "#2e7d32", bg: "#e8f5e9" },
@@ -1905,4 +1905,4 @@ var cdrReport_default = CdrReport;
1905
1905
  export {
1906
1906
  cdrReport_default as default
1907
1907
  };
1908
- //# sourceMappingURL=cdrReport-DCAAYJN2.mjs.map
1908
+ //# sourceMappingURL=cdrReport-LU7QZHKZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../call-control-sdk/lib/pages/cdrReport/index.tsx","../call-control-sdk/lib/pages/common/components/AuditReport.tsx","../call-control-sdk/lib/pages/cdrReport/useCdrReport.ts"],"sourcesContent":["import React, {\r\n useCallback,\r\n useEffect,\r\n useMemo,\r\n useRef,\r\n useState,\r\n} from \"react\";\r\nimport {\r\n Alert,\r\n Box,\r\n Chip,\r\n Paper,\r\n Stack,\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableContainer,\r\n TableHead,\r\n TableRow,\r\n TablePagination,\r\n TableSortLabel,\r\n CircularProgress,\r\n IconButton,\r\n Tooltip,\r\n} from \"@mui/material\";\r\nimport AppButton from \"../common/components/AppButton\";\r\nimport AuditReportDialog from \"../common/components/AuditReport\";\r\n\r\nimport ReportFilterBar, {\r\n type QuickRange,\r\n} from \"../common/components/ReportFilterBar\";\r\nimport DownloadIcon from \"@mui/icons-material/Download\";\r\nimport RefreshIcon from \"@mui/icons-material/Refresh\";\r\nimport PlayArrowIcon from \"@mui/icons-material/PlayArrow\";\r\nimport FileDownloadIcon from \"@mui/icons-material/FileDownload\";\r\nimport AssignmentIcon from \"@mui/icons-material/Assignment\";\r\n\r\nimport dayjs, { Dayjs } from \"dayjs\";\r\nimport isoWeek from \"dayjs/plugin/isoWeek\";\r\n\r\nimport { LocalizationProvider } from \"@mui/x-date-pickers/LocalizationProvider\";\r\nimport { AdapterDayjs } from \"@mui/x-date-pickers/AdapterDayjs\";\r\nimport {\r\n getCdrReport,\r\n exportCdrReportToExcel,\r\n getRecordingByCall,\r\n getQueues,\r\n type Queue,\r\n} from \"./useCdrReport\";\r\nimport { deepFindArray } from \"../../services/axios\";\r\nimport type { CdrReportParams, CdrRecordResponse } from \"./types\";\r\nimport { type AgentOption } from \"../common/components/AgentMultiSelect\";\r\nimport { headCellSx } from \"../common/utils/tableStyles\";\r\nimport PageHeader from \"../common/components/PageHeader\";\r\nimport SearchBar from \"../common/components/SearchBar\";\r\n\r\nimport { SDKProvider } from \"../../components/SDKProvider\";\r\nimport { SDKPermissionGuard } from \"../../components/SDKPermissionGuard\";\r\nimport { SDK_PERMISSIONS } from \"../../permissions/sdk-constants\";\r\n\r\ndayjs.extend(isoWeek);\r\n\r\nconst FONT =\r\n \"'Inter', 'Segoe UI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif\";\r\n\r\nconst COLORS = {\r\n navy: \"#0d2a56\",\r\n blue: \"#1565c8\",\r\n green: \"#0a9a62\",\r\n amber: \"#c47c00\",\r\n red: \"#cc2a2a\",\r\n purple: \"#6b3fbf\",\r\n bg: \"transparent\",\r\n surface: \"transparent\",\r\n} as const;\r\n\r\nconst DEFAULT_PAGE_SIZE = 15;\r\n\r\ntype SortKey =\r\n | \"phoneNumber\"\r\n | \"callStartTime\"\r\n | \"callType\"\r\n | \"callStatus\"\r\n | \"agentName\"\r\n | \"queueName\"\r\n | \"extension\"\r\n | \"talkDurationFmt\"\r\n | \"holdDurationFmt\"\r\n | \"ringingDurationFmt\"\r\n | \"queueDurationFmt\"\r\n | \"wrapupDurationFmt\"\r\n | \"disposition\"\r\n | \"remarks\"\r\n | \"wasTransferred\";\r\n\r\ntype SortDir = \"asc\" | \"desc\";\r\n\r\nconst comparator = (\r\n a: CdrRecordResponse,\r\n b: CdrRecordResponse,\r\n key: SortKey,\r\n): number => {\r\n const av = a[key as keyof CdrRecordResponse];\r\n const bv = b[key as keyof CdrRecordResponse];\r\n if (typeof av === \"number\" && typeof bv === \"number\") return av - bv;\r\n if (typeof av === \"boolean\" && typeof bv === \"boolean\")\r\n return (av ? 1 : 0) - (bv ? 1 : 0);\r\n return String(av ?? \"\").localeCompare(String(bv ?? \"\"));\r\n};\r\n\r\nfunction CallTypePill({ value }: { value: string }) {\r\n const v = (value || \"\").toLowerCase();\r\n let color = \"#6b7b8d\";\r\n let bg = \"transparent\";\r\n if (v.includes(\"inbound\")) {\r\n color = COLORS.green;\r\n bg = \"#e6f7ef\";\r\n } else if (v.includes(\"outbound\")) {\r\n color = COLORS.blue;\r\n bg = \"#e3eefa\";\r\n } else if (v.includes(\"internal\")) {\r\n color = COLORS.purple;\r\n bg = \"#f0e8ff\";\r\n }\r\n return (\r\n <Chip\r\n label={value}\r\n size=\"small\"\r\n sx={{\r\n fontFamily: FONT,\r\n bgcolor: bg,\r\n color,\r\n fontWeight: 600,\r\n fontSize: \"0.65rem\",\r\n height: 20,\r\n borderRadius: \"6px\",\r\n }}\r\n />\r\n );\r\n}\r\n\r\nfunction StatusPill({ value }: { value: string }) {\r\n const v = (value || \"\").toLowerCase();\r\n let color = \"#6b7b8d\";\r\n let bg = \"transparent\";\r\n if (v.includes(\"answered\")) {\r\n color = COLORS.green;\r\n bg = \"#e6f7ef\";\r\n } else if (v.includes(\"abandoned\") || v.includes(\"missed\")) {\r\n color = COLORS.red;\r\n bg = \"#fce8e8\";\r\n }\r\n return (\r\n <Chip\r\n label={value}\r\n size=\"small\"\r\n sx={{\r\n fontFamily: FONT,\r\n bgcolor: bg,\r\n color,\r\n fontWeight: 600,\r\n fontSize: \"0.65rem\",\r\n height: 20,\r\n borderRadius: \"6px\",\r\n }}\r\n />\r\n );\r\n}\r\n\r\nfunction RecordingCell({\r\n callUuid,\r\n recordingPath,\r\n}: {\r\n callUuid: string;\r\n recordingPath: string | null;\r\n}) {\r\n const [audioUrl, setAudioUrl] = useState<string | null>(null);\r\n const [loading, setLoading] = useState(false);\r\n const [error, setError] = useState(false);\r\n const unavailable = recordingPath === null;\r\n\r\n const handlePlay = async () => {\r\n if (audioUrl) return;\r\n try {\r\n setLoading(true);\r\n setError(false);\r\n const blob = await getRecordingByCall(callUuid);\r\n const url = URL.createObjectURL(blob);\r\n setAudioUrl(url);\r\n } catch {\r\n setError(true);\r\n } finally {\r\n setLoading(false);\r\n }\r\n };\r\n\r\n const handleDownload = async () => {\r\n try {\r\n const blob = audioUrl\r\n ? await fetch(audioUrl).then((r) => r.blob())\r\n : await getRecordingByCall(callUuid);\r\n const url = URL.createObjectURL(blob);\r\n const a = document.createElement(\"a\");\r\n a.href = url;\r\n a.download = `recording_${callUuid}.wav`;\r\n a.click();\r\n URL.revokeObjectURL(url);\r\n } catch {\r\n /* ignore */\r\n }\r\n };\r\n\r\n if (audioUrl) {\r\n return (\r\n <Box sx={{ display: \"flex\", alignItems: \"center\", gap: 0.5 }}>\r\n <audio\r\n controls\r\n autoPlay\r\n src={audioUrl}\r\n onEnded={() => {\r\n if (audioUrl.startsWith(\"blob:\")) URL.revokeObjectURL(audioUrl);\r\n setAudioUrl(null);\r\n }}\r\n style={{ width: 180, height: 30 }}\r\n />\r\n <Tooltip title=\"Download\">\r\n <IconButton\r\n size=\"small\"\r\n onClick={handleDownload}\r\n sx={{ color: COLORS.blue, p: 0.4 }}\r\n >\r\n <FileDownloadIcon sx={{ fontSize: 16 }} />\r\n </IconButton>\r\n </Tooltip>\r\n </Box>\r\n );\r\n }\r\n\r\n return (\r\n <Box sx={{ display: \"flex\", alignItems: \"center\", gap: 0.3 }}>\r\n <Tooltip title={unavailable || error ? \"Recording Unavailable\" : \"Play\"}>\r\n <span>\r\n <IconButton\r\n size=\"small\"\r\n onClick={handlePlay}\r\n disabled={loading || error || unavailable}\r\n sx={{ color: unavailable ? \"#b0b8c8\" : COLORS.green, p: 0.4 }}\r\n >\r\n {loading ? (\r\n <CircularProgress size={14} />\r\n ) : (\r\n <PlayArrowIcon sx={{ fontSize: 16 }} />\r\n )}\r\n </IconButton>\r\n </span>\r\n </Tooltip>\r\n <Tooltip\r\n title={unavailable || error ? \"Recording Unavailable\" : \"Download\"}\r\n >\r\n <span>\r\n <IconButton\r\n size=\"small\"\r\n onClick={handleDownload}\r\n disabled={loading || error || unavailable}\r\n sx={{ color: unavailable ? \"#b0b8c8\" : COLORS.blue, p: 0.4 }}\r\n >\r\n <FileDownloadIcon sx={{ fontSize: 16 }} />\r\n </IconButton>\r\n </span>\r\n </Tooltip>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction CdrReportContent() {\r\n const [startDate, setStartDate] = useState<Dayjs | null>(\r\n dayjs().startOf(\"day\"),\r\n );\r\n const [endDate, setEndDate] = useState<Dayjs | null>(dayjs());\r\n const [activeQuickDate, setActiveQuickDate] = useState<\r\n \"today\" | \"week\" | \"month\" | null\r\n >(\"today\");\r\n const [searchText, setSearchText] = useState(\"\");\r\n\r\n const [selectedAgents, setSelectedAgents] = useState<AgentOption[]>([]);\r\n const [isAllUsersSelected, setIsAllUsersSelected] = useState(false);\r\n\r\n const [queues, setQueues] = useState<Queue[]>([]);\r\n const [selectedQueues, setSelectedQueues] = useState<Queue[]>([]);\r\n\r\n const [callType, setCallType] = useState<string>(\"\");\r\n const [callStatus, setCallStatus] = useState<string>(\"\");\r\n\r\n const [records, setRecords] = useState<CdrRecordResponse[]>([]);\r\n const [totalRecords, setTotalRecords] = useState(0);\r\n const [loading, setLoading] = useState(false);\r\n const [error, setError] = useState(\"\");\r\n\r\n const [page, setPage] = useState(0);\r\n const [rowsPerPage, setRowsPerPage] = useState(DEFAULT_PAGE_SIZE);\r\n const [sortKey, setSortKey] = useState<SortKey>(\"callStartTime\");\r\n const [sortDir, setSortDir] = useState<SortDir>(\"desc\");\r\n\r\n const [auditDialogOpen, setAuditDialogOpen] = useState(false);\r\n const [selectedAuditRow, setSelectedAuditRow] =\r\n useState<CdrRecordResponse | null>(null);\r\n\r\n useEffect(() => {\r\n getQueues()\r\n .then((data) => setQueues(data || []))\r\n .catch(() => setError(\"Failed to load filter options\"));\r\n }, []);\r\n\r\n const handleQuickRangeChange = (range: QuickRange) => {\r\n setActiveQuickDate(range || null);\r\n };\r\n\r\n const [debouncedSearch, setDebouncedSearch] = useState(\"\");\r\n const debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);\r\n\r\n useEffect(() => {\r\n debounceRef.current = setTimeout(\r\n () => setDebouncedSearch(searchText.trim()),\r\n 400,\r\n );\r\n return () => clearTimeout(debounceRef.current);\r\n }, [searchText]);\r\n\r\n const fetchReport = useCallback(\r\n async (pageNum: number) => {\r\n const sd = startDate ?? dayjs();\r\n const ed = endDate ?? dayjs();\r\n\r\n if (!sd || !ed) {\r\n setError(\"Select a valid date range\");\r\n return;\r\n }\r\n\r\n const params: CdrReportParams = {\r\n start_date: sd.format(\"YYYY-MM-DDTHH:mm:ss\"),\r\n end_date: ed.format(\"YYYY-MM-DDTHH:mm:ss\"),\r\n agent_id:\r\n !isAllUsersSelected && selectedAgents.length > 0\r\n ? selectedAgents.map((a) => a.id)\r\n : undefined,\r\n // All queues selected → send no queue_id (backend returns all).\r\n queue_id:\r\n selectedQueues.length > 0 && selectedQueues.length < queues.length\r\n ? selectedQueues.map((q) => q.id)\r\n : undefined,\r\n call_type: callType || undefined,\r\n status: callStatus || undefined,\r\n search: debouncedSearch || undefined,\r\n page: pageNum + 1,\r\n pageSize: rowsPerPage,\r\n };\r\n\r\n try {\r\n setError(\"\");\r\n setLoading(true);\r\n const response: any = await getCdrReport(params);\r\n setRecords(\r\n deepFindArray<CdrRecordResponse>(response, [\"data\", \"records\"]),\r\n );\r\n setTotalRecords(\r\n response?.records?.total ??\r\n response?.total ??\r\n response?.data?.total ??\r\n 0,\r\n );\r\n } catch (err: any) {\r\n setError(err?.message || \"Failed to fetch CDR report\");\r\n setRecords([]);\r\n } finally {\r\n setLoading(false);\r\n }\r\n },\r\n [\r\n startDate,\r\n endDate,\r\n selectedAgents,\r\n isAllUsersSelected,\r\n selectedQueues,\r\n callType,\r\n callStatus,\r\n debouncedSearch,\r\n rowsPerPage,\r\n ],\r\n );\r\n\r\n useEffect(() => {\r\n setPage(0);\r\n fetchReport(0);\r\n }, [fetchReport]);\r\n\r\n const handleRefresh = () => {\r\n if (activeQuickDate) {\r\n const now = dayjs();\r\n let sd = now.startOf(\"day\");\r\n const ed = now;\r\n if (activeQuickDate === \"week\") sd = now.startOf(\"week\").startOf(\"day\");\r\n else if (activeQuickDate === \"month\")\r\n sd = now.startOf(\"month\").startOf(\"day\");\r\n setStartDate(sd);\r\n setEndDate(ed);\r\n } else {\r\n fetchReport(page);\r\n }\r\n };\r\n\r\n const handlePageChange = useCallback(\r\n (_event: React.MouseEvent<HTMLButtonElement> | null, newPage: number) => {\r\n setPage(newPage);\r\n fetchReport(newPage);\r\n },\r\n [fetchReport],\r\n );\r\n\r\n const handleSort = (key: SortKey) => {\r\n if (sortKey === key) {\r\n setSortDir((d) => (d === \"asc\" ? \"desc\" : \"asc\"));\r\n } else {\r\n setSortKey(key);\r\n setSortDir(\"asc\");\r\n }\r\n };\r\n\r\n const sortedRecords = useMemo(() => {\r\n const rows = [...records];\r\n rows.sort((a, b) => {\r\n const cmp = comparator(a, b, sortKey);\r\n return sortDir === \"asc\" ? cmp : -cmp;\r\n });\r\n return rows;\r\n }, [records, sortKey, sortDir]);\r\n\r\n const handleExportExcel = async () => {\r\n const sd = startDate ?? dayjs();\r\n const ed = endDate ?? dayjs();\r\n const params: CdrReportParams = {\r\n start_date: sd.format(\"YYYY-MM-DDTHH:mm:ss\"),\r\n end_date: ed.format(\"YYYY-MM-DDTHH:mm:ss\"),\r\n agent_id:\r\n !isAllUsersSelected && selectedAgents.length > 0\r\n ? selectedAgents.map((a) => a.id)\r\n : undefined,\r\n queue_id:\r\n selectedQueues.length > 0 && selectedQueues.length < queues.length\r\n ? selectedQueues.map((q) => q.id)\r\n : undefined,\r\n call_type: callType || undefined,\r\n status: callStatus || undefined,\r\n search: debouncedSearch || undefined,\r\n };\r\n try {\r\n await exportCdrReportToExcel(params);\r\n } catch (err: any) {\r\n setError(err?.message || \"Failed to export Excel\");\r\n }\r\n };\r\n\r\n return (\r\n <LocalizationProvider dateAdapter={AdapterDayjs}>\r\n <Box\r\n sx={{\r\n height: \"100%\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n fontFamily: FONT,\r\n }}\r\n >\r\n <PageHeader\r\n title=\"CDR Report\"\r\n actions={\r\n <Stack direction=\"row\" alignItems=\"center\" spacing={1}>\r\n <SearchBar\r\n value={searchText}\r\n onChange={setSearchText}\r\n placeholder=\"Search phone, agent...\"\r\n width={250}\r\n />\r\n <SDKPermissionGuard\r\n permissions={[\r\n SDK_PERMISSIONS.REPORTS_CDR_EXPORT,\r\n SDK_PERMISSIONS.REPORTS_CDR_MANAGE,\r\n ]}\r\n showFallback={false}\r\n >\r\n <AppButton\r\n startIcon={\r\n <DownloadIcon sx={{ fontSize: \"0.95rem !important\" }} />\r\n }\r\n disabled={!records.length}\r\n onClick={handleExportExcel}\r\n sx={{ height: 36 }}\r\n >\r\n Export Excel\r\n </AppButton>\r\n </SDKPermissionGuard>\r\n </Stack>\r\n }\r\n />\r\n\r\n <Box sx={{ flex: 1, overflow: \"auto\", py: 0.8, px: 0 }}>\r\n <Box sx={{ mb: 0.8 }}>\r\n <ReportFilterBar\r\n startDate={startDate}\r\n endDate={endDate}\r\n onStartChange={setStartDate}\r\n onEndChange={setEndDate}\r\n quickRange={activeQuickDate || \"\"}\r\n onQuickRangeChange={handleQuickRangeChange}\r\n showAgentSelect\r\n selectedAgents={selectedAgents}\r\n onAgentsChange={setSelectedAgents}\r\n setIsAllUsersSelected={setIsAllUsersSelected}\r\n showQueueSelect\r\n queues={queues}\r\n selectedQueues={selectedQueues}\r\n onQueuesChange={setSelectedQueues}\r\n showCallTypeSelect\r\n selectedCallType={callType}\r\n onCallTypeChange={setCallType}\r\n showStatusSelect\r\n selectedStatus={callStatus}\r\n onStatusChange={setCallStatus}\r\n extra={\r\n <AppButton\r\n startIcon={\r\n <RefreshIcon sx={{ fontSize: \"0.9rem !important\" }} />\r\n }\r\n disabled={loading}\r\n onClick={handleRefresh}\r\n sx={{ height: 32 }}\r\n >\r\n Refresh\r\n </AppButton>\r\n }\r\n />\r\n\r\n {error && (\r\n <Alert\r\n severity=\"error\"\r\n sx={{ mt: 1, fontFamily: FONT, fontSize: \"0.78rem\" }}\r\n >\r\n {error}\r\n </Alert>\r\n )}\r\n </Box>\r\n\r\n {loading && (\r\n <Box sx={{ textAlign: \"center\", py: 2.5 }}>\r\n <CircularProgress sx={{ color: COLORS.blue }} size={28} />\r\n </Box>\r\n )}\r\n\r\n <Paper\r\n elevation={0}\r\n sx={{\r\n borderRadius: \"8px\",\r\n border: \"1px solid #e0e7ef\",\r\n overflow: \"hidden\",\r\n mb: 2,\r\n }}\r\n >\r\n <TableContainer>\r\n <Table\r\n size=\"small\"\r\n sx={{\r\n minWidth: 1400,\r\n fontFamily: FONT,\r\n \"& .MuiTableCell-root\": {\r\n fontFamily: FONT,\r\n fontSize: \"0.75rem\",\r\n borderBottom: \"1px solid #eef1f6\",\r\n py: 0.6,\r\n px: 1,\r\n },\r\n }}\r\n >\r\n <TableHead>\r\n <TableRow>\r\n {(\r\n [\r\n { id: \"phoneNumber\" as SortKey, label: \"Phone Number\" },\r\n { id: \"callStartTime\" as SortKey, label: \"Call Start\" },\r\n { id: \"callType\" as SortKey, label: \"Call Type\" },\r\n { id: \"callStatus\" as SortKey, label: \"Status\" },\r\n { id: \"agentName\" as SortKey, label: \"User Name\" },\r\n { id: \"queueName\" as SortKey, label: \"Queues\" },\r\n { id: \"extension\" as SortKey, label: \"Extension\" },\r\n {\r\n id: \"talkDurationFmt\" as SortKey,\r\n label: \"Talk Duration\",\r\n },\r\n {\r\n id: \"holdDurationFmt\" as SortKey,\r\n label: \"Hold Duration\",\r\n },\r\n {\r\n id: \"ringingDurationFmt\" as SortKey,\r\n label: \"Ringing Duration\",\r\n },\r\n {\r\n id: \"queueDurationFmt\" as SortKey,\r\n label: \"Queue Duration\",\r\n },\r\n {\r\n id: \"wrapupDurationFmt\" as SortKey,\r\n label: \"Wrapup Duration\",\r\n },\r\n { id: \"disposition\" as SortKey, label: \"Disposition\" },\r\n { id: \"remarks\" as SortKey, label: \"Remarks\" },\r\n {\r\n id: \"wasTransferred\" as SortKey,\r\n label: \"Transferred\",\r\n },\r\n ] as { id: SortKey; label: string }[]\r\n ).map((col) => (\r\n <TableCell key={col.id} sx={headCellSx}>\r\n <TableSortLabel\r\n active={sortKey === col.id}\r\n direction={sortKey === col.id ? sortDir : \"asc\"}\r\n onClick={() => handleSort(col.id)}\r\n sx={{\r\n \"&.MuiTableSortLabel-root\": { color: \"#333\" },\r\n \"&.MuiTableSortLabel-root:hover\": { color: \"#555\" },\r\n \"&.Mui-active\": { color: \"#333\" },\r\n \"& .MuiTableSortLabel-icon\": {\r\n color: \"#333 !important\",\r\n },\r\n }}\r\n >\r\n {col.label}\r\n </TableSortLabel>\r\n </TableCell>\r\n ))}\r\n <TableCell\r\n sx={{ ...(headCellSx as object), minWidth: 220 }}\r\n >\r\n Recording\r\n </TableCell>\r\n <TableCell\r\n sx={{ ...(headCellSx as object), minWidth: 110 }}\r\n >\r\n Audit Report\r\n </TableCell>\r\n </TableRow>\r\n </TableHead>\r\n\r\n <TableBody>\r\n {sortedRecords.map((row, idx) => (\r\n <TableRow\r\n key={row.callUuid || idx}\r\n hover\r\n sx={{\r\n backgroundColor: \"#fff\",\r\n \"&:hover\": { backgroundColor: \"#f0f7f8\" },\r\n }}\r\n >\r\n <TableCell\r\n sx={{\r\n fontWeight: 600,\r\n color: COLORS.navy,\r\n fontSize: \"0.75rem\",\r\n }}\r\n >\r\n {row.phoneNumber || \"\"}\r\n </TableCell>\r\n <TableCell sx={{ fontSize: \"0.73rem\", color: \"#4a5568\" }}>\r\n {row.callStartTime\r\n ? dayjs(row.callStartTime).format(\r\n \"DD MMM YYYY hh:mm A\",\r\n )\r\n : \"\"}\r\n </TableCell>\r\n <TableCell>\r\n <CallTypePill value={row.callType || \"\"} />\r\n </TableCell>\r\n <TableCell>\r\n <StatusPill value={row.callStatus || \"\"} />\r\n </TableCell>\r\n <TableCell sx={{ fontSize: \"0.73rem\", color: \"#4a5568\" }}>\r\n {row.agentName || \"\"}\r\n </TableCell>\r\n <TableCell>\r\n {row.queueName ? (\r\n <Chip\r\n label={row.queueName}\r\n size=\"small\"\r\n sx={{\r\n fontFamily: FONT,\r\n backgroundColor: \"#f0ebfa\",\r\n color: COLORS.purple,\r\n fontWeight: 500,\r\n fontSize: \"0.67rem\",\r\n height: 22,\r\n }}\r\n />\r\n ) : null}\r\n </TableCell>\r\n <TableCell sx={{ fontSize: \"0.73rem\", color: \"#4a5568\" }}>\r\n {row.extension || \"\"}\r\n </TableCell>\r\n <TableCell\r\n sx={{\r\n fontWeight: 600,\r\n color: COLORS.blue,\r\n fontSize: \"0.75rem\",\r\n fontVariantNumeric: \"tabular-nums\",\r\n }}\r\n >\r\n {row.talkDurationFmt || \"\"}\r\n </TableCell>\r\n <TableCell\r\n sx={{\r\n fontWeight: 500,\r\n color: COLORS.amber,\r\n fontSize: \"0.75rem\",\r\n fontVariantNumeric: \"tabular-nums\",\r\n }}\r\n >\r\n {row.holdDurationFmt || \"\"}\r\n </TableCell>\r\n <TableCell\r\n sx={{\r\n fontWeight: 500,\r\n fontSize: \"0.75rem\",\r\n fontVariantNumeric: \"tabular-nums\",\r\n }}\r\n >\r\n {row.ringingDurationFmt || \"\"}\r\n </TableCell>\r\n <TableCell\r\n sx={{\r\n fontWeight: 500,\r\n fontSize: \"0.75rem\",\r\n fontVariantNumeric: \"tabular-nums\",\r\n }}\r\n >\r\n {row.queueDurationFmt || \"\"}\r\n </TableCell>\r\n <TableCell\r\n sx={{\r\n fontWeight: 500,\r\n fontSize: \"0.75rem\",\r\n fontVariantNumeric: \"tabular-nums\",\r\n }}\r\n >\r\n {row.wrapupDurationFmt || \"\"}\r\n </TableCell>\r\n <TableCell sx={{ fontSize: \"0.73rem\", color: \"#4a5568\" }}>\r\n {row.disposition || \"\"}\r\n </TableCell>\r\n <TableCell sx={{ fontSize: \"0.73rem\", color: \"#4a5568\" }}>\r\n {row.remarks ? (\r\n <Tooltip title={row.remarks}>\r\n <span\r\n style={{\r\n display: \"inline-block\",\r\n maxWidth: 180,\r\n overflow: \"hidden\",\r\n textOverflow: \"ellipsis\",\r\n whiteSpace: \"nowrap\",\r\n verticalAlign: \"bottom\",\r\n }}\r\n >\r\n {row.remarks}\r\n </span>\r\n </Tooltip>\r\n ) : (\r\n \"\"\r\n )}\r\n </TableCell>\r\n <TableCell>\r\n {row.wasTransferred ? (\r\n <Chip\r\n label=\"Yes\"\r\n size=\"small\"\r\n sx={{\r\n fontFamily: FONT,\r\n backgroundColor: \"#e6f7ef\",\r\n color: COLORS.green,\r\n fontWeight: 600,\r\n fontSize: \"0.65rem\",\r\n height: 20,\r\n borderRadius: \"6px\",\r\n }}\r\n />\r\n ) : (\r\n <Chip\r\n label=\"No\"\r\n size=\"small\"\r\n sx={{\r\n fontFamily: FONT,\r\n backgroundColor: \"transparent\",\r\n color: \"#6b7b8d\",\r\n fontWeight: 600,\r\n fontSize: \"0.65rem\",\r\n height: 20,\r\n borderRadius: \"6px\",\r\n }}\r\n />\r\n )}\r\n </TableCell>\r\n <TableCell>\r\n {row.callUuid ? (\r\n <RecordingCell\r\n callUuid={row.callUuid}\r\n recordingPath={row.recordingPath}\r\n />\r\n ) : null}\r\n </TableCell>\r\n <TableCell>\r\n <Tooltip title=\"View Audit Report\">\r\n <IconButton\r\n size=\"small\"\r\n onClick={() => {\r\n setSelectedAuditRow(row);\r\n setAuditDialogOpen(true);\r\n }}\r\n sx={{ color: COLORS.blue, p: 0.4 }}\r\n >\r\n <AssignmentIcon sx={{ fontSize: 16 }} />\r\n </IconButton>\r\n </Tooltip>\r\n </TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n </TableContainer>\r\n\r\n <TablePagination\r\n component=\"div\"\r\n count={totalRecords}\r\n page={page}\r\n onPageChange={handlePageChange}\r\n rowsPerPage={rowsPerPage}\r\n rowsPerPageOptions={[10, 15, 25, 50, 100]}\r\n onRowsPerPageChange={(e) => {\r\n setRowsPerPage(parseInt(e.target.value, 10));\r\n setPage(0);\r\n }}\r\n sx={{\r\n borderTop: \"1px solid #eef1f6\",\r\n fontFamily: FONT,\r\n \"& .MuiTablePagination-displayedRows\": {\r\n fontFamily: FONT,\r\n fontSize: \"0.73rem\",\r\n },\r\n \"& .MuiTablePagination-selectLabel\": {\r\n fontFamily: FONT,\r\n fontSize: \"0.73rem\",\r\n },\r\n }}\r\n />\r\n </Paper>\r\n </Box>\r\n </Box>\r\n\r\n <AuditReportDialog\r\n open={auditDialogOpen}\r\n onClose={() => {\r\n setAuditDialogOpen(false);\r\n setSelectedAuditRow(null);\r\n }}\r\n rowData={selectedAuditRow ?? undefined}\r\n />\r\n </LocalizationProvider>\r\n );\r\n}\r\n\r\nconst CdrReport: React.FC = () => (\r\n <SDKProvider>\r\n <CdrReportContent />\r\n </SDKProvider>\r\n);\r\n\r\nexport default CdrReport;\r\n","import React, { useEffect, useState } from \"react\";\r\nimport { createPortal } from \"react-dom\";\r\nimport {\r\n Box,\r\n Typography,\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableContainer,\r\n TableHead,\r\n TableRow,\r\n Tabs,\r\n Tab,\r\n LinearProgress,\r\n useTheme,\r\n Dialog,\r\n DialogTitle,\r\n DialogContent,\r\n IconButton,\r\n GlobalStyles,\r\n CircularProgress,\r\n Alert,\r\n} from \"@mui/material\";\r\nimport { alpha } from \"@mui/material/styles\";\r\nimport type { SxProps, Theme } from \"@mui/material/styles\";\r\nimport CloseIcon from \"@mui/icons-material/Close\";\r\nimport CheckCircleOutlineIcon from \"@mui/icons-material/CheckCircleOutlined\";\r\nimport HighlightOffIcon from \"@mui/icons-material/HighlightOff\";\r\nimport RemoveCircleOutlineIcon from \"@mui/icons-material/RemoveCircleOutlined\";\r\nimport axiosInstance from \"../../../services/axios\";\r\nimport { END_POINT } from \"../../../services/endPoint\";\r\nimport type { CdrRecordResponse } from \"../../cdrReport/types\";\r\n\r\nexport type CellRender = \"text\" | \"badge\" | \"status-icon-badge\" | \"progress\";\r\nexport type CellValue = string | number | ProgressValue;\r\nexport interface ProgressValue {\r\n score: number;\r\n max: number;\r\n}\r\n\r\nexport interface TableColumn {\r\n key: string;\r\n label: string;\r\n render?: CellRender;\r\n align?: \"left\" | \"center\" | \"right\";\r\n minWidth?: number | string;\r\n}\r\n\r\nexport interface TableContent {\r\n type: \"table\";\r\n title?: string;\r\n columns: TableColumn[];\r\n rows: Array<Record<string, CellValue>>;\r\n /** Optional summary row rendered with emphasis at the bottom. */\r\n footerRow?: Record<string, CellValue>;\r\n}\r\n\r\nexport interface KVGridContent {\r\n type: \"kv-grid\";\r\n title?: string;\r\n items: Array<{ label: string; value: string }>;\r\n /** Number of label-value columns. Defaults to 2. */\r\n columns?: 1 | 2 | 3;\r\n}\r\n\r\nexport interface ScoreWithMetricsContent {\r\n type: \"score-with-metrics\";\r\n score: number;\r\n maxScore: number;\r\n scoreLabel?: string;\r\n /** Rendered as a StatusBadge alongside the score. */\r\n resultBadge?: string;\r\n /** Metric cards rendered to the right of the score. */\r\n metrics: Array<{ label: string; value: string }>;\r\n}\r\n\r\nexport interface TextContent {\r\n type: \"text\";\r\n title?: string;\r\n body: string;\r\n /** \"accent\" adds a left border in the primary colour. */\r\n variant?: \"default\" | \"accent\";\r\n}\r\n\r\nexport interface BulletGroupContent {\r\n type: \"bullet-group\";\r\n title?: string;\r\n /** Side-by-side bullet lists. */\r\n groups: Array<{\r\n title: string;\r\n items: string[];\r\n bulletColor?: string;\r\n }>;\r\n}\r\nexport type SectionContent =\r\n | TableContent\r\n | KVGridContent\r\n | ScoreWithMetricsContent\r\n | TextContent\r\n | BulletGroupContent;\r\n\r\nexport interface ReportSection {\r\n id: string;\r\n /** Tab label. */\r\n label: string;\r\n content: SectionContent[];\r\n}\r\n\r\nexport interface AuditReportDialogData {\r\n title: string;\r\n subtitle?: string;\r\n headerBadges?: Array<{ label: string; value: string; asBadge?: boolean }>;\r\n sections?: ReportSection[];\r\n // Call_Summary?: string;\r\n}\r\n\r\n// const MOCK_AUDIT_REPORT: AuditReportDialogData = {\r\n// title: \"Audit Report\",\r\n// subtitle: \"Priya · Apollo Hospitals – Hyderabad · 28-May-2026\",\r\n// headerBadges: [\r\n// {\r\n// label: \"Call Disposition\",\r\n// value: \"Appointment Booking – Existing Patient\",\r\n// },\r\n// { label: \"Result\", value: \"PASS\", asBadge: true },\r\n// { label: \"Score\", value: \"94/100\" },\r\n// ],\r\n// sections: [\r\n// {\r\n// id: \"overview\",\r\n// label: \"Overview\",\r\n// content: [\r\n// {\r\n// type: \"score-with-metrics\",\r\n// score: 94,\r\n// maxScore: 100,\r\n// scoreLabel: \"OVERALL SCORE\",\r\n// resultBadge: \"PASS\",\r\n// metrics: [\r\n// { label: \"Audit Result\", value: \"PASS\" },\r\n// { label: \"Compliance Status\", value: \"COMPLIANT\" },\r\n// { label: \"First Call Resolution\", value: \"ACHIEVED\" },\r\n// { label: \"Customer Experience\", value: \"GOOD\" },\r\n// { label: \"Process Adherence\", value: \"STRONG\" },\r\n// { label: \"Communication\", value: \"STRONG\" },\r\n// { label: \"Knowledge Accuracy\", value: \"STRONG\" },\r\n// { label: \"Empathy Handling\", value: \"MODERATE\" },\r\n// { label: \"Risk Severity\", value: \"LOW\" },\r\n// ],\r\n// },\r\n// {\r\n// type: \"kv-grid\",\r\n// title: \"Audit Metadata\",\r\n// columns: 2,\r\n// items: [\r\n// { label: \"Hospital Name\", value: \"Apollo Hospitals – Hyderabad\" },\r\n// { label: \"Call Duration\", value: \"Approx. 03:30 Minutes\" },\r\n// { label: \"Department\", value: \"Central Appointment Desk\" },\r\n// { label: \"Agent Name\", value: \"Priya\" },\r\n// {\r\n// label: \"Call Disposition\",\r\n// value: \"Appointment Booking – Existing Patient\",\r\n// },\r\n// { label: \"Employee ID\", value: \"Not Available\" },\r\n// { label: \"Call Category\", value: \"General Medicine OPD\" },\r\n// { label: \"Team Leader\", value: \"Not Available\" },\r\n// { label: \"Call Type\", value: \"Inbound\" },\r\n// { label: \"Auditor Name\", value: \"QA Team\" },\r\n// { label: \"Audit Date\", value: \"28-May-2026\" },\r\n// { label: \"Language\", value: \"English\" },\r\n// { label: \"Call Date & Time\", value: \"Not Available\" },\r\n// { label: \"Recording ID\", value: \"Not Available\" },\r\n// ],\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// id: \"scorecard\",\r\n// label: \"Scorecard\",\r\n// content: [\r\n// {\r\n// type: \"table\",\r\n// title: \"Quality Scorecard\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Evaluation Parameter\" },\r\n// {\r\n// key: \"weightage\",\r\n// label: \"Weightage\",\r\n// align: \"center\",\r\n// minWidth: 90,\r\n// },\r\n// {\r\n// key: \"scoreObtained\",\r\n// label: \"Score\",\r\n// align: \"center\",\r\n// minWidth: 80,\r\n// },\r\n// { key: \"bar\", label: \"\", render: \"progress\", minWidth: 120 },\r\n// { key: \"remarks\", label: \"Remarks\" },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Opening & Greeting\",\r\n// weightage: 10,\r\n// scoreObtained: 10,\r\n// bar: { score: 10, max: 10 },\r\n// remarks: \"Fully compliant\",\r\n// },\r\n// {\r\n// parameter: \"Verification & Authentication\",\r\n// weightage: 10,\r\n// scoreObtained: 9,\r\n// bar: { score: 9, max: 10 },\r\n// remarks: \"Secondary verification missed\",\r\n// },\r\n// {\r\n// parameter: \"Communication & Soft Skills\",\r\n// weightage: 15,\r\n// scoreObtained: 14,\r\n// bar: { score: 14, max: 15 },\r\n// remarks: \"Clear and professional\",\r\n// },\r\n// {\r\n// parameter: \"Process Knowledge\",\r\n// weightage: 20,\r\n// scoreObtained: 19,\r\n// bar: { score: 19, max: 20 },\r\n// remarks: \"Strong workflow adherence\",\r\n// },\r\n// {\r\n// parameter: \"Resolution Accuracy\",\r\n// weightage: 20,\r\n// scoreObtained: 20,\r\n// bar: { score: 20, max: 20 },\r\n// remarks: \"Accurate booking completed\",\r\n// },\r\n// {\r\n// parameter: \"Empathy & Patient Assurance\",\r\n// weightage: 10,\r\n// scoreObtained: 7,\r\n// bar: { score: 7, max: 10 },\r\n// remarks: \"Emotional reassurance missing\",\r\n// },\r\n// {\r\n// parameter: \"Call Handling & Probing\",\r\n// weightage: 5,\r\n// scoreObtained: 4,\r\n// bar: { score: 4, max: 5 },\r\n// remarks: \"Limited symptom probing\",\r\n// },\r\n// {\r\n// parameter: \"CRM Documentation Alignment\",\r\n// weightage: 5,\r\n// scoreObtained: 5,\r\n// bar: { score: 5, max: 5 },\r\n// remarks: \"Proper disposition assumed\",\r\n// },\r\n// {\r\n// parameter: \"Closing & Customer Education\",\r\n// weightage: 5,\r\n// scoreObtained: 4,\r\n// bar: { score: 4, max: 5 },\r\n// remarks: \"Good closure; recontact guidance missed\",\r\n// },\r\n// ],\r\n// footerRow: {\r\n// parameter: \"Total Score\",\r\n// weightage: 100,\r\n// scoreObtained: 93,\r\n// bar: { score: 93, max: 100 },\r\n// remarks: \"EXCELLENT\",\r\n// },\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Disposition-Based Quality Framework\",\r\n// columns: [\r\n// {\r\n// key: \"dispositionType\",\r\n// label: \"Disposition Type\",\r\n// minWidth: 160,\r\n// },\r\n// {\r\n// key: \"expectedFramework\",\r\n// label: \"Expected Framework\",\r\n// minWidth: 200,\r\n// },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"status-icon-badge\",\r\n// minWidth: 120,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\" },\r\n// ],\r\n// rows: [\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"Patient Verification\",\r\n// status: \"completed\",\r\n// remarks: \"Existing patient validation performed\",\r\n// },\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"Doctor & Slot Recommendation\",\r\n// status: \"completed\",\r\n// remarks: \"Appropriate slots offered\",\r\n// },\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"Appointment Confirmation\",\r\n// status: \"completed\",\r\n// remarks: \"Booking details confirmed clearly\",\r\n// },\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"SMS Confirmation Intimation\",\r\n// status: \"completed\",\r\n// remarks: \"SMS update communicated\",\r\n// },\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"Pre-Visit Guidance\",\r\n// status: \"completed\",\r\n// remarks: \"Arrival instructions shared\",\r\n// },\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"Cancellation/Rebooking Guidance\",\r\n// status: \"missed\",\r\n// remarks: \"No rebooking guidance provided\",\r\n// },\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"Clinical Sensitivity Handling\",\r\n// status: \"partial\",\r\n// remarks: \"Symptom probing not performed\",\r\n// },\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// expectedFramework: \"Empathy Statement\",\r\n// status: \"missed\",\r\n// remarks: \"No empathetic acknowledgement used\",\r\n// },\r\n// ],\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// id: \"checklist\",\r\n// label: \"Audit Checklist\",\r\n// content: [\r\n// {\r\n// type: \"table\",\r\n// title: \"Opening & Greeting\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Audit Parameter\", minWidth: 180 },\r\n// {\r\n// key: \"expectedStandard\",\r\n// label: \"Expected Standard\",\r\n// minWidth: 200,\r\n// },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"status-icon-badge\",\r\n// minWidth: 130,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\", minWidth: 160 },\r\n// {\r\n// key: \"qaObservation\",\r\n// label: \"QA Observation / Impact\",\r\n// minWidth: 180,\r\n// },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Standard Greeting Used\",\r\n// expectedStandard:\r\n// \"Agent must greet as per approved hospital script\",\r\n// status: \"complied\",\r\n// remarks: \"Standard greeting delivered correctly\",\r\n// qaObservation:\r\n// \"Professional opening created positive first impression\",\r\n// },\r\n// {\r\n// parameter: \"Hospital Name Mentioned\",\r\n// expectedStandard: \"Mandatory hospital identification\",\r\n// status: \"complied\",\r\n// remarks: \"Apollo Hospitals mentioned clearly\",\r\n// qaObservation: \"Established caller confidence\",\r\n// },\r\n// {\r\n// parameter: \"Agent Introduction Provided\",\r\n// expectedStandard: \"Agent must introduce self\",\r\n// status: \"complied\",\r\n// remarks: \"Agent introduced herself as Priya\",\r\n// qaObservation: \"Maintained professional etiquette\",\r\n// },\r\n// {\r\n// parameter: \"Professional Tone Maintained\",\r\n// expectedStandard: \"Warm and professional tone expected\",\r\n// status: \"complied\",\r\n// remarks: \"Tone remained courteous throughout\",\r\n// qaObservation: \"Positive customer experience maintained\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Verification & Authentication\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Audit Parameter\", minWidth: 180 },\r\n// {\r\n// key: \"expectedStandard\",\r\n// label: \"Expected Standard\",\r\n// minWidth: 200,\r\n// },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"status-icon-badge\",\r\n// minWidth: 130,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\", minWidth: 160 },\r\n// {\r\n// key: \"qaObservation\",\r\n// label: \"QA Observation / Impact\",\r\n// minWidth: 180,\r\n// },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Patient Name Captured\",\r\n// expectedStandard: \"Mandatory for identification\",\r\n// status: \"complied\",\r\n// remarks: \"Patient name confirmed\",\r\n// qaObservation: \"Proper patient identification followed\",\r\n// },\r\n// {\r\n// parameter: \"Existing/New Patient Validation\",\r\n// expectedStandard: \"Required for workflow routing\",\r\n// status: \"complied\",\r\n// remarks: \"Existing patient status verified\",\r\n// qaObservation: \"Correct workflow handling\",\r\n// },\r\n// {\r\n// parameter: \"Registered Mobile Number Verified\",\r\n// expectedStandard: \"Mandatory authentication step\",\r\n// status: \"complied\",\r\n// remarks: \"Mobile number validated\",\r\n// qaObservation: \"Compliance adherence maintained\",\r\n// },\r\n// {\r\n// parameter: \"Secondary Authentication (DOB/UHID)\",\r\n// expectedStandard: \"Recommended compliance practice\",\r\n// status: \"missed\",\r\n// remarks: \"DOB/UHID not validated\",\r\n// qaObservation: \"Minor compliance enhancement opportunity\",\r\n// },\r\n// {\r\n// parameter: \"Patient Data Handling\",\r\n// expectedStandard:\r\n// \"Confidential information to be handled securely\",\r\n// status: \"complied\",\r\n// remarks: \"No privacy concern observed\",\r\n// qaObservation: \"Low compliance risk\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Communication Effectiveness\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Audit Parameter\", minWidth: 180 },\r\n// {\r\n// key: \"expectedStandard\",\r\n// label: \"Expected Standard\",\r\n// minWidth: 200,\r\n// },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"status-icon-badge\",\r\n// minWidth: 130,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\", minWidth: 160 },\r\n// {\r\n// key: \"qaObservation\",\r\n// label: \"QA Observation / Impact\",\r\n// minWidth: 180,\r\n// },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Clarity of Speech\",\r\n// expectedStandard: \"Clear and understandable communication\",\r\n// status: \"complied\",\r\n// remarks: \"Good articulation observed\",\r\n// qaObservation: \"Smooth patient interaction\",\r\n// },\r\n// {\r\n// parameter: \"Active Listening Demonstrated\",\r\n// expectedStandard: \"Agent should acknowledge caller inputs\",\r\n// status: \"complied\",\r\n// remarks: \"Patient concern handled attentively\",\r\n// qaObservation: \"Effective communication maintained\",\r\n// },\r\n// {\r\n// parameter: \"Avoidance of Dead Air\",\r\n// expectedStandard: \"Minimal silence during call\",\r\n// status: \"complied\",\r\n// remarks: \"Smooth conversational flow\",\r\n// qaObservation: \"Enhanced caller comfort\",\r\n// },\r\n// {\r\n// parameter: \"Professional Language Usage\",\r\n// expectedStandard: \"No slang/rude language\",\r\n// status: \"complied\",\r\n// remarks: \"Professional language maintained\",\r\n// qaObservation: \"Positive brand representation\",\r\n// },\r\n// {\r\n// parameter: \"Empathy Statements Used\",\r\n// expectedStandard: \"Emotional acknowledgement expected\",\r\n// status: \"missed\",\r\n// remarks: \"No empathy statement provided\",\r\n// qaObservation: \"Patient reassurance opportunity missed\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Process & Workflow Adherence\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Audit Parameter\", minWidth: 180 },\r\n// {\r\n// key: \"expectedStandard\",\r\n// label: \"Expected Standard\",\r\n// minWidth: 200,\r\n// },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"status-icon-badge\",\r\n// minWidth: 130,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\", minWidth: 160 },\r\n// {\r\n// key: \"qaObservation\",\r\n// label: \"QA Observation / Impact\",\r\n// minWidth: 180,\r\n// },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Correct Department Identification\",\r\n// expectedStandard: \"Appropriate specialty mapping required\",\r\n// status: \"complied\",\r\n// remarks: \"General Medicine identified correctly\",\r\n// qaObservation: \"Strong process knowledge demonstrated\",\r\n// },\r\n// {\r\n// parameter: \"Doctor/Service Availability Checked\",\r\n// expectedStandard: \"Agent must provide available slots/services\",\r\n// status: \"complied\",\r\n// remarks: \"Two appointment slots offered\",\r\n// qaObservation: \"Efficient appointment handling\",\r\n// },\r\n// {\r\n// parameter: \"Appointment/Request Confirmation\",\r\n// expectedStandard: \"Explicit patient confirmation required\",\r\n// status: \"complied\",\r\n// remarks: \"5:30 PM slot confirmed\",\r\n// qaObservation: \"Accurate workflow execution\",\r\n// },\r\n// {\r\n// parameter: \"Resolution Accuracy\",\r\n// expectedStandard: \"Correct workflow execution mandatory\",\r\n// status: \"complied\",\r\n// remarks: \"Appointment booked successfully\",\r\n// qaObservation: \"FCR achieved\",\r\n// },\r\n// {\r\n// parameter: \"SMS / Ticket Confirmation Shared\",\r\n// expectedStandard: \"Customer confirmation mandatory\",\r\n// status: \"complied\",\r\n// remarks: \"SMS update communicated\",\r\n// qaObservation: \"Improved patient awareness\",\r\n// },\r\n// {\r\n// parameter: \"Pre-Visit / Next-Step Guidance Shared\",\r\n// expectedStandard: \"Appropriate instructions expected\",\r\n// status: \"complied\",\r\n// remarks: \"Asked patient to arrive 15 mins early\",\r\n// qaObservation: \"Good patient guidance\",\r\n// },\r\n// {\r\n// parameter: \"Cancellation/Rebooking Guidance Provided\",\r\n// expectedStandard: \"Recommended customer education practice\",\r\n// status: \"missed\",\r\n// remarks: \"No reschedule/cancellation guidance shared\",\r\n// qaObservation: \"Minor customer education gap\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Clinical Sensitivity & Patient Handling\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Audit Parameter\", minWidth: 180 },\r\n// {\r\n// key: \"expectedStandard\",\r\n// label: \"Expected Standard\",\r\n// minWidth: 200,\r\n// },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"status-icon-badge\",\r\n// minWidth: 130,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\", minWidth: 160 },\r\n// {\r\n// key: \"qaObservation\",\r\n// label: \"QA Observation / Impact\",\r\n// minWidth: 180,\r\n// },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Patient Concern Acknowledged\",\r\n// expectedStandard: \"Agent should acknowledge caller concern\",\r\n// status: \"partial\",\r\n// remarks: \"Symptoms heard but not emotionally acknowledged\",\r\n// qaObservation: \"Moderate empathy gap observed\",\r\n// },\r\n// {\r\n// parameter: \"Empathy Toward Patient Condition\",\r\n// expectedStandard: \"Empathetic reassurance expected\",\r\n// status: \"missed\",\r\n// remarks: \"No supportive reassurance statement\",\r\n// qaObservation: \"Patient-centric experience opportunity missed\",\r\n// },\r\n// {\r\n// parameter: \"Severity/Red Flag Probing\",\r\n// expectedStandard:\r\n// \"Escalation probing recommended where applicable\",\r\n// status: \"missed\",\r\n// remarks: \"No symptom severity probing conducted\",\r\n// qaObservation: \"Potential clinical sensitivity gap\",\r\n// },\r\n// {\r\n// parameter: \"Professional Behaviour Maintained\",\r\n// expectedStandard: \"Calm and respectful handling required\",\r\n// status: \"complied\",\r\n// remarks: \"Professional tone maintained\",\r\n// qaObservation: \"Positive interaction maintained\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Call Closure & Customer Education\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Audit Parameter\", minWidth: 180 },\r\n// {\r\n// key: \"expectedStandard\",\r\n// label: \"Expected Standard\",\r\n// minWidth: 200,\r\n// },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"status-icon-badge\",\r\n// minWidth: 130,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\", minWidth: 160 },\r\n// {\r\n// key: \"qaObservation\",\r\n// label: \"QA Observation / Impact\",\r\n// minWidth: 180,\r\n// },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Additional Assistance Offered\",\r\n// expectedStandard: \"Mandatory closure check\",\r\n// status: \"complied\",\r\n// remarks: \"Agent checked for additional help\",\r\n// qaObservation: \"Good closure adherence\",\r\n// },\r\n// {\r\n// parameter: \"Professional Closing Provided\",\r\n// expectedStandard: \"Standard closure etiquette expected\",\r\n// status: \"complied\",\r\n// remarks: \"Proper courtesy closing used\",\r\n// qaObservation: \"Positive closure experience\",\r\n// },\r\n// {\r\n// parameter: \"Wellness/Courtesy Statement Used\",\r\n// expectedStandard: \"Positive healthcare closure preferred\",\r\n// status: \"complied\",\r\n// remarks: '\"Wishing you a speedy recovery\" used',\r\n// qaObservation: \"Enhanced patient experience\",\r\n// },\r\n// {\r\n// parameter: \"Recontact Information Shared\",\r\n// expectedStandard: \"Helpline/rebooking guidance recommended\",\r\n// status: \"missed\",\r\n// remarks: \"No callback/rebooking information provided\",\r\n// qaObservation: \"Minor patient education gap\",\r\n// },\r\n// ],\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// id: \"compliance\",\r\n// label: \"Compliance\",\r\n// content: [\r\n// {\r\n// type: \"table\",\r\n// title: \"Critical Compliance & Risk Analysis\",\r\n// columns: [\r\n// { key: \"parameter\", label: \"Critical Parameter\" },\r\n// {\r\n// key: \"status\",\r\n// label: \"Status\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// minWidth: 80,\r\n// },\r\n// {\r\n// key: \"riskLevel\",\r\n// label: \"Risk Level\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// minWidth: 100,\r\n// },\r\n// { key: \"remarks\", label: \"Remarks\" },\r\n// ],\r\n// rows: [\r\n// {\r\n// parameter: \"Wrong Information Shared\",\r\n// status: \"NO\",\r\n// riskLevel: \"LOW\",\r\n// remarks: \"Correct appointment information provided\",\r\n// },\r\n// {\r\n// parameter: \"Incorrect Appointment / Service Booking\",\r\n// status: \"NO\",\r\n// riskLevel: \"LOW\",\r\n// remarks: \"Booking completed accurately\",\r\n// },\r\n// {\r\n// parameter: \"Data Privacy Breach\",\r\n// status: \"NO\",\r\n// riskLevel: \"LOW\",\r\n// remarks: \"No confidentiality breach observed\",\r\n// },\r\n// {\r\n// parameter: \"Escalation Failure\",\r\n// status: \"NO\",\r\n// riskLevel: \"LOW\",\r\n// remarks: \"No escalation scenario identified\",\r\n// },\r\n// {\r\n// parameter: \"False Commitment\",\r\n// status: \"NO\",\r\n// riskLevel: \"LOW\",\r\n// remarks: \"No incorrect assurance provided\",\r\n// },\r\n// {\r\n// parameter: \"Rude / Unprofessional Behaviour\",\r\n// status: \"NO\",\r\n// riskLevel: \"LOW\",\r\n// remarks: \"Professional behaviour maintained\",\r\n// },\r\n// {\r\n// parameter: \"Incomplete Resolution\",\r\n// status: \"NO\",\r\n// riskLevel: \"LOW\",\r\n// remarks: \"Query resolved successfully\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Knowledge Gap & Disposition Analytics\",\r\n// columns: [\r\n// {\r\n// key: \"dispositionType\",\r\n// label: \"Disposition Type\",\r\n// minWidth: 180,\r\n// },\r\n// {\r\n// key: \"processKnowledge\",\r\n// label: \"Process Knowledge\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// },\r\n// {\r\n// key: \"communication\",\r\n// label: \"Communication\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// },\r\n// {\r\n// key: \"compliance\",\r\n// label: \"Compliance\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// },\r\n// {\r\n// key: \"riskTrend\",\r\n// label: \"Risk Trend\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// },\r\n// { key: \"qaObservation\", label: \"QA Observation\" },\r\n// ],\r\n// rows: [\r\n// {\r\n// dispositionType: \"Appointment Booking\",\r\n// processKnowledge: \"STRONG\",\r\n// communication: \"STRONG\",\r\n// compliance: \"STRONG\",\r\n// riskTrend: \"LOW\",\r\n// qaObservation: \"Operationally stable\",\r\n// },\r\n// {\r\n// dispositionType: \"Existing Patient Verification\",\r\n// processKnowledge: \"STRONG\",\r\n// communication: \"GOOD\",\r\n// compliance: \"GOOD\",\r\n// riskTrend: \"LOW\",\r\n// qaObservation: \"Secondary authentication gap\",\r\n// },\r\n// {\r\n// dispositionType: \"Symptomatic Patient Handling\",\r\n// processKnowledge: \"MODERATE\",\r\n// communication: \"MODERATE\",\r\n// compliance: \"MODERATE\",\r\n// riskTrend: \"MEDIUM\",\r\n// qaObservation: \"Empathy and probing improvement needed\",\r\n// },\r\n// {\r\n// dispositionType: \"Patient Education\",\r\n// processKnowledge: \"MODERATE\",\r\n// communication: \"GOOD\",\r\n// compliance: \"MODERATE\",\r\n// riskTrend: \"LOW\",\r\n// qaObservation: \"Rebooking guidance missed\",\r\n// },\r\n// ],\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// id: \"development\",\r\n// label: \"Development\",\r\n// content: [\r\n// {\r\n// type: \"table\",\r\n// title: \"Root Cause Analysis\",\r\n// columns: [\r\n// { key: \"observation\", label: \"Observation\", minWidth: 180 },\r\n// { key: \"rootCause\", label: \"Root Cause\", minWidth: 200 },\r\n// { key: \"impact\", label: \"Impact\", minWidth: 200 },\r\n// {\r\n// key: \"severity\",\r\n// label: \"Severity\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// minWidth: 90,\r\n// },\r\n// ],\r\n// rows: [\r\n// {\r\n// observation: \"Lack of empathy statements\",\r\n// rootCause: \"Transaction-focused handling approach\",\r\n// impact: \"Reduced emotional reassurance\",\r\n// severity: \"MEDIUM\",\r\n// },\r\n// {\r\n// observation: \"Limited symptom probing\",\r\n// rootCause: \"Inadequate clinical sensitivity coaching\",\r\n// impact: \"Potential missed escalation opportunity\",\r\n// severity: \"MEDIUM\",\r\n// },\r\n// {\r\n// observation: \"Missing cancellation guidance\",\r\n// rootCause: \"Incomplete closure checklist adherence\",\r\n// impact: \"Minor customer education gap\",\r\n// severity: \"LOW\",\r\n// },\r\n// {\r\n// observation: \"Secondary authentication missed\",\r\n// rootCause: \"Fast-call handling prioritization\",\r\n// impact: \"Minor compliance exposure\",\r\n// severity: \"LOW\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"table\",\r\n// title: \"Coaching & Development Plan\",\r\n// columns: [\r\n// { key: \"area\", label: \"Coaching Area\", minWidth: 160 },\r\n// {\r\n// key: \"recommendedAction\",\r\n// label: \"Recommended Action\",\r\n// minWidth: 220,\r\n// },\r\n// { key: \"owner\", label: \"Owner\", minWidth: 140 },\r\n// {\r\n// key: \"priority\",\r\n// label: \"Priority\",\r\n// render: \"badge\",\r\n// align: \"center\",\r\n// minWidth: 90,\r\n// },\r\n// { key: \"targetDate\", label: \"Target Date\", minWidth: 120 },\r\n// ],\r\n// rows: [\r\n// {\r\n// area: \"Empathy Handling\",\r\n// recommendedAction:\r\n// \"Reinforce empathetic acknowledgement techniques\",\r\n// owner: \"Team Leader\",\r\n// priority: \"HIGH\",\r\n// targetDate: \"Immediate\",\r\n// },\r\n// {\r\n// area: \"Clinical Sensitivity\",\r\n// recommendedAction: \"Train on symptom severity probing standards\",\r\n// owner: \"QA / Training Team\",\r\n// priority: \"HIGH\",\r\n// targetDate: \"Immediate\",\r\n// },\r\n// {\r\n// area: \"Closure Framework\",\r\n// recommendedAction:\r\n// \"Include rebooking/cancellation education in closure\",\r\n// owner: \"Team Leader\",\r\n// priority: \"MEDIUM\",\r\n// targetDate: \"Within 1 Week\",\r\n// },\r\n// {\r\n// area: \"Verification Compliance\",\r\n// recommendedAction: \"Reinforce secondary authentication process\",\r\n// owner: \"Operations Team\",\r\n// priority: \"MEDIUM\",\r\n// targetDate: \"Within 1 Week\",\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"text\",\r\n// title: \"Operational Assessment\",\r\n// body: \"The call demonstrated strong operational efficiency, accurate appointment booking workflow adherence, and professional customer handling. The interaction was completed successfully without any critical compliance or process failures.\",\r\n// },\r\n// {\r\n// type: \"bullet-group\",\r\n// groups: [\r\n// {\r\n// title: \"Key Strengths\",\r\n// bulletColor: \"#2e7d32\",\r\n// items: [\r\n// \"Strong appointment booking workflow adherence\",\r\n// \"Accurate and clear communication\",\r\n// \"Professional call handling behaviour\",\r\n// \"Effective call closure etiquette\",\r\n// ],\r\n// },\r\n// {\r\n// title: \"Improvement Areas\",\r\n// bulletColor: \"#e65100\",\r\n// items: [\r\n// \"Empathy and emotional reassurance\",\r\n// \"Symptom-based probing\",\r\n// \"Secondary patient authentication\",\r\n// \"Rebooking/cancellation guidance\",\r\n// ],\r\n// },\r\n// ],\r\n// },\r\n// {\r\n// type: \"text\",\r\n// title: \"Management Recommendation\",\r\n// body: \"Continue current operational workflow practices while introducing targeted coaching on healthcare empathy handling and clinical sensitivity-based customer interactions.\",\r\n// },\r\n// {\r\n// type: \"text\",\r\n// title: \"Final Auditor Remarks\",\r\n// body: \"The agent successfully managed the appointment booking interaction with strong process adherence, accurate resolution delivery, and professional communication standards. No operational or compliance risks were identified during the interaction. The primary opportunity for improvement lies in enhancing patient-centric empathy, clinical sensitivity probing, and strengthening closure education practices to further elevate overall patient experience quality.\",\r\n// variant: \"accent\",\r\n// },\r\n// ],\r\n// },\r\n// ],\r\n// };\r\n\r\nconst STATUS_COLOUR: Record<string, { color: string; bg: string }> = {\r\n completed: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n complied: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n pass: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n compliant: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n achieved: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n strong: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n excellent: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n low: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n no: { color: \"#2e7d32\", bg: \"#e8f5e9\" },\r\n good: { color: \"#1565c0\", bg: \"#e3f2fd\" },\r\n partial: { color: \"#e65100\", bg: \"#fff3e0\" },\r\n moderate: { color: \"#e65100\", bg: \"#fff3e0\" },\r\n medium: { color: \"#e65100\", bg: \"#fff3e0\" },\r\n missed: { color: \"#c62828\", bg: \"#ffebee\" },\r\n fail: { color: \"#c62828\", bg: \"#ffebee\" },\r\n high: { color: \"#c62828\", bg: \"#ffebee\" },\r\n yes: { color: \"#c62828\", bg: \"#ffebee\" },\r\n};\r\n\r\nfunction resolveColour(label: string): { color: string; bg: string } {\r\n const key = label.toLowerCase().replace(/[^a-z]/g, \"\");\r\n return STATUS_COLOUR[key] ?? { color: \"#555\", bg: \"#f0f0f0\" };\r\n}\r\n\r\nfunction StatusBadge({ label }: { label: string }) {\r\n const { color, bg } = resolveColour(label);\r\n return (\r\n <Box\r\n sx={{\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n px: \"7px\",\r\n py: \"2px\",\r\n borderRadius: \"4px\",\r\n backgroundColor: bg,\r\n whiteSpace: \"nowrap\",\r\n }}\r\n >\r\n <Typography\r\n sx={{\r\n fontSize: \"0.72rem\",\r\n fontWeight: 600,\r\n color,\r\n letterSpacing: \"0.02em\",\r\n }}\r\n >\r\n {label.toUpperCase()}\r\n </Typography>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction StatusIconBadge({ label }: { label: string }) {\r\n const key = label.toLowerCase().replace(/[^a-z]/g, \"\");\r\n let icon: React.ReactNode;\r\n if (key === \"complied\" || key === \"completed\") {\r\n icon = <CheckCircleOutlineIcon sx={{ fontSize: 15, color: \"#2e7d32\" }} />;\r\n } else if (key === \"partial\") {\r\n icon = <RemoveCircleOutlineIcon sx={{ fontSize: 15, color: \"#e65100\" }} />;\r\n } else {\r\n icon = <HighlightOffIcon sx={{ fontSize: 15, color: \"#c62828\" }} />;\r\n }\r\n return (\r\n <Box sx={{ display: \"inline-flex\", alignItems: \"center\", gap: \"4px\" }}>\r\n {icon}\r\n <StatusBadge label={label} />\r\n </Box>\r\n );\r\n}\r\n\r\nfunction ProgressCell({\r\n value,\r\n primary,\r\n}: {\r\n value: ProgressValue;\r\n primary: string;\r\n}) {\r\n const pct = Math.min(Math.round((value.score / value.max) * 100), 100);\r\n const isLow = pct < 80;\r\n const barColor = isLow ? \"#c62828\" : primary;\r\n return (\r\n <Box sx={{ display: \"flex\", alignItems: \"center\", gap: 1, minWidth: 100 }}>\r\n <LinearProgress\r\n variant=\"determinate\"\r\n value={pct}\r\n sx={{\r\n flex: 1,\r\n height: 5,\r\n borderRadius: 3,\r\n backgroundColor: alpha(barColor, 0.12),\r\n \"& .MuiLinearProgress-bar\": {\r\n backgroundColor: barColor,\r\n borderRadius: 3,\r\n },\r\n }}\r\n />\r\n <Typography\r\n sx={{\r\n fontSize: \"0.68rem\",\r\n color: \"text.secondary\",\r\n minWidth: 28,\r\n textAlign: \"right\",\r\n }}\r\n >\r\n {pct}%\r\n </Typography>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction RenderCell({\r\n value,\r\n render,\r\n primary,\r\n}: {\r\n value: CellValue;\r\n render?: CellRender;\r\n primary: string;\r\n}) {\r\n if (render === \"badge\") {\r\n return <StatusBadge label={String(value)} />;\r\n }\r\n if (render === \"status-icon-badge\") {\r\n return <StatusIconBadge label={String(value)} />;\r\n }\r\n if (render === \"progress\" && typeof value === \"object\") {\r\n return <ProgressCell value={value as ProgressValue} primary={primary} />;\r\n }\r\n return <>{value}</>;\r\n}\r\n\r\nconst TH: SxProps<Theme> = {\r\n fontSize: \"0.72rem\",\r\n fontWeight: 700,\r\n color: \"text.secondary\",\r\n py: \"7px\",\r\n px: \"10px\",\r\n backgroundColor: \"#f5f7f8\",\r\n borderBottom: \"1px solid\",\r\n borderColor: \"divider\",\r\n whiteSpace: \"nowrap\",\r\n};\r\n\r\nconst TD: SxProps<Theme> = {\r\n fontSize: \"0.75rem\",\r\n color: \"text.primary\",\r\n py: \"6px\",\r\n px: \"10px\",\r\n borderBottom: \"1px solid\",\r\n borderColor: \"divider\",\r\n verticalAlign: \"middle\",\r\n};\r\nfunction RenderTable({\r\n content,\r\n primary,\r\n}: {\r\n content: TableContent;\r\n primary: string;\r\n}) {\r\n return (\r\n <Box>\r\n {content.title && (\r\n <Typography\r\n sx={{\r\n fontSize: \"0.78rem\",\r\n fontWeight: 700,\r\n color: \"text.primary\",\r\n mb: \"8px\",\r\n mt: \"4px\",\r\n }}\r\n >\r\n {content.title}\r\n </Typography>\r\n )}\r\n <TableContainer\r\n sx={{\r\n border: \"1px solid\",\r\n borderColor: \"divider\",\r\n borderRadius: \"8px\",\r\n overflow: \"hidden\",\r\n }}\r\n >\r\n <Table size=\"small\">\r\n <TableHead>\r\n <TableRow>\r\n {content.columns.map((col) => (\r\n <TableCell\r\n key={col.key}\r\n sx={{\r\n ...TH,\r\n textAlign: col.align ?? \"left\",\r\n minWidth: col.minWidth,\r\n }}\r\n >\r\n {col.label}\r\n </TableCell>\r\n ))}\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n {content.rows.map((row, ri) => (\r\n <TableRow\r\n key={ri}\r\n sx={{\r\n \"&:last-child td\": {\r\n borderBottom: content.footerRow ? undefined : 0,\r\n },\r\n }}\r\n >\r\n {content.columns.map((col) => (\r\n <TableCell\r\n key={col.key}\r\n sx={{ ...TD, textAlign: col.align ?? \"left\" }}\r\n >\r\n <RenderCell\r\n value={row[col.key] ?? \"\"}\r\n render={col.render}\r\n primary={primary}\r\n />\r\n </TableCell>\r\n ))}\r\n </TableRow>\r\n ))}\r\n {content.footerRow && (\r\n <TableRow\r\n sx={{ backgroundColor: \"#f5f7f8\", \"& td\": { borderBottom: 0 } }}\r\n >\r\n {content.columns.map((col) => (\r\n <TableCell\r\n key={col.key}\r\n sx={{\r\n ...TD,\r\n textAlign: col.align ?? \"left\",\r\n fontWeight: 700,\r\n }}\r\n >\r\n <RenderCell\r\n value={content.footerRow![col.key] ?? \"\"}\r\n render={col.render}\r\n primary={primary}\r\n />\r\n </TableCell>\r\n ))}\r\n </TableRow>\r\n )}\r\n </TableBody>\r\n </Table>\r\n </TableContainer>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction RenderKVGrid({ content }: { content: KVGridContent }) {\r\n const cols = content.columns ?? 2;\r\n const half = Math.ceil(content.items.length / cols);\r\n const chunks: (typeof content.items)[] = [];\r\n for (let i = 0; i < cols; i++) {\r\n chunks.push(content.items.slice(i * half, (i + 1) * half));\r\n }\r\n\r\n return (\r\n <Box>\r\n {content.title && (\r\n <Typography\r\n sx={{\r\n fontSize: \"0.78rem\",\r\n fontWeight: 700,\r\n color: \"text.primary\",\r\n mb: \"8px\",\r\n mt: \"4px\",\r\n }}\r\n >\r\n {content.title}\r\n </Typography>\r\n )}\r\n <Box\r\n sx={{\r\n border: \"1px solid\",\r\n borderColor: \"divider\",\r\n borderRadius: \"8px\",\r\n overflow: \"hidden\",\r\n backgroundColor: \"background.paper\",\r\n }}\r\n >\r\n <Box sx={{ display: \"flex\", flexWrap: \"wrap\" }}>\r\n {chunks.map((chunk, ci) => (\r\n <Box\r\n key={ci}\r\n sx={{\r\n flex: \"1 1 240px\",\r\n minWidth: 0,\r\n borderRight: ci < chunks.length - 1 ? \"1px solid\" : \"none\",\r\n borderColor: \"divider\",\r\n }}\r\n >\r\n {chunk.map((item, ii) => (\r\n <Box\r\n key={ii}\r\n sx={{\r\n display: \"flex\",\r\n alignItems: \"baseline\",\r\n borderBottom: ii < chunk.length - 1 ? \"1px solid\" : \"none\",\r\n borderColor: \"divider\",\r\n px: \"10px\",\r\n py: \"6px\",\r\n gap: 1,\r\n }}\r\n >\r\n <Typography\r\n sx={{\r\n fontSize: \"0.72rem\",\r\n color: \"text.secondary\",\r\n minWidth: 140,\r\n flexShrink: 0,\r\n }}\r\n >\r\n {item.label}\r\n </Typography>\r\n <Typography\r\n sx={{\r\n fontSize: \"0.75rem\",\r\n color: \"text.primary\",\r\n fontWeight: 500,\r\n }}\r\n >\r\n {item.value === \"Not Available\" ? \"_\" : item.value}\r\n </Typography>\r\n </Box>\r\n ))}\r\n </Box>\r\n ))}\r\n </Box>\r\n </Box>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction RenderScoreWithMetrics({\r\n content,\r\n primary,\r\n}: {\r\n content: ScoreWithMetricsContent;\r\n primary: string;\r\n}) {\r\n const pct = Math.round((content.score / content.maxScore) * 100);\r\n return (\r\n <Box\r\n sx={{ display: \"flex\", gap: 2, flexWrap: \"wrap\", alignItems: \"stretch\" }}\r\n >\r\n {/* Score card */}\r\n <Box\r\n sx={{\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n border: \"1px solid\",\r\n borderColor: \"divider\",\r\n borderRadius: \"8px\",\r\n backgroundColor: \"background.paper\",\r\n px: 3,\r\n py: 2,\r\n minWidth: 140,\r\n gap: 0.5,\r\n }}\r\n >\r\n <Typography\r\n sx={{\r\n fontSize: \"0.72rem\",\r\n color: \"text.secondary\",\r\n fontWeight: 600,\r\n mb: 0.5,\r\n letterSpacing: \"0.04em\",\r\n }}\r\n >\r\n {content.scoreLabel ?? \"SCORE\"}\r\n </Typography>\r\n <Box sx={{ display: \"flex\", alignItems: \"baseline\", gap: \"3px\" }}>\r\n <Typography\r\n sx={{\r\n fontSize: \"2.4rem\",\r\n fontWeight: 700,\r\n color: primary,\r\n lineHeight: 1,\r\n }}\r\n >\r\n {content.score}\r\n </Typography>\r\n <Typography\r\n sx={{\r\n fontSize: \"0.85rem\",\r\n color: \"text.secondary\",\r\n fontWeight: 600,\r\n }}\r\n >\r\n /{content.maxScore}\r\n </Typography>\r\n </Box>\r\n <Box sx={{ width: \"100%\", mt: 0.75 }}>\r\n <LinearProgress\r\n variant=\"determinate\"\r\n value={pct}\r\n sx={{\r\n height: 6,\r\n borderRadius: 3,\r\n backgroundColor: alpha(primary, 0.12),\r\n \"& .MuiLinearProgress-bar\": {\r\n backgroundColor: primary,\r\n borderRadius: 3,\r\n },\r\n }}\r\n />\r\n </Box>\r\n {content.resultBadge && (\r\n <Box sx={{ mt: 0.75 }}>\r\n <StatusBadge label={content.resultBadge} />\r\n </Box>\r\n )}\r\n </Box>\r\n\r\n {/* Metric cards */}\r\n <Box\r\n sx={{\r\n flex: 1,\r\n minWidth: 260,\r\n display: \"grid\",\r\n gridTemplateColumns: \"repeat(auto-fill, minmax(160px, 1fr))\",\r\n gap: \"8px\",\r\n }}\r\n >\r\n {content.metrics.map((m) => (\r\n <Box\r\n key={m.label}\r\n sx={{\r\n border: \"1px solid\",\r\n borderColor: \"divider\",\r\n borderRadius: \"6px\",\r\n backgroundColor: \"background.paper\",\r\n px: \"10px\",\r\n py: \"7px\",\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"space-between\",\r\n gap: 1,\r\n }}\r\n >\r\n <Typography\r\n sx={{\r\n fontSize: \"0.72rem\",\r\n color: \"text.secondary\",\r\n lineHeight: 1.3,\r\n flex: 1,\r\n }}\r\n >\r\n {m.label}\r\n </Typography>\r\n <StatusBadge label={m.value} />\r\n </Box>\r\n ))}\r\n </Box>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction RenderText({\r\n content,\r\n primary,\r\n}: {\r\n content: TextContent;\r\n primary: string;\r\n}) {\r\n const isAccent = content.variant === \"accent\";\r\n return (\r\n <Box\r\n sx={{\r\n border: \"1px solid\",\r\n borderLeft: isAccent ? \"3px solid\" : \"1px solid\",\r\n borderColor: \"divider\",\r\n borderLeftColor: isAccent ? primary : \"divider\",\r\n borderRadius: \"6px\",\r\n px: \"14px\",\r\n py: \"10px\",\r\n backgroundColor: isAccent ? alpha(primary, 0.04) : \"background.paper\",\r\n }}\r\n >\r\n {content.title && (\r\n <Typography\r\n sx={{\r\n fontSize: \"0.78rem\",\r\n fontWeight: 600,\r\n color: isAccent ? primary : \"text.primary\",\r\n mb: \"6px\",\r\n }}\r\n >\r\n {content.title}\r\n </Typography>\r\n )}\r\n <Typography\r\n sx={{ fontSize: \"0.75rem\", color: \"text.secondary\", lineHeight: 1.6 }}\r\n >\r\n {content.body}\r\n </Typography>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction RenderBulletGroup({ content }: { content: BulletGroupContent }) {\r\n return (\r\n <Box>\r\n {content.title && (\r\n <Typography\r\n sx={{\r\n fontSize: \"0.78rem\",\r\n fontWeight: 700,\r\n color: \"text.primary\",\r\n mb: \"8px\",\r\n mt: \"4px\",\r\n }}\r\n >\r\n {content.title}\r\n </Typography>\r\n )}\r\n <Box sx={{ display: \"flex\", gap: 2, flexWrap: \"wrap\" }}>\r\n {content.groups.map((g, gi) => (\r\n <Box\r\n key={gi}\r\n sx={{\r\n flex: \"1 1 200px\",\r\n border: \"1px solid\",\r\n borderColor: \"divider\",\r\n borderRadius: \"6px\",\r\n backgroundColor: \"background.paper\",\r\n px: \"14px\",\r\n py: \"10px\",\r\n }}\r\n >\r\n <Typography\r\n sx={{\r\n fontSize: \"0.78rem\",\r\n fontWeight: 600,\r\n color: \"text.primary\",\r\n mb: \"8px\",\r\n }}\r\n >\r\n {g.title}\r\n </Typography>\r\n {g.items.map((item, ii) => (\r\n <Box\r\n key={ii}\r\n sx={{\r\n display: \"flex\",\r\n alignItems: \"flex-start\",\r\n gap: \"7px\",\r\n mb: \"5px\",\r\n }}\r\n >\r\n <Box\r\n sx={{\r\n width: 5,\r\n height: 5,\r\n borderRadius: \"50%\",\r\n backgroundColor: g.bulletColor ?? \"#555\",\r\n mt: \"5px\",\r\n flexShrink: 0,\r\n }}\r\n />\r\n <Typography\r\n sx={{\r\n fontSize: \"0.75rem\",\r\n color: \"text.secondary\",\r\n lineHeight: 1.5,\r\n }}\r\n >\r\n {item}\r\n </Typography>\r\n </Box>\r\n ))}\r\n </Box>\r\n ))}\r\n </Box>\r\n </Box>\r\n );\r\n}\r\n\r\nfunction SectionPanel({\r\n section,\r\n primary,\r\n}: {\r\n section: ReportSection;\r\n primary: string;\r\n}) {\r\n return (\r\n <Box sx={{ display: \"flex\", flexDirection: \"column\", gap: 2 }}>\r\n {section.content.map((item, i) => {\r\n switch (item.type) {\r\n case \"table\":\r\n return <RenderTable key={i} content={item} primary={primary} />;\r\n case \"kv-grid\":\r\n return <RenderKVGrid key={i} content={item} />;\r\n case \"score-with-metrics\":\r\n return (\r\n <RenderScoreWithMetrics\r\n key={i}\r\n content={item}\r\n primary={primary}\r\n />\r\n );\r\n case \"text\":\r\n return <RenderText key={i} content={item} primary={primary} />;\r\n case \"bullet-group\":\r\n return <RenderBulletGroup key={i} content={item} />;\r\n default:\r\n return null;\r\n }\r\n })}\r\n </Box>\r\n );\r\n}\r\n\r\nconst PRINT_ROOT_ID = \"audit-report-print-root\";\r\n\r\nconst PRINT_STYLES = (\r\n <GlobalStyles\r\n styles={{\r\n [`#${PRINT_ROOT_ID}`]: {\r\n position: \"absolute\",\r\n width: \"1px\",\r\n height: \"1px\",\r\n overflow: \"hidden\",\r\n clip: \"rect(0 0 0 0)\",\r\n clipPath: \"inset(50%)\",\r\n whiteSpace: \"nowrap\",\r\n pointerEvents: \"none\",\r\n },\r\n \"@media print\": {\r\n \"body *\": { visibility: \"hidden\" },\r\n [`#${PRINT_ROOT_ID}`]: {\r\n visibility: \"visible\",\r\n // override the off-screen clip\r\n position: \"absolute\",\r\n top: 0,\r\n left: 0,\r\n width: \"100%\",\r\n height: \"auto\",\r\n overflow: \"visible\",\r\n clip: \"auto\",\r\n clipPath: \"none\",\r\n whiteSpace: \"normal\",\r\n padding: \"0 8mm\",\r\n boxSizing: \"border-box\",\r\n },\r\n [`#${PRINT_ROOT_ID} *`]: {\r\n visibility: \"visible\",\r\n printColorAdjust: \"exact\",\r\n WebkitPrintColorAdjust: \"exact\",\r\n } as React.CSSProperties,\r\n },\r\n }}\r\n />\r\n);\r\n\r\nfunction PrintLayout({\r\n report,\r\n primary,\r\n}: {\r\n report: AuditReportDialogData | null;\r\n primary: string;\r\n}) {\r\n return (\r\n <div id={PRINT_ROOT_ID}>\r\n <Box\r\n sx={{\r\n mb: 2.5,\r\n pb: 1.5,\r\n borderBottom: \"2px solid\",\r\n borderColor: \"divider\",\r\n }}\r\n >\r\n <Typography\r\n sx={{ fontSize: \"1.2rem\", fontWeight: 700, color: \"text.primary\" }}\r\n >\r\n {report?.title}\r\n </Typography>\r\n\r\n {report?.subtitle && (\r\n <Typography\r\n sx={{ fontSize: \"0.8rem\", color: \"text.secondary\", mt: \"4px\" }}\r\n >\r\n {report.subtitle}\r\n </Typography>\r\n )}\r\n\r\n {report?.headerBadges && report.headerBadges.length > 0 && (\r\n <Box sx={{ display: \"flex\", gap: 1, flexWrap: \"wrap\", mt: 1 }}>\r\n {report.headerBadges.map((badge, i) =>\r\n badge.asBadge ? (\r\n <StatusBadge key={i} label={badge.value} />\r\n ) : (\r\n <Typography\r\n key={i}\r\n sx={{ fontSize: \"0.72rem\", color: \"text.secondary\" }}\r\n >\r\n <Box\r\n component=\"span\"\r\n sx={{ fontWeight: 600, color: \"text.primary\", mr: \"3px\" }}\r\n >\r\n {badge.label}:\r\n </Box>\r\n {badge.value}\r\n </Typography>\r\n ),\r\n )}\r\n </Box>\r\n )}\r\n </Box>\r\n\r\n {/* ── All sections stacked ── */}\r\n {report?.sections?.map((section, si) => (\r\n <Box\r\n key={section.id}\r\n sx={{\r\n mb: 3,\r\n pageBreakBefore: si > 0 ? \"always\" : \"auto\",\r\n }}\r\n >\r\n <Typography\r\n sx={{\r\n fontSize: \"0.82rem\",\r\n fontWeight: 700,\r\n color: \"text.primary\",\r\n mb: 1.5,\r\n pb: \"6px\",\r\n borderBottom: \"2px solid\",\r\n borderColor: \"divider\",\r\n textTransform: \"uppercase\",\r\n letterSpacing: \"0.06em\",\r\n }}\r\n >\r\n {section.label}\r\n </Typography>\r\n\r\n <SectionPanel section={section} primary={primary} />\r\n </Box>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\ninterface AuditReportDialogProps {\r\n open: boolean;\r\n onClose: () => void;\r\n maxWidth?: \"sm\" | \"md\" | \"lg\" | \"xl\";\r\n rowData?: CdrRecordResponse;\r\n}\r\n\r\nexport default function AuditReportDialog({\r\n open,\r\n onClose,\r\n maxWidth = \"lg\",\r\n rowData,\r\n}: AuditReportDialogProps) {\r\n const theme = useTheme();\r\n const primary = theme.palette.primary.main;\r\n const [activeTab, setActiveTab] = useState(0);\r\n const [reportData, setReportData] = useState<AuditReportDialogData | null>({\r\n title: \"Audit Report\",\r\n });\r\n const [auditLoading, setAuditLoading] = useState(false);\r\n const [auditError, setAuditError] = useState<string | null>(null);\r\n\r\n useEffect(() => {\r\n setReportData({ title: \"Audit Report\" });\r\n setAuditError(null);\r\n setActiveTab(0);\r\n\r\n if (!open || !rowData) return;\r\n\r\n let cancelled = false;\r\n\r\n const fetchAuditReport = async () => {\r\n setAuditLoading(true);\r\n try {\r\n const res = await axiosInstance.get<AuditReportDialogData>(\r\n END_POINT.CALLSAGE_AUDIT(rowData.callUuid),\r\n );\r\n\r\n if (!cancelled) setReportData(res.data);\r\n } catch (err: any) {\r\n if (!cancelled) {\r\n setAuditError(\r\n err?.response?.data?.message ??\r\n err?.message ??\r\n \"Failed to generate audit report\",\r\n );\r\n setReportData({ title: \"Audit Report\" });\r\n }\r\n } finally {\r\n if (!cancelled) setAuditLoading(false);\r\n }\r\n };\r\n\r\n fetchAuditReport();\r\n return () => {\r\n cancelled = true;\r\n };\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [open, rowData]);\r\n\r\n return (\r\n <>\r\n {/* Inject print CSS into <head> once while the dialog is mounted */}\r\n {PRINT_STYLES}\r\n {open &&\r\n createPortal(\r\n <PrintLayout report={reportData} primary={primary} />,\r\n document.body,\r\n )}\r\n\r\n <Dialog\r\n open={open}\r\n onClose={onClose}\r\n maxWidth={maxWidth}\r\n fullWidth\r\n slotProps={{\r\n paper: {\r\n sx: {\r\n height: \"90vh\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n overflow: \"hidden\",\r\n borderRadius: \"10px\",\r\n },\r\n },\r\n }}\r\n >\r\n <DialogTitle\r\n sx={{\r\n px: { xs: 2, md: 2.5 },\r\n py: \"12px\",\r\n display: \"flex\",\r\n alignItems: \"flex-start\",\r\n justifyContent: \"space-between\",\r\n gap: 1,\r\n borderBottom: \"1px solid\",\r\n borderColor: \"divider\",\r\n flexShrink: 0,\r\n }}\r\n >\r\n <Box sx={{ minWidth: 0 }}>\r\n <Typography\r\n sx={{\r\n fontWeight: 700,\r\n fontSize: { xs: \"1rem\", sm: \"1.2rem\" },\r\n color: \"text.primary\",\r\n lineHeight: 1.3,\r\n }}\r\n >\r\n {reportData?.title}\r\n </Typography>\r\n {reportData?.subtitle && (\r\n <Typography\r\n sx={{ fontSize: \"0.78rem\", color: \"text.secondary\", mt: \"3px\" }}\r\n >\r\n {reportData.subtitle}\r\n </Typography>\r\n )}\r\n </Box>\r\n <IconButton\r\n size=\"small\"\r\n onClick={onClose}\r\n sx={{\r\n flexShrink: 0,\r\n width: 28,\r\n height: 28,\r\n borderRadius: \"6px\",\r\n backgroundColor: \"action.hover\",\r\n color: \"text.secondary\",\r\n \"&:hover\": {\r\n backgroundColor: \"action.selected\",\r\n color: \"text.primary\",\r\n },\r\n transition: \"all 0.15s ease\",\r\n }}\r\n >\r\n <CloseIcon sx={{ fontSize: 15 }} />\r\n </IconButton>\r\n </DialogTitle>\r\n\r\n {/* Header badges */}\r\n {reportData?.headerBadges && reportData.headerBadges.length > 0 && (\r\n <Box\r\n sx={{\r\n px: { xs: 2, md: 2.5 },\r\n py: \"8px\",\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n gap: \"8px\",\r\n flexWrap: \"wrap\",\r\n borderBottom: \"1px solid\",\r\n borderColor: \"divider\",\r\n backgroundColor: \"#f5f7f8\",\r\n flexShrink: 0,\r\n }}\r\n >\r\n {reportData.headerBadges.map((badge, i) =>\r\n badge.asBadge ? (\r\n <StatusBadge key={i} label={badge.value} />\r\n ) : (\r\n <Box\r\n key={i}\r\n sx={{\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n gap: \"5px\",\r\n px: \"9px\",\r\n height: 26,\r\n border: \"1px solid\",\r\n borderColor: \"divider\",\r\n borderRadius: \"5px\",\r\n backgroundColor: \"background.paper\",\r\n }}\r\n >\r\n <Box\r\n sx={{\r\n width: 5,\r\n height: 5,\r\n borderRadius: \"50%\",\r\n backgroundColor: primary,\r\n flexShrink: 0,\r\n }}\r\n />\r\n <Typography\r\n sx={{\r\n fontSize: \"0.72rem\",\r\n color: \"text.secondary\",\r\n whiteSpace: \"nowrap\",\r\n }}\r\n >\r\n <Box\r\n component=\"span\"\r\n sx={{ fontWeight: 600, color: \"text.primary\", mr: \"3px\" }}\r\n >\r\n {badge.label}:\r\n </Box>\r\n {badge.value}\r\n </Typography>\r\n </Box>\r\n ),\r\n )}\r\n </Box>\r\n )}\r\n\r\n {/* Tabs */}\r\n <Box\r\n sx={{\r\n borderBottom: \"1px solid\",\r\n borderColor: \"divider\",\r\n backgroundColor: \"background.paper\",\r\n flexShrink: 0,\r\n }}\r\n >\r\n <Tabs\r\n value={activeTab}\r\n onChange={(_, v) => setActiveTab(v)}\r\n variant=\"scrollable\"\r\n scrollButtons=\"auto\"\r\n sx={{\r\n minHeight: 40,\r\n px: { xs: 1, md: 2 },\r\n \"& .MuiTab-root\": {\r\n fontSize: \"0.78rem\",\r\n fontWeight: 600,\r\n minHeight: 40,\r\n textTransform: \"none\",\r\n color: \"text.secondary\",\r\n py: 0,\r\n px: 1.5,\r\n \"&.Mui-selected\": { color: primary },\r\n },\r\n \"& .MuiTabs-indicator\": { backgroundColor: primary, height: 2 },\r\n }}\r\n >\r\n {reportData?.sections?.map((section) => (\r\n <Tab key={section.id} label={section.label} disableRipple />\r\n ))}\r\n </Tabs>\r\n </Box>\r\n\r\n <DialogContent\r\n sx={{ flex: 1, overflow: \"auto\", px: { xs: 2, md: 2.5 }, py: 2 }}\r\n >\r\n {auditLoading && (\r\n <Box\r\n sx={{\r\n display: \"flex\",\r\n justifyContent: \"center\",\r\n alignItems: \"center\",\r\n py: 6,\r\n }}\r\n >\r\n <CircularProgress size={32} />\r\n </Box>\r\n )}\r\n {!auditLoading && auditError && (\r\n <Alert severity=\"warning\" sx={{ mb: 2, fontSize: \"0.78rem\" }}>\r\n {auditError}\r\n </Alert>\r\n )}\r\n\r\n {!auditLoading && reportData?.sections?.[activeTab] && (\r\n <SectionPanel\r\n section={reportData.sections[activeTab]}\r\n primary={primary}\r\n />\r\n )}\r\n </DialogContent>\r\n </Dialog>\r\n </>\r\n );\r\n}\r\n","import { useCallback, useState } from \"react\";\r\nimport axiosInstance from \"../../services/axios\";\r\nimport { END_POINT } from \"../../services/endPoint\";\r\nimport type {\r\n\tCdrAgentFilterOption,\r\n\tCdrQueueFilterOption,\r\n\tCdrRecordsPage,\r\n\tCdrReportParams,\r\n\tCdrReportResponse,\r\n} from \"./types\";\r\n\r\n// ─── Build query string for CDR endpoints ────────────────────────────────────\r\n\r\nfunction buildCdrQuery(params: CdrReportParams): string {\r\n\tconst qs = new URLSearchParams();\r\n\tif (params.start_date) qs.append(\"start_date\", params.start_date);\r\n\tif (params.end_date) qs.append(\"end_date\", params.end_date);\r\n\tif (params.agent_id) {\r\n\t\tfor (const id of params.agent_id) qs.append(\"agent_id\", String(id));\r\n\t}\r\n\tif (params.queue_id) {\r\n\t\tfor (const id of params.queue_id) qs.append(\"queue_id\", String(id));\r\n\t}\r\n\tif (params.call_type) qs.append(\"call_type\", params.call_type);\r\n\tif (params.status) qs.append(\"status\", params.status);\r\n\tif (params.search) qs.append(\"search\", params.search);\r\n\tif (params.page) qs.append(\"page\", String(params.page));\r\n\tif (params.pageSize) qs.append(\"pageSize\", String(params.pageSize));\r\n\tconst str = qs.toString();\r\n\treturn str ? `?${str}` : \"\";\r\n}\r\n\r\n// ─── CDR records hook ────────────────────────────────────────────────────────\r\n\r\nexport function useCdrReport() {\r\n\tconst [records, setRecords] = useState<CdrRecordsPage[\"data\"]>([]);\r\n\tconst [totalRecords, setTotalRecords] = useState(0);\r\n\tconst [loading, setLoading] = useState(false);\r\n\tconst [error, setError] = useState(\"\");\r\n\r\n\tconst fetchRecords = useCallback(async (params: CdrReportParams): Promise<void> => {\r\n\t\tsetLoading(true);\r\n\t\tsetError(\"\");\r\n\t\ttry {\r\n\t\t\tconst qs = buildCdrQuery(params);\r\n\t\t\tconst res = await axiosInstance.get<CdrRecordsPage>(`${END_POINT.CDR_REPORT_RECORDS}${qs}`);\r\n\t\t\tsetRecords(res.data?.data ?? []);\r\n\t\t\tsetTotalRecords(res.data?.total ?? 0);\r\n\t\t} catch (err: any) {\r\n\t\t\tsetError(\r\n\t\t\t\terr?.response?.data?.message\r\n\t\t\t\t?? err?.response?.data?.detail\r\n\t\t\t\t?? err?.message\r\n\t\t\t\t?? \"Failed to fetch CDR report\"\r\n\t\t\t);\r\n\t\t\tsetRecords([]);\r\n\t\t\tsetTotalRecords(0);\r\n\t\t} finally {\r\n\t\t\tsetLoading(false);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst exportExcel = useCallback(async (params: CdrReportParams): Promise<void> => {\r\n\t\tconst qs = buildCdrQuery(params);\r\n\t\tconst res = await axiosInstance.get(`${END_POINT.CDR_REPORT_EXPORT_EXCEL}${qs}`, {\r\n\t\t\tresponseType: \"blob\",\r\n\t\t});\r\n\t\tconst blob = res.data as Blob;\r\n\t\tconst url = window.URL.createObjectURL(blob);\r\n\t\tconst a = document.createElement(\"a\");\r\n\t\ta.href = url;\r\n\t\ta.download = `cdr-report-${params.start_date ?? \"export\"}.xlsx`;\r\n\t\tdocument.body.appendChild(a);\r\n\t\ta.click();\r\n\t\ta.remove();\r\n\t\twindow.URL.revokeObjectURL(url);\r\n\t}, []);\r\n\r\n\tconst fetchRecording = useCallback(async (callUuid: string): Promise<Blob> => {\r\n\t\tconst res = await axiosInstance.get(END_POINT.RECORDING_BY_CALL(callUuid), {\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\trecords,\r\n\t\ttotalRecords,\r\n\t\tloading,\r\n\t\terror,\r\n\t\tsetError,\r\n\t\tfetchRecords,\r\n\t\texportExcel,\r\n\t\tfetchRecording,\r\n\t};\r\n}\r\n\r\n// ─── CDR filter options hook (agents + queues) ───────────────────────────────\r\n//\r\n// The main app's CdrReport uses the general user-list and master-queue endpoints\r\n// (NOT a CDR-specific filter endpoint). We mirror that here.\r\n// - agents: GET /api/v1/users/?role=AGENT → filter to role === \"AGENT\"\r\n// - queues: GET /api/v1/master/queue\r\n\r\ninterface UserListItem {\r\n\tid: number;\r\n\tuserId: string;\r\n\tfirstName?: string;\r\n\tlastName?: string;\r\n\trole?: string | { name?: string } | null;\r\n}\r\n\r\ninterface QueueListItem {\r\n\tid: number;\r\n\tname: string;\r\n}\r\n\r\nexport function useCdrFilters() {\r\n\tconst [agents, setAgents] = useState<CdrAgentFilterOption[]>([]);\r\n\tconst [queues, setQueues] = useState<CdrQueueFilterOption[]>([]);\r\n\tconst [loading, setLoading] = useState(false);\r\n\r\n\tconst fetchAgents = useCallback(async (): Promise<void> => {\r\n\t\ttry {\r\n\t\t\tconst res = await axiosInstance.get<UserListItem[] | { data: UserListItem[] }>(\r\n\t\t\t\tEND_POINT.USERS_LIST,\r\n\t\t\t\t{ params: { role: \"AGENT\" } },\r\n\t\t\t);\r\n\t\t\tconst raw = Array.isArray(res.data)\r\n\t\t\t\t? res.data\r\n\t\t\t\t: Array.isArray((res.data as any)?.data)\r\n\t\t\t\t\t? (res.data as any).data\r\n\t\t\t\t\t: [];\r\n\t\t\tconst mapped: CdrAgentFilterOption[] = (raw as UserListItem[])\r\n\t\t\t\t.filter((u) => {\r\n\t\t\t\t\tconst roleName = typeof u.role === \"object\" && u.role !== null ? u.role.name : u.role;\r\n\t\t\t\t\treturn roleName === \"AGENT\";\r\n\t\t\t\t})\r\n\t\t\t\t.map((u) => ({\r\n\t\t\t\t\tid: u.id,\r\n\t\t\t\t\tuserId: u.userId,\r\n\t\t\t\t\tfullName: [u.firstName, u.lastName].filter(Boolean).join(\" \") || u.userId,\r\n\t\t\t\t}));\r\n\t\t\tsetAgents(mapped);\r\n\t\t} catch {\r\n\t\t\tsetAgents([]);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst fetchQueues = useCallback(async (): Promise<void> => {\r\n\t\ttry {\r\n\t\t\tconst res = await axiosInstance.get<QueueListItem[] | { data: QueueListItem[] }>(\r\n\t\t\t\tEND_POINT.MASTER_QUEUES,\r\n\t\t\t);\r\n\t\t\tconst raw = Array.isArray(res.data)\r\n\t\t\t\t? res.data\r\n\t\t\t\t: Array.isArray((res.data as any)?.data)\r\n\t\t\t\t\t? (res.data as any).data\r\n\t\t\t\t\t: [];\r\n\t\t\tsetQueues((raw as QueueListItem[]).map((q) => ({ id: q.id, name: q.name })));\r\n\t\t} catch {\r\n\t\t\tsetQueues([]);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst fetchAll = useCallback(async (): Promise<void> => {\r\n\t\tsetLoading(true);\r\n\t\ttry {\r\n\t\t\tawait Promise.all([fetchAgents(), fetchQueues()]);\r\n\t\t} finally {\r\n\t\t\tsetLoading(false);\r\n\t\t}\r\n\t}, [fetchAgents, fetchQueues]);\r\n\r\n\treturn { agents, queues, loading, fetchAgents, fetchQueues, fetchAll };\r\n}\r\n\r\nexport interface Queue {\r\n\tid: number;\r\n\tname: string;\r\n\tdescription: string;\r\n\tisActive: boolean;\r\n}\r\n\r\nexport async function getQueues(): Promise<Queue[]> {\r\n\tconst res = await axiosInstance.get<QueueListItem[] | { data: QueueListItem[] }>(END_POINT.MASTER_QUEUES);\r\n\tconst raw = Array.isArray(res.data)\r\n\t\t? res.data\r\n\t\t: Array.isArray((res.data as any)?.data)\r\n\t\t\t? (res.data as any).data\r\n\t\t\t: [];\r\n\treturn (raw as QueueListItem[]).map((q) => ({ id: q.id, name: q.name, description: \"\", isActive: true }));\r\n}\r\n\r\nexport async function getCdrReportRecords(params: CdrReportParams): Promise<CdrRecordsPage> {\r\n\tconst qs = buildCdrQuery(params);\r\n\tconst res = await axiosInstance.get<CdrRecordsPage>(`${END_POINT.CDR_REPORT_RECORDS}${qs}`);\r\n\treturn res.data;\r\n}\r\n\r\n/**\r\n * Combined CDR report — stats + the current page of records in one call.\r\n * This is the documented endpoint that honours page/pageSize/search.\r\n */\r\nexport async function getCdrReport(params: CdrReportParams): Promise<CdrReportResponse> {\r\n\tconst qs = buildCdrQuery(params);\r\n\tconst res = await axiosInstance.get<CdrReportResponse>(`${END_POINT.CDR_REPORT}${qs}`);\r\n\treturn res.data;\r\n}\r\n\r\nexport async function exportCdrReportToExcel(params: CdrReportParams): Promise<void> {\r\n\tconst qs = buildCdrQuery(params);\r\n\tconst res = await axiosInstance.get(`${END_POINT.CDR_REPORT_EXPORT_EXCEL}${qs}`, { responseType: \"blob\" });\r\n\tconst url = window.URL.createObjectURL(new Blob([res.data]));\r\n\tconst a = document.createElement(\"a\");\r\n\ta.href = url;\r\n\ta.download = `cdr-report-${params.start_date ?? \"export\"}.xlsx`;\r\n\tdocument.body.appendChild(a);\r\n\ta.click();\r\n\ta.remove();\r\n\twindow.URL.revokeObjectURL(url);\r\n}\r\n\r\nexport async function getRecordingByCall(callUuid: string): Promise<Blob> {\r\n\tconst res = await axiosInstance.get(END_POINT.RECORDING_BY_CALL(callUuid), { responseType: \"blob\" });\r\n\treturn res.data;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE,eAAAA;AAAA,EACA,aAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,OACK;AACP;AAAA,EACE,SA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M;AAAA,QACN,SAAS,MAAM;AACb,6BAAmB,KAAK;AACxB,8BAAoB,IAAI;AAAA,QAC1B;AAAA,QACA,SAAS,8CAAoB;AAAA;AAAA,IAC/B;AAAA,KACF;AAEJ;AAEA,IAAM,YAAsB,MAC1B,gBAAAA,KAAC,eACC,0BAAAA,KAAC,oBAAiB,GACpB;AAGF,IAAO,oBAAQ;","names":["useCallback","useEffect","useState","Alert","Box","Table","TableBody","TableCell","TableContainer","TableHead","TableRow","CircularProgress","IconButton","_a","_b","useState","jsx","jsxs","useState","Box","IconButton","CircularProgress","useEffect","useCallback","Alert","TableContainer","Table","TableHead","TableRow","TableCell","TableBody"]}
@@ -8,9 +8,9 @@ import { useState, useEffect } from "react";
8
8
  var useGetCallerData = () => {
9
9
  var _a, _b;
10
10
  const sdkState = sdkStateManager.getState();
11
- const { process_id, process_name, status, phone_number, agent_id, call_id, call_details } = sdkState.callData;
11
+ const { process_id, process_name, status, phone_number, agent_id, call_id, call_details, socket_info } = sdkState.callData;
12
12
  const initialLeadData = sdkStateManager.getTransferLeadData();
13
- const initialCallData = __spreadValues({
13
+ const initialCallData = __spreadValues(__spreadValues({
14
14
  phone_number,
15
15
  status,
16
16
  callReferenceId: call_id,
@@ -19,15 +19,15 @@ var useGetCallerData = () => {
19
19
  process_name,
20
20
  call_details,
21
21
  auto_wrapup_time: (_b = (_a = sdkState.backendCallControls) == null ? void 0 : _a.auto_wrapup_time) != null ? _b : null
22
- }, initialLeadData !== void 0 && { lead_data: initialLeadData });
22
+ }, initialLeadData !== void 0 && { lead_data: initialLeadData }), socket_info !== void 0 && { socket_info });
23
23
  const [callData, setCallData] = useState(initialCallData);
24
24
  useEffect(() => {
25
25
  const unsubscribe = sdkStateManager.subscribe(() => {
26
26
  var _a2, _b2;
27
27
  const state = sdkStateManager.getState();
28
- const { process_id: process_id2, process_name: process_name2, status: status2, phone_number: phone_number2, agent_id: agent_id2, call_id: call_id2, call_details: call_details2, auto_wrapup_time } = state.callData;
28
+ const { process_id: process_id2, process_name: process_name2, status: status2, phone_number: phone_number2, agent_id: agent_id2, call_id: call_id2, call_details: call_details2, auto_wrapup_time, socket_info: socket_info2 } = state.callData;
29
29
  const lead_data = sdkStateManager.getTransferLeadData();
30
- const currentCallData = __spreadValues({
30
+ const currentCallData = __spreadValues(__spreadValues({
31
31
  phone_number: phone_number2,
32
32
  status: status2,
33
33
  callReferenceId: call_id2,
@@ -36,7 +36,7 @@ var useGetCallerData = () => {
36
36
  process_name: process_name2,
37
37
  call_details: call_details2,
38
38
  auto_wrapup_time: (_b2 = auto_wrapup_time != null ? auto_wrapup_time : (_a2 = state.backendCallControls) == null ? void 0 : _a2.auto_wrapup_time) != null ? _b2 : null
39
- }, lead_data !== void 0 && { lead_data });
39
+ }, lead_data !== void 0 && { lead_data }), socket_info2 !== void 0 && { socket_info: socket_info2 });
40
40
  setCallData(currentCallData);
41
41
  });
42
42
  return unsubscribe;
@@ -47,4 +47,4 @@ var useGetCallerData = () => {
47
47
  export {
48
48
  useGetCallerData
49
49
  };
50
- //# sourceMappingURL=chunk-BI4BLVVA.mjs.map
50
+ //# sourceMappingURL=chunk-IY5NGMWS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../call-control-sdk/lib/hooks/useGetCallerData.ts"],"sourcesContent":["import { useState, useEffect } from \"react\";\r\nimport { sdkStateManager } from \"./sdk-state\";\r\nimport type { CallData } from \"../../types\";\r\n\r\nexport const useGetCallerData = (): CallData => {\r\n\tconst sdkState = sdkStateManager.getState();\r\n\tconst { process_id, process_name, status, phone_number, agent_id, call_id, call_details, socket_info } =\r\n\t\tsdkState.callData;\r\n\tconst initialLeadData = sdkStateManager.getTransferLeadData();\r\n\tconst initialCallData = {\r\n\t\tphone_number,\r\n\t\tstatus,\r\n\t\tcallReferenceId: call_id,\r\n\t\tagent_id,\r\n\t\tprocess_id,\r\n\t\tprocess_name,\r\n\t\tcall_details,\r\n\t\tauto_wrapup_time: sdkState.backendCallControls?.auto_wrapup_time ?? null,\r\n\t\t...(initialLeadData !== undefined && { lead_data: initialLeadData }),\r\n\t\t...(socket_info !== undefined && { socket_info }),\r\n\t};\r\n\tconst [callData, setCallData] = useState<CallData>(initialCallData);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst unsubscribe = sdkStateManager.subscribe(() => {\r\n\t\t\tconst state = sdkStateManager.getState();\r\n\t\t\tconst { process_id, process_name, status, phone_number, agent_id, call_id, call_details, auto_wrapup_time, socket_info } =\r\n\t\t\t\tstate.callData;\r\n\t\t\tconst lead_data = sdkStateManager.getTransferLeadData();\r\n\t\t\tconst currentCallData = {\r\n\t\t\t\tphone_number,\r\n\t\t\t\tstatus,\r\n\t\t\t\tcallReferenceId: call_id,\r\n\t\t\t\tagent_id,\r\n\t\t\t\tprocess_id,\r\n\t\t\t\tprocess_name,\r\n\t\t\t\tcall_details,\r\n\t\t\t\tauto_wrapup_time: auto_wrapup_time ?? state.backendCallControls?.auto_wrapup_time ?? null,\r\n\t\t\t\t...(lead_data !== undefined && { lead_data }),\r\n\t\t\t\t...(socket_info !== undefined && { socket_info }),\r\n\t\t\t};\r\n\t\t\tsetCallData(currentCallData);\r\n\t\t});\r\n\r\n\t\treturn unsubscribe;\r\n\t}, []);\r\n\r\n\treturn callData;\r\n};\r\n"],"mappings":";;;;;;AAAA,SAAS,UAAU,iBAAiB;AAI7B,IAAM,mBAAmB,MAAgB;AAJhD;AAKC,QAAM,WAAW,gBAAgB,SAAS;AAC1C,QAAM,EAAE,YAAY,cAAc,QAAQ,cAAc,UAAU,SAAS,cAAc,YAAY,IACpG,SAAS;AACV,QAAM,kBAAkB,gBAAgB,oBAAoB;AAC5D,QAAM,kBAAkB;AAAA,IACvB;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAkB,oBAAS,wBAAT,mBAA8B,qBAA9B,YAAkD;AAAA,KAChE,oBAAoB,UAAa,EAAE,WAAW,gBAAgB,IAC9D,gBAAgB,UAAa,EAAE,YAAY;AAEhD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAmB,eAAe;AAElE,YAAU,MAAM;AACf,UAAM,cAAc,gBAAgB,UAAU,MAAM;AAxBtD,UAAAA,KAAAC;AAyBG,YAAM,QAAQ,gBAAgB,SAAS;AACvC,YAAM,EAAE,YAAAC,aAAY,cAAAC,eAAc,QAAAC,SAAQ,cAAAC,eAAc,UAAAC,WAAU,SAAAC,UAAS,cAAAC,eAAc,kBAAkB,aAAAC,aAAY,IACtH,MAAM;AACP,YAAM,YAAY,gBAAgB,oBAAoB;AACtD,YAAM,kBAAkB;AAAA,QACvB,cAAAJ;AAAA,QACA,QAAAD;AAAA,QACA,iBAAiBG;AAAA,QACjB,UAAAD;AAAA,QACA,YAAAJ;AAAA,QACA,cAAAC;AAAA,QACA,cAAAK;AAAA,QACA,mBAAkBP,MAAA,+CAAoBD,MAAA,MAAM,wBAAN,gBAAAA,IAA2B,qBAA/C,OAAAC,MAAmE;AAAA,SACjF,cAAc,UAAa,EAAE,UAAU,IACvCQ,iBAAgB,UAAa,EAAE,aAAAA,aAAY;AAEhD,kBAAY,eAAe;AAAA,IAC5B,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,CAAC;AAEL,SAAO;AACR;","names":["_a","_b","process_id","process_name","status","phone_number","agent_id","call_id","call_details","socket_info"]}
package/dist/index.d.mts CHANGED
@@ -684,8 +684,12 @@ interface CallData {
684
684
  call_uuid?: string;
685
685
  [key: string]: any;
686
686
  };
687
- /** Raw socket/state call data full unprocessed snapshot from the SDK state manager */
688
- socket_info?: any;
687
+ /** Lead data set by the host app; attached when available */
688
+ lead_data?: any;
689
+ /** Raw socket payload from the most recent WebSocket message */
690
+ socket_info?: Record<string, any>;
691
+ /** Call Sage AI analysis data from the most recent WebSocket message */
692
+ call_sage?: Record<string, any> | null;
689
693
  break_details?: {
690
694
  type: string;
691
695
  value: string;
@@ -1568,6 +1572,31 @@ declare const useGetAuthorizationToken: () => string | undefined;
1568
1572
  */
1569
1573
  declare const useGetCallerData: () => CallData;
1570
1574
 
1575
+ /**
1576
+ * 📡 Socket Data Interface
1577
+ * Raw WebSocket payload fields exposed by useGetSocketData.
1578
+ */
1579
+ interface SocketData {
1580
+ socket_info?: Record<string, any>;
1581
+ call_sage?: Record<string, any> | null;
1582
+ }
1583
+
1584
+ /**
1585
+ * 📡 Socket Data Hook
1586
+ * @function useGetSocketData
1587
+ * @description Reactive hook that re-renders only when socket_info or call_sage
1588
+ * actually change (deep equality). Use this instead of useGetCallerData when you
1589
+ * only care about live socket events and Call Sage AI data.
1590
+ *
1591
+ * @returns {SocketData} Latest { socket_info, call_sage } from the WebSocket stream
1592
+ *
1593
+ * @example
1594
+ * ```typescript
1595
+ * const { socket_info, call_sage } = useGetSocketData();
1596
+ * ```
1597
+ */
1598
+ declare const useGetSocketData: () => SocketData;
1599
+
1571
1600
  /**
1572
1601
  * 🗃️ SDK State Interface
1573
1602
  *
@@ -2457,4 +2486,4 @@ interface SDKAccessDeniedProps {
2457
2486
 
2458
2487
  declare const SDKAccessDenied: React.FC<SDKAccessDeniedProps>;
2459
2488
 
2460
- export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type ChangeModePayload, type CleanupOperation, type ConferenceCallPayload, type ConferenceLine, type ControlsFromPermissions, type DispositionType, type EndCallData, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LiveStatusPageProps, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, SDKAccessDenied, type SDKAccessDeniedProps, type SDKBit, type SDKConfig, type SDKEntitlement, type SDKEntitlements, type SDKInitResult, SDKPages, type SDKPermissionContextValue, SDKPermissionGuard, type SDKPermissionGuardProps, type SDKPermissionState, type SDKPermissionsHook, type SDKState, SDKStateManager, SDK_MENU_CODES, SDK_PERMISSIONS, SDK_WILDCARD, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StartMonitoringPayload, type StopMonitoringPayload, type StorageType, type SupervisorMonitorMode, type URLConfig, type UseCallMonitoringReturn, type UseClickToCallReturn, type UseClickToConferenceReturn, type UseEndCallReturn, type UseLogoutReturn, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, setTransferLeadData, startMonitoring, stopMonitoring, useCallMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout, useSDKPermissions, useSDKState };
2489
+ export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type ChangeModePayload, type CleanupOperation, type ConferenceCallPayload, type ConferenceLine, type ControlsFromPermissions, type DispositionType, type EndCallData, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LiveStatusPageProps, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, SDKAccessDenied, type SDKAccessDeniedProps, type SDKBit, type SDKConfig, type SDKEntitlement, type SDKEntitlements, type SDKInitResult, SDKPages, type SDKPermissionContextValue, SDKPermissionGuard, type SDKPermissionGuardProps, type SDKPermissionState, type SDKPermissionsHook, type SDKState, SDKStateManager, SDK_MENU_CODES, SDK_PERMISSIONS, SDK_WILDCARD, type SocketData, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StartMonitoringPayload, type StopMonitoringPayload, type StorageType, type SupervisorMonitorMode, type URLConfig, type UseCallMonitoringReturn, type UseClickToCallReturn, type UseClickToConferenceReturn, type UseEndCallReturn, type UseLogoutReturn, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, setTransferLeadData, startMonitoring, stopMonitoring, useCallMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useGetSocketData, useLogout, useSDKPermissions, useSDKState };
package/dist/index.d.ts CHANGED
@@ -684,8 +684,12 @@ interface CallData {
684
684
  call_uuid?: string;
685
685
  [key: string]: any;
686
686
  };
687
- /** Raw socket/state call data full unprocessed snapshot from the SDK state manager */
688
- socket_info?: any;
687
+ /** Lead data set by the host app; attached when available */
688
+ lead_data?: any;
689
+ /** Raw socket payload from the most recent WebSocket message */
690
+ socket_info?: Record<string, any>;
691
+ /** Call Sage AI analysis data from the most recent WebSocket message */
692
+ call_sage?: Record<string, any> | null;
689
693
  break_details?: {
690
694
  type: string;
691
695
  value: string;
@@ -1568,6 +1572,31 @@ declare const useGetAuthorizationToken: () => string | undefined;
1568
1572
  */
1569
1573
  declare const useGetCallerData: () => CallData;
1570
1574
 
1575
+ /**
1576
+ * 📡 Socket Data Interface
1577
+ * Raw WebSocket payload fields exposed by useGetSocketData.
1578
+ */
1579
+ interface SocketData {
1580
+ socket_info?: Record<string, any>;
1581
+ call_sage?: Record<string, any> | null;
1582
+ }
1583
+
1584
+ /**
1585
+ * 📡 Socket Data Hook
1586
+ * @function useGetSocketData
1587
+ * @description Reactive hook that re-renders only when socket_info or call_sage
1588
+ * actually change (deep equality). Use this instead of useGetCallerData when you
1589
+ * only care about live socket events and Call Sage AI data.
1590
+ *
1591
+ * @returns {SocketData} Latest { socket_info, call_sage } from the WebSocket stream
1592
+ *
1593
+ * @example
1594
+ * ```typescript
1595
+ * const { socket_info, call_sage } = useGetSocketData();
1596
+ * ```
1597
+ */
1598
+ declare const useGetSocketData: () => SocketData;
1599
+
1571
1600
  /**
1572
1601
  * 🗃️ SDK State Interface
1573
1602
  *
@@ -2457,5 +2486,5 @@ interface SDKAccessDeniedProps {
2457
2486
 
2458
2487
  declare const SDKAccessDenied: React.FC<SDKAccessDeniedProps>;
2459
2488
 
2460
- export type { APIResponse, AgentStatus, CallControlPanelProps, CallData, CallInitiationFunction, CallTerminationFunction, ChangeModePayload, CleanupOperation, ConferenceCallPayload, ConferenceLine, ControlsFromPermissions, DispositionType, EndCallData, EndCallPayLoadData, EndCallPayload, ErrorResponse, FollowUpType, HookStateTypes, InitSDKParams, LiveStatusPageProps, LogoutFunction, LogoutHookStateTypes, LogoutPayload, ProcessData, SDKAccessDeniedProps, SDKBit, SDKConfig, SDKEntitlement, SDKEntitlements, SDKInitResult, SDKPermissionContextValue, SDKPermissionGuardProps, SDKPermissionState, SDKPermissionsHook, SDKState, StartCallPayload, StartCalltData, StartCalltHookStateTypes, StartMonitoringPayload, StopMonitoringPayload, StorageType, SupervisorMonitorMode, URLConfig, UseCallMonitoringReturn, UseClickToCallReturn, UseClickToConferenceReturn, UseEndCallReturn, UseLogoutReturn }
2461
- export { CallControlPanel, SDKAccessDenied, SDKPages, SDKPermissionGuard, SDKStateManager, SDK_MENU_CODES, SDK_PERMISSIONS, SDK_WILDCARD, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, setTransferLeadData, startMonitoring, stopMonitoring, useCallMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout, useSDKPermissions, useSDKState };
2489
+ export type { APIResponse, AgentStatus, CallControlPanelProps, CallData, CallInitiationFunction, CallTerminationFunction, ChangeModePayload, CleanupOperation, ConferenceCallPayload, ConferenceLine, ControlsFromPermissions, DispositionType, EndCallData, EndCallPayLoadData, EndCallPayload, ErrorResponse, FollowUpType, HookStateTypes, InitSDKParams, LiveStatusPageProps, LogoutFunction, LogoutHookStateTypes, LogoutPayload, ProcessData, SDKAccessDeniedProps, SDKBit, SDKConfig, SDKEntitlement, SDKEntitlements, SDKInitResult, SDKPermissionContextValue, SDKPermissionGuardProps, SDKPermissionState, SDKPermissionsHook, SDKState, SocketData, StartCallPayload, StartCalltData, StartCalltHookStateTypes, StartMonitoringPayload, StopMonitoringPayload, StorageType, SupervisorMonitorMode, URLConfig, UseCallMonitoringReturn, UseClickToCallReturn, UseClickToConferenceReturn, UseEndCallReturn, UseLogoutReturn }
2490
+ export { CallControlPanel, SDKAccessDenied, SDKPages, SDKPermissionGuard, SDKStateManager, SDK_MENU_CODES, SDK_PERMISSIONS, SDK_WILDCARD, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, setTransferLeadData, startMonitoring, stopMonitoring, useCallMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useGetSocketData, useLogout, useSDKPermissions, useSDKState };