@carlonicora/nextjs-jsonapi 6.12.2 → 6.13.1
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/{ApiData-DPKNfY-9.d.mts → ApiData-Be8yxCOX.d.mts} +2 -0
- package/dist/{ApiData-DPKNfY-9.d.ts → ApiData-Be8yxCOX.d.ts} +2 -0
- package/dist/{BlockNoteEditor-7M5QW2YQ.js → BlockNoteEditor-UBVEUFNR.js} +34 -22
- package/dist/BlockNoteEditor-UBVEUFNR.js.map +1 -0
- package/dist/{BlockNoteEditor-75ED2CN2.mjs → BlockNoteEditor-VXMDSQAA.mjs} +20 -8
- package/dist/BlockNoteEditor-VXMDSQAA.mjs.map +1 -0
- package/dist/{BlockNoteViewer-WGCDB7IJ.js → BlockNoteViewer-2XYASA5Y.js} +8 -5
- package/dist/BlockNoteViewer-2XYASA5Y.js.map +1 -0
- package/dist/{BlockNoteViewer-MTGS6YJV.mjs → BlockNoteViewer-NBW2H6LC.mjs} +7 -4
- package/dist/{BlockNoteViewer-MTGS6YJV.mjs.map → BlockNoteViewer-NBW2H6LC.mjs.map} +1 -1
- package/dist/{JsonApiRequest-A66XK5WT.mjs → JsonApiRequest-F6TMJ42G.mjs} +2 -2
- package/dist/JsonApiRequest-WISJZSDE.js +26 -0
- package/dist/{JsonApiRequest-FZGPLNUF.js.map → JsonApiRequest-WISJZSDE.js.map} +1 -1
- package/dist/billing/index.js +499 -494
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +13 -8
- package/dist/billing/index.mjs.map +1 -1
- package/dist/chunk-27LQDGNP.mjs +317 -0
- package/dist/chunk-27LQDGNP.mjs.map +1 -0
- package/dist/{chunk-KSYQEKJX.js → chunk-2SV4SS6N.js} +14 -14
- package/dist/{chunk-KSYQEKJX.js.map → chunk-2SV4SS6N.js.map} +1 -1
- package/dist/{chunk-4FNGWALA.mjs → chunk-47BBY5KA.mjs} +6 -4
- package/dist/{chunk-4FNGWALA.mjs.map → chunk-47BBY5KA.mjs.map} +1 -1
- package/dist/chunk-6JUCIWDC.mjs +570 -0
- package/dist/chunk-6JUCIWDC.mjs.map +1 -0
- package/dist/chunk-7DBJTNSU.mjs +1049 -0
- package/dist/chunk-7DBJTNSU.mjs.map +1 -0
- package/dist/chunk-7JZHPMGW.mjs +704 -0
- package/dist/chunk-7JZHPMGW.mjs.map +1 -0
- package/dist/{chunk-L6PYFQTO.js → chunk-7ZHTPFFT.js} +16 -14
- package/dist/chunk-7ZHTPFFT.js.map +1 -0
- package/dist/chunk-B6JGKDP2.js +214 -0
- package/dist/chunk-B6JGKDP2.js.map +1 -0
- package/dist/{chunk-3YW35YHQ.mjs → chunk-BH6JWIKI.mjs} +5 -5
- package/dist/chunk-BZ5J2FIV.js +570 -0
- package/dist/chunk-BZ5J2FIV.js.map +1 -0
- package/dist/{chunk-V5MI7RNB.mjs → chunk-DGWOVYEC.mjs} +2 -2
- package/dist/chunk-DOCIFE6A.mjs +212 -0
- package/dist/chunk-DOCIFE6A.mjs.map +1 -0
- package/dist/chunk-GB6DBFYY.js +25 -0
- package/dist/chunk-GB6DBFYY.js.map +1 -0
- package/dist/{chunk-EWCY6QJA.mjs → chunk-JJMMT24D.mjs} +37 -3
- package/dist/chunk-JJMMT24D.mjs.map +1 -0
- package/dist/{chunk-JTPRJNT2.js → chunk-KMW7UNL2.js} +38 -3
- package/dist/chunk-KMW7UNL2.js.map +1 -0
- package/dist/chunk-MHB36MYE.js +317 -0
- package/dist/chunk-MHB36MYE.js.map +1 -0
- package/dist/{chunk-FF4EIQ6H.js → chunk-MOGEGWXW.js} +1039 -1680
- package/dist/chunk-MOGEGWXW.js.map +1 -0
- package/dist/{chunk-RXQYEEKZ.mjs → chunk-N4RZZKL5.mjs} +58 -25
- package/dist/chunk-N4RZZKL5.mjs.map +1 -0
- package/dist/{chunk-AA52ORW2.mjs → chunk-P445QGOC.mjs} +61 -702
- package/dist/chunk-P445QGOC.mjs.map +1 -0
- package/dist/chunk-PV4Z5W6V.js +212 -0
- package/dist/chunk-PV4Z5W6V.js.map +1 -0
- package/dist/chunk-PXDUJ47N.js +1049 -0
- package/dist/chunk-PXDUJ47N.js.map +1 -0
- package/dist/{chunk-V3YDVJ63.js → chunk-PYRZCKC2.js} +1209 -1176
- package/dist/chunk-PYRZCKC2.js.map +1 -0
- package/dist/{chunk-GHE4VT2R.js → chunk-QKNGZDSQ.js} +2 -2
- package/dist/{chunk-GHE4VT2R.js.map → chunk-QKNGZDSQ.js.map} +1 -1
- package/dist/chunk-W62MHDWM.js +704 -0
- package/dist/chunk-W62MHDWM.js.map +1 -0
- package/dist/chunk-XXP3TQHF.mjs +25 -0
- package/dist/chunk-XXP3TQHF.mjs.map +1 -0
- package/dist/chunk-YRKIFYOE.mjs +214 -0
- package/dist/chunk-YRKIFYOE.mjs.map +1 -0
- package/dist/{chunk-O3PDL2CV.js → chunk-Z4POQWFG.js} +40 -6
- package/dist/chunk-Z4POQWFG.js.map +1 -0
- package/dist/{chunk-PI56A4DG.mjs → chunk-ZLTOUZN2.mjs} +37 -2
- package/dist/chunk-ZLTOUZN2.mjs.map +1 -0
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +14 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +24 -19
- package/dist/components/index.d.mts +7 -1
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +11 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -6
- package/dist/contexts/index.d.mts +1 -1
- package/dist/contexts/index.d.ts +1 -1
- package/dist/contexts/index.js +11 -7
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +10 -6
- package/dist/core/index.d.mts +128 -2
- package/dist/core/index.d.ts +128 -2
- package/dist/core/index.js +17 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +22 -9
- package/dist/email-automations/index.js +101 -96
- package/dist/email-automations/index.js.map +1 -1
- package/dist/email-automations/index.mjs +13 -8
- package/dist/email-automations/index.mjs.map +1 -1
- package/dist/features/analytics/index.js +128 -123
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +13 -8
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.js +11 -8
- package/dist/features/analytics/server.js.map +1 -1
- package/dist/features/analytics/server.mjs +9 -6
- package/dist/features/analytics/server.mjs.map +1 -1
- package/dist/features/blog/index.js +158 -153
- package/dist/features/blog/index.js.map +1 -1
- package/dist/features/blog/index.mjs +14 -9
- package/dist/features/blog/index.mjs.map +1 -1
- package/dist/features/blog/server.js +30 -26
- package/dist/features/blog/server.js.map +1 -1
- package/dist/features/blog/server.mjs +10 -6
- package/dist/features/blog/server.mjs.map +1 -1
- package/dist/features/help/index.js +44 -40
- package/dist/features/help/index.js.map +1 -1
- package/dist/features/help/index.mjs +10 -6
- package/dist/features/help/index.mjs.map +1 -1
- package/dist/features/tokenusage/index.js +134 -129
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +13 -8
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -11
- package/dist/lifecycle-4GUOTB46.js +23 -0
- package/dist/lifecycle-4GUOTB46.js.map +1 -0
- package/dist/lifecycle-LKGPRBS7.mjs +23 -0
- package/dist/local-transport-7H3SPZSA.js +15 -0
- package/dist/local-transport-7H3SPZSA.js.map +1 -0
- package/dist/local-transport-QYFKA6AN.mjs +15 -0
- package/dist/local-transport-QYFKA6AN.mjs.map +1 -0
- package/dist/offline/index.d.mts +607 -0
- package/dist/offline/index.d.ts +607 -0
- package/dist/offline/index.js +1052 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/offline/index.mjs +1052 -0
- package/dist/offline/index.mjs.map +1 -0
- package/dist/offline/sqlite/device-worker.mjs +62 -0
- package/dist/offline/sqlite/index.mjs +17392 -0
- package/dist/offline/sqlite/sqlite3-opfs-async-proxy.js +881 -0
- package/dist/offline/sqlite/sqlite3.wasm +0 -0
- package/dist/request-KTBV6HHH.js +10 -0
- package/dist/request-KTBV6HHH.js.map +1 -0
- package/dist/request-SQOUNWZ4.mjs +10 -0
- package/dist/request-SQOUNWZ4.mjs.map +1 -0
- package/dist/server/cachedGet.d.mts +1 -1
- package/dist/server/cachedGet.d.ts +1 -1
- package/dist/server/cachedGet.stub.d.mts +1 -1
- package/dist/server/cachedGet.stub.d.ts +1 -1
- package/dist/server/index.d.mts +28 -2
- package/dist/server/index.d.ts +28 -2
- package/dist/server/index.js +18 -8
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +18 -8
- package/dist/{useSocket-IRHtk2xc.d.ts → useSocket-Bo9M0t0J.d.ts} +3 -1
- package/dist/{useSocket-C8fqU4od.d.mts → useSocket-J5qanQPN.d.mts} +3 -1
- package/dist/write-through-FDQ7N4YI.js +15 -0
- package/dist/write-through-FDQ7N4YI.js.map +1 -0
- package/dist/write-through-R25VQMH6.mjs +15 -0
- package/dist/write-through-R25VQMH6.mjs.map +1 -0
- package/package.json +7 -1
- package/pwa/sw.js +277 -26
- package/src/client/request.ts +37 -0
- package/src/components/editors/BlockNoteEditor.tsx +14 -0
- package/src/components/editors/__tests__/BlockNoteEditor.empty-change.spec.tsx +205 -0
- package/src/contexts/SocketContext.tsx +7 -1
- package/src/contexts/__tests__/SocketContext.session.spec.tsx +52 -5
- package/src/core/factories/RehydrationFactory.ts +28 -8
- package/src/core/factories/__tests__/RehydrationFactory.spec.ts +33 -0
- package/src/core/index.ts +3 -0
- package/src/core/interfaces/ApiData.ts +2 -0
- package/src/core/registry/ModuleRegistry.ts +3 -0
- package/src/features/auth/components/forms/Logout.tsx +8 -1
- package/src/features/auth/components/forms/__tests__/Logout.spec.tsx +62 -0
- package/src/features/onboarding/contexts/OnboardingContext.spec.tsx +42 -1
- package/src/features/onboarding/contexts/OnboardingContext.tsx +11 -1
- package/src/hooks/__tests__/useSocket.pause.spec.ts +39 -0
- package/src/hooks/useSocket.ts +20 -1
- package/src/offline/__tests__/answer-builders.spec.ts +176 -0
- package/src/offline/__tests__/device-switch.spec.ts +179 -0
- package/src/offline/__tests__/generic-answers.spec.ts +380 -0
- package/src/offline/__tests__/local-transport.spec.ts +150 -0
- package/src/offline/__tests__/logout.spec.ts +122 -0
- package/src/offline/__tests__/offline-fixtures.ts +89 -0
- package/src/offline/__tests__/router.spec.ts +56 -0
- package/src/offline/__tests__/state.spec.ts +62 -0
- package/src/offline/__tests__/write-through.spec.ts +137 -0
- package/src/offline/config.ts +229 -0
- package/src/offline/configure.ts +14 -0
- package/src/offline/device-switch.ts +75 -0
- package/src/offline/generic-answers.ts +706 -0
- package/src/offline/index.ts +67 -0
- package/src/offline/local-transport.ts +189 -0
- package/src/offline/logout.ts +41 -0
- package/src/offline/router.ts +41 -0
- package/src/offline/server/__tests__/build-offline-manifest.spec.ts +76 -0
- package/src/offline/server/build-offline-manifest.ts +49 -0
- package/src/offline/state-hooks.ts +10 -0
- package/src/offline/state.ts +143 -0
- package/src/offline/store/DeviceStore.ts +112 -0
- package/src/offline/store/__tests__/device-store-lifecycle.spec.ts +343 -0
- package/src/offline/store/__tests__/shared-database.spec.ts +151 -0
- package/src/offline/store/__tests__/sql-device-store.spec.ts +399 -0
- package/src/offline/store/lifecycle.ts +315 -0
- package/src/offline/store/schema.ts +101 -0
- package/src/offline/store/shared-database.ts +321 -0
- package/src/offline/store/sql-device-store.ts +469 -0
- package/src/offline/store/worker-client.ts +71 -0
- package/src/offline/store/worker.ts +87 -0
- package/src/offline/sync/__tests__/conflicts.spec.ts +185 -0
- package/src/offline/sync/__tests__/queue-drain.spec.ts +364 -0
- package/src/offline/sync/__tests__/runtime.spec.ts +337 -0
- package/src/offline/sync/__tests__/sync-fixtures.ts +103 -0
- package/src/offline/sync/__tests__/sync-root.spec.ts +727 -0
- package/src/offline/sync/artwork-cache.ts +67 -0
- package/src/offline/sync/conflicts.ts +211 -0
- package/src/offline/sync/counts.ts +39 -0
- package/src/offline/sync/drain-queue.ts +246 -0
- package/src/offline/sync/known-roots.ts +37 -0
- package/src/offline/sync/models/OfflineChangeSet.ts +34 -0
- package/src/offline/sync/models/OfflineChangeSetInterface.ts +54 -0
- package/src/offline/sync/models/RootSync.ts +68 -0
- package/src/offline/sync/models/RootSyncInterface.ts +20 -0
- package/src/offline/sync/models/__tests__/OfflineChangeSet.spec.ts +47 -0
- package/src/offline/sync/models/__tests__/RootSync.spec.ts +54 -0
- package/src/offline/sync/models/index.ts +5 -0
- package/src/offline/sync/models/offline.modules.ts +14 -0
- package/src/offline/sync/runtime.ts +226 -0
- package/src/offline/sync/session-refresh.ts +32 -0
- package/src/offline/sync/sync-root.ts +336 -0
- package/src/offline/sync/waiting.ts +40 -0
- package/src/offline/types.ts +115 -0
- package/src/offline/write-through.ts +189 -0
- package/src/pwa/__tests__/sw.spec.ts +358 -1
- package/src/server/index.ts +5 -0
- package/src/unified/__tests__/JsonApiRequest.offline.spec.ts +243 -0
- package/dist/BlockNoteEditor-75ED2CN2.mjs.map +0 -1
- package/dist/BlockNoteEditor-7M5QW2YQ.js.map +0 -1
- package/dist/BlockNoteViewer-WGCDB7IJ.js.map +0 -1
- package/dist/JsonApiRequest-FZGPLNUF.js +0 -26
- package/dist/chunk-AA52ORW2.mjs.map +0 -1
- package/dist/chunk-EWCY6QJA.mjs.map +0 -1
- package/dist/chunk-FF4EIQ6H.js.map +0 -1
- package/dist/chunk-JTPRJNT2.js.map +0 -1
- package/dist/chunk-L6PYFQTO.js.map +0 -1
- package/dist/chunk-O3PDL2CV.js.map +0 -1
- package/dist/chunk-PI56A4DG.mjs.map +0 -1
- package/dist/chunk-RXQYEEKZ.mjs.map +0 -1
- package/dist/chunk-V3YDVJ63.js.map +0 -1
- package/dist/request-5RLK2AM3.mjs +0 -9
- package/dist/request-EUGTI3BE.js +0 -9
- package/dist/request-EUGTI3BE.js.map +0 -1
- /package/dist/{JsonApiRequest-A66XK5WT.mjs.map → JsonApiRequest-F6TMJ42G.mjs.map} +0 -0
- /package/dist/{chunk-3YW35YHQ.mjs.map → chunk-BH6JWIKI.mjs.map} +0 -0
- /package/dist/{chunk-V5MI7RNB.mjs.map → chunk-DGWOVYEC.mjs.map} +0 -0
- /package/dist/{request-5RLK2AM3.mjs.map → lifecycle-LKGPRBS7.mjs.map} +0 -0
|
@@ -39,8 +39,9 @@
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
require('../../chunk-
|
|
42
|
+
var _chunkPYRZCKC2js = require('../../chunk-PYRZCKC2.js');
|
|
43
|
+
require('../../chunk-3EPNHTMH.js');
|
|
44
|
+
require('../../chunk-7ZHTPFFT.js');
|
|
44
45
|
require('../../chunk-G4JR3SFV.js');
|
|
45
46
|
|
|
46
47
|
|
|
@@ -57,13 +58,17 @@ require('../../chunk-G4JR3SFV.js');
|
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
|
|
61
|
+
var _chunkMOGEGWXWjs = require('../../chunk-MOGEGWXW.js');
|
|
62
|
+
require('../../chunk-GB6DBFYY.js');
|
|
63
|
+
|
|
60
64
|
|
|
61
65
|
|
|
62
|
-
var
|
|
63
|
-
require('../../chunk-
|
|
66
|
+
var _chunkBZ5J2FIVjs = require('../../chunk-BZ5J2FIV.js');
|
|
67
|
+
require('../../chunk-PV4Z5W6V.js');
|
|
68
|
+
require('../../chunk-KMW7UNL2.js');
|
|
69
|
+
require('../../chunk-MHB36MYE.js');
|
|
70
|
+
require('../../chunk-QKNGZDSQ.js');
|
|
64
71
|
require('../../chunk-LXKSUWAV.js');
|
|
65
|
-
require('../../chunk-JTPRJNT2.js');
|
|
66
|
-
require('../../chunk-3EPNHTMH.js');
|
|
67
72
|
|
|
68
73
|
|
|
69
74
|
var _chunk7QVYU63Ejs = require('../../chunk-7QVYU63E.js');
|
|
@@ -84,7 +89,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
84
89
|
};
|
|
85
90
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
86
91
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
87
|
-
|
|
92
|
+
_chunkPYRZCKC2js.DateRangeSelector,
|
|
88
93
|
{
|
|
89
94
|
onDateChange: (range) => {
|
|
90
95
|
if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
|
|
@@ -119,16 +124,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
|
|
|
119
124
|
}
|
|
120
125
|
),
|
|
121
126
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
122
|
-
|
|
127
|
+
_chunkPYRZCKC2js.Select,
|
|
123
128
|
{
|
|
124
129
|
items: companyItems,
|
|
125
130
|
value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
|
|
126
131
|
onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
|
|
127
132
|
children: [
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
|
-
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
133
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
|
|
134
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.SelectContent, { children: [
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
|
|
136
|
+
companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectItem, { value: company.id, children: company.label }, company.id))
|
|
132
137
|
] })
|
|
133
138
|
]
|
|
134
139
|
}
|
|
@@ -151,13 +156,13 @@ function Segmented({
|
|
|
151
156
|
children: options.map((option) => {
|
|
152
157
|
const selected = option.value === value;
|
|
153
158
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
-
|
|
159
|
+
_chunkPYRZCKC2js.Button,
|
|
155
160
|
{
|
|
156
161
|
type: "button",
|
|
157
162
|
size: "sm",
|
|
158
163
|
variant: selected ? "default" : "ghost",
|
|
159
164
|
"aria-pressed": selected,
|
|
160
|
-
className:
|
|
165
|
+
className: _chunkMOGEGWXWjs.cn.call(void 0, !selected && "text-muted-foreground"),
|
|
161
166
|
onClick: () => onSelect(option.value),
|
|
162
167
|
children: option.label
|
|
163
168
|
},
|
|
@@ -177,36 +182,36 @@ function withFilters(endpoint, filters) {
|
|
|
177
182
|
return endpoint;
|
|
178
183
|
}
|
|
179
184
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters, "withFilters");
|
|
180
|
-
var TokenUsageAdminService = class extends
|
|
185
|
+
var TokenUsageAdminService = class extends _chunkMOGEGWXWjs.AbstractService {
|
|
181
186
|
static {
|
|
182
187
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageAdminService");
|
|
183
188
|
}
|
|
184
189
|
/** Six rows: {customer, platform, total} × {current, previous}. */
|
|
185
190
|
static async getSummary(filters) {
|
|
186
|
-
const endpoint = withFilters(new (0,
|
|
191
|
+
const endpoint = withFilters(new (0, _chunkBZ5J2FIVjs.EndpointCreator)({ endpoint: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminSummary }), filters);
|
|
187
192
|
return this.callApi({
|
|
188
|
-
type:
|
|
193
|
+
type: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminSummary,
|
|
189
194
|
method: "GET" /* GET */,
|
|
190
195
|
endpoint: endpoint.generate()
|
|
191
196
|
});
|
|
192
197
|
}
|
|
193
198
|
static async getTimeline(params) {
|
|
194
|
-
const endpoint = withFilters(new (0,
|
|
199
|
+
const endpoint = withFilters(new (0, _chunkBZ5J2FIVjs.EndpointCreator)({ endpoint: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminTimeline }), params);
|
|
195
200
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
196
201
|
endpoint.addAdditionalParam("stackBy", params.stackBy);
|
|
197
202
|
return this.callApi({
|
|
198
|
-
type:
|
|
203
|
+
type: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminTimeline,
|
|
199
204
|
method: "GET" /* GET */,
|
|
200
205
|
endpoint: endpoint.generate()
|
|
201
206
|
});
|
|
202
207
|
}
|
|
203
208
|
static async getBreakdown(params) {
|
|
204
|
-
const endpoint = withFilters(new (0,
|
|
209
|
+
const endpoint = withFilters(new (0, _chunkBZ5J2FIVjs.EndpointCreator)({ endpoint: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminBreakdown }), params);
|
|
205
210
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
206
211
|
endpoint.addAdditionalParam("scope", params.scope);
|
|
207
212
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
208
213
|
return this.callApi({
|
|
209
|
-
type:
|
|
214
|
+
type: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminBreakdown,
|
|
210
215
|
method: "GET" /* GET */,
|
|
211
216
|
endpoint: endpoint.generate()
|
|
212
217
|
});
|
|
@@ -343,7 +348,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
343
348
|
error
|
|
344
349
|
]
|
|
345
350
|
);
|
|
346
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
351
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
|
|
347
352
|
}, "TokenUsageAdminProvider");
|
|
348
353
|
var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
349
354
|
const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
|
|
@@ -364,7 +369,7 @@ var _lucidereact = require('lucide-react');
|
|
|
364
369
|
var ZERO = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
365
370
|
function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
366
371
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
367
|
-
const { decimal, metricValue: formatValue, currency, percent } =
|
|
372
|
+
const { decimal, metricValue: formatValue, currency, percent } = _chunkPYRZCKC2js.useUsageFormatters.call(void 0, );
|
|
368
373
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (scope, window) => _nullishCoalesce(summary.find((r) => r.scope === scope && r.window === window), () => ( ZERO)), "rowFor");
|
|
369
374
|
const customerCurrent = rowFor("customer", "current");
|
|
370
375
|
const customerPrevious = rowFor("customer", "previous");
|
|
@@ -373,16 +378,16 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
373
378
|
const totalCurrent = rowFor("total", "current");
|
|
374
379
|
const totalPrevious = rowFor("total", "previous");
|
|
375
380
|
const averagePerCall = totalCurrent.calls ? totalCurrent.cost / totalCurrent.calls : 0;
|
|
376
|
-
const cacheHit =
|
|
381
|
+
const cacheHit = _chunkPYRZCKC2js.cacheHitPercentage.call(void 0, totalCurrent.cached, totalCurrent.tokensIn);
|
|
377
382
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
378
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
383
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkMOGEGWXWjs.cn.call(void 0, "grid gap-3", singleCustomerMode ? "sm:grid-cols-1" : "sm:grid-cols-2"), children: [
|
|
379
384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
380
385
|
LeadTile,
|
|
381
386
|
{
|
|
382
387
|
testId: "tile-customer",
|
|
383
388
|
label: t("token_usage.admin.customer_spend"),
|
|
384
|
-
value: formatValue(
|
|
385
|
-
delta:
|
|
389
|
+
value: formatValue(_chunkPYRZCKC2js.metricValue.call(void 0, customerCurrent, metric), metric),
|
|
390
|
+
delta: _chunkPYRZCKC2js.percentageDelta.call(void 0, _chunkPYRZCKC2js.metricValue.call(void 0, customerCurrent, metric), _chunkPYRZCKC2js.metricValue.call(void 0, customerPrevious, metric)),
|
|
386
391
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
387
392
|
decimal
|
|
388
393
|
}
|
|
@@ -392,8 +397,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
392
397
|
{
|
|
393
398
|
testId: "tile-platform",
|
|
394
399
|
label: t("token_usage.admin.platform_spend"),
|
|
395
|
-
value: formatValue(
|
|
396
|
-
delta:
|
|
400
|
+
value: formatValue(_chunkPYRZCKC2js.metricValue.call(void 0, platformCurrent, metric), metric),
|
|
401
|
+
delta: _chunkPYRZCKC2js.percentageDelta.call(void 0, _chunkPYRZCKC2js.metricValue.call(void 0, platformCurrent, metric), _chunkPYRZCKC2js.metricValue.call(void 0, platformPrevious, metric)),
|
|
397
402
|
previousLabel: t("token_usage.admin.vs_previous"),
|
|
398
403
|
decimal
|
|
399
404
|
}
|
|
@@ -405,8 +410,8 @@ function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
|
|
|
405
410
|
{
|
|
406
411
|
testId: "tile-total",
|
|
407
412
|
label: t("token_usage.admin.total_cost"),
|
|
408
|
-
value: formatValue(
|
|
409
|
-
delta:
|
|
413
|
+
value: formatValue(_chunkPYRZCKC2js.metricValue.call(void 0, totalCurrent, metric), metric),
|
|
414
|
+
delta: _chunkPYRZCKC2js.percentageDelta.call(void 0, _chunkPYRZCKC2js.metricValue.call(void 0, totalCurrent, metric), _chunkPYRZCKC2js.metricValue.call(void 0, totalPrevious, metric)),
|
|
410
415
|
decimal
|
|
411
416
|
}
|
|
412
417
|
),
|
|
@@ -440,7 +445,7 @@ function LeadTile({
|
|
|
440
445
|
previousLabel,
|
|
441
446
|
decimal
|
|
442
447
|
}) {
|
|
443
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
448
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.CardContent, { className: "grid gap-1", children: [
|
|
444
449
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
445
450
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
446
451
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
@@ -457,7 +462,7 @@ function SupportingTile({
|
|
|
457
462
|
delta,
|
|
458
463
|
decimal
|
|
459
464
|
}) {
|
|
460
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
465
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.CardContent, { className: "grid gap-1", children: [
|
|
461
466
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
|
|
462
467
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
|
|
463
468
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
|
|
@@ -480,7 +485,7 @@ function Delta({
|
|
|
480
485
|
"span",
|
|
481
486
|
{
|
|
482
487
|
"data-testid": testId,
|
|
483
|
-
className:
|
|
488
|
+
className: _chunkMOGEGWXWjs.cn.call(void 0,
|
|
484
489
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
485
490
|
increased ? "text-success" : "text-destructive"
|
|
486
491
|
),
|
|
@@ -501,10 +506,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, Delta, "Delta");
|
|
|
501
506
|
|
|
502
507
|
function TokenUsageBreakdownTable({ rows, metric }) {
|
|
503
508
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
504
|
-
const { decimal, metricValue: formatValue, percent, compare } =
|
|
509
|
+
const { decimal, metricValue: formatValue, percent, compare } = _chunkPYRZCKC2js.useUsageFormatters.call(void 0, );
|
|
505
510
|
const [sort, setSort] = _react.useState.call(void 0, void 0);
|
|
506
511
|
const showActiveUsers = rows.some((row) => row.activeUsers !== void 0);
|
|
507
|
-
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum +
|
|
512
|
+
const total = _react.useMemo.call(void 0, () => rows.reduce((sum, row) => sum + _chunkPYRZCKC2js.metricValue.call(void 0, row, metric), 0), [rows, metric]);
|
|
508
513
|
const sortValue = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row, key) => {
|
|
509
514
|
switch (key) {
|
|
510
515
|
case "label":
|
|
@@ -514,9 +519,9 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
514
519
|
case "activeUsers":
|
|
515
520
|
return _nullishCoalesce(row.activeUsers, () => ( 0));
|
|
516
521
|
case "cacheHit":
|
|
517
|
-
return
|
|
522
|
+
return _chunkPYRZCKC2js.cacheHitPercentage.call(void 0, row.cached, row.tokensIn);
|
|
518
523
|
case "share":
|
|
519
|
-
return
|
|
524
|
+
return _chunkPYRZCKC2js.metricValue.call(void 0, row, metric);
|
|
520
525
|
default:
|
|
521
526
|
return row[key];
|
|
522
527
|
}
|
|
@@ -554,13 +559,13 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
554
559
|
// The package's <Table> wraps itself in an `overflow-x-clip` container, which
|
|
555
560
|
// would swallow the overflow before this scroller ever saw it — hence the
|
|
556
561
|
// child override. Wide metric tables must scroll, never widen the page.
|
|
557
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
558
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
562
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Table, { children: [
|
|
563
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableHead, { className: _chunkMOGEGWXWjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
559
564
|
"button",
|
|
560
565
|
{
|
|
561
566
|
type: "button",
|
|
562
567
|
onClick: () => toggleSort(column.key),
|
|
563
|
-
className:
|
|
568
|
+
className: _chunkMOGEGWXWjs.cn.call(void 0,
|
|
564
569
|
"hover:text-primary inline-flex items-center gap-1 text-xs font-medium",
|
|
565
570
|
column.numeric && "flex-row-reverse"
|
|
566
571
|
),
|
|
@@ -570,20 +575,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
|
|
|
570
575
|
]
|
|
571
576
|
}
|
|
572
577
|
) }, column.key)) }) }),
|
|
573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
574
|
-
const value =
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableBody, { children: sortedRows.map((row) => {
|
|
579
|
+
const value = _chunkPYRZCKC2js.metricValue.call(void 0, row, metric);
|
|
575
580
|
const share = total > 0 ? value / total * 100 : 0;
|
|
576
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
577
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
579
|
-
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
581
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
584
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
585
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
586
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
581
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
|
|
584
|
+
showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
|
|
585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
|
|
586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
|
|
587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
|
|
588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunkPYRZCKC2js.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
|
|
589
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
|
|
590
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
|
|
591
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
|
|
587
592
|
] }, row.id);
|
|
588
593
|
}) })
|
|
589
594
|
] }) })
|
|
@@ -617,7 +622,7 @@ var operationDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0,
|
|
|
617
622
|
|
|
618
623
|
function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes = false }) {
|
|
619
624
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
620
|
-
const { metricValue: formatValue, percent } =
|
|
625
|
+
const { metricValue: formatValue, percent } = _chunkPYRZCKC2js.useUsageFormatters.call(void 0, );
|
|
621
626
|
const renderLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (row) => {
|
|
622
627
|
if (row.id === "other") return t("token_usage.admin.other");
|
|
623
628
|
if (!labelsAreOperationTypes) return row.label;
|
|
@@ -639,9 +644,9 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
639
644
|
const label = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground truncate text-xs", children: renderLabel(row) });
|
|
640
645
|
const description = renderDescription(row);
|
|
641
646
|
if (!description) return label;
|
|
642
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
647
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Tooltip, { children: [
|
|
643
648
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
-
|
|
649
|
+
_chunkPYRZCKC2js.TooltipTrigger,
|
|
645
650
|
{
|
|
646
651
|
"data-testid": `ranked-description-${row.id}`,
|
|
647
652
|
className: "min-w-0 cursor-help justify-self-start truncate",
|
|
@@ -649,19 +654,19 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
649
654
|
children: label
|
|
650
655
|
}
|
|
651
656
|
),
|
|
652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs", children: description }) })
|
|
653
658
|
] });
|
|
654
659
|
}, "renderLabelCell");
|
|
655
660
|
if (rows.length === 0) {
|
|
656
661
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground py-6 text-center text-sm", children: emptyLabel });
|
|
657
662
|
}
|
|
658
|
-
const values = rows.map((row) =>
|
|
663
|
+
const values = rows.map((row) => _chunkPYRZCKC2js.metricValue.call(void 0, row, metric));
|
|
659
664
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
660
665
|
const max = Math.max(...values, 0);
|
|
661
666
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid gap-0.5", children: rows.map((row, index) => {
|
|
662
667
|
const value = values[index];
|
|
663
668
|
const isOther = row.id === "other";
|
|
664
|
-
const step = isOther ?
|
|
669
|
+
const step = isOther ? _chunkPYRZCKC2js.SEQUENTIAL_RAMP.length - 1 : Math.min(index, _chunkPYRZCKC2js.SEQUENTIAL_RAMP.length - 1);
|
|
665
670
|
const width = max > 0 ? value / max * 100 : 0;
|
|
666
671
|
const share = total > 0 ? value / total * 100 : 0;
|
|
667
672
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-3 gap-y-0.5 py-0.5", children: [
|
|
@@ -673,7 +678,7 @@ function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes
|
|
|
673
678
|
"data-testid": `ranked-fill-${row.id}`,
|
|
674
679
|
"data-ramp-step": String(step),
|
|
675
680
|
className: "h-full rounded-r-[4px]",
|
|
676
|
-
style: { width: `${width}%`, backgroundColor:
|
|
681
|
+
style: { width: `${width}%`, backgroundColor: _chunkPYRZCKC2js.SEQUENTIAL_RAMP[step] }
|
|
677
682
|
}
|
|
678
683
|
) })
|
|
679
684
|
] }),
|
|
@@ -723,7 +728,7 @@ var inferGranularity = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (buc
|
|
|
723
728
|
}, "inferGranularity");
|
|
724
729
|
function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
725
730
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
726
|
-
const { compact, bucketDate, metricValue: formatValue } =
|
|
731
|
+
const { compact, bucketDate, metricValue: formatValue } = _chunkPYRZCKC2js.useUsageFormatters.call(void 0, );
|
|
727
732
|
const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
|
|
728
733
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
729
734
|
const { chartData, seriesKeys } = _react.useMemo.call(void 0, () => {
|
|
@@ -731,8 +736,8 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
731
736
|
const totals = /* @__PURE__ */ new Map();
|
|
732
737
|
for (const row of rows) totals.set(row.series, (_nullishCoalesce(totals.get(row.series), () => ( 0))) + metricValue2(row, metric));
|
|
733
738
|
const ranked = [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([series]) => series);
|
|
734
|
-
const named = ranked.slice(0,
|
|
735
|
-
const folded = new Set(ranked.slice(
|
|
739
|
+
const named = ranked.slice(0, _chunkPYRZCKC2js.CATEGORICAL_CEILING);
|
|
740
|
+
const folded = new Set(ranked.slice(_chunkPYRZCKC2js.CATEGORICAL_CEILING));
|
|
736
741
|
const keys = folded.size > 0 ? [...named, OTHER_SERIES] : named;
|
|
737
742
|
const byBucket = /* @__PURE__ */ new Map();
|
|
738
743
|
for (const row of rows) {
|
|
@@ -772,7 +777,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
772
777
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: className ? `text-muted-foreground text-sm ${className}` : "text-muted-foreground text-sm", children: t.has(key) ? t(key) : "No data in the selected period" });
|
|
773
778
|
}
|
|
774
779
|
const granularity = inferGranularity(chartData.map((entry) => entry.bucket));
|
|
775
|
-
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ?
|
|
780
|
+
const seriesColorFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (series, index) => series === OTHER_SERIES ? _chunkPYRZCKC2js.OTHER_COLOR : _chunkPYRZCKC2js.seriesColor.call(void 0, index, mode), "seriesColorFor");
|
|
776
781
|
return (
|
|
777
782
|
// The chart is a coordinate system, not prose: recharts lays the axes and the
|
|
778
783
|
// stacked bars out left-to-right, so the whole chart stays an LTR island even
|
|
@@ -781,7 +786,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
781
786
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
|
|
782
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
|
|
783
788
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.ChartContainer, { config: chartConfig, className: "aspect-auto h-72 w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _recharts.BarChart, { accessibilityLayer: true, data: chartData, margin: { top: 8, right: 8, bottom: 0, left: 0 }, children: [
|
|
785
790
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
|
|
786
791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
787
792
|
_recharts.XAxis,
|
|
@@ -805,10 +810,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
805
810
|
}
|
|
806
811
|
),
|
|
807
812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
808
|
-
|
|
813
|
+
_chunkPYRZCKC2js.ChartTooltip,
|
|
809
814
|
{
|
|
810
815
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
811
|
-
|
|
816
|
+
_chunkPYRZCKC2js.ChartTooltipContent,
|
|
812
817
|
{
|
|
813
818
|
labelFormatter: (value) => bucketDate(String(value), granularity),
|
|
814
819
|
valueFormatter: (value) => formatValue(Number(value), metric),
|
|
@@ -817,7 +822,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
|
|
|
817
822
|
)
|
|
818
823
|
}
|
|
819
824
|
),
|
|
820
|
-
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
825
|
+
seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.ChartLegendContent, {}) }) : null,
|
|
821
826
|
seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
822
827
|
_recharts.Bar,
|
|
823
828
|
{
|
|
@@ -869,19 +874,19 @@ function TokenUsageAdminContainer() {
|
|
|
869
874
|
[t]
|
|
870
875
|
);
|
|
871
876
|
if (error) {
|
|
872
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
877
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.RoundPageContainer, { module: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
873
878
|
}
|
|
874
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
879
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.RoundPageContainer, { module: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true });
|
|
875
880
|
const emptyLabel = t("token_usage.admin.no_data");
|
|
876
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
881
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.RoundPageContainer, { module: _chunkBZ5J2FIVjs.Modules.TokenUsageAdminSummary, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
877
882
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
|
|
878
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
879
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
881
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
884
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: [
|
|
885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
|
|
886
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
882
887
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
|
|
883
888
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
884
|
-
|
|
889
|
+
_chunkPYRZCKC2js.Select,
|
|
885
890
|
{
|
|
886
891
|
items: stackByItems,
|
|
887
892
|
value: filters.stackBy,
|
|
@@ -889,29 +894,29 @@ function TokenUsageAdminContainer() {
|
|
|
889
894
|
if (value) setFilters({ stackBy: value });
|
|
890
895
|
},
|
|
891
896
|
children: [
|
|
892
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
893
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
897
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectValue, {}) }),
|
|
898
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SelectItem, { value, children: stackByItems[value] }, value)) })
|
|
894
899
|
]
|
|
895
900
|
}
|
|
896
901
|
)
|
|
897
902
|
] }) })
|
|
898
903
|
] }),
|
|
899
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
904
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
|
|
900
905
|
] }),
|
|
901
906
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
902
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
903
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
904
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.admin.by_company") }) }),
|
|
909
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
|
|
905
910
|
] }),
|
|
906
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
908
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
911
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
912
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.admin.by_user") }) }),
|
|
913
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
|
|
909
914
|
] })
|
|
910
915
|
] }),
|
|
911
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
912
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
913
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
914
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
916
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkMOGEGWXWjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
|
|
917
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
918
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
|
|
919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
915
920
|
TokenUsageRankedBar,
|
|
916
921
|
{
|
|
917
922
|
rows: byCustomerOperation,
|
|
@@ -921,9 +926,9 @@ function TokenUsageAdminContainer() {
|
|
|
921
926
|
}
|
|
922
927
|
) })
|
|
923
928
|
] }),
|
|
924
|
-
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
925
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
926
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
929
|
+
!hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
|
|
931
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
927
932
|
TokenUsageRankedBar,
|
|
928
933
|
{
|
|
929
934
|
rows: byOperation,
|
|
@@ -934,9 +939,9 @@ function TokenUsageAdminContainer() {
|
|
|
934
939
|
) })
|
|
935
940
|
] })
|
|
936
941
|
] }),
|
|
937
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
938
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
939
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
942
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.admin.detail") }) }),
|
|
944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
|
|
940
945
|
] })
|
|
941
946
|
] }) });
|
|
942
947
|
}
|
|
@@ -949,36 +954,36 @@ function withFilters2(endpoint, filters) {
|
|
|
949
954
|
return endpoint;
|
|
950
955
|
}
|
|
951
956
|
_chunk7QVYU63Ejs.__name.call(void 0, withFilters2, "withFilters");
|
|
952
|
-
var TokenUsageReportService = class extends
|
|
957
|
+
var TokenUsageReportService = class extends _chunkMOGEGWXWjs.AbstractService {
|
|
953
958
|
static {
|
|
954
959
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "TokenUsageReportService");
|
|
955
960
|
}
|
|
956
961
|
/** Two rows: window "current" and "previous". */
|
|
957
962
|
static async getSummary(filters) {
|
|
958
|
-
const endpoint = withFilters2(new (0,
|
|
963
|
+
const endpoint = withFilters2(new (0, _chunkBZ5J2FIVjs.EndpointCreator)({ endpoint: _chunkBZ5J2FIVjs.Modules.TokenUsageReportSummary }), filters);
|
|
959
964
|
return this.callApi({
|
|
960
|
-
type:
|
|
965
|
+
type: _chunkBZ5J2FIVjs.Modules.TokenUsageReportSummary,
|
|
961
966
|
method: "GET" /* GET */,
|
|
962
967
|
endpoint: endpoint.generate()
|
|
963
968
|
});
|
|
964
969
|
}
|
|
965
970
|
static async getTimeline(params) {
|
|
966
|
-
const endpoint = withFilters2(new (0,
|
|
971
|
+
const endpoint = withFilters2(new (0, _chunkBZ5J2FIVjs.EndpointCreator)({ endpoint: _chunkBZ5J2FIVjs.Modules.TokenUsageReportTimeline }), params);
|
|
967
972
|
endpoint.addAdditionalParam("granularity", params.granularity);
|
|
968
973
|
return this.callApi({
|
|
969
|
-
type:
|
|
974
|
+
type: _chunkBZ5J2FIVjs.Modules.TokenUsageReportTimeline,
|
|
970
975
|
method: "GET" /* GET */,
|
|
971
976
|
endpoint: endpoint.generate()
|
|
972
977
|
});
|
|
973
978
|
}
|
|
974
979
|
static async getBreakdown(params) {
|
|
975
|
-
const endpoint = withFilters2(new (0,
|
|
980
|
+
const endpoint = withFilters2(new (0, _chunkBZ5J2FIVjs.EndpointCreator)({ endpoint: _chunkBZ5J2FIVjs.Modules.TokenUsageReportBreakdown }), params);
|
|
976
981
|
endpoint.addAdditionalParam("dimension", params.dimension);
|
|
977
982
|
if (params.targetLabel) endpoint.addAdditionalParam("targetLabel", params.targetLabel);
|
|
978
983
|
endpoint.addAdditionalParam("metric", params.metric);
|
|
979
984
|
if (params.limit !== void 0) endpoint.addAdditionalParam("limit", String(params.limit));
|
|
980
985
|
return this.callApi({
|
|
981
|
-
type:
|
|
986
|
+
type: _chunkBZ5J2FIVjs.Modules.TokenUsageReportBreakdown,
|
|
982
987
|
method: "GET" /* GET */,
|
|
983
988
|
endpoint: endpoint.generate()
|
|
984
989
|
});
|
|
@@ -1057,7 +1062,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
|
|
|
1057
1062
|
|
|
1058
1063
|
function TokenUsageReportFilterBar({ onChange }) {
|
|
1059
1064
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-help": "tokenusage.filters", className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1060
|
-
|
|
1065
|
+
_chunkPYRZCKC2js.DateRangeSelector,
|
|
1061
1066
|
{
|
|
1062
1067
|
onDateChange: (range) => {
|
|
1063
1068
|
if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
|
|
@@ -1090,7 +1095,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1090
1095
|
pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
|
|
1091
1096
|
}) => {
|
|
1092
1097
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1093
|
-
const generateUrl =
|
|
1098
|
+
const generateUrl = _chunkPYRZCKC2js.usePageUrlGenerator.call(void 0, );
|
|
1094
1099
|
const [filters, setFilterState] = _react.useState.call(void 0, () => {
|
|
1095
1100
|
const range = defaultRange2();
|
|
1096
1101
|
return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
|
|
@@ -1154,7 +1159,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
1154
1159
|
() => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
|
|
1155
1160
|
[summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
|
|
1156
1161
|
);
|
|
1157
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1162
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
|
|
1158
1163
|
}, "TokenUsageReportProvider");
|
|
1159
1164
|
var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1160
1165
|
const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
|
|
@@ -1174,7 +1179,7 @@ var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (
|
|
|
1174
1179
|
var ZERO2 = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
|
|
1175
1180
|
function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
1176
1181
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1177
|
-
const { decimal, metricValue: formatValue } =
|
|
1182
|
+
const { decimal, metricValue: formatValue } = _chunkPYRZCKC2js.useUsageFormatters.call(void 0, );
|
|
1178
1183
|
const rowFor = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (window) => _nullishCoalesce(summary.find((row) => row.window === window), () => ( ZERO2)), "rowFor");
|
|
1179
1184
|
const current = rowFor("current");
|
|
1180
1185
|
const previous = rowFor("previous");
|
|
@@ -1182,15 +1187,15 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1182
1187
|
const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
|
|
1183
1188
|
const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
|
|
1184
1189
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
|
|
1185
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.CardContent, { className: "grid gap-1", children: [
|
|
1186
1191
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
|
|
1187
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunkPYRZCKC2js.metricValue.call(void 0, current, metric), metric) }),
|
|
1188
1193
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
1189
1194
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1190
1195
|
Delta2,
|
|
1191
1196
|
{
|
|
1192
1197
|
testId: "tile-used-delta",
|
|
1193
|
-
delta:
|
|
1198
|
+
delta: _chunkPYRZCKC2js.percentageDelta.call(void 0, _chunkPYRZCKC2js.metricValue.call(void 0, current, metric), _chunkPYRZCKC2js.metricValue.call(void 0, previous, metric)),
|
|
1194
1199
|
decimal
|
|
1195
1200
|
}
|
|
1196
1201
|
),
|
|
@@ -1198,21 +1203,21 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
|
|
|
1198
1203
|
] })
|
|
1199
1204
|
] }) }),
|
|
1200
1205
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
1201
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1206
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.CardContent, { className: "grid gap-1", children: [
|
|
1202
1207
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
|
|
1203
1208
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
|
|
1204
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className:
|
|
1209
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunkMOGEGWXWjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
|
|
1205
1210
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground text-xs tabular-nums", children: [
|
|
1206
1211
|
"/ ",
|
|
1207
1212
|
whole(balances.monthlyCredits)
|
|
1208
1213
|
] })
|
|
1209
1214
|
] })
|
|
1210
1215
|
] }) }),
|
|
1211
|
-
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1216
|
+
balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.CardContent, { className: "grid gap-1", children: [
|
|
1212
1217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
|
|
1213
1218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
|
|
1214
1219
|
] }) }),
|
|
1215
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1220
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.CardContent, { className: "grid gap-1", children: [
|
|
1216
1221
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
|
|
1217
1222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
|
|
1218
1223
|
] }) })
|
|
@@ -1234,7 +1239,7 @@ function Delta2({
|
|
|
1234
1239
|
"span",
|
|
1235
1240
|
{
|
|
1236
1241
|
"data-testid": testId,
|
|
1237
|
-
className:
|
|
1242
|
+
className: _chunkMOGEGWXWjs.cn.call(void 0,
|
|
1238
1243
|
"inline-flex items-center gap-0.5 text-xs tabular-nums",
|
|
1239
1244
|
increased ? "text-warning" : "text-success"
|
|
1240
1245
|
),
|
|
@@ -1254,21 +1259,21 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1254
1259
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1255
1260
|
const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
|
|
1256
1261
|
if (error) {
|
|
1257
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1262
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
|
|
1258
1263
|
}
|
|
1259
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1264
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.RoundPageContainer, { fullWidth: true, forceHeader: true });
|
|
1260
1265
|
const emptyLabel = t("token_usage.report.no_data");
|
|
1261
1266
|
const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
|
|
1262
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1267
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
|
|
1263
1268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
|
|
1264
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
1270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
|
|
1271
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
|
|
1267
1272
|
] }),
|
|
1268
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
1269
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1270
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1271
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1273
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkMOGEGWXWjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
|
|
1274
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
1275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: t("token_usage.report.by_operation") }) }),
|
|
1276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1272
1277
|
TokenUsageRankedBar,
|
|
1273
1278
|
{
|
|
1274
1279
|
rows: byOperation,
|
|
@@ -1278,9 +1283,9 @@ function TokenUsageReportContainer({ balances = null }) {
|
|
|
1278
1283
|
}
|
|
1279
1284
|
) })
|
|
1280
1285
|
] }),
|
|
1281
|
-
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1282
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1283
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1286
|
+
targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPYRZCKC2js.Card, { children: [
|
|
1287
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardTitle, { children: targetTitle }) }),
|
|
1288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPYRZCKC2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
|
|
1284
1289
|
] })
|
|
1285
1290
|
] })
|
|
1286
1291
|
] }) });
|
|
@@ -1320,5 +1325,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, TokenUsageReportContainer, "TokenUsageRepor
|
|
|
1320
1325
|
|
|
1321
1326
|
|
|
1322
1327
|
|
|
1323
|
-
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown =
|
|
1328
|
+
exports.TOKEN_USAGE_ADMIN_I18N_KEYS = TOKEN_USAGE_ADMIN_I18N_KEYS; exports.TOKEN_USAGE_REPORT_I18N_KEYS = TOKEN_USAGE_REPORT_I18N_KEYS; exports.TokenUsageAdminBreakdown = _chunkMOGEGWXWjs.TokenUsageAdminBreakdown; exports.TokenUsageAdminBreakdownModule = _chunkMOGEGWXWjs.TokenUsageAdminBreakdownModule; exports.TokenUsageAdminContainer = TokenUsageAdminContainer; exports.TokenUsageAdminFilterBar = TokenUsageAdminFilterBar; exports.TokenUsageAdminProvider = TokenUsageAdminProvider; exports.TokenUsageAdminService = TokenUsageAdminService; exports.TokenUsageAdminSummary = _chunkMOGEGWXWjs.TokenUsageAdminSummary; exports.TokenUsageAdminSummaryModule = _chunkMOGEGWXWjs.TokenUsageAdminSummaryModule; exports.TokenUsageAdminTiles = TokenUsageAdminTiles; exports.TokenUsageAdminTimeline = _chunkMOGEGWXWjs.TokenUsageAdminTimeline; exports.TokenUsageAdminTimelineModule = _chunkMOGEGWXWjs.TokenUsageAdminTimelineModule; exports.TokenUsageBreakdownTable = TokenUsageBreakdownTable; exports.TokenUsageRankedBar = TokenUsageRankedBar; exports.TokenUsageReportBreakdown = _chunkMOGEGWXWjs.TokenUsageReportBreakdown; exports.TokenUsageReportContainer = TokenUsageReportContainer; exports.TokenUsageReportFilterBar = TokenUsageReportFilterBar; exports.TokenUsageReportProvider = TokenUsageReportProvider; exports.TokenUsageReportService = TokenUsageReportService; exports.TokenUsageReportSummary = _chunkMOGEGWXWjs.TokenUsageReportSummary; exports.TokenUsageReportTiles = TokenUsageReportTiles; exports.TokenUsageReportTimeline = _chunkMOGEGWXWjs.TokenUsageReportTimeline; exports.TokenUsageTimelineChart = TokenUsageTimelineChart; exports.configureTokenUsage = _chunkMOGEGWXWjs.configureTokenUsage; exports.createUsageFormatters = _chunkPYRZCKC2js.createUsageFormatters; exports.getTokenUsageCurrency = _chunkMOGEGWXWjs.getTokenUsageCurrency; exports.seriesColor = _chunkPYRZCKC2js.seriesColor; exports.seriesTheme = _chunkPYRZCKC2js.seriesTheme; exports.tokenUsageModules = _chunkMOGEGWXWjs.tokenUsageModules; exports.useTokenUsageAdmin = useTokenUsageAdmin; exports.useTokenUsageReport = useTokenUsageReport; exports.useUsageFormatters = _chunkPYRZCKC2js.useUsageFormatters;
|
|
1324
1329
|
//# sourceMappingURL=index.js.map
|