@carlonicora/nextjs-jsonapi 5.7.3 → 6.1.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-R3745ALQ.mjs → BlockNoteEditor-FZNU4YQT.mjs} +4 -4
- package/dist/{BlockNoteEditor-G45WMJ5V.js → BlockNoteEditor-SAU3G6H7.js} +19 -19
- package/dist/{BlockNoteEditor-G45WMJ5V.js.map → BlockNoteEditor-SAU3G6H7.js.map} +1 -1
- package/dist/{BlockNoteViewer-TNK3OMH5.mjs → BlockNoteViewer-6XDDVTN6.mjs} +2 -2
- package/dist/{BlockNoteViewer-5PGOVURC.js → BlockNoteViewer-7BTV7QQA.js} +3 -3
- package/dist/{BlockNoteViewer-5PGOVURC.js.map → BlockNoteViewer-7BTV7QQA.js.map} +1 -1
- package/dist/billing/index.js +492 -506
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +5 -19
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-CP7BXAFH.js → chunk-F4JB7YAP.js} +8 -8
- package/dist/{chunk-CP7BXAFH.js.map → chunk-F4JB7YAP.js.map} +1 -1
- package/dist/{chunk-KOA5PZZA.mjs → chunk-GFGKMUPZ.mjs} +2 -2
- package/dist/{chunk-EXG4ANC7.js → chunk-IPYXT7MH.js} +868 -868
- package/dist/{chunk-EXG4ANC7.js.map → chunk-IPYXT7MH.js.map} +1 -1
- package/dist/{chunk-RJMLAW5O.mjs → chunk-JVJS5RHB.mjs} +2 -2
- package/dist/{chunk-WU47MIZZ.js → chunk-MTI2UXDA.js} +4 -4
- package/dist/{chunk-WU47MIZZ.js.map → chunk-MTI2UXDA.js.map} +1 -1
- package/dist/{chunk-6KAYEYFU.mjs → chunk-RYZYKG6W.mjs} +2 -2
- package/dist/{chunk-3CSPHMVK.js → chunk-T3YQ47EF.js} +2 -32
- package/dist/chunk-T3YQ47EF.js.map +1 -0
- package/dist/{chunk-YG4YFAYY.js → chunk-TPZS46IM.js} +3 -3
- package/dist/{chunk-YG4YFAYY.js.map → chunk-TPZS46IM.js.map} +1 -1
- package/dist/{chunk-JCNB5KTQ.mjs → chunk-U7DR5VDT.mjs} +5 -5
- package/dist/{chunk-CJS5WA4E.mjs → chunk-USYZNWKS.mjs} +2 -32
- package/dist/chunk-USYZNWKS.mjs.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +0 -12
- package/dist/core/index.d.ts +0 -12
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/email-automations/index.js +92 -92
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.js +121 -121
- package/dist/features/analytics/index.mjs +4 -4
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.js +16 -16
- package/dist/features/blog/server.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +158 -125
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +38 -5
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/messages/en.json +25 -1
- package/messages/it.json +25 -1
- package/package.json +1 -1
- package/scripts/validate-messages.mjs +4 -1
- package/src/features/__tests__/i18n-keys.contract.spec.ts +4 -0
- package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +22 -14
- package/src/features/billing/i18n-keys.ts +1 -0
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +1 -21
- package/src/features/billing/stripe-subscription/data/__tests__/stripe-subscription.spec.ts +59 -0
- package/src/features/billing/stripe-subscription/data/stripe-subscription.service.ts +0 -34
- package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +1 -1
- package/src/features/tokenusage/components/TokenUsageRankedBar.tsx +34 -2
- package/src/features/tokenusage/components/__tests__/TokenUsageRankedBar.spec.tsx +22 -0
- package/src/features/tokenusage/lib/operation-label.ts +20 -0
- package/dist/chunk-3CSPHMVK.js.map +0 -1
- package/dist/chunk-CJS5WA4E.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-R3745ALQ.mjs.map → BlockNoteEditor-FZNU4YQT.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-TNK3OMH5.mjs.map → BlockNoteViewer-6XDDVTN6.mjs.map} +0 -0
- /package/dist/{chunk-KOA5PZZA.mjs.map → chunk-GFGKMUPZ.mjs.map} +0 -0
- /package/dist/{chunk-RJMLAW5O.mjs.map → chunk-JVJS5RHB.mjs.map} +0 -0
- /package/dist/{chunk-6KAYEYFU.mjs.map → chunk-RYZYKG6W.mjs.map} +0 -0
- /package/dist/{chunk-JCNB5KTQ.mjs.map → chunk-U7DR5VDT.mjs.map} +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkTPZS46IMjs = require('../../chunk-TPZS46IM.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -37,8 +37,11 @@ var _chunkYG4YFAYYjs = require('../../chunk-YG4YFAYY.js');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var _chunkIPYXT7MHjs = require('../../chunk-IPYXT7MH.js');
|
|
44
|
+
require('../../chunk-F4JB7YAP.js');
|
|
42
45
|
require('../../chunk-G4JR3SFV.js');
|
|
43
46
|
|
|
44
47
|
|
|
@@ -57,7 +60,7 @@ require('../../chunk-G4JR3SFV.js');
|
|
|
57
60
|
|
|
58
61
|
|
|
59
62
|
|
|
60
|
-
var
|
|
63
|
+
var _chunkT3YQ47EFjs = require('../../chunk-T3YQ47EF.js');
|
|
61
64
|
require('../../chunk-GHE4VT2R.js');
|
|
62
65
|
require('../../chunk-LXKSUWAV.js');
|
|
63
66
|
require('../../chunk-JTPRJNT2.js');
|
|
@@ -82,7 +85,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
82
85
|
};
|
|
83
86
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
84
87
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
85
|
-
|
|
88
|
+
_chunkIPYXT7MHjs.DateRangeSelector,
|
|
86
89
|
{
|
|
87
90
|
onDateChange: (range) => {
|
|
88
91
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -117,16 +120,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
117
120
|
}
|
|
118
121
|
),
|
|
119
122
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
120
|
-
|
|
123
|
+
_chunkIPYXT7MHjs.Select,
|
|
121
124
|
{
|
|
122
125
|
items: companyItems,
|
|
123
126
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
124
127
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
125
128
|
children: [
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
127
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.SelectContent, { children: [
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
132
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
130
133
|
] })
|
|
131
134
|
]
|
|
132
135
|
}
|
|
@@ -149,13 +152,13 @@ function Segmented({
|
|
|
149
152
|
children: options.map((option) => {
|
|
150
153
|
const selected = option.value === value;
|
|
151
154
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
152
|
-
|
|
155
|
+
_chunkIPYXT7MHjs.Button,
|
|
153
156
|
{
|
|
154
157
|
type: "button",
|
|
155
158
|
size: "sm",
|
|
156
159
|
variant: selected ? "default" : "ghost",
|
|
157
160
|
"aria-pressed": selected,
|
|
158
|
-
className:
|
|
161
|
+
className: _chunkT3YQ47EFjs.cn.call(void 0, !selected && "text-muted-foreground"),
|
|
159
162
|
onClick: () => onSelect(option.value),
|
|
160
163
|
children: option.label
|
|
161
164
|
},
|
|
@@ -175,36 +178,36 @@ function withFilters(endpoint, filters) {
|
|
|
175
178
|
return endpoint;
|
|
176
179
|
}
|
|
177
180
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters, "withFilters");
|
|
178
|
-
var TokenUsageAdminService = class extends
|
|
181
|
+
var TokenUsageAdminService = class extends _chunkT3YQ47EFjs.AbstractService {
|
|
179
182
|
static {
|
|
180
183
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageAdminService");
|
|
181
184
|
}
|
|
182
185
|
/** Six rows: {customer, platform, total} × {current, previous}. */
|
|
183
186
|
static async getSummary(filters) {
|
|
184
|
-
const endpoint = withFilters(new (0,
|
|
187
|
+
const endpoint = withFilters(new (0, _chunkT3YQ47EFjs.EndpointCreator)({ endpoint: _chunkT3YQ47EFjs.Modules.TokenUsageAdminSummary }), filters);
|
|
185
188
|
return this.callApi({
|
|
186
|
-
type:
|
|
189
|
+
type: _chunkT3YQ47EFjs.Modules.TokenUsageAdminSummary,
|
|
187
190
|
method: "GET" /* GET */,
|
|
188
191
|
endpoint: endpoint.generate()
|
|
189
192
|
});
|
|
190
193
|
}
|
|
191
194
|
static async getTimeline(params) {
|
|
192
|
-
const endpoint = withFilters(new (0,
|
|
195
|
+
const endpoint = withFilters(new (0, _chunkT3YQ47EFjs.EndpointCreator)({ endpoint: _chunkT3YQ47EFjs.Modules.TokenUsageAdminTimeline }), params);
|
|
193
196
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
194
197
|
endpoint.addAdditionalParam("stackBy", params.stackBy);
|
|
195
198
|
return this.callApi({
|
|
196
|
-
type:
|
|
199
|
+
type: _chunkT3YQ47EFjs.Modules.TokenUsageAdminTimeline,
|
|
197
200
|
method: "GET" /* GET */,
|
|
198
201
|
endpoint: endpoint.generate()
|
|
199
202
|
});
|
|
200
203
|
}
|
|
201
204
|
static async getBreakdown(params) {
|
|
202
|
-
const endpoint = withFilters(new (0,
|
|
205
|
+
const endpoint = withFilters(new (0, _chunkT3YQ47EFjs.EndpointCreator)({ endpoint: _chunkT3YQ47EFjs.Modules.TokenUsageAdminBreakdown }), params);
|
|
203
206
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
204
207
|
endpoint.addAdditionalParam("scope", params.scope);
|
|
205
208
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
206
209
|
return this.callApi({
|
|
207
|
-
type:
|
|
210
|
+
type: _chunkT3YQ47EFjs.Modules.TokenUsageAdminBreakdown,
|
|
208
211
|
method: "GET" /* GET */,
|
|
209
212
|
endpoint: endpoint.generate()
|
|
210
213
|
});
|
|
@@ -341,7 +344,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
341
344
|
error
|
|
342
345
|
]
|
|
343
346
|
);
|
|
344
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
347
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
345
348
|
}, "TokenUsageAdminProvider");
|
|
346
349
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
347
350
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -362,7 +365,7 @@ var _lucidereact = require('lucide-react');
|
|
|
362
365
|
var ZERO = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
363
366
|
function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
364
367
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
365
|
-
const { decimal, metricValue: formatValue, currency, percent } =
|
|
368
|
+
const { decimal, metricValue: formatValue, currency, percent } = _chunkTPZS46IMjs.useUsageFormatters.call(void 0, );
|
|
366
369
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (scope, window) => _nullishCoalesce(summary.find((r) => r.scope === scope && r.window === window), () => ( ZERO)), "rowFor");
|
|
367
370
|
const customerCurrent = rowFor("customer", "current");
|
|
368
371
|
const customerPrevious = rowFor("customer", "previous");
|
|
@@ -371,16 +374,16 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
371
374
|
const totalCurrent = rowFor("total", "current");
|
|
372
375
|
const totalPrevious = rowFor("total", "previous");
|
|
373
376
|
const averagePerCall = totalCurrent.calls ? totalCurrent.cost / totalCurrent.calls : 0;
|
|
374
|
-
const cacheHit =
|
|
377
|
+
const cacheHit = _chunkTPZS46IMjs.cacheHitPercentage.call(void 0, totalCurrent.cached, totalCurrent.tokensIn);
|
|
375
378
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
376
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkT3YQ47EFjs.cn.call(void 0, "grid gap-3", singleCustomerMode ? "sm:grid-cols-1" : "sm:grid-cols-2"), children: [
|
|
377
380
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
378
381
|
LeadTile,
|
|
379
382
|
{
|
|
380
383
|
testId: "tile-customer",
|
|
381
384
|
label: t("token_usage.admin.customer_spend"),
|
|
382
|
-
value: formatValue(
|
|
383
|
-
delta:
|
|
385
|
+
value: formatValue(_chunkTPZS46IMjs.metricValue.call(void 0, customerCurrent, metric), metric),
|
|
386
|
+
delta: _chunkTPZS46IMjs.percentageDelta.call(void 0, _chunkTPZS46IMjs.metricValue.call(void 0, customerCurrent, metric), _chunkTPZS46IMjs.metricValue.call(void 0, customerPrevious, metric)),
|
|
384
387
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
385
388
|
decimal
|
|
386
389
|
}
|
|
@@ -390,8 +393,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
390
393
|
{
|
|
391
394
|
testId: "tile-platform",
|
|
392
395
|
label: t("token_usage.admin.platform_spend"),
|
|
393
|
-
value: formatValue(
|
|
394
|
-
delta:
|
|
396
|
+
value: formatValue(_chunkTPZS46IMjs.metricValue.call(void 0, platformCurrent, metric), metric),
|
|
397
|
+
delta: _chunkTPZS46IMjs.percentageDelta.call(void 0, _chunkTPZS46IMjs.metricValue.call(void 0, platformCurrent, metric), _chunkTPZS46IMjs.metricValue.call(void 0, platformPrevious, metric)),
|
|
395
398
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
396
399
|
decimal
|
|
397
400
|
}
|
|
@@ -403,8 +406,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
403
406
|
{
|
|
404
407
|
testId: "tile-total",
|
|
405
408
|
label: t("token_usage.admin.total_cost"),
|
|
406
|
-
value: formatValue(
|
|
407
|
-
delta:
|
|
409
|
+
value: formatValue(_chunkTPZS46IMjs.metricValue.call(void 0, totalCurrent, metric), metric),
|
|
410
|
+
delta: _chunkTPZS46IMjs.percentageDelta.call(void 0, _chunkTPZS46IMjs.metricValue.call(void 0, totalCurrent, metric), _chunkTPZS46IMjs.metricValue.call(void 0, totalPrevious, metric)),
|
|
408
411
|
decimal
|
|
409
412
|
}
|
|
410
413
|
),
|
|
@@ -438,7 +441,7 @@ function LeadTile({
|
|
|
438
441
|
previousLabel,
|
|
439
442
|
decimal
|
|
440
443
|
}) {
|
|
441
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
444
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "grid gap-1", children: [
|
|
442
445
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
443
446
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
444
447
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -455,7 +458,7 @@ function SupportingTile({
|
|
|
455
458
|
delta,
|
|
456
459
|
decimal
|
|
457
460
|
}) {
|
|
458
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
461
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "grid gap-1", children: [
|
|
459
462
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
460
463
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
461
464
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -478,7 +481,7 @@ function Delta({
|
|
|
478
481
|
"span",
|
|
479
482
|
{
|
|
480
483
|
"data-testid": testId,
|
|
481
|
-
className:
|
|
484
|
+
className: _chunkT3YQ47EFjs.cn.call(void 0,
|
|
482
485
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
483
486
|
increased ? "text-success" : "text-destructive"
|
|
484
487
|
),
|
|
@@ -499,10 +502,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, Delta, "Delta");
|
|
|
499
502
|
|
|
500
503
|
function TokenUsageBreakdownTable({ rows, metric }) {
|
|
501
504
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
502
|
-
const { decimal, metricValue: formatValue, percent, compare } =
|
|
505
|
+
const { decimal, metricValue: formatValue, percent, compare } = _chunkTPZS46IMjs.useUsageFormatters.call(void 0, );
|
|
503
506
|
const [sort, setSort] = _react.useState.call(void 0, void 0);
|
|
504
507
|
const showActiveUsers = rows.some((row) => row.activeUsers !== void 0);
|
|
505
|
-
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum +
|
|
508
|
+
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum + _chunkTPZS46IMjs.metricValue.call(void 0, row, metric), 0), [rows, metric]);
|
|
506
509
|
const sortValue = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row, key) => {
|
|
507
510
|
switch (key) {
|
|
508
511
|
case "label":
|
|
@@ -512,9 +515,9 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
512
515
|
case "activeUsers":
|
|
513
516
|
return _nullishCoalesce(row.activeUsers, () => ( 0));
|
|
514
517
|
case "cacheHit":
|
|
515
|
-
return
|
|
518
|
+
return _chunkTPZS46IMjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn);
|
|
516
519
|
case "share":
|
|
517
|
-
return
|
|
520
|
+
return _chunkTPZS46IMjs.metricValue.call(void 0, row, metric);
|
|
518
521
|
default:
|
|
519
522
|
return row[key];
|
|
520
523
|
}
|
|
@@ -552,13 +555,13 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
552
555
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
553
556
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
554
557
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
555
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
556
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
558
|
+
/* @__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, _chunkIPYXT7MHjs.Table, { children: [
|
|
559
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { className: _chunkT3YQ47EFjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
557
560
|
"button",
|
|
558
561
|
{
|
|
559
562
|
type: "button",
|
|
560
563
|
onClick: () => toggleSort(column.key),
|
|
561
|
-
className:
|
|
564
|
+
className: _chunkT3YQ47EFjs.cn.call(void 0,
|
|
562
565
|
"hover:text-primary inline-flex items-center gap-1 text-xs font-medium",
|
|
563
566
|
column.numeric && "flex-row-reverse"
|
|
564
567
|
),
|
|
@@ -568,20 +571,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
568
571
|
]
|
|
569
572
|
}
|
|
570
573
|
) }, column.key)) }) }),
|
|
571
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
572
|
-
const value =
|
|
574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableBody, { children: sortedRows.map((row) => {
|
|
575
|
+
const value = _chunkTPZS46IMjs.metricValue.call(void 0, row, metric);
|
|
573
576
|
const share = total > 0 ? value / total * 100 : 0;
|
|
574
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
576
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
577
|
-
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
581
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
584
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
577
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
580
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunkTPZS46IMjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
585
588
|
] }, row.id);
|
|
586
589
|
}) })
|
|
587
590
|
] }) })
|
|
@@ -594,6 +597,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, TokenUsageBreakdownTable, "TokenUsageBreakd
|
|
|
594
597
|
|
|
595
598
|
// src/features/tokenusage/lib/operation-label.ts
|
|
596
599
|
var OPERATION_LABEL_NAMESPACE = "token_usage.types";
|
|
600
|
+
var OPERATION_DESCRIPTION_NAMESPACE = "token_usage.type_descriptions";
|
|
597
601
|
var toCamelCase = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => {
|
|
598
602
|
const parts = value.split(/[^a-zA-Z0-9]+/).filter(Boolean);
|
|
599
603
|
if (parts.length === 0) return value;
|
|
@@ -605,12 +609,16 @@ var operationLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (type,
|
|
|
605
609
|
const key = `${OPERATION_LABEL_NAMESPACE}.${toCamelCase(type)}`;
|
|
606
610
|
return has(key) ? translate(key) : type;
|
|
607
611
|
}, "operationLabel");
|
|
612
|
+
var operationDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (type, translate, has) => {
|
|
613
|
+
const key = `${OPERATION_DESCRIPTION_NAMESPACE}.${toCamelCase(type)}`;
|
|
614
|
+
return has(key) ? translate(key) : void 0;
|
|
615
|
+
}, "operationDescription");
|
|
608
616
|
|
|
609
617
|
// src/features/tokenusage/components/TokenUsageRankedBar.tsx
|
|
610
618
|
|
|
611
619
|
function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes = false }) {
|
|
612
620
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
613
|
-
const { metricValue: formatValue, percent } =
|
|
621
|
+
const { metricValue: formatValue, percent } = _chunkTPZS46IMjs.useUsageFormatters.call(void 0, );
|
|
614
622
|
const renderLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
615
623
|
if (row.id === "other") return t("token_usage.admin.other");
|
|
616
624
|
if (!labelsAreOperationTypes) return row.label;
|
|
@@ -620,28 +628,53 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
620
628
|
(key) => t.has(key)
|
|
621
629
|
);
|
|
622
630
|
}, "renderLabel");
|
|
631
|
+
const renderDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
632
|
+
if (row.id === "other" || !labelsAreOperationTypes) return void 0;
|
|
633
|
+
return operationDescription(
|
|
634
|
+
row.label,
|
|
635
|
+
(key) => t(key),
|
|
636
|
+
(key) => t.has(key)
|
|
637
|
+
);
|
|
638
|
+
}, "renderDescription");
|
|
639
|
+
const renderLabelCell = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
640
|
+
const label = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground truncate text-xs", children: renderLabel(row) });
|
|
641
|
+
const description = renderDescription(row);
|
|
642
|
+
if (!description) return label;
|
|
643
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Tooltip, { children: [
|
|
644
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
645
|
+
_chunkIPYXT7MHjs.TooltipTrigger,
|
|
646
|
+
{
|
|
647
|
+
"data-testid": `ranked-description-${row.id}`,
|
|
648
|
+
className: "min-w-0 cursor-help justify-self-start truncate",
|
|
649
|
+
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
650
|
+
children: label
|
|
651
|
+
}
|
|
652
|
+
),
|
|
653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs", children: description }) })
|
|
654
|
+
] });
|
|
655
|
+
}, "renderLabelCell");
|
|
623
656
|
if (rows.length === 0) {
|
|
624
657
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground py-6 text-center text-sm", children: emptyLabel });
|
|
625
658
|
}
|
|
626
|
-
const values = rows.map((row) =>
|
|
659
|
+
const values = rows.map((row) => _chunkTPZS46IMjs.metricValue.call(void 0, row, metric));
|
|
627
660
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
628
661
|
const max = Math.max(...values, 0);
|
|
629
662
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid gap-0.5", children: rows.map((row, index) => {
|
|
630
663
|
const value = values[index];
|
|
631
664
|
const isOther = row.id === "other";
|
|
632
|
-
const step = isOther ?
|
|
665
|
+
const step = isOther ? _chunkTPZS46IMjs.SEQUENTIAL_RAMP.length - 1 : Math.min(index, _chunkTPZS46IMjs.SEQUENTIAL_RAMP.length - 1);
|
|
633
666
|
const width = max > 0 ? value / max * 100 : 0;
|
|
634
667
|
const share = total > 0 ? value / total * 100 : 0;
|
|
635
668
|
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: [
|
|
636
669
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid min-w-0 gap-0.5", children: [
|
|
637
|
-
|
|
670
|
+
renderLabelCell(row),
|
|
638
671
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-muted h-2 w-full overflow-hidden rounded-r-[4px]", dir: "ltr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
639
672
|
"div",
|
|
640
673
|
{
|
|
641
674
|
"data-testid": `ranked-fill-${row.id}`,
|
|
642
675
|
"data-ramp-step": String(step),
|
|
643
676
|
className: "h-full rounded-r-[4px]",
|
|
644
|
-
style: { width: `${width}%`, backgroundColor:
|
|
677
|
+
style: { width: `${width}%`, backgroundColor: _chunkTPZS46IMjs.SEQUENTIAL_RAMP[step] }
|
|
645
678
|
}
|
|
646
679
|
) })
|
|
647
680
|
] }),
|
|
@@ -691,7 +724,7 @@ var inferGranularity = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (buc
|
|
|
691
724
|
}, "inferGranularity");
|
|
692
725
|
function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
693
726
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
694
|
-
const { compact, bucketDate, metricValue: formatValue } =
|
|
727
|
+
const { compact, bucketDate, metricValue: formatValue } = _chunkTPZS46IMjs.useUsageFormatters.call(void 0, );
|
|
695
728
|
const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
|
|
696
729
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
697
730
|
const { chartData, seriesKeys } = _react.useMemo.call(void 0, () => {
|
|
@@ -699,8 +732,8 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
699
732
|
const totals = /* @__PURE__ */ new Map();
|
|
700
733
|
for (const row of rows) totals.set(row.series, (_nullishCoalesce(totals.get(row.series), () => ( 0))) + metricValue2(row, metric));
|
|
701
734
|
const ranked = [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([series]) => series);
|
|
702
|
-
const named = ranked.slice(0,
|
|
703
|
-
const folded = new Set(ranked.slice(
|
|
735
|
+
const named = ranked.slice(0, _chunkTPZS46IMjs.CATEGORICAL_CEILING);
|
|
736
|
+
const folded = new Set(ranked.slice(_chunkTPZS46IMjs.CATEGORICAL_CEILING));
|
|
704
737
|
const keys = folded.size > 0 ? [...named, OTHER_SERIES] : named;
|
|
705
738
|
const byBucket = /* @__PURE__ */ new Map();
|
|
706
739
|
for (const row of rows) {
|
|
@@ -740,7 +773,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
740
773
|
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" });
|
|
741
774
|
}
|
|
742
775
|
const granularity = inferGranularity(chartData.map((entry) => entry.bucket));
|
|
743
|
-
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ?
|
|
776
|
+
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ? _chunkTPZS46IMjs.OTHER_COLOR : _chunkTPZS46IMjs.seriesColor.call(void 0, index, mode), "seriesColorFor");
|
|
744
777
|
return (
|
|
745
778
|
// The chart is a coordinate system, not prose: recharts lays the axes and the
|
|
746
779
|
// stacked bars out left-to-right, so the whole chart stays an LTR island even
|
|
@@ -749,7 +782,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
749
782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
750
783
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
751
784
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
752
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.ChartContainer, { config: chartConfig, className: "aspect-auto h-72 w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _recharts.BarChart, { accessibilityLayer: true, data: chartData, margin: { top: 8, right: 8, bottom: 0, left: 0 }, children: [
|
|
753
786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
754
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
755
788
|
_recharts.XAxis,
|
|
@@ -773,10 +806,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
773
806
|
}
|
|
774
807
|
),
|
|
775
808
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
776
|
-
|
|
809
|
+
_chunkIPYXT7MHjs.ChartTooltip,
|
|
777
810
|
{
|
|
778
811
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
779
|
-
|
|
812
|
+
_chunkIPYXT7MHjs.ChartTooltipContent,
|
|
780
813
|
{
|
|
781
814
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
782
815
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -785,7 +818,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
785
818
|
)
|
|
786
819
|
}
|
|
787
820
|
),
|
|
788
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
821
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.ChartLegendContent, {}) }) : null,
|
|
789
822
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
790
823
|
_recharts.Bar,
|
|
791
824
|
{
|
|
@@ -837,19 +870,19 @@ function TokenUsageAdminContainer() {
|
|
|
837
870
|
[t]
|
|
838
871
|
);
|
|
839
872
|
if (error) {
|
|
840
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
873
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.RoundPageContainer, { module: _chunkT3YQ47EFjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
841
874
|
}
|
|
842
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
875
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.RoundPageContainer, { module: _chunkT3YQ47EFjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
843
876
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
844
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
877
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.RoundPageContainer, { module: _chunkT3YQ47EFjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
845
878
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
846
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
847
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
848
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
849
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
879
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: [
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
850
883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
851
884
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
852
|
-
|
|
885
|
+
_chunkIPYXT7MHjs.Select,
|
|
853
886
|
{
|
|
854
887
|
items: stackByItems,
|
|
855
888
|
value: filters.stackBy,
|
|
@@ -857,29 +890,29 @@ function TokenUsageAdminContainer() {
|
|
|
857
890
|
if (value) setFilters({ stackBy: value });
|
|
858
891
|
},
|
|
859
892
|
children: [
|
|
860
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
861
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
893
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectValue, {}) }),
|
|
894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
862
895
|
]
|
|
863
896
|
}
|
|
864
897
|
)
|
|
865
898
|
] }) })
|
|
866
899
|
] }),
|
|
867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
900
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
868
901
|
] }),
|
|
869
902
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
870
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
871
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
903
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
904
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
905
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
873
906
|
] }),
|
|
874
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
875
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
876
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
909
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
877
910
|
] })
|
|
878
911
|
] }),
|
|
879
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
881
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
882
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
912
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkT3YQ47EFjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
913
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
914
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
915
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
916
|
TokenUsageRankedBar,
|
|
884
917
|
{
|
|
885
918
|
rows: byCustomerOperation,
|
|
@@ -889,9 +922,9 @@ function TokenUsageAdminContainer() {
|
|
|
889
922
|
}
|
|
890
923
|
) })
|
|
891
924
|
] }),
|
|
892
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
893
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
894
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
925
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
895
928
|
TokenUsageRankedBar,
|
|
896
929
|
{
|
|
897
930
|
rows: byOperation,
|
|
@@ -902,9 +935,9 @@ function TokenUsageAdminContainer() {
|
|
|
902
935
|
) })
|
|
903
936
|
] })
|
|
904
937
|
] }),
|
|
905
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
906
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
938
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
908
941
|
] })
|
|
909
942
|
] }) });
|
|
910
943
|
}
|
|
@@ -917,36 +950,36 @@ function withFilters2(endpoint, filters) {
|
|
|
917
950
|
return endpoint;
|
|
918
951
|
}
|
|
919
952
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters2, "withFilters");
|
|
920
|
-
var TokenUsageReportService = class extends
|
|
953
|
+
var TokenUsageReportService = class extends _chunkT3YQ47EFjs.AbstractService {
|
|
921
954
|
static {
|
|
922
955
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageReportService");
|
|
923
956
|
}
|
|
924
957
|
/** Two rows: window "current" and "previous". */
|
|
925
958
|
static async getSummary(filters) {
|
|
926
|
-
const endpoint = withFilters2(new (0,
|
|
959
|
+
const endpoint = withFilters2(new (0, _chunkT3YQ47EFjs.EndpointCreator)({ endpoint: _chunkT3YQ47EFjs.Modules.TokenUsageReportSummary }), filters);
|
|
927
960
|
return this.callApi({
|
|
928
|
-
type:
|
|
961
|
+
type: _chunkT3YQ47EFjs.Modules.TokenUsageReportSummary,
|
|
929
962
|
method: "GET" /* GET */,
|
|
930
963
|
endpoint: endpoint.generate()
|
|
931
964
|
});
|
|
932
965
|
}
|
|
933
966
|
static async getTimeline(params) {
|
|
934
|
-
const endpoint = withFilters2(new (0,
|
|
967
|
+
const endpoint = withFilters2(new (0, _chunkT3YQ47EFjs.EndpointCreator)({ endpoint: _chunkT3YQ47EFjs.Modules.TokenUsageReportTimeline }), params);
|
|
935
968
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
936
969
|
return this.callApi({
|
|
937
|
-
type:
|
|
970
|
+
type: _chunkT3YQ47EFjs.Modules.TokenUsageReportTimeline,
|
|
938
971
|
method: "GET" /* GET */,
|
|
939
972
|
endpoint: endpoint.generate()
|
|
940
973
|
});
|
|
941
974
|
}
|
|
942
975
|
static async getBreakdown(params) {
|
|
943
|
-
const endpoint = withFilters2(new (0,
|
|
976
|
+
const endpoint = withFilters2(new (0, _chunkT3YQ47EFjs.EndpointCreator)({ endpoint: _chunkT3YQ47EFjs.Modules.TokenUsageReportBreakdown }), params);
|
|
944
977
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
945
978
|
if (params.targetLabel) endpoint.addAdditionalParam("targetLabel", params.targetLabel);
|
|
946
979
|
endpoint.addAdditionalParam("metric", params.metric);
|
|
947
980
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
948
981
|
return this.callApi({
|
|
949
|
-
type:
|
|
982
|
+
type: _chunkT3YQ47EFjs.Modules.TokenUsageReportBreakdown,
|
|
950
983
|
method: "GET" /* GET */,
|
|
951
984
|
endpoint: endpoint.generate()
|
|
952
985
|
});
|
|
@@ -1025,7 +1058,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1025
1058
|
|
|
1026
1059
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1027
1060
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-help": "tokenusage.filters", className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1028
|
-
|
|
1061
|
+
_chunkIPYXT7MHjs.DateRangeSelector,
|
|
1029
1062
|
{
|
|
1030
1063
|
onDateChange: (range) => {
|
|
1031
1064
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1058,7 +1091,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1058
1091
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1059
1092
|
}) => {
|
|
1060
1093
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1061
|
-
const generateUrl =
|
|
1094
|
+
const generateUrl = _chunkIPYXT7MHjs.usePageUrlGenerator.call(void 0, );
|
|
1062
1095
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1063
1096
|
const range = defaultRange2();
|
|
1064
1097
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1122,7 +1155,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1122
1155
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1123
1156
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1124
1157
|
);
|
|
1125
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1158
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1126
1159
|
}, "TokenUsageReportProvider");
|
|
1127
1160
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1128
1161
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1142,7 +1175,7 @@ var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (
|
|
|
1142
1175
|
var ZERO2 = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
1143
1176
|
function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
1144
1177
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1145
|
-
const { decimal, metricValue: formatValue } =
|
|
1178
|
+
const { decimal, metricValue: formatValue } = _chunkTPZS46IMjs.useUsageFormatters.call(void 0, );
|
|
1146
1179
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (window) => _nullishCoalesce(summary.find((row) => row.window === window), () => ( ZERO2)), "rowFor");
|
|
1147
1180
|
const current = rowFor("current");
|
|
1148
1181
|
const previous = rowFor("previous");
|
|
@@ -1150,15 +1183,15 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1150
1183
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1151
1184
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1152
1185
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1153
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1186
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "grid gap-1", children: [
|
|
1154
1187
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1155
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(
|
|
1188
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunkTPZS46IMjs.metricValue.call(void 0, current, metric), metric) }),
|
|
1156
1189
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
1157
1190
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1158
1191
|
Delta2,
|
|
1159
1192
|
{
|
|
1160
1193
|
testId: "tile-used-delta",
|
|
1161
|
-
delta:
|
|
1194
|
+
delta: _chunkTPZS46IMjs.percentageDelta.call(void 0, _chunkTPZS46IMjs.metricValue.call(void 0, current, metric), _chunkTPZS46IMjs.metricValue.call(void 0, previous, metric)),
|
|
1162
1195
|
decimal
|
|
1163
1196
|
}
|
|
1164
1197
|
),
|
|
@@ -1166,21 +1199,21 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1166
1199
|
] })
|
|
1167
1200
|
] }) }),
|
|
1168
1201
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1169
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1202
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "grid gap-1", children: [
|
|
1170
1203
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1171
1204
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1172
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className:
|
|
1205
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunkT3YQ47EFjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
1173
1206
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground text-xs tabular-nums", children: [
|
|
1174
1207
|
"/ ",
|
|
1175
1208
|
whole(balances.monthlyCredits)
|
|
1176
1209
|
] })
|
|
1177
1210
|
] })
|
|
1178
1211
|
] }) }),
|
|
1179
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1212
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "grid gap-1", children: [
|
|
1180
1213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1181
1214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1182
1215
|
] }) }),
|
|
1183
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "grid gap-1", children: [
|
|
1184
1217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1185
1218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1186
1219
|
] }) })
|
|
@@ -1202,7 +1235,7 @@ function Delta2({
|
|
|
1202
1235
|
"span",
|
|
1203
1236
|
{
|
|
1204
1237
|
"data-testid": testId,
|
|
1205
|
-
className:
|
|
1238
|
+
className: _chunkT3YQ47EFjs.cn.call(void 0,
|
|
1206
1239
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
1207
1240
|
increased ? "text-warning" : "text-success"
|
|
1208
1241
|
),
|
|
@@ -1222,21 +1255,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1222
1255
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1223
1256
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1224
1257
|
if (error) {
|
|
1225
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1258
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1226
1259
|
}
|
|
1227
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1260
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1228
1261
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1229
1262
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1230
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1263
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1231
1264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1232
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1265
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
1266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1235
1268
|
] }),
|
|
1236
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
1237
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1239
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkT3YQ47EFjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1270
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
1271
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1240
1273
|
TokenUsageRankedBar,
|
|
1241
1274
|
{
|
|
1242
1275
|
rows: byOperation,
|
|
@@ -1246,9 +1279,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1246
1279
|
}
|
|
1247
1280
|
) })
|
|
1248
1281
|
] }),
|
|
1249
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1250
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1251
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1282
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
1283
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: targetTitle }) }),
|
|
1284
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1252
1285
|
] })
|
|
1253
1286
|
] })
|
|
1254
1287
|
] }) });
|
|
@@ -1286,5 +1319,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, TokenUsageReportContainer, "TokenUsageRepor
|
|
|
1286
1319
|
|
|
1287
1320
|
|
|
1288
1321
|
|
|
1289
|
-
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown =
|
|
1322
|
+
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown = _chunkT3YQ47EFjs.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkT3YQ47EFjs.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkT3YQ47EFjs.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkT3YQ47EFjs.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkT3YQ47EFjs.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkT3YQ47EFjs.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkT3YQ47EFjs.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkT3YQ47EFjs.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkT3YQ47EFjs.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkT3YQ47EFjs.configureTokenUsage; exports.createUsageFormatters = _chunkTPZS46IMjs.createUsageFormatters; exports.getTokenUsageCurrency = _chunkT3YQ47EFjs.getTokenUsageCurrency; exports.tokenUsageModules = _chunkT3YQ47EFjs.tokenUsageModules; exports.useTokenUsageAdmin = useTokenUsageAdmin; exports.useTokenUsageReport = useTokenUsageReport; exports.useUsageFormatters = _chunkTPZS46IMjs.useUsageFormatters;
|
|
1290
1323
|
//# sourceMappingURL=index.js.map
|