ahs-cti 0.0.1

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