@carlonicora/nextjs-jsonapi 6.11.0 → 6.12.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-GY5R25YI.js → BlockNoteEditor-R2SLOYS6.js} +74 -33
- package/dist/BlockNoteEditor-R2SLOYS6.js.map +1 -0
- package/dist/{BlockNoteEditor-5WM5DX3J.mjs → BlockNoteEditor-ZJPGGUQQ.mjs} +59 -18
- package/dist/BlockNoteEditor-ZJPGGUQQ.mjs.map +1 -0
- package/dist/billing/index.js +378 -378
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-MP3DV2I5.js → chunk-BXR36J25.js} +2 -2
- package/dist/{chunk-MP3DV2I5.js.map → chunk-BXR36J25.js.map} +1 -1
- package/dist/{chunk-3PRLRCMF.mjs → chunk-SQUMPLNN.mjs} +2 -2
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.d.mts +21 -0
- package/dist/components/index.d.ts +21 -0
- 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 +96 -96
- 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/package.json +8 -3
- package/src/components/editors/BlockNoteEditor.tsx +52 -20
- package/src/components/editors/__tests__/blocknote-editor-options.spec.ts +81 -0
- package/src/components/editors/blockNoteEditorOptions.ts +58 -0
- package/dist/BlockNoteEditor-5WM5DX3J.mjs.map +0 -1
- package/dist/BlockNoteEditor-GY5R25YI.js.map +0 -1
- /package/dist/{chunk-3PRLRCMF.mjs.map → chunk-SQUMPLNN.mjs.map} +0 -0
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _chunkBXR36J25js = require('../../chunk-BXR36J25.js');
|
|
43
43
|
require('../../chunk-FNPXCYHO.js');
|
|
44
44
|
require('../../chunk-G4JR3SFV.js');
|
|
45
45
|
|
|
@@ -84,7 +84,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
84
84
|
};
|
|
85
85
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
86
86
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
87
|
-
|
|
87
|
+
_chunkBXR36J25js.DateRangeSelector,
|
|
88
88
|
{
|
|
89
89
|
onDateChange: (range) => {
|
|
90
90
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -119,16 +119,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
119
119
|
}
|
|
120
120
|
),
|
|
121
121
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
122
|
-
|
|
122
|
+
_chunkBXR36J25js.Select,
|
|
123
123
|
{
|
|
124
124
|
items: companyItems,
|
|
125
125
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
126
126
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
127
127
|
children: [
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.SelectContent, { children: [
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
131
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
132
132
|
] })
|
|
133
133
|
]
|
|
134
134
|
}
|
|
@@ -151,7 +151,7 @@ function Segmented({
|
|
|
151
151
|
children: options.map((option) => {
|
|
152
152
|
const selected = option.value === value;
|
|
153
153
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
-
|
|
154
|
+
_chunkBXR36J25js.Button,
|
|
155
155
|
{
|
|
156
156
|
type: "button",
|
|
157
157
|
size: "sm",
|
|
@@ -343,7 +343,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
343
343
|
error
|
|
344
344
|
]
|
|
345
345
|
);
|
|
346
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
346
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
347
347
|
}, "TokenUsageAdminProvider");
|
|
348
348
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
349
349
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -364,7 +364,7 @@ var _lucidereact = require('lucide-react');
|
|
|
364
364
|
var ZERO = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
365
365
|
function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
366
366
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
367
|
-
const { decimal, metricValue: formatValue, currency, percent } =
|
|
367
|
+
const { decimal, metricValue: formatValue, currency, percent } = _chunkBXR36J25js.useUsageFormatters.call(void 0, );
|
|
368
368
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (scope, window) => _nullishCoalesce(summary.find((r) => r.scope === scope && r.window === window), () => ( ZERO)), "rowFor");
|
|
369
369
|
const customerCurrent = rowFor("customer", "current");
|
|
370
370
|
const customerPrevious = rowFor("customer", "previous");
|
|
@@ -373,7 +373,7 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
373
373
|
const totalCurrent = rowFor("total", "current");
|
|
374
374
|
const totalPrevious = rowFor("total", "previous");
|
|
375
375
|
const averagePerCall = totalCurrent.calls ? totalCurrent.cost / totalCurrent.calls : 0;
|
|
376
|
-
const cacheHit =
|
|
376
|
+
const cacheHit = _chunkBXR36J25js.cacheHitPercentage.call(void 0, totalCurrent.cached, totalCurrent.tokensIn);
|
|
377
377
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
378
378
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkYGEOX2XXjs.cn.call(void 0, "grid gap-3", singleCustomerMode ? "sm:grid-cols-1" : "sm:grid-cols-2"), children: [
|
|
379
379
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -381,8 +381,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
381
381
|
{
|
|
382
382
|
testId: "tile-customer",
|
|
383
383
|
label: t("token_usage.admin.customer_spend"),
|
|
384
|
-
value: formatValue(
|
|
385
|
-
delta:
|
|
384
|
+
value: formatValue(_chunkBXR36J25js.metricValue.call(void 0, customerCurrent, metric), metric),
|
|
385
|
+
delta: _chunkBXR36J25js.percentageDelta.call(void 0, _chunkBXR36J25js.metricValue.call(void 0, customerCurrent, metric), _chunkBXR36J25js.metricValue.call(void 0, customerPrevious, metric)),
|
|
386
386
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
387
387
|
decimal
|
|
388
388
|
}
|
|
@@ -392,8 +392,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
392
392
|
{
|
|
393
393
|
testId: "tile-platform",
|
|
394
394
|
label: t("token_usage.admin.platform_spend"),
|
|
395
|
-
value: formatValue(
|
|
396
|
-
delta:
|
|
395
|
+
value: formatValue(_chunkBXR36J25js.metricValue.call(void 0, platformCurrent, metric), metric),
|
|
396
|
+
delta: _chunkBXR36J25js.percentageDelta.call(void 0, _chunkBXR36J25js.metricValue.call(void 0, platformCurrent, metric), _chunkBXR36J25js.metricValue.call(void 0, platformPrevious, metric)),
|
|
397
397
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
398
398
|
decimal
|
|
399
399
|
}
|
|
@@ -405,8 +405,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
405
405
|
{
|
|
406
406
|
testId: "tile-total",
|
|
407
407
|
label: t("token_usage.admin.total_cost"),
|
|
408
|
-
value: formatValue(
|
|
409
|
-
delta:
|
|
408
|
+
value: formatValue(_chunkBXR36J25js.metricValue.call(void 0, totalCurrent, metric), metric),
|
|
409
|
+
delta: _chunkBXR36J25js.percentageDelta.call(void 0, _chunkBXR36J25js.metricValue.call(void 0, totalCurrent, metric), _chunkBXR36J25js.metricValue.call(void 0, totalPrevious, metric)),
|
|
410
410
|
decimal
|
|
411
411
|
}
|
|
412
412
|
),
|
|
@@ -440,7 +440,7 @@ function LeadTile({
|
|
|
440
440
|
previousLabel,
|
|
441
441
|
decimal
|
|
442
442
|
}) {
|
|
443
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
443
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.CardContent, { className: "grid gap-1", children: [
|
|
444
444
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
445
445
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
446
446
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -457,7 +457,7 @@ function SupportingTile({
|
|
|
457
457
|
delta,
|
|
458
458
|
decimal
|
|
459
459
|
}) {
|
|
460
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
460
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.CardContent, { className: "grid gap-1", children: [
|
|
461
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
462
462
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
463
463
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -501,10 +501,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, Delta, "Delta");
|
|
|
501
501
|
|
|
502
502
|
function TokenUsageBreakdownTable({ rows, metric }) {
|
|
503
503
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
504
|
-
const { decimal, metricValue: formatValue, percent, compare } =
|
|
504
|
+
const { decimal, metricValue: formatValue, percent, compare } = _chunkBXR36J25js.useUsageFormatters.call(void 0, );
|
|
505
505
|
const [sort, setSort] = _react.useState.call(void 0, void 0);
|
|
506
506
|
const showActiveUsers = rows.some((row) => row.activeUsers !== void 0);
|
|
507
|
-
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum +
|
|
507
|
+
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum + _chunkBXR36J25js.metricValue.call(void 0, row, metric), 0), [rows, metric]);
|
|
508
508
|
const sortValue = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row, key) => {
|
|
509
509
|
switch (key) {
|
|
510
510
|
case "label":
|
|
@@ -514,9 +514,9 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
514
514
|
case "activeUsers":
|
|
515
515
|
return _nullishCoalesce(row.activeUsers, () => ( 0));
|
|
516
516
|
case "cacheHit":
|
|
517
|
-
return
|
|
517
|
+
return _chunkBXR36J25js.cacheHitPercentage.call(void 0, row.cached, row.tokensIn);
|
|
518
518
|
case "share":
|
|
519
|
-
return
|
|
519
|
+
return _chunkBXR36J25js.metricValue.call(void 0, row, metric);
|
|
520
520
|
default:
|
|
521
521
|
return row[key];
|
|
522
522
|
}
|
|
@@ -554,8 +554,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
554
554
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
555
555
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
556
556
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
557
|
-
/* @__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,
|
|
558
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
557
|
+
/* @__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, _chunkBXR36J25js.Table, { children: [
|
|
558
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableHead, { className: _chunkYGEOX2XXjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
559
559
|
"button",
|
|
560
560
|
{
|
|
561
561
|
type: "button",
|
|
@@ -570,20 +570,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
570
570
|
]
|
|
571
571
|
}
|
|
572
572
|
) }, column.key)) }) }),
|
|
573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
574
|
-
const value =
|
|
573
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableBody, { children: sortedRows.map((row) => {
|
|
574
|
+
const value = _chunkBXR36J25js.metricValue.call(void 0, row, metric);
|
|
575
575
|
const share = total > 0 ? value / total * 100 : 0;
|
|
576
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
577
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
579
|
-
showActiveUsers && /* @__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,
|
|
585
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
586
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
576
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
577
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
579
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunkBXR36J25js.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
587
587
|
] }, row.id);
|
|
588
588
|
}) })
|
|
589
589
|
] }) })
|
|
@@ -617,7 +617,7 @@ var operationDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0,
|
|
|
617
617
|
|
|
618
618
|
function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes = false }) {
|
|
619
619
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
620
|
-
const { metricValue: formatValue, percent } =
|
|
620
|
+
const { metricValue: formatValue, percent } = _chunkBXR36J25js.useUsageFormatters.call(void 0, );
|
|
621
621
|
const renderLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
622
622
|
if (row.id === "other") return t("token_usage.admin.other");
|
|
623
623
|
if (!labelsAreOperationTypes) return row.label;
|
|
@@ -639,9 +639,9 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
639
639
|
const label = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground truncate text-xs", children: renderLabel(row) });
|
|
640
640
|
const description = renderDescription(row);
|
|
641
641
|
if (!description) return label;
|
|
642
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
642
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Tooltip, { children: [
|
|
643
643
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
-
|
|
644
|
+
_chunkBXR36J25js.TooltipTrigger,
|
|
645
645
|
{
|
|
646
646
|
"data-testid": `ranked-description-${row.id}`,
|
|
647
647
|
className: "min-w-0 cursor-help justify-self-start truncate",
|
|
@@ -649,19 +649,19 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
649
649
|
children: label
|
|
650
650
|
}
|
|
651
651
|
),
|
|
652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs", children: description }) })
|
|
653
653
|
] });
|
|
654
654
|
}, "renderLabelCell");
|
|
655
655
|
if (rows.length === 0) {
|
|
656
656
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground py-6 text-center text-sm", children: emptyLabel });
|
|
657
657
|
}
|
|
658
|
-
const values = rows.map((row) =>
|
|
658
|
+
const values = rows.map((row) => _chunkBXR36J25js.metricValue.call(void 0, row, metric));
|
|
659
659
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
660
660
|
const max = Math.max(...values, 0);
|
|
661
661
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid gap-0.5", children: rows.map((row, index) => {
|
|
662
662
|
const value = values[index];
|
|
663
663
|
const isOther = row.id === "other";
|
|
664
|
-
const step = isOther ?
|
|
664
|
+
const step = isOther ? _chunkBXR36J25js.SEQUENTIAL_RAMP.length - 1 : Math.min(index, _chunkBXR36J25js.SEQUENTIAL_RAMP.length - 1);
|
|
665
665
|
const width = max > 0 ? value / max * 100 : 0;
|
|
666
666
|
const share = total > 0 ? value / total * 100 : 0;
|
|
667
667
|
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: [
|
|
@@ -673,7 +673,7 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
673
673
|
"data-testid": `ranked-fill-${row.id}`,
|
|
674
674
|
"data-ramp-step": String(step),
|
|
675
675
|
className: "h-full rounded-r-[4px]",
|
|
676
|
-
style: { width: `${width}%`, backgroundColor:
|
|
676
|
+
style: { width: `${width}%`, backgroundColor: _chunkBXR36J25js.SEQUENTIAL_RAMP[step] }
|
|
677
677
|
}
|
|
678
678
|
) })
|
|
679
679
|
] }),
|
|
@@ -723,7 +723,7 @@ var inferGranularity = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (buc
|
|
|
723
723
|
}, "inferGranularity");
|
|
724
724
|
function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
725
725
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
726
|
-
const { compact, bucketDate, metricValue: formatValue } =
|
|
726
|
+
const { compact, bucketDate, metricValue: formatValue } = _chunkBXR36J25js.useUsageFormatters.call(void 0, );
|
|
727
727
|
const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
|
|
728
728
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
729
729
|
const { chartData, seriesKeys } = _react.useMemo.call(void 0, () => {
|
|
@@ -731,8 +731,8 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
731
731
|
const totals = /* @__PURE__ */ new Map();
|
|
732
732
|
for (const row of rows) totals.set(row.series, (_nullishCoalesce(totals.get(row.series), () => ( 0))) + metricValue2(row, metric));
|
|
733
733
|
const ranked = [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([series]) => series);
|
|
734
|
-
const named = ranked.slice(0,
|
|
735
|
-
const folded = new Set(ranked.slice(
|
|
734
|
+
const named = ranked.slice(0, _chunkBXR36J25js.CATEGORICAL_CEILING);
|
|
735
|
+
const folded = new Set(ranked.slice(_chunkBXR36J25js.CATEGORICAL_CEILING));
|
|
736
736
|
const keys = folded.size > 0 ? [...named, OTHER_SERIES] : named;
|
|
737
737
|
const byBucket = /* @__PURE__ */ new Map();
|
|
738
738
|
for (const row of rows) {
|
|
@@ -772,7 +772,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
772
772
|
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" });
|
|
773
773
|
}
|
|
774
774
|
const granularity = inferGranularity(chartData.map((entry) => entry.bucket));
|
|
775
|
-
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ?
|
|
775
|
+
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ? _chunkBXR36J25js.OTHER_COLOR : _chunkBXR36J25js.seriesColor.call(void 0, index, mode), "seriesColorFor");
|
|
776
776
|
return (
|
|
777
777
|
// The chart is a coordinate system, not prose: recharts lays the axes and the
|
|
778
778
|
// stacked bars out left-to-right, so the whole chart stays an LTR island even
|
|
@@ -781,7 +781,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
781
781
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
782
782
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
783
783
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.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: [
|
|
785
785
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
786
786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
787
787
|
_recharts.XAxis,
|
|
@@ -805,10 +805,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
805
805
|
}
|
|
806
806
|
),
|
|
807
807
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
808
|
-
|
|
808
|
+
_chunkBXR36J25js.ChartTooltip,
|
|
809
809
|
{
|
|
810
810
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
811
|
-
|
|
811
|
+
_chunkBXR36J25js.ChartTooltipContent,
|
|
812
812
|
{
|
|
813
813
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
814
814
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -817,7 +817,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
817
817
|
)
|
|
818
818
|
}
|
|
819
819
|
),
|
|
820
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
820
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.ChartLegendContent, {}) }) : null,
|
|
821
821
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
822
822
|
_recharts.Bar,
|
|
823
823
|
{
|
|
@@ -869,19 +869,19 @@ function TokenUsageAdminContainer() {
|
|
|
869
869
|
[t]
|
|
870
870
|
);
|
|
871
871
|
if (error) {
|
|
872
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
872
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.RoundPageContainer, { module: _chunkYGEOX2XXjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
873
873
|
}
|
|
874
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
874
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.RoundPageContainer, { module: _chunkYGEOX2XXjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
875
875
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
876
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
876
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.RoundPageContainer, { module: _chunkYGEOX2XXjs.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: [
|
|
877
877
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
878
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
879
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
881
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
879
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.CardHeader, { children: [
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
882
882
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
883
883
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
884
|
-
|
|
884
|
+
_chunkBXR36J25js.Select,
|
|
885
885
|
{
|
|
886
886
|
items: stackByItems,
|
|
887
887
|
value: filters.stackBy,
|
|
@@ -889,29 +889,29 @@ function TokenUsageAdminContainer() {
|
|
|
889
889
|
if (value) setFilters({ stackBy: value });
|
|
890
890
|
},
|
|
891
891
|
children: [
|
|
892
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
893
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
892
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectValue, {}) }),
|
|
893
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
894
894
|
]
|
|
895
895
|
}
|
|
896
896
|
)
|
|
897
897
|
] }) })
|
|
898
898
|
] }),
|
|
899
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
899
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
900
900
|
] }),
|
|
901
901
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
902
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
903
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
904
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
902
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
903
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
904
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
905
905
|
] }),
|
|
906
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
908
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
906
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
909
909
|
] })
|
|
910
910
|
] }),
|
|
911
911
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkYGEOX2XXjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
912
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
913
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
914
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
912
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
913
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
914
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
915
915
|
TokenUsageRankedBar,
|
|
916
916
|
{
|
|
917
917
|
rows: byCustomerOperation,
|
|
@@ -921,9 +921,9 @@ function TokenUsageAdminContainer() {
|
|
|
921
921
|
}
|
|
922
922
|
) })
|
|
923
923
|
] }),
|
|
924
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
925
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
926
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
924
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
925
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
927
927
|
TokenUsageRankedBar,
|
|
928
928
|
{
|
|
929
929
|
rows: byOperation,
|
|
@@ -934,9 +934,9 @@ function TokenUsageAdminContainer() {
|
|
|
934
934
|
) })
|
|
935
935
|
] })
|
|
936
936
|
] }),
|
|
937
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
938
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
939
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
937
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
938
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
940
940
|
] })
|
|
941
941
|
] }) });
|
|
942
942
|
}
|
|
@@ -1057,7 +1057,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1057
1057
|
|
|
1058
1058
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1059
1059
|
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,
|
|
1060
|
-
|
|
1060
|
+
_chunkBXR36J25js.DateRangeSelector,
|
|
1061
1061
|
{
|
|
1062
1062
|
onDateChange: (range) => {
|
|
1063
1063
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1090,7 +1090,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1090
1090
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1091
1091
|
}) => {
|
|
1092
1092
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1093
|
-
const generateUrl =
|
|
1093
|
+
const generateUrl = _chunkBXR36J25js.usePageUrlGenerator.call(void 0, );
|
|
1094
1094
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1095
1095
|
const range = defaultRange2();
|
|
1096
1096
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1154,7 +1154,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1154
1154
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1155
1155
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1156
1156
|
);
|
|
1157
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1157
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1158
1158
|
}, "TokenUsageReportProvider");
|
|
1159
1159
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1160
1160
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1174,7 +1174,7 @@ var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (
|
|
|
1174
1174
|
var ZERO2 = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
1175
1175
|
function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
1176
1176
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1177
|
-
const { decimal, metricValue: formatValue } =
|
|
1177
|
+
const { decimal, metricValue: formatValue } = _chunkBXR36J25js.useUsageFormatters.call(void 0, );
|
|
1178
1178
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (window) => _nullishCoalesce(summary.find((row) => row.window === window), () => ( ZERO2)), "rowFor");
|
|
1179
1179
|
const current = rowFor("current");
|
|
1180
1180
|
const previous = rowFor("previous");
|
|
@@ -1182,15 +1182,15 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1182
1182
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1183
1183
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1184
1184
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1185
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1185
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.CardContent, { className: "grid gap-1", children: [
|
|
1186
1186
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1187
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(
|
|
1187
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunkBXR36J25js.metricValue.call(void 0, current, metric), metric) }),
|
|
1188
1188
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
1189
1189
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1190
1190
|
Delta2,
|
|
1191
1191
|
{
|
|
1192
1192
|
testId: "tile-used-delta",
|
|
1193
|
-
delta:
|
|
1193
|
+
delta: _chunkBXR36J25js.percentageDelta.call(void 0, _chunkBXR36J25js.metricValue.call(void 0, current, metric), _chunkBXR36J25js.metricValue.call(void 0, previous, metric)),
|
|
1194
1194
|
decimal
|
|
1195
1195
|
}
|
|
1196
1196
|
),
|
|
@@ -1198,7 +1198,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1198
1198
|
] })
|
|
1199
1199
|
] }) }),
|
|
1200
1200
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1201
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1201
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.CardContent, { className: "grid gap-1", children: [
|
|
1202
1202
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1203
1203
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1204
1204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunkYGEOX2XXjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
@@ -1208,11 +1208,11 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1208
1208
|
] })
|
|
1209
1209
|
] })
|
|
1210
1210
|
] }) }),
|
|
1211
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1211
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.CardContent, { className: "grid gap-1", children: [
|
|
1212
1212
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1213
1213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1214
1214
|
] }) }),
|
|
1215
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.CardContent, { className: "grid gap-1", children: [
|
|
1216
1216
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1217
1217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1218
1218
|
] }) })
|
|
@@ -1254,21 +1254,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1254
1254
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1255
1255
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1256
1256
|
if (error) {
|
|
1257
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1257
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1258
1258
|
}
|
|
1259
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1259
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1260
1260
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1261
1261
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1262
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1262
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1263
1263
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1264
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1264
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
1265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1267
1267
|
] }),
|
|
1268
1268
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkYGEOX2XXjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
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, _chunkBXR36J25js.Card, { children: [
|
|
1270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1271
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1272
1272
|
TokenUsageRankedBar,
|
|
1273
1273
|
{
|
|
1274
1274
|
rows: byOperation,
|
|
@@ -1278,9 +1278,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
) })
|
|
1280
1280
|
] }),
|
|
1281
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1282
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1283
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1281
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBXR36J25js.Card, { children: [
|
|
1282
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardTitle, { children: targetTitle }) }),
|
|
1283
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBXR36J25js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1284
1284
|
] })
|
|
1285
1285
|
] })
|
|
1286
1286
|
] }) });
|
|
@@ -1320,5 +1320,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, TokenUsageReportContainer, "TokenUsageRepor
|
|
|
1320
1320
|
|
|
1321
1321
|
|
|
1322
1322
|
|
|
1323
|
-
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown = _chunkYGEOX2XXjs.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkYGEOX2XXjs.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkYGEOX2XXjs.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkYGEOX2XXjs.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkYGEOX2XXjs.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkYGEOX2XXjs.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkYGEOX2XXjs.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkYGEOX2XXjs.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkYGEOX2XXjs.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkYGEOX2XXjs.configureTokenUsage; exports.createUsageFormatters =
|
|
1323
|
+
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown = _chunkYGEOX2XXjs.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkYGEOX2XXjs.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkYGEOX2XXjs.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkYGEOX2XXjs.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkYGEOX2XXjs.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkYGEOX2XXjs.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkYGEOX2XXjs.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkYGEOX2XXjs.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkYGEOX2XXjs.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkYGEOX2XXjs.configureTokenUsage; exports.createUsageFormatters = _chunkBXR36J25js.createUsageFormatters; exports.getTokenUsageCurrency = _chunkYGEOX2XXjs.getTokenUsageCurrency; exports.seriesColor = _chunkBXR36J25js.seriesColor; exports.seriesTheme = _chunkBXR36J25js.seriesTheme; exports.tokenUsageModules = _chunkYGEOX2XXjs.tokenUsageModules; exports.useTokenUsageAdmin = useTokenUsageAdmin; exports.useTokenUsageReport = useTokenUsageReport; exports.useUsageFormatters = _chunkBXR36J25js.useUsageFormatters;
|
|
1324
1324
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carlonicora/nextjs-jsonapi",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.0",
|
|
4
4
|
"description": "Next.js JSON:API client with server/client support and caching",
|
|
5
5
|
"author": "Carlo Nicora",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -143,7 +143,8 @@
|
|
|
143
143
|
"next-intl": ">=4.0.0",
|
|
144
144
|
"react": ">=19.3.0",
|
|
145
145
|
"react-dom": ">=19.3.0",
|
|
146
|
-
"react-hook-form": ">=7.0.0"
|
|
146
|
+
"react-hook-form": ">=7.0.0",
|
|
147
|
+
"yjs": "^13.6.33"
|
|
147
148
|
},
|
|
148
149
|
"peerDependenciesMeta": {
|
|
149
150
|
"@stripe/react-stripe-js": {
|
|
@@ -163,6 +164,9 @@
|
|
|
163
164
|
},
|
|
164
165
|
"react-hook-form": {
|
|
165
166
|
"optional": true
|
|
167
|
+
},
|
|
168
|
+
"yjs": {
|
|
169
|
+
"optional": true
|
|
166
170
|
}
|
|
167
171
|
},
|
|
168
172
|
"dependencies": {
|
|
@@ -264,7 +268,8 @@
|
|
|
264
268
|
"tsup": "^8.5.1",
|
|
265
269
|
"typescript": "^6.0.3",
|
|
266
270
|
"vite": "^8.3.4",
|
|
267
|
-
"vitest": "^5.0.3"
|
|
271
|
+
"vitest": "^5.0.3",
|
|
272
|
+
"yjs": "^13.6.33"
|
|
268
273
|
},
|
|
269
274
|
"keywords": [
|
|
270
275
|
"nextjs",
|