@carlonicora/nextjs-jsonapi 6.1.0 → 6.3.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/{AssistantMessageInterface-S7oyERTT.d.mts → AssistantMessageInterface-0ZQ1EJKO.d.mts} +1 -1
- package/dist/{AssistantMessageInterface-DHJJO_Z_.d.ts → AssistantMessageInterface-CA-hZ5Wj.d.ts} +1 -1
- package/dist/{BlockNoteEditor-SAU3G6H7.js → BlockNoteEditor-CT4XUXPC.js} +19 -19
- package/dist/{BlockNoteEditor-SAU3G6H7.js.map → BlockNoteEditor-CT4XUXPC.js.map} +1 -1
- package/dist/{BlockNoteEditor-FZNU4YQT.mjs → BlockNoteEditor-M6UQRVRK.mjs} +4 -4
- package/dist/{BlockNoteViewer-7BTV7QQA.js → BlockNoteViewer-MFLWF3Y2.js} +3 -3
- package/dist/{BlockNoteViewer-7BTV7QQA.js.map → BlockNoteViewer-MFLWF3Y2.js.map} +1 -1
- package/dist/{BlockNoteViewer-6XDDVTN6.mjs → BlockNoteViewer-XZJ5Y7WN.mjs} +2 -2
- package/dist/{BlogPostInterface-BB_4wcDR.d.mts → BlogPostInterface-BN2mXc46.d.mts} +1 -1
- package/dist/{BlogPostInterface-bWAT1rfR.d.ts → BlogPostInterface-CTGfsR1I.d.ts} +1 -1
- package/dist/{auth.interface-CSzJ1oP1.d.ts → auth.interface-D5606g19.d.ts} +1 -1
- package/dist/{auth.interface-DD4uQv2K.d.mts → auth.interface-tsOuc0Fi.d.mts} +1 -1
- package/dist/billing/index.d.mts +3 -3
- package/dist/billing/index.d.ts +3 -3
- package/dist/billing/index.js +501 -493
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +13 -5
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-USYZNWKS.mjs → chunk-3FD6Y734.mjs} +74 -15
- package/dist/chunk-3FD6Y734.mjs.map +1 -0
- package/dist/{chunk-F4JB7YAP.js → chunk-DSGP6GC3.js} +8 -8
- package/dist/{chunk-F4JB7YAP.js.map → chunk-DSGP6GC3.js.map} +1 -1
- package/dist/{chunk-GFGKMUPZ.mjs → chunk-O2TEUH5S.mjs} +2 -2
- package/dist/{chunk-MTI2UXDA.js → chunk-QJIDORHM.js} +4 -4
- package/dist/{chunk-MTI2UXDA.js.map → chunk-QJIDORHM.js.map} +1 -1
- package/dist/{chunk-JVJS5RHB.mjs → chunk-RUJCWOJE.mjs} +2 -2
- package/dist/{chunk-U7DR5VDT.mjs → chunk-TIT4CJYQ.mjs} +1233 -1181
- package/dist/chunk-TIT4CJYQ.mjs.map +1 -0
- package/dist/{chunk-TPZS46IM.js → chunk-V4I3XKOM.js} +3 -3
- package/dist/{chunk-TPZS46IM.js.map → chunk-V4I3XKOM.js.map} +1 -1
- package/dist/{chunk-T3YQ47EF.js → chunk-XZCCIKX3.js} +152 -93
- package/dist/chunk-XZCCIKX3.js.map +1 -0
- package/dist/{chunk-IPYXT7MH.js → chunk-Y7JIQNM6.js} +922 -870
- package/dist/chunk-Y7JIQNM6.js.map +1 -0
- package/dist/{chunk-RYZYKG6W.mjs → chunk-ZDUT5JPT.mjs} +2 -2
- package/dist/client/index.d.mts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +22 -6
- package/dist/components/index.d.ts +22 -6
- package/dist/components/index.js +10 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -4
- package/dist/contexts/index.d.mts +5 -5
- package/dist/contexts/index.d.ts +5 -5
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +23 -13
- package/dist/core/index.d.ts +23 -13
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/{currency-DrEVd_Xs.d.mts → currency-BhuEoBOn.d.mts} +2 -115
- package/dist/{currency-8ErEC39n.d.ts → currency-CBgZkS0u.d.ts} +2 -115
- package/dist/email-automations/index.js +92 -92
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.d.mts +11 -3
- package/dist/features/analytics/index.d.ts +11 -3
- package/dist/features/analytics/index.js +129 -127
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +12 -10
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.d.mts +4 -4
- package/dist/features/blog/index.d.ts +4 -4
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.d.mts +4 -4
- package/dist/features/blog/server.d.ts +4 -4
- 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 +127 -127
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/{notification.interface-BB6GPpZY.d.mts → notification.interface-CF5h90U2.d.mts} +1 -1
- package/dist/{notification.interface-CmAGrijJ.d.ts → notification.interface-DQReXAD7.d.ts} +1 -1
- package/dist/{s3.service-Bz_K-tjz.d.ts → s3.service-BTCpmp5g.d.ts} +11 -4
- package/dist/{s3.service-D5zNCEW3.d.mts → s3.service-CzFBDEuQ.d.mts} +11 -4
- package/dist/server/index.d.mts +5 -5
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/dist/stripe-price.interface-D6mKjAdr.d.mts +132 -0
- package/dist/stripe-price.interface-DGqcklFJ.d.ts +132 -0
- package/dist/{useSocket-B0H9pmmH.d.ts → useSocket-BM3q9A0C.d.ts} +1 -1
- package/dist/{useSocket-B5RQb6v2.d.mts → useSocket-CwSoq6VS.d.mts} +1 -1
- package/dist/{user.interface-CIWGlbqM.d.mts → user.interface-BYnGJ7ss.d.mts} +37 -2
- package/dist/{user.interface-C0ZdsBZj.d.ts → user.interface-BqPjVyJI.d.ts} +37 -2
- package/messages/en.json +8 -0
- package/messages/it.json +8 -0
- package/package.json +1 -1
- package/src/components/containers/RoundPageContainer.tsx +7 -2
- package/src/components/index.ts +5 -0
- package/src/features/analytics/components/AnalyticsTracker.tsx +22 -9
- package/src/features/analytics/components/__tests__/AnalyticsTracker.spec.tsx +67 -0
- package/src/features/analytics/data/__tests__/models.spec.ts +13 -0
- package/src/features/analytics/data/analytics-event.ts +1 -0
- package/src/features/analytics/data/analytics.types.ts +2 -0
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +20 -3
- package/src/features/billing/components/widgets/CreditWarningBanner.tsx +93 -0
- package/src/features/billing/data/credit-warning.spec.ts +96 -0
- package/src/features/billing/data/credit-warning.ts +57 -0
- package/src/features/billing/data/index.ts +3 -0
- package/src/features/billing/i18n-keys.ts +6 -0
- package/src/features/company/data/company.interface.ts +11 -0
- package/src/features/company/data/company.service.ts +17 -0
- package/src/features/company/data/company.spec.ts +29 -0
- package/src/features/company/data/company.ts +31 -0
- package/dist/chunk-IPYXT7MH.js.map +0 -1
- package/dist/chunk-T3YQ47EF.js.map +0 -1
- package/dist/chunk-U7DR5VDT.mjs.map +0 -1
- package/dist/chunk-USYZNWKS.mjs.map +0 -1
- package/dist/feature.interface-BO25VLlx.d.ts +0 -19
- package/dist/feature.interface-CXb1-vNq.d.mts +0 -19
- /package/dist/{BlockNoteEditor-FZNU4YQT.mjs.map → BlockNoteEditor-M6UQRVRK.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-6XDDVTN6.mjs.map → BlockNoteViewer-XZJ5Y7WN.mjs.map} +0 -0
- /package/dist/{chunk-GFGKMUPZ.mjs.map → chunk-O2TEUH5S.mjs.map} +0 -0
- /package/dist/{chunk-JVJS5RHB.mjs.map → chunk-RUJCWOJE.mjs.map} +0 -0
- /package/dist/{chunk-RYZYKG6W.mjs.map → chunk-ZDUT5JPT.mjs.map} +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkV4I3XKOMjs = require('../../chunk-V4I3XKOM.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -40,8 +40,8 @@ var _chunkTPZS46IMjs = require('../../chunk-TPZS46IM.js');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
44
|
-
require('../../chunk-
|
|
43
|
+
var _chunkY7JIQNM6js = require('../../chunk-Y7JIQNM6.js');
|
|
44
|
+
require('../../chunk-DSGP6GC3.js');
|
|
45
45
|
require('../../chunk-G4JR3SFV.js');
|
|
46
46
|
|
|
47
47
|
|
|
@@ -60,7 +60,7 @@ require('../../chunk-G4JR3SFV.js');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkXZCCIKX3js = require('../../chunk-XZCCIKX3.js');
|
|
64
64
|
require('../../chunk-GHE4VT2R.js');
|
|
65
65
|
require('../../chunk-LXKSUWAV.js');
|
|
66
66
|
require('../../chunk-JTPRJNT2.js');
|
|
@@ -85,7 +85,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
85
85
|
};
|
|
86
86
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
87
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,
|
|
88
|
-
|
|
88
|
+
_chunkY7JIQNM6js.DateRangeSelector,
|
|
89
89
|
{
|
|
90
90
|
onDateChange: (range) => {
|
|
91
91
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -120,16 +120,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
120
120
|
}
|
|
121
121
|
),
|
|
122
122
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
123
|
-
|
|
123
|
+
_chunkY7JIQNM6js.Select,
|
|
124
124
|
{
|
|
125
125
|
items: companyItems,
|
|
126
126
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
127
127
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
128
128
|
children: [
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
132
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.SelectContent, { children: [
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
132
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
133
133
|
] })
|
|
134
134
|
]
|
|
135
135
|
}
|
|
@@ -152,13 +152,13 @@ function Segmented({
|
|
|
152
152
|
children: options.map((option) => {
|
|
153
153
|
const selected = option.value === value;
|
|
154
154
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
155
|
-
|
|
155
|
+
_chunkY7JIQNM6js.Button,
|
|
156
156
|
{
|
|
157
157
|
type: "button",
|
|
158
158
|
size: "sm",
|
|
159
159
|
variant: selected ? "default" : "ghost",
|
|
160
160
|
"aria-pressed": selected,
|
|
161
|
-
className:
|
|
161
|
+
className: _chunkXZCCIKX3js.cn.call(void 0, !selected && "text-muted-foreground"),
|
|
162
162
|
onClick: () => onSelect(option.value),
|
|
163
163
|
children: option.label
|
|
164
164
|
},
|
|
@@ -178,36 +178,36 @@ function withFilters(endpoint, filters) {
|
|
|
178
178
|
return endpoint;
|
|
179
179
|
}
|
|
180
180
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters, "withFilters");
|
|
181
|
-
var TokenUsageAdminService = class extends
|
|
181
|
+
var TokenUsageAdminService = class extends _chunkXZCCIKX3js.AbstractService {
|
|
182
182
|
static {
|
|
183
183
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageAdminService");
|
|
184
184
|
}
|
|
185
185
|
/** Six rows: {customer, platform, total} × {current, previous}. */
|
|
186
186
|
static async getSummary(filters) {
|
|
187
|
-
const endpoint = withFilters(new (0,
|
|
187
|
+
const endpoint = withFilters(new (0, _chunkXZCCIKX3js.EndpointCreator)({ endpoint: _chunkXZCCIKX3js.Modules.TokenUsageAdminSummary }), filters);
|
|
188
188
|
return this.callApi({
|
|
189
|
-
type:
|
|
189
|
+
type: _chunkXZCCIKX3js.Modules.TokenUsageAdminSummary,
|
|
190
190
|
method: "GET" /* GET */,
|
|
191
191
|
endpoint: endpoint.generate()
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
static async getTimeline(params) {
|
|
195
|
-
const endpoint = withFilters(new (0,
|
|
195
|
+
const endpoint = withFilters(new (0, _chunkXZCCIKX3js.EndpointCreator)({ endpoint: _chunkXZCCIKX3js.Modules.TokenUsageAdminTimeline }), params);
|
|
196
196
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
197
197
|
endpoint.addAdditionalParam("stackBy", params.stackBy);
|
|
198
198
|
return this.callApi({
|
|
199
|
-
type:
|
|
199
|
+
type: _chunkXZCCIKX3js.Modules.TokenUsageAdminTimeline,
|
|
200
200
|
method: "GET" /* GET */,
|
|
201
201
|
endpoint: endpoint.generate()
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
static async getBreakdown(params) {
|
|
205
|
-
const endpoint = withFilters(new (0,
|
|
205
|
+
const endpoint = withFilters(new (0, _chunkXZCCIKX3js.EndpointCreator)({ endpoint: _chunkXZCCIKX3js.Modules.TokenUsageAdminBreakdown }), params);
|
|
206
206
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
207
207
|
endpoint.addAdditionalParam("scope", params.scope);
|
|
208
208
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
209
209
|
return this.callApi({
|
|
210
|
-
type:
|
|
210
|
+
type: _chunkXZCCIKX3js.Modules.TokenUsageAdminBreakdown,
|
|
211
211
|
method: "GET" /* GET */,
|
|
212
212
|
endpoint: endpoint.generate()
|
|
213
213
|
});
|
|
@@ -344,7 +344,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
344
344
|
error
|
|
345
345
|
]
|
|
346
346
|
);
|
|
347
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
347
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
348
348
|
}, "TokenUsageAdminProvider");
|
|
349
349
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
350
350
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -365,7 +365,7 @@ var _lucidereact = require('lucide-react');
|
|
|
365
365
|
var ZERO = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
366
366
|
function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
367
367
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
368
|
-
const { decimal, metricValue: formatValue, currency, percent } =
|
|
368
|
+
const { decimal, metricValue: formatValue, currency, percent } = _chunkV4I3XKOMjs.useUsageFormatters.call(void 0, );
|
|
369
369
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (scope, window) => _nullishCoalesce(summary.find((r) => r.scope === scope && r.window === window), () => ( ZERO)), "rowFor");
|
|
370
370
|
const customerCurrent = rowFor("customer", "current");
|
|
371
371
|
const customerPrevious = rowFor("customer", "previous");
|
|
@@ -374,16 +374,16 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
374
374
|
const totalCurrent = rowFor("total", "current");
|
|
375
375
|
const totalPrevious = rowFor("total", "previous");
|
|
376
376
|
const averagePerCall = totalCurrent.calls ? totalCurrent.cost / totalCurrent.calls : 0;
|
|
377
|
-
const cacheHit =
|
|
377
|
+
const cacheHit = _chunkV4I3XKOMjs.cacheHitPercentage.call(void 0, totalCurrent.cached, totalCurrent.tokensIn);
|
|
378
378
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
379
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkXZCCIKX3js.cn.call(void 0, "grid gap-3", singleCustomerMode ? "sm:grid-cols-1" : "sm:grid-cols-2"), children: [
|
|
380
380
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
381
381
|
LeadTile,
|
|
382
382
|
{
|
|
383
383
|
testId: "tile-customer",
|
|
384
384
|
label: t("token_usage.admin.customer_spend"),
|
|
385
|
-
value: formatValue(
|
|
386
|
-
delta:
|
|
385
|
+
value: formatValue(_chunkV4I3XKOMjs.metricValue.call(void 0, customerCurrent, metric), metric),
|
|
386
|
+
delta: _chunkV4I3XKOMjs.percentageDelta.call(void 0, _chunkV4I3XKOMjs.metricValue.call(void 0, customerCurrent, metric), _chunkV4I3XKOMjs.metricValue.call(void 0, customerPrevious, metric)),
|
|
387
387
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
388
388
|
decimal
|
|
389
389
|
}
|
|
@@ -393,8 +393,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
393
393
|
{
|
|
394
394
|
testId: "tile-platform",
|
|
395
395
|
label: t("token_usage.admin.platform_spend"),
|
|
396
|
-
value: formatValue(
|
|
397
|
-
delta:
|
|
396
|
+
value: formatValue(_chunkV4I3XKOMjs.metricValue.call(void 0, platformCurrent, metric), metric),
|
|
397
|
+
delta: _chunkV4I3XKOMjs.percentageDelta.call(void 0, _chunkV4I3XKOMjs.metricValue.call(void 0, platformCurrent, metric), _chunkV4I3XKOMjs.metricValue.call(void 0, platformPrevious, metric)),
|
|
398
398
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
399
399
|
decimal
|
|
400
400
|
}
|
|
@@ -406,8 +406,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
406
406
|
{
|
|
407
407
|
testId: "tile-total",
|
|
408
408
|
label: t("token_usage.admin.total_cost"),
|
|
409
|
-
value: formatValue(
|
|
410
|
-
delta:
|
|
409
|
+
value: formatValue(_chunkV4I3XKOMjs.metricValue.call(void 0, totalCurrent, metric), metric),
|
|
410
|
+
delta: _chunkV4I3XKOMjs.percentageDelta.call(void 0, _chunkV4I3XKOMjs.metricValue.call(void 0, totalCurrent, metric), _chunkV4I3XKOMjs.metricValue.call(void 0, totalPrevious, metric)),
|
|
411
411
|
decimal
|
|
412
412
|
}
|
|
413
413
|
),
|
|
@@ -441,7 +441,7 @@ function LeadTile({
|
|
|
441
441
|
previousLabel,
|
|
442
442
|
decimal
|
|
443
443
|
}) {
|
|
444
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
444
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "grid gap-1", children: [
|
|
445
445
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
446
446
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
447
447
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -458,7 +458,7 @@ function SupportingTile({
|
|
|
458
458
|
delta,
|
|
459
459
|
decimal
|
|
460
460
|
}) {
|
|
461
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
461
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "grid gap-1", children: [
|
|
462
462
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
463
463
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
464
464
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -481,7 +481,7 @@ function Delta({
|
|
|
481
481
|
"span",
|
|
482
482
|
{
|
|
483
483
|
"data-testid": testId,
|
|
484
|
-
className:
|
|
484
|
+
className: _chunkXZCCIKX3js.cn.call(void 0,
|
|
485
485
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
486
486
|
increased ? "text-success" : "text-destructive"
|
|
487
487
|
),
|
|
@@ -502,10 +502,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, Delta, "Delta");
|
|
|
502
502
|
|
|
503
503
|
function TokenUsageBreakdownTable({ rows, metric }) {
|
|
504
504
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
505
|
-
const { decimal, metricValue: formatValue, percent, compare } =
|
|
505
|
+
const { decimal, metricValue: formatValue, percent, compare } = _chunkV4I3XKOMjs.useUsageFormatters.call(void 0, );
|
|
506
506
|
const [sort, setSort] = _react.useState.call(void 0, void 0);
|
|
507
507
|
const showActiveUsers = rows.some((row) => row.activeUsers !== void 0);
|
|
508
|
-
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 + _chunkV4I3XKOMjs.metricValue.call(void 0, row, metric), 0), [rows, metric]);
|
|
509
509
|
const sortValue = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row, key) => {
|
|
510
510
|
switch (key) {
|
|
511
511
|
case "label":
|
|
@@ -515,9 +515,9 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
515
515
|
case "activeUsers":
|
|
516
516
|
return _nullishCoalesce(row.activeUsers, () => ( 0));
|
|
517
517
|
case "cacheHit":
|
|
518
|
-
return
|
|
518
|
+
return _chunkV4I3XKOMjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn);
|
|
519
519
|
case "share":
|
|
520
|
-
return
|
|
520
|
+
return _chunkV4I3XKOMjs.metricValue.call(void 0, row, metric);
|
|
521
521
|
default:
|
|
522
522
|
return row[key];
|
|
523
523
|
}
|
|
@@ -555,13 +555,13 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
555
555
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
556
556
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
557
557
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
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,
|
|
559
|
-
/* @__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, _chunkY7JIQNM6js.Table, { children: [
|
|
559
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { className: _chunkXZCCIKX3js.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
560
560
|
"button",
|
|
561
561
|
{
|
|
562
562
|
type: "button",
|
|
563
563
|
onClick: () => toggleSort(column.key),
|
|
564
|
-
className:
|
|
564
|
+
className: _chunkXZCCIKX3js.cn.call(void 0,
|
|
565
565
|
"hover:text-primary inline-flex items-center gap-1 text-xs font-medium",
|
|
566
566
|
column.numeric && "flex-row-reverse"
|
|
567
567
|
),
|
|
@@ -571,20 +571,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
571
571
|
]
|
|
572
572
|
}
|
|
573
573
|
) }, column.key)) }) }),
|
|
574
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
575
|
-
const value =
|
|
574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableBody, { children: sortedRows.map((row) => {
|
|
575
|
+
const value = _chunkV4I3XKOMjs.metricValue.call(void 0, row, metric);
|
|
576
576
|
const share = total > 0 ? value / total * 100 : 0;
|
|
577
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
580
|
-
showActiveUsers && /* @__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,
|
|
587
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
577
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
580
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunkV4I3XKOMjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
588
588
|
] }, row.id);
|
|
589
589
|
}) })
|
|
590
590
|
] }) })
|
|
@@ -618,7 +618,7 @@ var operationDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0,
|
|
|
618
618
|
|
|
619
619
|
function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes = false }) {
|
|
620
620
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
621
|
-
const { metricValue: formatValue, percent } =
|
|
621
|
+
const { metricValue: formatValue, percent } = _chunkV4I3XKOMjs.useUsageFormatters.call(void 0, );
|
|
622
622
|
const renderLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
623
623
|
if (row.id === "other") return t("token_usage.admin.other");
|
|
624
624
|
if (!labelsAreOperationTypes) return row.label;
|
|
@@ -640,9 +640,9 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
640
640
|
const label = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground truncate text-xs", children: renderLabel(row) });
|
|
641
641
|
const description = renderDescription(row);
|
|
642
642
|
if (!description) return label;
|
|
643
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
643
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Tooltip, { children: [
|
|
644
644
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
645
|
-
|
|
645
|
+
_chunkY7JIQNM6js.TooltipTrigger,
|
|
646
646
|
{
|
|
647
647
|
"data-testid": `ranked-description-${row.id}`,
|
|
648
648
|
className: "min-w-0 cursor-help justify-self-start truncate",
|
|
@@ -650,19 +650,19 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
650
650
|
children: label
|
|
651
651
|
}
|
|
652
652
|
),
|
|
653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs", children: description }) })
|
|
654
654
|
] });
|
|
655
655
|
}, "renderLabelCell");
|
|
656
656
|
if (rows.length === 0) {
|
|
657
657
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground py-6 text-center text-sm", children: emptyLabel });
|
|
658
658
|
}
|
|
659
|
-
const values = rows.map((row) =>
|
|
659
|
+
const values = rows.map((row) => _chunkV4I3XKOMjs.metricValue.call(void 0, row, metric));
|
|
660
660
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
661
661
|
const max = Math.max(...values, 0);
|
|
662
662
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid gap-0.5", children: rows.map((row, index) => {
|
|
663
663
|
const value = values[index];
|
|
664
664
|
const isOther = row.id === "other";
|
|
665
|
-
const step = isOther ?
|
|
665
|
+
const step = isOther ? _chunkV4I3XKOMjs.SEQUENTIAL_RAMP.length - 1 : Math.min(index, _chunkV4I3XKOMjs.SEQUENTIAL_RAMP.length - 1);
|
|
666
666
|
const width = max > 0 ? value / max * 100 : 0;
|
|
667
667
|
const share = total > 0 ? value / total * 100 : 0;
|
|
668
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: [
|
|
@@ -674,7 +674,7 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
674
674
|
"data-testid": `ranked-fill-${row.id}`,
|
|
675
675
|
"data-ramp-step": String(step),
|
|
676
676
|
className: "h-full rounded-r-[4px]",
|
|
677
|
-
style: { width: `${width}%`, backgroundColor:
|
|
677
|
+
style: { width: `${width}%`, backgroundColor: _chunkV4I3XKOMjs.SEQUENTIAL_RAMP[step] }
|
|
678
678
|
}
|
|
679
679
|
) })
|
|
680
680
|
] }),
|
|
@@ -724,7 +724,7 @@ var inferGranularity = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (buc
|
|
|
724
724
|
}, "inferGranularity");
|
|
725
725
|
function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
726
726
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
727
|
-
const { compact, bucketDate, metricValue: formatValue } =
|
|
727
|
+
const { compact, bucketDate, metricValue: formatValue } = _chunkV4I3XKOMjs.useUsageFormatters.call(void 0, );
|
|
728
728
|
const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
|
|
729
729
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
730
730
|
const { chartData, seriesKeys } = _react.useMemo.call(void 0, () => {
|
|
@@ -732,8 +732,8 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
732
732
|
const totals = /* @__PURE__ */ new Map();
|
|
733
733
|
for (const row of rows) totals.set(row.series, (_nullishCoalesce(totals.get(row.series), () => ( 0))) + metricValue2(row, metric));
|
|
734
734
|
const ranked = [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([series]) => series);
|
|
735
|
-
const named = ranked.slice(0,
|
|
736
|
-
const folded = new Set(ranked.slice(
|
|
735
|
+
const named = ranked.slice(0, _chunkV4I3XKOMjs.CATEGORICAL_CEILING);
|
|
736
|
+
const folded = new Set(ranked.slice(_chunkV4I3XKOMjs.CATEGORICAL_CEILING));
|
|
737
737
|
const keys = folded.size > 0 ? [...named, OTHER_SERIES] : named;
|
|
738
738
|
const byBucket = /* @__PURE__ */ new Map();
|
|
739
739
|
for (const row of rows) {
|
|
@@ -773,7 +773,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
773
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" });
|
|
774
774
|
}
|
|
775
775
|
const granularity = inferGranularity(chartData.map((entry) => entry.bucket));
|
|
776
|
-
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 ? _chunkV4I3XKOMjs.OTHER_COLOR : _chunkV4I3XKOMjs.seriesColor.call(void 0, index, mode), "seriesColorFor");
|
|
777
777
|
return (
|
|
778
778
|
// The chart is a coordinate system, not prose: recharts lays the axes and the
|
|
779
779
|
// stacked bars out left-to-right, so the whole chart stays an LTR island even
|
|
@@ -782,7 +782,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
782
782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
783
783
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
784
784
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
785
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.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: [
|
|
786
786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
787
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
788
788
|
_recharts.XAxis,
|
|
@@ -806,10 +806,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
806
806
|
}
|
|
807
807
|
),
|
|
808
808
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
809
|
-
|
|
809
|
+
_chunkY7JIQNM6js.ChartTooltip,
|
|
810
810
|
{
|
|
811
811
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
812
|
-
|
|
812
|
+
_chunkY7JIQNM6js.ChartTooltipContent,
|
|
813
813
|
{
|
|
814
814
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
815
815
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -818,7 +818,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
818
818
|
)
|
|
819
819
|
}
|
|
820
820
|
),
|
|
821
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
821
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.ChartLegendContent, {}) }) : null,
|
|
822
822
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
823
823
|
_recharts.Bar,
|
|
824
824
|
{
|
|
@@ -870,19 +870,19 @@ function TokenUsageAdminContainer() {
|
|
|
870
870
|
[t]
|
|
871
871
|
);
|
|
872
872
|
if (error) {
|
|
873
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
873
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.RoundPageContainer, { module: _chunkXZCCIKX3js.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
874
874
|
}
|
|
875
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
875
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.RoundPageContainer, { module: _chunkXZCCIKX3js.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
876
876
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
877
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
877
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.RoundPageContainer, { module: _chunkXZCCIKX3js.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: [
|
|
878
878
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
879
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
881
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
882
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
879
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: [
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
883
883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
884
884
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
885
|
-
|
|
885
|
+
_chunkY7JIQNM6js.Select,
|
|
886
886
|
{
|
|
887
887
|
items: stackByItems,
|
|
888
888
|
value: filters.stackBy,
|
|
@@ -890,29 +890,29 @@ function TokenUsageAdminContainer() {
|
|
|
890
890
|
if (value) setFilters({ stackBy: value });
|
|
891
891
|
},
|
|
892
892
|
children: [
|
|
893
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
894
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
893
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectValue, {}) }),
|
|
894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
895
895
|
]
|
|
896
896
|
}
|
|
897
897
|
)
|
|
898
898
|
] }) })
|
|
899
899
|
] }),
|
|
900
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
900
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
901
901
|
] }),
|
|
902
902
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
903
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
904
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
905
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
903
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
904
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
905
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
906
906
|
] }),
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
908
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
909
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
909
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
910
910
|
] })
|
|
911
911
|
] }),
|
|
912
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
913
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
914
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
915
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
912
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkXZCCIKX3js.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
913
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
914
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
915
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
916
916
|
TokenUsageRankedBar,
|
|
917
917
|
{
|
|
918
918
|
rows: byCustomerOperation,
|
|
@@ -922,9 +922,9 @@ function TokenUsageAdminContainer() {
|
|
|
922
922
|
}
|
|
923
923
|
) })
|
|
924
924
|
] }),
|
|
925
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
926
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
927
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
925
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
928
928
|
TokenUsageRankedBar,
|
|
929
929
|
{
|
|
930
930
|
rows: byOperation,
|
|
@@ -935,9 +935,9 @@ function TokenUsageAdminContainer() {
|
|
|
935
935
|
) })
|
|
936
936
|
] })
|
|
937
937
|
] }),
|
|
938
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
939
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
940
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
938
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
941
941
|
] })
|
|
942
942
|
] }) });
|
|
943
943
|
}
|
|
@@ -950,36 +950,36 @@ function withFilters2(endpoint, filters) {
|
|
|
950
950
|
return endpoint;
|
|
951
951
|
}
|
|
952
952
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters2, "withFilters");
|
|
953
|
-
var TokenUsageReportService = class extends
|
|
953
|
+
var TokenUsageReportService = class extends _chunkXZCCIKX3js.AbstractService {
|
|
954
954
|
static {
|
|
955
955
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageReportService");
|
|
956
956
|
}
|
|
957
957
|
/** Two rows: window "current" and "previous". */
|
|
958
958
|
static async getSummary(filters) {
|
|
959
|
-
const endpoint = withFilters2(new (0,
|
|
959
|
+
const endpoint = withFilters2(new (0, _chunkXZCCIKX3js.EndpointCreator)({ endpoint: _chunkXZCCIKX3js.Modules.TokenUsageReportSummary }), filters);
|
|
960
960
|
return this.callApi({
|
|
961
|
-
type:
|
|
961
|
+
type: _chunkXZCCIKX3js.Modules.TokenUsageReportSummary,
|
|
962
962
|
method: "GET" /* GET */,
|
|
963
963
|
endpoint: endpoint.generate()
|
|
964
964
|
});
|
|
965
965
|
}
|
|
966
966
|
static async getTimeline(params) {
|
|
967
|
-
const endpoint = withFilters2(new (0,
|
|
967
|
+
const endpoint = withFilters2(new (0, _chunkXZCCIKX3js.EndpointCreator)({ endpoint: _chunkXZCCIKX3js.Modules.TokenUsageReportTimeline }), params);
|
|
968
968
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
969
969
|
return this.callApi({
|
|
970
|
-
type:
|
|
970
|
+
type: _chunkXZCCIKX3js.Modules.TokenUsageReportTimeline,
|
|
971
971
|
method: "GET" /* GET */,
|
|
972
972
|
endpoint: endpoint.generate()
|
|
973
973
|
});
|
|
974
974
|
}
|
|
975
975
|
static async getBreakdown(params) {
|
|
976
|
-
const endpoint = withFilters2(new (0,
|
|
976
|
+
const endpoint = withFilters2(new (0, _chunkXZCCIKX3js.EndpointCreator)({ endpoint: _chunkXZCCIKX3js.Modules.TokenUsageReportBreakdown }), params);
|
|
977
977
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
978
978
|
if (params.targetLabel) endpoint.addAdditionalParam("targetLabel", params.targetLabel);
|
|
979
979
|
endpoint.addAdditionalParam("metric", params.metric);
|
|
980
980
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
981
981
|
return this.callApi({
|
|
982
|
-
type:
|
|
982
|
+
type: _chunkXZCCIKX3js.Modules.TokenUsageReportBreakdown,
|
|
983
983
|
method: "GET" /* GET */,
|
|
984
984
|
endpoint: endpoint.generate()
|
|
985
985
|
});
|
|
@@ -1058,7 +1058,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1058
1058
|
|
|
1059
1059
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1060
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,
|
|
1061
|
-
|
|
1061
|
+
_chunkY7JIQNM6js.DateRangeSelector,
|
|
1062
1062
|
{
|
|
1063
1063
|
onDateChange: (range) => {
|
|
1064
1064
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1091,7 +1091,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1091
1091
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1092
1092
|
}) => {
|
|
1093
1093
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1094
|
-
const generateUrl =
|
|
1094
|
+
const generateUrl = _chunkY7JIQNM6js.usePageUrlGenerator.call(void 0, );
|
|
1095
1095
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1096
1096
|
const range = defaultRange2();
|
|
1097
1097
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1155,7 +1155,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1155
1155
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1156
1156
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1157
1157
|
);
|
|
1158
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1158
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1159
1159
|
}, "TokenUsageReportProvider");
|
|
1160
1160
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1161
1161
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1175,7 +1175,7 @@ var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (
|
|
|
1175
1175
|
var ZERO2 = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
1176
1176
|
function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
1177
1177
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1178
|
-
const { decimal, metricValue: formatValue } =
|
|
1178
|
+
const { decimal, metricValue: formatValue } = _chunkV4I3XKOMjs.useUsageFormatters.call(void 0, );
|
|
1179
1179
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (window) => _nullishCoalesce(summary.find((row) => row.window === window), () => ( ZERO2)), "rowFor");
|
|
1180
1180
|
const current = rowFor("current");
|
|
1181
1181
|
const previous = rowFor("previous");
|
|
@@ -1183,15 +1183,15 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1183
1183
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1184
1184
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1185
1185
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1186
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1186
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "grid gap-1", children: [
|
|
1187
1187
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1188
|
-
/* @__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(_chunkV4I3XKOMjs.metricValue.call(void 0, current, metric), metric) }),
|
|
1189
1189
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
1190
1190
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1191
1191
|
Delta2,
|
|
1192
1192
|
{
|
|
1193
1193
|
testId: "tile-used-delta",
|
|
1194
|
-
delta:
|
|
1194
|
+
delta: _chunkV4I3XKOMjs.percentageDelta.call(void 0, _chunkV4I3XKOMjs.metricValue.call(void 0, current, metric), _chunkV4I3XKOMjs.metricValue.call(void 0, previous, metric)),
|
|
1195
1195
|
decimal
|
|
1196
1196
|
}
|
|
1197
1197
|
),
|
|
@@ -1199,21 +1199,21 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1199
1199
|
] })
|
|
1200
1200
|
] }) }),
|
|
1201
1201
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1202
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1202
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "grid gap-1", children: [
|
|
1203
1203
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1204
1204
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1205
|
-
/* @__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: _chunkXZCCIKX3js.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
1206
1206
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground text-xs tabular-nums", children: [
|
|
1207
1207
|
"/ ",
|
|
1208
1208
|
whole(balances.monthlyCredits)
|
|
1209
1209
|
] })
|
|
1210
1210
|
] })
|
|
1211
1211
|
] }) }),
|
|
1212
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1212
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "grid gap-1", children: [
|
|
1213
1213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1214
1214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1215
1215
|
] }) }),
|
|
1216
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "grid gap-1", children: [
|
|
1217
1217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1218
1218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1219
1219
|
] }) })
|
|
@@ -1235,7 +1235,7 @@ function Delta2({
|
|
|
1235
1235
|
"span",
|
|
1236
1236
|
{
|
|
1237
1237
|
"data-testid": testId,
|
|
1238
|
-
className:
|
|
1238
|
+
className: _chunkXZCCIKX3js.cn.call(void 0,
|
|
1239
1239
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
1240
1240
|
increased ? "text-warning" : "text-success"
|
|
1241
1241
|
),
|
|
@@ -1255,21 +1255,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1255
1255
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1256
1256
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1257
1257
|
if (error) {
|
|
1258
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1258
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1259
1259
|
}
|
|
1260
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1260
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1261
1261
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1262
1262
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1263
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1263
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1264
1264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1265
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1267
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1265
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
1266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1268
1268
|
] }),
|
|
1269
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
1270
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1271
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1272
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkXZCCIKX3js.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1270
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
1271
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1273
1273
|
TokenUsageRankedBar,
|
|
1274
1274
|
{
|
|
1275
1275
|
rows: byOperation,
|
|
@@ -1279,9 +1279,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
) })
|
|
1281
1281
|
] }),
|
|
1282
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1283
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1284
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1282
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
1283
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: targetTitle }) }),
|
|
1284
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1285
1285
|
] })
|
|
1286
1286
|
] })
|
|
1287
1287
|
] }) });
|
|
@@ -1319,5 +1319,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, TokenUsageReportContainer, "TokenUsageRepor
|
|
|
1319
1319
|
|
|
1320
1320
|
|
|
1321
1321
|
|
|
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 =
|
|
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 = _chunkXZCCIKX3js.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkXZCCIKX3js.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkXZCCIKX3js.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkXZCCIKX3js.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkXZCCIKX3js.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkXZCCIKX3js.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkXZCCIKX3js.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkXZCCIKX3js.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkXZCCIKX3js.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkXZCCIKX3js.configureTokenUsage; exports.createUsageFormatters = _chunkV4I3XKOMjs.createUsageFormatters; exports.getTokenUsageCurrency = _chunkXZCCIKX3js.getTokenUsageCurrency; exports.tokenUsageModules = _chunkXZCCIKX3js.tokenUsageModules; exports.useTokenUsageAdmin = useTokenUsageAdmin; exports.useTokenUsageReport = useTokenUsageReport; exports.useUsageFormatters = _chunkV4I3XKOMjs.useUsageFormatters;
|
|
1323
1323
|
//# sourceMappingURL=index.js.map
|