ahs-cti 1.0.1-beta.6 → 1.0.1-beta.61
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.
- package/dist/agentDetailReport-F44HMQ5O.mjs +27 -0
- package/dist/agentDetailReport-F44HMQ5O.mjs.map +1 -0
- package/dist/agentPerformanceReport-TTOMNENK.mjs +561 -0
- package/dist/agentPerformanceReport-TTOMNENK.mjs.map +1 -0
- package/dist/auditReport-QTMAKVTN.mjs +26 -0
- package/dist/auditReport-QTMAKVTN.mjs.map +1 -0
- package/dist/callHistory-4J4J2XHA.mjs +835 -0
- package/dist/callHistory-4J4J2XHA.mjs.map +1 -0
- package/dist/campaigns-N3UNUGQP.mjs +3194 -0
- package/dist/campaigns-N3UNUGQP.mjs.map +1 -0
- package/dist/caroQualityAuditDashboard-TNS4L2NR.mjs +77 -0
- package/dist/caroQualityAuditDashboard-TNS4L2NR.mjs.map +1 -0
- package/dist/caroVoiceAI-OUTAAIFE.mjs +32 -0
- package/dist/caroVoiceAI-OUTAAIFE.mjs.map +1 -0
- package/dist/cdrReport-Z35OLYUL.mjs +877 -0
- package/dist/cdrReport-Z35OLYUL.mjs.map +1 -0
- package/dist/chunk-3PNP6G5P.mjs +92 -0
- package/dist/chunk-3PNP6G5P.mjs.map +1 -0
- package/dist/chunk-45MLTWV7.mjs +28700 -0
- package/dist/chunk-45MLTWV7.mjs.map +1 -0
- package/dist/chunk-635IIVZE.mjs +24 -0
- package/dist/chunk-635IIVZE.mjs.map +1 -0
- package/dist/chunk-677RFPP5.mjs +24 -0
- package/dist/chunk-677RFPP5.mjs.map +1 -0
- package/dist/chunk-ERSNXW5X.mjs +37807 -0
- package/dist/chunk-ERSNXW5X.mjs.map +1 -0
- package/dist/chunk-G6KRLGGC.mjs +75 -0
- package/dist/chunk-G6KRLGGC.mjs.map +1 -0
- package/dist/chunk-GFVR3HLK.mjs +24 -0
- package/dist/chunk-GFVR3HLK.mjs.map +1 -0
- package/dist/chunk-GTI2ZVQX.mjs +18683 -0
- package/dist/chunk-GTI2ZVQX.mjs.map +1 -0
- package/dist/chunk-H22TUCN3.mjs +24 -0
- package/dist/chunk-H22TUCN3.mjs.map +1 -0
- package/dist/chunk-HAOFUADN.mjs +38 -0
- package/dist/chunk-HAOFUADN.mjs.map +1 -0
- package/dist/chunk-JHC7OUQG.mjs +763 -0
- package/dist/chunk-JHC7OUQG.mjs.map +1 -0
- package/dist/chunk-KSVNZKRD.mjs +10930 -0
- package/dist/chunk-KSVNZKRD.mjs.map +1 -0
- package/dist/chunk-M7FJYZF6.mjs +75 -0
- package/dist/chunk-M7FJYZF6.mjs.map +1 -0
- package/dist/chunk-NDZDJWXY.mjs +132 -0
- package/dist/chunk-NDZDJWXY.mjs.map +1 -0
- package/dist/chunk-S2SMCH2C.mjs +71 -0
- package/dist/chunk-S2SMCH2C.mjs.map +1 -0
- package/dist/chunk-S34CQVTF.mjs +711 -0
- package/dist/chunk-S34CQVTF.mjs.map +1 -0
- package/dist/chunk-SUS5RUCA.mjs +459 -0
- package/dist/chunk-SUS5RUCA.mjs.map +1 -0
- package/dist/chunk-TCYBXDAP.mjs +201 -0
- package/dist/chunk-TCYBXDAP.mjs.map +1 -0
- package/dist/chunk-VII5JNA6.mjs +24 -0
- package/dist/chunk-VII5JNA6.mjs.map +1 -0
- package/dist/chunk-W3ECDLUB.mjs +24 -0
- package/dist/chunk-W3ECDLUB.mjs.map +1 -0
- package/dist/chunk-Y4PAUTZ4.mjs +133 -0
- package/dist/chunk-Y4PAUTZ4.mjs.map +1 -0
- package/dist/chunk-ZSRD3ZXF.mjs +109 -0
- package/dist/chunk-ZSRD3ZXF.mjs.map +1 -0
- package/dist/index.d.mts +273 -18
- package/dist/index.d.ts +274 -19
- package/dist/index.js +123618 -2375
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1113 -973
- package/dist/index.mjs.map +1 -1
- package/dist/liveStatus-PRDEL7CK.mjs +1088 -0
- package/dist/liveStatus-PRDEL7CK.mjs.map +1 -0
- package/dist/loginReport-47QNACQU.mjs +1012 -0
- package/dist/loginReport-47QNACQU.mjs.map +1 -0
- package/dist/managementDashboard-SZFYULKA.mjs +546 -0
- package/dist/managementDashboard-SZFYULKA.mjs.map +1 -0
- package/dist/qualityAuditDashboard-FHRGB77R.mjs +77 -0
- package/dist/qualityAuditDashboard-FHRGB77R.mjs.map +1 -0
- package/package.json +14 -4
- package/dist/callHistory-Z5ABHFDQ.mjs +0 -369
- package/dist/callHistory-Z5ABHFDQ.mjs.map +0 -1
- package/dist/chunk-FFYJ4LWU.mjs +0 -919
- package/dist/chunk-FFYJ4LWU.mjs.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
agentDetailReport_default
|
|
13
|
+
} from "./chunk-JHC7OUQG.mjs";
|
|
14
|
+
import "./chunk-45MLTWV7.mjs";
|
|
15
|
+
import "./chunk-H22TUCN3.mjs";
|
|
16
|
+
import "./chunk-677RFPP5.mjs";
|
|
17
|
+
import "./chunk-Y4PAUTZ4.mjs";
|
|
18
|
+
import "./chunk-ZSRD3ZXF.mjs";
|
|
19
|
+
import "./chunk-GTI2ZVQX.mjs";
|
|
20
|
+
import "./chunk-HAOFUADN.mjs";
|
|
21
|
+
import "./chunk-M7FJYZF6.mjs";
|
|
22
|
+
import "./chunk-KSVNZKRD.mjs";
|
|
23
|
+
import "./chunk-ERSNXW5X.mjs";
|
|
24
|
+
export {
|
|
25
|
+
agentDetailReport_default as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=agentDetailReport-F44HMQ5O.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,561 @@
|
|
|
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
|
+
ReportFilterBar,
|
|
13
|
+
SearchBar,
|
|
14
|
+
headCellSx,
|
|
15
|
+
reportBodyCellSx,
|
|
16
|
+
require_isoWeek,
|
|
17
|
+
sortLabelSx
|
|
18
|
+
} from "./chunk-SUS5RUCA.mjs";
|
|
19
|
+
import {
|
|
20
|
+
SDKPermissionGuard
|
|
21
|
+
} from "./chunk-TCYBXDAP.mjs";
|
|
22
|
+
import "./chunk-VII5JNA6.mjs";
|
|
23
|
+
import {
|
|
24
|
+
agentDetailReport_default
|
|
25
|
+
} from "./chunk-JHC7OUQG.mjs";
|
|
26
|
+
import "./chunk-45MLTWV7.mjs";
|
|
27
|
+
import {
|
|
28
|
+
FileDownload_default
|
|
29
|
+
} from "./chunk-H22TUCN3.mjs";
|
|
30
|
+
import "./chunk-677RFPP5.mjs";
|
|
31
|
+
import {
|
|
32
|
+
PageHeader
|
|
33
|
+
} from "./chunk-Y4PAUTZ4.mjs";
|
|
34
|
+
import {
|
|
35
|
+
AppButton
|
|
36
|
+
} from "./chunk-ZSRD3ZXF.mjs";
|
|
37
|
+
import {
|
|
38
|
+
AdapterDayjs,
|
|
39
|
+
LocalizationProvider,
|
|
40
|
+
require_dayjs_min
|
|
41
|
+
} from "./chunk-GTI2ZVQX.mjs";
|
|
42
|
+
import {
|
|
43
|
+
Refresh_default
|
|
44
|
+
} from "./chunk-HAOFUADN.mjs";
|
|
45
|
+
import {
|
|
46
|
+
SDKProvider
|
|
47
|
+
} from "./chunk-M7FJYZF6.mjs";
|
|
48
|
+
import {
|
|
49
|
+
END_POINT,
|
|
50
|
+
SDK_PERMISSIONS,
|
|
51
|
+
axios_default
|
|
52
|
+
} from "./chunk-KSVNZKRD.mjs";
|
|
53
|
+
import {
|
|
54
|
+
Alert_default,
|
|
55
|
+
Box_default,
|
|
56
|
+
CircularProgress_default,
|
|
57
|
+
IconButton_default,
|
|
58
|
+
Paper_default,
|
|
59
|
+
Stack_default,
|
|
60
|
+
TableBody_default,
|
|
61
|
+
TableCell_default,
|
|
62
|
+
TableContainer_default,
|
|
63
|
+
TableHead_default,
|
|
64
|
+
TablePagination_default,
|
|
65
|
+
TableRow_default,
|
|
66
|
+
TableSortLabel_default,
|
|
67
|
+
Table_default,
|
|
68
|
+
__spreadProps,
|
|
69
|
+
__spreadValues,
|
|
70
|
+
__toESM,
|
|
71
|
+
createSvgIcon
|
|
72
|
+
} from "./chunk-ERSNXW5X.mjs";
|
|
73
|
+
|
|
74
|
+
// call-control-sdk/lib/pages/agentPerformanceReport/index.tsx
|
|
75
|
+
import { useState as useState2, useEffect, useCallback as useCallback2, useMemo, useRef } from "react";
|
|
76
|
+
|
|
77
|
+
// node_modules/@mui/icons-material/Visibility.mjs
|
|
78
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
79
|
+
var Visibility_default = createSvgIcon(/* @__PURE__ */ _jsx("path", {
|
|
80
|
+
d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"
|
|
81
|
+
}), "Visibility");
|
|
82
|
+
|
|
83
|
+
// call-control-sdk/lib/pages/agentPerformanceReport/index.tsx
|
|
84
|
+
var import_dayjs = __toESM(require_dayjs_min());
|
|
85
|
+
var import_isoWeek = __toESM(require_isoWeek());
|
|
86
|
+
|
|
87
|
+
// call-control-sdk/lib/pages/agentPerformanceReport/useAgentPerformanceReport.ts
|
|
88
|
+
import { useCallback, useState } from "react";
|
|
89
|
+
function fmtSecs(s) {
|
|
90
|
+
if (!s || s <= 0) return "00:00:00";
|
|
91
|
+
const h = Math.floor(s / 3600);
|
|
92
|
+
const m = Math.floor(s % 3600 / 60);
|
|
93
|
+
const sc = Math.floor(s % 60);
|
|
94
|
+
return [h, m, sc].map((x) => String(x).padStart(2, "0")).join(":");
|
|
95
|
+
}
|
|
96
|
+
function validateReportPayload(payload) {
|
|
97
|
+
if (!payload.startDate || !payload.startTime) return { isValid: false, error: "Start date/time required" };
|
|
98
|
+
if (!payload.endDate || !payload.endTime) return { isValid: false, error: "End date/time required" };
|
|
99
|
+
if (!payload.loginUsersOnly && !payload.agents) return { isValid: false, error: "Select at least one agent" };
|
|
100
|
+
return { isValid: true };
|
|
101
|
+
}
|
|
102
|
+
function mapAgentPerfRow(a) {
|
|
103
|
+
var _a;
|
|
104
|
+
return {
|
|
105
|
+
agentDetails: { agentId: a.agentId, fullName: a.fullName, process: a.processName, queueNames: a.queueNames },
|
|
106
|
+
calls: { totalCalls: a.totalCalls, answered: a.answeredCalls, missed: a.missedCalls },
|
|
107
|
+
inCalls: { total: a.inCalls },
|
|
108
|
+
outCalls: { total: a.outCalls },
|
|
109
|
+
average: { holdTime: fmtSecs(a.holdTimeSeconds), wrapUp: fmtSecs(a.wrapupSeconds), aht: fmtSecs(a.ahtSeconds), ringing: "00:00:00", dialing: "00:00:00" },
|
|
110
|
+
loginDetails: { loggedInDuration: fmtSecs(a.loginDurationSeconds), talkTime: fmtSecs(a.talkTimeSeconds), idleTime: fmtSecs(a.idleTimeSeconds) },
|
|
111
|
+
breaks: { shortBreak: fmtSecs(a.breakTimeSeconds), breakCount: a.breakCount, lunch: "00:00:00", tea: "00:00:00", training: "00:00:00", meeting: "00:00:00" },
|
|
112
|
+
loginStats: { firstLogin: a.firstLoginTime || "", noOfLogins: 0 },
|
|
113
|
+
adherence: { pct: (_a = a.adherencePct) != null ? _a : null }
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async function getUserPerformanceReportPaged(payload) {
|
|
117
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
118
|
+
const params = {
|
|
119
|
+
start_date: payload.startDate,
|
|
120
|
+
end_date: payload.endDate,
|
|
121
|
+
agent_id: payload.agents,
|
|
122
|
+
queue_id: payload.queueIds && payload.queueIds.length > 0 ? payload.queueIds : void 0,
|
|
123
|
+
page: (_a = payload.page) != null ? _a : 1,
|
|
124
|
+
pageSize: (_b = payload.pageSize) != null ? _b : 10,
|
|
125
|
+
search: payload.search
|
|
126
|
+
};
|
|
127
|
+
const res = await axios_default.get(
|
|
128
|
+
`${END_POINT.AGENT_PERFORMANCE_REPORT}${buildQs(params)}`
|
|
129
|
+
);
|
|
130
|
+
const data = res.data;
|
|
131
|
+
const agentsPage = data == null ? void 0 : data.agents;
|
|
132
|
+
const rawRows = Array.isArray(agentsPage) ? agentsPage : Array.isArray(agentsPage == null ? void 0 : agentsPage.data) ? agentsPage.data : [];
|
|
133
|
+
const rows = rawRows.map(mapAgentPerfRow);
|
|
134
|
+
const total = (_h = (_g = (_e = (_c = agentsPage == null ? void 0 : agentsPage.total) != null ? _c : data == null ? void 0 : data.total) != null ? _e : (_d = data == null ? void 0 : data.pagination) == null ? void 0 : _d.total) != null ? _g : (_f = data == null ? void 0 : data.summary) == null ? void 0 : _f.agentsLoggedIn) != null ? _h : rows.length;
|
|
135
|
+
return { rows, total };
|
|
136
|
+
}
|
|
137
|
+
async function fetchQueues() {
|
|
138
|
+
var _a;
|
|
139
|
+
const res = await axios_default.get(END_POINT.MASTER_QUEUES);
|
|
140
|
+
if (Array.isArray(res.data)) return res.data;
|
|
141
|
+
if (Array.isArray((_a = res.data) == null ? void 0 : _a.data)) return res.data.data;
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
async function fetchProcesses() {
|
|
145
|
+
var _a;
|
|
146
|
+
const res = await axios_default.get(END_POINT.MASTER_PROCESS);
|
|
147
|
+
if (Array.isArray(res.data)) return res.data;
|
|
148
|
+
if (Array.isArray((_a = res.data) == null ? void 0 : _a.data)) return res.data.data;
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
function buildQs(params) {
|
|
152
|
+
const qs = new URLSearchParams();
|
|
153
|
+
if (params.start_date) qs.append("start_date", params.start_date);
|
|
154
|
+
if (params.end_date) qs.append("end_date", params.end_date);
|
|
155
|
+
if (params.agent_id) for (const id of params.agent_id) qs.append("agent_id", id);
|
|
156
|
+
if (params.queue_id) for (const id of params.queue_id) qs.append("queue_id", String(id));
|
|
157
|
+
if (params.process_id) for (const id of params.process_id) qs.append("process_id", String(id));
|
|
158
|
+
if (params.top_n) qs.append("top_n", String(params.top_n));
|
|
159
|
+
if (params.search) qs.append("search", params.search);
|
|
160
|
+
if (params.page) qs.append("page", String(params.page));
|
|
161
|
+
if (params.pageSize) qs.append("pageSize", String(params.pageSize));
|
|
162
|
+
const str = qs.toString();
|
|
163
|
+
return str ? `?${str}` : "";
|
|
164
|
+
}
|
|
165
|
+
async function exportAgentPerformanceToExcel(params) {
|
|
166
|
+
var _a;
|
|
167
|
+
const res = await axios_default.get(
|
|
168
|
+
`${END_POINT.AGENT_PERFORMANCE_REPORT_EXPORT_EXCEL}${buildQs(params)}`,
|
|
169
|
+
{ responseType: "blob" }
|
|
170
|
+
);
|
|
171
|
+
const url = URL.createObjectURL(new Blob([res.data]));
|
|
172
|
+
const a = document.createElement("a");
|
|
173
|
+
a.href = url;
|
|
174
|
+
a.download = `agent-performance-${(_a = params.start_date) != null ? _a : "export"}.xlsx`;
|
|
175
|
+
a.click();
|
|
176
|
+
URL.revokeObjectURL(url);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// call-control-sdk/lib/pages/agentPerformanceReport/index.tsx
|
|
180
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
181
|
+
import_dayjs.default.extend(import_isoWeek.default);
|
|
182
|
+
var C = {
|
|
183
|
+
navy: "#0d2a56",
|
|
184
|
+
blue: "#1565c8",
|
|
185
|
+
green: "#0a9a62",
|
|
186
|
+
amber: "#c47c00",
|
|
187
|
+
red: "#cc2a2a",
|
|
188
|
+
purple: "#6b3fbf",
|
|
189
|
+
teal: "#0b7a8f",
|
|
190
|
+
bg: "transparent",
|
|
191
|
+
surface: "#fff",
|
|
192
|
+
s2: "#f7f9fc",
|
|
193
|
+
s3: "#eef2f7",
|
|
194
|
+
b1: "rgba(20,50,100,.07)",
|
|
195
|
+
b2: "rgba(20,50,100,.13)",
|
|
196
|
+
t1: "#0d1e35",
|
|
197
|
+
t2: "#364f6e",
|
|
198
|
+
t3: "#7a93b5",
|
|
199
|
+
t4: "#bccad9",
|
|
200
|
+
blt: "#e8f0fc",
|
|
201
|
+
glt: "#e4f6ef",
|
|
202
|
+
alt: "#fdf3e0",
|
|
203
|
+
rlt: "#fde8e8",
|
|
204
|
+
plt: "#f0eafa",
|
|
205
|
+
tlt: "#e3f4f7"
|
|
206
|
+
};
|
|
207
|
+
function parseDur(d) {
|
|
208
|
+
if (!d || d === "00:00:00") return 0;
|
|
209
|
+
const p = d.split(":").map(Number);
|
|
210
|
+
if (p.length === 3) return p[0] * 3600 + p[1] * 60 + p[2];
|
|
211
|
+
if (p.length === 2) return p[0] * 60 + p[1];
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
function fmtDur(s) {
|
|
215
|
+
if (!s || s <= 0) return "00:00:00";
|
|
216
|
+
const h = Math.floor(s / 3600);
|
|
217
|
+
const m = Math.floor(s % 3600 / 60);
|
|
218
|
+
const sc = Math.floor(s % 60);
|
|
219
|
+
return [h, m, sc].map((x) => String(x).padStart(2, "0")).join(":");
|
|
220
|
+
}
|
|
221
|
+
function getVal(row, key) {
|
|
222
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
223
|
+
switch (key) {
|
|
224
|
+
case "id":
|
|
225
|
+
return ((_a = row.agentDetails) == null ? void 0 : _a.agentId) || "";
|
|
226
|
+
case "name":
|
|
227
|
+
return ((_b = row.agentDetails) == null ? void 0 : _b.fullName) || "";
|
|
228
|
+
case "process":
|
|
229
|
+
return ((_c = row.agentDetails) == null ? void 0 : _c.process) || "";
|
|
230
|
+
case "queue":
|
|
231
|
+
return ((_d = row.agentDetails) == null ? void 0 : _d.queueNames) || "";
|
|
232
|
+
case "total":
|
|
233
|
+
return (_f = (_e = row.calls) == null ? void 0 : _e.totalCalls) != null ? _f : 0;
|
|
234
|
+
case "ans":
|
|
235
|
+
return (_h = (_g = row.calls) == null ? void 0 : _g.answered) != null ? _h : 0;
|
|
236
|
+
case "miss":
|
|
237
|
+
return (_j = (_i = row.calls) == null ? void 0 : _i.missed) != null ? _j : 0;
|
|
238
|
+
case "inTotal":
|
|
239
|
+
return (_l = (_k = row.inCalls) == null ? void 0 : _k.total) != null ? _l : 0;
|
|
240
|
+
case "outTotal":
|
|
241
|
+
return (_n = (_m = row.outCalls) == null ? void 0 : _m.total) != null ? _n : 0;
|
|
242
|
+
case "aht":
|
|
243
|
+
return parseDur(((_o = row.average) == null ? void 0 : _o.aht) || "00:00:00");
|
|
244
|
+
case "loginDur":
|
|
245
|
+
return parseDur(((_p = row.loginDetails) == null ? void 0 : _p.loggedInDuration) || "00:00:00");
|
|
246
|
+
case "talk":
|
|
247
|
+
return parseDur(((_q = row.loginDetails) == null ? void 0 : _q.talkTime) || "00:00:00");
|
|
248
|
+
case "hold":
|
|
249
|
+
return parseDur(((_r = row.average) == null ? void 0 : _r.holdTime) || "00:00:00");
|
|
250
|
+
case "wrapup":
|
|
251
|
+
return parseDur(((_s = row.average) == null ? void 0 : _s.wrapUp) || "00:00:00");
|
|
252
|
+
case "breakTime":
|
|
253
|
+
return parseDur(((_t = row.breaks) == null ? void 0 : _t.lunch) || "00:00:00") + parseDur(((_u = row.breaks) == null ? void 0 : _u.tea) || "00:00:00") + parseDur(((_v = row.breaks) == null ? void 0 : _v.training) || "00:00:00") + parseDur(((_w = row.breaks) == null ? void 0 : _w.meeting) || "00:00:00") + parseDur(((_x = row.breaks) == null ? void 0 : _x.shortBreak) || "00:00:00");
|
|
254
|
+
case "idle":
|
|
255
|
+
return parseDur(((_y = row.loginDetails) == null ? void 0 : _y.idleTime) || "00:00:00");
|
|
256
|
+
case "adherence":
|
|
257
|
+
return (_A = (_z = row.adherence) == null ? void 0 : _z.pct) != null ? _A : null;
|
|
258
|
+
case "firstLogin":
|
|
259
|
+
return ((_B = row.loginStats) == null ? void 0 : _B.firstLogin) || "";
|
|
260
|
+
default:
|
|
261
|
+
return "";
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
var COLUMNS = [
|
|
265
|
+
{ key: "id", label: "User ID", group: "Agent" },
|
|
266
|
+
{ key: "name", label: "Full Name", group: "Agent" },
|
|
267
|
+
{ key: "queue", label: "Queues", group: "Agent" },
|
|
268
|
+
{ key: "total", label: "Total Calls", group: "Calls", align: "right" },
|
|
269
|
+
{ key: "ans", label: "Answered", group: "Calls", align: "right" },
|
|
270
|
+
{ key: "miss", label: "Missed", group: "Calls", align: "right" },
|
|
271
|
+
{ key: "inTotal", label: "Inbound", group: "Calls", align: "right" },
|
|
272
|
+
{ key: "outTotal", label: "Outbound", group: "Calls", align: "right" },
|
|
273
|
+
{ key: "aht", label: "AHT", group: "Time", align: "right" },
|
|
274
|
+
{ key: "loginDur", label: "Login Dur", group: "Time", align: "right" },
|
|
275
|
+
{ key: "talk", label: "Talk Time", group: "Time", align: "right" },
|
|
276
|
+
{ key: "hold", label: "Hold Time", group: "Time", align: "right" },
|
|
277
|
+
{ key: "wrapup", label: "Wrapup Time", group: "Time", align: "right" },
|
|
278
|
+
{ key: "breakTime", label: "Break Time", group: "Breaks", align: "right" },
|
|
279
|
+
{ key: "idle", label: "Idle Time", group: "Time", align: "right" },
|
|
280
|
+
{ key: "firstLogin", label: "First Login", group: "Login" },
|
|
281
|
+
{ key: "adherence", label: "Adherence %", group: "Agent", align: "right" }
|
|
282
|
+
];
|
|
283
|
+
function AgentPerformanceReportContent() {
|
|
284
|
+
const [startDate, setStartDate] = useState2((0, import_dayjs.default)().startOf("day"));
|
|
285
|
+
const [endDate, setEndDate] = useState2((0, import_dayjs.default)());
|
|
286
|
+
const [quickRange, setQuickRange] = useState2("today");
|
|
287
|
+
const [selectedUsers, setSelectedUsers] = useState2([]);
|
|
288
|
+
const [isAllUsersSelected, setIsAllUsersSelected] = useState2(false);
|
|
289
|
+
const [processes, setProcesses] = useState2([]);
|
|
290
|
+
const [process, setProcess] = useState2("");
|
|
291
|
+
const [search, setSearch] = useState2("");
|
|
292
|
+
const [loginUsersOnly] = useState2(true);
|
|
293
|
+
const [queues, setQueues] = useState2([]);
|
|
294
|
+
const [selectedQueues, setSelectedQueues] = useState2([]);
|
|
295
|
+
const [data, setData] = useState2([]);
|
|
296
|
+
const [loading, setLoading] = useState2(false);
|
|
297
|
+
const [error, setError] = useState2("");
|
|
298
|
+
const [selectedAgent, setSelectedAgent] = useState2(null);
|
|
299
|
+
const [orderBy, setOrderBy] = useState2("total");
|
|
300
|
+
const [order, setOrder] = useState2("desc");
|
|
301
|
+
const [page, setPage] = useState2(0);
|
|
302
|
+
const [rowsPerPage, setRowsPerPage] = useState2(10);
|
|
303
|
+
const [totalCount, setTotalCount] = useState2(-1);
|
|
304
|
+
const [visibleCols] = useState2(new Set(COLUMNS.map((c) => c.key)));
|
|
305
|
+
const [debouncedSearch, setDebouncedSearch] = useState2("");
|
|
306
|
+
const debounceRef = useRef(void 0);
|
|
307
|
+
useEffect(() => {
|
|
308
|
+
debounceRef.current = setTimeout(() => setDebouncedSearch(search.trim()), 400);
|
|
309
|
+
return () => clearTimeout(debounceRef.current);
|
|
310
|
+
}, [search]);
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
fetchProcesses().then((p) => {
|
|
313
|
+
const mapped = p.map((x) => ({ label: x.name, value: x.name }));
|
|
314
|
+
setProcesses(mapped);
|
|
315
|
+
if (mapped.length) setProcess(mapped[0].value);
|
|
316
|
+
}).catch(() => {
|
|
317
|
+
});
|
|
318
|
+
fetchQueues().then((data2) => setQueues(data2 || [])).catch(() => {
|
|
319
|
+
});
|
|
320
|
+
}, []);
|
|
321
|
+
const handleQuickRangeChange = (range) => {
|
|
322
|
+
setQuickRange(range);
|
|
323
|
+
};
|
|
324
|
+
const handleRefresh = () => {
|
|
325
|
+
if (quickRange === "today" || quickRange === "week" || quickRange === "month") {
|
|
326
|
+
const now = (0, import_dayjs.default)();
|
|
327
|
+
let sd = now.startOf("day");
|
|
328
|
+
const ed = now;
|
|
329
|
+
if (quickRange === "week") sd = now.startOf("week").startOf("day");
|
|
330
|
+
else if (quickRange === "month") sd = now.startOf("month").startOf("day");
|
|
331
|
+
setStartDate(sd);
|
|
332
|
+
setEndDate(ed);
|
|
333
|
+
} else {
|
|
334
|
+
fetchReport(page);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
const fetchReport = useCallback2(async (pageNum) => {
|
|
338
|
+
const fromDate = startDate;
|
|
339
|
+
const toDate = endDate;
|
|
340
|
+
if (!fromDate || !toDate) {
|
|
341
|
+
setError("Select date range");
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const payload = {
|
|
345
|
+
startDate: fromDate.format("YYYY-MM-DDTHH:mm:ss"),
|
|
346
|
+
endDate: toDate.format("YYYY-MM-DDTHH:mm:ss"),
|
|
347
|
+
startTime: fromDate.format("HH:mm:ss"),
|
|
348
|
+
endTime: toDate.format("HH:mm:ss"),
|
|
349
|
+
process,
|
|
350
|
+
agents: isAllUsersSelected ? [] : selectedUsers.map((u) => u.userId),
|
|
351
|
+
loginUsersOnly,
|
|
352
|
+
queueIds: selectedQueues.length > 0 && selectedQueues.length < queues.length ? selectedQueues.map((q) => q.id) : void 0,
|
|
353
|
+
search: debouncedSearch || void 0,
|
|
354
|
+
page: pageNum + 1,
|
|
355
|
+
pageSize: rowsPerPage
|
|
356
|
+
};
|
|
357
|
+
const valid = validateReportPayload(payload);
|
|
358
|
+
if (!valid.isValid) {
|
|
359
|
+
setError(valid.error || "Invalid");
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
try {
|
|
363
|
+
setLoading(true);
|
|
364
|
+
setError("");
|
|
365
|
+
const { rows, total } = await getUserPerformanceReportPaged(payload);
|
|
366
|
+
setData(rows);
|
|
367
|
+
setTotalCount(typeof total === "number" ? total : rows.length);
|
|
368
|
+
} catch (err) {
|
|
369
|
+
setError((err == null ? void 0 : err.message) || "Failed to fetch report");
|
|
370
|
+
setData([]);
|
|
371
|
+
} finally {
|
|
372
|
+
setLoading(false);
|
|
373
|
+
}
|
|
374
|
+
}, [startDate, endDate, process, selectedUsers, isAllUsersSelected, selectedQueues, loginUsersOnly, debouncedSearch, rowsPerPage]);
|
|
375
|
+
useEffect(() => {
|
|
376
|
+
setPage(0);
|
|
377
|
+
fetchReport(0);
|
|
378
|
+
}, [fetchReport]);
|
|
379
|
+
const handlePageChange = useCallback2(
|
|
380
|
+
(_event, newPage) => {
|
|
381
|
+
setPage(newPage);
|
|
382
|
+
fetchReport(newPage);
|
|
383
|
+
},
|
|
384
|
+
[fetchReport]
|
|
385
|
+
);
|
|
386
|
+
const sorted = useMemo(() => {
|
|
387
|
+
return [...data].sort((a, b) => {
|
|
388
|
+
const av = getVal(a, orderBy);
|
|
389
|
+
const bv = getVal(b, orderBy);
|
|
390
|
+
if (typeof av === "number" && typeof bv === "number") return order === "asc" ? av - bv : bv - av;
|
|
391
|
+
return order === "asc" ? String(av).localeCompare(String(bv)) : String(bv).localeCompare(String(av));
|
|
392
|
+
});
|
|
393
|
+
}, [data, orderBy, order]);
|
|
394
|
+
const paged = sorted;
|
|
395
|
+
const handleSort = (key) => {
|
|
396
|
+
setOrder(orderBy === key && order === "asc" ? "desc" : "asc");
|
|
397
|
+
setOrderBy(key);
|
|
398
|
+
};
|
|
399
|
+
const handleExportExcel = async () => {
|
|
400
|
+
const fromDate = startDate;
|
|
401
|
+
const toDate = endDate;
|
|
402
|
+
if (!fromDate || !toDate) {
|
|
403
|
+
setError("Select date range");
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const params = {
|
|
407
|
+
start_date: fromDate.format("YYYY-MM-DDTHH:mm:ss"),
|
|
408
|
+
end_date: toDate.format("YYYY-MM-DDTHH:mm:ss"),
|
|
409
|
+
agent_id: !isAllUsersSelected && selectedUsers.length > 0 ? selectedUsers.map((u) => u.userId) : void 0,
|
|
410
|
+
queue_id: selectedQueues.length > 0 && selectedQueues.length < queues.length ? selectedQueues.map((q) => q.id) : void 0,
|
|
411
|
+
search: debouncedSearch || void 0
|
|
412
|
+
};
|
|
413
|
+
try {
|
|
414
|
+
await exportAgentPerformanceToExcel(params);
|
|
415
|
+
} catch (err) {
|
|
416
|
+
setError((err == null ? void 0 : err.message) || "Failed to export Excel");
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
const renderCellValue = (row, col) => {
|
|
420
|
+
const v = getVal(row, col.key);
|
|
421
|
+
const durKeys = ["aht", "loginDur", "talk", "hold", "wrapup", "breakTime", "idle"];
|
|
422
|
+
if (durKeys.includes(col.key)) return fmtDur(v);
|
|
423
|
+
if (col.key === "adherence") return v != null ? `${v}%` : "\u2014";
|
|
424
|
+
if (col.key === "firstLogin") return v ? (0, import_dayjs.default)(v).format("DD MMM YYYY hh:mm A") : "";
|
|
425
|
+
return v != null ? v : "";
|
|
426
|
+
};
|
|
427
|
+
const activeCols = COLUMNS.filter((c) => visibleCols.has(c.key));
|
|
428
|
+
if (selectedAgent) {
|
|
429
|
+
return /* @__PURE__ */ jsx(
|
|
430
|
+
agentDetailReport_default,
|
|
431
|
+
{
|
|
432
|
+
agentRow: selectedAgent,
|
|
433
|
+
onBack: () => setSelectedAgent(null),
|
|
434
|
+
initialStartDate: startDate,
|
|
435
|
+
initialEndDate: endDate,
|
|
436
|
+
initialQuickRange: quickRange,
|
|
437
|
+
from: "REPORTS_LIST"
|
|
438
|
+
}
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsxs(Box_default, { sx: { background: C.bg, minHeight: "100vh" }, children: [
|
|
442
|
+
/* @__PURE__ */ jsx(
|
|
443
|
+
PageHeader,
|
|
444
|
+
{
|
|
445
|
+
title: " Performance Report",
|
|
446
|
+
actions: /* @__PURE__ */ jsxs(Stack_default, { direction: "row", alignItems: "center", spacing: 1, children: [
|
|
447
|
+
/* @__PURE__ */ jsx(
|
|
448
|
+
SearchBar,
|
|
449
|
+
{
|
|
450
|
+
value: search,
|
|
451
|
+
onChange: setSearch,
|
|
452
|
+
placeholder: "Search name, ID...",
|
|
453
|
+
width: 250
|
|
454
|
+
}
|
|
455
|
+
),
|
|
456
|
+
/* @__PURE__ */ jsx(
|
|
457
|
+
SDKPermissionGuard,
|
|
458
|
+
{
|
|
459
|
+
permissions: [SDK_PERMISSIONS.REPORTS_AGENT_PERFORMANCE_EXPORT, SDK_PERMISSIONS.REPORTS_AGENT_PERFORMANCE_MANAGE],
|
|
460
|
+
showFallback: false,
|
|
461
|
+
children: /* @__PURE__ */ jsx(
|
|
462
|
+
AppButton,
|
|
463
|
+
{
|
|
464
|
+
startIcon: /* @__PURE__ */ jsx(FileDownload_default, { sx: { fontSize: "0.95rem !important" } }),
|
|
465
|
+
disabled: !data.length,
|
|
466
|
+
onClick: handleExportExcel,
|
|
467
|
+
sx: { height: 36 },
|
|
468
|
+
children: "Export Excel"
|
|
469
|
+
}
|
|
470
|
+
)
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
] })
|
|
474
|
+
}
|
|
475
|
+
),
|
|
476
|
+
/* @__PURE__ */ jsx(
|
|
477
|
+
ReportFilterBar,
|
|
478
|
+
{
|
|
479
|
+
startDate,
|
|
480
|
+
endDate,
|
|
481
|
+
onStartChange: setStartDate,
|
|
482
|
+
onEndChange: setEndDate,
|
|
483
|
+
quickRange,
|
|
484
|
+
onQuickRangeChange: handleQuickRangeChange,
|
|
485
|
+
showAgentSelect: true,
|
|
486
|
+
selectedAgents: selectedUsers,
|
|
487
|
+
onAgentsChange: setSelectedUsers,
|
|
488
|
+
setIsAllUsersSelected,
|
|
489
|
+
showQueueSelect: true,
|
|
490
|
+
queues,
|
|
491
|
+
selectedQueues,
|
|
492
|
+
onQueuesChange: setSelectedQueues,
|
|
493
|
+
showProcessSelect: true,
|
|
494
|
+
processes,
|
|
495
|
+
selectedProcess: process,
|
|
496
|
+
onProcessChange: setProcess,
|
|
497
|
+
extra: /* @__PURE__ */ jsx(
|
|
498
|
+
AppButton,
|
|
499
|
+
{
|
|
500
|
+
startIcon: /* @__PURE__ */ jsx(Refresh_default, { sx: { fontSize: "0.9rem !important" } }),
|
|
501
|
+
disabled: loading,
|
|
502
|
+
onClick: handleRefresh,
|
|
503
|
+
sx: { height: 32 },
|
|
504
|
+
children: "Refresh"
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
error && /* @__PURE__ */ jsx(Alert_default, { severity: "error", sx: { mx: 2.5, mt: 1.5 }, onClose: () => setError(""), children: error }),
|
|
510
|
+
/* @__PURE__ */ jsxs(Box_default, { sx: { py: 2, px: 1, overflow: "auto", position: "relative" }, children: [
|
|
511
|
+
loading && /* @__PURE__ */ jsx(Box_default, { sx: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, background: "rgba(240,244,248,0.7)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 10 }, children: /* @__PURE__ */ jsx(CircularProgress_default, {}) }),
|
|
512
|
+
/* @__PURE__ */ jsxs(Paper_default, { elevation: 0, sx: { borderRadius: "8px", border: "1px solid #e0e7ef", overflow: "hidden", mb: 2 }, children: [
|
|
513
|
+
/* @__PURE__ */ jsx(TableContainer_default, { children: /* @__PURE__ */ jsxs(Table_default, { size: "small", sx: {
|
|
514
|
+
minWidth: 1400,
|
|
515
|
+
"& .MuiTableCell-root": { fontSize: "0.75rem", borderBottom: "1px solid #eef1f6", py: 0.6, px: 1 }
|
|
516
|
+
}, children: [
|
|
517
|
+
/* @__PURE__ */ jsx(TableHead_default, { children: /* @__PURE__ */ jsxs(TableRow_default, { children: [
|
|
518
|
+
activeCols.map((col) => /* @__PURE__ */ jsx(TableCell_default, { align: col.align || "left", sx: headCellSx, children: /* @__PURE__ */ jsx(TableSortLabel_default, { active: orderBy === col.key, direction: orderBy === col.key ? order : "asc", onClick: () => handleSort(col.key), sx: sortLabelSx, children: col.label }) }, col.key)),
|
|
519
|
+
/* @__PURE__ */ jsx(TableCell_default, { sx: __spreadProps(__spreadValues({}, headCellSx), { width: 48 }), children: "Detail" })
|
|
520
|
+
] }) }),
|
|
521
|
+
/* @__PURE__ */ jsxs(TableBody_default, { children: [
|
|
522
|
+
paged.map((row, idx) => /* @__PURE__ */ jsxs(TableRow_default, { hover: true, onClick: () => setSelectedAgent(row), sx: {
|
|
523
|
+
backgroundColor: "#fff",
|
|
524
|
+
"&:hover": { backgroundColor: "#f0f7f8" },
|
|
525
|
+
cursor: "pointer"
|
|
526
|
+
}, children: [
|
|
527
|
+
activeCols.map((col) => /* @__PURE__ */ jsx(TableCell_default, { align: col.align || "left", sx: reportBodyCellSx, children: renderCellValue(row, col) }, col.key)),
|
|
528
|
+
/* @__PURE__ */ jsx(TableCell_default, { sx: reportBodyCellSx, align: "center", children: /* @__PURE__ */ jsx(IconButton_default, { size: "small", onClick: (e) => {
|
|
529
|
+
e.stopPropagation();
|
|
530
|
+
setSelectedAgent(row);
|
|
531
|
+
}, sx: { color: C.blue }, children: /* @__PURE__ */ jsx(Visibility_default, { sx: { fontSize: 16 } }) }) })
|
|
532
|
+
] }, idx)),
|
|
533
|
+
paged.length === 0 && /* @__PURE__ */ jsx(TableRow_default, { children: /* @__PURE__ */ jsx(TableCell_default, { colSpan: activeCols.length + 1, sx: { textAlign: "center", py: 4, color: C.t3, fontSize: 13 }, children: "No data found" }) })
|
|
534
|
+
] })
|
|
535
|
+
] }) }),
|
|
536
|
+
/* @__PURE__ */ jsx(
|
|
537
|
+
TablePagination_default,
|
|
538
|
+
{
|
|
539
|
+
component: "div",
|
|
540
|
+
count: totalCount,
|
|
541
|
+
page,
|
|
542
|
+
onPageChange: handlePageChange,
|
|
543
|
+
rowsPerPage,
|
|
544
|
+
onRowsPerPageChange: (e) => {
|
|
545
|
+
setRowsPerPage(parseInt(e.target.value, 10));
|
|
546
|
+
setPage(0);
|
|
547
|
+
},
|
|
548
|
+
rowsPerPageOptions: [10, 15, 25, 50, 100],
|
|
549
|
+
sx: { borderTop: "1px solid #eef1f6", "& .MuiTablePagination-displayedRows": { fontSize: "0.73rem" }, "& .MuiTablePagination-selectLabel": { fontSize: "0.73rem" } }
|
|
550
|
+
}
|
|
551
|
+
)
|
|
552
|
+
] })
|
|
553
|
+
] })
|
|
554
|
+
] }) });
|
|
555
|
+
}
|
|
556
|
+
var AgentPerformanceReport = () => /* @__PURE__ */ jsx(SDKProvider, { children: /* @__PURE__ */ jsx(AgentPerformanceReportContent, {}) });
|
|
557
|
+
var agentPerformanceReport_default = AgentPerformanceReport;
|
|
558
|
+
export {
|
|
559
|
+
agentPerformanceReport_default as default
|
|
560
|
+
};
|
|
561
|
+
//# sourceMappingURL=agentPerformanceReport-TTOMNENK.mjs.map
|