@carlonicora/nextjs-jsonapi 2.0.2 → 2.0.3

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.
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- var _chunkQS5Y6ZBFjs = require('../../chunk-QS5Y6ZBF.js');
29
+ var _chunkPBKZYJRJjs = require('../../chunk-PBKZYJRJ.js');
30
30
  require('../../chunk-UXJAS6C5.js');
31
31
 
32
32
 
@@ -64,7 +64,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
64
64
  };
65
65
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
66
66
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
67
- _chunkQS5Y6ZBFjs.DateRangeSelector,
67
+ _chunkPBKZYJRJjs.DateRangeSelector,
68
68
  {
69
69
  onDateChange: (range) => {
70
70
  if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
@@ -99,16 +99,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
99
99
  }
100
100
  ),
101
101
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
102
- _chunkQS5Y6ZBFjs.Select,
102
+ _chunkPBKZYJRJjs.Select,
103
103
  {
104
104
  items: companyItems,
105
105
  value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
106
106
  onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
107
107
  children: [
108
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
109
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.SelectContent, { children: [
110
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
111
- companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectItem, { value: company.id, children: company.label }, company.id))
108
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
109
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.SelectContent, { children: [
110
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
111
+ companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectItem, { value: company.id, children: company.label }, company.id))
112
112
  ] })
113
113
  ]
114
114
  }
@@ -131,7 +131,7 @@ function Segmented({
131
131
  children: options.map((option) => {
132
132
  const selected = option.value === value;
133
133
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
134
- _chunkQS5Y6ZBFjs.Button,
134
+ _chunkPBKZYJRJjs.Button,
135
135
  {
136
136
  type: "button",
137
137
  size: "sm",
@@ -212,7 +212,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
212
212
  topN = DEFAULT_TOP_N
213
213
  }) => {
214
214
  const t = _nextintl.useTranslations.call(void 0, );
215
- const generateUrl = _chunkQS5Y6ZBFjs.usePageUrlGenerator.call(void 0, );
215
+ const generateUrl = _chunkPBKZYJRJjs.usePageUrlGenerator.call(void 0, );
216
216
  const [filters, setFilterState] = _react.useState.call(void 0, () => {
217
217
  const range = defaultRange();
218
218
  return {
@@ -330,7 +330,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
330
330
  error
331
331
  ]
332
332
  );
333
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
333
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
334
334
  }, "TokenUsageAdminProvider");
335
335
  var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
336
336
  const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
@@ -458,7 +458,7 @@ function LeadTile({
458
458
  delta,
459
459
  previousLabel
460
460
  }) {
461
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { className: "grid gap-1", children: [
461
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.CardContent, { className: "grid gap-1", children: [
462
462
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
463
463
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
464
464
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
@@ -474,7 +474,7 @@ function SupportingTile({
474
474
  value,
475
475
  delta
476
476
  }) {
477
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { className: "grid gap-1", children: [
477
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.CardContent, { className: "grid gap-1", children: [
478
478
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
479
479
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
480
480
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
@@ -566,8 +566,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
566
566
  // The package's <Table> wraps itself in an `overflow-x-clip` container, which
567
567
  // would swallow the overflow before this scroller ever saw it — hence the
568
568
  // child override. Wide metric tables must scroll, never widen the page.
569
- /* @__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, _chunkQS5Y6ZBFjs.Table, { children: [
570
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableHead, { className: _chunkDS4IBFWAjs.cn.call(void 0, column.numeric && "text-right"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
569
+ /* @__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, _chunkPBKZYJRJjs.Table, { children: [
570
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableHead, { className: _chunkDS4IBFWAjs.cn.call(void 0, column.numeric && "text-right"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
571
571
  "button",
572
572
  {
573
573
  type: "button",
@@ -582,20 +582,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
582
582
  ]
583
583
  }
584
584
  ) }, column.key)) }) }),
585
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableBody, { children: sortedRows.map((row) => {
585
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableBody, { children: sortedRows.map((row) => {
586
586
  const value = metricValue(row, metric);
587
587
  const share = total > 0 ? value / total * 100 : 0;
588
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
589
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
590
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
591
- showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : formatDecimal(row.activeUsers, 0) }),
592
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.calls, 0) }),
593
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensIn, 0) }),
594
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensOut, 0) }),
595
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(cacheHitPercentage(row.cached, row.tokensIn)) }),
596
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.cost, "cost") }),
597
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.credits, "credits") }),
598
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(share) })
588
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
589
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
590
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
591
+ showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : formatDecimal(row.activeUsers, 0) }),
592
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.calls, 0) }),
593
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensIn, 0) }),
594
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensOut, 0) }),
595
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(cacheHitPercentage(row.cached, row.tokensIn)) }),
596
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.cost, "cost") }),
597
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.credits, "credits") }),
598
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(share) })
599
599
  ] }, row.id);
600
600
  }) })
601
601
  ] }) })
@@ -789,7 +789,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
789
789
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, children: [
790
790
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
791
791
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
792
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.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: [
792
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.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: [
793
793
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
794
794
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
795
795
  _recharts.XAxis,
@@ -813,17 +813,17 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
813
813
  }
814
814
  ),
815
815
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
816
- _chunkQS5Y6ZBFjs.ChartTooltip,
816
+ _chunkPBKZYJRJjs.ChartTooltip,
817
817
  {
818
818
  content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
819
- _chunkQS5Y6ZBFjs.ChartTooltipContent,
819
+ _chunkPBKZYJRJjs.ChartTooltipContent,
820
820
  {
821
821
  labelFormatter: (value) => formatBucket.format(/* @__PURE__ */ new Date(`${String(value)}T00:00:00.000Z`))
822
822
  }
823
823
  )
824
824
  }
825
825
  ),
826
- seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.ChartLegendContent, {}) }) : null,
826
+ seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.ChartLegendContent, {}) }) : null,
827
827
  seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
828
828
  _recharts.Bar,
829
829
  {
@@ -869,19 +869,19 @@ function TokenUsageAdminContainer() {
869
869
  [t]
870
870
  );
871
871
  if (error) {
872
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
872
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
873
873
  }
874
- if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
874
+ if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
875
875
  const emptyLabel = t("token_usage.admin.no_data");
876
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
876
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
877
877
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode }),
878
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
879
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: [
880
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
881
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
878
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.Card, { children: [
879
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.CardHeader, { children: [
880
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
881
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
882
882
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
883
883
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
884
- _chunkQS5Y6ZBFjs.Select,
884
+ _chunkPBKZYJRJjs.Select,
885
885
  {
886
886
  items: stackByItems,
887
887
  value: filters.stackBy,
@@ -889,29 +889,29 @@ function TokenUsageAdminContainer() {
889
889
  if (value) setFilters({ stackBy: value });
890
890
  },
891
891
  children: [
892
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectValue, {}) }),
893
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectItem, { value, children: stackByItems[value] }, value)) })
892
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectValue, {}) }),
893
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.SelectItem, { value, children: stackByItems[value] }, value)) })
894
894
  ]
895
895
  }
896
896
  )
897
897
  ] }) })
898
898
  ] }),
899
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
899
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
900
900
  ] }),
901
901
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
902
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
903
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
904
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
902
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.Card, { children: [
903
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
904
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
905
905
  ] }),
906
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
907
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
908
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
906
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.Card, { children: [
907
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
908
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
909
909
  ] })
910
910
  ] }),
911
911
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkDS4IBFWAjs.cn.call(void 0, "grid gap-4", !singleCustomerMode && "md:grid-cols-2"), children: [
912
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
913
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
914
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
912
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.Card, { children: [
913
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
914
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
915
915
  TokenUsageRankedBar,
916
916
  {
917
917
  rows: byCustomerOperation,
@@ -921,9 +921,9 @@ function TokenUsageAdminContainer() {
921
921
  }
922
922
  ) })
923
923
  ] }),
924
- !singleCustomerMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
925
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
926
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
924
+ !singleCustomerMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.Card, { children: [
925
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
926
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
927
927
  TokenUsageRankedBar,
928
928
  {
929
929
  rows: byOperation,
@@ -934,9 +934,9 @@ function TokenUsageAdminContainer() {
934
934
  ) })
935
935
  ] })
936
936
  ] }),
937
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
938
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
939
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
937
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkPBKZYJRJjs.Card, { children: [
938
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
939
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPBKZYJRJjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
940
940
  ] })
941
941
  ] }) });
942
942
  }
@@ -26,7 +26,7 @@ import {
26
26
  TableHeader,
27
27
  TableRow,
28
28
  usePageUrlGenerator
29
- } from "../../chunk-TESVH5PV.mjs";
29
+ } from "../../chunk-QHGSBZCL.mjs";
30
30
  import "../../chunk-HN5ED7OF.mjs";
31
31
  import {
32
32
  AbstractService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carlonicora/nextjs-jsonapi",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Next.js JSON:API client with server/client support and caching",
5
5
  "author": "Carlo Nicora",
6
6
  "license": "GPL-3.0-or-later",
@@ -121,20 +121,25 @@ export function TokenStatusIndicator({ className, size = "md", showExtraPages =
121
121
 
122
122
  return (
123
123
  <Tooltip>
124
- <TooltipTrigger>
125
- <div
126
- className={cn("inline-flex items-center gap-1.5 cursor-default", className)}
127
- aria-label={t("billing.tokens.status", { defaultValue: "Page Status" })}
128
- >
129
- {getBatteryIcon()}
130
- <span className={cn(textSize, "text-muted-foreground font-medium")}>{availableMonthlyCredits}</span>
131
- {showExtraPages && availableExtraCredits > 0 && (
132
- <div className="inline-flex items-center gap-0.5">
133
- <PlusCircle className={cn(smallIconSize, "text-blue-500")} />
134
- <span className={cn(textSize, "text-blue-500 font-medium")}>{availableExtraCredits}</span>
135
- </div>
136
- )}
137
- </div>
124
+ {/* The layout classes live on the trigger itself, which renders the
125
+ <button>. Wrapping them in a nested inline-flex div instead makes that
126
+ child sit on the button's text baseline, so the button reserves
127
+ descender space below it and the icons render ~2px above the centre of
128
+ any flex row the indicator is placed in (e.g. the app header). */}
129
+ <TooltipTrigger
130
+ className={cn("inline-flex items-center gap-1.5 cursor-default", className)}
131
+ aria-label={t("billing.tokens.status", { defaultValue: "Page Status" })}
132
+ >
133
+ {getBatteryIcon()}
134
+ <span className={cn(textSize, "text-muted-foreground font-medium leading-none")}>
135
+ {availableMonthlyCredits}
136
+ </span>
137
+ {showExtraPages && availableExtraCredits > 0 && (
138
+ <span className="inline-flex items-center gap-0.5">
139
+ <PlusCircle className={cn(smallIconSize, "text-blue-500")} />
140
+ <span className={cn(textSize, "text-blue-500 font-medium leading-none")}>{availableExtraCredits}</span>
141
+ </span>
142
+ )}
138
143
  </TooltipTrigger>
139
144
  <TooltipContent side="top" className="max-w-xs">
140
145
  {tooltipContent}