@carlonicora/nextjs-jsonapi 3.3.5 → 3.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/{BlockNoteEditor-BXA6SDVC.mjs → BlockNoteEditor-BYMRWUVG.mjs} +2 -2
- package/dist/{BlockNoteEditor-BWC7JDVK.js → BlockNoteEditor-USRMFZGP.js} +9 -9
- package/dist/{BlockNoteEditor-BWC7JDVK.js.map → BlockNoteEditor-USRMFZGP.js.map} +1 -1
- package/dist/billing/index.js +333 -333
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-PXXVAY7N.js → chunk-5WFYQE22.js} +232 -232
- package/dist/chunk-5WFYQE22.js.map +1 -0
- package/dist/{chunk-JBTGGZ3K.mjs → chunk-CFZW6GU4.mjs} +12 -12
- package/dist/chunk-CFZW6GU4.mjs.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.d.mts +26 -1
- package/dist/components/index.d.ts +26 -1
- package/dist/components/index.js +4 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/features/help/index.js +31 -31
- package/dist/features/help/index.mjs +1 -1
- package/dist/features/tokenusage/index.js +75 -75
- package/dist/features/tokenusage/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/forms/DateRangeSelector.tsx +36 -12
- package/src/components/forms/__tests__/DateRangeSelector.spec.ts +74 -0
- package/dist/chunk-JBTGGZ3K.mjs.map +0 -1
- package/dist/chunk-PXXVAY7N.js.map +0 -1
- /package/dist/{BlockNoteEditor-BXA6SDVC.mjs.map → BlockNoteEditor-BYMRWUVG.mjs.map} +0 -0
|
@@ -23,7 +23,7 @@ var _chunkYBZVWLPHjs = require('../../chunk-YBZVWLPH.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunk5WFYQE22js = require('../../chunk-5WFYQE22.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkX2MQ3WHXjs = require('../../chunk-X2MQ3WHX.js');
|
|
@@ -75,29 +75,29 @@ var _lucidereact = require('lucide-react');
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
function HelpAssistantSheet({ open, onOpenChange }) {
|
|
78
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
79
|
-
|
|
78
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Sheet, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
79
|
+
_chunk5WFYQE22js.SheetContent,
|
|
80
80
|
{
|
|
81
81
|
side: "right",
|
|
82
82
|
className: "flex w-full flex-col data-[side=right]:sm:max-w-2xl data-[side=right]:lg:max-w-3xl",
|
|
83
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
83
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.AssistantProvider, { manageUrl: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HelpAssistantSheetBody, {}) })
|
|
84
84
|
}
|
|
85
85
|
) });
|
|
86
86
|
}
|
|
87
87
|
_chunk7QVYU63Ejs.__name.call(void 0, HelpAssistantSheet, "HelpAssistantSheet");
|
|
88
88
|
function HelpAssistantSheetBody() {
|
|
89
89
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
90
|
-
const ctx =
|
|
90
|
+
const ctx = _chunk5WFYQE22js.useAssistantContext.call(void 0, );
|
|
91
91
|
const showThread = !!ctx.assistant || ctx.sending || ctx.messages.length > 0;
|
|
92
92
|
const send = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (content) => ctx.sendMessage(content, { howToMode: true }), "send");
|
|
93
93
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
94
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
95
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
96
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
94
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.SheetHeader, { children: [
|
|
95
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SheetTitle, { children: t("help.askAi.sheet.title") }),
|
|
96
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SheetDescription, { children: t("help.askAi.sheet.subtitle") })
|
|
97
97
|
] }),
|
|
98
|
-
!showThread ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
98
|
+
!showThread ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.AssistantEmptyState, { onSend: send }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
99
99
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
100
|
-
|
|
100
|
+
_chunk5WFYQE22js.AssistantThread,
|
|
101
101
|
{
|
|
102
102
|
messages: ctx.messages,
|
|
103
103
|
sending: ctx.sending,
|
|
@@ -107,7 +107,7 @@ function HelpAssistantSheetBody() {
|
|
|
107
107
|
onRetry: ctx.retrySend
|
|
108
108
|
}
|
|
109
109
|
),
|
|
110
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
110
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.AssistantComposer, { onSend: send, disabled: ctx.sending })
|
|
111
111
|
] })
|
|
112
112
|
] });
|
|
113
113
|
}
|
|
@@ -117,20 +117,20 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpAssistantSheetBody, "HelpAssistantSheet
|
|
|
117
117
|
|
|
118
118
|
function HelpAskAi() {
|
|
119
119
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
120
|
-
const { currentUser } =
|
|
120
|
+
const { currentUser } = _chunk5WFYQE22js.useCurrentUserContext.call(void 0, );
|
|
121
121
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
122
122
|
const disabled = !currentUser;
|
|
123
123
|
if (disabled) {
|
|
124
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
124
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Tooltip, { children: [
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.TooltipTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Button, { variant: "outline", size: "sm", disabled: true }), children: [
|
|
126
126
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SparklesIcon, { className: "h-4 w-4" }),
|
|
127
127
|
t("help.askAi.button")
|
|
128
128
|
] }),
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TooltipContent, { children: t("help.askAi.loginTooltip") })
|
|
130
130
|
] });
|
|
131
131
|
}
|
|
132
132
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
133
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
133
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
134
134
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SparklesIcon, { className: "h-4 w-4" }),
|
|
135
135
|
t("help.askAi.button")
|
|
136
136
|
] }),
|
|
@@ -143,7 +143,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpAskAi, "HelpAskAi");
|
|
|
143
143
|
|
|
144
144
|
function HelpHeader() {
|
|
145
145
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
146
|
-
const { currentUser } =
|
|
146
|
+
const { currentUser } = _chunk5WFYQE22js.useCurrentUserContext.call(void 0, );
|
|
147
147
|
const { brand } = useHelp();
|
|
148
148
|
const logo = _optionalChain([brand, 'optionalAccess', _ => _.logo]);
|
|
149
149
|
const label = _nullishCoalesce(_optionalChain([brand, 'optionalAccess', _2 => _2.label]), () => ( "Help"));
|
|
@@ -159,7 +159,7 @@ function HelpHeader() {
|
|
|
159
159
|
] }),
|
|
160
160
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
161
161
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HelpAskAi, {}),
|
|
162
|
-
currentUser ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _link2.default, { href: appHref, className:
|
|
162
|
+
currentUser ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _link2.default, { href: appHref, className: _chunk5WFYQE22js.buttonVariants.call(void 0, { variant: "outline", size: "sm" }), children: t("help.header.openApp") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _link2.default, { href: "/login", className: _chunk5WFYQE22js.buttonVariants.call(void 0, { variant: "outline", size: "sm" }), children: t("help.header.login") })
|
|
163
163
|
] })
|
|
164
164
|
] });
|
|
165
165
|
}
|
|
@@ -201,7 +201,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, useHelpFilter, "useHelpFilter");
|
|
|
201
201
|
|
|
202
202
|
function HelpSideNav() {
|
|
203
203
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
204
|
-
const generateUrl =
|
|
204
|
+
const generateUrl = _chunk5WFYQE22js.usePageUrlGenerator.call(void 0, );
|
|
205
205
|
const pathname = _navigation.usePathname.call(void 0, );
|
|
206
206
|
const [articles, setArticles] = _react.useState.call(void 0, []);
|
|
207
207
|
_react.useEffect.call(void 0, () => {
|
|
@@ -282,7 +282,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpSideNav, "HelpSideNav");
|
|
|
282
282
|
function HelpArticleBody(props) {
|
|
283
283
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
284
284
|
const format = _nextintl.useFormatter.call(void 0, );
|
|
285
|
-
const generateUrl =
|
|
285
|
+
const generateUrl = _chunk5WFYQE22js.usePageUrlGenerator.call(void 0, );
|
|
286
286
|
const { howToType, title, summary, updatedAt, prev, next, children } = props;
|
|
287
287
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "article", { className: "prose dark:prose-invert max-w-none", children: [
|
|
288
288
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "nav", { className: "text-muted-foreground mb-2 text-xs", children: [
|
|
@@ -339,7 +339,7 @@ function HelpTOC({ headings }) {
|
|
|
339
339
|
}, [headings]);
|
|
340
340
|
if (headings.length === 0) return null;
|
|
341
341
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "nav", { "aria-label": t("help.toc.title"), className: "hidden lg:block", children: [
|
|
342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.MicroLabel, { className: "mb-2", children: t("help.toc.title") }),
|
|
343
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "space-y-1 text-sm", children: headings.map((h) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { style: { paddingLeft: `${(h.depth - 2) * 0.75}rem` }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
344
344
|
"a",
|
|
345
345
|
{
|
|
@@ -360,7 +360,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpTOC, "HelpTOC");
|
|
|
360
360
|
|
|
361
361
|
function HelpHint({ contextKey }) {
|
|
362
362
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
363
|
-
const generateUrl =
|
|
363
|
+
const generateUrl = _chunk5WFYQE22js.usePageUrlGenerator.call(void 0, );
|
|
364
364
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
365
365
|
const [picked, setPicked] = _react.useState.call(void 0, null);
|
|
366
366
|
const [articles, setArticles] = _react.useState.call(void 0, []);
|
|
@@ -378,7 +378,7 @@ function HelpHint({ contextKey }) {
|
|
|
378
378
|
if (matches.length === 0) return null;
|
|
379
379
|
const active = _nullishCoalesce(picked, () => ( (matches.length === 1 ? matches[0] : null)));
|
|
380
380
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
381
|
-
|
|
381
|
+
_chunk5WFYQE22js.Sheet,
|
|
382
382
|
{
|
|
383
383
|
open,
|
|
384
384
|
onOpenChange: (o) => {
|
|
@@ -386,11 +386,11 @@ function HelpHint({ contextKey }) {
|
|
|
386
386
|
if (!o) setPicked(null);
|
|
387
387
|
},
|
|
388
388
|
children: [
|
|
389
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
390
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
391
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
393
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
389
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SheetTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Button, { variant: "ghost", size: "icon-sm", "aria-label": t("help.hint.trigger") }), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.HelpCircleIcon, { className: "h-4 w-4" }) }),
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.SheetContent, { side: "right", className: "w-full max-w-md sm:max-w-lg", children: [
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.SheetHeader, { children: [
|
|
392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SheetTitle, { children: active ? active.name : t("help.hint.pickArticle") }),
|
|
393
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SheetDescription, { children: _nullishCoalesce(_optionalChain([active, 'optionalAccess', _4 => _4.summary]), () => ( "")) })
|
|
394
394
|
] }),
|
|
395
395
|
active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-4 space-y-3", children: [
|
|
396
396
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: active.summary }),
|
|
@@ -422,7 +422,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpHint, "HelpHint");
|
|
|
422
422
|
|
|
423
423
|
function HelpSearchResultRow({ result, onSelect }) {
|
|
424
424
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
425
|
-
const generateUrl =
|
|
425
|
+
const generateUrl = _chunk5WFYQE22js.usePageUrlGenerator.call(void 0, );
|
|
426
426
|
const [article, setArticle] = _react.useState.call(void 0, null);
|
|
427
427
|
_react.useEffect.call(void 0, () => {
|
|
428
428
|
let active = true;
|
|
@@ -433,7 +433,7 @@ function HelpSearchResultRow({ result, onSelect }) {
|
|
|
433
433
|
}, [result.id]);
|
|
434
434
|
if (!article) {
|
|
435
435
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
436
|
-
|
|
436
|
+
_chunk5WFYQE22js.CommandItem,
|
|
437
437
|
{
|
|
438
438
|
value: result.id,
|
|
439
439
|
disabled: true,
|
|
@@ -442,7 +442,7 @@ function HelpSearchResultRow({ result, onSelect }) {
|
|
|
442
442
|
}
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
445
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CommandItem, { value: result.id, onSelect, className: "cursor-pointer p-0", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
446
446
|
_link2.default,
|
|
447
447
|
{
|
|
448
448
|
href: generateUrl({ page: `/help/${article.howToType}/${article.slug}` }),
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunk5WFYQE22js = require('../../chunk-5WFYQE22.js');
|
|
30
30
|
require('../../chunk-X2MQ3WHX.js');
|
|
31
31
|
|
|
32
32
|
|
|
@@ -70,7 +70,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
70
70
|
};
|
|
71
71
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
72
72
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
73
|
-
|
|
73
|
+
_chunk5WFYQE22js.DateRangeSelector,
|
|
74
74
|
{
|
|
75
75
|
onDateChange: (range) => {
|
|
76
76
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -105,16 +105,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
107
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
108
|
-
|
|
108
|
+
_chunk5WFYQE22js.Select,
|
|
109
109
|
{
|
|
110
110
|
items: companyItems,
|
|
111
111
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
112
112
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
113
113
|
children: [
|
|
114
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
115
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
116
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
117
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
114
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
115
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.SelectContent, { children: [
|
|
116
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
117
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
118
118
|
] })
|
|
119
119
|
]
|
|
120
120
|
}
|
|
@@ -137,7 +137,7 @@ function Segmented({
|
|
|
137
137
|
children: options.map((option) => {
|
|
138
138
|
const selected = option.value === value;
|
|
139
139
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
140
|
-
|
|
140
|
+
_chunk5WFYQE22js.Button,
|
|
141
141
|
{
|
|
142
142
|
type: "button",
|
|
143
143
|
size: "sm",
|
|
@@ -219,7 +219,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
219
219
|
pageUrl = TOKEN_USAGE_ADMIN_PAGE_URL
|
|
220
220
|
}) => {
|
|
221
221
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
222
|
-
const generateUrl =
|
|
222
|
+
const generateUrl = _chunk5WFYQE22js.usePageUrlGenerator.call(void 0, );
|
|
223
223
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
224
224
|
const range = defaultRange();
|
|
225
225
|
return {
|
|
@@ -337,7 +337,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
337
337
|
error
|
|
338
338
|
]
|
|
339
339
|
);
|
|
340
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
340
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
341
341
|
}, "TokenUsageAdminProvider");
|
|
342
342
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
343
343
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -497,7 +497,7 @@ function LeadTile({
|
|
|
497
497
|
previousLabel,
|
|
498
498
|
decimal
|
|
499
499
|
}) {
|
|
500
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
500
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.CardContent, { className: "grid gap-1", children: [
|
|
501
501
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
502
502
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
503
503
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -514,7 +514,7 @@ function SupportingTile({
|
|
|
514
514
|
delta,
|
|
515
515
|
decimal
|
|
516
516
|
}) {
|
|
517
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
517
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.CardContent, { className: "grid gap-1", children: [
|
|
518
518
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
519
519
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
520
520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -611,8 +611,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
611
611
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
612
612
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
613
613
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
614
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
615
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
614
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Table, { children: [
|
|
615
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableHead, { className: _chunk6T6QB6K2js.cn.call(void 0, column.numeric && "text-right"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
616
616
|
"button",
|
|
617
617
|
{
|
|
618
618
|
type: "button",
|
|
@@ -627,20 +627,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
627
627
|
]
|
|
628
628
|
}
|
|
629
629
|
) }, column.key)) }) }),
|
|
630
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
630
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableBody, { children: sortedRows.map((row) => {
|
|
631
631
|
const value = metricValue(row, metric);
|
|
632
632
|
const share = total > 0 ? value / total * 100 : 0;
|
|
633
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
635
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
636
|
-
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
633
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
636
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
640
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: percent(cacheHitPercentage(row.cached, row.tokensIn)) }),
|
|
641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
642
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.TableCell, { className: "text-right text-xs tabular-nums", children: percent(share) })
|
|
644
644
|
] }, row.id);
|
|
645
645
|
}) })
|
|
646
646
|
] }) })
|
|
@@ -833,7 +833,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
833
833
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, children: [
|
|
834
834
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
835
835
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
836
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
836
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.ChartContainer, { config: chartConfig, className: "aspect-auto h-72 w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _recharts.BarChart, { accessibilityLayer: true, data: chartData, margin: { top: 8, right: 8, bottom: 0, left: 0 }, children: [
|
|
837
837
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
838
838
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
839
839
|
_recharts.XAxis,
|
|
@@ -857,10 +857,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
857
857
|
}
|
|
858
858
|
),
|
|
859
859
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
860
|
-
|
|
860
|
+
_chunk5WFYQE22js.ChartTooltip,
|
|
861
861
|
{
|
|
862
862
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
863
|
-
|
|
863
|
+
_chunk5WFYQE22js.ChartTooltipContent,
|
|
864
864
|
{
|
|
865
865
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
866
866
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -869,7 +869,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
869
869
|
)
|
|
870
870
|
}
|
|
871
871
|
),
|
|
872
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
872
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.ChartLegendContent, {}) }) : null,
|
|
873
873
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
874
874
|
_recharts.Bar,
|
|
875
875
|
{
|
|
@@ -920,19 +920,19 @@ function TokenUsageAdminContainer() {
|
|
|
920
920
|
[t]
|
|
921
921
|
);
|
|
922
922
|
if (error) {
|
|
923
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
923
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
924
924
|
}
|
|
925
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
925
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
926
926
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
927
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
927
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
928
928
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
929
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
930
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
929
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
930
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.CardHeader, { children: [
|
|
931
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
933
933
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
934
934
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
935
|
-
|
|
935
|
+
_chunk5WFYQE22js.Select,
|
|
936
936
|
{
|
|
937
937
|
items: stackByItems,
|
|
938
938
|
value: filters.stackBy,
|
|
@@ -940,29 +940,29 @@ function TokenUsageAdminContainer() {
|
|
|
940
940
|
if (value) setFilters({ stackBy: value });
|
|
941
941
|
},
|
|
942
942
|
children: [
|
|
943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectValue, {}) }),
|
|
944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
945
945
|
]
|
|
946
946
|
}
|
|
947
947
|
)
|
|
948
948
|
] }) })
|
|
949
949
|
] }),
|
|
950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
951
951
|
] }),
|
|
952
952
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
953
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
954
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
955
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
953
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
954
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
955
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
956
956
|
] }),
|
|
957
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
958
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
959
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
957
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
960
960
|
] })
|
|
961
961
|
] }),
|
|
962
962
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk6T6QB6K2js.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
963
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
964
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
965
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
963
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
964
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
965
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
966
966
|
TokenUsageRankedBar,
|
|
967
967
|
{
|
|
968
968
|
rows: byCustomerOperation,
|
|
@@ -972,9 +972,9 @@ function TokenUsageAdminContainer() {
|
|
|
972
972
|
}
|
|
973
973
|
) })
|
|
974
974
|
] }),
|
|
975
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
976
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
977
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
975
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
976
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
977
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
978
978
|
TokenUsageRankedBar,
|
|
979
979
|
{
|
|
980
980
|
rows: byOperation,
|
|
@@ -985,9 +985,9 @@ function TokenUsageAdminContainer() {
|
|
|
985
985
|
) })
|
|
986
986
|
] })
|
|
987
987
|
] }),
|
|
988
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
989
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
990
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
988
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
989
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
990
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
991
991
|
] })
|
|
992
992
|
] }) });
|
|
993
993
|
}
|
|
@@ -1108,7 +1108,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1108
1108
|
|
|
1109
1109
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1110
1110
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1111
|
-
|
|
1111
|
+
_chunk5WFYQE22js.DateRangeSelector,
|
|
1112
1112
|
{
|
|
1113
1113
|
onDateChange: (range) => {
|
|
1114
1114
|
if (!_optionalChain([range, 'optionalAccess', _10 => _10.from]) || !_optionalChain([range, 'optionalAccess', _11 => _11.to])) return;
|
|
@@ -1141,7 +1141,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1141
1141
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1142
1142
|
}) => {
|
|
1143
1143
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1144
|
-
const generateUrl =
|
|
1144
|
+
const generateUrl = _chunk5WFYQE22js.usePageUrlGenerator.call(void 0, );
|
|
1145
1145
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1146
1146
|
const range = defaultRange2();
|
|
1147
1147
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1205,7 +1205,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1205
1205
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1206
1206
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1207
1207
|
);
|
|
1208
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1208
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1209
1209
|
}, "TokenUsageReportProvider");
|
|
1210
1210
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1211
1211
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1233,7 +1233,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1233
1233
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1234
1234
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1235
1235
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1236
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1236
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.CardContent, { className: "grid gap-1", children: [
|
|
1237
1237
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1238
1238
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(metricValue(current, metric), metric) }),
|
|
1239
1239
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -1249,7 +1249,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1249
1249
|
] })
|
|
1250
1250
|
] }) }),
|
|
1251
1251
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1252
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1252
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.CardContent, { className: "grid gap-1", children: [
|
|
1253
1253
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1254
1254
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1255
1255
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunk6T6QB6K2js.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
@@ -1259,11 +1259,11 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1259
1259
|
] })
|
|
1260
1260
|
] })
|
|
1261
1261
|
] }) }),
|
|
1262
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1262
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.CardContent, { className: "grid gap-1", children: [
|
|
1263
1263
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1264
1264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1265
1265
|
] }) }),
|
|
1266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.CardContent, { className: "grid gap-1", children: [
|
|
1267
1267
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1268
1268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1269
1269
|
] }) })
|
|
@@ -1305,21 +1305,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1305
1305
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1306
1306
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1307
1307
|
if (error) {
|
|
1308
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1308
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1309
1309
|
}
|
|
1310
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1310
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1311
1311
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1312
1312
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1313
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1313
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1314
1314
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1315
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1317
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1315
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
1316
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1318
1318
|
] }),
|
|
1319
1319
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk6T6QB6K2js.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1320
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1320
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
1321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1323
1323
|
TokenUsageRankedBar,
|
|
1324
1324
|
{
|
|
1325
1325
|
rows: byOperation,
|
|
@@ -1329,9 +1329,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
) })
|
|
1331
1331
|
] }),
|
|
1332
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1334
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1332
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5WFYQE22js.Card, { children: [
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardTitle, { children: targetTitle }) }),
|
|
1334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5WFYQE22js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1335
1335
|
] })
|
|
1336
1336
|
] })
|
|
1337
1337
|
] }) });
|