@carlonicora/nextjs-jsonapi 5.1.1 → 5.1.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.
@@ -37,7 +37,7 @@ var _chunk67NJY7SMjs = require('../../chunk-67NJY7SM.js');
37
37
 
38
38
 
39
39
 
40
- var _chunkYZN2774Pjs = require('../../chunk-YZN2774P.js');
40
+ var _chunkSZQNUGDGjs = require('../../chunk-SZQNUGDG.js');
41
41
  require('../../chunk-TO6IYGML.js');
42
42
  require('../../chunk-G4JR3SFV.js');
43
43
 
@@ -82,7 +82,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
82
82
  };
83
83
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
84
84
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
85
- _chunkYZN2774Pjs.DateRangeSelector,
85
+ _chunkSZQNUGDGjs.DateRangeSelector,
86
86
  {
87
87
  onDateChange: (range) => {
88
88
  if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
@@ -117,16 +117,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
117
117
  }
118
118
  ),
119
119
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
120
- _chunkYZN2774Pjs.Select,
120
+ _chunkSZQNUGDGjs.Select,
121
121
  {
122
122
  items: companyItems,
123
123
  value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
124
124
  onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
125
125
  children: [
126
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
127
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.SelectContent, { children: [
128
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
129
- companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectItem, { value: company.id, children: company.label }, company.id))
126
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
127
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.SelectContent, { children: [
128
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
129
+ companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectItem, { value: company.id, children: company.label }, company.id))
130
130
  ] })
131
131
  ]
132
132
  }
@@ -149,7 +149,7 @@ function Segmented({
149
149
  children: options.map((option) => {
150
150
  const selected = option.value === value;
151
151
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
152
- _chunkYZN2774Pjs.Button,
152
+ _chunkSZQNUGDGjs.Button,
153
153
  {
154
154
  type: "button",
155
155
  size: "sm",
@@ -231,7 +231,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
231
231
  pageUrl = TOKEN_USAGE_ADMIN_PAGE_URL
232
232
  }) => {
233
233
  const t = _nextintl.useTranslations.call(void 0, );
234
- const generateUrl = _chunkYZN2774Pjs.usePageUrlGenerator.call(void 0, );
234
+ const generateUrl = _chunkSZQNUGDGjs.usePageUrlGenerator.call(void 0, );
235
235
  const [filters, setFilterState] = _react.useState.call(void 0, () => {
236
236
  const range = defaultRange();
237
237
  return {
@@ -349,7 +349,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
349
349
  error
350
350
  ]
351
351
  );
352
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
352
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
353
353
  }, "TokenUsageAdminProvider");
354
354
  var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
355
355
  const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
@@ -446,7 +446,7 @@ function LeadTile({
446
446
  previousLabel,
447
447
  decimal
448
448
  }) {
449
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.CardContent, { className: "grid gap-1", children: [
449
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.CardContent, { className: "grid gap-1", children: [
450
450
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
451
451
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
452
452
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
@@ -463,7 +463,7 @@ function SupportingTile({
463
463
  delta,
464
464
  decimal
465
465
  }) {
466
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.CardContent, { className: "grid gap-1", children: [
466
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.CardContent, { className: "grid gap-1", children: [
467
467
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
468
468
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
469
469
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
@@ -560,8 +560,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
560
560
  // The package's <Table> wraps itself in an `overflow-x-clip` container, which
561
561
  // would swallow the overflow before this scroller ever saw it — hence the
562
562
  // child override. Wide metric tables must scroll, never widen the page.
563
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Table, { children: [
564
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableHead, { className: _chunkVVJDWQEIjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
563
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Table, { children: [
564
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableHead, { className: _chunkVVJDWQEIjs.cn.call(void 0, column.numeric && "text-end"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
565
565
  "button",
566
566
  {
567
567
  type: "button",
@@ -576,20 +576,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
576
576
  ]
577
577
  }
578
578
  ) }, column.key)) }) }),
579
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableBody, { children: sortedRows.map((row) => {
579
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableBody, { children: sortedRows.map((row) => {
580
580
  const value = _chunk67NJY7SMjs.metricValue.call(void 0, row, metric);
581
581
  const share = total > 0 ? value / total * 100 : 0;
582
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
583
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
584
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
585
- showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
586
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
587
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
588
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
589
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunk67NJY7SMjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
590
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
591
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
592
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
582
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
583
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
584
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
585
+ showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : decimal(row.activeUsers, 0) }),
586
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.calls, 0) }),
587
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensIn, 0) }),
588
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: decimal(row.tokensOut, 0) }),
589
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(_chunk67NJY7SMjs.cacheHitPercentage.call(void 0, row.cached, row.tokensIn)) }),
590
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.cost, "cost") }),
591
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: formatValue(row.credits, "credits") }),
592
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.TableCell, { className: "text-end text-xs tabular-nums", children: percent(share) })
593
593
  ] }, row.id);
594
594
  }) })
595
595
  ] }) })
@@ -757,7 +757,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
757
757
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, dir: "ltr", children: [
758
758
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
759
759
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
760
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.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: [
760
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.ChartContainer, { config: chartConfig, className: "aspect-auto h-72 w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _recharts.BarChart, { accessibilityLayer: true, data: chartData, margin: { top: 8, right: 8, bottom: 0, left: 0 }, children: [
761
761
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
762
762
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
763
763
  _recharts.XAxis,
@@ -781,10 +781,10 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
781
781
  }
782
782
  ),
783
783
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
784
- _chunkYZN2774Pjs.ChartTooltip,
784
+ _chunkSZQNUGDGjs.ChartTooltip,
785
785
  {
786
786
  content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
787
- _chunkYZN2774Pjs.ChartTooltipContent,
787
+ _chunkSZQNUGDGjs.ChartTooltipContent,
788
788
  {
789
789
  labelFormatter: (value) => bucketDate(String(value), granularity),
790
790
  valueFormatter: (value) => formatValue(Number(value), metric),
@@ -793,7 +793,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
793
793
  )
794
794
  }
795
795
  ),
796
- seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.ChartLegendContent, {}) }) : null,
796
+ seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.ChartLegendContent, {}) }) : null,
797
797
  seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
798
798
  _recharts.Bar,
799
799
  {
@@ -845,19 +845,19 @@ function TokenUsageAdminContainer() {
845
845
  [t]
846
846
  );
847
847
  if (error) {
848
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
848
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
849
849
  }
850
- if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
850
+ if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
851
851
  const emptyLabel = t("token_usage.admin.no_data");
852
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
852
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
853
853
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode: hidePlatform }),
854
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
855
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: [
856
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
857
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
854
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
855
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: [
856
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
857
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
858
858
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
859
859
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
860
- _chunkYZN2774Pjs.Select,
860
+ _chunkSZQNUGDGjs.Select,
861
861
  {
862
862
  items: stackByItems,
863
863
  value: filters.stackBy,
@@ -865,29 +865,29 @@ function TokenUsageAdminContainer() {
865
865
  if (value) setFilters({ stackBy: value });
866
866
  },
867
867
  children: [
868
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectValue, {}) }),
869
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SelectItem, { value, children: stackByItems[value] }, value)) })
868
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectValue, {}) }),
869
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SelectItem, { value, children: stackByItems[value] }, value)) })
870
870
  ]
871
871
  }
872
872
  )
873
873
  ] }) })
874
874
  ] }),
875
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
875
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
876
876
  ] }),
877
877
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
878
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
879
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
880
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
878
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
879
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
880
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
881
881
  ] }),
882
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
883
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
884
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
882
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
883
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
884
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
885
885
  ] })
886
886
  ] }),
887
887
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkVVJDWQEIjs.cn.call(void 0, "grid gap-4", !hidePlatform && "md:grid-cols-2"), children: [
888
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
889
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
890
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
888
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
889
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
890
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
891
891
  TokenUsageRankedBar,
892
892
  {
893
893
  rows: byCustomerOperation,
@@ -897,9 +897,9 @@ function TokenUsageAdminContainer() {
897
897
  }
898
898
  ) })
899
899
  ] }),
900
- !hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
901
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
902
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
900
+ !hidePlatform && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
901
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
902
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
903
903
  TokenUsageRankedBar,
904
904
  {
905
905
  rows: byOperation,
@@ -910,9 +910,9 @@ function TokenUsageAdminContainer() {
910
910
  ) })
911
911
  ] })
912
912
  ] }),
913
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
914
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
915
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
913
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
914
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
915
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
916
916
  ] })
917
917
  ] }) });
918
918
  }
@@ -1033,7 +1033,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
1033
1033
 
1034
1034
  function TokenUsageReportFilterBar({ onChange }) {
1035
1035
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-help": "tokenusage.filters", className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1036
- _chunkYZN2774Pjs.DateRangeSelector,
1036
+ _chunkSZQNUGDGjs.DateRangeSelector,
1037
1037
  {
1038
1038
  onDateChange: (range) => {
1039
1039
  if (!_optionalChain([range, 'optionalAccess', _5 => _5.from]) || !_optionalChain([range, 'optionalAccess', _6 => _6.to])) return;
@@ -1066,7 +1066,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
1066
1066
  pageUrl = TOKEN_USAGE_REPORT_PAGE_URL
1067
1067
  }) => {
1068
1068
  const t = _nextintl.useTranslations.call(void 0, );
1069
- const generateUrl = _chunkYZN2774Pjs.usePageUrlGenerator.call(void 0, );
1069
+ const generateUrl = _chunkSZQNUGDGjs.usePageUrlGenerator.call(void 0, );
1070
1070
  const [filters, setFilterState] = _react.useState.call(void 0, () => {
1071
1071
  const range = defaultRange2();
1072
1072
  return { from: _nullishCoalesce(initialFrom, () => ( range.from)), to: _nullishCoalesce(initialTo, () => ( range.to)) };
@@ -1130,7 +1130,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
1130
1130
  () => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
1131
1131
  [summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
1132
1132
  );
1133
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
1133
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportContext.Provider, { value: contextValue, children }) });
1134
1134
  }, "TokenUsageReportProvider");
1135
1135
  var useTokenUsageReport = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
1136
1136
  const ctx = _react.useContext.call(void 0, TokenUsageReportContext);
@@ -1158,7 +1158,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
1158
1158
  const monthlyColor = monthlyPercentage > 75 ? "text-success" : monthlyPercentage >= 5 ? "text-warning" : "text-destructive";
1159
1159
  const whole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => decimal(Math.max(0, Math.floor(value)), 0), "whole");
1160
1160
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3", children: [
1161
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.CardContent, { className: "grid gap-1", children: [
1161
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { "data-testid": "tile-used", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.CardContent, { className: "grid gap-1", children: [
1162
1162
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.used_in_period") }),
1163
1163
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: formatValue(_chunk67NJY7SMjs.metricValue.call(void 0, current, metric), metric) }),
1164
1164
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
@@ -1174,7 +1174,7 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
1174
1174
  ] })
1175
1175
  ] }) }),
1176
1176
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-3 sm:grid-cols-3", children: [
1177
- balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.CardContent, { className: "grid gap-1", children: [
1177
+ balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { "data-testid": "tile-monthly", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.CardContent, { className: "grid gap-1", children: [
1178
1178
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.monthly_left") }),
1179
1179
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-baseline gap-1", children: [
1180
1180
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "tile-monthly-value", className: _chunkVVJDWQEIjs.cn.call(void 0, "text-sm font-medium tabular-nums", monthlyColor), children: whole(balances.availableMonthlyCredits) }),
@@ -1184,11 +1184,11 @@ function TokenUsageReportTiles({ summary, metric, balances }) {
1184
1184
  ] })
1185
1185
  ] })
1186
1186
  ] }) }),
1187
- balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.CardContent, { className: "grid gap-1", children: [
1187
+ balances && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { "data-testid": "tile-extra", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.CardContent, { className: "grid gap-1", children: [
1188
1188
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.extra_credits") }),
1189
1189
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: whole(balances.availableExtraCredits) })
1190
1190
  ] }) }),
1191
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.CardContent, { className: "grid gap-1", children: [
1191
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { "data-testid": "tile-calls", size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.CardContent, { className: "grid gap-1", children: [
1192
1192
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.report.calls") }),
1193
1193
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: decimal(current.calls, 0) })
1194
1194
  ] }) })
@@ -1230,21 +1230,21 @@ function TokenUsageReportContainer({ balances = null }) {
1230
1230
  const t = _nextintl.useTranslations.call(void 0, );
1231
1231
  const { summary, timeline, byOperation, byTarget, isLoading, error, targetPanelTitleKey } = useTokenUsageReport();
1232
1232
  if (error) {
1233
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
1233
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
1234
1234
  }
1235
- if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
1235
+ if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
1236
1236
  const emptyLabel = t("token_usage.report.no_data");
1237
1237
  const targetTitle = targetPanelTitleKey && byTarget.length > 0 ? t(targetPanelTitleKey) : void 0;
1238
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
1238
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
1239
1239
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageReportTiles, { summary, metric: "credits", balances }),
1240
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
1241
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
1242
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
1240
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
1241
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.report.usage_over_time") }) }),
1242
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: "credits", stackBy: "type" }) })
1243
1243
  ] }),
1244
1244
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkVVJDWQEIjs.cn.call(void 0, "grid gap-4", targetTitle && "md:grid-cols-2"), children: [
1245
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
1246
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: t("token_usage.report.by_operation") }) }),
1247
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1245
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
1246
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: t("token_usage.report.by_operation") }) }),
1247
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1248
1248
  TokenUsageRankedBar,
1249
1249
  {
1250
1250
  rows: byOperation,
@@ -1254,9 +1254,9 @@ function TokenUsageReportContainer({ balances = null }) {
1254
1254
  }
1255
1255
  ) })
1256
1256
  ] }),
1257
- targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYZN2774Pjs.Card, { children: [
1258
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardTitle, { children: targetTitle }) }),
1259
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYZN2774Pjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
1257
+ targetTitle && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkSZQNUGDGjs.Card, { children: [
1258
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardTitle, { children: targetTitle }) }),
1259
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSZQNUGDGjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byTarget, metric: "credits", emptyLabel }) })
1260
1260
  ] })
1261
1261
  ] })
1262
1262
  ] }) });
@@ -37,7 +37,7 @@ import {
37
37
  TableHeader,
38
38
  TableRow,
39
39
  usePageUrlGenerator
40
- } from "../../chunk-DYITOVR5.mjs";
40
+ } from "../../chunk-5JADF7ZA.mjs";
41
41
  import "../../chunk-OKUGTXDN.mjs";
42
42
  import "../../chunk-PW42LRSL.mjs";
43
43
  import {
package/messages/en.json CHANGED
@@ -1545,9 +1545,9 @@
1545
1545
  },
1546
1546
  "deleted": "Deleted User",
1547
1547
  "errors": {
1548
- "deleted": "Deleted Employee",
1548
+ "deleted": "Deleted user",
1549
1549
  "email_exists": "Another user with this email already exists",
1550
- "inactive": "Inactive Employee"
1550
+ "inactive": "Inactive user"
1551
1551
  },
1552
1552
  "fields": {
1553
1553
  "bio": {
package/messages/it.json CHANGED
@@ -1545,9 +1545,9 @@
1545
1545
  },
1546
1546
  "deleted": "Utente eliminato",
1547
1547
  "errors": {
1548
- "deleted": "Dipendente eliminato",
1548
+ "deleted": "Utente eliminato",
1549
1549
  "email_exists": "Esiste già un altro utente con questa email",
1550
- "inactive": "Dipendente non attivo"
1550
+ "inactive": "Utente non attivo"
1551
1551
  },
1552
1552
  "fields": {
1553
1553
  "bio": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carlonicora/nextjs-jsonapi",
3
- "version": "5.1.1",
3
+ "version": "5.1.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",
@@ -73,6 +73,8 @@ const APP_WORDS = [
73
73
  /\bpratich?[ae]\b/i,
74
74
  /\bstorytellers?\b/i,
75
75
  /\bnarrator[ei]\b/i,
76
+ /\bemployees?\b/i,
77
+ /\bdipendent[ei]\b/i,
76
78
  ];
77
79
 
78
80
  const isAppProvided = (key) => APP_PROVIDED_KEYS.some((p) => p.test(key));
@@ -346,6 +346,75 @@ describe("useDataListRetriever", () => {
346
346
  });
347
347
  });
348
348
 
349
+ describe("concurrent fetches", () => {
350
+ function deferred<V>() {
351
+ let resolve!: (value: V) => void;
352
+ const promise = new Promise<V>((r) => (resolve = r));
353
+ return { promise, resolve };
354
+ }
355
+
356
+ it("issues a parameter change made while a fetch is in flight", async () => {
357
+ const retriever = vi.fn().mockResolvedValueOnce([createMockApiData({ type: "articles", id: "1" })]);
358
+
359
+ const { result } = renderHook(() => useDataListRetriever({ retriever, module: mockModule }));
360
+ await waitFor(() => expect(result.current.isLoaded).toBe(true));
361
+
362
+ const slow = deferred<any[]>();
363
+ retriever.mockReturnValueOnce(slow.promise).mockResolvedValue([createMockApiData({ type: "articles", id: "2" })]);
364
+
365
+ act(() => {
366
+ result.current.addAdditionalParameter("completed", "completed");
367
+ });
368
+ act(() => {
369
+ result.current.removeAdditionalParameter("completed");
370
+ });
371
+
372
+ expect(retriever).toHaveBeenCalledTimes(3);
373
+ expect(retriever.mock.calls[2][0].completed).toBeUndefined();
374
+
375
+ await act(async () => {
376
+ slow.resolve([]);
377
+ });
378
+ });
379
+
380
+ it("keeps the newer response when the superseded one arrives last", async () => {
381
+ const retriever = vi.fn().mockResolvedValueOnce([createMockApiData({ type: "articles", id: "1" })]);
382
+
383
+ const { result } = renderHook(() => useDataListRetriever({ retriever, module: mockModule }));
384
+ await waitFor(() => expect(result.current.isLoaded).toBe(true));
385
+
386
+ const older = deferred<any[]>();
387
+ const newer = deferred<any[]>();
388
+ retriever.mockReturnValueOnce(older.promise).mockReturnValueOnce(newer.promise);
389
+
390
+ act(() => {
391
+ result.current.addAdditionalParameter("completed", "completed");
392
+ });
393
+ act(() => {
394
+ result.current.removeAdditionalParameter("completed");
395
+ });
396
+
397
+ await act(async () => {
398
+ newer.resolve([createMockApiData({ type: "articles", id: "open" })]);
399
+ });
400
+ await act(async () => {
401
+ older.resolve([createMockApiData({ type: "articles", id: "done" })]);
402
+ });
403
+
404
+ expect(result.current.data?.map((item: any) => item.id)).toEqual(["open"]);
405
+ expect(result.current.isLoaded).toBe(true);
406
+ });
407
+
408
+ it("still sends one request for the first load", async () => {
409
+ const retriever = vi.fn().mockResolvedValue([createMockApiData({ type: "articles", id: "1" })]);
410
+
411
+ const { result } = renderHook(() => useDataListRetriever({ retriever, module: mockModule }));
412
+ await waitFor(() => expect(result.current.isLoaded).toBe(true));
413
+
414
+ expect(retriever).toHaveBeenCalledTimes(1);
415
+ });
416
+ });
417
+
349
418
  describe("skipped calls", () => {
350
419
  it("still fetches a later search after a call the already-loaded guard skipped", async () => {
351
420
  const retriever = vi.fn().mockResolvedValue([createMockApiData({ type: "articles", id: "1" })]);
@@ -136,8 +136,12 @@ export function useDataListRetriever<T>(params: {
136
136
  return;
137
137
  }
138
138
 
139
- // Prevent concurrent fetches (unless it's a pagination call)
140
- if (isFetchingRef.current && !fetchParams?.callNext && !fetchParams?.callPrevious) return;
139
+ // Prevent concurrent fetches, except a refine (search / parameter change) or pagination.
140
+ // A refine has already written its term or parameter into the refs, so dropping it lost
141
+ // the user's filter for good; it supersedes the in-flight call instead, whose response the
142
+ // request-id check below discards.
143
+ if (isFetchingRef.current && !fetchParams?.isRefine && !fetchParams?.callNext && !fetchParams?.callPrevious)
144
+ return;
141
145
 
142
146
  if (stableParams.requiresSearch === true && fetchParams?.isRefine !== true && fetchParams?.isRefresh !== true) {
143
147
  return;