@carlonicora/nextjs-jsonapi 1.141.3 → 1.143.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.
Files changed (117) hide show
  1. package/dist/AbstractService-B0T7h8fX.d.mts +124 -0
  2. package/dist/AbstractService-Cew0PD0L.d.ts +124 -0
  3. package/dist/{AssistantMessageInterface-DH1QwtC_.d.mts → AssistantMessageInterface-Ce8FcllX.d.mts} +1 -1
  4. package/dist/{AssistantMessageInterface-giWvsOrX.d.ts → AssistantMessageInterface-Dh0BpbP2.d.ts} +1 -1
  5. package/dist/{AuthComponent-DdxCFgUZ.d.mts → AuthComponent-Cik96ElA.d.mts} +1 -1
  6. package/dist/{AuthComponent-Cd7lcYif.d.ts → AuthComponent-DTTKu3VK.d.ts} +1 -1
  7. package/dist/{BlockNoteEditor-JTKEBS2W.mjs → BlockNoteEditor-34QM4UR5.mjs} +4 -4
  8. package/dist/{BlockNoteEditor-4OXY6BKF.js → BlockNoteEditor-LMKWUOJG.js} +19 -19
  9. package/dist/{BlockNoteEditor-4OXY6BKF.js.map → BlockNoteEditor-LMKWUOJG.js.map} +1 -1
  10. package/dist/{auth.interface-yivTb46w.d.ts → auth.interface-COmBjh89.d.ts} +1 -1
  11. package/dist/{auth.interface-r3XKYOrQ.d.mts → auth.interface-CkmZqat3.d.mts} +1 -1
  12. package/dist/billing/index.js +357 -357
  13. package/dist/billing/index.mjs +3 -3
  14. package/dist/{chunk-5GVY2M5X.mjs → chunk-BIL2WQEV.mjs} +264 -18
  15. package/dist/chunk-BIL2WQEV.mjs.map +1 -0
  16. package/dist/{chunk-AGKZCRG2.js → chunk-DS4IBFWA.js} +269 -23
  17. package/dist/chunk-DS4IBFWA.js.map +1 -0
  18. package/dist/{chunk-4TGGHNWL.js → chunk-F6PZZ4KI.js} +752 -752
  19. package/dist/chunk-F6PZZ4KI.js.map +1 -0
  20. package/dist/{chunk-KXTTYXJ6.mjs → chunk-HN5ED7OF.mjs} +2 -2
  21. package/dist/{chunk-K76QSQTC.mjs → chunk-UGSOBBZH.mjs} +28 -28
  22. package/dist/chunk-UGSOBBZH.mjs.map +1 -0
  23. package/dist/{chunk-SE2YSAER.js → chunk-UXJAS6C5.js} +7 -7
  24. package/dist/{chunk-SE2YSAER.js.map → chunk-UXJAS6C5.js.map} +1 -1
  25. package/dist/client/index.d.mts +5 -5
  26. package/dist/client/index.d.ts +5 -5
  27. package/dist/client/index.js +4 -4
  28. package/dist/client/index.mjs +3 -3
  29. package/dist/components/index.d.mts +6 -6
  30. package/dist/components/index.d.ts +6 -6
  31. package/dist/components/index.js +4 -4
  32. package/dist/components/index.mjs +3 -3
  33. package/dist/{config-BrkU_Ynz.d.ts → config-Cd5xTEfZ.d.ts} +1 -1
  34. package/dist/{config-snd2ToEB.d.mts → config-YyhFHxkU.d.mts} +1 -1
  35. package/dist/contexts/index.d.mts +4 -4
  36. package/dist/contexts/index.d.ts +4 -4
  37. package/dist/contexts/index.js +4 -4
  38. package/dist/contexts/index.mjs +3 -3
  39. package/dist/core/index.d.mts +24 -60
  40. package/dist/core/index.d.ts +24 -60
  41. package/dist/core/index.js +8 -2
  42. package/dist/core/index.js.map +1 -1
  43. package/dist/core/index.mjs +7 -1
  44. package/dist/features/help/index.d.mts +2 -2
  45. package/dist/features/help/index.d.ts +2 -2
  46. package/dist/features/help/index.js +37 -37
  47. package/dist/features/help/index.mjs +3 -3
  48. package/dist/features/tokenusage/index.css +29 -0
  49. package/dist/features/tokenusage/index.css.map +1 -0
  50. package/dist/features/tokenusage/index.d.mts +388 -0
  51. package/dist/features/tokenusage/index.d.ts +388 -0
  52. package/dist/features/tokenusage/index.js +1012 -0
  53. package/dist/features/tokenusage/index.js.map +1 -0
  54. package/dist/features/tokenusage/index.mjs +1012 -0
  55. package/dist/features/tokenusage/index.mjs.map +1 -0
  56. package/dist/index.d.mts +11 -9
  57. package/dist/index.d.ts +11 -9
  58. package/dist/index.js +9 -3
  59. package/dist/index.js.map +1 -1
  60. package/dist/index.mjs +8 -2
  61. package/dist/{notification.interface-LKFmZndR.d.ts → notification.interface--27exGde.d.ts} +6 -6
  62. package/dist/{notification.interface-B3kNUTZs.d.mts → notification.interface-CG1vqoxg.d.mts} +6 -6
  63. package/dist/{s3.service-BrmeMjtk.d.ts → s3.service-CpwA3sl_.d.ts} +4 -125
  64. package/dist/{s3.service-CXKV_OT-.d.mts → s3.service-Dt6MfuHr.d.mts} +4 -125
  65. package/dist/server/index.d.mts +5 -4
  66. package/dist/server/index.d.ts +5 -4
  67. package/dist/server/index.js +3 -3
  68. package/dist/server/index.mjs +1 -1
  69. package/dist/tokenusage-admin.module-5wJ_tZTj.d.ts +61 -0
  70. package/dist/tokenusage-admin.module-DQVT4O4j.d.mts +61 -0
  71. package/dist/{types-CQSjy7et.d.mts → types-Bq_UA8Lg.d.mts} +1 -1
  72. package/dist/{types-DHOxe8rc.d.ts → types-bsm8Fp55.d.ts} +1 -1
  73. package/dist/{usePageUrlGenerator-tjq2mlDV.d.ts → usePageUrlGenerator-J_ECv-oQ.d.ts} +1 -1
  74. package/dist/{usePageUrlGenerator-uOnyJ6j2.d.mts → usePageUrlGenerator-uKBjAKqC.d.mts} +1 -1
  75. package/dist/{useSocket-BsbaGPqE.d.ts → useSocket-DgGAQW6h.d.ts} +1 -1
  76. package/dist/{useSocket-BSjn1Rlb.d.mts → useSocket-M3YY0aTS.d.mts} +1 -1
  77. package/package.json +6 -1
  78. package/src/core/index.ts +5 -0
  79. package/src/core/registry/ModuleRegistry.ts +4 -0
  80. package/src/features/company/components/details/TokenStatusIndicator.tsx +9 -9
  81. package/src/features/company/data/company.interface.ts +6 -6
  82. package/src/features/company/data/company.ts +17 -17
  83. package/src/features/tokenusage/components/TokenUsageAdminContainer.tsx +189 -0
  84. package/src/features/tokenusage/components/TokenUsageAdminFilterBar.tsx +138 -0
  85. package/src/features/tokenusage/components/TokenUsageAdminTiles.tsx +177 -0
  86. package/src/features/tokenusage/components/TokenUsageBreakdownTable.tsx +160 -0
  87. package/src/features/tokenusage/components/TokenUsageRankedBar.tsx +99 -0
  88. package/src/features/tokenusage/components/TokenUsageTimelineChart.tsx +225 -0
  89. package/src/features/tokenusage/components/__tests__/TokenUsageAdminTiles.spec.tsx +42 -0
  90. package/src/features/tokenusage/components/__tests__/TokenUsageRankedBar.spec.tsx +41 -0
  91. package/src/features/tokenusage/components/__tests__/TokenUsageTimelineChart.spec.tsx +47 -0
  92. package/src/features/tokenusage/contexts/TokenUsageAdminContext.tsx +252 -0
  93. package/src/features/tokenusage/contexts/__tests__/TokenUsageAdminContext.spec.tsx +80 -0
  94. package/src/features/tokenusage/data/TokenUsageAdminService.ts +54 -0
  95. package/src/features/tokenusage/data/__tests__/tokenusage-admin-models.spec.ts +147 -0
  96. package/src/features/tokenusage/data/index.ts +8 -0
  97. package/src/features/tokenusage/data/tokenusage-admin-breakdown.interface.ts +18 -0
  98. package/src/features/tokenusage/data/tokenusage-admin-breakdown.ts +115 -0
  99. package/src/features/tokenusage/data/tokenusage-admin-summary.interface.ts +14 -0
  100. package/src/features/tokenusage/data/tokenusage-admin-summary.ts +90 -0
  101. package/src/features/tokenusage/data/tokenusage-admin-timeline.interface.ts +13 -0
  102. package/src/features/tokenusage/data/tokenusage-admin-timeline.ts +94 -0
  103. package/src/features/tokenusage/data/tokenusage-admin.types.ts +56 -0
  104. package/src/features/tokenusage/i18n-keys.ts +65 -0
  105. package/src/features/tokenusage/index.ts +30 -0
  106. package/src/features/tokenusage/lib/metrics.ts +69 -0
  107. package/src/features/tokenusage/lib/operation-label.ts +41 -0
  108. package/src/features/tokenusage/lib/palette.ts +197 -0
  109. package/src/features/tokenusage/tokenusage-admin.module.ts +22 -0
  110. package/src/features/user/contexts/CurrentUserContext.tsx +18 -18
  111. package/src/features/user/contexts/__tests__/CurrentUserContext.spec.tsx +21 -21
  112. package/dist/chunk-4TGGHNWL.js.map +0 -1
  113. package/dist/chunk-5GVY2M5X.mjs.map +0 -1
  114. package/dist/chunk-AGKZCRG2.js.map +0 -1
  115. package/dist/chunk-K76QSQTC.mjs.map +0 -1
  116. /package/dist/{BlockNoteEditor-JTKEBS2W.mjs.map → BlockNoteEditor-34QM4UR5.mjs.map} +0 -0
  117. /package/dist/{chunk-KXTTYXJ6.mjs.map → chunk-HN5ED7OF.mjs.map} +0 -0
@@ -0,0 +1,388 @@
1
+ import * as React from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { A as ApiDataInterface, J as JsonApiHydratedDataInterface } from '../../ApiDataInterface-BcZeXy5X.js';
4
+ import { A as AbstractApiData } from '../../tokenusage-admin.module-5wJ_tZTj.js';
5
+ export { b as TokenUsageAdminBreakdownModule, T as TokenUsageAdminSummaryModule, a as TokenUsageAdminTimelineModule } from '../../tokenusage-admin.module-5wJ_tZTj.js';
6
+ import { A as AbstractService } from '../../AbstractService-Cew0PD0L.js';
7
+ import '../../ApiRequestDataTypeInterface-CYEcRUrh.js';
8
+ import '../../types-bsm8Fp55.js';
9
+ import 'lucide-react';
10
+
11
+ interface TokenUsageAdminBreakdownInterface extends ApiDataInterface {
12
+ get label(): string;
13
+ get sublabel(): string | undefined;
14
+ get cost(): number;
15
+ get credits(): number;
16
+ get tokensIn(): number;
17
+ get tokensOut(): number;
18
+ get cached(): number;
19
+ get calls(): number;
20
+ /** Company dimension only. */
21
+ get activeUsers(): number | undefined;
22
+ /** Company dimension only. */
23
+ get monthlyCredits(): number | undefined;
24
+ /** Company dimension only. */
25
+ get availableMonthlyCredits(): number | undefined;
26
+ }
27
+
28
+ interface TokenUsageAdminSummaryInterface extends ApiDataInterface {
29
+ /** "customer" | "platform" | "total" */
30
+ get scope(): string;
31
+ /** "current" | "previous" */
32
+ get window(): string;
33
+ get cost(): number;
34
+ get credits(): number;
35
+ get tokensIn(): number;
36
+ get tokensOut(): number;
37
+ get cached(): number;
38
+ get calls(): number;
39
+ }
40
+
41
+ interface TokenUsageAdminTimelineInterface extends ApiDataInterface {
42
+ /** Backend declares this `type: "date"`, so it is a Date in memory. */
43
+ get bucket(): Date;
44
+ get series(): string;
45
+ get cost(): number;
46
+ get credits(): number;
47
+ get tokensIn(): number;
48
+ get tokensOut(): number;
49
+ get cached(): number;
50
+ get calls(): number;
51
+ }
52
+
53
+ type Granularity = "day" | "week" | "month";
54
+ type StackBy = "scope" | "type" | "company";
55
+ type Dimension = "company" | "user" | "operation";
56
+ type Scope = "customer" | "platform";
57
+ type Metric = "cost" | "credits" | "tokens";
58
+ type TokenUsageAdminFilters = {
59
+ /** ISO 8601 instant. */
60
+ from: string;
61
+ /** ISO 8601 instant. */
62
+ to: string;
63
+ companyId?: string;
64
+ };
65
+ type TokenUsageAdminSummaryInput = {
66
+ id: string;
67
+ scope: string;
68
+ window: string;
69
+ cost: number;
70
+ credits: number;
71
+ tokensIn: number;
72
+ tokensOut: number;
73
+ cached: number;
74
+ calls: number;
75
+ };
76
+ type TokenUsageAdminTimelineInput = {
77
+ id: string;
78
+ /** Backend field type is "date" — emitted via formatLocalDate, never raw. */
79
+ bucket: Date;
80
+ series: string;
81
+ cost: number;
82
+ credits: number;
83
+ tokensIn: number;
84
+ tokensOut: number;
85
+ cached: number;
86
+ calls: number;
87
+ };
88
+ type TokenUsageAdminBreakdownInput = {
89
+ id: string;
90
+ label: string;
91
+ sublabel?: string;
92
+ cost: number;
93
+ credits: number;
94
+ tokensIn: number;
95
+ tokensOut: number;
96
+ cached: number;
97
+ calls: number;
98
+ activeUsers?: number;
99
+ monthlyCredits?: number;
100
+ availableMonthlyCredits?: number;
101
+ };
102
+
103
+ type TokenUsageAdminFilterState = {
104
+ /** ISO 8601 instant. */
105
+ from: string;
106
+ /** ISO 8601 instant. */
107
+ to: string;
108
+ granularity: Granularity;
109
+ stackBy: StackBy;
110
+ companyId?: string;
111
+ metric: Metric;
112
+ };
113
+ interface TokenUsageAdminContextType {
114
+ summary: TokenUsageAdminSummaryInterface[];
115
+ timeline: TokenUsageAdminTimelineInterface[];
116
+ byCompany: TokenUsageAdminBreakdownInterface[];
117
+ byUser: TokenUsageAdminBreakdownInterface[];
118
+ /** Platform-side spend split by operation. Always empty in single-customer mode. */
119
+ /** Platform spend by operation — empty in single-customer mode. */
120
+ byOperation: TokenUsageAdminBreakdownInterface[];
121
+ /** Customer spend by operation — the customer-side mirror of byOperation. */
122
+ byCustomerOperation: TokenUsageAdminBreakdownInterface[];
123
+ companies: {
124
+ id: string;
125
+ label: string;
126
+ }[];
127
+ filters: TokenUsageAdminFilterState;
128
+ /** Merges a partial patch into the current filters; every key is optional. */
129
+ setFilters: (next: Partial<TokenUsageAdminFilterState>) => void;
130
+ /** `true` once a company filter is applied — the platform panels are meaningless then. */
131
+ singleCustomerMode: boolean;
132
+ isLoading: boolean;
133
+ error: string | null;
134
+ }
135
+ type TokenUsageAdminProviderProps = {
136
+ children: ReactNode;
137
+ /** Pre-select a company, which puts the page in single-customer mode from the first render. */
138
+ initialCompanyId?: string;
139
+ /** ISO 8601 instant. Defaults to the start of the current month. */
140
+ initialFrom?: string;
141
+ /** ISO 8601 instant. Defaults to now. */
142
+ initialTo?: string;
143
+ /** Rows per ranked panel. Defaults to 10. */
144
+ topN?: number;
145
+ };
146
+ /**
147
+ * Owns every filter the administrative token-usage page reads, fetches the five
148
+ * panels behind it, and publishes the filter bar into the page title bar.
149
+ *
150
+ * The filter bar is rendered into `title.functions` here — NOT in the container —
151
+ * because `RoundPageContainer`'s title bar reads `title.functions` from
152
+ * `SharedContext`, and a descendant cannot inject nodes into an ancestor's
153
+ * provider value. That is why the filter state lives at this level.
154
+ */
155
+ declare const TokenUsageAdminProvider: ({ children, initialCompanyId, initialFrom, initialTo, topN, }: TokenUsageAdminProviderProps) => React.JSX.Element;
156
+ declare const useTokenUsageAdmin: () => TokenUsageAdminContextType;
157
+
158
+ /**
159
+ * Page body for the administrative token-usage dashboard.
160
+ *
161
+ * Stateless by design — every value it renders comes from
162
+ * `useTokenUsageAdmin()`. The filter bar is deliberately NOT here: it belongs to
163
+ * the page title bar, which `RoundPageContainer` fills from `SharedContext`, so
164
+ * the provider publishes it (see TokenUsageAdminContext).
165
+ */
166
+ declare function TokenUsageAdminContainer(): React.JSX.Element;
167
+
168
+ type FilterState = {
169
+ from: string;
170
+ to: string;
171
+ granularity: Granularity;
172
+ companyId?: string;
173
+ metric: Metric;
174
+ };
175
+ type Props$3 = FilterState & {
176
+ companies: {
177
+ id: string;
178
+ label: string;
179
+ }[];
180
+ /** Receives ONLY the keys that changed. */
181
+ onChange: (next: Partial<FilterState>) => void;
182
+ };
183
+ /**
184
+ * The single control row above the KPI tiles.
185
+ *
186
+ * It is deliberately stateless: every control reports the one key it changed and
187
+ * the owning context re-fetches. Keeping the whole filter state in one place is
188
+ * what lets the page issue a single coordinated batch of requests instead of one
189
+ * per control.
190
+ */
191
+ declare function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, onChange }: Props$3): React.JSX.Element;
192
+
193
+ type Props$2 = {
194
+ /** The six summary rows: {customer, platform, total} × {current, previous}. */
195
+ summary: TokenUsageAdminSummaryInterface[];
196
+ metric: Metric;
197
+ /** True when a company filter is applied — platform spend is then meaningless. */
198
+ singleCustomerMode: boolean;
199
+ };
200
+ /**
201
+ * The KPI header of the administrative token-usage page.
202
+ *
203
+ * Two lead tiles carry the cost centres — customer spend and platform spend —
204
+ * each with its delta against the equal-length preceding window. Three
205
+ * supporting tiles below carry the totals that give those two numbers context.
206
+ *
207
+ * The backend always returns both windows, which is why no tile has to branch on
208
+ * a missing row: an absent scope is simply zero-filled here.
209
+ */
210
+ declare function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }: Props$2): React.JSX.Element;
211
+
212
+ type Props$1 = {
213
+ /** Ranked rows, already ordered descending by the backend, "other" last. */
214
+ rows: TokenUsageAdminBreakdownInterface[];
215
+ metric: Metric;
216
+ /** Italian copy shown when there is nothing to rank. */
217
+ emptyLabel: string;
218
+ /**
219
+ * Whether `row.label` is an operation TYPE (vocabulary the consuming app
220
+ * translates) rather than an entity NAME (data, rendered verbatim).
221
+ *
222
+ * Company and user rows carry names — translating them would be nonsense — so
223
+ * this defaults to false and only the platform-by-operation panel opts in.
224
+ */
225
+ labelsAreOperationTypes?: boolean;
226
+ };
227
+ /**
228
+ * A ranked horizontal bar list — "who spent the most".
229
+ *
230
+ * This does a MAGNITUDE job, not a categorical one, so colour comes from a
231
+ * single sequential ramp indexed by RANK POSITION, never from a categorical
232
+ * palette keyed by entity. That is deliberate: a filter change reorders the
233
+ * rows, and rank-indexed colour simply re-shades them instead of repainting a
234
+ * company into another company's identity hue.
235
+ *
236
+ * There is exactly one series, so there is no legend: every bar is
237
+ * direct-labelled with its value and its share of the total.
238
+ */
239
+ declare function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes }: Props$1): React.JSX.Element;
240
+
241
+ type Props = {
242
+ rows: TokenUsageAdminBreakdownInterface[];
243
+ metric: Metric;
244
+ };
245
+ /**
246
+ * The numeric detail behind the ranked bars: every row, every metric column.
247
+ *
248
+ * The bars answer "who is biggest"; this answers "why". Sorting is client-side
249
+ * because the whole ranked set — top-N plus the "other" rollup — is already in
250
+ * memory, so a round trip would buy nothing.
251
+ */
252
+ declare function TokenUsageBreakdownTable({ rows, metric }: Props): React.JSX.Element;
253
+
254
+ type TokenUsageTimelineChartProps = {
255
+ rows: TokenUsageAdminTimelineInterface[];
256
+ metric: Metric;
257
+ stackBy: StackBy;
258
+ className?: string;
259
+ };
260
+ /**
261
+ * Usage over time as a stacked bar chart.
262
+ *
263
+ * Colour does an IDENTITY job here — each stacked segment is a series, not a
264
+ * magnitude — so it draws the fixed categorical order from `../lib/palette` and
265
+ * never generates or cycles a hue: series past the ceiling are summed into a
266
+ * single "other" segment painted in the palette's neutral.
267
+ *
268
+ * The palette's light-mode validator run carries a sub-3:1 contrast WARN on
269
+ * three slots, which obliges a relief channel. That is why the legend and the
270
+ * value-carrying tooltip below are not optional decoration: they are what makes
271
+ * the low-contrast fills readable.
272
+ */
273
+ declare function TokenUsageTimelineChart({ rows, metric, stackBy, className }: TokenUsageTimelineChartProps): React.JSX.Element;
274
+
275
+ /**
276
+ * One row of the administrative summary: a cost centre observed over one time
277
+ * window. Six rows are returned per request — scope crossed with window — so the
278
+ * KPI tiles can render a value and its delta without a second call.
279
+ */
280
+ declare class TokenUsageAdminSummary extends AbstractApiData implements TokenUsageAdminSummaryInterface {
281
+ private _scope;
282
+ private _window;
283
+ private _cost;
284
+ private _credits;
285
+ private _tokensIn;
286
+ private _tokensOut;
287
+ private _cached;
288
+ private _calls;
289
+ get scope(): string;
290
+ get window(): string;
291
+ get cost(): number;
292
+ get credits(): number;
293
+ get tokensIn(): number;
294
+ get tokensOut(): number;
295
+ get cached(): number;
296
+ get calls(): number;
297
+ rehydrate(data: JsonApiHydratedDataInterface): this;
298
+ createJsonApi(data: TokenUsageAdminSummaryInput): any;
299
+ }
300
+
301
+ /**
302
+ * One (bucket, series) cell of the usage-over-time chart. Rows arrive flat; the
303
+ * chart pivots them into stacked columns.
304
+ */
305
+ declare class TokenUsageAdminTimeline extends AbstractApiData implements TokenUsageAdminTimelineInterface {
306
+ private _bucket;
307
+ private _series;
308
+ private _cost;
309
+ private _credits;
310
+ private _tokensIn;
311
+ private _tokensOut;
312
+ private _cached;
313
+ private _calls;
314
+ get bucket(): Date;
315
+ get series(): string;
316
+ get cost(): number;
317
+ get credits(): number;
318
+ get tokensIn(): number;
319
+ get tokensOut(): number;
320
+ get cached(): number;
321
+ get calls(): number;
322
+ rehydrate(data: JsonApiHydratedDataInterface): this;
323
+ createJsonApi(data: TokenUsageAdminTimelineInput): any;
324
+ }
325
+
326
+ /**
327
+ * One ranked row of a breakdown. The same shape serves all three dimensions —
328
+ * company, user and operation — which is why the three "by-X" views collapse
329
+ * into a single `breakdown?dimension=` call.
330
+ *
331
+ * `activeUsers` / `monthlyCredits` / `availableMonthlyCredits` are populated only
332
+ * for `dimension=company`; they are absent on user and operation rows.
333
+ */
334
+ declare class TokenUsageAdminBreakdown extends AbstractApiData implements TokenUsageAdminBreakdownInterface {
335
+ private _label;
336
+ private _sublabel?;
337
+ private _cost;
338
+ private _credits;
339
+ private _tokensIn;
340
+ private _tokensOut;
341
+ private _cached;
342
+ private _calls;
343
+ private _activeUsers?;
344
+ private _monthlyCredits?;
345
+ private _availableMonthlyCredits?;
346
+ get label(): string;
347
+ get sublabel(): string | undefined;
348
+ get cost(): number;
349
+ get credits(): number;
350
+ get tokensIn(): number;
351
+ get tokensOut(): number;
352
+ get cached(): number;
353
+ get calls(): number;
354
+ get activeUsers(): number | undefined;
355
+ get monthlyCredits(): number | undefined;
356
+ get availableMonthlyCredits(): number | undefined;
357
+ rehydrate(data: JsonApiHydratedDataInterface): this;
358
+ createJsonApi(data: TokenUsageAdminBreakdownInput): any;
359
+ }
360
+
361
+ declare class TokenUsageAdminService extends AbstractService {
362
+ /** Six rows: {customer, platform, total} × {current, previous}. */
363
+ static getSummary(filters: TokenUsageAdminFilters): Promise<TokenUsageAdminSummaryInterface[]>;
364
+ static getTimeline(params: TokenUsageAdminFilters & {
365
+ granularity: Granularity;
366
+ stackBy: StackBy;
367
+ }): Promise<TokenUsageAdminTimelineInterface[]>;
368
+ static getBreakdown(params: TokenUsageAdminFilters & {
369
+ dimension: Dimension;
370
+ scope: Scope;
371
+ limit?: number;
372
+ }): Promise<TokenUsageAdminBreakdownInterface[]>;
373
+ }
374
+
375
+ /**
376
+ * The fixed namespace of i18n keys the administrative token-usage feature reads
377
+ * via useTranslations/getTranslations. Consuming apps must define each entry in
378
+ * their messages/<locale>.json — this list is the contract between the package
379
+ * and the app.
380
+ *
381
+ * One key is NOT listed because it is resolved from data rather than from a
382
+ * fixed string: the timeline chart labels each series through
383
+ * `token_usage.types.<camelCase>` and falls back to the raw series key when the
384
+ * app has no entry, so that namespace stays the app's own vocabulary.
385
+ */
386
+ declare const TOKEN_USAGE_ADMIN_I18N_KEYS: readonly ["token_usage.admin.title", "token_usage.admin.customer_spend", "token_usage.admin.platform_spend", "token_usage.admin.total_cost", "token_usage.admin.avg_per_call", "token_usage.admin.cache_hit", "token_usage.admin.vs_previous", "token_usage.admin.usage_over_time", "token_usage.admin.by_company", "token_usage.admin.by_user", "token_usage.admin.customer_by_operation", "token_usage.admin.platform_by_operation", "token_usage.admin.detail", "token_usage.admin.other", "token_usage.admin.no_data", "token_usage.admin.all_companies", "token_usage.admin.granularity.label", "token_usage.admin.granularity.day", "token_usage.admin.granularity.week", "token_usage.admin.granularity.month", "token_usage.admin.metric.label", "token_usage.admin.metric.cost", "token_usage.admin.metric.credits", "token_usage.admin.metric.tokens", "token_usage.admin.stack_by", "token_usage.admin.stack.scope", "token_usage.admin.stack.type", "token_usage.admin.stack.company", "token_usage.admin.columns.label", "token_usage.admin.columns.sublabel", "token_usage.admin.columns.calls", "token_usage.admin.columns.tokens_in", "token_usage.admin.columns.tokens_out", "token_usage.admin.columns.cost", "token_usage.admin.columns.credits", "token_usage.admin.columns.share", "token_usage.admin.columns.active_users", "token_usage.series.other", "token_usage.timeline.empty"];
387
+
388
+ export { type Dimension, type Granularity, type Metric, type Scope, type StackBy, TOKEN_USAGE_ADMIN_I18N_KEYS, TokenUsageAdminBreakdown, type TokenUsageAdminBreakdownInput, type TokenUsageAdminBreakdownInterface, TokenUsageAdminContainer, type TokenUsageAdminContextType, TokenUsageAdminFilterBar, type TokenUsageAdminFilterState, type TokenUsageAdminFilters, TokenUsageAdminProvider, TokenUsageAdminService, TokenUsageAdminSummary, type TokenUsageAdminSummaryInput, type TokenUsageAdminSummaryInterface, TokenUsageAdminTiles, TokenUsageAdminTimeline, type TokenUsageAdminTimelineInput, type TokenUsageAdminTimelineInterface, TokenUsageBreakdownTable, TokenUsageRankedBar, TokenUsageTimelineChart, useTokenUsageAdmin };