ahs-cti 0.0.2-beta.8 → 0.0.2

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.
Files changed (58) hide show
  1. package/README.md +425 -294
  2. package/dist/agentDetailReport-XSBMOUMW.mjs +12 -0
  3. package/dist/agentDetailReport-XSBMOUMW.mjs.map +1 -0
  4. package/dist/agentPerformanceReport-UT6QZWYD.mjs +533 -0
  5. package/dist/agentPerformanceReport-UT6QZWYD.mjs.map +1 -0
  6. package/dist/auditReport-R67BYA4Z.mjs +15 -0
  7. package/dist/auditReport-R67BYA4Z.mjs.map +1 -0
  8. package/dist/callHistory-PHGY224F.mjs +805 -0
  9. package/dist/callHistory-PHGY224F.mjs.map +1 -0
  10. package/dist/campaigns-JSMYHHDF.mjs +3049 -0
  11. package/dist/campaigns-JSMYHHDF.mjs.map +1 -0
  12. package/dist/caroQualityAuditDashboard-7X44HRZL.mjs +66 -0
  13. package/dist/caroQualityAuditDashboard-7X44HRZL.mjs.map +1 -0
  14. package/dist/caroVoiceAI-OZAB7LK4.mjs +21 -0
  15. package/dist/caroVoiceAI-OZAB7LK4.mjs.map +1 -0
  16. package/dist/cdrReport-44LN5VUX.mjs +819 -0
  17. package/dist/cdrReport-44LN5VUX.mjs.map +1 -0
  18. package/dist/chunk-6ICPXSN6.mjs +61 -0
  19. package/dist/chunk-6ICPXSN6.mjs.map +1 -0
  20. package/dist/chunk-CXULBAK6.mjs +493 -0
  21. package/dist/chunk-CXULBAK6.mjs.map +1 -0
  22. package/dist/chunk-FVXHNBYV.mjs +82 -0
  23. package/dist/chunk-FVXHNBYV.mjs.map +1 -0
  24. package/dist/chunk-G6KDIN5W.mjs +749 -0
  25. package/dist/chunk-G6KDIN5W.mjs.map +1 -0
  26. package/dist/chunk-GGACEO3I.mjs +180 -0
  27. package/dist/chunk-GGACEO3I.mjs.map +1 -0
  28. package/dist/chunk-HBR2JS4C.mjs +95 -0
  29. package/dist/chunk-HBR2JS4C.mjs.map +1 -0
  30. package/dist/chunk-HRM6S6J2.mjs +61 -0
  31. package/dist/chunk-HRM6S6J2.mjs.map +1 -0
  32. package/dist/chunk-JOZ4YQMR.mjs +116 -0
  33. package/dist/chunk-JOZ4YQMR.mjs.map +1 -0
  34. package/dist/chunk-O2XGWZLT.mjs +1060 -0
  35. package/dist/chunk-O2XGWZLT.mjs.map +1 -0
  36. package/dist/chunk-RZZQ42MG.mjs +115 -0
  37. package/dist/chunk-RZZQ42MG.mjs.map +1 -0
  38. package/dist/chunk-UZF5Q3GR.mjs +678 -0
  39. package/dist/chunk-UZF5Q3GR.mjs.map +1 -0
  40. package/dist/chunk-VQCHBU2Q.mjs +27 -0
  41. package/dist/chunk-VQCHBU2Q.mjs.map +1 -0
  42. package/dist/chunk-WWWM33FY.mjs +57 -0
  43. package/dist/chunk-WWWM33FY.mjs.map +1 -0
  44. package/dist/index.d.mts +795 -112
  45. package/dist/index.d.ts +796 -112
  46. package/dist/index.js +13690 -2103
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +2335 -2250
  49. package/dist/index.mjs.map +1 -1
  50. package/dist/liveStatus-AHKS4XLW.mjs +1077 -0
  51. package/dist/liveStatus-AHKS4XLW.mjs.map +1 -0
  52. package/dist/loginReport-7GBMZP55.mjs +828 -0
  53. package/dist/loginReport-7GBMZP55.mjs.map +1 -0
  54. package/dist/managementDashboard-TYON77NW.mjs +529 -0
  55. package/dist/managementDashboard-TYON77NW.mjs.map +1 -0
  56. package/dist/qualityAuditDashboard-AGJH5VVN.mjs +66 -0
  57. package/dist/qualityAuditDashboard-AGJH5VVN.mjs.map +1 -0
  58. package/package.json +16 -6
@@ -0,0 +1,819 @@
1
+ import {
2
+ exportCdrReportToExcel,
3
+ getCdrReport,
4
+ getQueues,
5
+ getRecordingByCall
6
+ } from "./chunk-HRM6S6J2.mjs";
7
+ import {
8
+ AuditReportDialog
9
+ } from "./chunk-UZF5Q3GR.mjs";
10
+ import {
11
+ ReportFilterBar,
12
+ SearchBar,
13
+ headCellSx
14
+ } from "./chunk-CXULBAK6.mjs";
15
+ import {
16
+ SDKPermissionGuard
17
+ } from "./chunk-GGACEO3I.mjs";
18
+ import {
19
+ PageHeader
20
+ } from "./chunk-JOZ4YQMR.mjs";
21
+ import {
22
+ AppButton
23
+ } from "./chunk-HBR2JS4C.mjs";
24
+ import {
25
+ SDKProvider
26
+ } from "./chunk-6ICPXSN6.mjs";
27
+ import {
28
+ SDK_PERMISSIONS,
29
+ deepFindArray
30
+ } from "./chunk-O2XGWZLT.mjs";
31
+ import {
32
+ __spreadProps,
33
+ __spreadValues
34
+ } from "./chunk-VQCHBU2Q.mjs";
35
+
36
+ // call-control-sdk/lib/pages/cdrReport/index.tsx
37
+ import {
38
+ useCallback,
39
+ useEffect,
40
+ useMemo,
41
+ useRef,
42
+ useState
43
+ } from "react";
44
+ import {
45
+ Alert,
46
+ Box,
47
+ Chip,
48
+ Paper,
49
+ Stack,
50
+ Table,
51
+ TableBody,
52
+ TableCell,
53
+ TableContainer,
54
+ TableHead,
55
+ TableRow,
56
+ TablePagination,
57
+ TableSortLabel,
58
+ CircularProgress,
59
+ IconButton,
60
+ Tooltip,
61
+ Typography
62
+ } from "@mui/material";
63
+ import DownloadIcon from "@mui/icons-material/Download";
64
+ import RefreshIcon from "@mui/icons-material/Refresh";
65
+ import PlayArrowIcon from "@mui/icons-material/PlayArrow";
66
+ import FileDownloadIcon from "@mui/icons-material/FileDownload";
67
+ import AssignmentIcon from "@mui/icons-material/Assignment";
68
+ import dayjs from "dayjs";
69
+ import isoWeek from "dayjs/plugin/isoWeek";
70
+ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
71
+ import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
72
+ import { jsx, jsxs } from "react/jsx-runtime";
73
+ dayjs.extend(isoWeek);
74
+ var FONT = "'Inter', 'Segoe UI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif";
75
+ var COLORS = {
76
+ navy: "#0d2a56",
77
+ blue: "#1565c8",
78
+ green: "#0a9a62",
79
+ amber: "#c47c00",
80
+ red: "#cc2a2a",
81
+ purple: "#6b3fbf",
82
+ bg: "transparent",
83
+ surface: "transparent"
84
+ };
85
+ var DEFAULT_PAGE_SIZE = 15;
86
+ var comparator = (a, b, key) => {
87
+ const av = a[key];
88
+ const bv = b[key];
89
+ if (typeof av === "number" && typeof bv === "number") return av - bv;
90
+ if (typeof av === "boolean" && typeof bv === "boolean")
91
+ return (av ? 1 : 0) - (bv ? 1 : 0);
92
+ return String(av != null ? av : "").localeCompare(String(bv != null ? bv : ""));
93
+ };
94
+ function CallTypePill({ value }) {
95
+ const v = (value || "").toLowerCase();
96
+ let color = "#6b7b8d";
97
+ let bg = "transparent";
98
+ if (v.includes("inbound")) {
99
+ color = COLORS.green;
100
+ bg = "#e6f7ef";
101
+ } else if (v.includes("outbound")) {
102
+ color = COLORS.blue;
103
+ bg = "#e3eefa";
104
+ } else if (v.includes("internal")) {
105
+ color = COLORS.purple;
106
+ bg = "#f0e8ff";
107
+ }
108
+ return /* @__PURE__ */ jsx(
109
+ Chip,
110
+ {
111
+ label: value,
112
+ size: "small",
113
+ sx: {
114
+ fontFamily: FONT,
115
+ bgcolor: bg,
116
+ color,
117
+ fontWeight: 600,
118
+ fontSize: "0.65rem",
119
+ height: 20,
120
+ borderRadius: "6px"
121
+ }
122
+ }
123
+ );
124
+ }
125
+ function StatusPill({ value }) {
126
+ const v = (value || "").toLowerCase();
127
+ let color = "#6b7b8d";
128
+ let bg = "transparent";
129
+ if (v.includes("answered")) {
130
+ color = COLORS.green;
131
+ bg = "#e6f7ef";
132
+ } else if (v.includes("abandoned") || v.includes("missed")) {
133
+ color = COLORS.red;
134
+ bg = "#fce8e8";
135
+ }
136
+ return /* @__PURE__ */ jsx(
137
+ Chip,
138
+ {
139
+ label: value,
140
+ size: "small",
141
+ sx: {
142
+ fontFamily: FONT,
143
+ bgcolor: bg,
144
+ color,
145
+ fontWeight: 600,
146
+ fontSize: "0.65rem",
147
+ height: 20,
148
+ borderRadius: "6px"
149
+ }
150
+ }
151
+ );
152
+ }
153
+ var fmtRecordingDuration = (s) => {
154
+ if (!isFinite(s) || s < 0) return "";
155
+ const m = Math.floor(s / 60);
156
+ const sec = Math.floor(s % 60);
157
+ return `${m}:${sec.toString().padStart(2, "0")}`;
158
+ };
159
+ function RecordingCell({
160
+ callUuid,
161
+ recordingPath
162
+ }) {
163
+ const [audioUrl, setAudioUrl] = useState(null);
164
+ const [loading, setLoading] = useState(false);
165
+ const [error, setError] = useState(false);
166
+ const [durationSec, setDurationSec] = useState(null);
167
+ const [currentSec, setCurrentSec] = useState(0);
168
+ const unavailable = recordingPath === null;
169
+ const totalLabel = durationSec != null ? fmtRecordingDuration(durationSec) : "";
170
+ const handlePlay = async () => {
171
+ if (audioUrl) return;
172
+ try {
173
+ setLoading(true);
174
+ setError(false);
175
+ const blob = await getRecordingByCall(callUuid);
176
+ const url = URL.createObjectURL(blob);
177
+ setAudioUrl(url);
178
+ } catch (e) {
179
+ setError(true);
180
+ } finally {
181
+ setLoading(false);
182
+ }
183
+ };
184
+ const handleDownload = async () => {
185
+ try {
186
+ const blob = audioUrl ? await fetch(audioUrl).then((r) => r.blob()) : await getRecordingByCall(callUuid);
187
+ const url = URL.createObjectURL(blob);
188
+ const a = document.createElement("a");
189
+ a.href = url;
190
+ a.download = `recording_${callUuid}.wav`;
191
+ a.click();
192
+ URL.revokeObjectURL(url);
193
+ } catch (e) {
194
+ }
195
+ };
196
+ if (audioUrl) {
197
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
198
+ /* @__PURE__ */ jsx(
199
+ "audio",
200
+ {
201
+ controls: true,
202
+ autoPlay: true,
203
+ src: audioUrl,
204
+ onLoadedMetadata: (e) => setDurationSec(e.currentTarget.duration),
205
+ onTimeUpdate: (e) => setCurrentSec(e.currentTarget.currentTime),
206
+ onEnded: () => {
207
+ if (audioUrl.startsWith("blob:")) URL.revokeObjectURL(audioUrl);
208
+ setAudioUrl(null);
209
+ setCurrentSec(0);
210
+ },
211
+ style: { width: 180, height: 30 }
212
+ }
213
+ ),
214
+ totalLabel && /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 12, fontWeight: 600, color: COLORS.navy, whiteSpace: "nowrap" }, children: [
215
+ fmtRecordingDuration(currentSec),
216
+ " / ",
217
+ totalLabel
218
+ ] }),
219
+ /* @__PURE__ */ jsx(Tooltip, { title: "Download", children: /* @__PURE__ */ jsx(
220
+ IconButton,
221
+ {
222
+ size: "small",
223
+ onClick: handleDownload,
224
+ sx: { color: COLORS.blue, p: 0.4 },
225
+ children: /* @__PURE__ */ jsx(FileDownloadIcon, { sx: { fontSize: 16 } })
226
+ }
227
+ ) })
228
+ ] });
229
+ }
230
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.3 }, children: [
231
+ /* @__PURE__ */ jsx(Tooltip, { title: unavailable || error ? "Recording Unavailable" : "Play", children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
232
+ IconButton,
233
+ {
234
+ size: "small",
235
+ onClick: handlePlay,
236
+ disabled: loading || error || unavailable,
237
+ sx: { color: unavailable ? "#b0b8c8" : COLORS.green, p: 0.4 },
238
+ children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 14 }) : /* @__PURE__ */ jsx(PlayArrowIcon, { sx: { fontSize: 16 } })
239
+ }
240
+ ) }) }),
241
+ /* @__PURE__ */ jsx(
242
+ Tooltip,
243
+ {
244
+ title: unavailable || error ? "Recording Unavailable" : "Download",
245
+ children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
246
+ IconButton,
247
+ {
248
+ size: "small",
249
+ onClick: handleDownload,
250
+ disabled: loading || error || unavailable,
251
+ sx: { color: unavailable ? "#b0b8c8" : COLORS.blue, p: 0.4 },
252
+ children: /* @__PURE__ */ jsx(FileDownloadIcon, { sx: { fontSize: 16 } })
253
+ }
254
+ ) })
255
+ }
256
+ ),
257
+ totalLabel && /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 12, fontWeight: 600, color: COLORS.navy, whiteSpace: "nowrap", ml: 0.3 }, children: totalLabel })
258
+ ] });
259
+ }
260
+ function CdrReportContent() {
261
+ const [startDate, setStartDate] = useState(
262
+ dayjs().startOf("day")
263
+ );
264
+ const [endDate, setEndDate] = useState(dayjs());
265
+ const [activeQuickDate, setActiveQuickDate] = useState("today");
266
+ const [searchText, setSearchText] = useState("");
267
+ const [selectedAgents, setSelectedAgents] = useState([]);
268
+ const [isAllUsersSelected, setIsAllUsersSelected] = useState(false);
269
+ const [queues, setQueues] = useState([]);
270
+ const [selectedQueues, setSelectedQueues] = useState([]);
271
+ const [callType, setCallType] = useState("");
272
+ const [callStatus, setCallStatus] = useState("");
273
+ const [records, setRecords] = useState([]);
274
+ const [totalRecords, setTotalRecords] = useState(0);
275
+ const [loading, setLoading] = useState(false);
276
+ const [error, setError] = useState("");
277
+ const [page, setPage] = useState(0);
278
+ const [rowsPerPage, setRowsPerPage] = useState(DEFAULT_PAGE_SIZE);
279
+ const [sortKey, setSortKey] = useState("callStartTime");
280
+ const [sortDir, setSortDir] = useState("desc");
281
+ const [auditDialogOpen, setAuditDialogOpen] = useState(false);
282
+ const [selectedAuditRow, setSelectedAuditRow] = useState(null);
283
+ useEffect(() => {
284
+ getQueues().then((data) => setQueues(data || [])).catch(() => setError("Failed to load filter options"));
285
+ }, []);
286
+ const handleQuickRangeChange = (range) => {
287
+ setActiveQuickDate(range || null);
288
+ };
289
+ const [debouncedSearch, setDebouncedSearch] = useState("");
290
+ const debounceRef = useRef(void 0);
291
+ useEffect(() => {
292
+ debounceRef.current = setTimeout(
293
+ () => setDebouncedSearch(searchText.trim()),
294
+ 400
295
+ );
296
+ return () => clearTimeout(debounceRef.current);
297
+ }, [searchText]);
298
+ const fetchReport = useCallback(
299
+ async (pageNum) => {
300
+ var _a, _b, _c, _d, _e;
301
+ const sd = startDate != null ? startDate : dayjs();
302
+ const ed = endDate != null ? endDate : dayjs();
303
+ if (!sd || !ed) {
304
+ setError("Select a valid date range");
305
+ return;
306
+ }
307
+ const params = {
308
+ start_date: sd.format("YYYY-MM-DDTHH:mm:ss"),
309
+ end_date: ed.format("YYYY-MM-DDTHH:mm:ss"),
310
+ agent_id: !isAllUsersSelected && selectedAgents.length > 0 ? selectedAgents.map((a) => a.id) : void 0,
311
+ // All queues selected → send no queue_id (backend returns all).
312
+ queue_id: selectedQueues.length > 0 && selectedQueues.length < queues.length ? selectedQueues.map((q) => q.id) : void 0,
313
+ call_type: callType || void 0,
314
+ status: callStatus || void 0,
315
+ search: debouncedSearch || void 0,
316
+ page: pageNum + 1,
317
+ pageSize: rowsPerPage
318
+ };
319
+ try {
320
+ setError("");
321
+ setLoading(true);
322
+ const response = await getCdrReport(params);
323
+ setRecords(
324
+ deepFindArray(response, ["data", "records"])
325
+ );
326
+ setTotalRecords(
327
+ (_e = (_d = (_b = (_a = response == null ? void 0 : response.records) == null ? void 0 : _a.total) != null ? _b : response == null ? void 0 : response.total) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.total) != null ? _e : 0
328
+ );
329
+ } catch (err) {
330
+ setError((err == null ? void 0 : err.message) || "Failed to fetch CDR report");
331
+ setRecords([]);
332
+ } finally {
333
+ setLoading(false);
334
+ }
335
+ },
336
+ [
337
+ startDate,
338
+ endDate,
339
+ selectedAgents,
340
+ isAllUsersSelected,
341
+ selectedQueues,
342
+ callType,
343
+ callStatus,
344
+ debouncedSearch,
345
+ rowsPerPage
346
+ ]
347
+ );
348
+ useEffect(() => {
349
+ setPage(0);
350
+ fetchReport(0);
351
+ }, [fetchReport]);
352
+ const handleRefresh = () => {
353
+ if (activeQuickDate) {
354
+ const now = dayjs();
355
+ let sd = now.startOf("day");
356
+ const ed = now;
357
+ if (activeQuickDate === "week") sd = now.startOf("week").startOf("day");
358
+ else if (activeQuickDate === "month")
359
+ sd = now.startOf("month").startOf("day");
360
+ setStartDate(sd);
361
+ setEndDate(ed);
362
+ } else {
363
+ fetchReport(page);
364
+ }
365
+ };
366
+ const handlePageChange = useCallback(
367
+ (_event, newPage) => {
368
+ setPage(newPage);
369
+ fetchReport(newPage);
370
+ },
371
+ [fetchReport]
372
+ );
373
+ const handleSort = (key) => {
374
+ if (sortKey === key) {
375
+ setSortDir((d) => d === "asc" ? "desc" : "asc");
376
+ } else {
377
+ setSortKey(key);
378
+ setSortDir("asc");
379
+ }
380
+ };
381
+ const sortedRecords = useMemo(() => {
382
+ const rows = [...records];
383
+ rows.sort((a, b) => {
384
+ const cmp = comparator(a, b, sortKey);
385
+ return sortDir === "asc" ? cmp : -cmp;
386
+ });
387
+ return rows;
388
+ }, [records, sortKey, sortDir]);
389
+ const handleExportExcel = async () => {
390
+ const sd = startDate != null ? startDate : dayjs();
391
+ const ed = endDate != null ? endDate : dayjs();
392
+ const params = {
393
+ start_date: sd.format("YYYY-MM-DDTHH:mm:ss"),
394
+ end_date: ed.format("YYYY-MM-DDTHH:mm:ss"),
395
+ agent_id: !isAllUsersSelected && selectedAgents.length > 0 ? selectedAgents.map((a) => a.id) : void 0,
396
+ queue_id: selectedQueues.length > 0 && selectedQueues.length < queues.length ? selectedQueues.map((q) => q.id) : void 0,
397
+ call_type: callType || void 0,
398
+ status: callStatus || void 0,
399
+ search: debouncedSearch || void 0
400
+ };
401
+ try {
402
+ await exportCdrReportToExcel(params);
403
+ } catch (err) {
404
+ setError((err == null ? void 0 : err.message) || "Failed to export Excel");
405
+ }
406
+ };
407
+ return /* @__PURE__ */ jsxs(LocalizationProvider, { dateAdapter: AdapterDayjs, children: [
408
+ /* @__PURE__ */ jsxs(
409
+ Box,
410
+ {
411
+ sx: {
412
+ height: "100%",
413
+ display: "flex",
414
+ flexDirection: "column",
415
+ fontFamily: FONT
416
+ },
417
+ children: [
418
+ /* @__PURE__ */ jsx(
419
+ PageHeader,
420
+ {
421
+ title: "CDR Report",
422
+ actions: /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, children: [
423
+ /* @__PURE__ */ jsx(
424
+ SearchBar,
425
+ {
426
+ value: searchText,
427
+ onChange: setSearchText,
428
+ placeholder: "Search phone, agent...",
429
+ width: 250
430
+ }
431
+ ),
432
+ /* @__PURE__ */ jsx(
433
+ SDKPermissionGuard,
434
+ {
435
+ permissions: [
436
+ SDK_PERMISSIONS.REPORTS_CDR_EXPORT,
437
+ SDK_PERMISSIONS.REPORTS_CDR_MANAGE
438
+ ],
439
+ showFallback: false,
440
+ children: /* @__PURE__ */ jsx(
441
+ AppButton,
442
+ {
443
+ startIcon: /* @__PURE__ */ jsx(DownloadIcon, { sx: { fontSize: "0.95rem !important" } }),
444
+ disabled: !records.length,
445
+ onClick: handleExportExcel,
446
+ sx: { height: 36 },
447
+ children: "Export Excel"
448
+ }
449
+ )
450
+ }
451
+ )
452
+ ] })
453
+ }
454
+ ),
455
+ /* @__PURE__ */ jsxs(Box, { sx: { flex: 1, overflow: "auto", py: 0.8, px: 0 }, children: [
456
+ /* @__PURE__ */ jsxs(Box, { sx: { mb: 0.8 }, children: [
457
+ /* @__PURE__ */ jsx(
458
+ ReportFilterBar,
459
+ {
460
+ startDate,
461
+ endDate,
462
+ onStartChange: setStartDate,
463
+ onEndChange: setEndDate,
464
+ quickRange: activeQuickDate || "",
465
+ onQuickRangeChange: handleQuickRangeChange,
466
+ showAgentSelect: true,
467
+ selectedAgents,
468
+ onAgentsChange: setSelectedAgents,
469
+ setIsAllUsersSelected,
470
+ showQueueSelect: true,
471
+ queues,
472
+ selectedQueues,
473
+ onQueuesChange: setSelectedQueues,
474
+ showCallTypeSelect: true,
475
+ selectedCallType: callType,
476
+ onCallTypeChange: setCallType,
477
+ showStatusSelect: true,
478
+ selectedStatus: callStatus,
479
+ onStatusChange: setCallStatus,
480
+ extra: /* @__PURE__ */ jsx(
481
+ AppButton,
482
+ {
483
+ startIcon: /* @__PURE__ */ jsx(RefreshIcon, { sx: { fontSize: "0.9rem !important" } }),
484
+ disabled: loading,
485
+ onClick: handleRefresh,
486
+ sx: { height: 32 },
487
+ children: "Refresh"
488
+ }
489
+ )
490
+ }
491
+ ),
492
+ error && /* @__PURE__ */ jsx(
493
+ Alert,
494
+ {
495
+ severity: "error",
496
+ sx: { mt: 1, fontFamily: FONT, fontSize: "0.78rem" },
497
+ children: error
498
+ }
499
+ )
500
+ ] }),
501
+ loading && /* @__PURE__ */ jsx(Box, { sx: { textAlign: "center", py: 2.5 }, children: /* @__PURE__ */ jsx(CircularProgress, { sx: { color: COLORS.blue }, size: 28 }) }),
502
+ /* @__PURE__ */ jsxs(
503
+ Paper,
504
+ {
505
+ elevation: 0,
506
+ sx: {
507
+ borderRadius: "8px",
508
+ border: "1px solid #e0e7ef",
509
+ overflow: "hidden",
510
+ mb: 2
511
+ },
512
+ children: [
513
+ /* @__PURE__ */ jsx(TableContainer, { children: /* @__PURE__ */ jsxs(
514
+ Table,
515
+ {
516
+ size: "small",
517
+ sx: {
518
+ minWidth: 1400,
519
+ fontFamily: FONT,
520
+ "& .MuiTableCell-root": {
521
+ fontFamily: FONT,
522
+ fontSize: "0.75rem",
523
+ borderBottom: "1px solid #eef1f6",
524
+ py: 0.6,
525
+ px: 1
526
+ }
527
+ },
528
+ children: [
529
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
530
+ /* @__PURE__ */ jsx(
531
+ TableCell,
532
+ {
533
+ sx: __spreadProps(__spreadValues({}, headCellSx), { minWidth: 110, textAlign: "center" }),
534
+ children: "Audit Report"
535
+ }
536
+ ),
537
+ /* @__PURE__ */ jsx(
538
+ TableCell,
539
+ {
540
+ sx: __spreadProps(__spreadValues({}, headCellSx), { minWidth: 100 }),
541
+ children: "Recording"
542
+ }
543
+ ),
544
+ [
545
+ { id: "phoneNumber", label: "Phone Number" },
546
+ { id: "callStartTime", label: "Call Start" },
547
+ { id: "callType", label: "Call Type" },
548
+ { id: "callStatus", label: "Status" },
549
+ { id: "agentName", label: "User Name" },
550
+ { id: "queueName", label: "Queues" },
551
+ { id: "extension", label: "Extension" },
552
+ {
553
+ id: "talkDurationFmt",
554
+ label: "Talk Duration"
555
+ },
556
+ {
557
+ id: "holdDurationFmt",
558
+ label: "Hold Duration"
559
+ },
560
+ {
561
+ id: "ringingDurationFmt",
562
+ label: "Ringing Duration"
563
+ },
564
+ {
565
+ id: "queueDurationFmt",
566
+ label: "Queue Duration"
567
+ },
568
+ {
569
+ id: "wrapupDurationFmt",
570
+ label: "Wrapup Duration"
571
+ },
572
+ { id: "disposition", label: "Disposition" },
573
+ { id: "remarks", label: "Remarks" },
574
+ {
575
+ id: "wasTransferred",
576
+ label: "Transferred"
577
+ }
578
+ ].map((col) => /* @__PURE__ */ jsx(TableCell, { sx: headCellSx, children: /* @__PURE__ */ jsx(
579
+ TableSortLabel,
580
+ {
581
+ active: sortKey === col.id,
582
+ direction: sortKey === col.id ? sortDir : "asc",
583
+ onClick: () => handleSort(col.id),
584
+ sx: {
585
+ "&.MuiTableSortLabel-root": { color: "#333" },
586
+ "&.MuiTableSortLabel-root:hover": { color: "#555" },
587
+ "&.Mui-active": { color: "#333" },
588
+ "& .MuiTableSortLabel-icon": {
589
+ color: "#333 !important"
590
+ }
591
+ },
592
+ children: col.label
593
+ }
594
+ ) }, col.id))
595
+ ] }) }),
596
+ /* @__PURE__ */ jsx(TableBody, { children: sortedRecords.map((row, idx) => /* @__PURE__ */ jsxs(
597
+ TableRow,
598
+ {
599
+ hover: true,
600
+ sx: {
601
+ backgroundColor: "#fff",
602
+ "&:hover": { backgroundColor: "#f0f7f8" }
603
+ },
604
+ children: [
605
+ /* @__PURE__ */ jsx(TableCell, { sx: { textAlign: "center", verticalAlign: "middle" }, children: /* @__PURE__ */ jsx(Tooltip, { title: "View Audit Report", children: /* @__PURE__ */ jsx(
606
+ IconButton,
607
+ {
608
+ size: "small",
609
+ onClick: () => {
610
+ setSelectedAuditRow(row);
611
+ setAuditDialogOpen(true);
612
+ },
613
+ sx: { color: COLORS.blue, p: 0.4 },
614
+ children: /* @__PURE__ */ jsx(AssignmentIcon, { sx: { fontSize: 16 } })
615
+ }
616
+ ) }) }),
617
+ /* @__PURE__ */ jsx(TableCell, { sx: { verticalAlign: "middle" }, children: row.callUuid ? /* @__PURE__ */ jsx(
618
+ RecordingCell,
619
+ {
620
+ callUuid: row.callUuid,
621
+ recordingPath: row.recordingPath
622
+ }
623
+ ) : null }),
624
+ /* @__PURE__ */ jsx(
625
+ TableCell,
626
+ {
627
+ sx: {
628
+ fontWeight: 600,
629
+ color: COLORS.navy,
630
+ fontSize: "0.75rem"
631
+ },
632
+ children: row.phoneNumber || ""
633
+ }
634
+ ),
635
+ /* @__PURE__ */ jsx(TableCell, { sx: { fontSize: "0.73rem", color: "#4a5568" }, children: row.callStartTime ? dayjs(row.callStartTime).format(
636
+ "DD MMM YYYY hh:mm A"
637
+ ) : "" }),
638
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(CallTypePill, { value: row.callType || "" }) }),
639
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(StatusPill, { value: row.callStatus || "" }) }),
640
+ /* @__PURE__ */ jsx(TableCell, { sx: { fontSize: "0.73rem", color: "#4a5568" }, children: row.agentName || "" }),
641
+ /* @__PURE__ */ jsx(TableCell, { children: row.queueName ? /* @__PURE__ */ jsx(
642
+ Chip,
643
+ {
644
+ label: row.queueName,
645
+ size: "small",
646
+ sx: {
647
+ fontFamily: FONT,
648
+ backgroundColor: "#f0ebfa",
649
+ color: COLORS.purple,
650
+ fontWeight: 500,
651
+ fontSize: "0.67rem",
652
+ height: 22
653
+ }
654
+ }
655
+ ) : null }),
656
+ /* @__PURE__ */ jsx(TableCell, { sx: { fontSize: "0.73rem", color: "#4a5568" }, children: row.extension || "" }),
657
+ /* @__PURE__ */ jsx(
658
+ TableCell,
659
+ {
660
+ sx: {
661
+ fontWeight: 600,
662
+ color: COLORS.blue,
663
+ fontSize: "0.75rem",
664
+ fontVariantNumeric: "tabular-nums"
665
+ },
666
+ children: row.talkDurationFmt || ""
667
+ }
668
+ ),
669
+ /* @__PURE__ */ jsx(
670
+ TableCell,
671
+ {
672
+ sx: {
673
+ fontWeight: 500,
674
+ color: COLORS.amber,
675
+ fontSize: "0.75rem",
676
+ fontVariantNumeric: "tabular-nums"
677
+ },
678
+ children: row.holdDurationFmt || ""
679
+ }
680
+ ),
681
+ /* @__PURE__ */ jsx(
682
+ TableCell,
683
+ {
684
+ sx: {
685
+ fontWeight: 500,
686
+ fontSize: "0.75rem",
687
+ fontVariantNumeric: "tabular-nums"
688
+ },
689
+ children: row.ringingDurationFmt || ""
690
+ }
691
+ ),
692
+ /* @__PURE__ */ jsx(
693
+ TableCell,
694
+ {
695
+ sx: {
696
+ fontWeight: 500,
697
+ fontSize: "0.75rem",
698
+ fontVariantNumeric: "tabular-nums"
699
+ },
700
+ children: row.queueDurationFmt || ""
701
+ }
702
+ ),
703
+ /* @__PURE__ */ jsx(
704
+ TableCell,
705
+ {
706
+ sx: {
707
+ fontWeight: 500,
708
+ fontSize: "0.75rem",
709
+ fontVariantNumeric: "tabular-nums"
710
+ },
711
+ children: row.wrapupDurationFmt || ""
712
+ }
713
+ ),
714
+ /* @__PURE__ */ jsx(TableCell, { sx: { fontSize: "0.73rem", color: "#4a5568" }, children: row.disposition || "" }),
715
+ /* @__PURE__ */ jsx(TableCell, { sx: { fontSize: "0.73rem", color: "#4a5568" }, children: row.remarks ? /* @__PURE__ */ jsx(Tooltip, { title: row.remarks, children: /* @__PURE__ */ jsx(
716
+ "span",
717
+ {
718
+ style: {
719
+ display: "inline-block",
720
+ maxWidth: 180,
721
+ overflow: "hidden",
722
+ textOverflow: "ellipsis",
723
+ whiteSpace: "nowrap",
724
+ verticalAlign: "bottom"
725
+ },
726
+ children: row.remarks
727
+ }
728
+ ) }) : "" }),
729
+ /* @__PURE__ */ jsx(TableCell, { children: row.wasTransferred ? /* @__PURE__ */ jsx(
730
+ Chip,
731
+ {
732
+ label: "Yes",
733
+ size: "small",
734
+ sx: {
735
+ fontFamily: FONT,
736
+ backgroundColor: "#e6f7ef",
737
+ color: COLORS.green,
738
+ fontWeight: 600,
739
+ fontSize: "0.65rem",
740
+ height: 20,
741
+ borderRadius: "6px"
742
+ }
743
+ }
744
+ ) : /* @__PURE__ */ jsx(
745
+ Chip,
746
+ {
747
+ label: "No",
748
+ size: "small",
749
+ sx: {
750
+ fontFamily: FONT,
751
+ backgroundColor: "transparent",
752
+ color: "#6b7b8d",
753
+ fontWeight: 600,
754
+ fontSize: "0.65rem",
755
+ height: 20,
756
+ borderRadius: "6px"
757
+ }
758
+ }
759
+ ) })
760
+ ]
761
+ },
762
+ row.callUuid || idx
763
+ )) })
764
+ ]
765
+ }
766
+ ) }),
767
+ /* @__PURE__ */ jsx(
768
+ TablePagination,
769
+ {
770
+ component: "div",
771
+ count: totalRecords,
772
+ page,
773
+ onPageChange: handlePageChange,
774
+ rowsPerPage,
775
+ rowsPerPageOptions: [10, 15, 25, 50, 100],
776
+ onRowsPerPageChange: (e) => {
777
+ setRowsPerPage(parseInt(e.target.value, 10));
778
+ setPage(0);
779
+ },
780
+ sx: {
781
+ borderTop: "1px solid #eef1f6",
782
+ fontFamily: FONT,
783
+ "& .MuiTablePagination-displayedRows": {
784
+ fontFamily: FONT,
785
+ fontSize: "0.73rem"
786
+ },
787
+ "& .MuiTablePagination-selectLabel": {
788
+ fontFamily: FONT,
789
+ fontSize: "0.73rem"
790
+ }
791
+ }
792
+ }
793
+ )
794
+ ]
795
+ }
796
+ )
797
+ ] })
798
+ ]
799
+ }
800
+ ),
801
+ /* @__PURE__ */ jsx(
802
+ AuditReportDialog,
803
+ {
804
+ open: auditDialogOpen,
805
+ onClose: () => {
806
+ setAuditDialogOpen(false);
807
+ setSelectedAuditRow(null);
808
+ },
809
+ rowData: selectedAuditRow != null ? selectedAuditRow : void 0
810
+ }
811
+ )
812
+ ] });
813
+ }
814
+ var CdrReport = () => /* @__PURE__ */ jsx(SDKProvider, { children: /* @__PURE__ */ jsx(CdrReportContent, {}) });
815
+ var cdrReport_default = CdrReport;
816
+ export {
817
+ cdrReport_default as default
818
+ };
819
+ //# sourceMappingURL=cdrReport-44LN5VUX.mjs.map