@copilotz/admin 0.3.4 → 0.3.5
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 +948 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +214 -0
- package/dist/index.js +431 -189
- 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,108 @@ var CopilotzAdmin = ({
|
|
|
354
558
|
}
|
|
355
559
|
];
|
|
356
560
|
if (admin.isLoading && !admin.overview) {
|
|
357
|
-
return /* @__PURE__ */
|
|
561
|
+
return /* @__PURE__ */ jsx6(Card, { className: cn("p-8", className), children: /* @__PURE__ */ jsx6(CardContent, { className: "p-0 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 p-8", className), children: /* @__PURE__ */ jsxs2(CardContent, { className: "p-0 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__ */ jsxs2("div", { className: cn("space-y-6 text-foreground", className), 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-card 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: "w-[110px] h-8", 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__ */ jsx6(Card, { className: "border-dashed py-10 text-center", children: /* @__PURE__ */ jsxs2(CardContent, { className: "p-0", 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 })
|
|
649
|
+
] }) }) : null,
|
|
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 gap-4 md:grid-cols-2 xl:grid-cols-5", children: cards.map((card) => /* @__PURE__ */ jsx6(Card, { className: "gap-0 py-0", children: /* @__PURE__ */ jsxs2(CardContent, { className: "p-5", children: [
|
|
653
|
+
/* @__PURE__ */ jsx6("p", { className: "text-sm font-medium text-muted-foreground", children: card.label }),
|
|
654
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
|
|
655
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-2 text-xs text-muted-foreground", children: card.detail })
|
|
656
|
+
] }) }, card.label)) })
|
|
441
657
|
] }) : null,
|
|
442
|
-
config.features.
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
445
|
-
"div",
|
|
446
|
-
{
|
|
447
|
-
className: "rounded-3xl border border-slate-200 bg-white p-5 shadow-sm",
|
|
448
|
-
children: [
|
|
449
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-slate-500", children: card.label }),
|
|
450
|
-
/* @__PURE__ */ jsx("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
|
|
451
|
-
/* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-slate-400", children: card.detail })
|
|
452
|
-
]
|
|
453
|
-
},
|
|
454
|
-
card.label
|
|
455
|
-
)) })
|
|
456
|
-
] }) : null,
|
|
457
|
-
config.features.showActivity ? /* @__PURE__ */ jsxs("section", { className: "space-y-4", children: [
|
|
458
|
-
/* @__PURE__ */ jsx(SectionHeading, { title: config.labels.activityTitle }),
|
|
459
|
-
/* @__PURE__ */ jsx(
|
|
658
|
+
config.features.showActivity ? /* @__PURE__ */ jsxs2("section", { className: "space-y-4", children: [
|
|
659
|
+
/* @__PURE__ */ jsx6(SectionHeading, { title: config.labels.activityTitle }),
|
|
660
|
+
/* @__PURE__ */ jsx6(
|
|
460
661
|
ActivityChart,
|
|
461
662
|
{
|
|
462
|
-
compact: config.ui.compact,
|
|
463
663
|
interval: admin.filters.interval,
|
|
464
664
|
labels: config.labels,
|
|
465
665
|
maxBars: config.ui.maxActivityBars,
|
|
@@ -467,8 +667,8 @@ var CopilotzAdmin = ({
|
|
|
467
667
|
}
|
|
468
668
|
)
|
|
469
669
|
] }) : null,
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
config.features.showThreads ? /* @__PURE__ */
|
|
670
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid gap-6 xl:grid-cols-3", children: [
|
|
671
|
+
config.features.showThreads ? /* @__PURE__ */ jsx6(
|
|
472
672
|
DataTable,
|
|
473
673
|
{
|
|
474
674
|
rows: admin.threads,
|
|
@@ -476,10 +676,10 @@ var CopilotzAdmin = ({
|
|
|
476
676
|
searchValue: threadSearch,
|
|
477
677
|
setSearchValue: setThreadSearch,
|
|
478
678
|
title: config.labels.threadsTitle,
|
|
479
|
-
children: /* @__PURE__ */
|
|
679
|
+
children: /* @__PURE__ */ jsx6(ThreadsTable, { rows: admin.threads, labels: config.labels })
|
|
480
680
|
}
|
|
481
681
|
) : null,
|
|
482
|
-
config.features.showParticipants ? /* @__PURE__ */
|
|
682
|
+
config.features.showParticipants ? /* @__PURE__ */ jsx6(
|
|
483
683
|
DataTable,
|
|
484
684
|
{
|
|
485
685
|
rows: admin.participants,
|
|
@@ -487,10 +687,16 @@ var CopilotzAdmin = ({
|
|
|
487
687
|
searchValue: participantSearch,
|
|
488
688
|
setSearchValue: setParticipantSearch,
|
|
489
689
|
title: config.labels.participantsTitle,
|
|
490
|
-
children: /* @__PURE__ */
|
|
690
|
+
children: /* @__PURE__ */ jsx6(
|
|
691
|
+
ParticipantsTable,
|
|
692
|
+
{
|
|
693
|
+
rows: admin.participants,
|
|
694
|
+
labels: config.labels
|
|
695
|
+
}
|
|
696
|
+
)
|
|
491
697
|
}
|
|
492
698
|
) : null,
|
|
493
|
-
config.features.showAgents ? /* @__PURE__ */
|
|
699
|
+
config.features.showAgents ? /* @__PURE__ */ jsx6(
|
|
494
700
|
DataTable,
|
|
495
701
|
{
|
|
496
702
|
rows: admin.agents,
|
|
@@ -498,145 +704,184 @@ var CopilotzAdmin = ({
|
|
|
498
704
|
searchValue: agentSearch,
|
|
499
705
|
setSearchValue: setAgentSearch,
|
|
500
706
|
title: config.labels.agentsTitle,
|
|
501
|
-
children: /* @__PURE__ */
|
|
707
|
+
children: /* @__PURE__ */ jsx6(AgentsTable, { rows: admin.agents, labels: config.labels })
|
|
502
708
|
}
|
|
503
709
|
) : null
|
|
504
710
|
] })
|
|
505
711
|
] });
|
|
506
712
|
};
|
|
507
713
|
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
|
-
);
|
|
714
|
+
return /* @__PURE__ */ jsx6("h3", { className: "text-lg font-semibold tracking-tight", children: title });
|
|
523
715
|
}
|
|
524
716
|
function ActivityChart(props) {
|
|
525
717
|
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
|
-
|
|
718
|
+
const maxMessages = Math.max(
|
|
719
|
+
...trimmedPoints.map((point) => point.messageCount),
|
|
720
|
+
1
|
|
721
|
+
);
|
|
722
|
+
return /* @__PURE__ */ jsx6(Card, { className: "gap-0 py-0", children: /* @__PURE__ */ jsx6(CardContent, { className: "p-5", children: trimmedPoints.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: props.labels.noResults }) : /* @__PURE__ */ jsx6("div", { className: "flex min-h-56 items-end gap-2", children: trimmedPoints.map((point) => /* @__PURE__ */ jsxs2(
|
|
723
|
+
"div",
|
|
724
|
+
{
|
|
725
|
+
className: "flex min-w-0 flex-1 flex-col items-center gap-2",
|
|
726
|
+
children: [
|
|
727
|
+
/* @__PURE__ */ jsx6("div", { className: "flex h-40 w-full items-end rounded-lg bg-muted px-1 pb-1", children: /* @__PURE__ */ jsx6(
|
|
728
|
+
"div",
|
|
729
|
+
{
|
|
730
|
+
className: "w-full rounded-md bg-primary",
|
|
731
|
+
style: {
|
|
732
|
+
height: `${Math.max(point.messageCount / maxMessages * 100, 8)}%`
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
) }),
|
|
736
|
+
/* @__PURE__ */ jsxs2("div", { className: "text-center", children: [
|
|
737
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xs font-medium", children: formatBucket(point.bucket, props.interval) }),
|
|
738
|
+
/* @__PURE__ */ jsxs2("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
739
|
+
formatNumber(point.messageCount),
|
|
740
|
+
" msg"
|
|
741
|
+
] })
|
|
742
|
+
] })
|
|
743
|
+
]
|
|
744
|
+
},
|
|
745
|
+
point.bucket
|
|
746
|
+
)) }) }) });
|
|
545
747
|
}
|
|
546
748
|
function DataTable(props) {
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
-
|
|
749
|
+
return /* @__PURE__ */ jsx6(Card, { className: "gap-0 py-0", children: /* @__PURE__ */ jsxs2(CardContent, { className: "p-5", children: [
|
|
750
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
|
|
751
|
+
/* @__PURE__ */ jsx6(SectionHeading, { title: props.title }),
|
|
752
|
+
/* @__PURE__ */ jsx6(
|
|
753
|
+
Input,
|
|
552
754
|
{
|
|
553
|
-
className: "w-full max-w-44
|
|
755
|
+
className: "w-full max-w-44 h-8",
|
|
554
756
|
onChange: (event) => props.setSearchValue(event.target.value),
|
|
555
757
|
placeholder: props.searchPlaceholder,
|
|
556
758
|
value: props.searchValue
|
|
557
759
|
}
|
|
558
760
|
)
|
|
559
761
|
] }),
|
|
560
|
-
props.rows.length === 0 ? /* @__PURE__ */
|
|
561
|
-
] });
|
|
762
|
+
props.rows.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "No results" }) : props.children
|
|
763
|
+
] }) });
|
|
562
764
|
}
|
|
563
|
-
function ThreadsTable({
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
765
|
+
function ThreadsTable({
|
|
766
|
+
rows,
|
|
767
|
+
labels
|
|
768
|
+
}) {
|
|
769
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((thread) => /* @__PURE__ */ jsxs2(
|
|
770
|
+
"div",
|
|
771
|
+
{
|
|
772
|
+
className: "rounded-lg border bg-muted/50 p-4",
|
|
773
|
+
children: [
|
|
774
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
|
|
775
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
776
|
+
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: thread.name }),
|
|
777
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs text-muted-foreground truncate", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
|
|
778
|
+
] }),
|
|
779
|
+
/* @__PURE__ */ jsx6(
|
|
780
|
+
Badge,
|
|
781
|
+
{
|
|
782
|
+
variant: thread.status === "archived" ? "secondary" : "default",
|
|
783
|
+
children: thread.status === "archived" ? labels.statusArchived : labels.statusActive
|
|
784
|
+
}
|
|
785
|
+
)
|
|
786
|
+
] }),
|
|
787
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
|
|
788
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
789
|
+
formatNumber(thread.messageCount),
|
|
790
|
+
" messages"
|
|
791
|
+
] }),
|
|
792
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
793
|
+
thread.participantIds.length,
|
|
794
|
+
" participants"
|
|
795
|
+
] }),
|
|
796
|
+
/* @__PURE__ */ jsx6("span", { children: formatDate(thread.lastActivityAt) })
|
|
797
|
+
] })
|
|
798
|
+
]
|
|
799
|
+
},
|
|
800
|
+
thread.threadId
|
|
801
|
+
)) });
|
|
584
802
|
}
|
|
585
|
-
function ParticipantsTable({
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
"
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
803
|
+
function ParticipantsTable({
|
|
804
|
+
rows,
|
|
805
|
+
labels
|
|
806
|
+
}) {
|
|
807
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((participant) => /* @__PURE__ */ jsxs2(
|
|
808
|
+
"div",
|
|
809
|
+
{
|
|
810
|
+
className: "rounded-lg border bg-muted/50 p-4",
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
|
|
813
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
814
|
+
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: participant.displayName }),
|
|
815
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs uppercase tracking-[0.18em] text-muted-foreground", children: participant.participantType })
|
|
816
|
+
] }),
|
|
817
|
+
/* @__PURE__ */ jsx6(Badge, { variant: "outline", children: participant.isGlobal ? labels.scopeGlobal : labels.scopeScoped })
|
|
818
|
+
] }),
|
|
819
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
|
|
820
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
821
|
+
formatNumber(participant.messageCount),
|
|
822
|
+
" messages"
|
|
823
|
+
] }),
|
|
824
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
825
|
+
formatNumber(participant.threadCount),
|
|
826
|
+
" threads"
|
|
827
|
+
] }),
|
|
828
|
+
/* @__PURE__ */ jsx6("span", { children: formatDate(participant.lastActivityAt) })
|
|
829
|
+
] })
|
|
830
|
+
]
|
|
831
|
+
},
|
|
832
|
+
`${participant.namespace}:${participant.externalId}`
|
|
833
|
+
)) });
|
|
606
834
|
}
|
|
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
|
-
|
|
835
|
+
function AgentsTable({
|
|
836
|
+
rows,
|
|
837
|
+
labels
|
|
838
|
+
}) {
|
|
839
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((agent) => /* @__PURE__ */ jsxs2(
|
|
840
|
+
"div",
|
|
841
|
+
{
|
|
842
|
+
className: "rounded-lg border bg-muted/50 p-4",
|
|
843
|
+
children: [
|
|
844
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
|
|
845
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
846
|
+
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: agent.displayName }),
|
|
847
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs text-muted-foreground truncate", children: agent.description ?? agent.agentId })
|
|
848
|
+
] }),
|
|
849
|
+
/* @__PURE__ */ jsx6(Badge, { variant: "outline", children: agent.isConfigured ? labels.configured : labels.unconfigured })
|
|
850
|
+
] }),
|
|
851
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-3 grid grid-cols-2 gap-2 text-xs text-muted-foreground", children: [
|
|
852
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
853
|
+
formatNumber(agent.messageCount),
|
|
854
|
+
" messages"
|
|
855
|
+
] }),
|
|
856
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
857
|
+
formatNumber(agent.llmCallCount),
|
|
858
|
+
" LLM calls"
|
|
859
|
+
] }),
|
|
860
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
861
|
+
formatNumber(agent.toolCallMessageCount),
|
|
862
|
+
" tool calls"
|
|
863
|
+
] }),
|
|
864
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
865
|
+
formatNumber(agent.totalTokens),
|
|
866
|
+
" tokens"
|
|
867
|
+
] })
|
|
868
|
+
] })
|
|
869
|
+
]
|
|
870
|
+
},
|
|
871
|
+
`${agent.namespace}:${agent.agentId}`
|
|
872
|
+
)) });
|
|
635
873
|
}
|
|
636
874
|
function formatBucket(bucket, interval) {
|
|
637
875
|
const date = new Date(bucket);
|
|
638
876
|
if (Number.isNaN(date.getTime())) return bucket;
|
|
639
|
-
return interval === "hour" ? date.toLocaleString(void 0, {
|
|
877
|
+
return interval === "hour" ? date.toLocaleString(void 0, {
|
|
878
|
+
hour: "numeric",
|
|
879
|
+
month: "short",
|
|
880
|
+
day: "numeric"
|
|
881
|
+
}) : date.toLocaleDateString(void 0, {
|
|
882
|
+
month: "short",
|
|
883
|
+
day: "numeric"
|
|
884
|
+
});
|
|
640
885
|
}
|
|
641
886
|
function formatDate(value) {
|
|
642
887
|
if (!value) return "No activity";
|
|
@@ -652,9 +897,6 @@ function formatDate(value) {
|
|
|
652
897
|
function formatNumber(value) {
|
|
653
898
|
return new Intl.NumberFormat().format(value);
|
|
654
899
|
}
|
|
655
|
-
function joinClassNames(...values) {
|
|
656
|
-
return values.filter(Boolean).join(" ");
|
|
657
|
-
}
|
|
658
900
|
export {
|
|
659
901
|
CopilotzAdmin,
|
|
660
902
|
defaultAdminConfig,
|