@carlonicora/nextjs-jsonapi 6.9.0 → 6.10.1
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-WN73IHXR.mjs → BlockNoteEditor-GK3DRTOP.mjs} +49 -15
- package/dist/BlockNoteEditor-GK3DRTOP.mjs.map +1 -0
- package/dist/{BlockNoteEditor-XXH3VBZ7.js → BlockNoteEditor-YOKJOVV3.js} +64 -30
- package/dist/BlockNoteEditor-YOKJOVV3.js.map +1 -0
- package/dist/billing/index.js +436 -435
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +8 -7
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-ZCM4JLM7.js → chunk-4UFMLTL2.js} +73 -71
- package/dist/chunk-4UFMLTL2.js.map +1 -0
- package/dist/{chunk-Q4XLE3QO.mjs → chunk-THZAK7S3.mjs} +9 -7
- package/dist/{chunk-Q4XLE3QO.mjs.map → chunk-THZAK7S3.mjs.map} +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.d.mts +12 -5
- package/dist/components/index.d.ts +12 -5
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/email-automations/index.js +58 -58
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +87 -87
- package/dist/features/analytics/index.mjs +1 -1
- package/dist/features/blog/index.js +93 -93
- package/dist/features/blog/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 +77 -77
- package/dist/features/tokenusage/index.mjs +1 -1
- package/messages/en.json +4 -2
- package/messages/it.json +4 -2
- package/package.json +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +69 -14
- package/src/components/editors/__tests__/BlockNoteEditor.ai.spec.tsx +295 -0
- package/src/features/assistant/components/containers/AssistantPageContainer.tsx +20 -9
- package/src/features/assistant/components/containers/__tests__/AssistantPageContainer.spec.tsx +116 -0
- package/src/features/assistant/components/parts/AssistantThread.tsx +2 -1
- package/src/features/assistant-message/components/MessageItem.tsx +1 -1
- package/src/features/assistant-message/components/MessageList.tsx +1 -1
- package/src/features/assistant-message/components/parts/MessageSourcesContainer.tsx +1 -1
- package/src/features/assistant-message/components/parts/MessageSourcesPanel.tsx +1 -1
- package/src/features/assistant-message/components/parts/__tests__/MessageSourcesPanel.spec.tsx +17 -1
- package/src/features/assistant-message/components/parts/__tests__/SuggestedQuestionsTab.spec.tsx +22 -0
- package/src/features/assistant-message/components/parts/tabs/SuggestedQuestionsTab.tsx +5 -3
- package/src/features/billing/i18n-keys.ts +2 -0
- package/src/features/billing/stripe-subscription/components/widgets/ProrationPreview.tsx +1 -2
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +16 -5
- package/dist/BlockNoteEditor-WN73IHXR.mjs.map +0 -1
- package/dist/BlockNoteEditor-XXH3VBZ7.js.map +0 -1
- package/dist/chunk-ZCM4JLM7.js.map +0 -1
|
@@ -23,7 +23,7 @@ var _chunkYBZVWLPHjs = require('../../chunk-YBZVWLPH.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunk4UFMLTL2js = require('../../chunk-4UFMLTL2.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkKRQRJA4Jjs = require('../../chunk-KRQRJA4J.js');
|
|
@@ -76,29 +76,29 @@ var _lucidereact = require('lucide-react');
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
function HelpAssistantSheet({ open, onOpenChange }) {
|
|
79
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
80
|
-
|
|
79
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Sheet, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
80
|
+
_chunk4UFMLTL2js.SheetContent,
|
|
81
81
|
{
|
|
82
82
|
side: "end",
|
|
83
83
|
className: "flex w-full flex-col data-[side=right]:sm:max-w-2xl data-[side=right]:lg:max-w-3xl data-[side=left]:sm:max-w-2xl data-[side=left]:lg:max-w-3xl",
|
|
84
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
84
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.AssistantProvider, { manageUrl: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HelpAssistantSheetBody, {}) })
|
|
85
85
|
}
|
|
86
86
|
) });
|
|
87
87
|
}
|
|
88
88
|
_chunk7QVYU63Ejs.__name.call(void 0, HelpAssistantSheet, "HelpAssistantSheet");
|
|
89
89
|
function HelpAssistantSheetBody() {
|
|
90
90
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
91
|
-
const ctx =
|
|
91
|
+
const ctx = _chunk4UFMLTL2js.useAssistantContext.call(void 0, );
|
|
92
92
|
const showThread = !!ctx.assistant || ctx.sending || ctx.messages.length > 0;
|
|
93
93
|
const send = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (content) => ctx.sendMessage(content, { howToMode: true }), "send");
|
|
94
94
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
95
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
96
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
97
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
95
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.SheetHeader, { children: [
|
|
96
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SheetTitle, { children: t("help.askAi.sheet.title") }),
|
|
97
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SheetDescription, { children: t("help.askAi.sheet.subtitle") })
|
|
98
98
|
] }),
|
|
99
|
-
!showThread ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
99
|
+
!showThread ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.AssistantEmptyState, { onSend: send }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
100
100
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
101
|
-
|
|
101
|
+
_chunk4UFMLTL2js.AssistantThread,
|
|
102
102
|
{
|
|
103
103
|
messages: ctx.messages,
|
|
104
104
|
sending: ctx.sending,
|
|
@@ -108,7 +108,7 @@ function HelpAssistantSheetBody() {
|
|
|
108
108
|
onRetry: ctx.retrySend
|
|
109
109
|
}
|
|
110
110
|
),
|
|
111
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
111
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.AssistantComposer, { onSend: send, disabled: ctx.sending })
|
|
112
112
|
] })
|
|
113
113
|
] });
|
|
114
114
|
}
|
|
@@ -118,20 +118,20 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpAssistantSheetBody, "HelpAssistantSheet
|
|
|
118
118
|
|
|
119
119
|
function HelpAskAi() {
|
|
120
120
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
121
|
-
const { currentUser } =
|
|
121
|
+
const { currentUser } = _chunk4UFMLTL2js.useCurrentUserContext.call(void 0, );
|
|
122
122
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
123
123
|
const disabled = !currentUser;
|
|
124
124
|
if (disabled) {
|
|
125
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
125
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Tooltip, { children: [
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.TooltipTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Button, { variant: "outline", size: "sm", disabled: true }), children: [
|
|
127
127
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SparklesIcon, { className: "h-4 w-4" }),
|
|
128
128
|
t("help.askAi.button")
|
|
129
129
|
] }),
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TooltipContent, { children: t("help.askAi.loginTooltip") })
|
|
131
131
|
] });
|
|
132
132
|
}
|
|
133
133
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
134
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
134
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
135
135
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SparklesIcon, { className: "h-4 w-4" }),
|
|
136
136
|
t("help.askAi.button")
|
|
137
137
|
] }),
|
|
@@ -144,7 +144,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpAskAi, "HelpAskAi");
|
|
|
144
144
|
|
|
145
145
|
function HelpHeader() {
|
|
146
146
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
147
|
-
const { currentUser } =
|
|
147
|
+
const { currentUser } = _chunk4UFMLTL2js.useCurrentUserContext.call(void 0, );
|
|
148
148
|
const { brand } = useHelp();
|
|
149
149
|
const logo = _optionalChain([brand, 'optionalAccess', _ => _.logo]);
|
|
150
150
|
const label = _nullishCoalesce(_optionalChain([brand, 'optionalAccess', _2 => _2.label]), () => ( t("help.title")));
|
|
@@ -160,7 +160,7 @@ function HelpHeader() {
|
|
|
160
160
|
] }),
|
|
161
161
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 max-md:shrink-0", children: [
|
|
162
162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HelpAskAi, {}),
|
|
163
|
-
currentUser ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _link2.default, { href: appHref, className:
|
|
163
|
+
currentUser ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _link2.default, { href: appHref, className: _chunk4UFMLTL2js.buttonVariants.call(void 0, { variant: "outline", size: "sm" }), children: t("help.header.openApp") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _link2.default, { href: "/login", className: _chunk4UFMLTL2js.buttonVariants.call(void 0, { variant: "outline", size: "sm" }), children: t("help.header.login") })
|
|
164
164
|
] })
|
|
165
165
|
] });
|
|
166
166
|
}
|
|
@@ -202,7 +202,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, useHelpFilter, "useHelpFilter");
|
|
|
202
202
|
|
|
203
203
|
function HelpSideNav() {
|
|
204
204
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
205
|
-
const generateUrl =
|
|
205
|
+
const generateUrl = _chunk4UFMLTL2js.usePageUrlGenerator.call(void 0, );
|
|
206
206
|
const pathname = _navigation.usePathname.call(void 0, );
|
|
207
207
|
const [articles, setArticles] = _react.useState.call(void 0, []);
|
|
208
208
|
_react.useEffect.call(void 0, () => {
|
|
@@ -283,7 +283,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpSideNav, "HelpSideNav");
|
|
|
283
283
|
function HelpArticleBody(props) {
|
|
284
284
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
285
285
|
const format = _nextintl.useFormatter.call(void 0, );
|
|
286
|
-
const generateUrl =
|
|
286
|
+
const generateUrl = _chunk4UFMLTL2js.usePageUrlGenerator.call(void 0, );
|
|
287
287
|
const { howToType, title, summary, updatedAt, prev, next, children } = props;
|
|
288
288
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "article", { className: "prose dark:prose-invert max-w-none", children: [
|
|
289
289
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "nav", { className: "text-muted-foreground mb-2 text-xs", children: [
|
|
@@ -340,7 +340,7 @@ function HelpTOC({ headings }) {
|
|
|
340
340
|
}, [headings]);
|
|
341
341
|
if (headings.length === 0) return null;
|
|
342
342
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "nav", { "aria-label": t("help.toc.title"), className: "hidden lg:block", children: [
|
|
343
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
343
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.MicroLabel, { className: "mb-2", children: t("help.toc.title") }),
|
|
344
344
|
/* @__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: { paddingInlineStart: `${(h.depth - 2) * 0.75}rem` }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
345
345
|
"a",
|
|
346
346
|
{
|
|
@@ -361,7 +361,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpTOC, "HelpTOC");
|
|
|
361
361
|
|
|
362
362
|
function HelpHint({ contextKey }) {
|
|
363
363
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
364
|
-
const generateUrl =
|
|
364
|
+
const generateUrl = _chunk4UFMLTL2js.usePageUrlGenerator.call(void 0, );
|
|
365
365
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
366
366
|
const [picked, setPicked] = _react.useState.call(void 0, null);
|
|
367
367
|
const [articles, setArticles] = _react.useState.call(void 0, []);
|
|
@@ -379,7 +379,7 @@ function HelpHint({ contextKey }) {
|
|
|
379
379
|
if (matches.length === 0) return null;
|
|
380
380
|
const active = _nullishCoalesce(picked, () => ( (matches.length === 1 ? matches[0] : null)));
|
|
381
381
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
382
|
-
|
|
382
|
+
_chunk4UFMLTL2js.Sheet,
|
|
383
383
|
{
|
|
384
384
|
open,
|
|
385
385
|
onOpenChange: (o) => {
|
|
@@ -387,11 +387,11 @@ function HelpHint({ contextKey }) {
|
|
|
387
387
|
if (!o) setPicked(null);
|
|
388
388
|
},
|
|
389
389
|
children: [
|
|
390
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
391
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
392
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
393
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SheetTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.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" }) }),
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.SheetContent, { side: "end", className: "w-full max-w-md sm:max-w-lg", children: [
|
|
392
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.SheetHeader, { children: [
|
|
393
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SheetTitle, { children: active ? active.name : t("help.hint.pickArticle") }),
|
|
394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SheetDescription, { children: _nullishCoalesce(_optionalChain([active, 'optionalAccess', _4 => _4.summary]), () => ( "")) })
|
|
395
395
|
] }),
|
|
396
396
|
active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-4 space-y-3", children: [
|
|
397
397
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: active.summary }),
|
|
@@ -423,7 +423,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, HelpHint, "HelpHint");
|
|
|
423
423
|
|
|
424
424
|
function HelpSearchResultRow({ result, onSelect }) {
|
|
425
425
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
426
|
-
const generateUrl =
|
|
426
|
+
const generateUrl = _chunk4UFMLTL2js.usePageUrlGenerator.call(void 0, );
|
|
427
427
|
const [article, setArticle] = _react.useState.call(void 0, null);
|
|
428
428
|
_react.useEffect.call(void 0, () => {
|
|
429
429
|
let active = true;
|
|
@@ -434,7 +434,7 @@ function HelpSearchResultRow({ result, onSelect }) {
|
|
|
434
434
|
}, [result.id]);
|
|
435
435
|
if (!article) {
|
|
436
436
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
437
|
-
|
|
437
|
+
_chunk4UFMLTL2js.CommandItem,
|
|
438
438
|
{
|
|
439
439
|
value: result.id,
|
|
440
440
|
disabled: true,
|
|
@@ -443,7 +443,7 @@ function HelpSearchResultRow({ result, onSelect }) {
|
|
|
443
443
|
}
|
|
444
444
|
);
|
|
445
445
|
}
|
|
446
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
446
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CommandItem, { value: result.id, onSelect, className: "cursor-pointer p-0", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
447
447
|
_link2.default,
|
|
448
448
|
{
|
|
449
449
|
href: generateUrl({ page: `/help/${article.howToType}/${article.slug}` }),
|
|
@@ -41,7 +41,7 @@ var _chunkG3YKDIALjs = require('../../chunk-G3YKDIAL.js');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunk4UFMLTL2js = require('../../chunk-4UFMLTL2.js');
|
|
45
45
|
require('../../chunk-KRQRJA4J.js');
|
|
46
46
|
require('../../chunk-G4JR3SFV.js');
|
|
47
47
|
|
|
@@ -86,7 +86,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
86
86
|
};
|
|
87
87
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
88
88
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
89
|
-
|
|
89
|
+
_chunk4UFMLTL2js.DateRangeSelector,
|
|
90
90
|
{
|
|
91
91
|
onDateChange: (range) => {
|
|
92
92
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -121,16 +121,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
121
121
|
}
|
|
122
122
|
),
|
|
123
123
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
124
|
-
|
|
124
|
+
_chunk4UFMLTL2js.Select,
|
|
125
125
|
{
|
|
126
126
|
items: companyItems,
|
|
127
127
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
128
128
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
129
129
|
children: [
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
132
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
133
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.SelectContent, { children: [
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
133
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
134
134
|
] })
|
|
135
135
|
]
|
|
136
136
|
}
|
|
@@ -153,7 +153,7 @@ function Segmented({
|
|
|
153
153
|
children: options.map((option) => {
|
|
154
154
|
const selected = option.value === value;
|
|
155
155
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
156
|
-
|
|
156
|
+
_chunk4UFMLTL2js.Button,
|
|
157
157
|
{
|
|
158
158
|
type: "button",
|
|
159
159
|
size: "sm",
|
|
@@ -345,7 +345,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
345
345
|
error
|
|
346
346
|
]
|
|
347
347
|
);
|
|
348
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
348
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
349
349
|
}, "TokenUsageAdminProvider");
|
|
350
350
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
351
351
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -442,7 +442,7 @@ function LeadTile({
|
|
|
442
442
|
previousLabel,
|
|
443
443
|
decimal
|
|
444
444
|
}) {
|
|
445
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
445
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.CardContent, { className: "grid gap-1", children: [
|
|
446
446
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
447
447
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
448
448
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -459,7 +459,7 @@ function SupportingTile({
|
|
|
459
459
|
delta,
|
|
460
460
|
decimal
|
|
461
461
|
}) {
|
|
462
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
462
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.CardContent, { className: "grid gap-1", children: [
|
|
463
463
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
464
464
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
465
465
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -556,8 +556,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
556
556
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
557
557
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
558
558
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
559
|
-
/* @__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,
|
|
560
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
559
|
+
/* @__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, _chunk4UFMLTL2js.Table, { children: [
|
|
560
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableHead, { className: _chunkSQTXJPREjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
561
561
|
"button",
|
|
562
562
|
{
|
|
563
563
|
type: "button",
|
|
@@ -572,20 +572,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
572
572
|
]
|
|
573
573
|
}
|
|
574
574
|
) }, column.key)) }) }),
|
|
575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableBody, { children: sortedRows.map((row) => {
|
|
576
576
|
const value = _chunkG3YKDIALjs.metricValue.call(void 0, row, metric);
|
|
577
577
|
const share = total > 0 ? value / total * 100 : 0;
|
|
578
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
581
|
-
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
584
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
585
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
586
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
587
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
588
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
578
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
581
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunkG3YKDIALjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
589
589
|
] }, row.id);
|
|
590
590
|
}) })
|
|
591
591
|
] }) })
|
|
@@ -641,9 +641,9 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
641
641
|
const label = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground truncate text-xs", children: renderLabel(row) });
|
|
642
642
|
const description = renderDescription(row);
|
|
643
643
|
if (!description) return label;
|
|
644
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
644
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Tooltip, { children: [
|
|
645
645
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
646
|
-
|
|
646
|
+
_chunk4UFMLTL2js.TooltipTrigger,
|
|
647
647
|
{
|
|
648
648
|
"data-testid": `ranked-description-${row.id}`,
|
|
649
649
|
className: "min-w-0 cursor-help justify-self-start truncate",
|
|
@@ -651,7 +651,7 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
651
651
|
children: label
|
|
652
652
|
}
|
|
653
653
|
),
|
|
654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs", children: description }) })
|
|
655
655
|
] });
|
|
656
656
|
}, "renderLabelCell");
|
|
657
657
|
if (rows.length === 0) {
|
|
@@ -783,7 +783,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
783
783
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
784
784
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
785
785
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
786
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
786
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.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: [
|
|
787
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
788
788
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
789
789
|
_recharts.XAxis,
|
|
@@ -807,10 +807,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
807
807
|
}
|
|
808
808
|
),
|
|
809
809
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
810
|
-
|
|
810
|
+
_chunk4UFMLTL2js.ChartTooltip,
|
|
811
811
|
{
|
|
812
812
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
813
|
-
|
|
813
|
+
_chunk4UFMLTL2js.ChartTooltipContent,
|
|
814
814
|
{
|
|
815
815
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
816
816
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -819,7 +819,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
819
819
|
)
|
|
820
820
|
}
|
|
821
821
|
),
|
|
822
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
822
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.ChartLegendContent, {}) }) : null,
|
|
823
823
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
824
824
|
_recharts.Bar,
|
|
825
825
|
{
|
|
@@ -871,19 +871,19 @@ function TokenUsageAdminContainer() {
|
|
|
871
871
|
[t]
|
|
872
872
|
);
|
|
873
873
|
if (error) {
|
|
874
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
874
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.RoundPageContainer, { module: _chunkSQTXJPREjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
875
875
|
}
|
|
876
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
876
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.RoundPageContainer, { module: _chunkSQTXJPREjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
877
877
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
878
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.RoundPageContainer, { module: _chunkSQTXJPREjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
879
879
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
881
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
882
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: [
|
|
882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
883
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
884
884
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
885
885
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
886
|
-
|
|
886
|
+
_chunk4UFMLTL2js.Select,
|
|
887
887
|
{
|
|
888
888
|
items: stackByItems,
|
|
889
889
|
value: filters.stackBy,
|
|
@@ -891,29 +891,29 @@ function TokenUsageAdminContainer() {
|
|
|
891
891
|
if (value) setFilters({ stackBy: value });
|
|
892
892
|
},
|
|
893
893
|
children: [
|
|
894
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
895
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectValue, {}) }),
|
|
895
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
896
896
|
]
|
|
897
897
|
}
|
|
898
898
|
)
|
|
899
899
|
] }) })
|
|
900
900
|
] }),
|
|
901
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
901
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
902
902
|
] }),
|
|
903
903
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
904
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
905
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
906
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
904
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
905
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
906
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
907
907
|
] }),
|
|
908
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
909
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
910
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
909
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
910
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
911
911
|
] })
|
|
912
912
|
] }),
|
|
913
913
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkSQTXJPREjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
914
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
915
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
916
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
914
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
915
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
916
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
917
917
|
TokenUsageRankedBar,
|
|
918
918
|
{
|
|
919
919
|
rows: byCustomerOperation,
|
|
@@ -923,9 +923,9 @@ function TokenUsageAdminContainer() {
|
|
|
923
923
|
}
|
|
924
924
|
) })
|
|
925
925
|
] }),
|
|
926
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
927
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
928
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
926
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
928
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
929
929
|
TokenUsageRankedBar,
|
|
930
930
|
{
|
|
931
931
|
rows: byOperation,
|
|
@@ -936,9 +936,9 @@ function TokenUsageAdminContainer() {
|
|
|
936
936
|
) })
|
|
937
937
|
] })
|
|
938
938
|
] }),
|
|
939
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
940
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
941
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
942
942
|
] })
|
|
943
943
|
] }) });
|
|
944
944
|
}
|
|
@@ -1059,7 +1059,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1059
1059
|
|
|
1060
1060
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1061
1061
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-help": "tokenusage.filters", className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1062
|
-
|
|
1062
|
+
_chunk4UFMLTL2js.DateRangeSelector,
|
|
1063
1063
|
{
|
|
1064
1064
|
onDateChange: (range) => {
|
|
1065
1065
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1092,7 +1092,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1092
1092
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1093
1093
|
}) => {
|
|
1094
1094
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1095
|
-
const generateUrl =
|
|
1095
|
+
const generateUrl = _chunk4UFMLTL2js.usePageUrlGenerator.call(void 0, );
|
|
1096
1096
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1097
1097
|
const range = defaultRange2();
|
|
1098
1098
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1156,7 +1156,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1156
1156
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1157
1157
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1158
1158
|
);
|
|
1159
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1159
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1160
1160
|
}, "TokenUsageReportProvider");
|
|
1161
1161
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1162
1162
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1184,7 +1184,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1184
1184
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1185
1185
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1186
1186
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1187
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1187
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.CardContent, { className: "grid gap-1", children: [
|
|
1188
1188
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1189
1189
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunkG3YKDIALjs.metricValue.call(void 0, current, metric), metric) }),
|
|
1190
1190
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -1200,7 +1200,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1200
1200
|
] })
|
|
1201
1201
|
] }) }),
|
|
1202
1202
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1203
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.CardContent, { className: "grid gap-1", children: [
|
|
1204
1204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1205
1205
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1206
1206
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunkSQTXJPREjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
@@ -1210,11 +1210,11 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1210
1210
|
] })
|
|
1211
1211
|
] })
|
|
1212
1212
|
] }) }),
|
|
1213
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1213
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.CardContent, { className: "grid gap-1", children: [
|
|
1214
1214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1215
1215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1216
1216
|
] }) }),
|
|
1217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.CardContent, { className: "grid gap-1", children: [
|
|
1218
1218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1219
1219
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1220
1220
|
] }) })
|
|
@@ -1256,21 +1256,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1256
1256
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1257
1257
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1258
1258
|
if (error) {
|
|
1259
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1259
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1260
1260
|
}
|
|
1261
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1261
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1262
1262
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1263
1263
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1264
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1264
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1265
1265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1266
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1267
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1268
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1266
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
1267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1268
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1269
1269
|
] }),
|
|
1270
1270
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkSQTXJPREjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1271
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1272
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1273
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1271
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
1272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1273
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1274
1274
|
TokenUsageRankedBar,
|
|
1275
1275
|
{
|
|
1276
1276
|
rows: byOperation,
|
|
@@ -1280,9 +1280,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
) })
|
|
1282
1282
|
] }),
|
|
1283
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1284
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1285
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1283
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Card, { children: [
|
|
1284
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardTitle, { children: targetTitle }) }),
|
|
1285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1286
1286
|
] })
|
|
1287
1287
|
] })
|
|
1288
1288
|
] }) });
|