@carlonicora/nextjs-jsonapi 6.21.0 → 6.22.0
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-66ZACETR.mjs → BlockNoteEditor-2XSIQCEB.mjs} +2 -2
- package/dist/{BlockNoteEditor-NXCRWS2O.js → BlockNoteEditor-HW3TK7SM.js} +9 -9
- package/dist/{BlockNoteEditor-NXCRWS2O.js.map → BlockNoteEditor-HW3TK7SM.js.map} +1 -1
- package/dist/billing/index.js +378 -378
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-OHHA5BBX.mjs → chunk-EFQIMPCJ.mjs} +9 -7
- package/dist/chunk-EFQIMPCJ.mjs.map +1 -0
- package/dist/{chunk-3CGU6WXY.js → chunk-FXRRQ7Q6.js} +9 -7
- package/dist/chunk-FXRRQ7Q6.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 +78 -78
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +107 -107
- 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 +102 -102
- package/dist/features/tokenusage/index.mjs +1 -1
- package/dist/features/user/contexts/UserContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/forms/EditorSheet.tsx +2 -2
- package/src/components/forms/__tests__/EditorSheet.spec.tsx +16 -0
- package/src/features/oauth/components/OAuthClientDetail.tsx +1 -1
- package/src/features/user/contexts/UserContext.tsx +6 -2
- package/dist/chunk-3CGU6WXY.js.map +0 -1
- package/dist/chunk-OHHA5BBX.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-66ZACETR.mjs.map → BlockNoteEditor-2XSIQCEB.mjs.map} +0 -0
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _chunkFXRRQ7Q6js = require('../../chunk-FXRRQ7Q6.js');
|
|
43
43
|
require('../../chunk-3EPNHTMH.js');
|
|
44
44
|
require('../../chunk-BD6ARGGI.js');
|
|
45
45
|
require('../../chunk-G4JR3SFV.js');
|
|
@@ -89,7 +89,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
89
89
|
};
|
|
90
90
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
91
91
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
92
|
-
|
|
92
|
+
_chunkFXRRQ7Q6js.DateRangeSelector,
|
|
93
93
|
{
|
|
94
94
|
onDateChange: (range) => {
|
|
95
95
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -124,16 +124,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
124
124
|
}
|
|
125
125
|
),
|
|
126
126
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
127
|
-
|
|
127
|
+
_chunkFXRRQ7Q6js.Select,
|
|
128
128
|
{
|
|
129
129
|
items: companyItems,
|
|
130
130
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
131
131
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
132
132
|
children: [
|
|
133
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
134
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
136
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
133
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
134
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.SelectContent, { children: [
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
136
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
137
137
|
] })
|
|
138
138
|
]
|
|
139
139
|
}
|
|
@@ -156,7 +156,7 @@ function Segmented({
|
|
|
156
156
|
children: options.map((option) => {
|
|
157
157
|
const selected = option.value === value;
|
|
158
158
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
159
|
-
|
|
159
|
+
_chunkFXRRQ7Q6js.Button,
|
|
160
160
|
{
|
|
161
161
|
type: "button",
|
|
162
162
|
size: "sm",
|
|
@@ -348,7 +348,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
348
348
|
error
|
|
349
349
|
]
|
|
350
350
|
);
|
|
351
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
351
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
352
352
|
}, "TokenUsageAdminProvider");
|
|
353
353
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
354
354
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -369,7 +369,7 @@ var _lucidereact = require('lucide-react');
|
|
|
369
369
|
var ZERO = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
370
370
|
function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
371
371
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
372
|
-
const { decimal, metricValue: formatValue, currency, percent } =
|
|
372
|
+
const { decimal, metricValue: formatValue, currency, percent } = _chunkFXRRQ7Q6js.useUsageFormatters.call(void 0, );
|
|
373
373
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (scope, window) => _nullishCoalesce(summary.find((r) => r.scope === scope && r.window === window), () => ( ZERO)), "rowFor");
|
|
374
374
|
const customerCurrent = rowFor("customer", "current");
|
|
375
375
|
const customerPrevious = rowFor("customer", "previous");
|
|
@@ -378,7 +378,7 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
378
378
|
const totalCurrent = rowFor("total", "current");
|
|
379
379
|
const totalPrevious = rowFor("total", "previous");
|
|
380
380
|
const averagePerCall = totalCurrent.calls ? totalCurrent.cost / totalCurrent.calls : 0;
|
|
381
|
-
const cacheHit =
|
|
381
|
+
const cacheHit = _chunkFXRRQ7Q6js.cacheHitPercentage.call(void 0, totalCurrent.cached, totalCurrent.tokensIn);
|
|
382
382
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
383
383
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkZB6OYIMBjs.cn.call(void 0, "grid gap-3", singleCustomerMode ? "sm:grid-cols-1" : "sm:grid-cols-2"), children: [
|
|
384
384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -386,8 +386,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
386
386
|
{
|
|
387
387
|
testId: "tile-customer",
|
|
388
388
|
label: t("token_usage.admin.customer_spend"),
|
|
389
|
-
value: formatValue(
|
|
390
|
-
delta:
|
|
389
|
+
value: formatValue(_chunkFXRRQ7Q6js.metricValue.call(void 0, customerCurrent, metric), metric),
|
|
390
|
+
delta: _chunkFXRRQ7Q6js.percentageDelta.call(void 0, _chunkFXRRQ7Q6js.metricValue.call(void 0, customerCurrent, metric), _chunkFXRRQ7Q6js.metricValue.call(void 0, customerPrevious, metric)),
|
|
391
391
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
392
392
|
decimal
|
|
393
393
|
}
|
|
@@ -397,8 +397,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
397
397
|
{
|
|
398
398
|
testId: "tile-platform",
|
|
399
399
|
label: t("token_usage.admin.platform_spend"),
|
|
400
|
-
value: formatValue(
|
|
401
|
-
delta:
|
|
400
|
+
value: formatValue(_chunkFXRRQ7Q6js.metricValue.call(void 0, platformCurrent, metric), metric),
|
|
401
|
+
delta: _chunkFXRRQ7Q6js.percentageDelta.call(void 0, _chunkFXRRQ7Q6js.metricValue.call(void 0, platformCurrent, metric), _chunkFXRRQ7Q6js.metricValue.call(void 0, platformPrevious, metric)),
|
|
402
402
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
403
403
|
decimal
|
|
404
404
|
}
|
|
@@ -410,8 +410,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
410
410
|
{
|
|
411
411
|
testId: "tile-total",
|
|
412
412
|
label: t("token_usage.admin.total_cost"),
|
|
413
|
-
value: formatValue(
|
|
414
|
-
delta:
|
|
413
|
+
value: formatValue(_chunkFXRRQ7Q6js.metricValue.call(void 0, totalCurrent, metric), metric),
|
|
414
|
+
delta: _chunkFXRRQ7Q6js.percentageDelta.call(void 0, _chunkFXRRQ7Q6js.metricValue.call(void 0, totalCurrent, metric), _chunkFXRRQ7Q6js.metricValue.call(void 0, totalPrevious, metric)),
|
|
415
415
|
decimal
|
|
416
416
|
}
|
|
417
417
|
),
|
|
@@ -445,7 +445,7 @@ function LeadTile({
|
|
|
445
445
|
previousLabel,
|
|
446
446
|
decimal
|
|
447
447
|
}) {
|
|
448
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
448
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.CardContent, { className: "grid gap-1", children: [
|
|
449
449
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
450
450
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
451
451
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -462,7 +462,7 @@ function SupportingTile({
|
|
|
462
462
|
delta,
|
|
463
463
|
decimal
|
|
464
464
|
}) {
|
|
465
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
465
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.CardContent, { className: "grid gap-1", children: [
|
|
466
466
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
467
467
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
468
468
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -506,10 +506,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, Delta, "Delta");
|
|
|
506
506
|
|
|
507
507
|
function TokenUsageBreakdownTable({ rows, metric }) {
|
|
508
508
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
509
|
-
const { decimal, metricValue: formatValue, percent, compare } =
|
|
509
|
+
const { decimal, metricValue: formatValue, percent, compare } = _chunkFXRRQ7Q6js.useUsageFormatters.call(void 0, );
|
|
510
510
|
const [sort, setSort] = _react.useState.call(void 0, void 0);
|
|
511
511
|
const showActiveUsers = rows.some((row) => row.activeUsers !== void 0);
|
|
512
|
-
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum +
|
|
512
|
+
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum + _chunkFXRRQ7Q6js.metricValue.call(void 0, row, metric), 0), [rows, metric]);
|
|
513
513
|
const sortValue = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row, key) => {
|
|
514
514
|
switch (key) {
|
|
515
515
|
case "label":
|
|
@@ -519,9 +519,9 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
519
519
|
case "activeUsers":
|
|
520
520
|
return _nullishCoalesce(row.activeUsers, () => ( 0));
|
|
521
521
|
case "cacheHit":
|
|
522
|
-
return
|
|
522
|
+
return _chunkFXRRQ7Q6js.cacheHitPercentage.call(void 0, row.cached, row.tokensIn);
|
|
523
523
|
case "share":
|
|
524
|
-
return
|
|
524
|
+
return _chunkFXRRQ7Q6js.metricValue.call(void 0, row, metric);
|
|
525
525
|
default:
|
|
526
526
|
return row[key];
|
|
527
527
|
}
|
|
@@ -559,8 +559,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
559
559
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
560
560
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
561
561
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
562
|
-
/* @__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,
|
|
563
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
562
|
+
/* @__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, _chunkFXRRQ7Q6js.Table, { children: [
|
|
563
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableHead, { className: _chunkZB6OYIMBjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
564
564
|
"button",
|
|
565
565
|
{
|
|
566
566
|
type: "button",
|
|
@@ -575,20 +575,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
575
575
|
]
|
|
576
576
|
}
|
|
577
577
|
) }, column.key)) }) }),
|
|
578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
579
|
-
const value =
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableBody, { children: sortedRows.map((row) => {
|
|
579
|
+
const value = _chunkFXRRQ7Q6js.metricValue.call(void 0, row, metric);
|
|
580
580
|
const share = total > 0 ? value / total * 100 : 0;
|
|
581
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
584
|
-
showActiveUsers && /* @__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,
|
|
589
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
590
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
591
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
581
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
584
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunkFXRRQ7Q6js.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
589
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
590
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
591
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
592
592
|
] }, row.id);
|
|
593
593
|
}) })
|
|
594
594
|
] }) })
|
|
@@ -622,7 +622,7 @@ var operationDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0,
|
|
|
622
622
|
|
|
623
623
|
function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes = false }) {
|
|
624
624
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
625
|
-
const { metricValue: formatValue, percent } =
|
|
625
|
+
const { metricValue: formatValue, percent } = _chunkFXRRQ7Q6js.useUsageFormatters.call(void 0, );
|
|
626
626
|
const renderLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
627
627
|
if (row.id === "other") return t("token_usage.admin.other");
|
|
628
628
|
if (!labelsAreOperationTypes) return row.label;
|
|
@@ -644,9 +644,9 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
644
644
|
const label = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground truncate text-xs", children: renderLabel(row) });
|
|
645
645
|
const description = renderDescription(row);
|
|
646
646
|
if (!description) return label;
|
|
647
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
647
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Tooltip, { children: [
|
|
648
648
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
649
|
-
|
|
649
|
+
_chunkFXRRQ7Q6js.TooltipTrigger,
|
|
650
650
|
{
|
|
651
651
|
"data-testid": `ranked-description-${row.id}`,
|
|
652
652
|
className: "min-w-0 cursor-help justify-self-start truncate",
|
|
@@ -654,19 +654,19 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
654
654
|
children: label
|
|
655
655
|
}
|
|
656
656
|
),
|
|
657
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs", children: description }) })
|
|
658
658
|
] });
|
|
659
659
|
}, "renderLabelCell");
|
|
660
660
|
if (rows.length === 0) {
|
|
661
661
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground py-6 text-center text-sm", children: emptyLabel });
|
|
662
662
|
}
|
|
663
|
-
const values = rows.map((row) =>
|
|
663
|
+
const values = rows.map((row) => _chunkFXRRQ7Q6js.metricValue.call(void 0, row, metric));
|
|
664
664
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
665
665
|
const max = Math.max(...values, 0);
|
|
666
666
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid gap-0.5", children: rows.map((row, index) => {
|
|
667
667
|
const value = values[index];
|
|
668
668
|
const isOther = row.id === "other";
|
|
669
|
-
const step = isOther ?
|
|
669
|
+
const step = isOther ? _chunkFXRRQ7Q6js.SEQUENTIAL_RAMP.length - 1 : Math.min(index, _chunkFXRRQ7Q6js.SEQUENTIAL_RAMP.length - 1);
|
|
670
670
|
const width = max > 0 ? value / max * 100 : 0;
|
|
671
671
|
const share = total > 0 ? value / total * 100 : 0;
|
|
672
672
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-3 gap-y-0.5 py-0.5", children: [
|
|
@@ -678,7 +678,7 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
678
678
|
"data-testid": `ranked-fill-${row.id}`,
|
|
679
679
|
"data-ramp-step": String(step),
|
|
680
680
|
className: "h-full rounded-r-[4px]",
|
|
681
|
-
style: { width: `${width}%`, backgroundColor:
|
|
681
|
+
style: { width: `${width}%`, backgroundColor: _chunkFXRRQ7Q6js.SEQUENTIAL_RAMP[step] }
|
|
682
682
|
}
|
|
683
683
|
) })
|
|
684
684
|
] }),
|
|
@@ -728,7 +728,7 @@ var inferGranularity = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (buc
|
|
|
728
728
|
}, "inferGranularity");
|
|
729
729
|
function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
730
730
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
731
|
-
const { compact, bucketDate, metricValue: formatValue } =
|
|
731
|
+
const { compact, bucketDate, metricValue: formatValue } = _chunkFXRRQ7Q6js.useUsageFormatters.call(void 0, );
|
|
732
732
|
const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
|
|
733
733
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
734
734
|
const { chartData, seriesKeys } = _react.useMemo.call(void 0, () => {
|
|
@@ -736,8 +736,8 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
736
736
|
const totals = /* @__PURE__ */ new Map();
|
|
737
737
|
for (const row of rows) totals.set(row.series, (_nullishCoalesce(totals.get(row.series), () => ( 0))) + metricValue2(row, metric));
|
|
738
738
|
const ranked = [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([series]) => series);
|
|
739
|
-
const named = ranked.slice(0,
|
|
740
|
-
const folded = new Set(ranked.slice(
|
|
739
|
+
const named = ranked.slice(0, _chunkFXRRQ7Q6js.CATEGORICAL_CEILING);
|
|
740
|
+
const folded = new Set(ranked.slice(_chunkFXRRQ7Q6js.CATEGORICAL_CEILING));
|
|
741
741
|
const keys = folded.size > 0 ? [...named, OTHER_SERIES] : named;
|
|
742
742
|
const byBucket = /* @__PURE__ */ new Map();
|
|
743
743
|
for (const row of rows) {
|
|
@@ -777,7 +777,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
777
777
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: className ? `text-muted-foreground text-sm ${className}` : "text-muted-foreground text-sm", children: t.has(key) ? t(key) : "No data in the selected period" });
|
|
778
778
|
}
|
|
779
779
|
const granularity = inferGranularity(chartData.map((entry) => entry.bucket));
|
|
780
|
-
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ?
|
|
780
|
+
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ? _chunkFXRRQ7Q6js.OTHER_COLOR : _chunkFXRRQ7Q6js.seriesColor.call(void 0, index, mode), "seriesColorFor");
|
|
781
781
|
return (
|
|
782
782
|
// The chart is a coordinate system, not prose: recharts lays the axes and the
|
|
783
783
|
// stacked bars out left-to-right, so the whole chart stays an LTR island even
|
|
@@ -786,7 +786,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
786
786
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
787
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
788
788
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
789
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.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: [
|
|
790
790
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
791
791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
792
792
|
_recharts.XAxis,
|
|
@@ -810,10 +810,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
810
810
|
}
|
|
811
811
|
),
|
|
812
812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
813
|
-
|
|
813
|
+
_chunkFXRRQ7Q6js.ChartTooltip,
|
|
814
814
|
{
|
|
815
815
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
816
|
-
|
|
816
|
+
_chunkFXRRQ7Q6js.ChartTooltipContent,
|
|
817
817
|
{
|
|
818
818
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
819
819
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -822,7 +822,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
822
822
|
)
|
|
823
823
|
}
|
|
824
824
|
),
|
|
825
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
825
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.ChartLegendContent, {}) }) : null,
|
|
826
826
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
827
|
_recharts.Bar,
|
|
828
828
|
{
|
|
@@ -874,19 +874,19 @@ function TokenUsageAdminContainer() {
|
|
|
874
874
|
[t]
|
|
875
875
|
);
|
|
876
876
|
if (error) {
|
|
877
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
877
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.RoundPageContainer, { module: _chunkYWLSIIE6js.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
878
878
|
}
|
|
879
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
879
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.RoundPageContainer, { module: _chunkYWLSIIE6js.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
880
880
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
881
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
881
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.RoundPageContainer, { module: _chunkYWLSIIE6js.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: [
|
|
882
882
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
883
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
884
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
885
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
886
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
884
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: [
|
|
885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
886
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
887
887
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
888
888
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
889
|
-
|
|
889
|
+
_chunkFXRRQ7Q6js.Select,
|
|
890
890
|
{
|
|
891
891
|
items: stackByItems,
|
|
892
892
|
value: filters.stackBy,
|
|
@@ -894,29 +894,29 @@ function TokenUsageAdminContainer() {
|
|
|
894
894
|
if (value) setFilters({ stackBy: value });
|
|
895
895
|
},
|
|
896
896
|
children: [
|
|
897
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
898
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
897
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectValue, {}) }),
|
|
898
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
899
899
|
]
|
|
900
900
|
}
|
|
901
901
|
)
|
|
902
902
|
] }) })
|
|
903
903
|
] }),
|
|
904
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
904
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
905
905
|
] }),
|
|
906
906
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
908
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
909
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
909
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
910
910
|
] }),
|
|
911
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
912
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
913
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
911
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
912
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
913
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
914
914
|
] })
|
|
915
915
|
] }),
|
|
916
916
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkZB6OYIMBjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
917
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
918
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
919
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
917
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
918
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
920
920
|
TokenUsageRankedBar,
|
|
921
921
|
{
|
|
922
922
|
rows: byCustomerOperation,
|
|
@@ -926,9 +926,9 @@ function TokenUsageAdminContainer() {
|
|
|
926
926
|
}
|
|
927
927
|
) })
|
|
928
928
|
] }),
|
|
929
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
930
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
929
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
931
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
932
932
|
TokenUsageRankedBar,
|
|
933
933
|
{
|
|
934
934
|
rows: byOperation,
|
|
@@ -939,9 +939,9 @@ function TokenUsageAdminContainer() {
|
|
|
939
939
|
) })
|
|
940
940
|
] })
|
|
941
941
|
] }),
|
|
942
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
942
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
945
945
|
] })
|
|
946
946
|
] }) });
|
|
947
947
|
}
|
|
@@ -1062,7 +1062,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1062
1062
|
|
|
1063
1063
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1064
1064
|
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,
|
|
1065
|
-
|
|
1065
|
+
_chunkFXRRQ7Q6js.DateRangeSelector,
|
|
1066
1066
|
{
|
|
1067
1067
|
onDateChange: (range) => {
|
|
1068
1068
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1095,7 +1095,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1095
1095
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1096
1096
|
}) => {
|
|
1097
1097
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1098
|
-
const generateUrl =
|
|
1098
|
+
const generateUrl = _chunkFXRRQ7Q6js.usePageUrlGenerator.call(void 0, );
|
|
1099
1099
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1100
1100
|
const range = defaultRange2();
|
|
1101
1101
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1159,7 +1159,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1159
1159
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1160
1160
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1161
1161
|
);
|
|
1162
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1162
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1163
1163
|
}, "TokenUsageReportProvider");
|
|
1164
1164
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1165
1165
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1179,7 +1179,7 @@ var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (
|
|
|
1179
1179
|
var ZERO2 = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
1180
1180
|
function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
1181
1181
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1182
|
-
const { decimal, metricValue: formatValue } =
|
|
1182
|
+
const { decimal, metricValue: formatValue } = _chunkFXRRQ7Q6js.useUsageFormatters.call(void 0, );
|
|
1183
1183
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (window) => _nullishCoalesce(summary.find((row) => row.window === window), () => ( ZERO2)), "rowFor");
|
|
1184
1184
|
const current = rowFor("current");
|
|
1185
1185
|
const previous = rowFor("previous");
|
|
@@ -1187,15 +1187,15 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1187
1187
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1188
1188
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1189
1189
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1190
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.CardContent, { className: "grid gap-1", children: [
|
|
1191
1191
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunkFXRRQ7Q6js.metricValue.call(void 0, current, metric), metric) }),
|
|
1193
1193
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
1194
1194
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1195
1195
|
Delta2,
|
|
1196
1196
|
{
|
|
1197
1197
|
testId: "tile-used-delta",
|
|
1198
|
-
delta:
|
|
1198
|
+
delta: _chunkFXRRQ7Q6js.percentageDelta.call(void 0, _chunkFXRRQ7Q6js.metricValue.call(void 0, current, metric), _chunkFXRRQ7Q6js.metricValue.call(void 0, previous, metric)),
|
|
1199
1199
|
decimal
|
|
1200
1200
|
}
|
|
1201
1201
|
),
|
|
@@ -1203,7 +1203,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1203
1203
|
] })
|
|
1204
1204
|
] }) }),
|
|
1205
1205
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1206
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1206
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.CardContent, { className: "grid gap-1", children: [
|
|
1207
1207
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1208
1208
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1209
1209
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunkZB6OYIMBjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
@@ -1213,11 +1213,11 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1213
1213
|
] })
|
|
1214
1214
|
] })
|
|
1215
1215
|
] }) }),
|
|
1216
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1216
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.CardContent, { className: "grid gap-1", children: [
|
|
1217
1217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1218
1218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1219
1219
|
] }) }),
|
|
1220
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1220
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.CardContent, { className: "grid gap-1", children: [
|
|
1221
1221
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1222
1222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1223
1223
|
] }) })
|
|
@@ -1259,21 +1259,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1259
1259
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1260
1260
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1261
1261
|
if (error) {
|
|
1262
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1262
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1263
1263
|
}
|
|
1264
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1264
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1265
1265
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1266
1266
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1267
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1267
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1268
1268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1269
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1270
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1271
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
1270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1271
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1272
1272
|
] }),
|
|
1273
1273
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkZB6OYIMBjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1274
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1276
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1274
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
1275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1277
1277
|
TokenUsageRankedBar,
|
|
1278
1278
|
{
|
|
1279
1279
|
rows: byOperation,
|
|
@@ -1283,9 +1283,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
) })
|
|
1285
1285
|
] }),
|
|
1286
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1287
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1288
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1286
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFXRRQ7Q6js.Card, { children: [
|
|
1287
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardTitle, { children: targetTitle }) }),
|
|
1288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFXRRQ7Q6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1289
1289
|
] })
|
|
1290
1290
|
] })
|
|
1291
1291
|
] }) });
|
|
@@ -1325,5 +1325,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, TokenUsageReportContainer, "TokenUsageRepor
|
|
|
1325
1325
|
|
|
1326
1326
|
|
|
1327
1327
|
|
|
1328
|
-
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown = _chunkZB6OYIMBjs.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkZB6OYIMBjs.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkZB6OYIMBjs.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkZB6OYIMBjs.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkZB6OYIMBjs.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkZB6OYIMBjs.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkZB6OYIMBjs.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkZB6OYIMBjs.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkZB6OYIMBjs.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkZB6OYIMBjs.configureTokenUsage; exports.createUsageFormatters =
|
|
1328
|
+
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown = _chunkZB6OYIMBjs.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkZB6OYIMBjs.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkZB6OYIMBjs.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkZB6OYIMBjs.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkZB6OYIMBjs.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkZB6OYIMBjs.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkZB6OYIMBjs.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkZB6OYIMBjs.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkZB6OYIMBjs.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkZB6OYIMBjs.configureTokenUsage; exports.createUsageFormatters = _chunkFXRRQ7Q6js.createUsageFormatters; exports.getTokenUsageCurrency = _chunkZB6OYIMBjs.getTokenUsageCurrency; exports.seriesColor = _chunkFXRRQ7Q6js.seriesColor; exports.seriesTheme = _chunkFXRRQ7Q6js.seriesTheme; exports.tokenUsageModules = _chunkZB6OYIMBjs.tokenUsageModules; exports.useTokenUsageAdmin = useTokenUsageAdmin; exports.useTokenUsageReport = useTokenUsageReport; exports.useUsageFormatters = _chunkFXRRQ7Q6js.useUsageFormatters;
|
|
1329
1329
|
//# sourceMappingURL=index.js.map
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
seriesTheme,
|
|
40
40
|
usePageUrlGenerator,
|
|
41
41
|
useUsageFormatters
|
|
42
|
-
} from "../../chunk-
|
|
42
|
+
} from "../../chunk-EFQIMPCJ.mjs";
|
|
43
43
|
import "../../chunk-VOXD3ZLY.mjs";
|
|
44
44
|
import "../../chunk-G2UIQSNJ.mjs";
|
|
45
45
|
import "../../chunk-PW42LRSL.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserContext.d.ts","sourceRoot":"","sources":["../../../../src/features/user/contexts/UserContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,4BAA4B,EAAsB,MAAM,eAAe,CAAC;AAUjF,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,UAAU,eAAe;IACvB,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,KAAK,IAAI,CAAC;CACrD;AAYD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,4BAA4B,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,8BAA8B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"UserContext.d.ts","sourceRoot":"","sources":["../../../../src/features/user/contexts/UserContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,4BAA4B,EAAsB,MAAM,eAAe,CAAC;AAUjF,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,UAAU,eAAe;IACvB,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,KAAK,IAAI,CAAC;CACrD;AAYD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,4BAA4B,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,8BAA8B,iBAAiB,gCAiF3E,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,eAMjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -320,8 +320,8 @@ export function EditorSheet<T extends FieldValues>({
|
|
|
320
320
|
render={<div />}
|
|
321
321
|
nativeButton={false}
|
|
322
322
|
size="sm"
|
|
323
|
-
variant={isLabelled ? "
|
|
324
|
-
className="text-muted-foreground"
|
|
323
|
+
variant={isLabelled ? "default" : "ghost"}
|
|
324
|
+
className={isLabelled ? undefined : "text-muted-foreground"}
|
|
325
325
|
>
|
|
326
326
|
<PencilIcon />
|
|
327
327
|
{isLabelled && t("ui.buttons.edit")}
|