@carlonicora/nextjs-jsonapi 5.4.0 → 5.5.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-YQL2SGFR.mjs → BlockNoteEditor-GVQCKRMU.mjs} +5 -5
- package/dist/{BlockNoteEditor-4YCAIEPT.js → BlockNoteEditor-THBJH2UR.js} +20 -20
- package/dist/{BlockNoteEditor-4YCAIEPT.js.map → BlockNoteEditor-THBJH2UR.js.map} +1 -1
- package/dist/{BlockNoteViewer-AEJKJ27Q.mjs → BlockNoteViewer-U6E3DS4F.mjs} +3 -3
- package/dist/{BlockNoteViewer-YL3J7J2Y.js → BlockNoteViewer-VZOVKTFO.js} +4 -4
- package/dist/{BlockNoteViewer-YL3J7J2Y.js.map → BlockNoteViewer-VZOVKTFO.js.map} +1 -1
- package/dist/billing/index.js +442 -442
- package/dist/billing/index.mjs +4 -4
- package/dist/{chunk-XCHSX3VC.mjs → chunk-3CGROPF3.mjs} +2 -2
- package/dist/{chunk-QMYQRPQC.mjs → chunk-6SQYXUVP.mjs} +2 -2
- package/dist/{chunk-NFBOSPNJ.js → chunk-G6UE6MEP.js} +59 -19
- package/dist/chunk-G6UE6MEP.js.map +1 -0
- package/dist/{chunk-YNCQSWQW.js → chunk-S4YJ5WCW.js} +8 -8
- package/dist/{chunk-YNCQSWQW.js.map → chunk-S4YJ5WCW.js.map} +1 -1
- package/dist/{chunk-3NLAXVIN.js → chunk-TY5FYP3G.js} +917 -881
- package/dist/chunk-TY5FYP3G.js.map +1 -0
- package/dist/{chunk-WC63PJSC.mjs → chunk-VC5A3AUZ.mjs} +61 -21
- package/dist/chunk-VC5A3AUZ.mjs.map +1 -0
- package/dist/{chunk-6DC2WVVB.mjs → chunk-W7F5BDSV.mjs} +2 -2
- package/dist/{chunk-5PPG6PL7.js → chunk-WPYT4UKJ.js} +3 -3
- package/dist/{chunk-5PPG6PL7.js.map → chunk-WPYT4UKJ.js.map} +1 -1
- package/dist/{chunk-EUKTBOI2.mjs → chunk-X5WIUUNG.mjs} +1471 -1435
- package/dist/chunk-X5WIUUNG.mjs.map +1 -0
- package/dist/{chunk-YW4ZCEWB.js → chunk-YDYVJM4I.js} +4 -4
- package/dist/{chunk-YW4ZCEWB.js.map → chunk-YDYVJM4I.js.map} +1 -1
- package/dist/client/index.js +5 -5
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +4 -4
- package/dist/components/editors/server.d.mts +15 -0
- package/dist/components/editors/server.d.ts +15 -0
- package/dist/components/editors/server.js +38 -0
- package/dist/components/editors/server.js.map +1 -0
- package/dist/components/editors/server.mjs +38 -0
- package/dist/components/editors/server.mjs.map +1 -0
- package/dist/components/index.d.mts +33 -10
- package/dist/components/index.d.ts +33 -10
- package/dist/components/index.js +7 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +8 -6
- package/dist/contexts/index.d.mts +9 -1
- package/dist/contexts/index.d.ts +9 -1
- package/dist/contexts/index.js +5 -5
- package/dist/contexts/index.mjs +4 -4
- package/dist/core/index.js +4 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +3 -3
- package/dist/email-automations/index.d.mts +3 -0
- package/dist/email-automations/index.d.ts +3 -0
- package/dist/email-automations/index.js +99 -95
- package/dist/email-automations/index.js.map +1 -1
- package/dist/email-automations/index.mjs +30 -26
- package/dist/email-automations/index.mjs.map +1 -1
- package/dist/features/analytics/index.d.mts +11 -4
- package/dist/features/analytics/index.d.ts +11 -4
- package/dist/features/analytics/index.js +127 -135
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +16 -24
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.d.mts +5 -2
- package/dist/features/analytics/server.d.ts +5 -2
- package/dist/features/analytics/server.js +7 -7
- package/dist/features/analytics/server.js.map +1 -1
- package/dist/features/analytics/server.mjs +5 -5
- package/dist/features/analytics/server.mjs.map +1 -1
- package/dist/features/blog/index.d.mts +12 -2
- package/dist/features/blog/index.d.ts +12 -2
- package/dist/features/blog/index.js +206 -195
- package/dist/features/blog/index.js.map +1 -1
- package/dist/features/blog/index.mjs +71 -60
- package/dist/features/blog/index.mjs.map +1 -1
- package/dist/features/blog/server.d.mts +4 -1
- package/dist/features/blog/server.d.ts +4 -1
- package/dist/features/blog/server.js +49 -21
- package/dist/features/blog/server.js.map +1 -1
- package/dist/features/blog/server.mjs +36 -8
- package/dist/features/blog/server.mjs.map +1 -1
- package/dist/features/help/index.js +38 -38
- package/dist/features/help/index.mjs +4 -4
- package/dist/features/tokenusage/index.d.mts +1 -3
- package/dist/features/tokenusage/index.d.ts +1 -3
- package/dist/features/tokenusage/index.js +127 -135
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +10 -18
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/server/index.js +4 -4
- package/dist/server/index.mjs +3 -3
- package/package.json +9 -1
- package/src/components/editors/server/BlockNoteServerContent.tsx +28 -0
- package/src/components/editors/server/__tests__/renderBlockNoteHTML.spec.ts +44 -0
- package/src/components/editors/server/renderBlockNoteHTML.ts +26 -0
- package/src/components/editors/server-entry.ts +7 -0
- package/src/components/index.ts +1 -0
- package/src/components/viewers/BlockNoteStaticViewer.tsx +44 -0
- package/src/features/administration/components/AdminIndexContainer.tsx +61 -33
- package/src/features/administration/components/__tests__/AdminIndexContainer.spec.tsx +61 -1
- package/src/features/administration/components/index.ts +2 -1
- package/src/features/administration/contexts/AdministrationContext.tsx +11 -3
- package/src/features/administration/contexts/__tests__/AdministrationContext.spec.tsx +40 -0
- package/src/features/ai-connection/ai-connection.module.ts +2 -0
- package/src/features/ai-connection/contexts/AiConnectionsContext.tsx +3 -16
- package/src/features/ai-connection/contexts/__tests__/AiConnectionsContext.spec.tsx +33 -0
- package/src/features/analytics/__tests__/server-entry.spec.tsx +2 -1
- package/src/features/analytics/analytics.modules.ts +22 -5
- package/src/features/analytics/components/AnalyticsAdminContainer.tsx +4 -3
- package/src/features/analytics/components/AnalyticsAdminPageContainer.tsx +6 -3
- package/src/features/analytics/components/AnalyticsJourneyContainer.tsx +4 -3
- package/src/features/analytics/components/__tests__/AnalyticsJourneyContainer.spec.tsx +11 -0
- package/src/features/analytics/components/__tests__/AnalyticsPageContainers.spec.tsx +12 -1
- package/src/features/analytics/components/server/AnalyticsAdminPage.tsx +6 -3
- package/src/features/analytics/contexts/AnalyticsAdminContext.tsx +8 -17
- package/src/features/analytics/contexts/__tests__/AnalyticsAdminContext.spec.tsx +17 -0
- package/src/features/billing/stripe-price/stripe-price.module.ts +2 -0
- package/src/features/billing/stripe-product/stripe-product.module.ts +2 -0
- package/src/features/blog/components/admin/BlogAdminContainer.tsx +13 -6
- package/src/features/blog/components/admin/BlogCategoriesList.tsx +1 -1
- package/src/features/blog/components/admin/BlogCoverImageField.tsx +1 -1
- package/src/features/blog/components/admin/BlogPostContainer.tsx +0 -1
- package/src/features/blog/components/admin/BlogPostEditor.tsx +42 -33
- package/src/features/blog/components/admin/BlogPostTranslationEditor.tsx +12 -4
- package/src/features/blog/components/admin/BlogPostsList.tsx +1 -1
- package/src/features/blog/components/public/BlogPostCard.tsx +2 -9
- package/src/features/blog/components/public/BlogPostMeta.tsx +2 -2
- package/src/features/blog/components/public/BlogPostView.tsx +9 -3
- package/src/features/blog/components/public/__tests__/BlogList.spec.tsx +2 -0
- package/src/features/blog/components/public/__tests__/BlogPostView.spec.tsx +17 -11
- package/src/features/blog/server/fetchers.ts +57 -8
- package/src/features/email-automation/components/containers/EmailAutomationsListContainer.tsx +12 -3
- package/src/features/rbac/contexts/RbacContext.tsx +4 -7
- package/src/features/rbac/contexts/__tests__/RbacContext.spec.tsx +42 -0
- package/src/features/tokenusage/components/TokenUsageAdminContainer.tsx +4 -3
- package/src/features/tokenusage/contexts/TokenUsageAdminContext.tsx +3 -18
- package/src/features/tokenusage/contexts/__tests__/TokenUsageAdminContext.spec.tsx +17 -0
- package/src/features/tokenusage/tokenusage-admin.module.ts +4 -3
- package/src/features/tokenusage/tokenusage.modules.ts +12 -2
- package/src/features/user/contexts/UserContext.tsx +18 -3
- package/src/features/user/contexts/__tests__/UserContext.spec.tsx +95 -0
- package/dist/chunk-3NLAXVIN.js.map +0 -1
- package/dist/chunk-EUKTBOI2.mjs.map +0 -1
- package/dist/chunk-NFBOSPNJ.js.map +0 -1
- package/dist/chunk-WC63PJSC.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-YQL2SGFR.mjs.map → BlockNoteEditor-GVQCKRMU.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-AEJKJ27Q.mjs.map → BlockNoteViewer-U6E3DS4F.mjs.map} +0 -0
- /package/dist/{chunk-XCHSX3VC.mjs.map → chunk-3CGROPF3.mjs.map} +0 -0
- /package/dist/{chunk-QMYQRPQC.mjs.map → chunk-6SQYXUVP.mjs.map} +0 -0
- /package/dist/{chunk-6DC2WVVB.mjs.map → chunk-W7F5BDSV.mjs.map} +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkWPYT4UKJjs = require('../../chunk-WPYT4UKJ.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -37,8 +37,8 @@ var _chunk5PPG6PL7js = require('../../chunk-5PPG6PL7.js');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
41
|
-
require('../../chunk-
|
|
40
|
+
var _chunkTY5FYP3Gjs = require('../../chunk-TY5FYP3G.js');
|
|
41
|
+
require('../../chunk-S4YJ5WCW.js');
|
|
42
42
|
require('../../chunk-G4JR3SFV.js');
|
|
43
43
|
|
|
44
44
|
|
|
@@ -57,10 +57,10 @@ require('../../chunk-G4JR3SFV.js');
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
var
|
|
60
|
+
var _chunkG6UE6MEPjs = require('../../chunk-G6UE6MEP.js');
|
|
61
|
+
require('../../chunk-GHE4VT2R.js');
|
|
61
62
|
require('../../chunk-LXKSUWAV.js');
|
|
62
63
|
require('../../chunk-JTPRJNT2.js');
|
|
63
|
-
require('../../chunk-GHE4VT2R.js');
|
|
64
64
|
require('../../chunk-3EPNHTMH.js');
|
|
65
65
|
|
|
66
66
|
|
|
@@ -82,7 +82,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
82
82
|
};
|
|
83
83
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
84
84
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
85
|
-
|
|
85
|
+
_chunkTY5FYP3Gjs.DateRangeSelector,
|
|
86
86
|
{
|
|
87
87
|
onDateChange: (range) => {
|
|
88
88
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -117,16 +117,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
117
117
|
}
|
|
118
118
|
),
|
|
119
119
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
120
|
-
|
|
120
|
+
_chunkTY5FYP3Gjs.Select,
|
|
121
121
|
{
|
|
122
122
|
items: companyItems,
|
|
123
123
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
124
124
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
125
125
|
children: [
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
127
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
127
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.SelectContent, { children: [
|
|
128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
129
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
130
130
|
] })
|
|
131
131
|
]
|
|
132
132
|
}
|
|
@@ -149,13 +149,13 @@ function Segmented({
|
|
|
149
149
|
children: options.map((option) => {
|
|
150
150
|
const selected = option.value === value;
|
|
151
151
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
152
|
-
|
|
152
|
+
_chunkTY5FYP3Gjs.Button,
|
|
153
153
|
{
|
|
154
154
|
type: "button",
|
|
155
155
|
size: "sm",
|
|
156
156
|
variant: selected ? "default" : "ghost",
|
|
157
157
|
"aria-pressed": selected,
|
|
158
|
-
className:
|
|
158
|
+
className: _chunkG6UE6MEPjs.cn.call(void 0, !selected && "text-muted-foreground"),
|
|
159
159
|
onClick: () => onSelect(option.value),
|
|
160
160
|
children: option.label
|
|
161
161
|
},
|
|
@@ -175,36 +175,36 @@ function withFilters(endpoint, filters) {
|
|
|
175
175
|
return endpoint;
|
|
176
176
|
}
|
|
177
177
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters, "withFilters");
|
|
178
|
-
var TokenUsageAdminService = class extends
|
|
178
|
+
var TokenUsageAdminService = class extends _chunkG6UE6MEPjs.AbstractService {
|
|
179
179
|
static {
|
|
180
180
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageAdminService");
|
|
181
181
|
}
|
|
182
182
|
/** Six rows: {customer, platform, total} × {current, previous}. */
|
|
183
183
|
static async getSummary(filters) {
|
|
184
|
-
const endpoint = withFilters(new (0,
|
|
184
|
+
const endpoint = withFilters(new (0, _chunkG6UE6MEPjs.EndpointCreator)({ endpoint: _chunkG6UE6MEPjs.Modules.TokenUsageAdminSummary }), filters);
|
|
185
185
|
return this.callApi({
|
|
186
|
-
type:
|
|
186
|
+
type: _chunkG6UE6MEPjs.Modules.TokenUsageAdminSummary,
|
|
187
187
|
method: "GET" /* GET */,
|
|
188
188
|
endpoint: endpoint.generate()
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
static async getTimeline(params) {
|
|
192
|
-
const endpoint = withFilters(new (0,
|
|
192
|
+
const endpoint = withFilters(new (0, _chunkG6UE6MEPjs.EndpointCreator)({ endpoint: _chunkG6UE6MEPjs.Modules.TokenUsageAdminTimeline }), params);
|
|
193
193
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
194
194
|
endpoint.addAdditionalParam("stackBy", params.stackBy);
|
|
195
195
|
return this.callApi({
|
|
196
|
-
type:
|
|
196
|
+
type: _chunkG6UE6MEPjs.Modules.TokenUsageAdminTimeline,
|
|
197
197
|
method: "GET" /* GET */,
|
|
198
198
|
endpoint: endpoint.generate()
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
static async getBreakdown(params) {
|
|
202
|
-
const endpoint = withFilters(new (0,
|
|
202
|
+
const endpoint = withFilters(new (0, _chunkG6UE6MEPjs.EndpointCreator)({ endpoint: _chunkG6UE6MEPjs.Modules.TokenUsageAdminBreakdown }), params);
|
|
203
203
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
204
204
|
endpoint.addAdditionalParam("scope", params.scope);
|
|
205
205
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
206
206
|
return this.callApi({
|
|
207
|
-
type:
|
|
207
|
+
type: _chunkG6UE6MEPjs.Modules.TokenUsageAdminBreakdown,
|
|
208
208
|
method: "GET" /* GET */,
|
|
209
209
|
endpoint: endpoint.generate()
|
|
210
210
|
});
|
|
@@ -213,7 +213,6 @@ var TokenUsageAdminService = class extends _chunkNFBOSPNJjs.AbstractService {
|
|
|
213
213
|
|
|
214
214
|
// src/features/tokenusage/contexts/TokenUsageAdminContext.tsx
|
|
215
215
|
|
|
216
|
-
var TOKEN_USAGE_ADMIN_PAGE_URL = "/administration/token-usage";
|
|
217
216
|
var DEFAULT_TOP_N = 10;
|
|
218
217
|
var TokenUsageAdminContext = _react.createContext.call(void 0, void 0);
|
|
219
218
|
function defaultRange() {
|
|
@@ -227,11 +226,9 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
227
226
|
initialCompanyId,
|
|
228
227
|
initialFrom,
|
|
229
228
|
initialTo,
|
|
230
|
-
topN = DEFAULT_TOP_N
|
|
231
|
-
pageUrl = TOKEN_USAGE_ADMIN_PAGE_URL
|
|
229
|
+
topN = DEFAULT_TOP_N
|
|
232
230
|
}) => {
|
|
233
231
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
234
|
-
const generateUrl = _chunk3NLAXVINjs.usePageUrlGenerator.call(void 0, );
|
|
235
232
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
236
233
|
const range = defaultRange();
|
|
237
234
|
return {
|
|
@@ -297,12 +294,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
297
294
|
() => byCompany.filter((row) => row.id !== "other").map((row) => ({ id: row.id, label: row.label })),
|
|
298
295
|
[byCompany]
|
|
299
296
|
);
|
|
300
|
-
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => [
|
|
301
|
-
{
|
|
302
|
-
name: t("token_usage.admin.title"),
|
|
303
|
-
href: generateUrl({ page: pageUrl })
|
|
304
|
-
}
|
|
305
|
-
], "breadcrumb");
|
|
297
|
+
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => [{ name: t("token_usage.admin.title") }], "breadcrumb");
|
|
306
298
|
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => ({
|
|
307
299
|
type: t("token_usage.admin.title"),
|
|
308
300
|
functions: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -349,7 +341,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
349
341
|
error
|
|
350
342
|
]
|
|
351
343
|
);
|
|
352
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
344
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
353
345
|
}, "TokenUsageAdminProvider");
|
|
354
346
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
355
347
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -370,7 +362,7 @@ var _lucidereact = require('lucide-react');
|
|
|
370
362
|
var ZERO = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
371
363
|
function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
372
364
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
373
|
-
const { decimal, metricValue: formatValue, currency, percent } =
|
|
365
|
+
const { decimal, metricValue: formatValue, currency, percent } = _chunkWPYT4UKJjs.useUsageFormatters.call(void 0, );
|
|
374
366
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (scope, window) => _nullishCoalesce(summary.find((r) => r.scope === scope && r.window === window), () => ( ZERO)), "rowFor");
|
|
375
367
|
const customerCurrent = rowFor("customer", "current");
|
|
376
368
|
const customerPrevious = rowFor("customer", "previous");
|
|
@@ -379,16 +371,16 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
379
371
|
const totalCurrent = rowFor("total", "current");
|
|
380
372
|
const totalPrevious = rowFor("total", "previous");
|
|
381
373
|
const averagePerCall = totalCurrent.calls ? totalCurrent.cost / totalCurrent.calls : 0;
|
|
382
|
-
const cacheHit =
|
|
374
|
+
const cacheHit = _chunkWPYT4UKJjs.cacheHitPercentage.call(void 0, totalCurrent.cached, totalCurrent.tokensIn);
|
|
383
375
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
384
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
376
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkG6UE6MEPjs.cn.call(void 0, "grid gap-3", singleCustomerMode ? "sm:grid-cols-1" : "sm:grid-cols-2"), children: [
|
|
385
377
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
386
378
|
LeadTile,
|
|
387
379
|
{
|
|
388
380
|
testId: "tile-customer",
|
|
389
381
|
label: t("token_usage.admin.customer_spend"),
|
|
390
|
-
value: formatValue(
|
|
391
|
-
delta:
|
|
382
|
+
value: formatValue(_chunkWPYT4UKJjs.metricValue.call(void 0, customerCurrent, metric), metric),
|
|
383
|
+
delta: _chunkWPYT4UKJjs.percentageDelta.call(void 0, _chunkWPYT4UKJjs.metricValue.call(void 0, customerCurrent, metric), _chunkWPYT4UKJjs.metricValue.call(void 0, customerPrevious, metric)),
|
|
392
384
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
393
385
|
decimal
|
|
394
386
|
}
|
|
@@ -398,8 +390,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
398
390
|
{
|
|
399
391
|
testId: "tile-platform",
|
|
400
392
|
label: t("token_usage.admin.platform_spend"),
|
|
401
|
-
value: formatValue(
|
|
402
|
-
delta:
|
|
393
|
+
value: formatValue(_chunkWPYT4UKJjs.metricValue.call(void 0, platformCurrent, metric), metric),
|
|
394
|
+
delta: _chunkWPYT4UKJjs.percentageDelta.call(void 0, _chunkWPYT4UKJjs.metricValue.call(void 0, platformCurrent, metric), _chunkWPYT4UKJjs.metricValue.call(void 0, platformPrevious, metric)),
|
|
403
395
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
404
396
|
decimal
|
|
405
397
|
}
|
|
@@ -411,8 +403,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
411
403
|
{
|
|
412
404
|
testId: "tile-total",
|
|
413
405
|
label: t("token_usage.admin.total_cost"),
|
|
414
|
-
value: formatValue(
|
|
415
|
-
delta:
|
|
406
|
+
value: formatValue(_chunkWPYT4UKJjs.metricValue.call(void 0, totalCurrent, metric), metric),
|
|
407
|
+
delta: _chunkWPYT4UKJjs.percentageDelta.call(void 0, _chunkWPYT4UKJjs.metricValue.call(void 0, totalCurrent, metric), _chunkWPYT4UKJjs.metricValue.call(void 0, totalPrevious, metric)),
|
|
416
408
|
decimal
|
|
417
409
|
}
|
|
418
410
|
),
|
|
@@ -446,7 +438,7 @@ function LeadTile({
|
|
|
446
438
|
previousLabel,
|
|
447
439
|
decimal
|
|
448
440
|
}) {
|
|
449
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
441
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "grid gap-1", children: [
|
|
450
442
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
451
443
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
452
444
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -463,7 +455,7 @@ function SupportingTile({
|
|
|
463
455
|
delta,
|
|
464
456
|
decimal
|
|
465
457
|
}) {
|
|
466
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
458
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "grid gap-1", children: [
|
|
467
459
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
468
460
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
469
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -486,7 +478,7 @@ function Delta({
|
|
|
486
478
|
"span",
|
|
487
479
|
{
|
|
488
480
|
"data-testid": testId,
|
|
489
|
-
className:
|
|
481
|
+
className: _chunkG6UE6MEPjs.cn.call(void 0,
|
|
490
482
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
491
483
|
increased ? "text-success" : "text-destructive"
|
|
492
484
|
),
|
|
@@ -507,10 +499,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, Delta, "Delta");
|
|
|
507
499
|
|
|
508
500
|
function TokenUsageBreakdownTable({ rows, metric }) {
|
|
509
501
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
510
|
-
const { decimal, metricValue: formatValue, percent, compare } =
|
|
502
|
+
const { decimal, metricValue: formatValue, percent, compare } = _chunkWPYT4UKJjs.useUsageFormatters.call(void 0, );
|
|
511
503
|
const [sort, setSort] = _react.useState.call(void 0, void 0);
|
|
512
504
|
const showActiveUsers = rows.some((row) => row.activeUsers !== void 0);
|
|
513
|
-
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum +
|
|
505
|
+
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum + _chunkWPYT4UKJjs.metricValue.call(void 0, row, metric), 0), [rows, metric]);
|
|
514
506
|
const sortValue = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row, key) => {
|
|
515
507
|
switch (key) {
|
|
516
508
|
case "label":
|
|
@@ -520,9 +512,9 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
520
512
|
case "activeUsers":
|
|
521
513
|
return _nullishCoalesce(row.activeUsers, () => ( 0));
|
|
522
514
|
case "cacheHit":
|
|
523
|
-
return
|
|
515
|
+
return _chunkWPYT4UKJjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn);
|
|
524
516
|
case "share":
|
|
525
|
-
return
|
|
517
|
+
return _chunkWPYT4UKJjs.metricValue.call(void 0, row, metric);
|
|
526
518
|
default:
|
|
527
519
|
return row[key];
|
|
528
520
|
}
|
|
@@ -560,13 +552,13 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
560
552
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
561
553
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
562
554
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
563
|
-
/* @__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,
|
|
564
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Table, { children: [
|
|
556
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { className: _chunkG6UE6MEPjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
565
557
|
"button",
|
|
566
558
|
{
|
|
567
559
|
type: "button",
|
|
568
560
|
onClick: () => toggleSort(column.key),
|
|
569
|
-
className:
|
|
561
|
+
className: _chunkG6UE6MEPjs.cn.call(void 0,
|
|
570
562
|
"hover:text-primary inline-flex items-center gap-1 text-xs font-medium",
|
|
571
563
|
column.numeric && "flex-row-reverse"
|
|
572
564
|
),
|
|
@@ -576,20 +568,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
576
568
|
]
|
|
577
569
|
}
|
|
578
570
|
) }, column.key)) }) }),
|
|
579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
580
|
-
const value =
|
|
571
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableBody, { children: sortedRows.map((row) => {
|
|
572
|
+
const value = _chunkWPYT4UKJjs.metricValue.call(void 0, row, metric);
|
|
581
573
|
const share = total > 0 ? value / total * 100 : 0;
|
|
582
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
584
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
585
|
-
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
586
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
587
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
588
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
589
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
590
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
591
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
592
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
574
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
576
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
577
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunkWPYT4UKJjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
593
585
|
] }, row.id);
|
|
594
586
|
}) })
|
|
595
587
|
] }) })
|
|
@@ -618,7 +610,7 @@ var operationLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (type,
|
|
|
618
610
|
|
|
619
611
|
function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes = false }) {
|
|
620
612
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
621
|
-
const { metricValue: formatValue, percent } =
|
|
613
|
+
const { metricValue: formatValue, percent } = _chunkWPYT4UKJjs.useUsageFormatters.call(void 0, );
|
|
622
614
|
const renderLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
623
615
|
if (row.id === "other") return t("token_usage.admin.other");
|
|
624
616
|
if (!labelsAreOperationTypes) return row.label;
|
|
@@ -631,13 +623,13 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
631
623
|
if (rows.length === 0) {
|
|
632
624
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground py-6 text-center text-sm", children: emptyLabel });
|
|
633
625
|
}
|
|
634
|
-
const values = rows.map((row) =>
|
|
626
|
+
const values = rows.map((row) => _chunkWPYT4UKJjs.metricValue.call(void 0, row, metric));
|
|
635
627
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
636
628
|
const max = Math.max(...values, 0);
|
|
637
629
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid gap-0.5", children: rows.map((row, index) => {
|
|
638
630
|
const value = values[index];
|
|
639
631
|
const isOther = row.id === "other";
|
|
640
|
-
const step = isOther ?
|
|
632
|
+
const step = isOther ? _chunkWPYT4UKJjs.SEQUENTIAL_RAMP.length - 1 : Math.min(index, _chunkWPYT4UKJjs.SEQUENTIAL_RAMP.length - 1);
|
|
641
633
|
const width = max > 0 ? value / max * 100 : 0;
|
|
642
634
|
const share = total > 0 ? value / total * 100 : 0;
|
|
643
635
|
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: [
|
|
@@ -649,7 +641,7 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
649
641
|
"data-testid": `ranked-fill-${row.id}`,
|
|
650
642
|
"data-ramp-step": String(step),
|
|
651
643
|
className: "h-full rounded-r-[4px]",
|
|
652
|
-
style: { width: `${width}%`, backgroundColor:
|
|
644
|
+
style: { width: `${width}%`, backgroundColor: _chunkWPYT4UKJjs.SEQUENTIAL_RAMP[step] }
|
|
653
645
|
}
|
|
654
646
|
) })
|
|
655
647
|
] }),
|
|
@@ -699,7 +691,7 @@ var inferGranularity = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (buc
|
|
|
699
691
|
}, "inferGranularity");
|
|
700
692
|
function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
701
693
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
702
|
-
const { compact, bucketDate, metricValue: formatValue } =
|
|
694
|
+
const { compact, bucketDate, metricValue: formatValue } = _chunkWPYT4UKJjs.useUsageFormatters.call(void 0, );
|
|
703
695
|
const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
|
|
704
696
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
705
697
|
const { chartData, seriesKeys } = _react.useMemo.call(void 0, () => {
|
|
@@ -707,8 +699,8 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
707
699
|
const totals = /* @__PURE__ */ new Map();
|
|
708
700
|
for (const row of rows) totals.set(row.series, (_nullishCoalesce(totals.get(row.series), () => ( 0))) + metricValue2(row, metric));
|
|
709
701
|
const ranked = [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([series]) => series);
|
|
710
|
-
const named = ranked.slice(0,
|
|
711
|
-
const folded = new Set(ranked.slice(
|
|
702
|
+
const named = ranked.slice(0, _chunkWPYT4UKJjs.CATEGORICAL_CEILING);
|
|
703
|
+
const folded = new Set(ranked.slice(_chunkWPYT4UKJjs.CATEGORICAL_CEILING));
|
|
712
704
|
const keys = folded.size > 0 ? [...named, OTHER_SERIES] : named;
|
|
713
705
|
const byBucket = /* @__PURE__ */ new Map();
|
|
714
706
|
for (const row of rows) {
|
|
@@ -748,7 +740,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
748
740
|
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" });
|
|
749
741
|
}
|
|
750
742
|
const granularity = inferGranularity(chartData.map((entry) => entry.bucket));
|
|
751
|
-
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ?
|
|
743
|
+
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ? _chunkWPYT4UKJjs.OTHER_COLOR : _chunkWPYT4UKJjs.seriesColor.call(void 0, index, mode), "seriesColorFor");
|
|
752
744
|
return (
|
|
753
745
|
// The chart is a coordinate system, not prose: recharts lays the axes and the
|
|
754
746
|
// stacked bars out left-to-right, so the whole chart stays an LTR island even
|
|
@@ -757,7 +749,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
757
749
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
758
750
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
759
751
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
760
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.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: [
|
|
761
753
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
762
754
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
763
755
|
_recharts.XAxis,
|
|
@@ -781,10 +773,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
781
773
|
}
|
|
782
774
|
),
|
|
783
775
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
-
|
|
776
|
+
_chunkTY5FYP3Gjs.ChartTooltip,
|
|
785
777
|
{
|
|
786
778
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
787
|
-
|
|
779
|
+
_chunkTY5FYP3Gjs.ChartTooltipContent,
|
|
788
780
|
{
|
|
789
781
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
790
782
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -793,7 +785,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
793
785
|
)
|
|
794
786
|
}
|
|
795
787
|
),
|
|
796
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
788
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.ChartLegendContent, {}) }) : null,
|
|
797
789
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
798
790
|
_recharts.Bar,
|
|
799
791
|
{
|
|
@@ -845,19 +837,19 @@ function TokenUsageAdminContainer() {
|
|
|
845
837
|
[t]
|
|
846
838
|
);
|
|
847
839
|
if (error) {
|
|
848
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
840
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { module: _chunkG6UE6MEPjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
849
841
|
}
|
|
850
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
842
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { module: _chunkG6UE6MEPjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
851
843
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
852
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
844
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { module: _chunkG6UE6MEPjs.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: [
|
|
853
845
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
854
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
855
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
856
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
857
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
846
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
847
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: [
|
|
848
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
849
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
858
850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
859
851
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
860
|
-
|
|
852
|
+
_chunkTY5FYP3Gjs.Select,
|
|
861
853
|
{
|
|
862
854
|
items: stackByItems,
|
|
863
855
|
value: filters.stackBy,
|
|
@@ -865,29 +857,29 @@ function TokenUsageAdminContainer() {
|
|
|
865
857
|
if (value) setFilters({ stackBy: value });
|
|
866
858
|
},
|
|
867
859
|
children: [
|
|
868
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
869
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
860
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectValue, {}) }),
|
|
861
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
870
862
|
]
|
|
871
863
|
}
|
|
872
864
|
)
|
|
873
865
|
] }) })
|
|
874
866
|
] }),
|
|
875
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
876
868
|
] }),
|
|
877
869
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
878
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
879
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
870
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
881
873
|
] }),
|
|
882
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
883
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
884
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
874
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
875
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
876
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
885
877
|
] })
|
|
886
878
|
] }),
|
|
887
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
888
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
889
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
890
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
879
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkG6UE6MEPjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
891
883
|
TokenUsageRankedBar,
|
|
892
884
|
{
|
|
893
885
|
rows: byCustomerOperation,
|
|
@@ -897,9 +889,9 @@ function TokenUsageAdminContainer() {
|
|
|
897
889
|
}
|
|
898
890
|
) })
|
|
899
891
|
] }),
|
|
900
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
901
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
902
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
892
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
893
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
903
895
|
TokenUsageRankedBar,
|
|
904
896
|
{
|
|
905
897
|
rows: byOperation,
|
|
@@ -910,9 +902,9 @@ function TokenUsageAdminContainer() {
|
|
|
910
902
|
) })
|
|
911
903
|
] })
|
|
912
904
|
] }),
|
|
913
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
914
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
915
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
905
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
906
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
916
908
|
] })
|
|
917
909
|
] }) });
|
|
918
910
|
}
|
|
@@ -925,36 +917,36 @@ function withFilters2(endpoint, filters) {
|
|
|
925
917
|
return endpoint;
|
|
926
918
|
}
|
|
927
919
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters2, "withFilters");
|
|
928
|
-
var TokenUsageReportService = class extends
|
|
920
|
+
var TokenUsageReportService = class extends _chunkG6UE6MEPjs.AbstractService {
|
|
929
921
|
static {
|
|
930
922
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageReportService");
|
|
931
923
|
}
|
|
932
924
|
/** Two rows: window "current" and "previous". */
|
|
933
925
|
static async getSummary(filters) {
|
|
934
|
-
const endpoint = withFilters2(new (0,
|
|
926
|
+
const endpoint = withFilters2(new (0, _chunkG6UE6MEPjs.EndpointCreator)({ endpoint: _chunkG6UE6MEPjs.Modules.TokenUsageReportSummary }), filters);
|
|
935
927
|
return this.callApi({
|
|
936
|
-
type:
|
|
928
|
+
type: _chunkG6UE6MEPjs.Modules.TokenUsageReportSummary,
|
|
937
929
|
method: "GET" /* GET */,
|
|
938
930
|
endpoint: endpoint.generate()
|
|
939
931
|
});
|
|
940
932
|
}
|
|
941
933
|
static async getTimeline(params) {
|
|
942
|
-
const endpoint = withFilters2(new (0,
|
|
934
|
+
const endpoint = withFilters2(new (0, _chunkG6UE6MEPjs.EndpointCreator)({ endpoint: _chunkG6UE6MEPjs.Modules.TokenUsageReportTimeline }), params);
|
|
943
935
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
944
936
|
return this.callApi({
|
|
945
|
-
type:
|
|
937
|
+
type: _chunkG6UE6MEPjs.Modules.TokenUsageReportTimeline,
|
|
946
938
|
method: "GET" /* GET */,
|
|
947
939
|
endpoint: endpoint.generate()
|
|
948
940
|
});
|
|
949
941
|
}
|
|
950
942
|
static async getBreakdown(params) {
|
|
951
|
-
const endpoint = withFilters2(new (0,
|
|
943
|
+
const endpoint = withFilters2(new (0, _chunkG6UE6MEPjs.EndpointCreator)({ endpoint: _chunkG6UE6MEPjs.Modules.TokenUsageReportBreakdown }), params);
|
|
952
944
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
953
945
|
if (params.targetLabel) endpoint.addAdditionalParam("targetLabel", params.targetLabel);
|
|
954
946
|
endpoint.addAdditionalParam("metric", params.metric);
|
|
955
947
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
956
948
|
return this.callApi({
|
|
957
|
-
type:
|
|
949
|
+
type: _chunkG6UE6MEPjs.Modules.TokenUsageReportBreakdown,
|
|
958
950
|
method: "GET" /* GET */,
|
|
959
951
|
endpoint: endpoint.generate()
|
|
960
952
|
});
|
|
@@ -1033,7 +1025,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1033
1025
|
|
|
1034
1026
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1035
1027
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-help": "tokenusage.filters", className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1036
|
-
|
|
1028
|
+
_chunkTY5FYP3Gjs.DateRangeSelector,
|
|
1037
1029
|
{
|
|
1038
1030
|
onDateChange: (range) => {
|
|
1039
1031
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1066,7 +1058,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1066
1058
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1067
1059
|
}) => {
|
|
1068
1060
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1069
|
-
const generateUrl =
|
|
1061
|
+
const generateUrl = _chunkTY5FYP3Gjs.usePageUrlGenerator.call(void 0, );
|
|
1070
1062
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1071
1063
|
const range = defaultRange2();
|
|
1072
1064
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1130,7 +1122,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1130
1122
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1131
1123
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1132
1124
|
);
|
|
1133
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1125
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1134
1126
|
}, "TokenUsageReportProvider");
|
|
1135
1127
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1136
1128
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1150,7 +1142,7 @@ var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (
|
|
|
1150
1142
|
var ZERO2 = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
1151
1143
|
function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
1152
1144
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1153
|
-
const { decimal, metricValue: formatValue } =
|
|
1145
|
+
const { decimal, metricValue: formatValue } = _chunkWPYT4UKJjs.useUsageFormatters.call(void 0, );
|
|
1154
1146
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (window) => _nullishCoalesce(summary.find((row) => row.window === window), () => ( ZERO2)), "rowFor");
|
|
1155
1147
|
const current = rowFor("current");
|
|
1156
1148
|
const previous = rowFor("previous");
|
|
@@ -1158,15 +1150,15 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1158
1150
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1159
1151
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1160
1152
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1161
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "grid gap-1", children: [
|
|
1162
1154
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1163
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(
|
|
1155
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunkWPYT4UKJjs.metricValue.call(void 0, current, metric), metric) }),
|
|
1164
1156
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
1165
1157
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1166
1158
|
Delta2,
|
|
1167
1159
|
{
|
|
1168
1160
|
testId: "tile-used-delta",
|
|
1169
|
-
delta:
|
|
1161
|
+
delta: _chunkWPYT4UKJjs.percentageDelta.call(void 0, _chunkWPYT4UKJjs.metricValue.call(void 0, current, metric), _chunkWPYT4UKJjs.metricValue.call(void 0, previous, metric)),
|
|
1170
1162
|
decimal
|
|
1171
1163
|
}
|
|
1172
1164
|
),
|
|
@@ -1174,21 +1166,21 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1174
1166
|
] })
|
|
1175
1167
|
] }) }),
|
|
1176
1168
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1177
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1169
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "grid gap-1", children: [
|
|
1178
1170
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1179
1171
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1180
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className:
|
|
1172
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunkG6UE6MEPjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
1181
1173
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground text-xs tabular-nums", children: [
|
|
1182
1174
|
"/ ",
|
|
1183
1175
|
whole(balances.monthlyCredits)
|
|
1184
1176
|
] })
|
|
1185
1177
|
] })
|
|
1186
1178
|
] }) }),
|
|
1187
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1179
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "grid gap-1", children: [
|
|
1188
1180
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1189
1181
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1190
1182
|
] }) }),
|
|
1191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1183
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "grid gap-1", children: [
|
|
1192
1184
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1193
1185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1194
1186
|
] }) })
|
|
@@ -1210,7 +1202,7 @@ function Delta2({
|
|
|
1210
1202
|
"span",
|
|
1211
1203
|
{
|
|
1212
1204
|
"data-testid": testId,
|
|
1213
|
-
className:
|
|
1205
|
+
className: _chunkG6UE6MEPjs.cn.call(void 0,
|
|
1214
1206
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
1215
1207
|
increased ? "text-warning" : "text-success"
|
|
1216
1208
|
),
|
|
@@ -1230,21 +1222,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1230
1222
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1231
1223
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1232
1224
|
if (error) {
|
|
1233
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1225
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1234
1226
|
}
|
|
1235
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1227
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1236
1228
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1237
1229
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1238
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1230
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1239
1231
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1240
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1241
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1242
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1232
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1243
1235
|
] }),
|
|
1244
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
1245
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1247
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1236
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkG6UE6MEPjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1237
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
1238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1248
1240
|
TokenUsageRankedBar,
|
|
1249
1241
|
{
|
|
1250
1242
|
rows: byOperation,
|
|
@@ -1254,9 +1246,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1254
1246
|
}
|
|
1255
1247
|
) })
|
|
1256
1248
|
] }),
|
|
1257
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1258
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1259
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1249
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
|
|
1250
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: targetTitle }) }),
|
|
1251
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1260
1252
|
] })
|
|
1261
1253
|
] })
|
|
1262
1254
|
] }) });
|
|
@@ -1294,5 +1286,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, TokenUsageReportContainer, "TokenUsageRepor
|
|
|
1294
1286
|
|
|
1295
1287
|
|
|
1296
1288
|
|
|
1297
|
-
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown =
|
|
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 = _chunkG6UE6MEPjs.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkG6UE6MEPjs.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkG6UE6MEPjs.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkG6UE6MEPjs.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkG6UE6MEPjs.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkG6UE6MEPjs.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkG6UE6MEPjs.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkG6UE6MEPjs.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkG6UE6MEPjs.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkG6UE6MEPjs.configureTokenUsage; exports.createUsageFormatters = _chunkWPYT4UKJjs.createUsageFormatters; exports.getTokenUsageCurrency = _chunkG6UE6MEPjs.getTokenUsageCurrency; exports.tokenUsageModules = _chunkG6UE6MEPjs.tokenUsageModules; exports.useTokenUsageAdmin = useTokenUsageAdmin; exports.useTokenUsageReport = useTokenUsageReport; exports.useUsageFormatters = _chunkWPYT4UKJjs.useUsageFormatters;
|
|
1298
1290
|
//# sourceMappingURL=index.js.map
|