@carlonicora/nextjs-jsonapi 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/{BlockNoteEditor-7WGCH2KB.js → BlockNoteEditor-TIMGYKAA.js} +19 -19
  2. package/dist/{BlockNoteEditor-7WGCH2KB.js.map → BlockNoteEditor-TIMGYKAA.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-GWAV5ESO.mjs → BlockNoteEditor-YFJMXJEU.mjs} +4 -4
  4. package/dist/billing/index.js +362 -362
  5. package/dist/billing/index.mjs +3 -3
  6. package/dist/{chunk-GYGMEDVS.js → chunk-7HKJNUW7.js} +755 -746
  7. package/dist/chunk-7HKJNUW7.js.map +1 -0
  8. package/dist/{chunk-3LVSA7IM.mjs → chunk-DJWNNV52.mjs} +2 -2
  9. package/dist/{chunk-LCCRUWWY.mjs → chunk-FS4RVV3K.mjs} +241 -1
  10. package/dist/chunk-FS4RVV3K.mjs.map +1 -0
  11. package/dist/{chunk-M2EGUO2F.mjs → chunk-G4YS52SO.mjs} +16 -7
  12. package/dist/chunk-G4YS52SO.mjs.map +1 -0
  13. package/dist/{chunk-TOKHHZSP.js → chunk-OTEDZ6YW.js} +7 -7
  14. package/dist/{chunk-TOKHHZSP.js.map → chunk-OTEDZ6YW.js.map} +1 -1
  15. package/dist/{chunk-V66AZWPG.js → chunk-RTOC53EZ.js} +246 -6
  16. package/dist/chunk-RTOC53EZ.js.map +1 -0
  17. package/dist/client/index.js +4 -4
  18. package/dist/client/index.mjs +3 -3
  19. package/dist/components/index.d.mts +16 -1
  20. package/dist/components/index.d.ts +16 -1
  21. package/dist/components/index.js +4 -4
  22. package/dist/components/index.mjs +3 -3
  23. package/dist/{tokenusage-admin.module-5wJ_tZTj.d.ts → config-BIjrg5wd.d.ts} +39 -1
  24. package/dist/{tokenusage-admin.module-DQVT4O4j.d.mts → config-BRUjtCd1.d.mts} +39 -1
  25. package/dist/contexts/index.js +4 -4
  26. package/dist/contexts/index.mjs +3 -3
  27. package/dist/core/index.d.mts +5 -2
  28. package/dist/core/index.d.ts +5 -2
  29. package/dist/core/index.js +8 -2
  30. package/dist/core/index.js.map +1 -1
  31. package/dist/core/index.mjs +7 -1
  32. package/dist/features/help/index.js +37 -37
  33. package/dist/features/help/index.mjs +3 -3
  34. package/dist/features/tokenusage/index.d.mts +413 -14
  35. package/dist/features/tokenusage/index.d.ts +413 -14
  36. package/dist/features/tokenusage/index.js +481 -120
  37. package/dist/features/tokenusage/index.js.map +1 -1
  38. package/dist/features/tokenusage/index.mjs +431 -70
  39. package/dist/features/tokenusage/index.mjs.map +1 -1
  40. package/dist/index.d.mts +2 -2
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.js +9 -3
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.mjs +8 -2
  45. package/dist/server/index.js +3 -3
  46. package/dist/server/index.mjs +1 -1
  47. package/package.json +1 -1
  48. package/src/core/index.ts +10 -0
  49. package/src/core/registry/ModuleRegistry.ts +4 -0
  50. package/src/features/tokenusage/components/TokenUsageAdminContainer.tsx +20 -4
  51. package/src/features/tokenusage/components/TokenUsageAdminTiles.tsx +31 -18
  52. package/src/features/tokenusage/components/TokenUsageBreakdownTable.tsx +13 -13
  53. package/src/features/tokenusage/components/TokenUsageRankedBar.tsx +24 -7
  54. package/src/features/tokenusage/components/TokenUsageReportContainer.tsx +102 -0
  55. package/src/features/tokenusage/components/TokenUsageReportFilterBar.tsx +34 -0
  56. package/src/features/tokenusage/components/TokenUsageReportTiles.tsx +161 -0
  57. package/src/features/tokenusage/components/TokenUsageTimelineChart.tsx +15 -13
  58. package/src/features/tokenusage/components/__tests__/TokenUsageAdminTiles.spec.tsx +4 -2
  59. package/src/features/tokenusage/components/__tests__/TokenUsageRankedBar.spec.tsx +3 -1
  60. package/src/features/tokenusage/contexts/TokenUsageAdminContext.tsx +6 -3
  61. package/src/features/tokenusage/contexts/TokenUsageReportContext.tsx +199 -0
  62. package/src/features/tokenusage/data/TokenUsageReportService.ts +65 -0
  63. package/src/features/tokenusage/data/index.ts +9 -0
  64. package/src/features/tokenusage/data/tokenusage-report-breakdown.interface.ts +12 -0
  65. package/src/features/tokenusage/data/tokenusage-report-breakdown.ts +94 -0
  66. package/src/features/tokenusage/data/tokenusage-report-summary.interface.ts +12 -0
  67. package/src/features/tokenusage/data/tokenusage-report-summary.ts +87 -0
  68. package/src/features/tokenusage/data/tokenusage-report-timeline.interface.ts +13 -0
  69. package/src/features/tokenusage/data/tokenusage-report-timeline.ts +94 -0
  70. package/src/features/tokenusage/data/tokenusage-report.types.ts +51 -0
  71. package/src/features/tokenusage/i18n-keys.ts +28 -0
  72. package/src/features/tokenusage/index.ts +18 -0
  73. package/src/features/tokenusage/lib/config.ts +22 -0
  74. package/src/features/tokenusage/lib/formatters.ts +100 -0
  75. package/src/features/tokenusage/lib/metrics.ts +8 -26
  76. package/src/features/tokenusage/lib/palette.ts +41 -14
  77. package/src/features/tokenusage/tokenusage-admin.module.ts +4 -0
  78. package/src/features/tokenusage/tokenusage.modules.ts +40 -0
  79. package/src/shadcnui/ui/chart.tsx +30 -3
  80. package/dist/chunk-GYGMEDVS.js.map +0 -1
  81. package/dist/chunk-LCCRUWWY.mjs.map +0 -1
  82. package/dist/chunk-M2EGUO2F.mjs.map +0 -1
  83. package/dist/chunk-V66AZWPG.js.map +0 -1
  84. /package/dist/{BlockNoteEditor-GWAV5ESO.mjs.map → BlockNoteEditor-YFJMXJEU.mjs.map} +0 -0
  85. /package/dist/{chunk-3LVSA7IM.mjs.map → chunk-DJWNNV52.mjs.map} +0 -0
@@ -20,7 +20,7 @@ import {
20
20
  useI18nLocale,
21
21
  useI18nRouter,
22
22
  useI18nTranslations
23
- } from "./chunk-3LVSA7IM.mjs";
23
+ } from "./chunk-DJWNNV52.mjs";
24
24
  import {
25
25
  AVAILABLE_OAUTH_SCOPES,
26
26
  AssistantActionService,
@@ -69,7 +69,7 @@ import {
69
69
  useIsMobile,
70
70
  validateItalianTaxCode,
71
71
  validatePartitaIva
72
- } from "./chunk-LCCRUWWY.mjs";
72
+ } from "./chunk-FS4RVV3K.mjs";
73
73
  import {
74
74
  JsonApiContext
75
75
  } from "./chunk-VOXD3ZLY.mjs";
@@ -1108,6 +1108,8 @@ function ChartTooltipContent({
1108
1108
  labelFormatter,
1109
1109
  labelClassName,
1110
1110
  formatter,
1111
+ valueFormatter,
1112
+ hideZeroValues = false,
1111
1113
  color,
1112
1114
  nameKey,
1113
1115
  labelKey
@@ -1142,7 +1144,7 @@ function ChartTooltipContent({
1142
1144
  ),
1143
1145
  children: [
1144
1146
  !nestLabel ? tooltipLabel : null,
1145
- /* @__PURE__ */ jsx10("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
1147
+ /* @__PURE__ */ jsx10("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").filter((item) => !hideZeroValues || Number(item.value) !== 0).map((item, index) => {
1146
1148
  const key = `${nameKey || item.name || item.dataKey || "value"}`;
1147
1149
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
1148
1150
  const indicatorColor = color || item.payload?.fill || item.color;
@@ -1173,7 +1175,11 @@ function ChartTooltipContent({
1173
1175
  "div",
1174
1176
  {
1175
1177
  className: cn(
1176
- "flex flex-1 justify-between leading-none",
1178
+ // gap-4 is load-bearing: without it a long series name
1179
+ // runs straight into its value ("Decision suggestions0")
1180
+ // because justify-between leaves no room once the row
1181
+ // fills. The gap also widens the tooltip to fit.
1182
+ "flex flex-1 justify-between gap-4 leading-none",
1177
1183
  nestLabel ? "items-end" : "items-center"
1178
1184
  ),
1179
1185
  children: [
@@ -1181,7 +1187,10 @@ function ChartTooltipContent({
1181
1187
  nestLabel ? tooltipLabel : null,
1182
1188
  /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: itemConfig?.label || item.name })
1183
1189
  ] }),
1184
- item.value && /* @__PURE__ */ jsx10("span", { className: "text-foreground font-medium tabular-nums", children: item.value.toLocaleString() })
1190
+ item.value !== void 0 && item.value !== null && // Tested against undefined/null rather than truthiness:
1191
+ // a value of exactly 0 is falsy, and the old guard
1192
+ // dropped the number while still drawing its row.
1193
+ /* @__PURE__ */ jsx10("span", { className: "text-foreground font-medium tabular-nums", children: valueFormatter ? valueFormatter(item.value) : item.value.toLocaleString() })
1185
1194
  ]
1186
1195
  }
1187
1196
  )
@@ -10203,7 +10212,7 @@ import { useRef as useRef17 } from "react";
10203
10212
  import dynamic from "next/dynamic";
10204
10213
  import React17 from "react";
10205
10214
  import { jsx as jsx88 } from "react/jsx-runtime";
10206
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-GWAV5ESO.mjs"), {
10215
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-YFJMXJEU.mjs"), {
10207
10216
  ssr: false
10208
10217
  });
10209
10218
  var BlockNoteEditorContainer = React17.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -24579,4 +24588,4 @@ export {
24579
24588
  useOAuthClients,
24580
24589
  useOAuthClient
24581
24590
  };
24582
- //# sourceMappingURL=chunk-M2EGUO2F.mjs.map
24591
+ //# sourceMappingURL=chunk-G4YS52SO.mjs.map