ahs-cti 0.0.5 → 0.0.7

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