@carlonicora/nextjs-jsonapi 5.7.0 → 5.7.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-ZHXXFWUJ.js → BlockNoteEditor-ARUXU5AV.js} +9 -9
- package/dist/{BlockNoteEditor-ZHXXFWUJ.js.map → BlockNoteEditor-ARUXU5AV.js.map} +1 -1
- package/dist/{BlockNoteEditor-R3WXUFHX.mjs → BlockNoteEditor-MNNISNVN.mjs} +2 -2
- package/dist/billing/index.js +381 -380
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +3 -2
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-CFB6FHIY.mjs → chunk-2FNSDBJG.mjs} +9 -6
- package/dist/chunk-2FNSDBJG.mjs.map +1 -0
- package/dist/{chunk-ZCOPOO7T.js → chunk-2WK35GO2.js} +10 -7
- package/dist/chunk-2WK35GO2.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- 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 +74 -74
- package/dist/features/tokenusage/index.mjs +1 -1
- package/package.json +1 -1
- package/src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx +2 -2
- package/src/features/billing/stripe-coupon/components/forms/CouponEditor.tsx +1 -11
- package/src/features/billing/stripe-coupon/utils/__tests__/coupon-page-module.spec.ts +32 -0
- package/src/features/billing/stripe-coupon/utils/coupon-page-module.ts +13 -0
- package/dist/chunk-CFB6FHIY.mjs.map +0 -1
- package/dist/chunk-ZCOPOO7T.js.map +0 -1
- /package/dist/{BlockNoteEditor-R3WXUFHX.mjs.map → BlockNoteEditor-MNNISNVN.mjs.map} +0 -0
|
@@ -23,7 +23,7 @@ var _chunkYBZVWLPHjs = require('../../chunk-YBZVWLPH.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunk2WK35GO2js = require('../../chunk-2WK35GO2.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkXOSC3FFPjs = require('../../chunk-XOSC3FFP.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, _chunk2WK35GO2js.Sheet, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
80
|
+
_chunk2WK35GO2js.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, _chunk2WK35GO2js.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 = _chunk2WK35GO2js.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, _chunk2WK35GO2js.SheetHeader, { children: [
|
|
96
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SheetTitle, { children: t("help.askAi.sheet.title") }),
|
|
97
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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, _chunk2WK35GO2js.AssistantEmptyState, { onSend: send }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
100
100
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
101
|
-
|
|
101
|
+
_chunk2WK35GO2js.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, _chunk2WK35GO2js.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 } = _chunk2WK35GO2js.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, _chunk2WK35GO2js.Tooltip, { children: [
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TooltipTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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, _chunk2WK35GO2js.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, _chunk2WK35GO2js.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 } = _chunk2WK35GO2js.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: _chunk2WK35GO2js.buttonVariants.call(void 0, { variant: "outline", size: "sm" }), children: t("help.header.openApp") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _link2.default, { href: "/login", className: _chunk2WK35GO2js.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 = _chunk2WK35GO2js.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 = _chunk2WK35GO2js.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, _chunk2WK35GO2js.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 = _chunk2WK35GO2js.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
|
+
_chunk2WK35GO2js.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, _chunk2WK35GO2js.SheetTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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, _chunk2WK35GO2js.SheetContent, { side: "end", className: "w-full max-w-md sm:max-w-lg", children: [
|
|
392
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.SheetHeader, { children: [
|
|
393
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SheetTitle, { children: active ? active.name : t("help.hint.pickArticle") }),
|
|
394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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 = _chunk2WK35GO2js.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
|
+
_chunk2WK35GO2js.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, _chunk2WK35GO2js.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}` }),
|
|
@@ -37,7 +37,7 @@ var _chunk2TXE57LEjs = require('../../chunk-2TXE57LE.js');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunk2WK35GO2js = require('../../chunk-2WK35GO2.js');
|
|
41
41
|
require('../../chunk-XOSC3FFP.js');
|
|
42
42
|
require('../../chunk-G4JR3SFV.js');
|
|
43
43
|
|
|
@@ -82,7 +82,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
82
82
|
};
|
|
83
83
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
84
84
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
85
|
-
|
|
85
|
+
_chunk2WK35GO2js.DateRangeSelector,
|
|
86
86
|
{
|
|
87
87
|
onDateChange: (range) => {
|
|
88
88
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -117,16 +117,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
117
117
|
}
|
|
118
118
|
),
|
|
119
119
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
120
|
-
|
|
120
|
+
_chunk2WK35GO2js.Select,
|
|
121
121
|
{
|
|
122
122
|
items: companyItems,
|
|
123
123
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
124
124
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
125
125
|
children: [
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
127
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
127
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.SelectContent, { children: [
|
|
128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
129
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
130
130
|
] })
|
|
131
131
|
]
|
|
132
132
|
}
|
|
@@ -149,7 +149,7 @@ function Segmented({
|
|
|
149
149
|
children: options.map((option) => {
|
|
150
150
|
const selected = option.value === value;
|
|
151
151
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
152
|
-
|
|
152
|
+
_chunk2WK35GO2js.Button,
|
|
153
153
|
{
|
|
154
154
|
type: "button",
|
|
155
155
|
size: "sm",
|
|
@@ -341,7 +341,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
341
341
|
error
|
|
342
342
|
]
|
|
343
343
|
);
|
|
344
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
344
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
345
345
|
}, "TokenUsageAdminProvider");
|
|
346
346
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
347
347
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -438,7 +438,7 @@ function LeadTile({
|
|
|
438
438
|
previousLabel,
|
|
439
439
|
decimal
|
|
440
440
|
}) {
|
|
441
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
441
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "grid gap-1", children: [
|
|
442
442
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
443
443
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
444
444
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -455,7 +455,7 @@ function SupportingTile({
|
|
|
455
455
|
delta,
|
|
456
456
|
decimal
|
|
457
457
|
}) {
|
|
458
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
458
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "grid gap-1", children: [
|
|
459
459
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
460
460
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
461
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -552,8 +552,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
552
552
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
553
553
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
554
554
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
555
|
-
/* @__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,
|
|
556
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
555
|
+
/* @__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, _chunk2WK35GO2js.Table, { children: [
|
|
556
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { className: _chunk5TH2DSAHjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
557
557
|
"button",
|
|
558
558
|
{
|
|
559
559
|
type: "button",
|
|
@@ -568,20 +568,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
568
568
|
]
|
|
569
569
|
}
|
|
570
570
|
) }, column.key)) }) }),
|
|
571
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
571
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableBody, { children: sortedRows.map((row) => {
|
|
572
572
|
const value = _chunk2TXE57LEjs.metricValue.call(void 0, row, metric);
|
|
573
573
|
const share = total > 0 ? value / total * 100 : 0;
|
|
574
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
576
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
577
|
-
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
581
|
-
/* @__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,
|
|
574
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
576
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
577
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunk2TXE57LEjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
585
585
|
] }, row.id);
|
|
586
586
|
}) })
|
|
587
587
|
] }) })
|
|
@@ -749,7 +749,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
749
749
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
750
750
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
751
751
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
752
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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: [
|
|
753
753
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
754
754
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
755
755
|
_recharts.XAxis,
|
|
@@ -773,10 +773,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
773
773
|
}
|
|
774
774
|
),
|
|
775
775
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
776
|
-
|
|
776
|
+
_chunk2WK35GO2js.ChartTooltip,
|
|
777
777
|
{
|
|
778
778
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
779
|
-
|
|
779
|
+
_chunk2WK35GO2js.ChartTooltipContent,
|
|
780
780
|
{
|
|
781
781
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
782
782
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -785,7 +785,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
785
785
|
)
|
|
786
786
|
}
|
|
787
787
|
),
|
|
788
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
788
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.ChartLegendContent, {}) }) : null,
|
|
789
789
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
790
790
|
_recharts.Bar,
|
|
791
791
|
{
|
|
@@ -837,19 +837,19 @@ function TokenUsageAdminContainer() {
|
|
|
837
837
|
[t]
|
|
838
838
|
);
|
|
839
839
|
if (error) {
|
|
840
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
840
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.RoundPageContainer, { module: _chunk5TH2DSAHjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
841
841
|
}
|
|
842
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
842
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.RoundPageContainer, { module: _chunk5TH2DSAHjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
843
843
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
844
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
844
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.RoundPageContainer, { module: _chunk5TH2DSAHjs.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: [
|
|
845
845
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
846
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
847
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
848
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
849
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
846
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
847
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { children: [
|
|
848
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
849
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
850
850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
851
851
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
852
|
-
|
|
852
|
+
_chunk2WK35GO2js.Select,
|
|
853
853
|
{
|
|
854
854
|
items: stackByItems,
|
|
855
855
|
value: filters.stackBy,
|
|
@@ -857,29 +857,29 @@ function TokenUsageAdminContainer() {
|
|
|
857
857
|
if (value) setFilters({ stackBy: value });
|
|
858
858
|
},
|
|
859
859
|
children: [
|
|
860
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
861
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
860
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectValue, {}) }),
|
|
861
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
862
862
|
]
|
|
863
863
|
}
|
|
864
864
|
)
|
|
865
865
|
] }) })
|
|
866
866
|
] }),
|
|
867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
868
868
|
] }),
|
|
869
869
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
870
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
871
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
870
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
873
873
|
] }),
|
|
874
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
875
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
876
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
874
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
875
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
876
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
877
877
|
] })
|
|
878
878
|
] }),
|
|
879
879
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk5TH2DSAHjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
881
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
882
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
883
|
TokenUsageRankedBar,
|
|
884
884
|
{
|
|
885
885
|
rows: byCustomerOperation,
|
|
@@ -889,9 +889,9 @@ function TokenUsageAdminContainer() {
|
|
|
889
889
|
}
|
|
890
890
|
) })
|
|
891
891
|
] }),
|
|
892
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
893
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
894
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
892
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
893
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
895
895
|
TokenUsageRankedBar,
|
|
896
896
|
{
|
|
897
897
|
rows: byOperation,
|
|
@@ -902,9 +902,9 @@ function TokenUsageAdminContainer() {
|
|
|
902
902
|
) })
|
|
903
903
|
] })
|
|
904
904
|
] }),
|
|
905
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
906
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
905
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
906
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
908
908
|
] })
|
|
909
909
|
] }) });
|
|
910
910
|
}
|
|
@@ -1025,7 +1025,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1025
1025
|
|
|
1026
1026
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1027
1027
|
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,
|
|
1028
|
-
|
|
1028
|
+
_chunk2WK35GO2js.DateRangeSelector,
|
|
1029
1029
|
{
|
|
1030
1030
|
onDateChange: (range) => {
|
|
1031
1031
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1058,7 +1058,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1058
1058
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1059
1059
|
}) => {
|
|
1060
1060
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1061
|
-
const generateUrl =
|
|
1061
|
+
const generateUrl = _chunk2WK35GO2js.usePageUrlGenerator.call(void 0, );
|
|
1062
1062
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1063
1063
|
const range = defaultRange2();
|
|
1064
1064
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1122,7 +1122,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1122
1122
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1123
1123
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1124
1124
|
);
|
|
1125
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1125
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1126
1126
|
}, "TokenUsageReportProvider");
|
|
1127
1127
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1128
1128
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1150,7 +1150,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1150
1150
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1151
1151
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1152
1152
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1153
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "grid gap-1", children: [
|
|
1154
1154
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1155
1155
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunk2TXE57LEjs.metricValue.call(void 0, current, metric), metric) }),
|
|
1156
1156
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -1166,7 +1166,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1166
1166
|
] })
|
|
1167
1167
|
] }) }),
|
|
1168
1168
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1169
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1169
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "grid gap-1", children: [
|
|
1170
1170
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1171
1171
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1172
1172
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunk5TH2DSAHjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
@@ -1176,11 +1176,11 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1176
1176
|
] })
|
|
1177
1177
|
] })
|
|
1178
1178
|
] }) }),
|
|
1179
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1179
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "grid gap-1", children: [
|
|
1180
1180
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1181
1181
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1182
1182
|
] }) }),
|
|
1183
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1183
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "grid gap-1", children: [
|
|
1184
1184
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1185
1185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1186
1186
|
] }) })
|
|
@@ -1222,21 +1222,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1222
1222
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1223
1223
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1224
1224
|
if (error) {
|
|
1225
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1225
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1226
1226
|
}
|
|
1227
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1227
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1228
1228
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1229
1229
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1230
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1230
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1231
1231
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1232
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1232
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1235
1235
|
] }),
|
|
1236
1236
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk5TH2DSAHjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1237
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1239
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1237
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
1238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1240
1240
|
TokenUsageRankedBar,
|
|
1241
1241
|
{
|
|
1242
1242
|
rows: byOperation,
|
|
@@ -1246,9 +1246,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
) })
|
|
1248
1248
|
] }),
|
|
1249
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1250
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1251
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1249
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
1250
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: targetTitle }) }),
|
|
1251
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1252
1252
|
] })
|
|
1253
1253
|
] })
|
|
1254
1254
|
] }) });
|