ahs-cti 0.0.7 → 0.0.9

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 (139) hide show
  1. package/dist/agentDetailReport-F44HMQ5O.mjs +27 -0
  2. package/dist/agentDetailReport-F44HMQ5O.mjs.map +1 -0
  3. package/dist/{agentPerformanceReport-JZK5DN5E.mjs → agentPerformanceReport-TTOMNENK.mjs} +25 -15
  4. package/dist/{agentPerformanceReport-JZK5DN5E.mjs.map → agentPerformanceReport-TTOMNENK.mjs.map} +1 -1
  5. package/dist/auditReport-QTMAKVTN.mjs +26 -0
  6. package/dist/auditReport-QTMAKVTN.mjs.map +1 -0
  7. package/dist/{callHistory-T3M76D4B.mjs → callHistory-4J4J2XHA.mjs} +20 -10
  8. package/dist/{callHistory-T3M76D4B.mjs.map → callHistory-4J4J2XHA.mjs.map} +1 -1
  9. package/dist/{campaigns-5PVHXBSD.mjs → campaigns-N3UNUGQP.mjs} +23 -13
  10. package/dist/{campaigns-5PVHXBSD.mjs.map → campaigns-N3UNUGQP.mjs.map} +1 -1
  11. package/dist/{caroQualityAuditDashboard-EUDYZ3QY.mjs → caroQualityAuditDashboard-TNS4L2NR.mjs} +12 -2
  12. package/dist/{caroQualityAuditDashboard-EUDYZ3QY.mjs.map → caroQualityAuditDashboard-TNS4L2NR.mjs.map} +1 -1
  13. package/dist/{caroVoiceAI-GGJCVUIQ.mjs → caroVoiceAI-OUTAAIFE.mjs} +12 -2
  14. package/dist/{caroVoiceAI-GGJCVUIQ.mjs.map → caroVoiceAI-OUTAAIFE.mjs.map} +1 -1
  15. package/dist/{cdrReport-ZMDHSZUW.mjs → cdrReport-Z35OLYUL.mjs} +26 -16
  16. package/dist/{cdrReport-ZMDHSZUW.mjs.map → cdrReport-Z35OLYUL.mjs.map} +1 -1
  17. package/dist/chunk-3PNP6G5P.mjs +92 -0
  18. package/dist/chunk-3PNP6G5P.mjs.map +1 -0
  19. package/dist/{chunk-DF5EFKXC.mjs → chunk-45MLTWV7.mjs} +12 -2
  20. package/dist/{chunk-DF5EFKXC.mjs.map → chunk-45MLTWV7.mjs.map} +1 -1
  21. package/dist/chunk-635IIVZE.mjs +24 -0
  22. package/dist/{chunk-FRKV2U3I.mjs.map → chunk-635IIVZE.mjs.map} +1 -1
  23. package/dist/chunk-677RFPP5.mjs +24 -0
  24. package/dist/{chunk-7LE2VTAI.mjs.map → chunk-677RFPP5.mjs.map} +1 -1
  25. package/dist/{chunk-Q6G3MPS7.mjs → chunk-ERSNXW5X.mjs} +11 -1
  26. package/dist/{chunk-Q6G3MPS7.mjs.map → chunk-ERSNXW5X.mjs.map} +1 -1
  27. package/dist/{chunk-H7GRWLYI.mjs → chunk-G6KRLGGC.mjs} +13 -3
  28. package/dist/{chunk-H7GRWLYI.mjs.map → chunk-G6KRLGGC.mjs.map} +1 -1
  29. package/dist/chunk-GFVR3HLK.mjs +24 -0
  30. package/dist/{chunk-6WLG2PXL.mjs.map → chunk-GFVR3HLK.mjs.map} +1 -1
  31. package/dist/{chunk-E6KYWWAI.mjs → chunk-GTI2ZVQX.mjs} +12 -2
  32. package/dist/{chunk-E6KYWWAI.mjs.map → chunk-GTI2ZVQX.mjs.map} +1 -1
  33. package/dist/chunk-H22TUCN3.mjs +24 -0
  34. package/dist/{chunk-AOJRUZTO.mjs.map → chunk-H22TUCN3.mjs.map} +1 -1
  35. package/dist/{chunk-YAQYTUTX.mjs → chunk-HAOFUADN.mjs} +12 -2
  36. package/dist/{chunk-YAQYTUTX.mjs.map → chunk-HAOFUADN.mjs.map} +1 -1
  37. package/dist/{chunk-33QNSXP7.mjs → chunk-JHC7OUQG.mjs} +21 -11
  38. package/dist/chunk-JHC7OUQG.mjs.map +1 -0
  39. package/dist/chunk-KSVNZKRD.mjs +10930 -0
  40. package/dist/chunk-KSVNZKRD.mjs.map +1 -0
  41. package/dist/{chunk-VVDJLUYT.mjs → chunk-M7FJYZF6.mjs} +12 -2
  42. package/dist/{chunk-VVDJLUYT.mjs.map → chunk-M7FJYZF6.mjs.map} +1 -1
  43. package/dist/{chunk-DNTGBNZD.mjs → chunk-NDZDJWXY.mjs} +13 -3
  44. package/dist/{chunk-DNTGBNZD.mjs.map → chunk-NDZDJWXY.mjs.map} +1 -1
  45. package/dist/chunk-S2SMCH2C.mjs +71 -0
  46. package/dist/chunk-S2SMCH2C.mjs.map +1 -0
  47. package/dist/{chunk-IDZWA6HG.mjs → chunk-S34CQVTF.mjs} +14 -4
  48. package/dist/{chunk-IDZWA6HG.mjs.map → chunk-S34CQVTF.mjs.map} +1 -1
  49. package/dist/{chunk-2M3YEXYA.mjs → chunk-SUS5RUCA.mjs} +17 -7
  50. package/dist/{chunk-2M3YEXYA.mjs.map → chunk-SUS5RUCA.mjs.map} +1 -1
  51. package/dist/{chunk-3J7KQNEU.mjs → chunk-TCYBXDAP.mjs} +13 -3
  52. package/dist/{chunk-3J7KQNEU.mjs.map → chunk-TCYBXDAP.mjs.map} +1 -1
  53. package/dist/chunk-VII5JNA6.mjs +24 -0
  54. package/dist/{chunk-WTBVFN4H.mjs.map → chunk-VII5JNA6.mjs.map} +1 -1
  55. package/dist/chunk-W3ECDLUB.mjs +24 -0
  56. package/dist/{chunk-OHJIW3I3.mjs.map → chunk-W3ECDLUB.mjs.map} +1 -1
  57. package/dist/{chunk-VBIDPX5Z.mjs → chunk-Y4PAUTZ4.mjs} +13 -3
  58. package/dist/{chunk-VBIDPX5Z.mjs.map → chunk-Y4PAUTZ4.mjs.map} +1 -1
  59. package/dist/{chunk-NAZO4HKB.mjs → chunk-ZSRD3ZXF.mjs} +12 -2
  60. package/dist/{chunk-NAZO4HKB.mjs.map → chunk-ZSRD3ZXF.mjs.map} +1 -1
  61. package/dist/index.mjs +33 -23
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/{liveStatus-YSBYSVOO.mjs → liveStatus-PRDEL7CK.mjs} +16 -6
  64. package/dist/{liveStatus-YSBYSVOO.mjs.map → liveStatus-PRDEL7CK.mjs.map} +1 -1
  65. package/dist/{loginReport-YIVBJVJD.mjs → loginReport-47QNACQU.mjs} +22 -12
  66. package/dist/{loginReport-YIVBJVJD.mjs.map → loginReport-47QNACQU.mjs.map} +1 -1
  67. package/dist/{managementDashboard-7EMQC2UA.mjs → managementDashboard-SZFYULKA.mjs} +22 -12
  68. package/dist/{managementDashboard-7EMQC2UA.mjs.map → managementDashboard-SZFYULKA.mjs.map} +1 -1
  69. package/dist/{qualityAuditDashboard-ENGQN2WQ.mjs → qualityAuditDashboard-FHRGB77R.mjs} +12 -2
  70. package/dist/{qualityAuditDashboard-ENGQN2WQ.mjs.map → qualityAuditDashboard-FHRGB77R.mjs.map} +1 -1
  71. package/dist-react/agentDetailReport-PDKQKJNL.mjs +23 -0
  72. package/dist-react/agentPerformanceReport-MU2FASNN.mjs +544 -0
  73. package/dist-react/agentPerformanceReport-MU2FASNN.mjs.map +1 -0
  74. package/dist-react/auditReport-WH2KDNYT.mjs +25 -0
  75. package/{dist/auditReport-6ZUJ4UFO.mjs.map → dist-react/auditReport-WH2KDNYT.mjs.map} +1 -1
  76. package/dist-react/callHistory-HXXRYUIV.mjs +832 -0
  77. package/dist-react/callHistory-HXXRYUIV.mjs.map +1 -0
  78. package/dist-react/campaigns-J7KIAATE.mjs +3139 -0
  79. package/dist-react/campaigns-J7KIAATE.mjs.map +1 -0
  80. package/dist-react/caroQualityAuditDashboard-THYPVOCP.mjs +76 -0
  81. package/dist-react/caroQualityAuditDashboard-THYPVOCP.mjs.map +1 -0
  82. package/dist-react/caroVoiceAI-XGDUETXI.mjs +31 -0
  83. package/dist-react/caroVoiceAI-XGDUETXI.mjs.map +1 -0
  84. package/dist-react/cdrReport-SX2FZAO6.mjs +858 -0
  85. package/dist-react/cdrReport-SX2FZAO6.mjs.map +1 -0
  86. package/dist-react/chunk-4YF4IDV6.mjs +72 -0
  87. package/dist-react/chunk-4YF4IDV6.mjs.map +1 -0
  88. package/dist-react/chunk-ADM2JJCP.mjs +190 -0
  89. package/dist-react/chunk-ADM2JJCP.mjs.map +1 -0
  90. package/dist-react/chunk-EN7HM2MD.mjs +688 -0
  91. package/dist-react/chunk-EN7HM2MD.mjs.map +1 -0
  92. package/{dist/chunk-LHE4QGJJ.mjs → dist-react/chunk-F7G2XFRU.mjs} +12 -2
  93. package/{dist/chunk-LHE4QGJJ.mjs.map → dist-react/chunk-F7G2XFRU.mjs.map} +1 -1
  94. package/{dist/chunk-DJP744FF.mjs → dist-react/chunk-GUMGXVIT.mjs} +12 -2
  95. package/{dist/chunk-DJP744FF.mjs.map → dist-react/chunk-GUMGXVIT.mjs.map} +1 -1
  96. package/dist-react/chunk-KRXHK4AU.mjs +127 -0
  97. package/dist-react/chunk-KRXHK4AU.mjs.map +1 -0
  98. package/{dist/chunk-U2UDKXMB.mjs → dist-react/chunk-LWDAC6QU.mjs} +12 -2
  99. package/{dist/chunk-U2UDKXMB.mjs.map → dist-react/chunk-LWDAC6QU.mjs.map} +1 -1
  100. package/dist-react/chunk-LX6I32Y4.mjs +106 -0
  101. package/dist-react/chunk-LX6I32Y4.mjs.map +1 -0
  102. package/dist-react/chunk-MCD5FQNY.mjs +428 -0
  103. package/dist-react/chunk-MCD5FQNY.mjs.map +1 -0
  104. package/dist-react/chunk-MD472UKG.mjs +757 -0
  105. package/{dist/chunk-33QNSXP7.mjs.map → dist-react/chunk-MD472UKG.mjs.map} +1 -1
  106. package/dist-react/chunk-ORNNWQI6.mjs +67 -0
  107. package/dist-react/chunk-ORNNWQI6.mjs.map +1 -0
  108. package/dist-react/chunk-S4J35V4B.mjs +126 -0
  109. package/dist-react/chunk-S4J35V4B.mjs.map +1 -0
  110. package/dist-react/chunk-T53WMN5A.mjs +126 -0
  111. package/dist-react/chunk-T53WMN5A.mjs.map +1 -0
  112. package/dist-react/chunk-UTSRABCL.mjs +96 -0
  113. package/dist-react/chunk-UTSRABCL.mjs.map +1 -0
  114. package/dist-react/incoming-4WP3FJI4.mp3 +0 -0
  115. package/dist-react/incoming.mp3 +0 -0
  116. package/dist-react/index.d.mts +2476 -0
  117. package/dist-react/index.d.ts +2477 -0
  118. package/dist-react/index.js +26713 -0
  119. package/dist-react/index.js.map +1 -0
  120. package/dist-react/index.mjs +4675 -0
  121. package/dist-react/index.mjs.map +1 -0
  122. package/dist-react/liveStatus-IDZ7CPYK.mjs +1087 -0
  123. package/dist-react/liveStatus-IDZ7CPYK.mjs.map +1 -0
  124. package/dist-react/loginReport-F47GUU53.mjs +990 -0
  125. package/dist-react/loginReport-F47GUU53.mjs.map +1 -0
  126. package/dist-react/managementDashboard-GC5E7NEL.mjs +540 -0
  127. package/dist-react/managementDashboard-GC5E7NEL.mjs.map +1 -0
  128. package/dist-react/qualityAuditDashboard-ZAM7HRNH.mjs +76 -0
  129. package/dist-react/qualityAuditDashboard-ZAM7HRNH.mjs.map +1 -0
  130. package/package.json +17 -2
  131. package/dist/agentDetailReport-ZR7U2LLB.mjs +0 -17
  132. package/dist/auditReport-6ZUJ4UFO.mjs +0 -16
  133. package/dist/chunk-6WLG2PXL.mjs +0 -14
  134. package/dist/chunk-7LE2VTAI.mjs +0 -14
  135. package/dist/chunk-AOJRUZTO.mjs +0 -14
  136. package/dist/chunk-FRKV2U3I.mjs +0 -14
  137. package/dist/chunk-OHJIW3I3.mjs +0 -14
  138. package/dist/chunk-WTBVFN4H.mjs +0 -14
  139. /package/{dist/agentDetailReport-ZR7U2LLB.mjs.map → dist-react/agentDetailReport-PDKQKJNL.mjs.map} +0 -0
@@ -0,0 +1,832 @@
1
+ import * as __ext_react from "react";
2
+ import * as __ext_react_dom from "react-dom";
3
+ import * as __ext_react_jsx from "react/jsx-runtime";
4
+ var __cjsExternals = { "react": __ext_react, "react-dom": __ext_react_dom, "react/jsx-runtime": __ext_react_jsx };
5
+ var require = function (id) {
6
+ var mod = __cjsExternals[id];
7
+ if (mod) return mod.default || mod;
8
+ throw new Error('Dynamic require of "' + id + '" is not supported');
9
+ };
10
+
11
+ import {
12
+ SDKPageHeader
13
+ } from "./chunk-T53WMN5A.mjs";
14
+ import {
15
+ AppButton
16
+ } from "./chunk-LX6I32Y4.mjs";
17
+ import {
18
+ SDKProvider,
19
+ useToast
20
+ } from "./chunk-4YF4IDV6.mjs";
21
+ import {
22
+ END_POINT,
23
+ axios_default,
24
+ deepFindArray
25
+ } from "./chunk-F7G2XFRU.mjs";
26
+ import {
27
+ __spreadProps,
28
+ __spreadValues
29
+ } from "./chunk-S4J35V4B.mjs";
30
+
31
+ // call-control-sdk/lib/pages/callHistory/index.tsx
32
+ import { memo, useCallback as useCallback2, useEffect as useEffect2, useState as useState3 } from "react";
33
+ import {
34
+ Box as Box2,
35
+ Typography as Typography2,
36
+ Table,
37
+ TableBody,
38
+ TableCell,
39
+ TableContainer,
40
+ TableHead,
41
+ TableRow,
42
+ TablePagination,
43
+ ToggleButton,
44
+ ToggleButtonGroup,
45
+ IconButton,
46
+ Collapse,
47
+ CircularProgress as CircularProgress2,
48
+ Chip,
49
+ Stack as Stack2,
50
+ Switch,
51
+ FormControlLabel,
52
+ Tooltip as Tooltip2,
53
+ InputAdornment,
54
+ OutlinedInput,
55
+ useTheme,
56
+ Paper
57
+ } from "@mui/material";
58
+
59
+ // call-control-sdk/lib/pages/common/components/Transcript.tsx
60
+ import { useEffect, useState } from "react";
61
+ import {
62
+ Avatar,
63
+ Box,
64
+ CircularProgress,
65
+ Rating,
66
+ Stack,
67
+ Tooltip,
68
+ Typography
69
+ } from "@mui/material";
70
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
71
+ var GAUGE_COLORS = ["#e74c3c", "#e67e22", "#f1c40f", "#a3d977", "#2ecc71"];
72
+ function scoreColor(score) {
73
+ const idx = Math.max(0, Math.min(4, Math.round(score) - 1));
74
+ return GAUGE_COLORS[idx];
75
+ }
76
+ function GaugeTooltip({ metric }) {
77
+ var _a;
78
+ if (!metric) return /* @__PURE__ */ jsx(Fragment, { children: "\u2014" });
79
+ return /* @__PURE__ */ jsxs(Box, { sx: { maxWidth: 240 }, children: [
80
+ typeof metric.Model_Prediction_Confidence_Level === "number" && /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: "0.75rem", fontWeight: 600, mb: 0.5 }, children: [
81
+ "Model Confidence: ",
82
+ metric.Model_Prediction_Confidence_Level,
83
+ "%"
84
+ ] }),
85
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.72rem", lineHeight: 1.4 }, children: (_a = metric.Observations) != null ? _a : "" })
86
+ ] });
87
+ }
88
+ function Gauge({ score, label }) {
89
+ const max = 5;
90
+ const radius = 32;
91
+ const stroke = 7;
92
+ const circumference = 2 * Math.PI * radius;
93
+ const pct = Math.max(0, Math.min(1, score / max));
94
+ const dash = circumference * pct;
95
+ const color = scoreColor(score);
96
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", px: 1 }, children: [
97
+ /* @__PURE__ */ jsxs(Box, { sx: { position: "relative", width: 80, height: 80 }, children: [
98
+ /* @__PURE__ */ jsxs("svg", { width: 80, height: 80, viewBox: "0 0 80 80", children: [
99
+ /* @__PURE__ */ jsx("circle", { cx: 40, cy: 40, r: radius, fill: "none", stroke: "#eee", strokeWidth: stroke }),
100
+ /* @__PURE__ */ jsx(
101
+ "circle",
102
+ {
103
+ cx: 40,
104
+ cy: 40,
105
+ r: radius,
106
+ fill: "none",
107
+ stroke: color,
108
+ strokeWidth: stroke,
109
+ strokeLinecap: "round",
110
+ strokeDasharray: `${dash} ${circumference - dash}`,
111
+ transform: "rotate(-90 40 40)"
112
+ }
113
+ )
114
+ ] }),
115
+ /* @__PURE__ */ jsx(
116
+ Box,
117
+ {
118
+ sx: {
119
+ position: "absolute",
120
+ inset: 0,
121
+ display: "flex",
122
+ alignItems: "center",
123
+ justifyContent: "center",
124
+ fontSize: 18,
125
+ fontWeight: 600,
126
+ color: "#444"
127
+ },
128
+ children: score
129
+ }
130
+ )
131
+ ] }),
132
+ /* @__PURE__ */ jsx(
133
+ Typography,
134
+ {
135
+ sx: {
136
+ mt: 0.5,
137
+ fontSize: "0.7rem",
138
+ color: "primary.main",
139
+ fontWeight: 600,
140
+ textAlign: "center",
141
+ lineHeight: 1.2,
142
+ maxWidth: 110
143
+ },
144
+ children: label
145
+ }
146
+ )
147
+ ] });
148
+ }
149
+ function ClassificationBar({ classification }) {
150
+ const COLOR_MAP = {
151
+ Informational_Queries: "#5bc0eb",
152
+ Action_Oriented_Queries: "#3aa3d0",
153
+ Escalations_or_Complaints: "#9b59b6"
154
+ };
155
+ const segments = Object.entries(classification != null ? classification : {}).filter(([, v]) => v != null).map(([key, value]) => {
156
+ var _a;
157
+ return {
158
+ label: key.replaceAll("_", " "),
159
+ value: Number(value) || 0,
160
+ color: (_a = COLOR_MAP[key]) != null ? _a : "#7e57c2"
161
+ };
162
+ });
163
+ const total = segments.reduce((s, seg) => s + seg.value, 0) || 1;
164
+ return /* @__PURE__ */ jsxs(Box, { children: [
165
+ /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 2, mb: 0.75, sx: { flexWrap: "wrap", rowGap: 0.5 }, children: segments.map((s) => /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.72rem", color: s.color, fontWeight: 600 }, children: s.label }, s.label)) }),
166
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", width: "100%", height: 8, borderRadius: 4, overflow: "hidden" }, children: segments.map((s) => /* @__PURE__ */ jsx(Box, { sx: { width: `${s.value / total * 100}%`, backgroundColor: s.color } }, s.label)) })
167
+ ] });
168
+ }
169
+ function SectionBox({ title, children }) {
170
+ return /* @__PURE__ */ jsxs(Box, { sx: (t) => ({ border: `1.5px solid ${t.palette.primary.main}`, borderRadius: 1, p: 1, mb: 1.25 }), children: [
171
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", fontWeight: 700, mb: 0.5 }, children: title }),
172
+ children
173
+ ] });
174
+ }
175
+ function resolveTranscriptData(raw) {
176
+ var _a;
177
+ if (!raw) return null;
178
+ const payload = (_a = raw.data) != null ? _a : raw;
179
+ if (payload.Call_Center_Interaction_Hospital_Service) {
180
+ return {
181
+ transcription: payload.transcription,
182
+ sentiment_analysis: {
183
+ Call_Center_Interaction_Hospital_Service: payload.Call_Center_Interaction_Hospital_Service
184
+ }
185
+ };
186
+ }
187
+ return payload;
188
+ }
189
+ var Transcript = ({ row }) => {
190
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
191
+ const [transcript, setTranscript] = useState(null);
192
+ const [loading, setLoading] = useState(true);
193
+ useEffect(() => {
194
+ let cancelled = false;
195
+ setLoading(true);
196
+ axios_default.get(END_POINT.CALLSAGE_SENTIMENT(row.call_uuid)).then((res) => {
197
+ if (!cancelled) setTranscript(resolveTranscriptData(res.data));
198
+ }).catch(() => {
199
+ if (!cancelled) setTranscript(null);
200
+ }).finally(() => {
201
+ if (!cancelled) setLoading(false);
202
+ });
203
+ return () => {
204
+ cancelled = true;
205
+ };
206
+ }, [row.call_uuid]);
207
+ if (loading) {
208
+ return /* @__PURE__ */ jsx(Box, { display: "flex", justifyContent: "center", py: 3, children: /* @__PURE__ */ jsx(CircularProgress, { size: 22 }) });
209
+ }
210
+ const svc = (_a = transcript == null ? void 0 : transcript.sentiment_analysis) == null ? void 0 : _a.Call_Center_Interaction_Hospital_Service;
211
+ const summary = svc == null ? void 0 : svc.Call_Summary;
212
+ const breakdown = svc == null ? void 0 : svc.Sentiment_Analysis_Breakdown;
213
+ const patient = (_b = breakdown == null ? void 0 : breakdown.Patient_Sentiment_Analysis) != null ? _b : {};
214
+ const agent = (_c = breakdown == null ? void 0 : breakdown.Agent_Sentiment_Analysis) != null ? _c : {};
215
+ const oss = breakdown == null ? void 0 : breakdown["Overall_Sentiment_Score_(OSS)"];
216
+ const classification = svc == null ? void 0 : svc.Conversation_Type_Classification;
217
+ const positives = (_e = (_d = svc == null ? void 0 : svc.Key_Highlights_Issues_Identified) == null ? void 0 : _d.Positive_Aspects) != null ? _e : [];
218
+ const improvements = (_g = (_f = svc == null ? void 0 : svc.Key_Highlights_Issues_Identified) == null ? void 0 : _f.Areas_for_Improvement) != null ? _g : [];
219
+ const lines = ((_h = transcript == null ? void 0 : transcript.transcription) != null ? _h : "").split("\n").filter((l) => l.trim().length > 0);
220
+ const patientAspects = Object.entries(patient).filter(([key]) => key !== "Overall_Sentiment");
221
+ const agentAspects = Object.entries(agent).filter(([key]) => key !== "Overall_Agent_Performance");
222
+ const patientAvg = (_j = (_i = patient["Overall_Sentiment"]) == null ? void 0 : _i.Sentiment_Score) != null ? _j : patientAspects.reduce((sum, [, m]) => {
223
+ var _a2;
224
+ return sum + ((_a2 = m == null ? void 0 : m.Sentiment_Score) != null ? _a2 : 0);
225
+ }, 0) / (patientAspects.length || 1);
226
+ const agentAvg = (_l = (_k = agent["Overall_Agent_Performance"]) == null ? void 0 : _k.Sentiment_Score) != null ? _l : agentAspects.reduce((sum, [, m]) => {
227
+ var _a2;
228
+ return sum + ((_a2 = m == null ? void 0 : m.Sentiment_Score) != null ? _a2 : 0);
229
+ }, 0) / (agentAspects.length || 1);
230
+ const overall = (_m = oss == null ? void 0 : oss.Sentiment_Score) != null ? _m : (patientAvg + agentAvg) / 2;
231
+ if (!svc && lines.length === 0) {
232
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
233
+ /* @__PURE__ */ jsx(Typography, { fontWeight: 600, fontSize: "0.85rem", mb: 0.5, children: "Call Details" }),
234
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", fontSize: "0.82rem", children: [
235
+ "Call UID: ",
236
+ row.call_uuid
237
+ ] }),
238
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", fontSize: "0.82rem", children: [
239
+ "Agent: ",
240
+ (_n = row.agent_id) != null ? _n : "Unassigned"
241
+ ] }),
242
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", fontSize: "0.82rem", color: "#999", mt: 1, children: "No transcript available for this call." })
243
+ ] });
244
+ }
245
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "grid", gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" }, gap: 1.5 }, children: [
246
+ /* @__PURE__ */ jsxs(Box, { children: [
247
+ /* @__PURE__ */ jsxs(Box, { sx: { p: 1.25, border: "1px solid #e0e0e0", borderRadius: 1, backgroundColor: "#fff", mb: 1.25 }, children: [
248
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 0.5, children: [
249
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 700, fontSize: "0.85rem", color: "primary.main" }, children: "Call Summary" }),
250
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, children: [
251
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "#555" }, children: "Overall Satisfaction:" }),
252
+ /* @__PURE__ */ jsx(Rating, { size: "small", value: overall, precision: 0.5, readOnly: true })
253
+ ] })
254
+ ] }),
255
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", color: "#444", lineHeight: 1.45 }, children: summary != null ? summary : "-" })
256
+ ] }),
257
+ lines.length > 0 ? /* @__PURE__ */ jsxs(Box, { sx: { p: 1.25, border: "1px solid #e0e0e0", borderRadius: 1, backgroundColor: "#fff" }, children: [
258
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 700, fontSize: "0.85rem", color: "primary.main", mb: 1 }, children: "Transcript" }),
259
+ /* @__PURE__ */ jsx(Box, { sx: { maxHeight: 360, overflowY: "auto", pr: 0.5 }, children: lines.map((line, idx) => {
260
+ const isPatient = line.trim().toLowerCase().startsWith("patient");
261
+ const text = line.replace(/^\s*(Patient|Agent)\s*:\s*/i, "");
262
+ return /* @__PURE__ */ jsxs(
263
+ Box,
264
+ {
265
+ sx: {
266
+ display: "flex",
267
+ justifyContent: isPatient ? "flex-end" : "flex-start",
268
+ alignItems: "center",
269
+ mb: 0.75,
270
+ gap: 0.75
271
+ },
272
+ children: [
273
+ !isPatient && /* @__PURE__ */ jsx(Avatar, { sx: { width: 22, height: 22, fontSize: 12 } }),
274
+ /* @__PURE__ */ jsx(
275
+ Box,
276
+ {
277
+ sx: (t) => ({
278
+ maxWidth: "70%",
279
+ px: 1.25,
280
+ py: 0.75,
281
+ borderRadius: isPatient ? "8px 8px 0 8px" : "8px 8px 8px 0",
282
+ backgroundColor: isPatient ? t.palette.primary.main : "#fff",
283
+ color: isPatient ? t.palette.common.white : "#222",
284
+ border: isPatient ? "none" : "1px solid #e0e0e0",
285
+ fontSize: "0.8rem",
286
+ lineHeight: 1.4
287
+ }),
288
+ children: text
289
+ }
290
+ ),
291
+ isPatient && /* @__PURE__ */ jsx(Avatar, { sx: { width: 22, height: 22, fontSize: 12 } })
292
+ ]
293
+ },
294
+ idx
295
+ );
296
+ }) })
297
+ ] }) : /* @__PURE__ */ jsxs(Box, { sx: { p: 1.25, border: "1px solid #e0e0e0", borderRadius: 1, backgroundColor: "#fff" }, children: [
298
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 700, fontSize: "0.9rem", color: "primary.main", mb: 1 }, children: "Key Highlights & Issues Identified" }),
299
+ /* @__PURE__ */ jsxs(Box, { sx: { maxHeight: 180, overflowY: "auto", pr: 0.5 }, children: [
300
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.82rem", fontWeight: 700, color: "#2ecc71", mb: 0.5 }, children: "\u2705 Positive Aspects:" }),
301
+ positives.length > 0 ? positives.map((p, i) => /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: "0.78rem", color: "#333", pl: 1.5, mb: 0.25 }, children: [
302
+ "\u2022 ",
303
+ p
304
+ ] }, i)) : /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", color: "#999", pl: 1.5 }, children: "\u2014" }),
305
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.82rem", fontWeight: 700, color: "#e67e22", mt: 1, mb: 0.5 }, children: "\u26A0\uFE0F Areas of Improvements:" }),
306
+ improvements.length > 0 ? improvements.map((p, i) => /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: "0.78rem", color: "#333", pl: 1.5, mb: 0.25 }, children: [
307
+ "\u2022 ",
308
+ p
309
+ ] }, i)) : /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", color: "#999", pl: 1.5 }, children: "\u2014" })
310
+ ] })
311
+ ] })
312
+ ] }),
313
+ /* @__PURE__ */ jsxs(Box, { children: [
314
+ /* @__PURE__ */ jsxs(Box, { sx: { p: 1.25, border: "1px solid #e0e0e0", borderRadius: 1, backgroundColor: "#fff", mb: lines.length > 0 ? 1.25 : 0 }, children: [
315
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 700, fontSize: "0.9rem", color: "primary.main", mb: 1 }, children: "Sentiment Analysis" }),
316
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 1, mb: 1 }, children: [
317
+ /* @__PURE__ */ jsxs(SectionBox, { title: "Patient Sentiment", children: [
318
+ /* @__PURE__ */ jsx(Stack, { direction: "row", justifyContent: "space-around", flexWrap: "wrap", mb: 0.5, children: patientAspects.map(([key, metric]) => {
319
+ var _a2;
320
+ return /* @__PURE__ */ jsx(Tooltip, { title: /* @__PURE__ */ jsx(GaugeTooltip, { metric }), arrow: true, children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
321
+ Gauge,
322
+ {
323
+ score: (_a2 = metric == null ? void 0 : metric.Sentiment_Score) != null ? _a2 : 0,
324
+ label: key.replaceAll("_", " ")
325
+ }
326
+ ) }) }, key);
327
+ }) }),
328
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, children: [
329
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.7rem", fontWeight: 600 }, children: "Patient Sentiment:" }),
330
+ /* @__PURE__ */ jsx(Rating, { size: "small", value: patientAvg, precision: 0.5, readOnly: true })
331
+ ] })
332
+ ] }),
333
+ /* @__PURE__ */ jsxs(SectionBox, { title: "Agent Performance", children: [
334
+ /* @__PURE__ */ jsx(Stack, { direction: "row", justifyContent: "space-around", flexWrap: "wrap", mb: 0.5, children: agentAspects.map(([key, metric]) => {
335
+ var _a2;
336
+ return /* @__PURE__ */ jsx(Tooltip, { title: /* @__PURE__ */ jsx(GaugeTooltip, { metric }), arrow: true, children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
337
+ Gauge,
338
+ {
339
+ score: (_a2 = metric == null ? void 0 : metric.Sentiment_Score) != null ? _a2 : 0,
340
+ label: key.replaceAll("_", " ")
341
+ }
342
+ ) }) }, key);
343
+ }) }),
344
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, children: [
345
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.7rem", fontWeight: 600 }, children: "Agent Performance:" }),
346
+ /* @__PURE__ */ jsx(Rating, { size: "small", value: agentAvg, precision: 0.5, readOnly: true })
347
+ ] })
348
+ ] })
349
+ ] }),
350
+ /* @__PURE__ */ jsx(SectionBox, { title: "Conversation Classification", children: /* @__PURE__ */ jsx(ClassificationBar, { classification }) })
351
+ ] }),
352
+ lines.length > 0 && /* @__PURE__ */ jsxs(Box, { sx: { p: 1.25, border: "1px solid #e0e0e0", borderRadius: 1, backgroundColor: "#fff" }, children: [
353
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 700, fontSize: "0.9rem", color: "primary.main", mb: 1 }, children: "Key Highlights & Issues Identified" }),
354
+ /* @__PURE__ */ jsxs(Box, { sx: { maxHeight: 180, overflowY: "auto", pr: 0.5 }, children: [
355
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.82rem", fontWeight: 700, color: "#2ecc71", mb: 0.5 }, children: "\u2705 Positive Aspects:" }),
356
+ positives.length > 0 ? positives.map((p, i) => /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: "0.78rem", color: "#333", pl: 1.5, mb: 0.25 }, children: [
357
+ "\u2022 ",
358
+ p
359
+ ] }, i)) : /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", color: "#999", pl: 1.5 }, children: "\u2014" }),
360
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.82rem", fontWeight: 700, color: "#e67e22", mt: 1, mb: 0.5 }, children: "\u26A0\uFE0F Areas of Improvements:" }),
361
+ improvements.length > 0 ? improvements.map((p, i) => /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: "0.78rem", color: "#333", pl: 1.5, mb: 0.25 }, children: [
362
+ "\u2022 ",
363
+ p
364
+ ] }, i)) : /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", color: "#999", pl: 1.5 }, children: "\u2014" })
365
+ ] })
366
+ ] })
367
+ ] })
368
+ ] });
369
+ };
370
+ var Transcript_default = Transcript;
371
+
372
+ // call-control-sdk/lib/pages/callHistory/index.tsx
373
+ import KeyboardArrowDown from "@mui/icons-material/KeyboardArrowDown";
374
+ import PlayArrow from "@mui/icons-material/PlayArrow";
375
+ import ExpandLess from "@mui/icons-material/ExpandLess";
376
+ import Search from "@mui/icons-material/Search";
377
+ import Phone from "@mui/icons-material/Phone";
378
+ import RefreshIcon from "@mui/icons-material/Refresh";
379
+
380
+ // call-control-sdk/lib/pages/callHistory/useCallHistory.ts
381
+ import { useState as useState2, useCallback } from "react";
382
+ var MOCK_TRANSCRIPT = {
383
+ transcription: [
384
+ "Agent: Welcome, please wait while your call is being transferred.",
385
+ "Patient: Welcome, please wait while your call is being connected.",
386
+ "Agent: Please wait while your call is connected.",
387
+ "Agent: I will show you how you can also book new appointments if you need an appointment.",
388
+ "Agent: And you can select your specialty.",
389
+ "Patient: I am not getting it.",
390
+ "Patient: Yes, I am speaking.",
391
+ "Patient: I don't know what the reason is.",
392
+ "Patient: Yes.",
393
+ "Patient: I will do it according to the plan.",
394
+ "Patient: I am not getting any information about that.",
395
+ "Patient: Yeah, so I want to see the result.",
396
+ "Patient: I am not doing it now.",
397
+ "Agent: So we also have a new point.",
398
+ "Agent: We can include that.",
399
+ "Agent: So, um, these are the entities of the bank.",
400
+ "Agent: If you have any questions, I can answer them for you.",
401
+ "Patient: How much is it?",
402
+ "Patient: No, I don't want to do it.",
403
+ "Patient: I just got some calling.",
404
+ "Patient: I will call now."
405
+ ].join("\n"),
406
+ sentiment_analysis: {
407
+ Call_Center_Interaction_Hospital_Service: {
408
+ Call_Summary: "The conversation involved a patient attempting to get information regarding booking an appointment and the status of their results. The agent provided some guidance but the patient expressed confusion and dissatisfaction with the information provided, leading to frustration.",
409
+ Sentiment_Analysis_Breakdown: {
410
+ Patient_Sentiment_Analysis: {
411
+ "Resolution_Confidence_Index_(RCI)": {
412
+ Sentiment_Score: 1,
413
+ Observations: "The patient expressed confusion and dissatisfaction, stating 'I am not getting any information about that' and 'I am not doing it now', indicating a lack of clarity and resolution.",
414
+ Model_Prediction_Confidence_Level: 85
415
+ },
416
+ "Tone_And_Emotional_Analysis_(TEA)": {
417
+ Sentiment_Score: 2,
418
+ Observations: "The patient displayed frustration with statements like 'I don't know what the reason is' and 'I am not getting it', indicating a high level of dissatisfaction throughout the call.",
419
+ Model_Prediction_Confidence_Level: 80
420
+ },
421
+ Overall_Sentiment: {
422
+ Sentiment_Score: 1.5,
423
+ Observations: "The patient showed significant frustration and confusion, leading to a low overall sentiment."
424
+ }
425
+ },
426
+ Agent_Sentiment_Analysis: {
427
+ Empathy_Score: {
428
+ Sentiment_Score: 2,
429
+ Observations: "The agent attempted to provide information but lacked engagement and empathy, as evidenced by the unclear responses and minimal reassurance offered to the patient.",
430
+ Model_Prediction_Confidence_Level: 75
431
+ },
432
+ Confidence_Score: {
433
+ Sentiment_Score: 2,
434
+ Observations: "The agent's responses were somewhat unclear and lacked confidence, particularly when addressing the patient's inquiries, leading to a perception of hesitation.",
435
+ Model_Prediction_Confidence_Level: 70
436
+ },
437
+ Overall_Agent_Performance: {
438
+ Sentiment_Score: 2,
439
+ Observations: "The agent's performance was below expectations, lacking both empathy and clarity."
440
+ }
441
+ },
442
+ "Overall_Sentiment_Score_(OSS)": {
443
+ Sentiment_Score: 1.7,
444
+ Observations: "The overall conversation reflected a low satisfaction level from the patient, compounded by the agent's lack of clarity and engagement."
445
+ }
446
+ },
447
+ Conversation_Type_Classification: {
448
+ Informational_Queries: "40%",
449
+ Action_Oriented_Queries: "40%",
450
+ Escalations_or_Complaints: "20%"
451
+ },
452
+ Key_Highlights_Issues_Identified: {
453
+ Positive_Aspects: [
454
+ "The agent attempted to provide information about booking appointments."
455
+ ],
456
+ Areas_for_Improvement: [
457
+ "The agent needs to improve clarity in communication and show more empathy towards patient concerns."
458
+ ]
459
+ }
460
+ }
461
+ }
462
+ };
463
+ function useCallHistory() {
464
+ const [calls, setCalls] = useState2([]);
465
+ const [callsTotal, setCallsTotal] = useState2(-1);
466
+ const [missedCalls, setMissedCalls] = useState2([]);
467
+ const [loading, setLoading] = useState2(false);
468
+ const fetchCallHistory = useCallback(async (params) => {
469
+ var _a, _b;
470
+ setLoading(true);
471
+ try {
472
+ const page = (_a = params == null ? void 0 : params.page) != null ? _a : 1;
473
+ const pageSize = (_b = params == null ? void 0 : params.pageSize) != null ? _b : 10;
474
+ const query = { page, pageSize };
475
+ if (params == null ? void 0 : params.search) query.search = params.search;
476
+ if (params == null ? void 0 : params.call_type) query.call_type = params.call_type;
477
+ const res = await axios_default.post(END_POINT.CALLS_HISTORY, {}, { params: query });
478
+ const records = deepFindArray(res.data, ["records"]);
479
+ const d = res.data;
480
+ const total = typeof (d == null ? void 0 : d.total) === "number" ? d.total : typeof (d == null ? void 0 : d.count) === "number" ? d.count : typeof (d == null ? void 0 : d.totalCount) === "number" ? d.totalCount : -1;
481
+ setCalls(records);
482
+ setCallsTotal(total >= 0 ? total : records.length < pageSize ? (page - 1) * pageSize + records.length : -1);
483
+ } catch (e) {
484
+ setCalls([]);
485
+ setCallsTotal(-1);
486
+ } finally {
487
+ setLoading(false);
488
+ }
489
+ }, []);
490
+ const fetchMissedCalls = useCallback(async () => {
491
+ var _a;
492
+ setLoading(true);
493
+ try {
494
+ const res = await axios_default.get(END_POINT.MISSED_CALLS);
495
+ setMissedCalls(Array.isArray((_a = res.data) == null ? void 0 : _a.data) ? res.data.data : []);
496
+ } catch (e) {
497
+ setMissedCalls([]);
498
+ } finally {
499
+ setLoading(false);
500
+ }
501
+ }, []);
502
+ const fetchRecording = useCallback(async (call_uuid) => {
503
+ const res = await axios_default.get(END_POINT.RECORDING_BY_CALL(call_uuid), {
504
+ responseType: "blob"
505
+ });
506
+ return res.data;
507
+ }, []);
508
+ const fetchTranscript = useCallback(async (_call_uuid) => {
509
+ await new Promise((r) => setTimeout(r, 400));
510
+ return MOCK_TRANSCRIPT;
511
+ }, []);
512
+ return {
513
+ calls,
514
+ callsTotal,
515
+ missedCalls,
516
+ loading,
517
+ fetchCallHistory,
518
+ fetchMissedCalls,
519
+ fetchRecording,
520
+ fetchTranscript
521
+ };
522
+ }
523
+
524
+ // call-control-sdk/lib/pages/callHistory/index.tsx
525
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
526
+ var CALL_HISTORY_COLS = ["Call UID", "Mobile", "Type", "Start Time", "End Time", "Recording", "Agent", "Details"];
527
+ var MISSED_CALLS_COLS = ["Agent ID", "Agent Name", "Mobile No", "Type", "Actions"];
528
+ var CENTER_COLS = /* @__PURE__ */ new Set(["Type", "Recording", "Agent", "Details", "Actions"]);
529
+ var CallHistoryContent = memo(() => {
530
+ const theme = useTheme();
531
+ const { showToast } = useToast();
532
+ const { calls, callsTotal, missedCalls, loading, fetchCallHistory, fetchMissedCalls, fetchRecording } = useCallHistory();
533
+ const [filter, setFilter] = useState3("ALL");
534
+ const [search, setSearch] = useState3("");
535
+ const [showMissedCalls, setShowMissedCalls] = useState3(false);
536
+ const [page, setPage] = useState3(0);
537
+ const [rowsPerPage, setRowsPerPage] = useState3(10);
538
+ const [debouncedSearch, setDebouncedSearch] = useState3("");
539
+ useEffect2(() => {
540
+ const t = setTimeout(() => setDebouncedSearch(search.trim()), 400);
541
+ return () => clearTimeout(t);
542
+ }, [search]);
543
+ useEffect2(() => {
544
+ if (showMissedCalls) {
545
+ fetchMissedCalls();
546
+ } else {
547
+ fetchCallHistory({
548
+ page: page + 1,
549
+ pageSize: rowsPerPage,
550
+ search: debouncedSearch || void 0,
551
+ call_type: filter === "ALL" ? void 0 : filter
552
+ });
553
+ }
554
+ }, [showMissedCalls, page, rowsPerPage, filter, debouncedSearch, fetchCallHistory, fetchMissedCalls]);
555
+ const filteredCalls = calls;
556
+ const filteredMissedCalls = missedCalls.filter((c) => {
557
+ var _a;
558
+ return filter === "ALL" || ((_a = c.callType) == null ? void 0 : _a.toUpperCase()) === filter;
559
+ }).filter((c) => {
560
+ var _a, _b, _c;
561
+ const q = search.toLowerCase();
562
+ return ((_a = c.agentId) == null ? void 0 : _a.toLowerCase().includes(q)) || ((_b = c.username) == null ? void 0 : _b.toLowerCase().includes(q)) || ((_c = c.mobileNumber) == null ? void 0 : _c.toLowerCase().includes(q));
563
+ });
564
+ return /* @__PURE__ */ jsxs2(Box2, { children: [
565
+ /* @__PURE__ */ jsx2(
566
+ SDKPageHeader,
567
+ {
568
+ title: "Call History",
569
+ actions: /* @__PURE__ */ jsxs2(Stack2, { direction: "row", alignItems: "center", spacing: 1, children: [
570
+ /* @__PURE__ */ jsx2(
571
+ AppButton,
572
+ {
573
+ size: "small",
574
+ startIcon: loading ? /* @__PURE__ */ jsx2(CircularProgress2, { size: 14, color: "inherit" }) : /* @__PURE__ */ jsx2(RefreshIcon, { sx: { fontSize: "0.95rem !important" } }),
575
+ onClick: () => showMissedCalls ? fetchMissedCalls() : fetchCallHistory({
576
+ page: page + 1,
577
+ pageSize: rowsPerPage,
578
+ search: debouncedSearch || void 0,
579
+ call_type: filter === "ALL" ? void 0 : filter
580
+ }),
581
+ disabled: loading,
582
+ sx: { height: 36 },
583
+ children: "Refresh"
584
+ }
585
+ ),
586
+ /* @__PURE__ */ jsx2(
587
+ OutlinedInput,
588
+ {
589
+ size: "small",
590
+ value: search,
591
+ onChange: (e) => {
592
+ setSearch(e.target.value);
593
+ setPage(0);
594
+ },
595
+ placeholder: "Search",
596
+ sx: { width: 220, fontSize: "0.82rem", height: 36 },
597
+ endAdornment: /* @__PURE__ */ jsx2(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx2(Search, { sx: { fontSize: 18, color: "#999" } }) })
598
+ }
599
+ )
600
+ ] })
601
+ }
602
+ ),
603
+ /* @__PURE__ */ jsxs2(Box2, { py: 1.5, px: 2, children: [
604
+ /* @__PURE__ */ jsxs2(Stack2, { direction: "row", spacing: 2, alignItems: "center", mb: 2, children: [
605
+ /* @__PURE__ */ jsx2(
606
+ FormControlLabel,
607
+ {
608
+ control: /* @__PURE__ */ jsx2(
609
+ Switch,
610
+ {
611
+ size: "small",
612
+ checked: showMissedCalls,
613
+ onChange: (_, checked) => {
614
+ setShowMissedCalls(checked);
615
+ setPage(0);
616
+ }
617
+ }
618
+ ),
619
+ label: /* @__PURE__ */ jsx2(Typography2, { sx: { fontSize: "0.8rem", color: "#555" }, children: "Missed Calls" }),
620
+ sx: { ml: 0 }
621
+ }
622
+ ),
623
+ /* @__PURE__ */ jsxs2(
624
+ ToggleButtonGroup,
625
+ {
626
+ value: filter,
627
+ exclusive: true,
628
+ onChange: (_, v) => {
629
+ if (v) {
630
+ setFilter(v);
631
+ setPage(0);
632
+ }
633
+ },
634
+ size: "small",
635
+ sx: {
636
+ border: "1px solid #ccc",
637
+ borderRadius: "50px",
638
+ overflow: "hidden",
639
+ "& .MuiToggleButton-root": {
640
+ border: "none",
641
+ borderRight: "1px solid #ccc",
642
+ color: "#555",
643
+ fontWeight: 600,
644
+ textTransform: "uppercase",
645
+ fontSize: "0.72rem",
646
+ px: 2,
647
+ py: 0.5,
648
+ borderRadius: 0,
649
+ "&:last-of-type": { borderRight: "none" },
650
+ "&.Mui-selected": {
651
+ backgroundColor: theme.palette.primary.main,
652
+ color: "#fff",
653
+ "&:hover": { backgroundColor: theme.palette.primary.dark }
654
+ }
655
+ }
656
+ },
657
+ children: [
658
+ /* @__PURE__ */ jsx2(ToggleButton, { value: "ALL", children: "All" }),
659
+ /* @__PURE__ */ jsx2(ToggleButton, { value: "INCOMING", children: "Inbound" }),
660
+ /* @__PURE__ */ jsx2(ToggleButton, { value: "OUTGOING", children: "Outbound" })
661
+ ]
662
+ }
663
+ )
664
+ ] }),
665
+ /* @__PURE__ */ jsxs2(TableContainer, { component: Paper, variant: "outlined", sx: { display: "flex", flexDirection: "column" }, children: [
666
+ /* @__PURE__ */ jsx2(Box2, { sx: { overflowY: "auto", maxHeight: 600 }, children: /* @__PURE__ */ jsx2(Table, { stickyHeader: true, size: "small", children: showMissedCalls ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
667
+ /* @__PURE__ */ jsx2(TableHead, { children: /* @__PURE__ */ jsx2(TableRow, { children: MISSED_CALLS_COLS.map((col) => /* @__PURE__ */ jsx2(
668
+ TableCell,
669
+ {
670
+ align: CENTER_COLS.has(col) ? "center" : "left",
671
+ sx: { fontWeight: 600, backgroundColor: "#f1f1f1", fontSize: "0.8rem" },
672
+ children: col
673
+ },
674
+ col
675
+ )) }) }),
676
+ /* @__PURE__ */ jsx2(TableBody, { children: loading ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: 5, align: "center", sx: { py: 4 }, children: /* @__PURE__ */ jsx2(CircularProgress2, { size: 24 }) }) }) : filteredMissedCalls.length === 0 ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: 5, align: "center", sx: { py: 4, color: "#999", fontSize: "0.82rem" }, children: "No Records Found" }) }) : filteredMissedCalls.slice(page * rowsPerPage, (page + 1) * rowsPerPage).map((row, i) => /* @__PURE__ */ jsx2(MissedCallRow, { row }, `${row.agentId}-${row.mobileNumber}-${i}`)) })
677
+ ] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
678
+ /* @__PURE__ */ jsx2(TableHead, { children: /* @__PURE__ */ jsx2(TableRow, { children: CALL_HISTORY_COLS.map((col) => /* @__PURE__ */ jsx2(
679
+ TableCell,
680
+ {
681
+ align: CENTER_COLS.has(col) ? "center" : "left",
682
+ sx: { fontWeight: 600, backgroundColor: "#f1f1f1", fontSize: "0.8rem" },
683
+ children: col
684
+ },
685
+ col
686
+ )) }) }),
687
+ /* @__PURE__ */ jsx2(TableBody, { children: loading ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: 8, align: "center", sx: { py: 4 }, children: /* @__PURE__ */ jsx2(CircularProgress2, {}) }) }) : filteredCalls.length === 0 ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: 8, align: "center", sx: { py: 4, color: "#999", fontSize: "0.82rem" }, children: "No Records Found" }) }) : filteredCalls.map((row, i) => /* @__PURE__ */ jsx2(
688
+ ExpandableRow,
689
+ {
690
+ row,
691
+ striped: i % 2 === 0,
692
+ fetchRecording,
693
+ onError: (msg) => showToast(msg, "error")
694
+ },
695
+ row.call_uuid
696
+ )) })
697
+ ] }) }) }),
698
+ /* @__PURE__ */ jsx2(
699
+ TablePagination,
700
+ {
701
+ component: "div",
702
+ count: showMissedCalls ? filteredMissedCalls.length : callsTotal,
703
+ page,
704
+ rowsPerPage,
705
+ onPageChange: (_, p) => setPage(p),
706
+ onRowsPerPageChange: (e) => {
707
+ setRowsPerPage(parseInt(e.target.value, 10));
708
+ setPage(0);
709
+ },
710
+ rowsPerPageOptions: [10, 15, 25, 50, 100],
711
+ sx: { borderTop: "1px solid #e0e0e0" }
712
+ }
713
+ )
714
+ ] })
715
+ ] })
716
+ ] });
717
+ });
718
+ CallHistoryContent.displayName = "CallHistoryContent";
719
+ var MissedCallRow = memo(({ row }) => {
720
+ const theme = useTheme();
721
+ return /* @__PURE__ */ jsxs2(TableRow, { hover: true, children: [
722
+ /* @__PURE__ */ jsx2(TableCell, { sx: { fontSize: "0.82rem", color: theme.palette.primary.main }, children: row.agentId }),
723
+ /* @__PURE__ */ jsx2(TableCell, { sx: { fontSize: "0.82rem" }, children: row.username }),
724
+ /* @__PURE__ */ jsxs2(TableCell, { sx: { fontSize: "0.82rem" }, children: [
725
+ row.mobileNumber,
726
+ " (",
727
+ row.callCount,
728
+ ")"
729
+ ] }),
730
+ /* @__PURE__ */ jsx2(TableCell, { sx: { fontSize: "0.82rem", textTransform: "uppercase" }, children: row.callType }),
731
+ /* @__PURE__ */ jsx2(TableCell, { align: "center", children: /* @__PURE__ */ jsx2(Phone, { sx: { color: "#c0392b", fontSize: 20, cursor: "pointer" } }) })
732
+ ] });
733
+ });
734
+ MissedCallRow.displayName = "MissedCallRow";
735
+ var activePlayers = /* @__PURE__ */ new Set();
736
+ var notifyPlay = (activeId) => {
737
+ activePlayers.forEach((fn) => fn(activeId));
738
+ };
739
+ function ExpandableRow({
740
+ row,
741
+ striped,
742
+ fetchRecording,
743
+ onError
744
+ }) {
745
+ var _a;
746
+ const [open, setOpen] = useState3(false);
747
+ const [audioURL, setAudioURL] = useState3(null);
748
+ const [loadingAudio, setLoadingAudio] = useState3(false);
749
+ const closePlayer = useCallback2(() => {
750
+ setAudioURL((prev) => {
751
+ if (prev && prev.startsWith("blob:")) URL.revokeObjectURL(prev);
752
+ return null;
753
+ });
754
+ }, []);
755
+ useEffect2(() => {
756
+ const onPlay = (activeId) => {
757
+ if (activeId !== row.call_uuid) closePlayer();
758
+ };
759
+ activePlayers.add(onPlay);
760
+ return () => {
761
+ activePlayers.delete(onPlay);
762
+ };
763
+ }, [row.call_uuid, closePlayer]);
764
+ const handlePlay = async () => {
765
+ if (!row.recording.available) return;
766
+ notifyPlay(row.call_uuid);
767
+ setLoadingAudio(true);
768
+ try {
769
+ const blob = await fetchRecording(row.call_uuid);
770
+ setAudioURL(URL.createObjectURL(blob));
771
+ } catch (e) {
772
+ onError("Recording not available");
773
+ } finally {
774
+ setLoadingAudio(false);
775
+ }
776
+ };
777
+ const handleToggle = () => setOpen((prev) => !prev);
778
+ const bg = striped ? "#fafafa" : "white";
779
+ const cellSx = { fontSize: "0.82rem", backgroundColor: bg };
780
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
781
+ /* @__PURE__ */ jsxs2(TableRow, { hover: true, children: [
782
+ /* @__PURE__ */ jsx2(TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { maxWidth: 130 }), children: /* @__PURE__ */ jsx2(Tooltip2, { title: row.call_uuid, arrow: true, children: /* @__PURE__ */ jsx2(
783
+ Typography2,
784
+ {
785
+ noWrap: true,
786
+ sx: { fontSize: 13, maxWidth: 130, overflow: "hidden", textOverflow: "ellipsis" },
787
+ children: row.call_uuid
788
+ }
789
+ ) }) }),
790
+ /* @__PURE__ */ jsx2(TableCell, { sx: cellSx, children: row.mobile_no }),
791
+ /* @__PURE__ */ jsx2(TableCell, { align: "center", sx: cellSx, children: /* @__PURE__ */ jsx2(
792
+ Chip,
793
+ {
794
+ size: "small",
795
+ label: row.call_type,
796
+ color: row.call_type === "INCOMING" ? "success" : "primary"
797
+ }
798
+ ) }),
799
+ /* @__PURE__ */ jsx2(TableCell, { sx: cellSx, children: new Date(row.start_time).toLocaleString() }),
800
+ /* @__PURE__ */ jsx2(TableCell, { sx: cellSx, children: row.end_time ? new Date(row.end_time).toLocaleString() : "\u2014" }),
801
+ /* @__PURE__ */ jsx2(TableCell, { align: "center", sx: cellSx, children: row.recording.available ? /* @__PURE__ */ jsx2(
802
+ IconButton,
803
+ {
804
+ color: "primary",
805
+ onClick: handlePlay,
806
+ disabled: loadingAudio,
807
+ size: "small",
808
+ children: loadingAudio ? /* @__PURE__ */ jsx2(CircularProgress2, { size: 18 }) : /* @__PURE__ */ jsx2(PlayArrow, {})
809
+ }
810
+ ) : /* @__PURE__ */ jsx2(Chip, { size: "small", label: "No File" }) }),
811
+ /* @__PURE__ */ jsx2(TableCell, { align: "center", sx: cellSx, children: (_a = row.agent_id) != null ? _a : "" }),
812
+ /* @__PURE__ */ jsx2(TableCell, { align: "center", sx: cellSx, children: /* @__PURE__ */ jsx2(IconButton, { onClick: handleToggle, size: "small", children: open ? /* @__PURE__ */ jsx2(ExpandLess, {}) : /* @__PURE__ */ jsx2(KeyboardArrowDown, {}) }) })
813
+ ] }),
814
+ audioURL && /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: 8, sx: { p: 0 }, children: /* @__PURE__ */ jsx2(Box2, { p: 2, children: /* @__PURE__ */ jsx2(
815
+ "audio",
816
+ {
817
+ controls: true,
818
+ autoPlay: true,
819
+ src: audioURL,
820
+ onEnded: closePlayer,
821
+ style: { width: "100%" }
822
+ }
823
+ ) }) }) }),
824
+ /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: 8, sx: { p: 0 }, children: /* @__PURE__ */ jsx2(Collapse, { in: open, unmountOnExit: true, children: /* @__PURE__ */ jsx2(Box2, { p: 2, bgcolor: "#f9fafc", borderTop: "1px solid #eee", children: open && /* @__PURE__ */ jsx2(Transcript_default, { row }) }) }) }) })
825
+ ] });
826
+ }
827
+ var CallHistory = () => /* @__PURE__ */ jsx2(SDKProvider, { children: /* @__PURE__ */ jsx2(CallHistoryContent, {}) });
828
+ var callHistory_default = CallHistory;
829
+ export {
830
+ callHistory_default as default
831
+ };
832
+ //# sourceMappingURL=callHistory-HXXRYUIV.mjs.map