@consilioweb/payload-support 0.8.2 → 0.9.4
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/components/RichTextEditor/index.cjs +233 -0
- package/dist/components/RichTextEditor/index.js +232 -0
- package/dist/components/TicketConversation/components/CodeBlock.cjs +24 -7
- package/dist/components/TicketConversation/components/CodeBlock.js +23 -9
- package/dist/index.cjs +19 -1
- package/dist/index.js +19 -1
- package/dist/views/BillingView/client.cjs +260 -103
- package/dist/views/BillingView/client.js +259 -103
- package/dist/views/ChatView/client.cjs +184 -137
- package/dist/views/ChatView/client.js +180 -137
- package/dist/views/CrmView/client.cjs +270 -122
- package/dist/views/CrmView/client.js +266 -122
- package/dist/views/EmailTrackingView/client.cjs +80 -69
- package/dist/views/EmailTrackingView/client.js +80 -70
- package/dist/views/ImportConversationView/client.cjs +127 -94
- package/dist/views/ImportConversationView/client.js +123 -94
- package/dist/views/LogsView/client.cjs +56 -58
- package/dist/views/LogsView/client.js +52 -58
- package/dist/views/NewTicketView/client.cjs +39 -55
- package/dist/views/NewTicketView/client.js +38 -55
- package/dist/views/PendingEmailsView/client.cjs +399 -102
- package/dist/views/PendingEmailsView/client.js +396 -103
- package/dist/views/SupportDashboardView/client.cjs +276 -137
- package/dist/views/SupportDashboardView/client.js +275 -137
- package/dist/views/TicketDetailView/client.cjs +487 -204
- package/dist/views/TicketDetailView/client.js +486 -204
- package/dist/views/TicketInboxView/client.cjs +62 -65
- package/dist/views/TicketInboxView/client.js +62 -66
- package/dist/views/TicketingSettingsView/client.cjs +10 -8
- package/dist/views/TicketingSettingsView/client.js +10 -8
- package/dist/views/TimeDashboardView/client.cjs +70 -59
- package/dist/views/TimeDashboardView/client.js +69 -59
- package/package.json +6 -2
- package/src/components/RichTextEditor/index.tsx +261 -0
- package/src/components/TicketConversation/components/CodeBlock.tsx +53 -14
- package/src/plugin.ts +2 -0
- package/src/utils/emailTemplate.ts +37 -0
- package/src/views/BillingView/client.tsx +362 -69
- package/src/views/ChatView/client.tsx +225 -140
- package/src/views/CrmView/client.tsx +447 -189
- package/src/views/EmailTrackingView/client.tsx +111 -71
- package/src/views/ImportConversationView/client.tsx +255 -70
- package/src/views/LogsView/client.tsx +85 -50
- package/src/views/NewTicketView/client.tsx +37 -53
- package/src/views/PendingEmailsView/client.tsx +512 -92
- package/src/views/SupportDashboardView/client.tsx +294 -134
- package/src/views/TicketDetailView/client.tsx +486 -213
- package/src/views/TicketInboxView/client.tsx +52 -61
- package/src/views/TicketingSettingsView/client.tsx +10 -9
- package/src/views/TimeDashboardView/client.tsx +184 -69
|
@@ -4,10 +4,12 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var Link = require('next/link');
|
|
6
6
|
var useTranslation = require('../../components/TicketConversation/hooks/useTranslation');
|
|
7
|
+
var styles = require('../../styles/SupportDashboard.module.scss');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
|
|
10
11
|
var Link__default = /*#__PURE__*/_interopDefault(Link);
|
|
12
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
11
13
|
|
|
12
14
|
function formatResponseTime(hours) {
|
|
13
15
|
if (hours == null) return "--";
|
|
@@ -35,17 +37,80 @@ function computeTrend(current, previous) {
|
|
|
35
37
|
if (pct === 0) return { pct: 0, dir: "neutral" };
|
|
36
38
|
return { pct: Math.abs(pct), dir: pct > 0 ? "up" : "down" };
|
|
37
39
|
}
|
|
38
|
-
function StatCard({ label, value, trend, accentColor }) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
function StatCard({ label, value, trend, accentColor, onClick }) {
|
|
41
|
+
const style = accentColor ? { "--stat-accent": accentColor } : void 0;
|
|
42
|
+
const Tag = onClick ? "button" : "div";
|
|
43
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
44
|
+
Tag,
|
|
45
|
+
{
|
|
46
|
+
className: styles__default.default.statCard,
|
|
47
|
+
style,
|
|
48
|
+
onClick,
|
|
49
|
+
type: onClick ? "button" : void 0,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.statLabel, children: label }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.statValueRow, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.statValue, children: value }) }),
|
|
53
|
+
trend && trend.dir !== "neutral" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.statTrend} ${styles__default.default[trend.dir]}`, children: [
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.trendArrow, children: trend.dir === "up" ? "\u2191" : "\u2193" }),
|
|
55
|
+
trend.pct,
|
|
56
|
+
"%"
|
|
57
|
+
] }),
|
|
58
|
+
trend && trend.dir === "neutral" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles__default.default.statTrend} ${styles__default.default.neutral}`, children: "\u2014 stable" })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function VolumeChart({ data }) {
|
|
64
|
+
const max = Math.max(...data.map((d) => d.value), 1);
|
|
65
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.volumeChart, children: data.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: styles__default.default.volumeBar,
|
|
70
|
+
style: { height: `${Math.max(d.value / max * 100, 5)}%` },
|
|
71
|
+
title: `${d.label}: ${d.value}`
|
|
72
|
+
},
|
|
73
|
+
i
|
|
74
|
+
)) }),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.volumeLabels, children: [
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: data[0]?.label }),
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: data[data.length - 1]?.label })
|
|
78
|
+
] })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
function CSATRing({ score, count }) {
|
|
82
|
+
const pct = score > 0 ? score / 5 * 100 : 0;
|
|
83
|
+
const radius = 42;
|
|
84
|
+
const circumference = 2 * Math.PI * radius;
|
|
85
|
+
const strokeDashoffset = circumference - pct / 100 * circumference;
|
|
86
|
+
const color = score >= 4 ? "#22c55e" : score >= 3 ? "#f59e0b" : score > 0 ? "#ef4444" : "#94a3b8";
|
|
87
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.csatContainer, children: [
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.csatRing, children: [
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "100", height: "100", viewBox: "0 0 100 100", children: [
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "50", r: radius, fill: "none", stroke: "var(--theme-elevation-150, #e2e8f0)", strokeWidth: "6" }),
|
|
91
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
92
|
+
"circle",
|
|
93
|
+
{
|
|
94
|
+
cx: "50",
|
|
95
|
+
cy: "50",
|
|
96
|
+
r: radius,
|
|
97
|
+
fill: "none",
|
|
98
|
+
stroke: color,
|
|
99
|
+
strokeWidth: "6",
|
|
100
|
+
strokeLinecap: "round",
|
|
101
|
+
strokeDasharray: circumference,
|
|
102
|
+
strokeDashoffset,
|
|
103
|
+
transform: "rotate(-90 50 50)",
|
|
104
|
+
style: { transition: "stroke-dashoffset 600ms ease" }
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.csatValue, children: score > 0 ? score.toFixed(1) : "--" })
|
|
47
109
|
] }),
|
|
48
|
-
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.csatMeta, children: [
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.csatLabel, children: score > 0 ? `${score.toFixed(1)} / 5` : "Pas de donn\xE9es" }),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.csatSub, children: count > 0 ? `${count} avis recueillis` : "Aucun avis" })
|
|
113
|
+
] })
|
|
49
114
|
] });
|
|
50
115
|
}
|
|
51
116
|
function formatSlaTime(minutes) {
|
|
@@ -59,14 +124,15 @@ function formatSlaTime(minutes) {
|
|
|
59
124
|
return remainH > 0 ? `${d}j ${remainH}h` : `${d}j`;
|
|
60
125
|
}
|
|
61
126
|
function SlaSection() {
|
|
62
|
-
const { t } = useTranslation.useTranslation();
|
|
63
127
|
const [sla, setSla] = react.useState(null);
|
|
64
128
|
const [slaLoading, setSlaLoading] = react.useState(true);
|
|
65
129
|
react.useEffect(() => {
|
|
66
130
|
const fetchSla = async () => {
|
|
67
131
|
try {
|
|
68
132
|
const res = await fetch("/api/support/sla-check");
|
|
69
|
-
if (res.ok)
|
|
133
|
+
if (res.ok) {
|
|
134
|
+
setSla(await res.json());
|
|
135
|
+
}
|
|
70
136
|
} catch {
|
|
71
137
|
}
|
|
72
138
|
setSlaLoading(false);
|
|
@@ -75,58 +141,96 @@ function SlaSection() {
|
|
|
75
141
|
const interval = setInterval(fetchSla, 6e4);
|
|
76
142
|
return () => clearInterval(interval);
|
|
77
143
|
}, []);
|
|
78
|
-
if (slaLoading)
|
|
144
|
+
if (slaLoading) {
|
|
145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.slaSection, children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: styles__default.default.slaSectionTitle, children: "SLA" }),
|
|
147
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.slaLoading, children: "Chargement..." })
|
|
148
|
+
] });
|
|
149
|
+
}
|
|
79
150
|
if (!sla) return null;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
94
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontWeight: 600 }, children: [
|
|
95
|
-
"#",
|
|
96
|
-
ticket.ticketNumber
|
|
97
|
-
] }),
|
|
98
|
-
" ",
|
|
99
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#6b7280" }, children: ticket.subject })
|
|
151
|
+
const navigateToTicket = (id) => {
|
|
152
|
+
window.location.href = `/admin/support/ticket?id=${id}`;
|
|
153
|
+
};
|
|
154
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.slaSection, children: [
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: styles__default.default.slaSectionTitle, children: "SLA" }),
|
|
156
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.slaGrid, children: [
|
|
157
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.slaCard} ${styles__default.default.slaBreach}`, children: [
|
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.slaCardHeader, children: [
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h3", { className: `${styles__default.default.slaCardTitle} ${styles__default.default.slaCardTitleBreach}`, children: [
|
|
160
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
161
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
|
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
100
164
|
] }),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
165
|
+
"En breach"
|
|
166
|
+
] }),
|
|
167
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${styles__default.default.slaCount} ${styles__default.default.slaCountBreach}`, children: sla.breached.length })
|
|
168
|
+
] }),
|
|
169
|
+
sla.breached.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.slaEmpty, children: "Aucun ticket en breach" }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: styles__default.default.slaList, children: sla.breached.map((ticket) => {
|
|
170
|
+
const now = /* @__PURE__ */ new Date();
|
|
171
|
+
const created = new Date(ticket.createdAt);
|
|
172
|
+
const overdueMin = Math.round((now.getTime() - created.getTime()) / 6e4);
|
|
173
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
174
|
+
"li",
|
|
175
|
+
{
|
|
176
|
+
className: styles__default.default.slaItem,
|
|
177
|
+
onClick: () => navigateToTicket(ticket.id),
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.slaItemLeft, children: [
|
|
180
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.slaItemNum, children: [
|
|
181
|
+
"#",
|
|
182
|
+
ticket.ticketNumber
|
|
183
|
+
] }),
|
|
184
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.slaItemSubject, children: ticket.subject })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: `${styles__default.default.slaItemTime} ${styles__default.default.slaTimeBreach}`, children: [
|
|
187
|
+
"+",
|
|
188
|
+
formatSlaTime(overdueMin)
|
|
189
|
+
] })
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
ticket.id
|
|
193
|
+
);
|
|
106
194
|
}) })
|
|
107
195
|
] }),
|
|
108
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
109
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
110
|
-
/* @__PURE__ */ jsxRuntime.
|
|
111
|
-
|
|
196
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.slaCard} ${styles__default.default.slaRisk}`, children: [
|
|
197
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.slaCardHeader, children: [
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h3", { className: `${styles__default.default.slaCardTitle} ${styles__default.default.slaCardTitleRisk}`, children: [
|
|
199
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
201
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "12 6 12 12 16 14" })
|
|
202
|
+
] }),
|
|
203
|
+
"\xC0 risque"
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${styles__default.default.slaCount} ${styles__default.default.slaCountRisk}`, children: sla.atRisk.length })
|
|
112
206
|
] }),
|
|
113
|
-
sla.atRisk.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
114
|
-
const
|
|
207
|
+
sla.atRisk.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.slaEmpty, children: "Aucun ticket \xE0 risque" }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: styles__default.default.slaList, children: sla.atRisk.map((ticket) => {
|
|
208
|
+
const now = /* @__PURE__ */ new Date();
|
|
209
|
+
const created = new Date(ticket.createdAt);
|
|
210
|
+
const elapsedMin = Math.round((now.getTime() - created.getTime()) / 6e4);
|
|
115
211
|
const estimatedTotalMin = Math.round(elapsedMin / 0.8);
|
|
116
212
|
const remainingMin = Math.max(estimatedTotalMin - elapsedMin, 0);
|
|
117
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
213
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
214
|
+
"li",
|
|
215
|
+
{
|
|
216
|
+
className: styles__default.default.slaItem,
|
|
217
|
+
onClick: () => navigateToTicket(ticket.id),
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.slaItemLeft, children: [
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.slaItemNum, children: [
|
|
221
|
+
"#",
|
|
222
|
+
ticket.ticketNumber
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.slaItemSubject, children: ticket.subject })
|
|
225
|
+
] }),
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: `${styles__default.default.slaItemTime} ${styles__default.default.slaTimeRisk}`, children: [
|
|
227
|
+
formatSlaTime(remainingMin),
|
|
228
|
+
" restant"
|
|
229
|
+
] })
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
ticket.id
|
|
233
|
+
);
|
|
130
234
|
}) })
|
|
131
235
|
] })
|
|
132
236
|
] })
|
|
@@ -173,24 +277,34 @@ const SupportDashboardClient = () => {
|
|
|
173
277
|
const volumeData = react.useMemo(() => {
|
|
174
278
|
if (!stats) return [];
|
|
175
279
|
const avg = stats.createdLast7Days;
|
|
176
|
-
const days = [
|
|
280
|
+
const days = ["Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"];
|
|
177
281
|
const base = Math.max(Math.floor(avg / 7), 0);
|
|
178
282
|
return days.map((label, i) => ({
|
|
179
283
|
label,
|
|
284
|
+
// Simple deterministic variation based on index
|
|
180
285
|
value: Math.max(base + (i * 3 + 1) % 5 - 2, 0)
|
|
181
286
|
}));
|
|
182
|
-
}, [stats
|
|
287
|
+
}, [stats]);
|
|
183
288
|
if (loading) {
|
|
184
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
185
|
-
/* @__PURE__ */ jsxRuntime.
|
|
186
|
-
|
|
187
|
-
|
|
289
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.page, children: [
|
|
290
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.header, children: [
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: styles__default.default.title, children: t("dashboard.title") }),
|
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: styles__default.default.subtitle, children: t("dashboard.loadingMetrics") })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.statsRow, children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.skeletonCard }, i)) }),
|
|
295
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.middleGrid, children: [
|
|
296
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.skeletonTable }),
|
|
297
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.rightColumn, children: [
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.skeletonChart }),
|
|
299
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.skeletonChart })
|
|
300
|
+
] })
|
|
301
|
+
] })
|
|
188
302
|
] });
|
|
189
303
|
}
|
|
190
304
|
if (!stats) {
|
|
191
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
305
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.page, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.errorState, children: [
|
|
192
306
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: t("dashboard.loadError") }),
|
|
193
|
-
|
|
307
|
+
sessionExpired ? t("common.sessionExpired") : t("dashboard.cannotLoadStats")
|
|
194
308
|
] }) });
|
|
195
309
|
}
|
|
196
310
|
const openCount = stats.byStatus.open || 0;
|
|
@@ -202,98 +316,123 @@ const SupportDashboardClient = () => {
|
|
|
202
316
|
if (typeof ticket.client === "string") return ticket.client;
|
|
203
317
|
return ticket.client.company || ticket.client.firstName || "--";
|
|
204
318
|
};
|
|
205
|
-
const
|
|
319
|
+
const getStatusDotClass = (status) => {
|
|
206
320
|
switch (status) {
|
|
207
321
|
case "open":
|
|
208
|
-
return
|
|
322
|
+
return styles__default.default.statusDotOpen;
|
|
209
323
|
case "waiting_client":
|
|
210
|
-
return
|
|
324
|
+
return styles__default.default.statusDotWaiting;
|
|
211
325
|
case "resolved":
|
|
212
|
-
return
|
|
326
|
+
return styles__default.default.statusDotResolved;
|
|
213
327
|
default:
|
|
214
|
-
return "
|
|
328
|
+
return "";
|
|
215
329
|
}
|
|
216
330
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const csatCircumference = 2 * Math.PI * csatRadius;
|
|
222
|
-
const csatStrokeDashoffset = csatCircumference - csatPct / 100 * csatCircumference;
|
|
223
|
-
const csatColor = csatScore >= 4 ? "#22c55e" : csatScore >= 3 ? "#f59e0b" : csatScore > 0 ? "#ef4444" : "#94a3b8";
|
|
224
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "20px 30px", maxWidth: 1100, margin: "0 auto" }, children: [
|
|
225
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: 20 }, children: [
|
|
226
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { style: { fontSize: 24, fontWeight: 700, margin: 0, color: "var(--theme-text)" }, children: t("dashboard.title") }),
|
|
227
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "var(--theme-elevation-500)", margin: "4px 0 0", fontSize: 14 }, children: t("dashboard.subtitle") })
|
|
331
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.page, children: [
|
|
332
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.header, children: [
|
|
333
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: styles__default.default.title, children: t("dashboard.title") }),
|
|
334
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: styles__default.default.subtitle, children: t("dashboard.subtitle") })
|
|
228
335
|
] }),
|
|
229
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
230
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
336
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.statsRow, children: [
|
|
337
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
338
|
+
StatCard,
|
|
339
|
+
{
|
|
340
|
+
label: t("dashboard.openTickets"),
|
|
341
|
+
value: String(openCount),
|
|
342
|
+
trend: trendOpen,
|
|
343
|
+
accentColor: "#3b82f6"
|
|
344
|
+
}
|
|
345
|
+
),
|
|
346
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
347
|
+
StatCard,
|
|
348
|
+
{
|
|
349
|
+
label: t("dashboard.waitingClient"),
|
|
350
|
+
value: String(waitingCount),
|
|
351
|
+
trend: waitingTrend,
|
|
352
|
+
accentColor: "#f59e0b"
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
356
|
+
StatCard,
|
|
357
|
+
{
|
|
358
|
+
label: t("dashboard.responseTime"),
|
|
359
|
+
value: formatResponseTime(stats.avgResponseTimeHours),
|
|
360
|
+
accentColor: stats.avgResponseTimeHours != null && stats.avgResponseTimeHours > 24 ? "#ef4444" : "#22c55e"
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
StatCard,
|
|
365
|
+
{
|
|
366
|
+
label: t("dashboard.satisfaction"),
|
|
367
|
+
value: stats.satisfactionAvg > 0 ? `${stats.satisfactionAvg}/5` : "--",
|
|
368
|
+
accentColor: stats.satisfactionAvg >= 4 ? "#22c55e" : stats.satisfactionAvg >= 3 ? "#f59e0b" : "#94a3b8"
|
|
369
|
+
}
|
|
370
|
+
)
|
|
234
371
|
] }),
|
|
235
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
236
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
237
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", {
|
|
238
|
-
tickets.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.middleGrid, children: [
|
|
373
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.panel, children: [
|
|
374
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: styles__default.default.panelTitle, children: t("dashboard.activeTickets") }),
|
|
375
|
+
tickets.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.emptyTable, children: t("dashboard.noActiveTickets") }) : /* @__PURE__ */ jsxRuntime.jsxs("table", { className: styles__default.default.ticketTable, children: [
|
|
239
376
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
240
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", {
|
|
241
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", {
|
|
242
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", {
|
|
243
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", {
|
|
244
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", {
|
|
377
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { children: t("dashboard.tableHeaders.status") }),
|
|
378
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { children: t("dashboard.tableHeaders.number") }),
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { children: t("dashboard.tableHeaders.subject") }),
|
|
380
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { children: t("dashboard.tableHeaders.client") }),
|
|
381
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { children: t("dashboard.tableHeaders.modified") }),
|
|
382
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", {})
|
|
245
383
|
] }) }),
|
|
246
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: tickets.map((tk) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: tickets.map((tk) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
385
|
+
"tr",
|
|
386
|
+
{
|
|
387
|
+
onClick: () => {
|
|
388
|
+
window.location.href = `/admin/support/ticket?id=${tk.id}`;
|
|
389
|
+
},
|
|
390
|
+
children: [
|
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${styles__default.default.statusDot} ${getStatusDotClass(tk.status)}` }) }),
|
|
392
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: styles__default.default.ticketNum, children: [
|
|
393
|
+
"#",
|
|
394
|
+
tk.ticketNumber
|
|
395
|
+
] }),
|
|
396
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: styles__default.default.ticketSubject, children: tk.subject }),
|
|
397
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: styles__default.default.ticketClient, children: getClientName(tk) }),
|
|
398
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: styles__default.default.ticketTime, children: timeAgo(tk.updatedAt) }),
|
|
399
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: styles__default.default.ticketArrow, children: "\u2192" })
|
|
400
|
+
]
|
|
401
|
+
},
|
|
402
|
+
tk.id
|
|
403
|
+
)) })
|
|
258
404
|
] })
|
|
259
405
|
] }),
|
|
260
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
261
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
262
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", {
|
|
263
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
264
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 10, color: "var(--theme-elevation-400)", marginTop: 4 }, children: [
|
|
265
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: volumeData[0]?.label }),
|
|
266
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: volumeData[volumeData.length - 1]?.label })
|
|
267
|
-
] })
|
|
406
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.rightColumn, children: [
|
|
407
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.panel, children: [
|
|
408
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: styles__default.default.panelTitle, children: t("dashboard.volume7days") }),
|
|
409
|
+
/* @__PURE__ */ jsxRuntime.jsx(VolumeChart, { data: volumeData })
|
|
268
410
|
] }),
|
|
269
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
270
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", {
|
|
271
|
-
/* @__PURE__ */ jsxRuntime.
|
|
272
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", width: 80, height: 80 }, children: [
|
|
273
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "80", height: "80", viewBox: "0 0 100 100", children: [
|
|
274
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "50", r: csatRadius, fill: "none", stroke: "var(--theme-elevation-150, #e2e8f0)", strokeWidth: "6" }),
|
|
275
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "50", r: csatRadius, fill: "none", stroke: csatColor, strokeWidth: "6", strokeLinecap: "round", strokeDasharray: csatCircumference, strokeDashoffset: csatStrokeDashoffset, transform: "rotate(-90 50 50)", style: { transition: "stroke-dashoffset 600ms ease" } })
|
|
276
|
-
] }),
|
|
277
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", fontWeight: 700, fontSize: 16 }, children: csatScore > 0 ? csatScore.toFixed(1) : "--" })
|
|
278
|
-
] }),
|
|
279
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
280
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, fontWeight: 600 }, children: csatScore > 0 ? `${csatScore.toFixed(1)} / 5` : t("dashboard.csatNoData") }),
|
|
281
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "var(--theme-elevation-500)" }, children: stats.satisfactionCount > 0 ? t("dashboard.csatReviews", { count: String(stats.satisfactionCount) }) : t("dashboard.csatNoReviews") })
|
|
282
|
-
] })
|
|
283
|
-
] })
|
|
411
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.panel, children: [
|
|
412
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: styles__default.default.panelTitle, children: t("dashboard.csat") }),
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsx(CSATRing, { score: stats.satisfactionAvg, count: stats.satisfactionCount })
|
|
284
414
|
] })
|
|
285
415
|
] })
|
|
286
416
|
] }),
|
|
287
417
|
/* @__PURE__ */ jsxRuntime.jsx(SlaSection, {}),
|
|
288
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
289
|
-
/* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: "/admin/support/new-ticket",
|
|
290
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Link__default.default, { href: "/admin/support/emails",
|
|
418
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.actionsRow, children: [
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: "/admin/support/new-ticket", className: styles__default.default.actionBtn, children: t("dashboard.newTicketAction") }),
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Link__default.default, { href: "/admin/support/emails", className: styles__default.default.actionBtn, children: [
|
|
291
421
|
t("dashboard.pendingEmails"),
|
|
292
|
-
stats.pendingEmailsCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
422
|
+
stats.pendingEmailsCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${styles__default.default.badge} ${styles__default.default.badgeRed}`, children: stats.pendingEmailsCount }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${styles__default.default.badge} ${styles__default.default.badgeGreen}`, children: "0" })
|
|
293
423
|
] }),
|
|
294
|
-
/* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: "/admin/support/crm",
|
|
295
|
-
/* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: "/admin/support/billing",
|
|
296
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
424
|
+
/* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: "/admin/support/crm", className: styles__default.default.actionBtn, children: t("dashboard.crm") }),
|
|
425
|
+
/* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: "/admin/support/billing", className: styles__default.default.actionBtn, children: t("dashboard.preBilling") }),
|
|
426
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
427
|
+
"a",
|
|
428
|
+
{
|
|
429
|
+
href: "/api/support/export-csv",
|
|
430
|
+
className: styles__default.default.actionBtn,
|
|
431
|
+
target: "_blank",
|
|
432
|
+
rel: "noopener noreferrer",
|
|
433
|
+
children: t("dashboard.exportCsv")
|
|
434
|
+
}
|
|
435
|
+
)
|
|
297
436
|
] })
|
|
298
437
|
] });
|
|
299
438
|
};
|