ahs-cti 0.0.8 → 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,688 @@
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
+ END_POINT,
13
+ axios_default
14
+ } from "./chunk-F7G2XFRU.mjs";
15
+ import {
16
+ __spreadProps,
17
+ __spreadValues
18
+ } from "./chunk-S4J35V4B.mjs";
19
+
20
+ // call-control-sdk/lib/pages/common/components/AuditReport.tsx
21
+ import { useEffect, useState } from "react";
22
+ import { createPortal } from "react-dom";
23
+ import {
24
+ Avatar,
25
+ Box,
26
+ Typography,
27
+ Table,
28
+ TableBody,
29
+ TableCell,
30
+ TableContainer,
31
+ TableHead,
32
+ TableRow,
33
+ Tabs,
34
+ Tab,
35
+ LinearProgress,
36
+ useTheme,
37
+ Dialog,
38
+ IconButton,
39
+ GlobalStyles,
40
+ CircularProgress,
41
+ Alert,
42
+ ToggleButton,
43
+ ToggleButtonGroup
44
+ } from "@mui/material";
45
+ import { alpha } from "@mui/material/styles";
46
+ import CloseIcon from "@mui/icons-material/Close";
47
+ import LaunchIcon from "@mui/icons-material/Launch";
48
+ import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutlined";
49
+ import HighlightOffIcon from "@mui/icons-material/HighlightOff";
50
+ import RemoveCircleOutlineIcon from "@mui/icons-material/RemoveCircleOutlined";
51
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
52
+ function toStringArray(value) {
53
+ if (!value) return [];
54
+ if (Array.isArray(value)) return value;
55
+ return value.split("\n").map((l) => l.replace(/^\s*[\*\-]\s*/, "").trim()).filter(Boolean);
56
+ }
57
+ var STATUS_COLOUR = {
58
+ completed: { color: "#2e7d32", bg: "#e8f5e9" },
59
+ complied: { color: "#2e7d32", bg: "#e8f5e9" },
60
+ pass: { color: "#2e7d32", bg: "#e8f5e9" },
61
+ compliant: { color: "#2e7d32", bg: "#e8f5e9" },
62
+ achieved: { color: "#2e7d32", bg: "#e8f5e9" },
63
+ strong: { color: "#2e7d32", bg: "#e8f5e9" },
64
+ excellent: { color: "#2e7d32", bg: "#e8f5e9" },
65
+ low: { color: "#2e7d32", bg: "#e8f5e9" },
66
+ no: { color: "#2e7d32", bg: "#e8f5e9" },
67
+ good: { color: "#1565c0", bg: "#e3f2fd" },
68
+ partial: { color: "#e65100", bg: "#fff3e0" },
69
+ moderate: { color: "#e65100", bg: "#fff3e0" },
70
+ medium: { color: "#e65100", bg: "#fff3e0" },
71
+ missed: { color: "#c62828", bg: "#ffebee" },
72
+ fail: { color: "#c62828", bg: "#ffebee" },
73
+ high: { color: "#c62828", bg: "#ffebee" },
74
+ yes: { color: "#c62828", bg: "#ffebee" },
75
+ "n/a": { color: "#757575", bg: "#f5f5f5" },
76
+ na: { color: "#757575", bg: "#f5f5f5" }
77
+ };
78
+ function resolveColour(label) {
79
+ var _a;
80
+ const key = label.toLowerCase().trim();
81
+ if (STATUS_COLOUR[key]) return STATUS_COLOUR[key];
82
+ const stripped = key.replace(/[^a-z]/g, "");
83
+ return (_a = STATUS_COLOUR[stripped]) != null ? _a : { color: "#555", bg: "#f0f0f0" };
84
+ }
85
+ function StatusBadge({ label }) {
86
+ const { color, bg } = resolveColour(label);
87
+ return /* @__PURE__ */ jsx(Box, { sx: { display: "inline-flex", alignItems: "center", px: "7px", py: "2px", borderRadius: "4px", backgroundColor: bg, whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.72rem", fontWeight: 600, color, letterSpacing: "0.02em" }, children: label.toUpperCase() }) });
88
+ }
89
+ function StatusIconBadge({ label }) {
90
+ const key = label.toLowerCase().replace(/[^a-z]/g, "");
91
+ let icon;
92
+ if (key === "complied" || key === "completed" || key === "pass") {
93
+ icon = /* @__PURE__ */ jsx(CheckCircleOutlineIcon, { sx: { fontSize: 15, color: "#2e7d32" } });
94
+ } else if (key === "partial") {
95
+ icon = /* @__PURE__ */ jsx(RemoveCircleOutlineIcon, { sx: { fontSize: 15, color: "#e65100" } });
96
+ } else if (key === "na") {
97
+ icon = /* @__PURE__ */ jsx(RemoveCircleOutlineIcon, { sx: { fontSize: 15, color: "#757575" } });
98
+ } else {
99
+ icon = /* @__PURE__ */ jsx(HighlightOffIcon, { sx: { fontSize: 15, color: "#c62828" } });
100
+ }
101
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "inline-flex", alignItems: "center", gap: "4px" }, children: [
102
+ icon,
103
+ /* @__PURE__ */ jsx(StatusBadge, { label })
104
+ ] });
105
+ }
106
+ function ProgressCell({ value, primary }) {
107
+ const pct = Math.min(Math.round(value.score / value.max * 100), 100);
108
+ const barColor = pct < 80 ? "#c62828" : primary;
109
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 100 }, children: [
110
+ /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: pct, sx: { flex: 1, height: 5, borderRadius: 3, backgroundColor: alpha(barColor, 0.12), "& .MuiLinearProgress-bar": { backgroundColor: barColor, borderRadius: 3 } } }),
111
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: "0.68rem", color: "text.secondary", minWidth: 28, textAlign: "right" }, children: [
112
+ pct,
113
+ "%"
114
+ ] })
115
+ ] });
116
+ }
117
+ var TH = { fontSize: "0.72rem", fontWeight: 700, color: "text.secondary", py: "7px", px: "10px", backgroundColor: "#f5f7f8", borderBottom: "1px solid", borderColor: "divider", whiteSpace: "nowrap" };
118
+ var TD = { fontSize: "0.75rem", color: "text.primary", py: "6px", px: "10px", borderBottom: "1px solid", borderColor: "divider", verticalAlign: "middle" };
119
+ function SectionTitle({ children }) {
120
+ return /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", fontWeight: 700, color: "text.primary", mb: "8px", mt: "4px" }, children });
121
+ }
122
+ function TranscriptBubbles({ text }) {
123
+ const lines = text.split("\n").filter((l) => l.trim().length > 0);
124
+ if (!lines.length) {
125
+ return /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "text.secondary" }, children: "No transcript available." });
126
+ }
127
+ return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexDirection: "column", gap: "6px" }, children: lines.map((line, idx) => {
128
+ const isPatient = line.trim().toLowerCase().startsWith("patient");
129
+ const text2 = line.replace(/^\s*(Patient|Agent)\s*:\s*/i, "");
130
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: isPatient ? "flex-end" : "flex-start", alignItems: "flex-end", gap: "6px" }, children: [
131
+ !isPatient && /* @__PURE__ */ jsx(Avatar, { sx: { width: 22, height: 22, fontSize: 12 } }),
132
+ /* @__PURE__ */ jsx(
133
+ Box,
134
+ {
135
+ sx: (t) => ({
136
+ maxWidth: "70%",
137
+ px: "10px",
138
+ py: "7px",
139
+ borderRadius: isPatient ? "8px 8px 0 8px" : "8px 8px 8px 0",
140
+ backgroundColor: isPatient ? t.palette.primary.main : "#fff",
141
+ color: isPatient ? t.palette.common.white : "#222",
142
+ border: isPatient ? "none" : "1px solid #e0e0e0",
143
+ fontSize: "0.78rem",
144
+ lineHeight: 1.5
145
+ }),
146
+ children: text2
147
+ }
148
+ ),
149
+ isPatient && /* @__PURE__ */ jsx(Avatar, { sx: { width: 22, height: 22, fontSize: 12 } })
150
+ ] }, idx);
151
+ }) });
152
+ }
153
+ function OverviewTab({ data }) {
154
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
155
+ const meta = (_a = data.Audit_Metadata) != null ? _a : {};
156
+ const kvItems = [
157
+ { label: "Hospital Name", value: (_b = meta.Hospital_Name) != null ? _b : "N/A" },
158
+ { label: "Call Duration", value: (_c = meta.Call_Duration) != null ? _c : "N/A" },
159
+ { label: "Department", value: (_d = meta["Process/Department"]) != null ? _d : "N/A" },
160
+ { label: "Agent Name", value: (_e = meta.Agent_Name) != null ? _e : "N/A" },
161
+ { label: "Call Disposition", value: (_f = meta.Call_Disposition) != null ? _f : "N/A" },
162
+ { label: "Employee ID", value: (_g = meta.Employee_ID) != null ? _g : "N/A" },
163
+ { label: "Call Category", value: (_h = meta.Call_Category) != null ? _h : "N/A" },
164
+ { label: "Team Leader", value: (_i = meta.Team_Leader) != null ? _i : "N/A" },
165
+ { label: "Call Type", value: (_j = meta.Call_Type) != null ? _j : "N/A" },
166
+ { label: "Auditor Name", value: (_k = meta.Auditor_Name) != null ? _k : "N/A" },
167
+ { label: "Call Date & Time", value: (_l = meta.Call_Date_Time) != null ? _l : "N/A" },
168
+ { label: "Language", value: (_m = meta.Language) != null ? _m : "N/A" },
169
+ { label: "Recording ID", value: (_n = meta.Recording_ID) != null ? _n : "N/A" }
170
+ ];
171
+ const half = Math.ceil(kvItems.length / 2);
172
+ const col1 = kvItems.slice(0, half);
173
+ const col2 = kvItems.slice(half);
174
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
175
+ /* @__PURE__ */ jsxs(Box, { children: [
176
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Audit Metadata" }),
177
+ /* @__PURE__ */ jsx(Box, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", overflow: "hidden", backgroundColor: "background.paper" }, children: /* @__PURE__ */ jsx(Box, { sx: { display: "flex" }, children: [col1, col2].map((chunk, ci) => /* @__PURE__ */ jsx(Box, { sx: { flex: "1 1 240px", minWidth: 0, borderRight: ci === 0 ? "1px solid" : "none", borderColor: "divider" }, children: chunk.map((item, ii) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "baseline", borderBottom: ii < chunk.length - 1 ? "1px solid" : "none", borderColor: "divider", px: "10px", py: "6px", gap: 1 }, children: [
178
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.72rem", color: "text.secondary", minWidth: 140, flexShrink: 0 }, children: item.label }),
179
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "text.primary", fontWeight: 500 }, children: item.value })
180
+ ] }, ii)) }, ci)) }) })
181
+ ] }),
182
+ /* @__PURE__ */ jsxs(Box, { children: [
183
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Call Summary" }),
184
+ /* @__PURE__ */ jsx(Box, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", backgroundColor: "background.paper", px: "14px", py: "10px", maxHeight: 160, overflowY: "auto" }, children: /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "text.secondary", lineHeight: 1.7 }, children: (_o = data.Call_Summary) != null ? _o : "No summary available." }) })
185
+ ] }),
186
+ /* @__PURE__ */ jsxs(Box, { children: [
187
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Call Transcription" }),
188
+ /* @__PURE__ */ jsx(Box, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", backgroundColor: "#f9f9f9", px: "14px", py: "12px", maxHeight: 320, overflowY: "auto" }, children: /* @__PURE__ */ jsx(TranscriptBubbles, { text: (_p = data.transcript) != null ? _p : "" }) })
189
+ ] })
190
+ ] });
191
+ }
192
+ var SCORECARD_PARAMS = [
193
+ { key: "Opening_and_Greeting", label: "Opening & Greeting", defaultMax: 10 },
194
+ { key: "Verification_and_Authentication", label: "Verification & Authentication", defaultMax: 10 },
195
+ { key: "Communication_and_Soft_Skills", label: "Communication & Soft Skills", defaultMax: 15 },
196
+ { key: "Process_and_Workflow_Adherence", label: "Process & Workflow Adherence", defaultMax: 20 },
197
+ { key: "Resolution_Accuracy", label: "Resolution Accuracy", defaultMax: 20 },
198
+ { key: "Empathy_and_Patient_Assurance", label: "Empathy & Patient Assurance", defaultMax: 10 },
199
+ { key: "Call_Handling", label: "Call Handling", defaultMax: 5 },
200
+ { key: "CRM_Documentation_Alignment", label: "CRM Documentation Alignment", defaultMax: 5 },
201
+ { key: "Closing_and_Customer_Education", label: "Closing & Customer Education", defaultMax: 5 }
202
+ ];
203
+ function ScorecardTab({ data, primary }) {
204
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
205
+ const sc = (_a = data.Quality_Scorecard) != null ? _a : {};
206
+ const summary = (_b = data.Executive_Audit_Summary) != null ? _b : {};
207
+ const rawScore = (_d = (_c = sc.Total_Score) != null ? _c : summary.Overall_Audit_Score_Percentage) != null ? _d : 0;
208
+ const overallScore = typeof rawScore === "string" ? parseFloat(rawScore.replace("%", "")) || 0 : rawScore;
209
+ const pct = Math.min(Math.round(overallScore / 100 * 100), 100);
210
+ const resultBadge = (_f = (_e = summary.Audit_Result) != null ? _e : sc.Final_Rating) != null ? _f : "N/A";
211
+ const metrics = [
212
+ { label: "Audit Result", value: (_g = summary.Audit_Result) != null ? _g : "N/A" },
213
+ { label: "First Call Resolution", value: (_h = summary.First_Call_Resolution_FCR) != null ? _h : "N/A" },
214
+ { label: "Patient Experience", value: (_j = (_i = summary.Customer_Experience) != null ? _i : summary.Patient_Sentiment) != null ? _j : "N/A" },
215
+ { label: "Process Adherence", value: (_k = summary.Process_Adherence) != null ? _k : "N/A" },
216
+ { label: "Effective Communication", value: (_l = summary.Communication_Effectiveness) != null ? _l : "N/A" }
217
+ ];
218
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2.5 }, children: [
219
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 2, flexWrap: "wrap", alignItems: "stretch" }, children: [
220
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", border: "1px solid", borderColor: "divider", borderRadius: "8px", backgroundColor: "background.paper", px: 3, py: 2, minWidth: 140, gap: 0.5 }, children: [
221
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.72rem", color: "text.secondary", fontWeight: 600, mb: 0.5, letterSpacing: "0.04em" }, children: "OVERALL SCORE" }),
222
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "baseline", gap: "3px" }, children: [
223
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "2.4rem", fontWeight: 700, color: primary, lineHeight: 1 }, children: overallScore }),
224
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.85rem", color: "text.secondary", fontWeight: 600 }, children: "/100" })
225
+ ] }),
226
+ /* @__PURE__ */ jsx(Box, { sx: { width: "100%", mt: 0.75 }, children: /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: pct, sx: { height: 6, borderRadius: 3, backgroundColor: alpha(primary, 0.12), "& .MuiLinearProgress-bar": { backgroundColor: primary, borderRadius: 3 } } }) }),
227
+ /* @__PURE__ */ jsx(Box, { sx: { mt: 0.75 }, children: /* @__PURE__ */ jsx(StatusBadge, { label: resultBadge }) })
228
+ ] }),
229
+ /* @__PURE__ */ jsxs(Box, { sx: { flex: 1, minWidth: 260, display: "flex", flexDirection: "column", gap: "8px", alignSelf: "stretch" }, children: [
230
+ /* @__PURE__ */ jsx(Box, { sx: { flex: 1, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "8px" }, children: metrics.slice(0, 3).map((m) => /* @__PURE__ */ jsxs(Box, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "6px", backgroundColor: "background.paper", px: "10px", py: "8px", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "6px" }, children: [
231
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.72rem", color: "text.secondary", lineHeight: 1.3, textAlign: "center" }, children: m.label }),
232
+ /* @__PURE__ */ jsx(StatusBadge, { label: m.value })
233
+ ] }, m.label)) }),
234
+ /* @__PURE__ */ jsx(Box, { sx: { flex: 1, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "8px" }, children: metrics.slice(3).map((m) => /* @__PURE__ */ jsxs(Box, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "6px", backgroundColor: "background.paper", px: "10px", py: "8px", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "6px" }, children: [
235
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.72rem", color: "text.secondary", lineHeight: 1.3, textAlign: "center" }, children: m.label }),
236
+ /* @__PURE__ */ jsx(StatusBadge, { label: m.value })
237
+ ] }, m.label)) })
238
+ ] })
239
+ ] }),
240
+ /* @__PURE__ */ jsxs(Box, { children: [
241
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Quality Scorecard" }),
242
+ /* @__PURE__ */ jsx(TableContainer, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", overflow: "hidden" }, children: /* @__PURE__ */ jsxs(Table, { size: "small", children: [
243
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: [
244
+ { label: "Evaluation Parameter", align: "left", minWidth: 180 },
245
+ { label: "Weightage", align: "center", minWidth: 90 },
246
+ { label: "Score", align: "center", minWidth: 80 },
247
+ { label: "", align: "left", minWidth: 120 },
248
+ { label: "Remarks", align: "left", minWidth: 160 }
249
+ ].map((col, i) => /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TH), { textAlign: col.align, minWidth: col.minWidth }), children: col.label }, i)) }) }),
250
+ /* @__PURE__ */ jsxs(TableBody, { children: [
251
+ SCORECARD_PARAMS.map((p) => {
252
+ var _a2, _b2;
253
+ const entry = sc[p.key];
254
+ const rawEntryScore = entry == null ? void 0 : entry.Score_Obtained;
255
+ const score = typeof rawEntryScore === "string" ? parseFloat(rawEntryScore) || 0 : rawEntryScore != null ? rawEntryScore : 0;
256
+ const max = (_a2 = entry == null ? void 0 : entry.Weightage) != null ? _a2 : p.defaultMax;
257
+ return /* @__PURE__ */ jsxs(TableRow, { children: [
258
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: p.label }),
259
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TD), { textAlign: "center" }), children: max }),
260
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TD), { textAlign: "center" }), children: rawEntryScore != null ? rawEntryScore : "\u2014" }),
261
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: /* @__PURE__ */ jsx(ProgressCell, { value: { score, max }, primary }) }),
262
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: (_b2 = entry == null ? void 0 : entry.Remarks) != null ? _b2 : "\u2014" })
263
+ ] }, p.key);
264
+ }),
265
+ /* @__PURE__ */ jsxs(TableRow, { sx: { backgroundColor: "#f5f7f8", "& td": { borderBottom: 0 } }, children: [
266
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TD), { fontWeight: 700 }), children: "Total Score" }),
267
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TD), { textAlign: "center", fontWeight: 700 }), children: "100" }),
268
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TD), { textAlign: "center", fontWeight: 700 }), children: overallScore }),
269
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: /* @__PURE__ */ jsx(ProgressCell, { value: { score: overallScore, max: 100 }, primary }) }),
270
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TD), { fontWeight: 700 }), children: /* @__PURE__ */ jsx(StatusBadge, { label: (_m = sc.Final_Rating) != null ? _m : resultBadge }) })
271
+ ] })
272
+ ] })
273
+ ] }) })
274
+ ] })
275
+ ] });
276
+ }
277
+ var OPENING_LABELS = { Standard_Greeting_Used: "Standard Greeting Used", Hospital_Name_Mentioned: "Hospital Name Mentioned", Agent_Introduction_Provided: "Agent Introduction Provided", Professional_Tone_Maintained: "Professional Tone Maintained" };
278
+ var OPENING_EXPECTED = { Standard_Greeting_Used: "Agent must greet as per approved hospital script", Hospital_Name_Mentioned: "Mandatory hospital identification", Agent_Introduction_Provided: "Agent must introduce self", Professional_Tone_Maintained: "Warm and professional tone expected" };
279
+ var VERIFICATION_LABELS = { Patient_Name_Captured: "Patient Name Captured", "Existing_New_Patient_Validation": "Existing/New Patient Validation", Registered_Mobile_Number_Verified: "Registered Mobile Number Verified", "Secondary_Authentication_DOB_UHID": "Secondary Authentication (DOB/UHID)" };
280
+ var VERIFICATION_EXPECTED = { Patient_Name_Captured: "Mandatory for identification", "Existing_New_Patient_Validation": "Required for workflow routing", Registered_Mobile_Number_Verified: "Mandatory authentication step", "Secondary_Authentication_DOB_UHID": "Recommended compliance practice" };
281
+ var COMM_LABELS = { Clarity_of_Speech: "Clarity of Speech", Active_Listening_Demonstrated: "Active Listening Demonstrated", Avoidance_of_Dead_Air: "Avoidance of Dead Air", Professional_Language_Usage: "Professional Language Usage", Empathy_Statements_Used: "Empathy Statements Used" };
282
+ var COMM_EXPECTED = { Clarity_of_Speech: "Clear and understandable communication", Active_Listening_Demonstrated: "Agent should acknowledge caller inputs", Avoidance_of_Dead_Air: "Minimal silence during call", Professional_Language_Usage: "No slang/rude language", Empathy_Statements_Used: "Emotional acknowledgement expected" };
283
+ var EMPATHY_LABELS = { Patient_Concern_Acknowledged: "Patient Concern Acknowledged", Empathy_Toward_Patient_Condition: "Empathy Toward Patient Condition", Severity_Red_Flag_Probing: "Severity/Red Flag Probing", Professional_Behaviour_Maintained: "Professional Behaviour Maintained" };
284
+ var EMPATHY_EXPECTED = { Patient_Concern_Acknowledged: "Agent should acknowledge caller concern", Empathy_Toward_Patient_Condition: "Empathetic reassurance expected", Severity_Red_Flag_Probing: "Escalation probing recommended where applicable", Professional_Behaviour_Maintained: "Calm and respectful handling required" };
285
+ var CALL_HANDLING_LABELS = { "Placing the Call on Hold": "Placing the Call on Hold", Resuming_After_Hold: "Resuming After Hold", Apologizing_for_Inconvenience: "Apologizing for Inconvenience", Offering_Further_Assistance: "Offering Further Assistance" };
286
+ var CALL_HANDLING_EXPECTED = { "Placing the Call on Hold": "Inform customer before placing on hold", Resuming_After_Hold: "Thank customer for holding", Apologizing_for_Inconvenience: "Apologize for any delays", Offering_Further_Assistance: "Ask if further help is needed" };
287
+ var CLOSURE_LABELS = { Additional_Assistance_Offered: "Additional Assistance Offered", Professional_Closing_Provided: "Professional Closing Provided", "Wellness/Courtesy_Statement_Used": "Wellness/Courtesy Statement Used" };
288
+ var CLOSURE_EXPECTED = { Additional_Assistance_Offered: "Mandatory closure check", Professional_Closing_Provided: "Standard closure etiquette expected", "Wellness/Courtesy_Statement_Used": "Positive healthcare closure preferred" };
289
+ var EXCLUDED_KEYS = /* @__PURE__ */ new Set(["Patient_Data_Handling", "Recontact_Information_Shared"]);
290
+ function obsRecordToRows(record, labelMap, expectedMap) {
291
+ return Object.entries(record != null ? record : {}).filter(([key]) => !EXCLUDED_KEYS.has(key)).map(([key, val]) => {
292
+ var _a, _b, _c, _d, _e;
293
+ return {
294
+ parameter: (_a = labelMap[key]) != null ? _a : key.replace(/_/g, " "),
295
+ expectedStandard: (_b = expectedMap[key]) != null ? _b : "\u2014",
296
+ status: (_c = val.Status) != null ? _c : "N/A",
297
+ remarks: (_d = val.Remarks) != null ? _d : "\u2014",
298
+ qaObservation: (_e = val.Observation_Impact) != null ? _e : "\u2014"
299
+ };
300
+ });
301
+ }
302
+ function processWorkflowRows(groups) {
303
+ return (groups != null ? groups : []).flatMap(
304
+ (g) => {
305
+ var _a;
306
+ return ((_a = g == null ? void 0 : g.items) != null ? _a : []).map((item) => {
307
+ var _a2, _b, _c, _d, _e;
308
+ return {
309
+ parameter: (_a2 = item.parameter) != null ? _a2 : "\u2014",
310
+ expectedStandard: (_b = item.expectedStandard) != null ? _b : "\u2014",
311
+ status: (_c = item.status) != null ? _c : "N/A",
312
+ remarks: (_d = item.remarks) != null ? _d : "\u2014",
313
+ qaObservation: (_e = item.qaObservation) != null ? _e : "\u2014"
314
+ };
315
+ });
316
+ }
317
+ );
318
+ }
319
+ var CHECKLIST_COLS = [
320
+ { key: "parameter", label: "Audit Parameter", minWidth: 180 },
321
+ { key: "expectedStandard", label: "Expected Standard", minWidth: 200 },
322
+ { key: "status", label: "Status", minWidth: 130 },
323
+ { key: "remarks", label: "Remarks", minWidth: 160 },
324
+ { key: "qaObservation", label: "QA Observation / Impact", minWidth: 180 }
325
+ ];
326
+ function ChecklistTable({ title, rows }) {
327
+ const visibleRows = rows;
328
+ if (!visibleRows.length) return null;
329
+ return /* @__PURE__ */ jsxs(Box, { children: [
330
+ /* @__PURE__ */ jsx(SectionTitle, { children: title }),
331
+ /* @__PURE__ */ jsx(TableContainer, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", overflow: "hidden" }, children: /* @__PURE__ */ jsxs(Table, { size: "small", children: [
332
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: CHECKLIST_COLS.map((col) => /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TH), { minWidth: col.minWidth }), children: col.label }, col.key)) }) }),
333
+ /* @__PURE__ */ jsx(TableBody, { children: visibleRows.map((row, ri) => /* @__PURE__ */ jsxs(TableRow, { sx: { "&:last-child td": { borderBottom: 0 } }, children: [
334
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: row.parameter }),
335
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: row.expectedStandard }),
336
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: /* @__PURE__ */ jsx(StatusIconBadge, { label: row.status }) }),
337
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: row.remarks }),
338
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: row.qaObservation })
339
+ ] }, ri)) })
340
+ ] }) })
341
+ ] });
342
+ }
343
+ function DispositionFrameworkTable({ data }) {
344
+ var _a;
345
+ const rows = ((_a = data.Disposition_Based_Quality_Framework) != null ? _a : []).flatMap(
346
+ (df) => {
347
+ var _a2;
348
+ return ((_a2 = df == null ? void 0 : df.frameworks) != null ? _a2 : []).map((fw) => {
349
+ var _a3, _b, _c, _d;
350
+ return {
351
+ dispositionType: (_a3 = df.dispositionType) != null ? _a3 : "\u2014",
352
+ expectedFramework: (_b = fw.expectedFramework) != null ? _b : "\u2014",
353
+ status: (_c = fw.status) != null ? _c : "N/A",
354
+ remarks: (_d = fw.remarks) != null ? _d : "\u2014"
355
+ };
356
+ });
357
+ }
358
+ ).filter((r) => r.expectedFramework.toLowerCase().trim() !== "clinical sensitivity handling");
359
+ if (!rows.length) {
360
+ return /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "text.secondary" }, children: "No disposition framework data available." });
361
+ }
362
+ return /* @__PURE__ */ jsxs(Box, { children: [
363
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Disposition-Based Quality Framework" }),
364
+ /* @__PURE__ */ jsx(TableContainer, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", overflow: "hidden" }, children: /* @__PURE__ */ jsxs(Table, { size: "small", children: [
365
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: [
366
+ { label: "Disposition Type", minWidth: 160 },
367
+ { label: "Expected Framework", minWidth: 200 },
368
+ { label: "Status", minWidth: 120 },
369
+ { label: "Remarks", minWidth: 160 }
370
+ ].map((col, i) => /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TH), { minWidth: col.minWidth }), children: col.label }, i)) }) }),
371
+ /* @__PURE__ */ jsx(TableBody, { children: rows.map((row, ri) => /* @__PURE__ */ jsxs(TableRow, { sx: { "&:last-child td": { borderBottom: 0 } }, children: [
372
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: row.dispositionType }),
373
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: row.expectedFramework }),
374
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: /* @__PURE__ */ jsx(StatusIconBadge, { label: row.status }) }),
375
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: row.remarks })
376
+ ] }, ri)) })
377
+ ] }) })
378
+ ] });
379
+ }
380
+ function AuditChecklistContent({ data }) {
381
+ var _a;
382
+ const obs = (_a = data.Section_Wise_Audit_Observations_Checklist) != null ? _a : {};
383
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
384
+ /* @__PURE__ */ jsx(DispositionFrameworkTable, { data }),
385
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Opening & Greeting", rows: obsRecordToRows(obs.Opening_and_Greeting, OPENING_LABELS, OPENING_EXPECTED) }),
386
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Verification & Authentication", rows: obsRecordToRows(obs.Verification_and_Authentication, VERIFICATION_LABELS, VERIFICATION_EXPECTED) }),
387
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Communication Effectiveness", rows: obsRecordToRows(obs.Communication_and_Soft_Skills, COMM_LABELS, COMM_EXPECTED) }),
388
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Process & Workflow Adherence", rows: processWorkflowRows(obs.Process_and_Workflow_Adherence) }),
389
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Empathy & Patient Assurance", rows: obsRecordToRows(obs.Empathy_and_Patient_Assurance, EMPATHY_LABELS, EMPATHY_EXPECTED) }),
390
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Call Handling", rows: obsRecordToRows(obs.Call_Handling, CALL_HANDLING_LABELS, CALL_HANDLING_EXPECTED) }),
391
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Call Closure & Customer Education", rows: obsRecordToRows(obs.Call_Closure_and_Customer_Education, CLOSURE_LABELS, CLOSURE_EXPECTED) })
392
+ ] });
393
+ }
394
+ function AuditChecklistTab({ data, primary: _primary }) {
395
+ var _a;
396
+ const [view, setView] = useState("overview");
397
+ const obs = (_a = data.Section_Wise_Audit_Observations_Checklist) != null ? _a : {};
398
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
399
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "flex-start" }, children: /* @__PURE__ */ jsxs(
400
+ ToggleButtonGroup,
401
+ {
402
+ value: view,
403
+ exclusive: true,
404
+ onChange: (_, v) => v && setView(v),
405
+ size: "small",
406
+ sx: {
407
+ "& .MuiToggleButton-root": {
408
+ fontSize: "0.72rem",
409
+ fontWeight: 600,
410
+ textTransform: "none",
411
+ px: 1.5,
412
+ py: "4px",
413
+ border: "1px solid",
414
+ borderColor: "divider",
415
+ color: "text.secondary",
416
+ "&.Mui-selected": { backgroundColor: _primary, color: "#fff", borderColor: _primary, "&:hover": { backgroundColor: _primary } }
417
+ }
418
+ },
419
+ children: [
420
+ /* @__PURE__ */ jsx(ToggleButton, { value: "overview", children: "Overview" }),
421
+ /* @__PURE__ */ jsx(ToggleButton, { value: "detailed", children: "Detailed" })
422
+ ]
423
+ }
424
+ ) }),
425
+ view === "overview" && /* @__PURE__ */ jsx(DispositionFrameworkTable, { data }),
426
+ view === "detailed" && /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
427
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Opening & Greeting", rows: obsRecordToRows(obs.Opening_and_Greeting, OPENING_LABELS, OPENING_EXPECTED) }),
428
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Verification & Authentication", rows: obsRecordToRows(obs.Verification_and_Authentication, VERIFICATION_LABELS, VERIFICATION_EXPECTED) }),
429
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Communication Effectiveness", rows: obsRecordToRows(obs.Communication_and_Soft_Skills, COMM_LABELS, COMM_EXPECTED) }),
430
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Process & Workflow Adherence", rows: processWorkflowRows(obs.Process_and_Workflow_Adherence) }),
431
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Empathy & Patient Assurance", rows: obsRecordToRows(obs.Empathy_and_Patient_Assurance, EMPATHY_LABELS, EMPATHY_EXPECTED) }),
432
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Call Handling", rows: obsRecordToRows(obs.Call_Handling, CALL_HANDLING_LABELS, CALL_HANDLING_EXPECTED) }),
433
+ /* @__PURE__ */ jsx(ChecklistTable, { title: "Call Closure & Customer Education", rows: obsRecordToRows(obs.Call_Closure_and_Customer_Education, CLOSURE_LABELS, CLOSURE_EXPECTED) })
434
+ ] })
435
+ ] });
436
+ }
437
+ function RootCauseAnalysisTab({ data, primary }) {
438
+ var _a, _b;
439
+ const rcaRows = (_a = data.Root_Cause_Analysis) != null ? _a : [];
440
+ const rec = (_b = data.Auditor_Recommendation) != null ? _b : {};
441
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
442
+ /* @__PURE__ */ jsxs(Box, { children: [
443
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Root Cause Analysis" }),
444
+ rcaRows.length > 0 ? /* @__PURE__ */ jsx(TableContainer, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", overflow: "hidden" }, children: /* @__PURE__ */ jsxs(Table, { size: "small", children: [
445
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: [{ label: "Observation", minWidth: 180 }, { label: "Root Cause", minWidth: 200 }, { label: "Impact", minWidth: 200 }, { label: "Severity", minWidth: 90 }].map((col, i) => /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TH), { minWidth: col.minWidth }), children: col.label }, i)) }) }),
446
+ /* @__PURE__ */ jsx(TableBody, { children: rcaRows.map((row, ri) => {
447
+ var _a2, _b2, _c;
448
+ return /* @__PURE__ */ jsxs(TableRow, { sx: { "&:last-child td": { borderBottom: 0 } }, children: [
449
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: (_a2 = row.Observation) != null ? _a2 : "\u2014" }),
450
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: (_b2 = row.Root_Cause) != null ? _b2 : "\u2014" }),
451
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadValues({}, TD), children: (_c = row.Impact) != null ? _c : "\u2014" }),
452
+ /* @__PURE__ */ jsx(TableCell, { sx: __spreadProps(__spreadValues({}, TD), { textAlign: "center" }), children: row.Severity ? /* @__PURE__ */ jsx(StatusBadge, { label: row.Severity }) : "\u2014" })
453
+ ] }, ri);
454
+ }) })
455
+ ] }) }) : /* @__PURE__ */ jsx(Box, { sx: { border: "1px solid", borderColor: "divider", borderRadius: "8px", px: "14px", py: "10px", backgroundColor: "background.paper" }, children: /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "text.secondary" }, children: "No significant root causes identified for this interaction." }) })
456
+ ] }),
457
+ (toStringArray(rec.Key_Strengths).length > 0 || toStringArray(rec.Improvement_Areas).length > 0) && /* @__PURE__ */ jsxs(Box, { children: [
458
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Auditor's Recommendation" }),
459
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", gap: 2, flexWrap: "wrap" }, children: [
460
+ { title: "Key Strengths", items: toStringArray(rec.Key_Strengths), color: "#2e7d32" },
461
+ { title: "Improvement Areas", items: toStringArray(rec.Improvement_Areas), color: "#e65100" }
462
+ ].filter((g) => {
463
+ var _a2, _b2;
464
+ return ((_b2 = (_a2 = g.items) == null ? void 0 : _a2.length) != null ? _b2 : 0) > 0;
465
+ }).map((g) => {
466
+ var _a2;
467
+ return /* @__PURE__ */ jsxs(Box, { sx: { flex: "1 1 200px", border: "1px solid", borderColor: "divider", borderRadius: "6px", backgroundColor: "background.paper", px: "14px", py: "10px" }, children: [
468
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", fontWeight: 600, color: "text.primary", mb: "8px" }, children: g.title }),
469
+ (_a2 = g.items) == null ? void 0 : _a2.map((item, ii) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "flex-start", gap: "7px", mb: "5px" }, children: [
470
+ /* @__PURE__ */ jsx(Box, { sx: { width: 5, height: 5, borderRadius: "50%", backgroundColor: g.color, mt: "5px", flexShrink: 0 } }),
471
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "text.secondary", lineHeight: 1.5 }, children: item })
472
+ ] }, ii))
473
+ ] }, g.title);
474
+ }) })
475
+ ] }),
476
+ data.Final_Auditor_Remarks && /* @__PURE__ */ jsxs(Box, { sx: { border: "1px solid", borderLeft: "3px solid", borderColor: "divider", borderLeftColor: primary, borderRadius: "6px", px: "14px", py: "10px", backgroundColor: alpha(primary, 0.04) }, children: [
477
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", fontWeight: 600, color: primary, mb: "6px" }, children: "Final Auditor Remarks" }),
478
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.75rem", color: "text.secondary", lineHeight: 1.6 }, children: data.Final_Auditor_Remarks })
479
+ ] })
480
+ ] });
481
+ }
482
+ var STATIC_TABS = [
483
+ { id: "overview", label: "Overview" },
484
+ { id: "scorecard", label: "Scorecard" },
485
+ { id: "checklist", label: "Audit Checklist" },
486
+ { id: "rca", label: "Root Cause Analysis" }
487
+ ];
488
+ function useAuditReportData(callUuid, active = true) {
489
+ const [activeTab, setActiveTab] = useState(0);
490
+ const [apiData, setApiData] = useState(null);
491
+ const [auditLoading, setAuditLoading] = useState(false);
492
+ const [auditError, setAuditError] = useState(null);
493
+ useEffect(() => {
494
+ setApiData(null);
495
+ setAuditError(null);
496
+ setActiveTab(0);
497
+ if (!active || !callUuid) return;
498
+ let cancelled = false;
499
+ setAuditLoading(true);
500
+ axios_default.get(END_POINT.CALLSAGE_AUDIT(callUuid)).then((res) => {
501
+ if (!cancelled) setApiData(res.data);
502
+ }).catch((err) => {
503
+ var _a, _b, _c, _d;
504
+ if (!cancelled) setAuditError((_d = (_c = (_b = (_a = err == null ? void 0 : err.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) != null ? _c : err == null ? void 0 : err.message) != null ? _d : "Failed to generate audit report");
505
+ }).finally(() => {
506
+ if (!cancelled) setAuditLoading(false);
507
+ });
508
+ return () => {
509
+ cancelled = true;
510
+ };
511
+ }, [active, callUuid]);
512
+ return { activeTab, setActiveTab, apiData, auditLoading, auditError };
513
+ }
514
+ var PRINT_ROOT_ID = "audit-report-print-root";
515
+ var PRINT_STYLES = /* @__PURE__ */ jsx(
516
+ GlobalStyles,
517
+ {
518
+ styles: {
519
+ [`#${PRINT_ROOT_ID}`]: { position: "absolute", width: "1px", height: "1px", overflow: "hidden", clip: "rect(0 0 0 0)", clipPath: "inset(50%)", whiteSpace: "nowrap", pointerEvents: "none" },
520
+ "@media print": {
521
+ "body *": { visibility: "hidden" },
522
+ [`#${PRINT_ROOT_ID}`]: { visibility: "visible", position: "absolute", top: 0, left: 0, width: "100%", height: "auto", overflow: "visible", clip: "auto", clipPath: "none", whiteSpace: "normal", padding: "0 8mm", boxSizing: "border-box" },
523
+ [`#${PRINT_ROOT_ID} *`]: { visibility: "visible", printColorAdjust: "exact", WebkitPrintColorAdjust: "exact" }
524
+ }
525
+ }
526
+ }
527
+ );
528
+ function buildHeaderBadges(data) {
529
+ var _a, _b, _c, _d, _e, _f, _g;
530
+ const sc = (_a = data.Quality_Scorecard) != null ? _a : {};
531
+ const summary = (_b = data.Executive_Audit_Summary) != null ? _b : {};
532
+ const meta = (_c = data.Audit_Metadata) != null ? _c : {};
533
+ return [
534
+ { label: "Call Disposition", value: (_d = meta.Call_Disposition) != null ? _d : "N/A" },
535
+ { label: "Result", value: (_e = summary.Audit_Result) != null ? _e : "N/A", asBadge: true },
536
+ { label: "Score", value: `${(_g = (_f = sc.Total_Score) != null ? _f : summary.Overall_Audit_Score_Percentage) != null ? _g : 0}/100` }
537
+ ];
538
+ }
539
+ function AuditReportInner({ callUuid, active = true, primary, onClose, onMaximize }) {
540
+ var _a, _b, _c;
541
+ const { activeTab, setActiveTab, apiData, auditLoading, auditError } = useAuditReportData(callUuid, active);
542
+ const headerBadges = apiData ? buildHeaderBadges(apiData) : [];
543
+ const subtitle = apiData ? [(_a = apiData.Audit_Metadata) == null ? void 0 : _a.Agent_Name, (_b = apiData.Audit_Metadata) == null ? void 0 : _b.Hospital_Name, (_c = apiData.Audit_Metadata) == null ? void 0 : _c.Call_Date_Time].filter(Boolean).join(" \xB7 ") || void 0 : void 0;
544
+ const iconButtonSx = {
545
+ flexShrink: 0,
546
+ width: 28,
547
+ height: 28,
548
+ borderRadius: "6px",
549
+ backgroundColor: "action.hover",
550
+ color: "text.secondary",
551
+ "&:hover": { backgroundColor: "action.selected", color: "text.primary" },
552
+ transition: "all 0.15s ease"
553
+ };
554
+ function renderTab() {
555
+ if (!apiData) return null;
556
+ switch (activeTab) {
557
+ case 0:
558
+ return /* @__PURE__ */ jsx(OverviewTab, { data: apiData });
559
+ case 1:
560
+ return /* @__PURE__ */ jsx(ScorecardTab, { data: apiData, primary });
561
+ case 2:
562
+ return /* @__PURE__ */ jsx(AuditChecklistTab, { data: apiData, primary });
563
+ case 3:
564
+ return /* @__PURE__ */ jsx(RootCauseAnalysisTab, { data: apiData, primary });
565
+ default:
566
+ return null;
567
+ }
568
+ }
569
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
570
+ PRINT_STYLES,
571
+ createPortal(
572
+ /* @__PURE__ */ jsxs("div", { id: PRINT_ROOT_ID, children: [
573
+ /* @__PURE__ */ jsxs(Box, { sx: { mb: 2.5, pb: 1.5, borderBottom: "2px solid", borderColor: "divider" }, children: [
574
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "1.2rem", fontWeight: 700, color: "text.primary" }, children: "Audit Report" }),
575
+ subtitle && /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.8rem", color: "text.secondary", mt: "4px" }, children: subtitle })
576
+ ] }),
577
+ apiData && /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
578
+ /* @__PURE__ */ jsx(OverviewTab, { data: apiData }),
579
+ /* @__PURE__ */ jsx(ScorecardTab, { data: apiData, primary }),
580
+ /* @__PURE__ */ jsxs(Box, { children: [
581
+ /* @__PURE__ */ jsx(SectionTitle, { children: "Audit Checklist" }),
582
+ /* @__PURE__ */ jsx(AuditChecklistContent, { data: apiData })
583
+ ] }),
584
+ /* @__PURE__ */ jsx(RootCauseAnalysisTab, { data: apiData, primary })
585
+ ] })
586
+ ] }),
587
+ document.body
588
+ ),
589
+ /* @__PURE__ */ jsxs(Box, { sx: { px: { xs: 2, md: 2.5 }, py: "12px", display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 1, borderBottom: "1px solid", borderColor: "divider", flexShrink: 0 }, children: [
590
+ /* @__PURE__ */ jsxs(Box, { sx: { minWidth: 0 }, children: [
591
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 700, fontSize: { xs: "1rem", sm: "1.2rem" }, color: "text.primary", lineHeight: 1.3 }, children: "Audit Report" }),
592
+ subtitle && /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", color: "text.secondary", mt: "3px" }, children: subtitle })
593
+ ] }),
594
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.75, flexShrink: 0 }, children: [
595
+ onMaximize && /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: onMaximize, title: "Open in new tab", sx: iconButtonSx, children: /* @__PURE__ */ jsx(LaunchIcon, { sx: { fontSize: 14 } }) }),
596
+ onClose && /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: onClose, title: "Close", sx: iconButtonSx, children: /* @__PURE__ */ jsx(CloseIcon, { sx: { fontSize: 15 } }) })
597
+ ] })
598
+ ] }),
599
+ headerBadges.length > 0 && /* @__PURE__ */ jsx(Box, { sx: { px: { xs: 2, md: 2.5 }, py: "8px", display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap", borderBottom: "1px solid", borderColor: "divider", backgroundColor: "#f5f7f8", flexShrink: 0 }, children: headerBadges.map(
600
+ (badge, i) => badge.asBadge ? /* @__PURE__ */ jsx(StatusBadge, { label: badge.value }, i) : /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: "5px", px: "9px", height: 26, border: "1px solid", borderColor: "divider", borderRadius: "5px", backgroundColor: "background.paper" }, children: [
601
+ /* @__PURE__ */ jsx(Box, { sx: { width: 5, height: 5, borderRadius: "50%", backgroundColor: primary, flexShrink: 0 } }),
602
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontSize: "0.72rem", color: "text.secondary", whiteSpace: "nowrap" }, children: [
603
+ /* @__PURE__ */ jsxs(Box, { component: "span", sx: { fontWeight: 600, color: "text.primary", mr: "3px" }, children: [
604
+ badge.label,
605
+ ":"
606
+ ] }),
607
+ badge.value
608
+ ] })
609
+ ] }, i)
610
+ ) }),
611
+ /* @__PURE__ */ jsx(Box, { sx: { borderBottom: "1px solid", borderColor: "divider", backgroundColor: "background.paper", flexShrink: 0 }, children: /* @__PURE__ */ jsx(
612
+ Tabs,
613
+ {
614
+ value: activeTab,
615
+ onChange: (_, v) => setActiveTab(v),
616
+ variant: "scrollable",
617
+ scrollButtons: "auto",
618
+ sx: {
619
+ minHeight: 40,
620
+ px: { xs: 1, md: 2 },
621
+ "& .MuiTab-root": { fontSize: "0.78rem", fontWeight: 600, minHeight: 40, textTransform: "none", color: "text.secondary", py: 0, px: 1.5, "&.Mui-selected": { color: primary } },
622
+ "& .MuiTabs-indicator": { backgroundColor: primary, height: 2 }
623
+ },
624
+ children: STATIC_TABS.map((tab) => /* @__PURE__ */ jsx(Tab, { label: tab.label, disableRipple: true }, tab.id))
625
+ }
626
+ ) }),
627
+ /* @__PURE__ */ jsxs(Box, { sx: { flex: 1, overflow: "auto", px: { xs: 2, md: 2.5 }, py: 2 }, children: [
628
+ auditLoading && /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", py: 6 }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 32 }) }),
629
+ !auditLoading && auditError && /* @__PURE__ */ jsx(Alert, { severity: "warning", sx: { mb: 2, fontSize: "0.78rem" }, children: auditError }),
630
+ !auditLoading && !auditError && !apiData && /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", py: 6 }, children: /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.78rem", color: "text.secondary" }, children: "No audit data available." }) }),
631
+ !auditLoading && apiData && renderTab()
632
+ ] })
633
+ ] });
634
+ }
635
+ var auditReportUrlResolver = (callUuid) => `/audit-report/${encodeURIComponent(callUuid)}`;
636
+ function setAuditReportUrlResolver(resolver) {
637
+ auditReportUrlResolver = resolver;
638
+ }
639
+ function AuditReportDialog({ open, onClose, width = "80vw", rowData, onMaximize }) {
640
+ const theme = useTheme();
641
+ const primary = theme.palette.primary.main;
642
+ const callUuid = rowData == null ? void 0 : rowData.callUuid;
643
+ const handleMaximize = () => {
644
+ if (!callUuid) return;
645
+ if (onMaximize) {
646
+ onMaximize(callUuid);
647
+ return;
648
+ }
649
+ window.open(auditReportUrlResolver(callUuid), "_blank");
650
+ };
651
+ return /* @__PURE__ */ jsx(
652
+ Dialog,
653
+ {
654
+ open,
655
+ onClose: (_e, reason) => {
656
+ if (reason !== "backdropClick") onClose();
657
+ },
658
+ fullWidth: true,
659
+ slotProps: {
660
+ paper: {
661
+ sx: { width, maxWidth: width, height: "90vh", display: "flex", flexDirection: "column", overflow: "hidden", borderRadius: "10px" }
662
+ }
663
+ },
664
+ children: open && /* @__PURE__ */ jsx(
665
+ AuditReportInner,
666
+ {
667
+ callUuid,
668
+ active: open,
669
+ primary,
670
+ onClose,
671
+ onMaximize: callUuid ? handleMaximize : void 0
672
+ }
673
+ )
674
+ }
675
+ );
676
+ }
677
+ function AuditReportFullPage({ callUuid }) {
678
+ const theme = useTheme();
679
+ const primary = theme.palette.primary.main;
680
+ return /* @__PURE__ */ jsx(Box, { sx: { height: "100vh", display: "flex", flexDirection: "column", overflow: "hidden", backgroundColor: "background.paper" }, children: /* @__PURE__ */ jsx(AuditReportInner, { callUuid, active: true, primary }) });
681
+ }
682
+
683
+ export {
684
+ setAuditReportUrlResolver,
685
+ AuditReportDialog,
686
+ AuditReportFullPage
687
+ };
688
+ //# sourceMappingURL=chunk-EN7HM2MD.mjs.map