ahs-cti 0.0.2-beta.9 → 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 +13838 -2251
  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,529 @@
1
+ import {
2
+ ReportFilterBar,
3
+ headCellSx
4
+ } from "./chunk-CXULBAK6.mjs";
5
+ import {
6
+ PageHeader
7
+ } from "./chunk-JOZ4YQMR.mjs";
8
+ import {
9
+ AppButton
10
+ } from "./chunk-HBR2JS4C.mjs";
11
+ import {
12
+ SDKProvider
13
+ } from "./chunk-6ICPXSN6.mjs";
14
+ import {
15
+ END_POINT,
16
+ axios_default
17
+ } from "./chunk-O2XGWZLT.mjs";
18
+ import {
19
+ __spreadProps,
20
+ __spreadValues
21
+ } from "./chunk-VQCHBU2Q.mjs";
22
+
23
+ // call-control-sdk/lib/pages/managementDashboard/index.tsx
24
+ import { useState, useEffect, useCallback, useMemo, useRef } from "react";
25
+ import {
26
+ Box,
27
+ Paper,
28
+ Stack,
29
+ Typography,
30
+ CircularProgress,
31
+ Alert,
32
+ Table,
33
+ TableBody,
34
+ TableCell,
35
+ TableContainer,
36
+ TableHead,
37
+ TableRow,
38
+ TextField,
39
+ InputAdornment,
40
+ Chip,
41
+ Radio,
42
+ RadioGroup,
43
+ FormControlLabel
44
+ } from "@mui/material";
45
+ import dayjs from "dayjs";
46
+ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
47
+ import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
48
+ import {
49
+ ComposedChart,
50
+ Bar,
51
+ Line,
52
+ XAxis,
53
+ YAxis,
54
+ CartesianGrid,
55
+ Tooltip as RTooltip,
56
+ ResponsiveContainer
57
+ } from "recharts";
58
+ import SearchIcon from "@mui/icons-material/Search";
59
+ import FileDownloadIcon from "@mui/icons-material/FileDownload";
60
+ import RefreshIcon from "@mui/icons-material/Refresh";
61
+
62
+ // call-control-sdk/lib/pages/managementDashboard/useManagementDashboard.ts
63
+ function buildQs(params) {
64
+ const qs = new URLSearchParams();
65
+ if (params.start_date) qs.append("start_date", params.start_date);
66
+ if (params.end_date) qs.append("end_date", params.end_date);
67
+ if (params.agent_id != null) qs.append("agent_id", String(params.agent_id));
68
+ const str = qs.toString();
69
+ return str ? `?${str}` : "";
70
+ }
71
+ async function getManagementDashboard(params) {
72
+ const res = await axios_default.get(
73
+ `${END_POINT.MANAGEMENT_DASHBOARD}${buildQs(params)}`
74
+ );
75
+ return res.data;
76
+ }
77
+
78
+ // call-control-sdk/lib/pages/managementDashboard/index.tsx
79
+ import { jsx, jsxs } from "react/jsx-runtime";
80
+ var C = {
81
+ navy: "#1a3a6b",
82
+ blue: "#2b6cb0",
83
+ green: "#276749",
84
+ amber: "#c47c00",
85
+ red: "#c53030",
86
+ teal: "#0b7a8f",
87
+ surface: "#fff",
88
+ s2: "#f7f9fc",
89
+ s3: "#eef2f7",
90
+ b1: "rgba(20,50,100,.07)",
91
+ b2: "rgba(20,50,100,.13)",
92
+ t1: "#2d3748",
93
+ t2: "#4a5568",
94
+ t3: "#718096",
95
+ blt: "#e8f0fc",
96
+ glt: "#e4f6ef",
97
+ alt: "#fdf3e0",
98
+ rlt: "#fde8e8",
99
+ tlt: "#e3f4f7"
100
+ };
101
+ var headSx = __spreadProps(__spreadValues({}, headCellSx), { py: 1, px: 1.5 });
102
+ var cellSx = { fontSize: 12, py: 0.8, px: 1.5, borderBottom: `1px solid ${C.b1}` };
103
+ var monoSx = { fontFamily: "'JetBrains Mono', monospace", fontSize: 12, fontWeight: 700 };
104
+ var labelSx = { fontSize: 11, fontWeight: 700, letterSpacing: 0.7, textTransform: "uppercase", color: C.t2 };
105
+ var cardPaper = { background: C.surface, border: `1px solid #dce3ef`, borderRadius: "6px", overflow: "hidden", boxShadow: "0 1px 4px rgba(0,0,0,.09)" };
106
+ var cardHeader = { px: 1.5, py: 1, background: C.s2, borderBottom: `1px solid ${C.b1}`, display: "flex", alignItems: "center", justifyContent: "space-between" };
107
+ var EMPTY = {
108
+ inbound: { total: 0, answered: 0, unanswered: 0, answered_pct: 0, unanswered_pct: 0 },
109
+ outbound: { total: 0, answered: 0, unanswered: 0, answered_pct: 0, unanswered_pct: 0 },
110
+ totals: { total_calls: 0, total_answered: 0, highest_duration: "00:00:00", lowest_duration: "00:00:00", calls_lt_30sec: 0, avg_inbound_duration: "00:00:00", avg_outbound_duration: "00:00:00" },
111
+ abandoned: { total: 0, called_back: 0, to_call: 0, called_back_pct: 0, to_call_pct: 0, avg_callback_duration: "00:00:00" },
112
+ ivr: { total: 0, called_back: 0, to_call: 0, called_back_pct: 0, to_call_pct: 0 },
113
+ waiting: { avg_wait_time: "00:00:00", avg_lang_selection: "00:00:00", avg_queue_wait: "00:00:00" },
114
+ cht: [],
115
+ queue_calls: [],
116
+ hourly_chart: [],
117
+ repeated_calls: []
118
+ };
119
+ function DirectionCard({ title, data }) {
120
+ return /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
121
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: title }) }),
122
+ /* @__PURE__ */ jsxs(Box, { sx: { p: 1.5 }, children: [
123
+ /* @__PURE__ */ jsx(Typography, { sx: { fontFamily: "'Barlow Condensed', sans-serif", fontSize: 32, fontWeight: 800, color: C.navy, lineHeight: 1, mb: 1.2 }, children: data.total.toLocaleString() }),
124
+ /* @__PURE__ */ jsx(Box, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 1, borderTop: `2px solid ${C.s3}`, pt: 1 }, children: [
125
+ { label: "ANSWERED", value: data.answered, pct: data.answered_pct, color: C.blue },
126
+ { label: "UNANSWERED", value: data.unanswered, pct: data.unanswered_pct, color: C.t3 }
127
+ ].map(({ label, value, pct, color }) => /* @__PURE__ */ jsxs(Box, { children: [
128
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 10, fontWeight: 700, letterSpacing: 0.5, color: C.t3, mb: 0.3 }, children: label }),
129
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "baseline", gap: 0.5 }, children: [
130
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 18, fontWeight: 700, color }, children: value.toLocaleString() }),
131
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 11, color: C.t3 }, children: [
132
+ pct.toFixed(1),
133
+ "%"
134
+ ] })
135
+ ] })
136
+ ] }, label)) })
137
+ ] })
138
+ ] });
139
+ }
140
+ function QueueCallsCard({ data }) {
141
+ return /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
142
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Queue Wise Calls" }) }),
143
+ /* @__PURE__ */ jsxs(Box, { sx: { p: 1.5 }, children: [
144
+ data.length === 0 && /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 12, color: C.t3, textAlign: "center", py: 2 }, children: "No data" }),
145
+ data.map((q, i) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", py: 0.6, borderBottom: `1px solid #f0f0f0`, "&:last-child": { borderBottom: "none" } }, children: [
146
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 12, fontWeight: 600, color: C.t2 }, children: q.queue_name }),
147
+ /* @__PURE__ */ jsx(Box, { sx: { background: i === 0 ? "#3182ce" : "#90cdf4", color: i === 0 ? "#fff" : "#1a365d", borderRadius: "4px", px: 1.2, py: 0.3, minWidth: 44, textAlign: "center", fontSize: 14, fontWeight: 700 }, children: q.call_count })
148
+ ] }, q.queue_name))
149
+ ] })
150
+ ] });
151
+ }
152
+ function AbandonedCard({ data }) {
153
+ return /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
154
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Abandoned Patients" }) }),
155
+ /* @__PURE__ */ jsxs(Box, { sx: { p: 1.5 }, children: [
156
+ /* @__PURE__ */ jsx(Typography, { sx: { fontFamily: "'Barlow Condensed', sans-serif", fontSize: 30, fontWeight: 800, color: C.navy, lineHeight: 1, mb: 1 }, children: data.total.toLocaleString() }),
157
+ [
158
+ { label: "Called Back Patients", value: data.called_back, pct: data.called_back_pct },
159
+ { label: "To be Called Patients", value: data.to_call, pct: data.to_call_pct }
160
+ ].map(({ label, value, pct }) => /* @__PURE__ */ jsxs(Box, { sx: { mb: 0.4 }, children: [
161
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 11, color: C.t3, display: "inline" }, children: [
162
+ label,
163
+ " "
164
+ ] }),
165
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 13, fontWeight: 700, color: C.blue, display: "inline" }, children: [
166
+ value,
167
+ " "
168
+ ] }),
169
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 11, fontWeight: 700, color: "#48bb78", display: "inline" }, children: [
170
+ pct.toFixed(1),
171
+ "%"
172
+ ] })
173
+ ] }, label))
174
+ ] })
175
+ ] });
176
+ }
177
+ function AvgCallbackCard({ duration }) {
178
+ return /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
179
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Avg Callback Duration" }) }),
180
+ /* @__PURE__ */ jsx(Box, { sx: { p: 1.5 }, children: /* @__PURE__ */ jsx(Typography, { sx: { fontFamily: "'JetBrains Mono', monospace", fontSize: 26, fontWeight: 700, color: C.navy, mt: 1, letterSpacing: 1 }, children: duration }) })
181
+ ] });
182
+ }
183
+ function IvrCard({ data }) {
184
+ return /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
185
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "IVR Patients" }) }),
186
+ /* @__PURE__ */ jsxs(Box, { sx: { p: 1.5 }, children: [
187
+ /* @__PURE__ */ jsx(Typography, { sx: { fontFamily: "'Barlow Condensed', sans-serif", fontSize: 30, fontWeight: 800, color: C.navy, lineHeight: 1, mb: 1 }, children: data.total.toLocaleString() }),
188
+ [
189
+ { label: "Called Back", value: data.called_back, pct: data.called_back_pct },
190
+ { label: "To Be Called", value: data.to_call, pct: data.to_call_pct }
191
+ ].map(({ label, value, pct }) => /* @__PURE__ */ jsxs(Box, { sx: { mb: 0.4 }, children: [
192
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 11, color: C.t3, display: "inline" }, children: [
193
+ label,
194
+ " "
195
+ ] }),
196
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 13, fontWeight: 700, color: C.blue, display: "inline" }, children: [
197
+ value,
198
+ " "
199
+ ] }),
200
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: 11, fontWeight: 700, color: "#48bb78", display: "inline" }, children: [
201
+ pct.toFixed(1),
202
+ "%"
203
+ ] })
204
+ ] }, label))
205
+ ] })
206
+ ] });
207
+ }
208
+ function statusColor(status) {
209
+ const s = status == null ? void 0 : status.toUpperCase();
210
+ if (s === "ANSWERED") return C.green;
211
+ if (s === "CANCEL") return C.red;
212
+ if (s === "ABANDONED") return "#c05621";
213
+ return C.t2;
214
+ }
215
+ function ManagementDashboardContent() {
216
+ const [startDate, setStartDate] = useState(dayjs().startOf("day"));
217
+ const [endDate, setEndDate] = useState(dayjs());
218
+ const [quickRange, setQuickRange] = useState("today");
219
+ const [data, setData] = useState(EMPTY);
220
+ const [loading, setLoading] = useState(false);
221
+ const [error, setError] = useState("");
222
+ const [repeatedSearch, setRepeatedSearch] = useState("");
223
+ const [chartDir, setChartDir] = useState("inbound");
224
+ const chartRef = useRef(null);
225
+ const fetchDashboard = useCallback(async () => {
226
+ var _a, _b;
227
+ if (!startDate || !endDate) return;
228
+ setLoading(true);
229
+ setError("");
230
+ try {
231
+ const result = await getManagementDashboard({
232
+ start_date: startDate.format("YYYY-MM-DD"),
233
+ end_date: endDate.format("YYYY-MM-DD")
234
+ });
235
+ setData(result);
236
+ } catch (err) {
237
+ setError(((_b = (_a = err == null ? void 0 : err.response) == null ? void 0 : _a.data) == null ? void 0 : _b.detail) || (err == null ? void 0 : err.message) || "Failed to load dashboard");
238
+ } finally {
239
+ setLoading(false);
240
+ }
241
+ }, [startDate, endDate]);
242
+ useEffect(() => {
243
+ fetchDashboard();
244
+ }, [fetchDashboard]);
245
+ const handleQuickRangeChange = (range) => setQuickRange(range);
246
+ const filteredRepeated = useMemo(() => {
247
+ if (!repeatedSearch) return data.repeated_calls;
248
+ const q = repeatedSearch.toLowerCase();
249
+ return data.repeated_calls.filter(
250
+ (r) => r.phone_number.toLowerCase().includes(q) || r.latest_status.toLowerCase().includes(q) || r.latest_call_type.toLowerCase().includes(q)
251
+ );
252
+ }, [data.repeated_calls, repeatedSearch]);
253
+ const hourlyData = useMemo(() => {
254
+ const map = new Map(data.hourly_chart.map((h) => [h.hour, h]));
255
+ return Array.from({ length: 24 }, (_, h) => {
256
+ var _a, _b, _c, _d, _e, _f;
257
+ return {
258
+ hour: `${String(h).padStart(2, "0")}`,
259
+ answered: (_b = (_a = map.get(h)) == null ? void 0 : _a.answered) != null ? _b : 0,
260
+ abandoned: (_d = (_c = map.get(h)) == null ? void 0 : _c.abandoned) != null ? _d : 0,
261
+ agents: (_f = (_e = map.get(h)) == null ? void 0 : _e.agents) != null ? _f : 0
262
+ };
263
+ });
264
+ }, [data.hourly_chart]);
265
+ const downloadChart = () => {
266
+ var _a;
267
+ const svgEl = (_a = chartRef.current) == null ? void 0 : _a.querySelector("svg");
268
+ if (!svgEl) return;
269
+ const svgData = new XMLSerializer().serializeToString(svgEl);
270
+ const canvas = document.createElement("canvas");
271
+ const img = new Image();
272
+ img.onload = () => {
273
+ canvas.width = img.width;
274
+ canvas.height = img.height;
275
+ const ctx = canvas.getContext("2d");
276
+ if (!ctx) return;
277
+ ctx.fillStyle = "#fff";
278
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
279
+ ctx.drawImage(img, 0, 0);
280
+ const a = document.createElement("a");
281
+ a.download = `hourly_chart_${chartDir}.png`;
282
+ a.href = canvas.toDataURL("image/png");
283
+ a.click();
284
+ };
285
+ img.src = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(svgData)));
286
+ };
287
+ return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsxs(Box, { sx: { background: "transparent", minHeight: "100vh" }, children: [
288
+ /* @__PURE__ */ jsx(
289
+ PageHeader,
290
+ {
291
+ title: "Management Dashboard",
292
+ actions: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
293
+ /* @__PURE__ */ jsx(
294
+ AppButton,
295
+ {
296
+ variant: "outlined",
297
+ startIcon: /* @__PURE__ */ jsx(RefreshIcon, { sx: { fontSize: "0.95rem !important" } }),
298
+ onClick: fetchDashboard,
299
+ disabled: loading,
300
+ children: "Refresh"
301
+ }
302
+ ),
303
+ /* @__PURE__ */ jsx(
304
+ AppButton,
305
+ {
306
+ startIcon: /* @__PURE__ */ jsx(FileDownloadIcon, { sx: { fontSize: "0.95rem !important" } }),
307
+ disabled: loading || data.totals.total_calls === 0,
308
+ onClick: () => {
309
+ const rows = data.repeated_calls.map((r) => Object.values(r).join(","));
310
+ const csv = ["Phone,Date,Count,Status,Type,Comments", ...rows].join("\n");
311
+ const a = document.createElement("a");
312
+ a.href = URL.createObjectURL(new Blob([csv], { type: "text/csv" }));
313
+ a.download = `mgmt_dashboard_${startDate == null ? void 0 : startDate.format("YYYY-MM-DD")}.csv`;
314
+ a.click();
315
+ },
316
+ children: "Export CSV"
317
+ }
318
+ )
319
+ ] })
320
+ }
321
+ ),
322
+ /* @__PURE__ */ jsx(
323
+ ReportFilterBar,
324
+ {
325
+ startDate,
326
+ endDate,
327
+ onStartChange: setStartDate,
328
+ onEndChange: setEndDate,
329
+ showTime: false,
330
+ quickRange,
331
+ onQuickRangeChange: handleQuickRangeChange
332
+ }
333
+ ),
334
+ error && /* @__PURE__ */ jsx(Alert, { severity: "error", sx: { mx: 2.5, mt: 1.5 }, onClose: () => setError(""), children: error }),
335
+ loading && /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", py: 5 }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 36 }) }),
336
+ !loading && /* @__PURE__ */ jsxs(Box, { sx: { px: { xs: 1, md: 2 }, py: 1.5 }, children: [
337
+ /* @__PURE__ */ jsxs(Box, { sx: {
338
+ display: "grid",
339
+ gridTemplateColumns: { xs: "1fr", sm: "repeat(2, 1fr)", md: "repeat(3, 1fr)", lg: "1.3fr 1.2fr 1.1fr 0.75fr 1.3fr 1.1fr" },
340
+ gap: 1.2,
341
+ mb: 1.2
342
+ }, children: [
343
+ /* @__PURE__ */ jsx(DirectionCard, { title: "Inbound Calls", data: data.inbound }),
344
+ /* @__PURE__ */ jsx(QueueCallsCard, { data: data.queue_calls }),
345
+ /* @__PURE__ */ jsx(AbandonedCard, { data: data.abandoned }),
346
+ /* @__PURE__ */ jsx(AvgCallbackCard, { duration: data.abandoned.avg_callback_duration }),
347
+ /* @__PURE__ */ jsx(DirectionCard, { title: "Outbound Calls", data: data.outbound }),
348
+ /* @__PURE__ */ jsx(IvrCard, { data: data.ivr })
349
+ ] }),
350
+ /* @__PURE__ */ jsxs(Box, { sx: {
351
+ display: "grid",
352
+ gridTemplateColumns: { xs: "1fr", sm: "repeat(2, 1fr)", lg: "1fr 1fr 1.6fr 1.6fr" },
353
+ gap: 1.2,
354
+ mb: 1.2
355
+ }, children: [
356
+ /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
357
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Summary" }) }),
358
+ /* @__PURE__ */ jsxs(Box, { sx: { p: 1.5 }, children: [
359
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "baseline", gap: 0.5, mb: 0.5 }, children: [
360
+ /* @__PURE__ */ jsx(Typography, { sx: { fontFamily: "'Barlow Condensed', sans-serif", fontSize: 22, fontWeight: 800, color: C.navy }, children: data.totals.total_answered.toLocaleString() }),
361
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 14, color: C.t3 }, children: "/" }),
362
+ /* @__PURE__ */ jsx(Typography, { sx: { fontFamily: "'Barlow Condensed', sans-serif", fontSize: 22, fontWeight: 800, color: C.t3 }, children: data.totals.total_calls.toLocaleString() })
363
+ ] }),
364
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 11, color: C.t3, mb: 1 }, children: "Total Calls" }),
365
+ /* @__PURE__ */ jsxs(Box, { sx: { mt: 1 }, children: [
366
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 11, color: C.t3, mb: 0.3 }, children: "Call Duration" }),
367
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 2 }, children: [
368
+ /* @__PURE__ */ jsxs(Box, { children: [
369
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 10, color: C.t3 }, children: "Highest" }),
370
+ /* @__PURE__ */ jsx(Typography, { sx: __spreadProps(__spreadValues({}, monoSx), { color: C.blue, fontSize: 13 }), children: data.totals.highest_duration })
371
+ ] }),
372
+ /* @__PURE__ */ jsxs(Box, { children: [
373
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 10, color: C.t3 }, children: "Lowest" }),
374
+ /* @__PURE__ */ jsx(Typography, { sx: __spreadProps(__spreadValues({}, monoSx), { color: C.blue, fontSize: 13 }), children: data.totals.lowest_duration })
375
+ ] })
376
+ ] })
377
+ ] }),
378
+ /* @__PURE__ */ jsxs(Box, { sx: { mt: 1 }, children: [
379
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 11, color: C.t3, display: "inline" }, children: "Calls < 30 sec: " }),
380
+ /* @__PURE__ */ jsx(Typography, { sx: __spreadProps(__spreadValues({}, monoSx), { color: C.blue, display: "inline", fontSize: 13 }), children: data.totals.calls_lt_30sec.toLocaleString() })
381
+ ] })
382
+ ] })
383
+ ] }),
384
+ /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
385
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Avg Total Calls Duration" }) }),
386
+ /* @__PURE__ */ jsx(Box, { sx: { p: 1.5 }, children: [
387
+ { label: "Inbound", value: data.totals.avg_inbound_duration },
388
+ { label: "Outbound", value: data.totals.avg_outbound_duration }
389
+ ].map(({ label, value }) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", py: 1, borderBottom: `1px solid ${C.b1}`, "&:last-child": { borderBottom: "none" } }, children: [
390
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 12, fontWeight: 600, color: C.t2 }, children: label }),
391
+ /* @__PURE__ */ jsx(Typography, { sx: __spreadProps(__spreadValues({}, monoSx), { fontSize: 16, color: C.blue }), children: value })
392
+ ] }, label)) })
393
+ ] }),
394
+ /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
395
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Inbound Average Waiting" }) }),
396
+ /* @__PURE__ */ jsx(Box, { sx: { p: 1.5, display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 1, mt: 0.5 }, children: [
397
+ { label: "Waiting Time", value: data.waiting.avg_wait_time },
398
+ { label: "Language Selection", value: data.waiting.avg_lang_selection },
399
+ { label: "Queue Waiting", value: data.waiting.avg_queue_wait }
400
+ ].map(({ label, value }) => /* @__PURE__ */ jsxs(Box, { sx: { textAlign: "center" }, children: [
401
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 10, fontWeight: 600, color: C.t3, mb: 0.5 }, children: label }),
402
+ /* @__PURE__ */ jsx(Typography, { sx: __spreadProps(__spreadValues({}, monoSx), { fontSize: 18, color: C.blue }), children: value })
403
+ ] }, label)) })
404
+ ] }),
405
+ /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
406
+ /* @__PURE__ */ jsx(Box, { sx: cardHeader, children: /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Average CHT" }) }),
407
+ /* @__PURE__ */ jsx(TableContainer, { children: /* @__PURE__ */ jsxs(Table, { size: "small", children: [
408
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
409
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Call Type" }),
410
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Call Handling Time" }),
411
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Talk Duration" }),
412
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Hold Duration" })
413
+ ] }) }),
414
+ /* @__PURE__ */ jsxs(TableBody, { children: [
415
+ data.cht.length === 0 && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: 4, sx: { textAlign: "center", py: 2, color: C.t3, fontSize: 12 }, children: "No data" }) }),
416
+ data.cht.map((row) => /* @__PURE__ */ jsxs(TableRow, { hover: true, children: [
417
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { fontWeight: 600, color: C.t2 }), children: row.call_type }),
418
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues(__spreadValues({}, cellSx), monoSx), { color: C.blue }), children: row.call_handling_time }),
419
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues(__spreadValues({}, cellSx), monoSx), { color: C.blue }), children: row.talk_duration }),
420
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues(__spreadValues({}, cellSx), monoSx), { color: C.blue }), children: row.hold_duration })
421
+ ] }, row.call_type))
422
+ ] })
423
+ ] }) })
424
+ ] })
425
+ ] }),
426
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "grid", gridTemplateColumns: { xs: "1fr", lg: "1fr 1fr" }, gap: 1.2 }, children: [
427
+ /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
428
+ /* @__PURE__ */ jsxs(Box, { sx: __spreadProps(__spreadValues({}, cardHeader), { flexWrap: "wrap", gap: 1 }), children: [
429
+ /* @__PURE__ */ jsxs(Box, { children: [
430
+ /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Avg Hour Wise Inbound Calls vs Agents" }),
431
+ /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 1.5, sx: { mt: 0.5 }, children: [
432
+ { color: "#f6a623", label: "Answered" },
433
+ { color: "#90a4c0", label: "Abandoned" },
434
+ { color: "#4a5568", label: "Agents" }
435
+ ].map(({ color, label }) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
436
+ /* @__PURE__ */ jsx(Box, { sx: { width: 12, height: 12, borderRadius: "2px", background: color } }),
437
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: 11, color: C.t3 }, children: label })
438
+ ] }, label)) })
439
+ ] }),
440
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: 0.5 }, children: [
441
+ /* @__PURE__ */ jsxs(
442
+ RadioGroup,
443
+ {
444
+ row: true,
445
+ value: chartDir,
446
+ onChange: (e) => setChartDir(e.target.value),
447
+ sx: { "& .MuiFormControlLabel-root": { mr: 0.5 }, "& .MuiFormControlLabel-label": { fontSize: 12 } },
448
+ children: [
449
+ /* @__PURE__ */ jsx(FormControlLabel, { value: "inbound", control: /* @__PURE__ */ jsx(Radio, { size: "small" }), label: "Inbound" }),
450
+ /* @__PURE__ */ jsx(FormControlLabel, { value: "outbound", control: /* @__PURE__ */ jsx(Radio, { size: "small" }), label: "Outbound" })
451
+ ]
452
+ }
453
+ ),
454
+ /* @__PURE__ */ jsx(
455
+ Typography,
456
+ {
457
+ onClick: downloadChart,
458
+ sx: { fontSize: 11, color: "#3182ce", cursor: "pointer", border: "1px solid #bee3f8", borderRadius: "4px", px: 1, py: 0.3 },
459
+ children: "\u2B07 DOWNLOAD"
460
+ }
461
+ )
462
+ ] })
463
+ ] }),
464
+ /* @__PURE__ */ jsx(Box, { ref: chartRef, sx: { p: 1.5, height: 260 }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data: hourlyData, margin: { top: 4, right: 30, left: -20, bottom: 0 }, barGap: 1, children: [
465
+ /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: C.b2, vertical: false }),
466
+ /* @__PURE__ */ jsx(XAxis, { dataKey: "hour", tick: { fontSize: 9, fill: C.t3 }, interval: 1 }),
467
+ /* @__PURE__ */ jsx(YAxis, { yAxisId: "left", tick: { fontSize: 9, fill: C.t3 } }),
468
+ /* @__PURE__ */ jsx(YAxis, { yAxisId: "right", orientation: "right", tick: { fontSize: 9, fill: C.t3 } }),
469
+ /* @__PURE__ */ jsx(
470
+ RTooltip,
471
+ {
472
+ contentStyle: { fontSize: 11, borderRadius: 6, border: `1px solid ${C.b2}` },
473
+ formatter: (v, n) => [v, n.charAt(0).toUpperCase() + n.slice(1)]
474
+ }
475
+ ),
476
+ /* @__PURE__ */ jsx(Bar, { yAxisId: "left", dataKey: "answered", fill: "#f6a623", radius: [2, 2, 0, 0], maxBarSize: 14 }),
477
+ /* @__PURE__ */ jsx(Bar, { yAxisId: "left", dataKey: "abandoned", fill: "#90a4c0", radius: [2, 2, 0, 0], maxBarSize: 14 }),
478
+ /* @__PURE__ */ jsx(Line, { yAxisId: "right", type: "monotone", dataKey: "agents", stroke: "#4a5568", strokeWidth: 1.5, dot: { r: 2, fill: "#4a5568" } })
479
+ ] }) }) })
480
+ ] }),
481
+ /* @__PURE__ */ jsxs(Paper, { sx: cardPaper, children: [
482
+ /* @__PURE__ */ jsxs(Box, { sx: cardHeader, children: [
483
+ /* @__PURE__ */ jsx(Typography, { sx: labelSx, children: "Repeated Calls" }),
484
+ /* @__PURE__ */ jsx(Chip, { label: data.repeated_calls.length, size: "small", sx: { background: C.rlt, color: C.red, fontWeight: 700, fontSize: 11 } })
485
+ ] }),
486
+ /* @__PURE__ */ jsx(Box, { sx: { px: 1.5, py: 1 }, children: /* @__PURE__ */ jsx(
487
+ TextField,
488
+ {
489
+ size: "small",
490
+ placeholder: "Search\u2026",
491
+ value: repeatedSearch,
492
+ onChange: (e) => setRepeatedSearch(e.target.value),
493
+ fullWidth: true,
494
+ slotProps: { input: { startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(SearchIcon, { sx: { fontSize: 16, color: C.t3 } }) }) } },
495
+ sx: { "& .MuiInputBase-root": { fontSize: 12 } }
496
+ }
497
+ ) }),
498
+ /* @__PURE__ */ jsx(TableContainer, { sx: { maxHeight: 260, overflow: "auto" }, children: /* @__PURE__ */ jsxs(Table, { size: "small", stickyHeader: true, children: [
499
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
500
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Phone Number" }),
501
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Date" }),
502
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "No of Calls" }),
503
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Latest Status" }),
504
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Latest Call Type" }),
505
+ /* @__PURE__ */ jsx(TableCell, { sx: headSx, children: "Comments" })
506
+ ] }) }),
507
+ /* @__PURE__ */ jsxs(TableBody, { children: [
508
+ filteredRepeated.length === 0 && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: 6, sx: { textAlign: "center", py: 2, color: C.t3, fontSize: 12 }, children: "No repeated calls" }) }),
509
+ filteredRepeated.map((r) => /* @__PURE__ */ jsxs(TableRow, { hover: true, children: [
510
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues(__spreadValues({}, cellSx), monoSx), { fontSize: 11 }), children: r.phone_number }),
511
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { fontSize: 11 }), children: r.date }),
512
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { fontWeight: 700, color: C.navy, fontSize: 13 }), children: r.call_count }),
513
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { fontSize: 11, fontWeight: 600, color: statusColor(r.latest_status) }), children: r.latest_status }),
514
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { fontSize: 11 }), children: r.latest_call_type }),
515
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { fontSize: 11, color: C.t3 }), children: r.comments })
516
+ ] }, `${r.phone_number}-${r.date}`))
517
+ ] })
518
+ ] }) })
519
+ ] })
520
+ ] })
521
+ ] })
522
+ ] }) });
523
+ }
524
+ var ManagementDashboard = () => /* @__PURE__ */ jsx(SDKProvider, { children: /* @__PURE__ */ jsx(ManagementDashboardContent, {}) });
525
+ var managementDashboard_default = ManagementDashboard;
526
+ export {
527
+ managementDashboard_default as default
528
+ };
529
+ //# sourceMappingURL=managementDashboard-TYON77NW.mjs.map