@carlonicora/nextjs-jsonapi 3.24.2 → 3.26.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 (220) hide show
  1. package/dist/{AssistantMessageInterface-1Kbz8RVs.d.ts → AssistantMessageInterface-CubxuBIJ.d.ts} +1 -1
  2. package/dist/{AssistantMessageInterface-CoxJyuFM.d.mts → AssistantMessageInterface-sHjI2zPN.d.mts} +1 -1
  3. package/dist/{BlockNoteEditor-35D4R7HJ.js → BlockNoteEditor-4EIKMNY3.js} +31 -21
  4. package/dist/BlockNoteEditor-4EIKMNY3.js.map +1 -0
  5. package/dist/{BlockNoteEditor-65HR6ULV.mjs → BlockNoteEditor-AXYVDDXM.mjs} +16 -6
  6. package/dist/{BlockNoteEditor-65HR6ULV.mjs.map → BlockNoteEditor-AXYVDDXM.mjs.map} +1 -1
  7. package/dist/{BlockNoteViewer-QDXDVYEM.js → BlockNoteViewer-7BFNTN4E.js} +4 -4
  8. package/dist/{BlockNoteViewer-QDXDVYEM.js.map → BlockNoteViewer-7BFNTN4E.js.map} +1 -1
  9. package/dist/{BlockNoteViewer-KDKGUIG5.mjs → BlockNoteViewer-KRTAFTUX.mjs} +3 -3
  10. package/dist/{HandbookSectionInterface-OePKPbqN.d.ts → HandbookSectionInterface-Ck1wZJ81.d.ts} +1 -1
  11. package/dist/{HandbookSectionInterface-BYsmnPEz.d.mts → HandbookSectionInterface-DgYH--Ik.d.mts} +1 -1
  12. package/dist/JsonApiRequest-TE5WD3WS.js +26 -0
  13. package/dist/{JsonApiRequest-G625QAH5.js.map → JsonApiRequest-TE5WD3WS.js.map} +1 -1
  14. package/dist/{JsonApiRequest-RRMNV7YE.mjs → JsonApiRequest-UHOWNI3O.mjs} +2 -2
  15. package/dist/analytics.modules-CfczU12P.d.ts +25 -0
  16. package/dist/analytics.modules-pzGwMASI.d.mts +25 -0
  17. package/dist/{auth.interface-BC1jp_ni.d.ts → auth.interface-BzI4onI_.d.ts} +1 -1
  18. package/dist/{auth.interface-dR2-6gPM.d.mts → auth.interface-Df4vXbNz.d.mts} +1 -1
  19. package/dist/billing/index.js +402 -402
  20. package/dist/billing/index.mjs +4 -4
  21. package/dist/{chunk-YXRVPEEJ.js → chunk-26MQIJNB.js} +1 -1
  22. package/dist/{chunk-YXRVPEEJ.js.map → chunk-26MQIJNB.js.map} +1 -1
  23. package/dist/{chunk-T76WLDE5.mjs → chunk-37DMFVLN.mjs} +1 -1
  24. package/dist/{chunk-3AR4KA5D.js → chunk-4Z45NYPR.js} +13 -13
  25. package/dist/{chunk-3AR4KA5D.js.map → chunk-4Z45NYPR.js.map} +1 -1
  26. package/dist/chunk-7B4E42R5.mjs +280 -0
  27. package/dist/chunk-7B4E42R5.mjs.map +1 -0
  28. package/dist/{chunk-2XCUAHQT.js → chunk-ABVTYQIJ.js} +1563 -1336
  29. package/dist/chunk-ABVTYQIJ.js.map +1 -0
  30. package/dist/{chunk-U7QVISQS.js → chunk-CAKOFJZD.js} +450 -40
  31. package/dist/chunk-CAKOFJZD.js.map +1 -0
  32. package/dist/{chunk-IBVKPLHT.mjs → chunk-E3I4MT53.mjs} +422 -12
  33. package/dist/chunk-E3I4MT53.mjs.map +1 -0
  34. package/dist/chunk-GHFMKH3M.js +280 -0
  35. package/dist/chunk-GHFMKH3M.js.map +1 -0
  36. package/dist/chunk-GKDHYB2R.js +110 -0
  37. package/dist/chunk-GKDHYB2R.js.map +1 -0
  38. package/dist/{chunk-ZJI5ZZW5.mjs → chunk-Q6J2ICKO.mjs} +3 -3
  39. package/dist/{chunk-4O7R2Z2O.mjs → chunk-QWZAGQWJ.mjs} +2175 -1948
  40. package/dist/chunk-QWZAGQWJ.mjs.map +1 -0
  41. package/dist/chunk-U65JPKO3.mjs +110 -0
  42. package/dist/chunk-U65JPKO3.mjs.map +1 -0
  43. package/dist/client/index.d.mts +6 -5
  44. package/dist/client/index.d.ts +6 -5
  45. package/dist/client/index.js +5 -5
  46. package/dist/client/index.js.map +1 -1
  47. package/dist/client/index.mjs +4 -4
  48. package/dist/components/index.d.mts +33 -10
  49. package/dist/components/index.d.ts +33 -10
  50. package/dist/components/index.js +7 -5
  51. package/dist/components/index.js.map +1 -1
  52. package/dist/components/index.mjs +6 -4
  53. package/dist/{config-B6UB7j69.d.ts → config-3N1LSrcC.d.ts} +1 -1
  54. package/dist/{config-Cd5xTEfZ.d.ts → config-AVtuvfM1.d.ts} +1 -1
  55. package/dist/{config-n-ZpPmOL.d.mts → config-BSKTYDoh.d.mts} +1 -1
  56. package/dist/{config-YyhFHxkU.d.mts → config-BmufyEj6.d.mts} +1 -1
  57. package/dist/contexts/index.d.mts +5 -4
  58. package/dist/contexts/index.d.ts +5 -4
  59. package/dist/contexts/index.js +5 -5
  60. package/dist/contexts/index.mjs +4 -4
  61. package/dist/core/index.d.mts +31 -14
  62. package/dist/core/index.d.ts +31 -14
  63. package/dist/core/index.js +9 -5
  64. package/dist/core/index.js.map +1 -1
  65. package/dist/core/index.mjs +8 -4
  66. package/dist/features/analytics/index.css +30 -0
  67. package/dist/features/analytics/index.css.map +1 -0
  68. package/dist/features/analytics/index.d.mts +508 -0
  69. package/dist/features/analytics/index.d.ts +508 -0
  70. package/dist/features/analytics/index.js +1166 -0
  71. package/dist/features/analytics/index.js.map +1 -0
  72. package/dist/features/analytics/index.mjs +1166 -0
  73. package/dist/features/analytics/index.mjs.map +1 -0
  74. package/dist/features/analytics/server.d.mts +28 -0
  75. package/dist/features/analytics/server.d.ts +28 -0
  76. package/dist/features/analytics/server.js +41 -0
  77. package/dist/features/analytics/server.js.map +1 -0
  78. package/dist/features/analytics/server.mjs +41 -0
  79. package/dist/features/analytics/server.mjs.map +1 -0
  80. package/dist/features/help/index.d.mts +2 -2
  81. package/dist/features/help/index.d.ts +2 -2
  82. package/dist/features/help/index.js +43 -43
  83. package/dist/features/help/index.js.map +1 -1
  84. package/dist/features/help/index.mjs +9 -9
  85. package/dist/features/help/index.mjs.map +1 -1
  86. package/dist/features/tokenusage/index.d.mts +2 -2
  87. package/dist/features/tokenusage/index.d.ts +2 -2
  88. package/dist/features/tokenusage/index.js +141 -223
  89. package/dist/features/tokenusage/index.js.map +1 -1
  90. package/dist/features/tokenusage/index.mjs +28 -110
  91. package/dist/features/tokenusage/index.mjs.map +1 -1
  92. package/dist/index.d.mts +11 -9
  93. package/dist/index.d.ts +11 -9
  94. package/dist/index.js +10 -6
  95. package/dist/index.js.map +1 -1
  96. package/dist/index.mjs +9 -5
  97. package/dist/notification.interface-BNCvnVCW.d.ts +34 -0
  98. package/dist/notification.interface-P_pNfzZQ.d.mts +34 -0
  99. package/dist/{s3.service-Bqr-fQmi.d.ts → s3.service-CbUa6a-8.d.ts} +3 -2
  100. package/dist/{s3.service-Buiy1ncj.d.mts → s3.service-DAp8FbuG.d.mts} +3 -2
  101. package/dist/server/index.d.mts +5 -4
  102. package/dist/server/index.d.ts +5 -4
  103. package/dist/server/index.js +39 -279
  104. package/dist/server/index.js.map +1 -1
  105. package/dist/server/index.mjs +20 -260
  106. package/dist/server/index.mjs.map +1 -1
  107. package/dist/{types-bsm8Fp55.d.ts → types-Cn153-mH.d.ts} +1 -1
  108. package/dist/{types-Bq_UA8Lg.d.mts → types-D0uLYV2P.d.mts} +1 -1
  109. package/dist/{usePageUrlGenerator-J_ECv-oQ.d.ts → usePageUrlGenerator-B-3FRKBD.d.ts} +1 -1
  110. package/dist/{usePageUrlGenerator-uKBjAKqC.d.mts → usePageUrlGenerator-CCJ_cdQy.d.mts} +1 -1
  111. package/dist/{useSocket-BcH7l7B8.d.mts → useSocket-B9gTbuCj.d.mts} +1 -1
  112. package/dist/{useSocket-DCZd_eJk.d.ts → useSocket-BHVIyigI.d.ts} +1 -1
  113. package/dist/{notification.interface-MnRt1Tjm.d.mts → user.interface-CSaGWFbg.d.mts} +1 -31
  114. package/dist/{notification.interface-CjzV_KII.d.ts → user.interface-CrmwJLYW.d.ts} +1 -31
  115. package/package.json +11 -1
  116. package/src/client/index.ts +2 -0
  117. package/src/components/containers/PageContainer.tsx +1 -1
  118. package/src/components/containers/RoundPageContainer.tsx +60 -16
  119. package/src/components/containers/RoundPageContainerTitle.tsx +75 -35
  120. package/src/components/editors/BlockNoteEditor.tsx +13 -1
  121. package/src/components/forms/EntityMultiSelector.tsx +4 -4
  122. package/src/components/forms/EntitySelector.tsx +4 -4
  123. package/src/components/forms/FormBlockNote.tsx +21 -1
  124. package/src/components/forms/FormCheckbox.tsx +6 -2
  125. package/src/components/forms/__tests__/useEditorDialog.test.ts +47 -0
  126. package/src/components/forms/useEditorDialog.ts +22 -0
  127. package/src/components/navigations/Breadcrumb.tsx +45 -16
  128. package/src/components/navigations/Header.tsx +16 -3
  129. package/src/components/navigations/MobileNavigationBar.tsx +12 -0
  130. package/src/components/navigations/__tests__/MobileNavigationBar.spec.tsx +17 -0
  131. package/src/components/tables/ContentListTable.tsx +52 -32
  132. package/src/core/index.ts +4 -0
  133. package/src/core/registry/ModuleRegistry.ts +7 -0
  134. package/src/features/__tests__/i18n-keys.contract.spec.ts +1 -0
  135. package/src/features/analytics/__tests__/server-entry.spec.tsx +64 -0
  136. package/src/features/analytics/analytics.modules.ts +30 -0
  137. package/src/features/analytics/components/AnalyticsAdminContainer.tsx +97 -0
  138. package/src/features/analytics/components/AnalyticsAdminFilterBar.tsx +120 -0
  139. package/src/features/analytics/components/AnalyticsAdminPageContainer.tsx +25 -0
  140. package/src/features/analytics/components/AnalyticsAdminTiles.tsx +191 -0
  141. package/src/features/analytics/components/AnalyticsBreakdownTable.tsx +105 -0
  142. package/src/features/analytics/components/AnalyticsJourneyContainer.tsx +246 -0
  143. package/src/features/analytics/components/AnalyticsJourneyPageContainer.tsx +14 -0
  144. package/src/features/analytics/components/AnalyticsSessionsTable.tsx +107 -0
  145. package/src/features/analytics/components/AnalyticsTimelineChart.tsx +175 -0
  146. package/src/features/analytics/components/AnalyticsTracker.tsx +112 -0
  147. package/src/features/analytics/components/__tests__/AnalyticsAdminTiles.spec.tsx +39 -0
  148. package/src/features/analytics/components/__tests__/AnalyticsBreakdownTable.spec.tsx +39 -0
  149. package/src/features/analytics/components/__tests__/AnalyticsJourneyContainer.spec.tsx +124 -0
  150. package/src/features/analytics/components/__tests__/AnalyticsPageContainers.spec.tsx +117 -0
  151. package/src/features/analytics/components/__tests__/AnalyticsSessionsTable.spec.tsx +121 -0
  152. package/src/features/analytics/components/__tests__/AnalyticsTimelineChart.spec.tsx +35 -0
  153. package/src/features/analytics/components/__tests__/AnalyticsTracker.spec.tsx +248 -0
  154. package/src/features/analytics/components/server/AnalyticsAdminPage.tsx +28 -0
  155. package/src/features/analytics/components/server/AnalyticsJourneyPage.tsx +25 -0
  156. package/src/features/analytics/contexts/AnalyticsAdminContext.tsx +273 -0
  157. package/src/features/analytics/contexts/__tests__/AnalyticsAdminContext.spec.tsx +140 -0
  158. package/src/features/analytics/data/AnalyticsAdminService.ts +91 -0
  159. package/src/features/analytics/data/AnalyticsService.ts +23 -0
  160. package/src/features/analytics/data/__tests__/AnalyticsAdminService.spec.ts +117 -0
  161. package/src/features/analytics/data/__tests__/AnalyticsService.spec.ts +56 -0
  162. package/src/features/analytics/data/__tests__/models.spec.ts +300 -0
  163. package/src/features/analytics/data/analytics-breakdown.interface.ts +9 -0
  164. package/src/features/analytics/data/analytics-breakdown.ts +65 -0
  165. package/src/features/analytics/data/analytics-event.interface.ts +7 -0
  166. package/src/features/analytics/data/analytics-event.ts +63 -0
  167. package/src/features/analytics/data/analytics-page-view.interface.ts +9 -0
  168. package/src/features/analytics/data/analytics-page-view.ts +57 -0
  169. package/src/features/analytics/data/analytics-session.interface.ts +23 -0
  170. package/src/features/analytics/data/analytics-session.ts +144 -0
  171. package/src/features/analytics/data/analytics-summary.interface.ts +11 -0
  172. package/src/features/analytics/data/analytics-summary.ts +79 -0
  173. package/src/features/analytics/data/analytics-timeline.interface.ts +10 -0
  174. package/src/features/analytics/data/analytics-timeline.ts +67 -0
  175. package/src/features/analytics/data/analytics.types.ts +97 -0
  176. package/src/features/analytics/data/index.ts +15 -0
  177. package/src/features/analytics/i18n-keys.ts +76 -0
  178. package/src/features/analytics/index.ts +31 -0
  179. package/src/features/analytics/lib/__tests__/utm.spec.ts +20 -0
  180. package/src/features/analytics/lib/__tests__/visitorCookie.spec.ts +63 -0
  181. package/src/features/analytics/lib/utm.ts +29 -0
  182. package/src/features/analytics/lib/visitorCookie.ts +32 -0
  183. package/src/features/analytics/server-entry.ts +8 -0
  184. package/src/features/assistant/components/parts/AssistantBlockNoteComposer.tsx +1 -1
  185. package/src/features/assistant/components/parts/AssistantComposer.tsx +1 -1
  186. package/src/features/assistant-message/components/MessageItem.tsx +2 -2
  187. package/src/features/assistant-message/components/parts/tabs/CitationsTab.tsx +23 -5
  188. package/src/features/auth/components/containers/AuthContainer.tsx +8 -1
  189. package/src/features/company/components/details/CompanyContent.tsx +3 -1
  190. package/src/features/company/components/details/CompanyDetails.tsx +9 -1
  191. package/src/features/company/components/details/TokenStatusIndicator.tsx +42 -13
  192. package/src/features/help/components/HelpHeader.tsx +7 -5
  193. package/src/features/tokenusage/components/TokenUsageAdminFilterBar.tsx +9 -6
  194. package/src/features/tokenusage/lib/__tests__/formatters.spec.ts +21 -0
  195. package/src/features/tokenusage/lib/formatters.ts +5 -1
  196. package/src/features/waitlist/components/lists/WaitlistList.tsx +68 -121
  197. package/src/features/waitlist/data/WaitlistService.ts +2 -2
  198. package/src/features/waitlist/data/index.ts +1 -0
  199. package/src/features/waitlist/data/waitlist.fields.ts +8 -0
  200. package/src/features/waitlist/hooks/useWaitlistTableStructure.tsx +69 -30
  201. package/src/shadcnui/ui/button.tsx +1 -1
  202. package/src/shadcnui/ui/checkbox.tsx +1 -1
  203. package/src/shadcnui/ui/command.tsx +4 -4
  204. package/src/shadcnui/ui/dialog.tsx +2 -0
  205. package/src/shadcnui/ui/input.tsx +1 -1
  206. package/src/shadcnui/ui/popover.tsx +9 -0
  207. package/src/shadcnui/ui/select.tsx +1 -1
  208. package/src/shadcnui/ui/sheet.tsx +8 -1
  209. package/src/shadcnui/ui/table.tsx +2 -2
  210. package/src/shadcnui/ui/textarea.tsx +1 -1
  211. package/dist/BlockNoteEditor-35D4R7HJ.js.map +0 -1
  212. package/dist/JsonApiRequest-G625QAH5.js +0 -26
  213. package/dist/chunk-2XCUAHQT.js.map +0 -1
  214. package/dist/chunk-4O7R2Z2O.mjs.map +0 -1
  215. package/dist/chunk-IBVKPLHT.mjs.map +0 -1
  216. package/dist/chunk-U7QVISQS.js.map +0 -1
  217. /package/dist/{BlockNoteViewer-KDKGUIG5.mjs.map → BlockNoteViewer-KRTAFTUX.mjs.map} +0 -0
  218. /package/dist/{JsonApiRequest-RRMNV7YE.mjs.map → JsonApiRequest-UHOWNI3O.mjs.map} +0 -0
  219. /package/dist/{chunk-T76WLDE5.mjs.map → chunk-37DMFVLN.mjs.map} +0 -0
  220. /package/dist/{chunk-ZJI5ZZW5.mjs.map → chunk-Q6J2ICKO.mjs.map} +0 -0
@@ -1,4 +1,15 @@
1
1
  "use client";
2
+ import {
3
+ CATEGORICAL_CEILING,
4
+ OTHER_COLOR,
5
+ SEQUENTIAL_RAMP,
6
+ cacheHitPercentage,
7
+ createUsageFormatters,
8
+ metricValue,
9
+ percentageDelta,
10
+ seriesColor,
11
+ useUsageFormatters
12
+ } from "../../chunk-U65JPKO3.mjs";
2
13
  import {
3
14
  Button,
4
15
  Card,
@@ -26,8 +37,8 @@ import {
26
37
  TableHeader,
27
38
  TableRow,
28
39
  usePageUrlGenerator
29
- } from "../../chunk-4O7R2Z2O.mjs";
30
- import "../../chunk-ZJI5ZZW5.mjs";
40
+ } from "../../chunk-QWZAGQWJ.mjs";
41
+ import "../../chunk-Q6J2ICKO.mjs";
31
42
  import {
32
43
  AbstractService,
33
44
  EndpointCreator,
@@ -45,10 +56,10 @@ import {
45
56
  configureTokenUsage,
46
57
  getTokenUsageCurrency,
47
58
  tokenUsageModules
48
- } from "../../chunk-IBVKPLHT.mjs";
59
+ } from "../../chunk-E3I4MT53.mjs";
60
+ import "../../chunk-37DMFVLN.mjs";
49
61
  import "../../chunk-AUXK7QSA.mjs";
50
62
  import "../../chunk-PI56A4DG.mjs";
51
- import "../../chunk-T76WLDE5.mjs";
52
63
  import "../../chunk-VOXD3ZLY.mjs";
53
64
  import {
54
65
  __name
@@ -69,7 +80,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
69
80
  ...Object.fromEntries(companies.map((company) => [company.id, company.label]))
70
81
  };
71
82
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
72
- /* @__PURE__ */ jsx(
83
+ /* @__PURE__ */ jsx("div", { className: "max-md:w-full max-md:[&_#date]:w-full", children: /* @__PURE__ */ jsx(
73
84
  DateRangeSelector,
74
85
  {
75
86
  onDateChange: (range) => {
@@ -77,7 +88,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
77
88
  onChange({ from: range.from.toISOString(), to: range.to.toISOString() });
78
89
  }
79
90
  }
80
- ),
91
+ ) }),
81
92
  /* @__PURE__ */ jsx(
82
93
  Segmented,
83
94
  {
@@ -349,74 +360,11 @@ var useTokenUsageAdmin = /* @__PURE__ */ __name(() => {
349
360
 
350
361
  // src/features/tokenusage/components/TokenUsageAdminContainer.tsx
351
362
  import { useTranslations as useTranslations7 } from "next-intl";
352
- import { useMemo as useMemo5 } from "react";
363
+ import { useMemo as useMemo4 } from "react";
353
364
 
354
365
  // src/features/tokenusage/components/TokenUsageAdminTiles.tsx
355
366
  import { ArrowDownIcon, ArrowUpIcon } from "lucide-react";
356
367
  import { useTranslations as useTranslations3 } from "next-intl";
357
-
358
- // src/features/tokenusage/lib/formatters.ts
359
- import { useLocale } from "next-intl";
360
- import { useMemo as useMemo2 } from "react";
361
- function createUsageFormatters(locale, currency) {
362
- const symbol = new Intl.NumberFormat(locale, { style: "currency", currency, currencyDisplay: "narrowSymbol" }).formatToParts(0).find((part) => part.type === "currency")?.value ?? currency;
363
- const decimal = /* @__PURE__ */ __name((value, decimals) => value.toLocaleString(locale, { minimumFractionDigits: decimals, maximumFractionDigits: decimals }), "decimal");
364
- const dayFormat = new Intl.DateTimeFormat(locale, { day: "numeric", month: "short", timeZone: "UTC" });
365
- const monthFormat = new Intl.DateTimeFormat(locale, { month: "short", year: "numeric", timeZone: "UTC" });
366
- const compactFormat = new Intl.NumberFormat(locale, { notation: "compact", maximumFractionDigits: 1 });
367
- const collator = new Intl.Collator(locale);
368
- return {
369
- decimal,
370
- metricValue(value, metric) {
371
- if (metric === "cost") return `${symbol} ${decimal(value, 2)}`;
372
- if (metric === "credits") return decimal(value, 1);
373
- return decimal(value, 0);
374
- },
375
- currency(value, decimals) {
376
- return `${symbol} ${decimal(value, decimals)}`;
377
- },
378
- percent(value, decimals = 1) {
379
- return `${decimal(value, decimals)} %`;
380
- },
381
- compact(value) {
382
- return compactFormat.format(value);
383
- },
384
- bucketDate(iso, granularity) {
385
- const date = /* @__PURE__ */ new Date(`${iso}T00:00:00.000Z`);
386
- return granularity === "month" ? monthFormat.format(date) : dayFormat.format(date);
387
- },
388
- compare(a, b) {
389
- return collator.compare(a, b);
390
- }
391
- };
392
- }
393
- __name(createUsageFormatters, "createUsageFormatters");
394
- function useUsageFormatters() {
395
- const locale = useLocale();
396
- const currency = getTokenUsageCurrency();
397
- return useMemo2(() => createUsageFormatters(locale, currency), [locale, currency]);
398
- }
399
- __name(useUsageFormatters, "useUsageFormatters");
400
-
401
- // src/features/tokenusage/lib/metrics.ts
402
- function metricValue(row, metric) {
403
- if (metric === "cost") return row.cost;
404
- if (metric === "credits") return row.credits;
405
- return row.tokensIn + row.tokensOut;
406
- }
407
- __name(metricValue, "metricValue");
408
- function cacheHitPercentage(cached, tokensIn) {
409
- if (!tokensIn) return 0;
410
- return cached / tokensIn * 100;
411
- }
412
- __name(cacheHitPercentage, "cacheHitPercentage");
413
- function percentageDelta(current, previous) {
414
- if (!previous) return void 0;
415
- return Math.round((current - previous) / previous * 100);
416
- }
417
- __name(percentageDelta, "percentageDelta");
418
-
419
- // src/features/tokenusage/components/TokenUsageAdminTiles.tsx
420
368
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
421
369
  var ZERO = { cost: 0, credits: 0, tokensIn: 0, tokensOut: 0, cached: 0, calls: 0 };
422
370
  function TokenUsageAdminTiles({ summary, metric, singleCustomerMode }) {
@@ -554,14 +502,14 @@ __name(Delta, "Delta");
554
502
  // src/features/tokenusage/components/TokenUsageBreakdownTable.tsx
555
503
  import { ArrowDownIcon as ArrowDownIcon2, ArrowUpIcon as ArrowUpIcon2 } from "lucide-react";
556
504
  import { useTranslations as useTranslations4 } from "next-intl";
557
- import { useMemo as useMemo3, useState as useState2 } from "react";
505
+ import { useMemo as useMemo2, useState as useState2 } from "react";
558
506
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
559
507
  function TokenUsageBreakdownTable({ rows, metric }) {
560
508
  const t = useTranslations4();
561
509
  const { decimal, metricValue: formatValue, percent, compare } = useUsageFormatters();
562
510
  const [sort, setSort] = useState2(void 0);
563
511
  const showActiveUsers = rows.some((row) => row.activeUsers !== void 0);
564
- const total = useMemo3(() => rows.reduce((sum, row) => sum + metricValue(row, metric), 0), [rows, metric]);
512
+ const total = useMemo2(() => rows.reduce((sum, row) => sum + metricValue(row, metric), 0), [rows, metric]);
565
513
  const sortValue = /* @__PURE__ */ __name((row, key) => {
566
514
  switch (key) {
567
515
  case "label":
@@ -578,7 +526,7 @@ function TokenUsageBreakdownTable({ rows, metric }) {
578
526
  return row[key];
579
527
  }
580
528
  }, "sortValue");
581
- const sortedRows = useMemo3(() => {
529
+ const sortedRows = useMemo2(() => {
582
530
  if (!sort) return rows;
583
531
  const factor = sort.direction === "desc" ? -1 : 1;
584
532
  return [...rows].sort((a, b) => {
@@ -665,36 +613,6 @@ var operationLabel = /* @__PURE__ */ __name((type, translate, has) => {
665
613
  return has(key) ? translate(key) : type;
666
614
  }, "operationLabel");
667
615
 
668
- // src/features/tokenusage/lib/palette.ts
669
- var CATEGORICAL_LIGHT = [
670
- "#2a78d6",
671
- "#eb6834",
672
- "#1baf7a",
673
- "#eda100",
674
- "#e87ba4",
675
- "#008300",
676
- "#4a3aa7"
677
- ];
678
- var CATEGORICAL_DARK = [
679
- "#3987e5",
680
- "#d95926",
681
- "#199e70",
682
- "#c98500",
683
- "#d55181",
684
- "#008300",
685
- "#9085e9"
686
- ];
687
- var CATEGORICAL_CEILING = CATEGORICAL_LIGHT.length;
688
- var OTHER_COLOR = "#898781";
689
- var SEQUENTIAL_RAMP_LIGHT = ["#104281", "#1c5cab", "#2a78d6", "#5598e7", "#86b6ef"];
690
- var SEQUENTIAL_RAMP = SEQUENTIAL_RAMP_LIGHT;
691
- var categoricalSet = /* @__PURE__ */ __name((mode) => mode === "dark" ? CATEGORICAL_DARK : CATEGORICAL_LIGHT, "categoricalSet");
692
- function seriesColor(index, mode = "light") {
693
- if (index < 0 || index >= CATEGORICAL_CEILING) return OTHER_COLOR;
694
- return categoricalSet(mode)[index];
695
- }
696
- __name(seriesColor, "seriesColor");
697
-
698
616
  // src/features/tokenusage/components/TokenUsageRankedBar.tsx
699
617
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
700
618
  function TokenUsageRankedBar({ rows, metric, emptyLabel, labelsAreOperationTypes = false }) {
@@ -751,7 +669,7 @@ __name(TokenUsageRankedBar, "TokenUsageRankedBar");
751
669
  // src/features/tokenusage/components/TokenUsageTimelineChart.tsx
752
670
  import { useTranslations as useTranslations6 } from "next-intl";
753
671
  import { useTheme } from "next-themes";
754
- import { useMemo as useMemo4 } from "react";
672
+ import { useMemo as useMemo3 } from "react";
755
673
  import { Bar, BarChart, CartesianGrid, XAxis, YAxis } from "recharts";
756
674
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
757
675
  var OTHER_SERIES = "other";
@@ -783,7 +701,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
783
701
  const { compact, bucketDate, metricValue: formatValue } = useUsageFormatters();
784
702
  const { resolvedTheme } = useTheme();
785
703
  const mode = resolvedTheme === "dark" ? "dark" : "light";
786
- const { chartData, seriesKeys } = useMemo4(() => {
704
+ const { chartData, seriesKeys } = useMemo3(() => {
787
705
  if (rows.length === 0) return { chartData: [], seriesKeys: [] };
788
706
  const totals = /* @__PURE__ */ new Map();
789
707
  for (const row of rows) totals.set(row.series, (totals.get(row.series) ?? 0) + metricValue2(row, metric));
@@ -820,7 +738,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
820
738
  (key) => t.has(key)
821
739
  );
822
740
  }, "seriesLabel");
823
- const chartConfig = useMemo4(
741
+ const chartConfig = useMemo3(
824
742
  () => Object.fromEntries(seriesKeys.map((series) => [series, { label: seriesLabel(series) }])),
825
743
  [seriesKeys, stackBy]
826
744
  );
@@ -912,12 +830,12 @@ function TokenUsageAdminContainer() {
912
830
  isLoading,
913
831
  error
914
832
  } = useTokenUsageAdmin();
915
- const platformIsEmpty = useMemo5(
833
+ const platformIsEmpty = useMemo4(
916
834
  () => summary.filter((row) => row.scope === "platform").every((row) => row.cost === 0 && row.credits === 0 && row.tokensIn === 0 && row.tokensOut === 0),
917
835
  [summary]
918
836
  );
919
837
  const hidePlatform = singleCustomerMode || platformIsEmpty;
920
- const stackByItems = useMemo5(
838
+ const stackByItems = useMemo4(
921
839
  () => ({
922
840
  scope: t("token_usage.admin.stack.scope"),
923
841
  type: t("token_usage.admin.stack.type"),
@@ -1108,7 +1026,7 @@ var TOKEN_USAGE_REPORT_I18N_KEYS = [
1108
1026
 
1109
1027
  // src/features/tokenusage/contexts/TokenUsageReportContext.tsx
1110
1028
  import { useTranslations as useTranslations8 } from "next-intl";
1111
- import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect2, useMemo as useMemo6, useState as useState3 } from "react";
1029
+ import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect2, useMemo as useMemo5, useState as useState3 } from "react";
1112
1030
 
1113
1031
  // src/features/tokenusage/components/TokenUsageReportFilterBar.tsx
1114
1032
  import { jsx as jsx8 } from "react/jsx-runtime";
@@ -1207,7 +1125,7 @@ var TokenUsageReportProvider = /* @__PURE__ */ __name(({
1207
1125
  type: t("token_usage.report.title"),
1208
1126
  functions: /* @__PURE__ */ jsx9(TokenUsageReportFilterBar, { onChange: setFilters }, "tokenUsageReportFilterBar")
1209
1127
  }), "title");
1210
- const contextValue = useMemo6(
1128
+ const contextValue = useMemo5(
1211
1129
  () => ({ summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error }),
1212
1130
  [summary, timeline, byOperation, byTarget, targetPanelTitleKey, filters, setFilters, isLoading, error]
1213
1131
  );