ahs-cti 0.0.4 → 0.0.6

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