@strapi-community/plugin-io 1.0.0

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.
@@ -0,0 +1,754 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const admin = require("@strapi/strapi/admin");
6
+ const styled = require("styled-components");
7
+ const designSystem = require("@strapi/design-system");
8
+ const index = require("./index-DkTxsEqL.js");
9
+ const index$1 = require("./index-BVQ20t1c.js");
10
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
+ const styled__default = /* @__PURE__ */ _interopDefault(styled);
12
+ const UsersIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z" }) });
13
+ const BoltIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z" }) });
14
+ const ChartBarIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z" }) });
15
+ const HomeIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" }) });
16
+ const ArrowPathIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" }) });
17
+ const TrashIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" }) });
18
+ const PlayIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z" }) });
19
+ const SignalIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9.348 14.652a3.75 3.75 0 0 1 0-5.304m5.304 0a3.75 3.75 0 0 1 0 5.304m-7.425 2.121a6.75 6.75 0 0 1 0-9.546m9.546 0a6.75 6.75 0 0 1 0 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z" }) });
20
+ const customColors = {
21
+ primary: { 100: "#E0F2FE", 500: "#0EA5E9", 600: "#0284C7" },
22
+ secondary: { 100: "#EDE9FE", 500: "#A855F7", 600: "#9333EA" },
23
+ success: { 100: "#DCFCE7", 500: "#22C55E", 600: "#16A34A" },
24
+ warning: { 100: "#FEF3C7", 500: "#F59E0B", 600: "#D97706" }
25
+ };
26
+ const fadeIn = styled.keyframes`
27
+ from { opacity: 0; transform: translateY(20px); }
28
+ to { opacity: 1; transform: translateY(0); }
29
+ `;
30
+ const shimmer = styled.keyframes`
31
+ 0% { background-position: -200% 0; }
32
+ 100% { background-position: 200% 0; }
33
+ `;
34
+ const float = styled.keyframes`
35
+ 0%, 100% { transform: translateY(0); }
36
+ 50% { transform: translateY(-8px); }
37
+ `;
38
+ const Container = styled__default.default(designSystem.Box)`
39
+ ${styled.css`animation: ${fadeIn} 0.6s;`}
40
+ min-height: 100vh;
41
+ max-width: 1440px;
42
+ margin: 0 auto;
43
+ padding: 24px 16px 0;
44
+
45
+ @media (min-width: 768px) {
46
+ padding: 32px 24px 0;
47
+ }
48
+ `;
49
+ const Header = styled__default.default(designSystem.Box)`
50
+ background: linear-gradient(135deg, ${customColors.primary[600]} 0%, ${customColors.secondary[600]} 100%);
51
+ border-radius: 12px;
52
+ padding: 20px 16px;
53
+ margin-bottom: 20px;
54
+ position: relative;
55
+ overflow: hidden;
56
+ box-shadow: ${({ theme }) => theme.shadows.tableShadow};
57
+
58
+ @media (min-width: 768px) {
59
+ border-radius: 16px;
60
+ padding: 32px 48px;
61
+ margin-bottom: 32px;
62
+ }
63
+
64
+ &::before {
65
+ content: '';
66
+ position: absolute;
67
+ top: 0;
68
+ left: -100%;
69
+ width: 200%;
70
+ height: 100%;
71
+ background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
72
+ ${styled.css`animation: ${shimmer} 3s infinite;`}
73
+ }
74
+ `;
75
+ const Title = styled__default.default(designSystem.Typography)`
76
+ color: #fff;
77
+ font-size: 1.5rem;
78
+ font-weight: 700;
79
+ display: flex;
80
+ align-items: center;
81
+ gap: 10px;
82
+ margin-bottom: 6px;
83
+
84
+ @media (min-width: 768px) {
85
+ font-size: 2.25rem;
86
+ gap: 16px;
87
+ margin-bottom: 8px;
88
+ }
89
+
90
+ svg {
91
+ width: 24px;
92
+ height: 24px;
93
+ ${styled.css`animation: ${float} 3s ease-in-out infinite;`}
94
+
95
+ @media (min-width: 768px) {
96
+ width: 32px;
97
+ height: 32px;
98
+ }
99
+ }
100
+ `;
101
+ const Subtitle = styled__default.default(designSystem.Typography)`
102
+ color: rgba(255,255,255,0.95);
103
+ font-size: 0.875rem;
104
+
105
+ @media (min-width: 768px) {
106
+ font-size: 1rem;
107
+ }
108
+ `;
109
+ const StatsGrid = styled__default.default.div`
110
+ display: grid;
111
+ grid-template-columns: repeat(2, 1fr);
112
+ gap: 12px;
113
+ margin-bottom: 24px;
114
+
115
+ @media (min-width: 640px) {
116
+ gap: 16px;
117
+ margin-bottom: 32px;
118
+ }
119
+
120
+ @media (min-width: 1024px) {
121
+ grid-template-columns: repeat(4, 1fr);
122
+ gap: 24px;
123
+ margin-bottom: 40px;
124
+ }
125
+ `;
126
+ const StatCard = styled__default.default(designSystem.Box)`
127
+ background: ${({ theme }) => theme.colors.neutral0};
128
+ border-radius: 10px;
129
+ padding: 16px;
130
+ transition: all 0.2s;
131
+ ${styled.css`animation: ${fadeIn} 0.5s backwards;`}
132
+ animation-delay: ${(p) => p.$delay || "0s"};
133
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
134
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
135
+ text-align: center;
136
+ display: flex;
137
+ flex-direction: column;
138
+ align-items: center;
139
+
140
+ @media (min-width: 640px) {
141
+ border-radius: 12px;
142
+ padding: 20px;
143
+ }
144
+
145
+ @media (min-width: 1024px) {
146
+ padding: 32px;
147
+ }
148
+
149
+ &:hover {
150
+ transform: translateY(-4px);
151
+ box-shadow: ${({ theme }) => theme.shadows.tableShadow};
152
+ border-color: ${(p) => p.$borderColor || customColors.primary[500]};
153
+
154
+ .stat-icon {
155
+ transform: scale(1.1);
156
+ }
157
+
158
+ .stat-value {
159
+ transform: scale(1.05);
160
+ color: ${(p) => p.$accentColor || customColors.primary[600]};
161
+ }
162
+ }
163
+ `;
164
+ const StatIcon = styled__default.default(designSystem.Box)`
165
+ width: 48px;
166
+ height: 48px;
167
+ border-radius: 10px;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ background: ${(p) => p.$bg || customColors.primary[100]};
172
+ transition: all 0.2s;
173
+ margin: 0 auto 12px;
174
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
175
+
176
+ @media (min-width: 640px) {
177
+ width: 60px;
178
+ height: 60px;
179
+ border-radius: 12px;
180
+ margin-bottom: 16px;
181
+ }
182
+
183
+ @media (min-width: 1024px) {
184
+ width: 80px;
185
+ height: 80px;
186
+ margin-bottom: 24px;
187
+ }
188
+
189
+ svg {
190
+ width: 24px;
191
+ height: 24px;
192
+ color: ${(p) => p.$color || customColors.primary[600]};
193
+
194
+ @media (min-width: 640px) {
195
+ width: 30px;
196
+ height: 30px;
197
+ }
198
+
199
+ @media (min-width: 1024px) {
200
+ width: 40px;
201
+ height: 40px;
202
+ }
203
+ }
204
+ `;
205
+ const StatValue = styled__default.default(designSystem.Typography)`
206
+ font-size: 2rem;
207
+ font-weight: 700;
208
+ color: ${({ theme }) => theme.colors.neutral800};
209
+ line-height: 1;
210
+ margin-bottom: 6px;
211
+ transition: all 0.2s;
212
+
213
+ @media (min-width: 640px) {
214
+ font-size: 2.5rem;
215
+ margin-bottom: 8px;
216
+ }
217
+
218
+ @media (min-width: 1024px) {
219
+ font-size: 3.5rem;
220
+ margin-bottom: 12px;
221
+ }
222
+ `;
223
+ const StatLabel = styled__default.default(designSystem.Typography)`
224
+ font-size: 0.75rem;
225
+ color: ${({ theme }) => theme.colors.neutral600};
226
+ font-weight: 500;
227
+
228
+ @media (min-width: 640px) {
229
+ font-size: 0.875rem;
230
+ }
231
+
232
+ @media (min-width: 1024px) {
233
+ font-size: 1rem;
234
+ }
235
+ `;
236
+ const Card = styled__default.default(designSystem.Box)`
237
+ background: ${({ theme }) => theme.colors.neutral0};
238
+ border-radius: 10px;
239
+ padding: 16px;
240
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
241
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
242
+ margin-bottom: 16px;
243
+ transition: all 0.2s;
244
+
245
+ @media (min-width: 640px) {
246
+ border-radius: 12px;
247
+ padding: 20px;
248
+ margin-bottom: 20px;
249
+ }
250
+
251
+ @media (min-width: 1024px) {
252
+ padding: 28px;
253
+ margin-bottom: 28px;
254
+ box-shadow: ${({ theme }) => theme.shadows.tableShadow};
255
+ }
256
+
257
+ &:hover {
258
+ box-shadow: ${({ theme }) => theme.shadows.tableShadow};
259
+ border-color: ${customColors.primary[100]};
260
+
261
+ @media (min-width: 1024px) {
262
+ box-shadow: ${({ theme }) => theme.shadows.popupShadow};
263
+ }
264
+ }
265
+ `;
266
+ const CardTitle = styled__default.default(designSystem.Typography)`
267
+ font-size: 1rem;
268
+ font-weight: 700;
269
+ color: ${({ theme }) => theme.colors.neutral800};
270
+ margin-bottom: 12px;
271
+ display: flex;
272
+ align-items: center;
273
+ gap: 8px;
274
+
275
+ @media (min-width: 640px) {
276
+ font-size: 1.125rem;
277
+ margin-bottom: 16px;
278
+ gap: 10px;
279
+ }
280
+
281
+ @media (min-width: 1024px) {
282
+ font-size: 1.25rem;
283
+ margin-bottom: 20px;
284
+ gap: 12px;
285
+ }
286
+
287
+ svg {
288
+ width: 20px;
289
+ height: 20px;
290
+ color: ${customColors.primary[600]};
291
+
292
+ @media (min-width: 1024px) {
293
+ width: 24px;
294
+ height: 24px;
295
+ }
296
+ }
297
+ `;
298
+ const ClientItem = styled__default.default(designSystem.Box)`
299
+ background: ${({ theme }) => theme.colors.neutral100};
300
+ border-radius: 8px;
301
+ padding: 12px;
302
+ margin-bottom: 10px;
303
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
304
+ transition: all 0.15s;
305
+
306
+ @media (min-width: 640px) {
307
+ border-radius: 10px;
308
+ padding: 16px 20px;
309
+ margin-bottom: 12px;
310
+ }
311
+
312
+ &:hover {
313
+ background: ${({ theme }) => theme.colors.neutral150};
314
+ border-color: ${customColors.primary[100]};
315
+ }
316
+ `;
317
+ const EventItem = styled__default.default(designSystem.Box)`
318
+ background: ${({ theme }) => theme.colors.neutral100};
319
+ border-radius: 8px;
320
+ padding: 10px 12px;
321
+ margin-bottom: 8px;
322
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
323
+ transition: all 0.15s;
324
+
325
+ @media (min-width: 640px) {
326
+ border-radius: 10px;
327
+ padding: 14px 18px;
328
+ margin-bottom: 10px;
329
+ }
330
+
331
+ &:hover {
332
+ background: ${({ theme }) => theme.colors.neutral150};
333
+ border-color: ${customColors.success[500]};
334
+ }
335
+ `;
336
+ const EmptyState = styled__default.default(designSystem.Box)`
337
+ text-align: center;
338
+ padding: 24px 16px;
339
+ display: flex;
340
+ flex-direction: column;
341
+ align-items: center;
342
+ justify-content: center;
343
+
344
+ @media (min-width: 640px) {
345
+ padding: 36px 24px;
346
+ }
347
+
348
+ @media (min-width: 1024px) {
349
+ padding: 48px 24px;
350
+ }
351
+
352
+ svg {
353
+ width: 32px;
354
+ height: 32px;
355
+ color: ${({ theme }) => theme.colors.neutral400};
356
+ margin-bottom: 12px;
357
+
358
+ @media (min-width: 1024px) {
359
+ width: 48px;
360
+ height: 48px;
361
+ margin-bottom: 16px;
362
+ }
363
+ }
364
+ `;
365
+ const ActionButton = styled__default.default.button`
366
+ display: inline-flex;
367
+ align-items: center;
368
+ gap: 6px;
369
+ padding: 8px 12px;
370
+ border-radius: 6px;
371
+ font-size: 13px;
372
+ font-weight: 600;
373
+ cursor: pointer;
374
+ transition: all 0.15s;
375
+ border: none;
376
+ white-space: nowrap;
377
+
378
+ @media (min-width: 640px) {
379
+ gap: 8px;
380
+ padding: 10px 16px;
381
+ border-radius: 8px;
382
+ font-size: 14px;
383
+ }
384
+
385
+ @media (min-width: 1024px) {
386
+ padding: 10px 20px;
387
+ }
388
+
389
+ svg {
390
+ width: 16px;
391
+ height: 16px;
392
+
393
+ @media (min-width: 1024px) {
394
+ width: 18px;
395
+ height: 18px;
396
+ }
397
+ }
398
+
399
+ &.primary {
400
+ background: ${({ theme }) => theme.colors.primary600};
401
+ color: ${({ theme }) => theme.colors.neutral0};
402
+ box-shadow: 0 2px 8px rgba(14,165,233,0.3);
403
+
404
+ @media (min-width: 1024px) {
405
+ box-shadow: 0 4px 12px rgba(14,165,233,0.3);
406
+ }
407
+
408
+ &:hover {
409
+ transform: translateY(-2px);
410
+ background: ${({ theme }) => theme.colors.primary700};
411
+ box-shadow: 0 4px 12px rgba(14,165,233,0.4);
412
+
413
+ @media (min-width: 1024px) {
414
+ box-shadow: 0 6px 16px rgba(14,165,233,0.4);
415
+ }
416
+ }
417
+ }
418
+
419
+ &.secondary {
420
+ background: ${({ theme }) => theme.colors.neutral150};
421
+ color: ${({ theme }) => theme.colors.neutral700};
422
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
423
+
424
+ &:hover {
425
+ background: ${({ theme }) => theme.colors.neutral200};
426
+ }
427
+ }
428
+
429
+ &.danger {
430
+ background: ${({ theme }) => theme.colors.danger100};
431
+ color: ${({ theme }) => theme.colors.danger700};
432
+ border: 1px solid ${({ theme }) => theme.colors.danger200};
433
+
434
+ &:hover {
435
+ background: ${({ theme }) => theme.colors.danger200};
436
+ }
437
+ }
438
+ `;
439
+ const ResponsiveGrid = styled__default.default.div`
440
+ display: flex;
441
+ flex-direction: column;
442
+ gap: 16px;
443
+
444
+ @media (min-width: 1024px) {
445
+ display: grid;
446
+ grid-template-columns: repeat(2, 1fr);
447
+ gap: 24px;
448
+ }
449
+ `;
450
+ const ResponsiveBox = styled__default.default(designSystem.Box)`
451
+ min-width: 100%;
452
+
453
+ @media (min-width: 1024px) {
454
+ min-width: 400px;
455
+ }
456
+ `;
457
+ const StyledSelect = styled__default.default.select`
458
+ padding: 6px 12px;
459
+ border-radius: 4px;
460
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
461
+ font-size: 13px;
462
+ cursor: pointer;
463
+ background: ${({ theme }) => theme.colors.neutral0};
464
+ color: ${({ theme }) => theme.colors.neutral800};
465
+ transition: all 0.15s;
466
+
467
+ &:hover {
468
+ border-color: ${({ theme }) => theme.colors.primary600};
469
+ }
470
+
471
+ &:focus {
472
+ outline: none;
473
+ border-color: ${({ theme }) => theme.colors.primary600};
474
+ box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primary100};
475
+ }
476
+
477
+ option {
478
+ background: ${({ theme }) => theme.colors.neutral0};
479
+ color: ${({ theme }) => theme.colors.neutral800};
480
+ }
481
+ `;
482
+ const MonitoringPage = () => {
483
+ const { get, post } = admin.useFetchClient();
484
+ const { toggleNotification } = admin.useNotification();
485
+ const { formatMessage } = index.useIntl();
486
+ const t = (id, def) => formatMessage({ id: `${index$1.PLUGIN_ID}.${id}`, defaultMessage: def });
487
+ const [stats, setStats] = React.useState(null);
488
+ const [eventLog, setEventLog] = React.useState([]);
489
+ const [isLoading, setIsLoading] = React.useState(true);
490
+ const [testEventName, setTestEventName] = React.useState("test");
491
+ const [testEventData, setTestEventData] = React.useState("{}");
492
+ const [eventTypeFilter, setEventTypeFilter] = React.useState("all");
493
+ const [searchTerm, setSearchTerm] = React.useState("");
494
+ React.useEffect(() => {
495
+ fetchStats();
496
+ const interval = setInterval(fetchStats, 6e4);
497
+ return () => clearInterval(interval);
498
+ }, []);
499
+ const fetchStats = async () => {
500
+ try {
501
+ const [s, l] = await Promise.all([
502
+ get(`/${index$1.PLUGIN_ID}/stats`),
503
+ get(`/${index$1.PLUGIN_ID}/event-log?limit=50`)
504
+ ]);
505
+ if (s.data?.data) setStats(s.data.data);
506
+ if (l.data?.data) setEventLog(l.data.data);
507
+ setIsLoading(false);
508
+ } catch (e) {
509
+ setIsLoading(false);
510
+ }
511
+ };
512
+ const handleSendTestEvent = async () => {
513
+ try {
514
+ const data = JSON.parse(testEventData);
515
+ await post(`/${index$1.PLUGIN_ID}/test-event`, { eventName: testEventName, data });
516
+ toggleNotification({ type: "success", message: "Test event sent!" });
517
+ fetchStats();
518
+ } catch {
519
+ toggleNotification({ type: "warning", message: "Invalid JSON" });
520
+ }
521
+ };
522
+ const handleResetStats = async () => {
523
+ try {
524
+ await post(`/${index$1.PLUGIN_ID}/reset-stats`);
525
+ toggleNotification({ type: "success", message: "Stats reset!" });
526
+ fetchStats();
527
+ } catch {
528
+ toggleNotification({ type: "danger", message: "Error" });
529
+ }
530
+ };
531
+ const filteredEvents = eventLog.filter((event) => {
532
+ if (eventTypeFilter !== "all" && event.type !== eventTypeFilter) return false;
533
+ if (searchTerm && !JSON.stringify(event).toLowerCase().includes(searchTerm.toLowerCase())) {
534
+ return false;
535
+ }
536
+ return true;
537
+ });
538
+ const eventTypes = ["all", ...new Set(eventLog.map((e) => e.type))];
539
+ if (isLoading) {
540
+ return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 8, style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading..." }) }) });
541
+ }
542
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
543
+ /* @__PURE__ */ jsxRuntime.jsx(Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(
544
+ designSystem.Flex,
545
+ {
546
+ direction: { base: "column", tablet: "row" },
547
+ justifyContent: "space-between",
548
+ alignItems: { base: "flex-start", tablet: "center" },
549
+ gap: 3,
550
+ style: { position: "relative", zIndex: 1 },
551
+ children: [
552
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
553
+ /* @__PURE__ */ jsxRuntime.jsxs(Title, { children: [
554
+ /* @__PURE__ */ jsxRuntime.jsx(SignalIcon, {}),
555
+ t("monitoring.title", "Monitoring & Logging")
556
+ ] }),
557
+ /* @__PURE__ */ jsxRuntime.jsx(Subtitle, { children: t("monitoring.description", "Real-time connection and event statistics") })
558
+ ] }),
559
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
560
+ /* @__PURE__ */ jsxRuntime.jsxs(ActionButton, { className: "secondary", onClick: fetchStats, children: [
561
+ /* @__PURE__ */ jsxRuntime.jsx(ArrowPathIcon, {}),
562
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: "Refresh" }),
563
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline" }, children: "↻" })
564
+ ] }),
565
+ /* @__PURE__ */ jsxRuntime.jsxs(ActionButton, { className: "danger", onClick: handleResetStats, children: [
566
+ /* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
567
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: "Reset" }),
568
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline" }, children: "✕" })
569
+ ] })
570
+ ] })
571
+ ]
572
+ }
573
+ ) }),
574
+ /* @__PURE__ */ jsxRuntime.jsxs(StatsGrid, { children: [
575
+ /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.1s", $borderColor: customColors.primary[500], $accentColor: customColors.primary[600], children: [
576
+ /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: customColors.primary[100], $color: customColors.primary[600], children: /* @__PURE__ */ jsxRuntime.jsx(UsersIcon, {}) }),
577
+ /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: stats?.connections?.connected || 0 }),
578
+ /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("monitoring.connectedClients", "Connected Clients") })
579
+ ] }),
580
+ /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.2s", $borderColor: customColors.success[500], $accentColor: customColors.success[600], children: [
581
+ /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: customColors.success[100], $color: customColors.success[600], children: /* @__PURE__ */ jsxRuntime.jsx(BoltIcon, {}) }),
582
+ /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: stats?.events?.totalEvents || 0 }),
583
+ /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("monitoring.totalEvents", "Total Events") })
584
+ ] }),
585
+ /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.3s", $borderColor: customColors.warning[500], $accentColor: customColors.warning[600], children: [
586
+ /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: customColors.warning[100], $color: customColors.warning[600], children: /* @__PURE__ */ jsxRuntime.jsx(ChartBarIcon, {}) }),
587
+ /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: stats?.events?.eventsPerSecond || "0.00" }),
588
+ /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("monitoring.eventsPerSecond", "Events/Second") })
589
+ ] }),
590
+ /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.4s", $borderColor: customColors.secondary[500], $accentColor: customColors.secondary[600], children: [
591
+ /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: customColors.secondary[100], $color: customColors.secondary[600], children: /* @__PURE__ */ jsxRuntime.jsx(HomeIcon, {}) }),
592
+ /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: stats?.connections?.rooms?.length || 0 }),
593
+ /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("monitoring.rooms", "Active Rooms") })
594
+ ] })
595
+ ] }),
596
+ /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
597
+ /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { children: [
598
+ /* @__PURE__ */ jsxRuntime.jsx(PlayIcon, {}),
599
+ t("monitoring.testEvent", "Send Test Event")
600
+ ] }),
601
+ /* @__PURE__ */ jsxRuntime.jsxs(
602
+ designSystem.Flex,
603
+ {
604
+ direction: { base: "column", tablet: "row" },
605
+ gap: 3,
606
+ alignItems: { base: "stretch", tablet: "flex-end" },
607
+ children: [
608
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%", maxWidth: "220px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
609
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Event Name" }),
610
+ /* @__PURE__ */ jsxRuntime.jsx(
611
+ designSystem.TextInput,
612
+ {
613
+ value: testEventName,
614
+ onChange: (e) => setTestEventName(e.target.value),
615
+ placeholder: "test"
616
+ }
617
+ )
618
+ ] }) }),
619
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
620
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Event Data (JSON)" }),
621
+ /* @__PURE__ */ jsxRuntime.jsx(
622
+ designSystem.TextInput,
623
+ {
624
+ value: testEventData,
625
+ onChange: (e) => setTestEventData(e.target.value),
626
+ placeholder: '{"message":"Hello"}'
627
+ }
628
+ )
629
+ ] }) }),
630
+ /* @__PURE__ */ jsxRuntime.jsxs(ActionButton, { className: "primary", onClick: handleSendTestEvent, style: { alignSelf: "flex-end" }, children: [
631
+ /* @__PURE__ */ jsxRuntime.jsx(PlayIcon, {}),
632
+ "Send"
633
+ ] })
634
+ ]
635
+ }
636
+ )
637
+ ] }),
638
+ /* @__PURE__ */ jsxRuntime.jsxs(ResponsiveGrid, { children: [
639
+ /* @__PURE__ */ jsxRuntime.jsx(ResponsiveBox, { children: /* @__PURE__ */ jsxRuntime.jsxs(Card, { style: { minHeight: "280px" }, children: [
640
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 3, children: [
641
+ /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { style: { marginBottom: 0 }, children: [
642
+ /* @__PURE__ */ jsxRuntime.jsx(UsersIcon, {}),
643
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: t("monitoring.connectedClientsList", "Connected Clients") }),
644
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline" }, children: "Clients" })
645
+ ] }),
646
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { active: true, children: [
647
+ stats?.connections?.connected || 0,
648
+ " online"
649
+ ] })
650
+ ] }),
651
+ stats?.connections?.sockets?.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { maxHeight: "220px", overflowY: "auto" }, children: stats.connections.sockets.map((s) => /* @__PURE__ */ jsxRuntime.jsx(ClientItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(
652
+ designSystem.Flex,
653
+ {
654
+ direction: { base: "column", tablet: "row" },
655
+ justifyContent: "space-between",
656
+ alignItems: { base: "flex-start", tablet: "center" },
657
+ gap: 2,
658
+ children: [
659
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1, minWidth: 0 }, children: [
660
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", children: s.user ? s.user.username : "Anonymous" }),
661
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, wrap: "wrap", children: [
662
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { fontSize: "12px" }, children: s.user?.email || s.handshake.address }),
663
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral400", children: "•" }),
664
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "12px" }, children: s.user?.role || "public" })
665
+ ] }),
666
+ /* @__PURE__ */ jsxRuntime.jsx(
667
+ designSystem.Typography,
668
+ {
669
+ variant: "pi",
670
+ textColor: "neutral300",
671
+ style: { fontFamily: "monospace", fontSize: "10px", wordBreak: "break-all" },
672
+ children: s.id
673
+ }
674
+ )
675
+ ] }),
676
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { active: s.connected, children: s.connected ? "Online" : "Offline" })
677
+ ]
678
+ }
679
+ ) }, s.id)) }) : /* @__PURE__ */ jsxRuntime.jsxs(EmptyState, { children: [
680
+ /* @__PURE__ */ jsxRuntime.jsx(UsersIcon, {}),
681
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", textColor: "neutral600", children: t("monitoring.noClients", "No clients connected") })
682
+ ] })
683
+ ] }) }),
684
+ /* @__PURE__ */ jsxRuntime.jsx(ResponsiveBox, { children: /* @__PURE__ */ jsxRuntime.jsxs(Card, { style: { minHeight: "280px" }, children: [
685
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 2, children: [
686
+ /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { style: { marginBottom: 0 }, children: [
687
+ /* @__PURE__ */ jsxRuntime.jsx(BoltIcon, {}),
688
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: t("monitoring.eventLog", "Recent Events") }),
689
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline" }, children: "Events" })
690
+ ] }),
691
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: filteredEvents.length })
692
+ ] }),
693
+ /* @__PURE__ */ jsxRuntime.jsxs(
694
+ designSystem.Flex,
695
+ {
696
+ direction: { base: "column", tablet: "row" },
697
+ gap: 2,
698
+ marginBottom: 3,
699
+ children: [
700
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
701
+ designSystem.TextInput,
702
+ {
703
+ placeholder: t("monitoring.searchEvents", "Search events..."),
704
+ value: searchTerm,
705
+ onChange: (e) => setSearchTerm(e.target.value),
706
+ size: "S"
707
+ }
708
+ ) }),
709
+ /* @__PURE__ */ jsxRuntime.jsx(
710
+ StyledSelect,
711
+ {
712
+ value: eventTypeFilter,
713
+ onChange: (e) => setEventTypeFilter(e.target.value),
714
+ children: eventTypes.map((type) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: type, children: type === "all" ? "All Types" : type }, type))
715
+ }
716
+ )
717
+ ]
718
+ }
719
+ ),
720
+ filteredEvents.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { maxHeight: "180px", overflowY: "auto" }, children: filteredEvents.slice().reverse().slice(0, 10).map((e, i) => /* @__PURE__ */ jsxRuntime.jsx(EventItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
721
+ designSystem.Flex,
722
+ {
723
+ direction: { base: "column", tablet: "row" },
724
+ justifyContent: "space-between",
725
+ alignItems: { base: "flex-start", tablet: "center" },
726
+ gap: 2,
727
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1, minWidth: 0 }, children: [
728
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", wrap: "wrap", marginBottom: 1, children: [
729
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: e.type }),
730
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "11px" }, children: new Date(e.timestamp).toLocaleTimeString() })
731
+ ] }),
732
+ /* @__PURE__ */ jsxRuntime.jsxs(
733
+ designSystem.Typography,
734
+ {
735
+ variant: "pi",
736
+ style: { fontFamily: "monospace", fontSize: "11px", wordBreak: "break-all" },
737
+ textColor: "neutral600",
738
+ children: [
739
+ JSON.stringify(e.data).substring(0, 50),
740
+ "..."
741
+ ]
742
+ }
743
+ )
744
+ ] })
745
+ }
746
+ ) }, i)) }) : /* @__PURE__ */ jsxRuntime.jsxs(EmptyState, { children: [
747
+ /* @__PURE__ */ jsxRuntime.jsx(BoltIcon, {}),
748
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", textColor: "neutral600", children: searchTerm || eventTypeFilter !== "all" ? t("monitoring.noMatchingEvents", "No matching events") : t("monitoring.noEvents", "No events logged") })
749
+ ] })
750
+ ] }) })
751
+ ] })
752
+ ] });
753
+ };
754
+ exports.MonitoringPage = MonitoringPage;