@copilotz/admin 0.3.4 → 0.3.6
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/index.cjs +955 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +214 -0
- package/dist/index.js +430 -181
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1414 -0
- package/package.json +25 -7
package/dist/index.js
CHANGED
|
@@ -300,8 +300,212 @@ function useCopilotzAdmin(options = {}) {
|
|
|
300
300
|
]);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
// src/lib/utils.ts
|
|
304
|
+
import { clsx } from "clsx";
|
|
305
|
+
import { twMerge } from "tailwind-merge";
|
|
306
|
+
function cn(...inputs) {
|
|
307
|
+
return twMerge(clsx(inputs));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/components/ui/card.tsx
|
|
311
|
+
import { jsx } from "react/jsx-runtime";
|
|
312
|
+
function Card({ className, ...props }) {
|
|
313
|
+
return /* @__PURE__ */ jsx(
|
|
314
|
+
"div",
|
|
315
|
+
{
|
|
316
|
+
"data-slot": "card",
|
|
317
|
+
className: cn(
|
|
318
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
319
|
+
className
|
|
320
|
+
),
|
|
321
|
+
...props
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
function CardContent({ className, ...props }) {
|
|
326
|
+
return /* @__PURE__ */ jsx(
|
|
327
|
+
"div",
|
|
328
|
+
{
|
|
329
|
+
"data-slot": "card-content",
|
|
330
|
+
className: cn("px-6", className),
|
|
331
|
+
...props
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// src/components/ui/button.tsx
|
|
337
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
338
|
+
import { cva } from "class-variance-authority";
|
|
339
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
340
|
+
var buttonVariants = cva(
|
|
341
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
342
|
+
{
|
|
343
|
+
variants: {
|
|
344
|
+
variant: {
|
|
345
|
+
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
346
|
+
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
347
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
348
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
349
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
350
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
351
|
+
},
|
|
352
|
+
size: {
|
|
353
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
354
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
355
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
356
|
+
icon: "size-9"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
defaultVariants: {
|
|
360
|
+
variant: "default",
|
|
361
|
+
size: "default"
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
function Button({
|
|
366
|
+
className,
|
|
367
|
+
variant,
|
|
368
|
+
size,
|
|
369
|
+
asChild = false,
|
|
370
|
+
...props
|
|
371
|
+
}) {
|
|
372
|
+
const Comp = asChild ? Slot : "button";
|
|
373
|
+
return /* @__PURE__ */ jsx2(
|
|
374
|
+
Comp,
|
|
375
|
+
{
|
|
376
|
+
"data-slot": "button",
|
|
377
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
378
|
+
...props
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/components/ui/input.tsx
|
|
384
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
385
|
+
function Input({ className, type, ...props }) {
|
|
386
|
+
return /* @__PURE__ */ jsx3(
|
|
387
|
+
"input",
|
|
388
|
+
{
|
|
389
|
+
type,
|
|
390
|
+
"data-slot": "input",
|
|
391
|
+
className: cn(
|
|
392
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
393
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
394
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
395
|
+
className
|
|
396
|
+
),
|
|
397
|
+
...props
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// src/components/ui/badge.tsx
|
|
403
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
404
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
405
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
406
|
+
var badgeVariants = cva2(
|
|
407
|
+
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
408
|
+
{
|
|
409
|
+
variants: {
|
|
410
|
+
variant: {
|
|
411
|
+
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
412
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
413
|
+
destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
414
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
defaultVariants: {
|
|
418
|
+
variant: "default"
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
function Badge({
|
|
423
|
+
className,
|
|
424
|
+
variant,
|
|
425
|
+
asChild = false,
|
|
426
|
+
...props
|
|
427
|
+
}) {
|
|
428
|
+
const Comp = asChild ? Slot2 : "span";
|
|
429
|
+
return /* @__PURE__ */ jsx4(
|
|
430
|
+
Comp,
|
|
431
|
+
{
|
|
432
|
+
"data-slot": "badge",
|
|
433
|
+
className: cn(badgeVariants({ variant }), className),
|
|
434
|
+
...props
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// src/components/ui/select.tsx
|
|
440
|
+
import * as React from "react";
|
|
441
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
442
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
443
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
444
|
+
var Select = SelectPrimitive.Root;
|
|
445
|
+
var SelectValue = SelectPrimitive.Value;
|
|
446
|
+
var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
447
|
+
SelectPrimitive.Trigger,
|
|
448
|
+
{
|
|
449
|
+
ref,
|
|
450
|
+
className: cn(
|
|
451
|
+
"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-colors placeholder:text-muted-foreground focus:ring-2 focus:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50",
|
|
452
|
+
className
|
|
453
|
+
),
|
|
454
|
+
...props,
|
|
455
|
+
children: [
|
|
456
|
+
children,
|
|
457
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx5(ChevronDown, { className: "h-4 w-4 opacity-50" }) })
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
));
|
|
461
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
462
|
+
var SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
463
|
+
SelectPrimitive.Content,
|
|
464
|
+
{
|
|
465
|
+
ref,
|
|
466
|
+
className: cn(
|
|
467
|
+
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
468
|
+
position === "popper" && "translate-y-1",
|
|
469
|
+
className
|
|
470
|
+
),
|
|
471
|
+
position,
|
|
472
|
+
...props,
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.ScrollUpButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ jsx5(ChevronUp, { className: "h-4 w-4" }) }),
|
|
475
|
+
/* @__PURE__ */ jsx5(
|
|
476
|
+
SelectPrimitive.Viewport,
|
|
477
|
+
{
|
|
478
|
+
className: cn(
|
|
479
|
+
"p-1",
|
|
480
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
481
|
+
),
|
|
482
|
+
children
|
|
483
|
+
}
|
|
484
|
+
),
|
|
485
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.ScrollDownButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ jsx5(ChevronDown, { className: "h-4 w-4" }) })
|
|
486
|
+
]
|
|
487
|
+
}
|
|
488
|
+
) }));
|
|
489
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
490
|
+
var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
491
|
+
SelectPrimitive.Item,
|
|
492
|
+
{
|
|
493
|
+
ref,
|
|
494
|
+
className: cn(
|
|
495
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
496
|
+
className
|
|
497
|
+
),
|
|
498
|
+
...props,
|
|
499
|
+
children: [
|
|
500
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children }),
|
|
501
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.ItemIndicator, { className: "absolute right-2 inline-flex items-center justify-center", children: /* @__PURE__ */ jsx5(Check, { className: "h-4 w-4" }) })
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
));
|
|
505
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
506
|
+
|
|
303
507
|
// src/CopilotzAdmin.tsx
|
|
304
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
508
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
305
509
|
var CopilotzAdmin = ({
|
|
306
510
|
config: userConfig,
|
|
307
511
|
className
|
|
@@ -354,112 +558,115 @@ var CopilotzAdmin = ({
|
|
|
354
558
|
}
|
|
355
559
|
];
|
|
356
560
|
if (admin.isLoading && !admin.overview) {
|
|
357
|
-
return /* @__PURE__ */
|
|
561
|
+
return /* @__PURE__ */ jsx6(Card, { className: cn("border-border", className), children: /* @__PURE__ */ jsx6(CardContent, { className: "text-muted-foreground", children: config.labels.loading }) });
|
|
358
562
|
}
|
|
359
563
|
if (admin.error && !admin.overview) {
|
|
360
|
-
return /* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
|
|
564
|
+
return /* @__PURE__ */ jsx6(Card, { className: cn("border-destructive/50 bg-destructive/10", className), children: /* @__PURE__ */ jsxs2(CardContent, { className: "space-y-4", children: [
|
|
565
|
+
/* @__PURE__ */ jsx6("p", { className: "text-base font-semibold text-destructive", children: admin.error.message }),
|
|
566
|
+
/* @__PURE__ */ jsx6(
|
|
567
|
+
Button,
|
|
364
568
|
{
|
|
365
|
-
|
|
569
|
+
variant: "destructive",
|
|
366
570
|
onClick: () => void admin.refresh(),
|
|
367
|
-
type: "button",
|
|
368
571
|
children: config.labels.retry
|
|
369
572
|
}
|
|
370
573
|
)
|
|
371
|
-
] });
|
|
574
|
+
] }) });
|
|
372
575
|
}
|
|
373
576
|
const isEmpty = cards.every((card) => card.value === 0) && admin.activity.length === 0 && admin.threads.length === 0 && admin.participants.length === 0 && admin.agents.length === 0;
|
|
374
|
-
return /* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
config.branding.logo ? /* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
/* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ jsx6(Card, { className: cn("gap-0 overflow-hidden py-0", className), children: /* @__PURE__ */ jsxs2(CardContent, { className: "space-y-6 p-6", children: [
|
|
578
|
+
/* @__PURE__ */ jsxs2("header", { className: "flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between", children: [
|
|
579
|
+
/* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
|
|
580
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
|
|
581
|
+
config.branding.logo ? /* @__PURE__ */ jsx6("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl border bg-background shadow-sm", children: config.branding.logo }) : null,
|
|
582
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
583
|
+
/* @__PURE__ */ jsx6("h2", { className: "text-2xl font-semibold tracking-tight", children: config.branding.title }),
|
|
584
|
+
/* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: config.branding.subtitle })
|
|
382
585
|
] })
|
|
383
586
|
] }),
|
|
384
|
-
config.namespace ? /* @__PURE__ */
|
|
587
|
+
config.namespace ? /* @__PURE__ */ jsxs2("p", { className: "text-xs font-medium uppercase tracking-[0.18em] text-muted-foreground", children: [
|
|
385
588
|
"Namespace: ",
|
|
386
589
|
config.namespace
|
|
387
590
|
] }) : null
|
|
388
591
|
] }),
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
391
|
-
|
|
592
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
593
|
+
/* @__PURE__ */ jsx6(
|
|
594
|
+
Button,
|
|
392
595
|
{
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
onClick: () => admin.setRange("24h")
|
|
596
|
+
variant: admin.filters.range === "24h" ? "default" : "outline",
|
|
597
|
+
size: "sm",
|
|
598
|
+
onClick: () => admin.setRange("24h"),
|
|
599
|
+
children: config.labels.range24h
|
|
396
600
|
}
|
|
397
601
|
),
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
|
|
602
|
+
/* @__PURE__ */ jsx6(
|
|
603
|
+
Button,
|
|
400
604
|
{
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
onClick: () => admin.setRange("7d")
|
|
605
|
+
variant: admin.filters.range === "7d" ? "default" : "outline",
|
|
606
|
+
size: "sm",
|
|
607
|
+
onClick: () => admin.setRange("7d"),
|
|
608
|
+
children: config.labels.range7d
|
|
404
609
|
}
|
|
405
610
|
),
|
|
406
|
-
/* @__PURE__ */
|
|
407
|
-
|
|
611
|
+
/* @__PURE__ */ jsx6(
|
|
612
|
+
Button,
|
|
408
613
|
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
onClick: () => admin.setRange("30d")
|
|
614
|
+
variant: admin.filters.range === "30d" ? "default" : "outline",
|
|
615
|
+
size: "sm",
|
|
616
|
+
onClick: () => admin.setRange("30d"),
|
|
617
|
+
children: config.labels.range30d
|
|
412
618
|
}
|
|
413
619
|
),
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
|
|
620
|
+
/* @__PURE__ */ jsxs2(
|
|
621
|
+
Select,
|
|
416
622
|
{
|
|
417
|
-
className: "rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm",
|
|
418
|
-
onChange: (event) => admin.setInterval(event.target.value),
|
|
419
623
|
value: admin.filters.interval,
|
|
624
|
+
onValueChange: (v) => admin.setInterval(v),
|
|
420
625
|
children: [
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
626
|
+
/* @__PURE__ */ jsx6(SelectTrigger, { className: "h-8 w-[110px]", children: /* @__PURE__ */ jsx6(SelectValue, {}) }),
|
|
627
|
+
/* @__PURE__ */ jsxs2(SelectContent, { children: [
|
|
628
|
+
/* @__PURE__ */ jsx6(SelectItem, { value: "hour", children: config.labels.intervalHour }),
|
|
629
|
+
/* @__PURE__ */ jsx6(SelectItem, { value: "day", children: config.labels.intervalDay })
|
|
630
|
+
] })
|
|
423
631
|
]
|
|
424
632
|
}
|
|
425
633
|
),
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
|
|
634
|
+
/* @__PURE__ */ jsx6(
|
|
635
|
+
Button,
|
|
428
636
|
{
|
|
429
|
-
|
|
637
|
+
variant: "outline",
|
|
638
|
+
size: "sm",
|
|
430
639
|
onClick: () => void admin.refresh(),
|
|
431
|
-
type: "button",
|
|
432
640
|
children: config.labels.refresh
|
|
433
641
|
}
|
|
434
642
|
),
|
|
435
643
|
config.branding.actions
|
|
436
644
|
] })
|
|
437
645
|
] }),
|
|
438
|
-
isEmpty ? /* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */
|
|
646
|
+
isEmpty ? /* @__PURE__ */ jsxs2("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
647
|
+
/* @__PURE__ */ jsx6("h3", { className: "text-lg font-semibold", children: config.labels.emptyTitle }),
|
|
648
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-2 text-sm text-muted-foreground", children: config.labels.emptyDescription })
|
|
441
649
|
] }) : null,
|
|
442
|
-
config.features.showOverview ? /* @__PURE__ */
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
650
|
+
config.features.showOverview ? /* @__PURE__ */ jsxs2("section", { className: "space-y-4", children: [
|
|
651
|
+
/* @__PURE__ */ jsx6(SectionHeading, { title: config.labels.overviewTitle }),
|
|
652
|
+
/* @__PURE__ */ jsx6("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-5", children: cards.map((card) => /* @__PURE__ */ jsxs2(
|
|
445
653
|
"div",
|
|
446
654
|
{
|
|
447
|
-
className: "rounded-
|
|
655
|
+
className: "rounded-xl border bg-background p-5 shadow-sm",
|
|
448
656
|
children: [
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ jsx6("p", { className: "text-sm font-medium text-muted-foreground", children: card.label }),
|
|
658
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
|
|
659
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-2 text-xs text-muted-foreground", children: card.detail })
|
|
452
660
|
]
|
|
453
661
|
},
|
|
454
662
|
card.label
|
|
455
663
|
)) })
|
|
456
664
|
] }) : null,
|
|
457
|
-
config.features.showActivity ? /* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */
|
|
665
|
+
config.features.showActivity ? /* @__PURE__ */ jsxs2("section", { className: "space-y-4", children: [
|
|
666
|
+
/* @__PURE__ */ jsx6(SectionHeading, { title: config.labels.activityTitle }),
|
|
667
|
+
/* @__PURE__ */ jsx6(
|
|
460
668
|
ActivityChart,
|
|
461
669
|
{
|
|
462
|
-
compact: config.ui.compact,
|
|
463
670
|
interval: admin.filters.interval,
|
|
464
671
|
labels: config.labels,
|
|
465
672
|
maxBars: config.ui.maxActivityBars,
|
|
@@ -467,8 +674,8 @@ var CopilotzAdmin = ({
|
|
|
467
674
|
}
|
|
468
675
|
)
|
|
469
676
|
] }) : null,
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
config.features.showThreads ? /* @__PURE__ */
|
|
677
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid gap-6 lg:grid-cols-3", children: [
|
|
678
|
+
config.features.showThreads ? /* @__PURE__ */ jsx6(
|
|
472
679
|
DataTable,
|
|
473
680
|
{
|
|
474
681
|
rows: admin.threads,
|
|
@@ -476,10 +683,10 @@ var CopilotzAdmin = ({
|
|
|
476
683
|
searchValue: threadSearch,
|
|
477
684
|
setSearchValue: setThreadSearch,
|
|
478
685
|
title: config.labels.threadsTitle,
|
|
479
|
-
children: /* @__PURE__ */
|
|
686
|
+
children: /* @__PURE__ */ jsx6(ThreadsTable, { rows: admin.threads, labels: config.labels })
|
|
480
687
|
}
|
|
481
688
|
) : null,
|
|
482
|
-
config.features.showParticipants ? /* @__PURE__ */
|
|
689
|
+
config.features.showParticipants ? /* @__PURE__ */ jsx6(
|
|
483
690
|
DataTable,
|
|
484
691
|
{
|
|
485
692
|
rows: admin.participants,
|
|
@@ -487,10 +694,16 @@ var CopilotzAdmin = ({
|
|
|
487
694
|
searchValue: participantSearch,
|
|
488
695
|
setSearchValue: setParticipantSearch,
|
|
489
696
|
title: config.labels.participantsTitle,
|
|
490
|
-
children: /* @__PURE__ */
|
|
697
|
+
children: /* @__PURE__ */ jsx6(
|
|
698
|
+
ParticipantsTable,
|
|
699
|
+
{
|
|
700
|
+
rows: admin.participants,
|
|
701
|
+
labels: config.labels
|
|
702
|
+
}
|
|
703
|
+
)
|
|
491
704
|
}
|
|
492
705
|
) : null,
|
|
493
|
-
config.features.showAgents ? /* @__PURE__ */
|
|
706
|
+
config.features.showAgents ? /* @__PURE__ */ jsx6(
|
|
494
707
|
DataTable,
|
|
495
708
|
{
|
|
496
709
|
rows: admin.agents,
|
|
@@ -498,145 +711,184 @@ var CopilotzAdmin = ({
|
|
|
498
711
|
searchValue: agentSearch,
|
|
499
712
|
setSearchValue: setAgentSearch,
|
|
500
713
|
title: config.labels.agentsTitle,
|
|
501
|
-
children: /* @__PURE__ */
|
|
714
|
+
children: /* @__PURE__ */ jsx6(AgentsTable, { rows: admin.agents, labels: config.labels })
|
|
502
715
|
}
|
|
503
716
|
) : null
|
|
504
717
|
] })
|
|
505
|
-
] });
|
|
718
|
+
] }) });
|
|
506
719
|
};
|
|
507
720
|
function SectionHeading({ title }) {
|
|
508
|
-
return /* @__PURE__ */
|
|
509
|
-
}
|
|
510
|
-
function RangeButton({ active, label, onClick }) {
|
|
511
|
-
return /* @__PURE__ */ jsx(
|
|
512
|
-
"button",
|
|
513
|
-
{
|
|
514
|
-
className: joinClassNames(
|
|
515
|
-
"rounded-xl px-3 py-2 text-sm font-medium transition",
|
|
516
|
-
active ? "bg-slate-900 text-white" : "border border-slate-200 bg-white text-slate-600"
|
|
517
|
-
),
|
|
518
|
-
onClick,
|
|
519
|
-
type: "button",
|
|
520
|
-
children: label
|
|
521
|
-
}
|
|
522
|
-
);
|
|
721
|
+
return /* @__PURE__ */ jsx6("h3", { className: "text-lg font-semibold tracking-tight", children: title });
|
|
523
722
|
}
|
|
524
723
|
function ActivityChart(props) {
|
|
525
724
|
const trimmedPoints = props.points.slice(-props.maxBars);
|
|
526
|
-
const maxMessages = Math.max(
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
725
|
+
const maxMessages = Math.max(
|
|
726
|
+
...trimmedPoints.map((point) => point.messageCount),
|
|
727
|
+
1
|
|
728
|
+
);
|
|
729
|
+
return /* @__PURE__ */ jsx6("div", { className: "rounded-xl border bg-background p-5 shadow-sm", children: trimmedPoints.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: props.labels.noResults }) : /* @__PURE__ */ jsx6("div", { className: "flex min-h-48 items-end gap-2", children: trimmedPoints.map((point) => /* @__PURE__ */ jsxs2(
|
|
730
|
+
"div",
|
|
731
|
+
{
|
|
732
|
+
className: "flex min-w-0 flex-1 flex-col items-center gap-2",
|
|
733
|
+
children: [
|
|
734
|
+
/* @__PURE__ */ jsx6("div", { className: "flex h-36 w-full items-end rounded-lg bg-muted px-1 pb-1", children: /* @__PURE__ */ jsx6(
|
|
735
|
+
"div",
|
|
736
|
+
{
|
|
737
|
+
className: "w-full rounded-md bg-primary transition-all",
|
|
738
|
+
style: {
|
|
739
|
+
height: `${Math.max(point.messageCount / maxMessages * 100, 8)}%`
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
) }),
|
|
743
|
+
/* @__PURE__ */ jsxs2("div", { className: "text-center", children: [
|
|
744
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xs font-medium", children: formatBucket(point.bucket, props.interval) }),
|
|
745
|
+
/* @__PURE__ */ jsxs2("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
746
|
+
formatNumber(point.messageCount),
|
|
747
|
+
" msg"
|
|
748
|
+
] })
|
|
749
|
+
] })
|
|
750
|
+
]
|
|
751
|
+
},
|
|
752
|
+
point.bucket
|
|
753
|
+
)) }) });
|
|
545
754
|
}
|
|
546
755
|
function DataTable(props) {
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
-
|
|
756
|
+
return /* @__PURE__ */ jsxs2("div", { className: "rounded-xl border bg-background p-5 shadow-sm", children: [
|
|
757
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
|
|
758
|
+
/* @__PURE__ */ jsx6(SectionHeading, { title: props.title }),
|
|
759
|
+
/* @__PURE__ */ jsx6(
|
|
760
|
+
Input,
|
|
552
761
|
{
|
|
553
|
-
className: "w-full max-w-44
|
|
762
|
+
className: "h-8 w-full max-w-44",
|
|
554
763
|
onChange: (event) => props.setSearchValue(event.target.value),
|
|
555
764
|
placeholder: props.searchPlaceholder,
|
|
556
765
|
value: props.searchValue
|
|
557
766
|
}
|
|
558
767
|
)
|
|
559
768
|
] }),
|
|
560
|
-
props.rows.length === 0 ? /* @__PURE__ */
|
|
769
|
+
props.rows.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "No results" }) : props.children
|
|
561
770
|
] });
|
|
562
771
|
}
|
|
563
|
-
function ThreadsTable({
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
772
|
+
function ThreadsTable({
|
|
773
|
+
rows,
|
|
774
|
+
labels
|
|
775
|
+
}) {
|
|
776
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((thread) => /* @__PURE__ */ jsxs2(
|
|
777
|
+
"div",
|
|
778
|
+
{
|
|
779
|
+
className: "rounded-lg border bg-muted/50 p-4",
|
|
780
|
+
children: [
|
|
781
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
|
|
782
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
783
|
+
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: thread.name }),
|
|
784
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ jsx6(
|
|
787
|
+
Badge,
|
|
788
|
+
{
|
|
789
|
+
variant: thread.status === "archived" ? "secondary" : "default",
|
|
790
|
+
children: thread.status === "archived" ? labels.statusArchived : labels.statusActive
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
] }),
|
|
794
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
|
|
795
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
796
|
+
formatNumber(thread.messageCount),
|
|
797
|
+
" messages"
|
|
798
|
+
] }),
|
|
799
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
800
|
+
thread.participantIds.length,
|
|
801
|
+
" participants"
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ jsx6("span", { children: formatDate(thread.lastActivityAt) })
|
|
804
|
+
] })
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
thread.threadId
|
|
808
|
+
)) });
|
|
584
809
|
}
|
|
585
|
-
function ParticipantsTable({
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
"
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
810
|
+
function ParticipantsTable({
|
|
811
|
+
rows,
|
|
812
|
+
labels
|
|
813
|
+
}) {
|
|
814
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((participant) => /* @__PURE__ */ jsxs2(
|
|
815
|
+
"div",
|
|
816
|
+
{
|
|
817
|
+
className: "rounded-lg border bg-muted/50 p-4",
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
|
|
820
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
821
|
+
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: participant.displayName }),
|
|
822
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs uppercase tracking-[0.18em] text-muted-foreground", children: participant.participantType })
|
|
823
|
+
] }),
|
|
824
|
+
/* @__PURE__ */ jsx6(Badge, { variant: "outline", children: participant.isGlobal ? labels.scopeGlobal : labels.scopeScoped })
|
|
825
|
+
] }),
|
|
826
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
|
|
827
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
828
|
+
formatNumber(participant.messageCount),
|
|
829
|
+
" messages"
|
|
830
|
+
] }),
|
|
831
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
832
|
+
formatNumber(participant.threadCount),
|
|
833
|
+
" threads"
|
|
834
|
+
] }),
|
|
835
|
+
/* @__PURE__ */ jsx6("span", { children: formatDate(participant.lastActivityAt) })
|
|
836
|
+
] })
|
|
837
|
+
]
|
|
838
|
+
},
|
|
839
|
+
`${participant.namespace}:${participant.externalId}`
|
|
840
|
+
)) });
|
|
606
841
|
}
|
|
607
|
-
function AgentsTable({
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
"
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
842
|
+
function AgentsTable({
|
|
843
|
+
rows,
|
|
844
|
+
labels
|
|
845
|
+
}) {
|
|
846
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((agent) => /* @__PURE__ */ jsxs2(
|
|
847
|
+
"div",
|
|
848
|
+
{
|
|
849
|
+
className: "rounded-lg border bg-muted/50 p-4",
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
|
|
852
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
853
|
+
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: agent.displayName }),
|
|
854
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: agent.description ?? agent.agentId })
|
|
855
|
+
] }),
|
|
856
|
+
/* @__PURE__ */ jsx6(Badge, { variant: "outline", children: agent.isConfigured ? labels.configured : labels.unconfigured })
|
|
857
|
+
] }),
|
|
858
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-3 grid grid-cols-2 gap-2 text-xs text-muted-foreground", children: [
|
|
859
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
860
|
+
formatNumber(agent.messageCount),
|
|
861
|
+
" messages"
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
864
|
+
formatNumber(agent.llmCallCount),
|
|
865
|
+
" LLM calls"
|
|
866
|
+
] }),
|
|
867
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
868
|
+
formatNumber(agent.toolCallMessageCount),
|
|
869
|
+
" tool calls"
|
|
870
|
+
] }),
|
|
871
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
872
|
+
formatNumber(agent.totalTokens),
|
|
873
|
+
" tokens"
|
|
874
|
+
] })
|
|
875
|
+
] })
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
`${agent.namespace}:${agent.agentId}`
|
|
879
|
+
)) });
|
|
635
880
|
}
|
|
636
881
|
function formatBucket(bucket, interval) {
|
|
637
882
|
const date = new Date(bucket);
|
|
638
883
|
if (Number.isNaN(date.getTime())) return bucket;
|
|
639
|
-
return interval === "hour" ? date.toLocaleString(void 0, {
|
|
884
|
+
return interval === "hour" ? date.toLocaleString(void 0, {
|
|
885
|
+
hour: "numeric",
|
|
886
|
+
month: "short",
|
|
887
|
+
day: "numeric"
|
|
888
|
+
}) : date.toLocaleDateString(void 0, {
|
|
889
|
+
month: "short",
|
|
890
|
+
day: "numeric"
|
|
891
|
+
});
|
|
640
892
|
}
|
|
641
893
|
function formatDate(value) {
|
|
642
894
|
if (!value) return "No activity";
|
|
@@ -652,9 +904,6 @@ function formatDate(value) {
|
|
|
652
904
|
function formatNumber(value) {
|
|
653
905
|
return new Intl.NumberFormat().format(value);
|
|
654
906
|
}
|
|
655
|
-
function joinClassNames(...values) {
|
|
656
|
-
return values.filter(Boolean).join(" ");
|
|
657
|
-
}
|
|
658
907
|
export {
|
|
659
908
|
CopilotzAdmin,
|
|
660
909
|
defaultAdminConfig,
|