@burdenoff/microfe-subscriberbot 2026.1103.1 → 2026.1105.1

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 (200) hide show
  1. package/dist/index.js +3 -3
  2. package/dist/stories/Accessibility.stories.d.ts +13 -0
  3. package/dist/stories/Accessibility.stories.d.ts.map +1 -0
  4. package/dist/stories/pages/AgentDetailPage.stories.d.ts.map +1 -1
  5. package/dist/stories/pages/AgentNewPage.stories.d.ts.map +1 -1
  6. package/dist/stories/pages/AgentsListPage.stories.d.ts.map +1 -1
  7. package/dist/stories/pages/BankConnectionsPage.stories.d.ts +1 -0
  8. package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -1
  9. package/dist/stories/pages/EnterpriseSpendPage.stories.d.ts.map +1 -1
  10. package/dist/stories/pages/InboxPage.stories.d.ts.map +1 -1
  11. package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +1 -1
  12. package/dist/subscriberbot/admin/AdminDashboardPage.js +168 -168
  13. package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
  14. package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts.map +1 -1
  15. package/dist/subscriberbot/admin/NegotiationDeskPanel.js +116 -116
  16. package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -1
  17. package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +1 -1
  18. package/dist/subscriberbot/admin/ProcurementDeskPanel.js +211 -211
  19. package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -1
  20. package/dist/subscriberbot/components/Modal.d.ts.map +1 -1
  21. package/dist/subscriberbot/components/Modal.js +43 -33
  22. package/dist/subscriberbot/components/Modal.js.map +1 -1
  23. package/dist/subscriberbot/components/PostureOptions.d.ts.map +1 -1
  24. package/dist/subscriberbot/components/PostureOptions.js +10 -10
  25. package/dist/subscriberbot/components/PostureOptions.js.map +1 -1
  26. package/dist/subscriberbot/components/StateViews.d.ts.map +1 -1
  27. package/dist/subscriberbot/components/StateViews.js +45 -37
  28. package/dist/subscriberbot/components/StateViews.js.map +1 -1
  29. package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
  30. package/dist/subscriberbot/components/StatusBadge.js +6 -6
  31. package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
  32. package/dist/subscriberbot/components/decisions/DecisionBanners.js +6 -6
  33. package/dist/subscriberbot/components/decisions/DecisionCard.d.ts.map +1 -1
  34. package/dist/subscriberbot/components/decisions/DecisionCard.js +149 -147
  35. package/dist/subscriberbot/components/decisions/DecisionCard.js.map +1 -1
  36. package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +1 -1
  37. package/dist/subscriberbot/components/mobile/MobileDashboard.js +127 -127
  38. package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -1
  39. package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts.map +1 -1
  40. package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +114 -114
  41. package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -1
  42. package/dist/subscriberbot/components/mobile/MobileScreen.js +1 -1
  43. package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
  44. package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +4 -4
  45. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts.map +1 -1
  46. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +11 -11
  47. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -1
  48. package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts.map +1 -1
  49. package/dist/subscriberbot/components/negotiations/OutcomeForm.js +29 -29
  50. package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -1
  51. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +1 -1
  52. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +43 -43
  53. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -1
  54. package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +4 -4
  55. package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +1 -1
  56. package/dist/subscriberbot/components/procurement/ProcurementThread.js +14 -14
  57. package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -1
  58. package/dist/subscriberbot/components/savings/SavingsCards.d.ts.map +1 -1
  59. package/dist/subscriberbot/components/savings/SavingsCards.js +242 -237
  60. package/dist/subscriberbot/components/savings/SavingsCards.js.map +1 -1
  61. package/dist/subscriberbot/components/viz.d.ts +1 -0
  62. package/dist/subscriberbot/components/viz.d.ts.map +1 -1
  63. package/dist/subscriberbot/components/viz.js +100 -101
  64. package/dist/subscriberbot/components/viz.js.map +1 -1
  65. package/dist/subscriberbot/hooks/index.js +1 -1
  66. package/dist/subscriberbot/hooks/useFormError.d.ts +7 -0
  67. package/dist/subscriberbot/hooks/useFormError.d.ts.map +1 -0
  68. package/dist/subscriberbot/hooks/useFormError.js +28 -0
  69. package/dist/subscriberbot/hooks/useFormError.js.map +1 -0
  70. package/dist/subscriberbot/hooks/useFormatters.d.ts +11 -0
  71. package/dist/subscriberbot/hooks/useFormatters.d.ts.map +1 -0
  72. package/dist/subscriberbot/hooks/useFormatters.js +13 -0
  73. package/dist/subscriberbot/hooks/useFormatters.js.map +1 -0
  74. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
  75. package/dist/subscriberbot/hooks/useSubscriberBotApi.js +371 -370
  76. package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
  77. package/dist/subscriberbot/hooks/useTr.d.ts.map +1 -1
  78. package/dist/subscriberbot/hooks/useTr.js +1 -1
  79. package/dist/subscriberbot/hooks/useTr.js.map +1 -1
  80. package/dist/subscriberbot/index.js +1 -1
  81. package/dist/subscriberbot/pages/AssetVaultPage.d.ts.map +1 -1
  82. package/dist/subscriberbot/pages/AssetVaultPage.js +124 -124
  83. package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
  84. package/dist/subscriberbot/pages/DashboardPage.d.ts +0 -10
  85. package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -1
  86. package/dist/subscriberbot/pages/DashboardPage.js +107 -98
  87. package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
  88. package/dist/subscriberbot/pages/InboxPage.d.ts +0 -10
  89. package/dist/subscriberbot/pages/InboxPage.d.ts.map +1 -1
  90. package/dist/subscriberbot/pages/InboxPage.js +421 -402
  91. package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
  92. package/dist/subscriberbot/pages/InsightsPage.d.ts.map +1 -1
  93. package/dist/subscriberbot/pages/InsightsPage.js +130 -121
  94. package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
  95. package/dist/subscriberbot/pages/InvoicesPage.d.ts +0 -12
  96. package/dist/subscriberbot/pages/InvoicesPage.d.ts.map +1 -1
  97. package/dist/subscriberbot/pages/InvoicesPage.js +237 -215
  98. package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
  99. package/dist/subscriberbot/pages/RenewalsPage.d.ts.map +1 -1
  100. package/dist/subscriberbot/pages/RenewalsPage.js +303 -295
  101. package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -1
  102. package/dist/subscriberbot/pages/SavingsPage.d.ts.map +1 -1
  103. package/dist/subscriberbot/pages/SavingsPage.js +57 -57
  104. package/dist/subscriberbot/pages/SavingsPage.js.map +1 -1
  105. package/dist/subscriberbot/pages/WorkflowsPage.d.ts +0 -13
  106. package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +1 -1
  107. package/dist/subscriberbot/pages/WorkflowsPage.js +202 -196
  108. package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
  109. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts +0 -18
  110. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +1 -1
  111. package/dist/subscriberbot/pages/agents/AgentDetailPage.js +283 -275
  112. package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
  113. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts +0 -6
  114. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +1 -1
  115. package/dist/subscriberbot/pages/agents/AgentNewPage.js +85 -77
  116. package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
  117. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts +0 -9
  118. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +1 -1
  119. package/dist/subscriberbot/pages/agents/AgentsListPage.js +136 -136
  120. package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
  121. package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +0 -9
  122. package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
  123. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +267 -260
  124. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
  125. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts +0 -10
  126. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts.map +1 -1
  127. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js +96 -96
  128. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js.map +1 -1
  129. package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts +0 -11
  130. package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts.map +1 -1
  131. package/dist/subscriberbot/pages/decisions/DecisionsPage.js +46 -46
  132. package/dist/subscriberbot/pages/decisions/DecisionsPage.js.map +1 -1
  133. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts +0 -11
  134. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts.map +1 -1
  135. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +181 -171
  136. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js.map +1 -1
  137. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts +0 -9
  138. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts.map +1 -1
  139. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +164 -164
  140. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -1
  141. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts +0 -9
  142. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts.map +1 -1
  143. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +197 -181
  144. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -1
  145. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts +0 -8
  146. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts.map +1 -1
  147. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +79 -79
  148. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -1
  149. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +0 -9
  150. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +1 -1
  151. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +147 -147
  152. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -1
  153. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +0 -10
  154. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +1 -1
  155. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +204 -188
  156. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -1
  157. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +0 -9
  158. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +1 -1
  159. package/dist/subscriberbot/pages/procurement/ProcurementPage.js +80 -80
  160. package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -1
  161. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts +0 -10
  162. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts.map +1 -1
  163. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +484 -458
  164. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
  165. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts +0 -8
  166. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts.map +1 -1
  167. package/dist/subscriberbot/pages/providers/ProviderNewPage.js +146 -136
  168. package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
  169. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts +0 -10
  170. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts.map +1 -1
  171. package/dist/subscriberbot/pages/providers/ProvidersListPage.js +88 -87
  172. package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
  173. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts +0 -11
  174. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
  175. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +520 -490
  176. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
  177. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts +0 -8
  178. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +1 -1
  179. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +104 -90
  180. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
  181. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts +0 -8
  182. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +1 -1
  183. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +97 -96
  184. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
  185. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.d.ts.map +1 -1
  186. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js +76 -74
  187. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js.map +1 -1
  188. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts +5 -3
  189. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts.map +1 -1
  190. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js +26 -25
  191. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js.map +1 -1
  192. package/dist/subscriberbot/utils/formatters.d.ts +16 -5
  193. package/dist/subscriberbot/utils/formatters.d.ts.map +1 -1
  194. package/dist/subscriberbot/utils/formatters.js +57 -25
  195. package/dist/subscriberbot/utils/formatters.js.map +1 -1
  196. package/dist/subscriberbot/utils/plaidLink.d.ts +2 -1
  197. package/dist/subscriberbot/utils/plaidLink.d.ts.map +1 -1
  198. package/dist/subscriberbot/utils/plaidLink.js +21 -21
  199. package/dist/subscriberbot/utils/plaidLink.js.map +1 -1
  200. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
1
  import { useSubscriberBot as e } from "../context/SubscriberBotContext.js";
2
- import { cn as t } from "../utils/cn.js";
3
- import { PageLayout as n } from "../components/PageLayout.js";
4
- import { MetricsCard as r } from "../components/MetricsCard.js";
5
- import { formatCurrency as i, formatEnumLabel as a } from "../utils/formatters.js";
2
+ import { useTr as t } from "../hooks/useTr.js";
3
+ import { useFormatters as n } from "../hooks/useFormatters.js";
4
+ import { cn as r } from "../utils/cn.js";
5
+ import { PageLayout as i } from "../components/PageLayout.js";
6
+ import { MetricsCard as a } from "../components/MetricsCard.js";
6
7
  import { EmptyState as o } from "../components/EmptyState.js";
7
- import { useTr as s } from "../hooks/useTr.js";
8
- import { ErrorView as c, LoadingView as l, Section as u } from "../components/StateViews.js";
9
- import { BarList as d, Donut as f, Legend as p, MiniProgress as m } from "../components/viz.js";
8
+ import { ErrorView as s, LoadingView as c, Section as l } from "../components/StateViews.js";
9
+ import { BarList as u, Donut as d, Legend as f, MiniProgress as p } from "../components/viz.js";
10
10
  import "../components/index.js";
11
- import { useRelationships as h } from "../hooks/useSubscriberBotApi.js";
12
- import { useMemo as g } from "react";
13
- import { CalendarClock as _, HeartPulse as v, Layers as y, PiggyBank as b, TrendingUp as x, Wallet as S } from "lucide-react";
14
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
15
- import { GlassCard as E, PagePurpose as D } from "@burdenoff/fe-libs/ui";
11
+ import { useRelationships as m } from "../hooks/useSubscriberBotApi.js";
12
+ import { useMemo as h } from "react";
13
+ import { CalendarClock as g, HeartPulse as _, Layers as v, PiggyBank as y, TrendingUp as b, Wallet as x } from "lucide-react";
14
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
15
+ import { GlassCard as T, PagePurpose as E } from "@burdenoff/fe-libs/ui";
16
16
  //#region src/subscriberbot/pages/InsightsPage.tsx
17
- var O = {
17
+ var D = {
18
18
  DAILY: 30,
19
19
  WEEKLY: 4.345,
20
20
  MONTHLY: 1,
@@ -23,25 +23,29 @@ var O = {
23
23
  LIFETIME: 0,
24
24
  FREE: 0,
25
25
  USAGE_BASED: 1
26
- }, k = (e) => e.amount * (O[e.interval] ?? 1), A = (e) => e.status === "ACTIVE", j = () => {
27
- let O = h({ pagination: { limit: 100 } }), j = s(), { navigateTo: M } = e(), N = g(() => O.data?.items ?? [], [O.data]), P = g(() => {
28
- let e = N.filter(A), t = e[0]?.currency ?? N[0]?.currency ?? "USD", n = e.reduce((e, t) => e + k(t), 0), r = N.filter((e) => e.healthScore != null), i = r.length ? r.reduce((e, t) => e + (t.healthScore ?? 0), 0) / r.length : null, o = /* @__PURE__ */ new Map();
29
- for (let e of N) o.set(e.status, (o.get(e.status) ?? 0) + 1);
30
- let s = /* @__PURE__ */ new Map();
31
- for (let t of e) s.set(t.kind, (s.get(t.kind) ?? 0) + k(t));
32
- let c = [...e].sort((e, t) => k(t) - k(e)).slice(0, 6), l = [], u = /* @__PURE__ */ new Date();
26
+ }, O = (e) => e.amount * (D[e.interval] ?? 1), k = (e) => e.status === "ACTIVE", A = () => {
27
+ let { formatCurrency: D, formatDate: A, formatEnumLabel: j } = n(), M = m({ pagination: { limit: 100 } }), N = t(), { navigateTo: P } = e(), F = h(() => M.data?.items ?? [], [M.data]), I = h(() => {
28
+ let e = F.filter(k), t = e[0]?.currency ?? F[0]?.currency ?? "USD", n = e.reduce((e, t) => e + O(t), 0), r = F.filter((e) => e.healthScore != null), i = r.length ? r.reduce((e, t) => e + (t.healthScore ?? 0), 0) / r.length : null, a = /* @__PURE__ */ new Map();
29
+ for (let e of F) a.set(e.status, (a.get(e.status) ?? 0) + 1);
30
+ let o = /* @__PURE__ */ new Map();
31
+ for (let t of e) o.set(t.kind, (o.get(t.kind) ?? 0) + O(t));
32
+ let s = [...e].sort((e, t) => O(t) - O(e)).slice(0, 6), c = [], l = /* @__PURE__ */ new Date();
33
33
  for (let e = 0; e < 6; e += 1) {
34
- let t = new Date(u.getFullYear(), u.getMonth() + e, 1), n = `${t.getFullYear()}-${t.getMonth()}`, r = t.toLocaleString(void 0, { month: "short" }), i = N.reduce((e, t) => {
34
+ let t = new Date(l.getFullYear(), l.getMonth() + e, 1), n = `${t.getFullYear()}-${t.getMonth()}`, r = A(t, {
35
+ month: "short",
36
+ day: void 0,
37
+ year: void 0
38
+ }), i = F.reduce((e, t) => {
35
39
  if (!t.renewsAt) return e;
36
40
  let r = new Date(t.renewsAt);
37
41
  return Number.isNaN(r.getTime()) ? e : `${r.getFullYear()}-${r.getMonth()}` === n ? e + t.amount : e;
38
42
  }, 0);
39
- l.push({
43
+ c.push({
40
44
  label: r,
41
45
  value: i
42
46
  });
43
47
  }
44
- let d = N.filter((e) => e.healthScore != null && e.healthScore < 40).sort((e, t) => (e.healthScore ?? 0) - (t.healthScore ?? 0)).slice(0, 6), f = N.filter((e) => {
48
+ let u = F.filter((e) => e.healthScore != null && e.healthScore < 40).sort((e, t) => (e.healthScore ?? 0) - (t.healthScore ?? 0)).slice(0, 6), d = F.filter((e) => {
45
49
  if (!e.renewsAt) return !1;
46
50
  let t = new Date(e.renewsAt).getTime();
47
51
  if (Number.isNaN(t)) return !1;
@@ -53,182 +57,187 @@ var O = {
53
57
  monthlySpend: n,
54
58
  activeCount: e.length,
55
59
  avgHealth: i,
56
- renewals30: f,
57
- statusData: [...o.entries()].map(([e, t]) => ({
58
- label: a(e),
60
+ renewals30: d,
61
+ statusData: [...a.entries()].map(([e, t]) => ({
62
+ label: j(e),
59
63
  value: t
60
64
  })),
61
- kindData: [...s.entries()].map(([e, t]) => ({
62
- label: a(e),
65
+ kindData: [...o.entries()].map(([e, t]) => ({
66
+ label: j(e),
63
67
  value: t
64
68
  })).sort((e, t) => t.value - e.value),
65
- topCosts: c,
66
- forecast: l,
67
- watchlist: d,
68
- total: N.length
69
+ topCosts: s,
70
+ forecast: c,
71
+ watchlist: u,
72
+ total: F.length
69
73
  };
70
- }, [N]);
71
- if (O.isLoading) return /* @__PURE__ */ w(l, { label: j("insights.loading", "Crunching your spend insights…") });
72
- if (O.isError) return /* @__PURE__ */ w(c, {
73
- message: j("insights.error", "Could not load insights."),
74
- onRetry: () => void O.refetch()
74
+ }, [
75
+ F,
76
+ A,
77
+ j
78
+ ]);
79
+ if (M.isLoading) return /* @__PURE__ */ C(c, { label: N("insights.loading", "Crunching your spend insights…") });
80
+ if (M.isError) return /* @__PURE__ */ C(s, {
81
+ message: N("insights.error", "Could not load insights."),
82
+ onRetry: () => void M.refetch()
75
83
  });
76
- let F = (e) => i(e, P.currency);
77
- return /* @__PURE__ */ T(n, {
78
- title: j("insights.title", "Insights"),
79
- description: j("insights.description", "Where your recurring money goes, what renews next, and what to review — computed live from your portfolio."),
80
- actions: /* @__PURE__ */ T("button", {
84
+ let L = (e) => D(e, I.currency);
85
+ return /* @__PURE__ */ w(i, {
86
+ title: N("insights.title", "Insights"),
87
+ description: N("insights.description", "Where your recurring money goes, what renews next, and what to review — computed live from your portfolio."),
88
+ actions: /* @__PURE__ */ w("button", {
81
89
  type: "button",
82
- onClick: () => M("/savings"),
90
+ onClick: () => P("/savings"),
83
91
  "data-testid": "insights-open-savings",
84
92
  className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
85
- children: [/* @__PURE__ */ w(b, {
93
+ children: [/* @__PURE__ */ C(y, {
86
94
  className: "h-4 w-4",
87
95
  "aria-hidden": !0
88
- }), j("insights.openSavings", "See how to save")]
96
+ }), N("insights.openSavings", "See how to save")]
89
97
  }),
90
- children: [/* @__PURE__ */ w(D, {
98
+ children: [/* @__PURE__ */ C(E, {
91
99
  className: "mb-2",
92
- children: j("insights.purpose", "Understand and optimize your recurring spend. Every figure here is aggregated from your real subscriptions — normalized to a monthly equivalent so plans on different billing cycles are comparable.")
93
- }), P.total === 0 ? /* @__PURE__ */ w(o, {
94
- icon: /* @__PURE__ */ w(x, { className: "h-8 w-8" }),
95
- title: j("insights.emptyTitle", "No data to analyze yet"),
96
- description: j("insights.emptyDescription", "Add a few subscriptions and your spend breakdown, renewal forecast and health watchlist will appear here.")
97
- }) : /* @__PURE__ */ T(C, { children: [
98
- /* @__PURE__ */ T("div", {
100
+ children: N("insights.purpose", "Understand and optimize your recurring spend. Every figure here is aggregated from your real subscriptions — normalized to a monthly equivalent so plans on different billing cycles are comparable.")
101
+ }), I.total === 0 ? /* @__PURE__ */ C(o, {
102
+ icon: /* @__PURE__ */ C(b, { className: "h-8 w-8" }),
103
+ title: N("insights.emptyTitle", "No data to analyze yet"),
104
+ description: N("insights.emptyDescription", "Add a few subscriptions and your spend breakdown, renewal forecast and health watchlist will appear here.")
105
+ }) : /* @__PURE__ */ w(S, { children: [
106
+ /* @__PURE__ */ w("div", {
99
107
  className: "grid grid-cols-2 gap-4 lg:grid-cols-4",
100
108
  children: [
101
- /* @__PURE__ */ w(r, {
102
- icon: /* @__PURE__ */ w(S, { className: "h-5 w-5" }),
103
- value: F(P.monthlySpend),
104
- label: j("insights.metrics.recurringSpend", "Recurring spend / month"),
109
+ /* @__PURE__ */ C(a, {
110
+ icon: /* @__PURE__ */ C(x, { className: "h-5 w-5" }),
111
+ value: L(I.monthlySpend),
112
+ label: N("insights.metrics.recurringSpend", "Recurring spend / month"),
105
113
  featured: !0
106
114
  }),
107
- /* @__PURE__ */ w(r, {
108
- icon: /* @__PURE__ */ w(y, { className: "h-5 w-5" }),
109
- value: P.activeCount,
110
- label: j("insights.metrics.activeSubscriptions", "Active subscriptions")
115
+ /* @__PURE__ */ C(a, {
116
+ icon: /* @__PURE__ */ C(v, { className: "h-5 w-5" }),
117
+ value: I.activeCount,
118
+ label: N("insights.metrics.activeSubscriptions", "Active subscriptions")
111
119
  }),
112
- /* @__PURE__ */ w(r, {
113
- icon: /* @__PURE__ */ w(_, { className: "h-5 w-5" }),
114
- value: P.renewals30,
115
- label: j("insights.metrics.renewing30Days", "Renewing in 30 days")
120
+ /* @__PURE__ */ C(a, {
121
+ icon: /* @__PURE__ */ C(g, { className: "h-5 w-5" }),
122
+ value: I.renewals30,
123
+ label: N("insights.metrics.renewing30Days", "Renewing in 30 days")
116
124
  }),
117
- /* @__PURE__ */ w(r, {
118
- icon: /* @__PURE__ */ w(v, { className: "h-5 w-5" }),
119
- value: P.avgHealth == null ? j("insights.metrics.noScore", "—") : Math.round(P.avgHealth),
120
- label: j("insights.metrics.avgHealthScore", "Avg. health score")
125
+ /* @__PURE__ */ C(a, {
126
+ icon: /* @__PURE__ */ C(_, { className: "h-5 w-5" }),
127
+ value: I.avgHealth == null ? N("insights.metrics.noScore", "—") : Math.round(I.avgHealth),
128
+ label: N("insights.metrics.avgHealthScore", "Avg. health score")
121
129
  })
122
130
  ]
123
131
  }),
124
- /* @__PURE__ */ T("div", {
132
+ /* @__PURE__ */ w("div", {
125
133
  className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
126
134
  children: [
127
- /* @__PURE__ */ T(E, {
135
+ /* @__PURE__ */ w(T, {
128
136
  treatment: "plain",
129
137
  className: "p-6",
130
- children: [/* @__PURE__ */ w("h3", {
138
+ children: [/* @__PURE__ */ C("h2", {
131
139
  className: "mb-4 text-sm font-semibold text-text-primary",
132
- children: j("insights.portfolioByStatus", "Portfolio by status")
133
- }), /* @__PURE__ */ T("div", {
140
+ children: N("insights.portfolioByStatus", "Portfolio by status")
141
+ }), /* @__PURE__ */ w("div", {
134
142
  className: "flex flex-col items-center gap-6 sm:flex-row",
135
- children: [/* @__PURE__ */ w(f, {
136
- data: P.statusData,
137
- centerLabel: String(P.total),
138
- centerSub: j("insights.subscriptions", "subscriptions")
139
- }), /* @__PURE__ */ w(p, {
143
+ children: [/* @__PURE__ */ C(d, {
144
+ data: I.statusData,
145
+ centerLabel: String(I.total),
146
+ centerSub: N("insights.subscriptions", "subscriptions")
147
+ }), /* @__PURE__ */ C(f, {
140
148
  className: "w-full sm:flex-1",
141
- data: P.statusData
149
+ data: I.statusData
142
150
  })]
143
151
  })]
144
152
  }),
145
- /* @__PURE__ */ T(E, {
153
+ /* @__PURE__ */ w(T, {
146
154
  treatment: "plain",
147
155
  className: "p-6",
148
- children: [/* @__PURE__ */ w("h3", {
156
+ children: [/* @__PURE__ */ C("h2", {
149
157
  className: "mb-4 text-sm font-semibold text-text-primary",
150
- children: j("insights.spendByType", "Monthly spend by type")
151
- }), P.kindData.length ? /* @__PURE__ */ w(d, {
152
- data: P.kindData,
153
- valueFormat: F
154
- }) : /* @__PURE__ */ w("p", {
158
+ children: N("insights.spendByType", "Monthly spend by type")
159
+ }), I.kindData.length ? /* @__PURE__ */ C(u, {
160
+ data: I.kindData,
161
+ valueFormat: L
162
+ }) : /* @__PURE__ */ C("p", {
155
163
  className: "text-sm text-text-secondary",
156
- children: j("insights.noActiveSpend", "No active spend.")
164
+ children: N("insights.noActiveSpend", "No active spend.")
157
165
  })]
158
166
  }),
159
- /* @__PURE__ */ T(E, {
167
+ /* @__PURE__ */ w(T, {
160
168
  treatment: "plain",
161
169
  className: "p-6",
162
- children: [/* @__PURE__ */ T("div", {
170
+ children: [/* @__PURE__ */ w("div", {
163
171
  className: "mb-4 flex items-baseline justify-between gap-2",
164
- children: [/* @__PURE__ */ w("h3", {
172
+ children: [/* @__PURE__ */ C("h2", {
165
173
  className: "text-sm font-semibold text-text-primary",
166
- children: j("insights.renewalForecast", "Renewal forecast (6 mo)")
167
- }), /* @__PURE__ */ w("button", {
174
+ children: N("insights.renewalForecast", "Renewal forecast (6 mo)")
175
+ }), /* @__PURE__ */ C("button", {
168
176
  type: "button",
169
- onClick: () => M("/renewals"),
177
+ onClick: () => P("/renewals"),
170
178
  "data-testid": "insights-open-renewals",
171
179
  className: "shrink-0 rounded text-xs font-medium text-text-link hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
172
- children: j("insights.openRenewals", "Plan renewals")
180
+ children: N("insights.openRenewals", "Plan renewals")
173
181
  })]
174
- }), P.forecast.some((e) => e.value > 0) ? /* @__PURE__ */ w(d, {
175
- data: P.forecast,
176
- valueFormat: F
177
- }) : /* @__PURE__ */ w("p", {
182
+ }), I.forecast.some((e) => e.value > 0) ? /* @__PURE__ */ C(u, {
183
+ data: I.forecast,
184
+ valueFormat: L
185
+ }) : /* @__PURE__ */ C("p", {
178
186
  className: "text-sm text-text-secondary",
179
- children: j("insights.noRenewals", "No dated renewals in the next 6 months.")
187
+ children: N("insights.noRenewals", "No dated renewals in the next 6 months.")
180
188
  })]
181
189
  })
182
190
  ]
183
191
  }),
184
- /* @__PURE__ */ T("div", {
192
+ /* @__PURE__ */ w("div", {
185
193
  className: "grid grid-cols-1 gap-4 lg:grid-cols-2",
186
- children: [/* @__PURE__ */ w(u, {
187
- title: j("insights.topCosts", "Top monthly costs"),
188
- children: /* @__PURE__ */ w(E, {
194
+ children: [/* @__PURE__ */ C(l, {
195
+ title: N("insights.topCosts", "Top monthly costs"),
196
+ children: /* @__PURE__ */ C(T, {
189
197
  treatment: "plain",
190
198
  className: "divide-y divide-border-subtle",
191
- children: P.topCosts.map((e) => /* @__PURE__ */ T("div", {
199
+ children: I.topCosts.map((e) => /* @__PURE__ */ w("div", {
192
200
  className: "flex items-center justify-between p-4",
193
- children: [/* @__PURE__ */ w("span", {
201
+ children: [/* @__PURE__ */ C("span", {
194
202
  className: "truncate text-sm text-text-primary",
195
203
  children: e.label
196
- }), /* @__PURE__ */ T("span", {
197
- className: "ml-3 shrink-0 text-sm font-semibold tabular-nums text-text-primary",
198
- children: [F(k(e)), /* @__PURE__ */ w("span", {
204
+ }), /* @__PURE__ */ w("span", {
205
+ className: "ms-3 shrink-0 text-sm font-semibold tabular-nums text-text-primary",
206
+ children: [L(O(e)), /* @__PURE__ */ C("span", {
199
207
  className: "text-xs font-normal text-text-secondary",
200
- children: j("insights.perMonth", "/mo")
208
+ children: N("insights.perMonth", "/mo")
201
209
  })]
202
210
  })]
203
211
  }, e.id))
204
212
  })
205
- }), /* @__PURE__ */ w(u, {
206
- title: j("insights.healthWatchlist", "Health watchlist"),
207
- children: P.watchlist.length ? /* @__PURE__ */ w(E, {
213
+ }), /* @__PURE__ */ C(l, {
214
+ title: N("insights.healthWatchlist", "Health watchlist"),
215
+ children: I.watchlist.length ? /* @__PURE__ */ C(T, {
208
216
  treatment: "plain",
209
217
  className: "divide-y divide-border-subtle",
210
- children: P.watchlist.map((e) => /* @__PURE__ */ T("div", {
218
+ children: I.watchlist.map((e) => /* @__PURE__ */ w("div", {
211
219
  className: "flex items-center gap-3 p-4",
212
220
  children: [
213
- /* @__PURE__ */ w("span", {
221
+ /* @__PURE__ */ C("span", {
214
222
  className: "w-32 shrink-0 truncate text-sm text-text-primary",
215
223
  children: e.label
216
224
  }),
217
- /* @__PURE__ */ w(m, {
225
+ /* @__PURE__ */ C(p, {
226
+ label: N("common.healthScore", "Health score"),
218
227
  className: "flex-1",
219
228
  value: e.healthScore ?? 0,
220
229
  tone: "negative"
221
230
  }),
222
- /* @__PURE__ */ w("span", {
223
- className: t("w-8 shrink-0 text-right text-sm font-medium tabular-nums text-status-warning-text"),
231
+ /* @__PURE__ */ C("span", {
232
+ className: r("w-8 shrink-0 text-end text-sm font-medium tabular-nums text-status-warning-text"),
224
233
  children: e.healthScore
225
234
  })
226
235
  ]
227
236
  }, e.id))
228
- }) : /* @__PURE__ */ w(E, {
237
+ }) : /* @__PURE__ */ C(T, {
229
238
  treatment: "plain",
230
239
  className: "p-6 text-sm text-text-secondary",
231
- children: j("insights.allHealthy", "Nothing needs review — all scored subscriptions look healthy.")
240
+ children: N("insights.allHealthy", "Nothing needs review — all scored subscriptions look healthy.")
232
241
  })
233
242
  })]
234
243
  })
@@ -236,6 +245,6 @@ var O = {
236
245
  });
237
246
  };
238
247
  //#endregion
239
- export { j as InsightsPage };
248
+ export { A as InsightsPage };
240
249
 
241
250
  //# sourceMappingURL=InsightsPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InsightsPage.js","names":[],"sources":["../../../src/subscriberbot/pages/InsightsPage.tsx"],"sourcesContent":["/**\n * Insights — spend analytics + renewal forecast, aggregated entirely from the\n * real subscription portfolio (`useRelationships`). Nothing is mocked: every\n * figure is computed from live relationship data (amount normalized to a monthly\n * equivalent by billing interval). Covers the concept mocks for cost insight,\n * renewal cashflow forecast, and spend management.\n * @module subscriberbot/pages\n */\nimport { useMemo, type FC } from 'react';\nimport { TrendingUp, Wallet, CalendarClock, HeartPulse, Layers, PiggyBank } from 'lucide-react';\nimport { GlassCard, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport {\n PageLayout,\n MetricsCard,\n EmptyState,\n LoadingView,\n ErrorView,\n Section,\n Donut,\n Legend,\n BarList,\n MiniProgress,\n} from '../components';\nimport { useRelationships } from '../hooks/useSubscriberBotApi';\nimport { useSubscriberBot } from '../context/SubscriberBotContext';\nimport { useTr } from '../hooks/useTr';\nimport { formatCurrency, formatEnumLabel } from '../utils/formatters';\nimport type { SubBillingInterval, SubRelationship } from '../types';\nimport { cn } from '../utils/cn';\n\nconst MONTHLY_FACTOR: Record<SubBillingInterval, number> = {\n DAILY: 30,\n WEEKLY: 4.345,\n MONTHLY: 1,\n QUARTERLY: 1 / 3,\n YEARLY: 1 / 12,\n LIFETIME: 0,\n FREE: 0,\n USAGE_BASED: 1,\n};\n\nconst monthly = (r: SubRelationship): number => r.amount * (MONTHLY_FACTOR[r.interval] ?? 1);\nconst isActive = (r: SubRelationship): boolean => r.status === 'ACTIVE';\n\nexport const InsightsPage: FC = () => {\n const query = useRelationships({ pagination: { limit: 100 } });\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const rels = useMemo(() => query.data?.items ?? [], [query.data]);\n\n const stats = useMemo(() => {\n const active = rels.filter(isActive);\n const currency = active[0]?.currency ?? rels[0]?.currency ?? 'USD';\n const monthlySpend = active.reduce((s, r) => s + monthly(r), 0);\n const scored = rels.filter((r) => r.healthScore != null);\n const avgHealth = scored.length\n ? scored.reduce((s, r) => s + (r.healthScore ?? 0), 0) / scored.length\n : null;\n\n // by status (donut)\n const byStatus = new Map<string, number>();\n for (const r of rels) byStatus.set(r.status, (byStatus.get(r.status) ?? 0) + 1);\n\n // spend by kind (bar)\n const byKind = new Map<string, number>();\n for (const r of active) byKind.set(r.kind, (byKind.get(r.kind) ?? 0) + monthly(r));\n\n // top monthly costs\n const topCosts = [...active].sort((a, b) => monthly(b) - monthly(a)).slice(0, 6);\n\n // renewal forecast — next 6 calendar months by renewsAt\n const buckets: { label: string; value: number }[] = [];\n const now = new Date();\n for (let i = 0; i < 6; i += 1) {\n const d = new Date(now.getFullYear(), now.getMonth() + i, 1);\n const key = `${d.getFullYear()}-${d.getMonth()}`;\n const label = d.toLocaleString(undefined, { month: 'short' });\n const value = rels.reduce((s, r) => {\n if (!r.renewsAt) return s;\n const rd = new Date(r.renewsAt);\n if (Number.isNaN(rd.getTime())) return s;\n return `${rd.getFullYear()}-${rd.getMonth()}` === key ? s + r.amount : s;\n }, 0);\n buckets.push({ label, value });\n }\n\n // low-health watchlist\n const watchlist = rels\n .filter((r) => r.healthScore != null && (r.healthScore as number) < 40)\n .sort((a, b) => (a.healthScore ?? 0) - (b.healthScore ?? 0))\n .slice(0, 6);\n\n const renewals30 = rels.filter((r) => {\n if (!r.renewsAt) return false;\n const t = new Date(r.renewsAt).getTime();\n if (Number.isNaN(t)) return false;\n const days = (t - Date.now()) / 86_400_000;\n return days >= 0 && days <= 30;\n }).length;\n\n return {\n currency,\n monthlySpend,\n activeCount: active.length,\n avgHealth,\n renewals30,\n statusData: [...byStatus.entries()].map(([label, value]) => ({\n label: formatEnumLabel(label),\n value,\n })),\n kindData: [...byKind.entries()]\n .map(([label, value]) => ({ label: formatEnumLabel(label), value }))\n .sort((a, b) => b.value - a.value),\n topCosts,\n forecast: buckets,\n watchlist,\n total: rels.length,\n };\n }, [rels]);\n\n if (query.isLoading)\n return <LoadingView label={tr('insights.loading', 'Crunching your spend insights…')} />;\n if (query.isError)\n return (\n <ErrorView\n message={tr('insights.error', 'Could not load insights.')}\n onRetry={() => void query.refetch()}\n />\n );\n\n const fmt = (n: number) => formatCurrency(n, stats.currency);\n\n return (\n <PageLayout\n title={tr('insights.title', 'Insights')}\n description={tr(\n 'insights.description',\n 'Where your recurring money goes, what renews next, and what to review — computed live from your portfolio.'\n )}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/savings')}\n data-testid=\"insights-open-savings\"\n className=\"inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90\"\n >\n <PiggyBank className=\"h-4 w-4\" aria-hidden />\n {tr('insights.openSavings', 'See how to save')}\n </button>\n }\n >\n <PagePurpose className=\"mb-2\">\n {tr(\n 'insights.purpose',\n 'Understand and optimize your recurring spend. Every figure here is aggregated from your real subscriptions — normalized to a monthly equivalent so plans on different billing cycles are comparable.'\n )}\n </PagePurpose>\n\n {stats.total === 0 ? (\n <EmptyState\n icon={<TrendingUp className=\"h-8 w-8\" />}\n title={tr('insights.emptyTitle', 'No data to analyze yet')}\n description={tr(\n 'insights.emptyDescription',\n 'Add a few subscriptions and your spend breakdown, renewal forecast and health watchlist will appear here.'\n )}\n />\n ) : (\n <>\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n <MetricsCard\n icon={<Wallet className=\"h-5 w-5\" />}\n value={fmt(stats.monthlySpend)}\n label={tr('insights.metrics.recurringSpend', 'Recurring spend / month')}\n featured\n />\n <MetricsCard\n icon={<Layers className=\"h-5 w-5\" />}\n value={stats.activeCount}\n label={tr('insights.metrics.activeSubscriptions', 'Active subscriptions')}\n />\n <MetricsCard\n icon={<CalendarClock className=\"h-5 w-5\" />}\n value={stats.renewals30}\n label={tr('insights.metrics.renewing30Days', 'Renewing in 30 days')}\n />\n <MetricsCard\n icon={<HeartPulse className=\"h-5 w-5\" />}\n value={\n stats.avgHealth != null\n ? Math.round(stats.avgHealth)\n : tr('insights.metrics.noScore', '—')\n }\n label={tr('insights.metrics.avgHealthScore', 'Avg. health score')}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <h3 className=\"mb-4 text-sm font-semibold text-text-primary\">\n {tr('insights.portfolioByStatus', 'Portfolio by status')}\n </h3>\n <div className=\"flex flex-col items-center gap-6 sm:flex-row\">\n <Donut\n data={stats.statusData}\n centerLabel={String(stats.total)}\n centerSub={tr('insights.subscriptions', 'subscriptions')}\n />\n <Legend className=\"w-full sm:flex-1\" data={stats.statusData} />\n </div>\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <h3 className=\"mb-4 text-sm font-semibold text-text-primary\">\n {tr('insights.spendByType', 'Monthly spend by type')}\n </h3>\n {stats.kindData.length ? (\n <BarList data={stats.kindData} valueFormat={fmt} />\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr('insights.noActiveSpend', 'No active spend.')}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <div className=\"mb-4 flex items-baseline justify-between gap-2\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tr('insights.renewalForecast', 'Renewal forecast (6 mo)')}\n </h3>\n <button\n type=\"button\"\n onClick={() => navigateTo('/renewals')}\n data-testid=\"insights-open-renewals\"\n className=\"shrink-0 rounded text-xs font-medium text-text-link hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n {tr('insights.openRenewals', 'Plan renewals')}\n </button>\n </div>\n {stats.forecast.some((f) => f.value > 0) ? (\n <BarList data={stats.forecast} valueFormat={fmt} />\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr('insights.noRenewals', 'No dated renewals in the next 6 months.')}\n </p>\n )}\n </GlassCard>\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-2\">\n <Section title={tr('insights.topCosts', 'Top monthly costs')}>\n <GlassCard treatment=\"plain\" className=\"divide-y divide-border-subtle\">\n {stats.topCosts.map((r) => (\n <div key={r.id} className=\"flex items-center justify-between p-4\">\n <span className=\"truncate text-sm text-text-primary\">{r.label}</span>\n <span className=\"ml-3 shrink-0 text-sm font-semibold tabular-nums text-text-primary\">\n {fmt(monthly(r))}\n <span className=\"text-xs font-normal text-text-secondary\">\n {tr('insights.perMonth', '/mo')}\n </span>\n </span>\n </div>\n ))}\n </GlassCard>\n </Section>\n\n <Section title={tr('insights.healthWatchlist', 'Health watchlist')}>\n {stats.watchlist.length ? (\n <GlassCard treatment=\"plain\" className=\"divide-y divide-border-subtle\">\n {stats.watchlist.map((r) => (\n <div key={r.id} className=\"flex items-center gap-3 p-4\">\n <span className=\"w-32 shrink-0 truncate text-sm text-text-primary\">\n {r.label}\n </span>\n <MiniProgress className=\"flex-1\" value={r.healthScore ?? 0} tone=\"negative\" />\n <span\n className={cn(\n 'w-8 shrink-0 text-right text-sm font-medium tabular-nums text-status-warning-text'\n )}\n >\n {r.healthScore}\n </span>\n </div>\n ))}\n </GlassCard>\n ) : (\n <GlassCard treatment=\"plain\" className=\"p-6 text-sm text-text-secondary\">\n {tr(\n 'insights.allHealthy',\n 'Nothing needs review — all scored subscriptions look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C,EACC,uBACA,+DACF;KACS,CAAA;IAEN,CAAA,CACN;;EACL,EAAA,CAAA,CAEM;;AAEhB"}
1
+ {"version":3,"file":"InsightsPage.js","names":[],"sources":["../../../src/subscriberbot/pages/InsightsPage.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * Insights — spend analytics + renewal forecast, aggregated entirely from the\n * real subscription portfolio (`useRelationships`). Nothing is mocked: every\n * figure is computed from live relationship data (amount normalized to a monthly\n * equivalent by billing interval). Covers the concept mocks for cost insight,\n * renewal cashflow forecast, and spend management.\n * @module subscriberbot/pages\n */\nimport { useMemo, type FC } from 'react';\nimport { TrendingUp, Wallet, CalendarClock, HeartPulse, Layers, PiggyBank } from 'lucide-react';\nimport { GlassCard, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport {\n PageLayout,\n MetricsCard,\n EmptyState,\n LoadingView,\n ErrorView,\n Section,\n Donut,\n Legend,\n BarList,\n MiniProgress,\n} from '../components';\nimport { useRelationships } from '../hooks/useSubscriberBotApi';\nimport { useSubscriberBot } from '../context/SubscriberBotContext';\nimport { useTr } from '../hooks/useTr';\n\nimport type { SubBillingInterval, SubRelationship } from '../types';\nimport { cn } from '../utils/cn';\n\nconst MONTHLY_FACTOR: Record<SubBillingInterval, number> = {\n DAILY: 30,\n WEEKLY: 4.345,\n MONTHLY: 1,\n QUARTERLY: 1 / 3,\n YEARLY: 1 / 12,\n LIFETIME: 0,\n FREE: 0,\n USAGE_BASED: 1,\n};\n\nconst monthly = (r: SubRelationship): number => r.amount * (MONTHLY_FACTOR[r.interval] ?? 1);\nconst isActive = (r: SubRelationship): boolean => r.status === 'ACTIVE';\n\nexport const InsightsPage: FC = () => {\n const { formatCurrency, formatDate, formatEnumLabel } = useFormatters();\n\n const query = useRelationships({ pagination: { limit: 100 } });\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const rels = useMemo(() => query.data?.items ?? [], [query.data]);\n\n const stats = useMemo(() => {\n const active = rels.filter(isActive);\n const currency = active[0]?.currency ?? rels[0]?.currency ?? 'USD';\n const monthlySpend = active.reduce((s, r) => s + monthly(r), 0);\n const scored = rels.filter((r) => r.healthScore != null);\n const avgHealth = scored.length\n ? scored.reduce((s, r) => s + (r.healthScore ?? 0), 0) / scored.length\n : null;\n\n // by status (donut)\n const byStatus = new Map<string, number>();\n for (const r of rels) byStatus.set(r.status, (byStatus.get(r.status) ?? 0) + 1);\n\n // spend by kind (bar)\n const byKind = new Map<string, number>();\n for (const r of active) byKind.set(r.kind, (byKind.get(r.kind) ?? 0) + monthly(r));\n\n // top monthly costs\n const topCosts = [...active].sort((a, b) => monthly(b) - monthly(a)).slice(0, 6);\n\n // renewal forecast — next 6 calendar months by renewsAt\n const buckets: { label: string; value: number }[] = [];\n const now = new Date();\n for (let i = 0; i < 6; i += 1) {\n const d = new Date(now.getFullYear(), now.getMonth() + i, 1);\n const key = `${d.getFullYear()}-${d.getMonth()}`;\n const label = formatDate(d, { month: 'short', day: undefined, year: undefined });\n const value = rels.reduce((s, r) => {\n if (!r.renewsAt) return s;\n const rd = new Date(r.renewsAt);\n if (Number.isNaN(rd.getTime())) return s;\n return `${rd.getFullYear()}-${rd.getMonth()}` === key ? s + r.amount : s;\n }, 0);\n buckets.push({ label, value });\n }\n\n // low-health watchlist\n const watchlist = rels\n .filter((r) => r.healthScore != null && (r.healthScore as number) < 40)\n .sort((a, b) => (a.healthScore ?? 0) - (b.healthScore ?? 0))\n .slice(0, 6);\n\n const renewals30 = rels.filter((r) => {\n if (!r.renewsAt) return false;\n const t = new Date(r.renewsAt).getTime();\n if (Number.isNaN(t)) return false;\n const days = (t - Date.now()) / 86_400_000;\n return days >= 0 && days <= 30;\n }).length;\n\n return {\n currency,\n monthlySpend,\n activeCount: active.length,\n avgHealth,\n renewals30,\n statusData: [...byStatus.entries()].map(([label, value]) => ({\n label: formatEnumLabel(label),\n value,\n })),\n kindData: [...byKind.entries()]\n .map(([label, value]) => ({ label: formatEnumLabel(label), value }))\n .sort((a, b) => b.value - a.value),\n topCosts,\n forecast: buckets,\n watchlist,\n total: rels.length,\n };\n }, [rels, formatDate, formatEnumLabel]);\n\n if (query.isLoading)\n return <LoadingView label={tr('insights.loading', 'Crunching your spend insights…')} />;\n if (query.isError)\n return (\n <ErrorView\n message={tr('insights.error', 'Could not load insights.')}\n onRetry={() => void query.refetch()}\n />\n );\n\n const fmt = (n: number) => formatCurrency(n, stats.currency);\n\n return (\n <PageLayout\n title={tr('insights.title', 'Insights')}\n description={tr(\n 'insights.description',\n 'Where your recurring money goes, what renews next, and what to review — computed live from your portfolio.'\n )}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/savings')}\n data-testid=\"insights-open-savings\"\n className=\"inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90\"\n >\n <PiggyBank className=\"h-4 w-4\" aria-hidden />\n {tr('insights.openSavings', 'See how to save')}\n </button>\n }\n >\n <PagePurpose className=\"mb-2\">\n {tr(\n 'insights.purpose',\n 'Understand and optimize your recurring spend. Every figure here is aggregated from your real subscriptions — normalized to a monthly equivalent so plans on different billing cycles are comparable.'\n )}\n </PagePurpose>\n\n {stats.total === 0 ? (\n <EmptyState\n icon={<TrendingUp className=\"h-8 w-8\" />}\n title={tr('insights.emptyTitle', 'No data to analyze yet')}\n description={tr(\n 'insights.emptyDescription',\n 'Add a few subscriptions and your spend breakdown, renewal forecast and health watchlist will appear here.'\n )}\n />\n ) : (\n <>\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n <MetricsCard\n icon={<Wallet className=\"h-5 w-5\" />}\n value={fmt(stats.monthlySpend)}\n label={tr('insights.metrics.recurringSpend', 'Recurring spend / month')}\n featured\n />\n <MetricsCard\n icon={<Layers className=\"h-5 w-5\" />}\n value={stats.activeCount}\n label={tr('insights.metrics.activeSubscriptions', 'Active subscriptions')}\n />\n <MetricsCard\n icon={<CalendarClock className=\"h-5 w-5\" />}\n value={stats.renewals30}\n label={tr('insights.metrics.renewing30Days', 'Renewing in 30 days')}\n />\n <MetricsCard\n icon={<HeartPulse className=\"h-5 w-5\" />}\n value={\n stats.avgHealth != null\n ? Math.round(stats.avgHealth)\n : tr('insights.metrics.noScore', '—')\n }\n label={tr('insights.metrics.avgHealthScore', 'Avg. health score')}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <h2 className=\"mb-4 text-sm font-semibold text-text-primary\">\n {tr('insights.portfolioByStatus', 'Portfolio by status')}\n </h2>\n <div className=\"flex flex-col items-center gap-6 sm:flex-row\">\n <Donut\n data={stats.statusData}\n centerLabel={String(stats.total)}\n centerSub={tr('insights.subscriptions', 'subscriptions')}\n />\n <Legend className=\"w-full sm:flex-1\" data={stats.statusData} />\n </div>\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <h2 className=\"mb-4 text-sm font-semibold text-text-primary\">\n {tr('insights.spendByType', 'Monthly spend by type')}\n </h2>\n {stats.kindData.length ? (\n <BarList data={stats.kindData} valueFormat={fmt} />\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr('insights.noActiveSpend', 'No active spend.')}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <div className=\"mb-4 flex items-baseline justify-between gap-2\">\n <h2 className=\"text-sm font-semibold text-text-primary\">\n {tr('insights.renewalForecast', 'Renewal forecast (6 mo)')}\n </h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/renewals')}\n data-testid=\"insights-open-renewals\"\n className=\"shrink-0 rounded text-xs font-medium text-text-link hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n {tr('insights.openRenewals', 'Plan renewals')}\n </button>\n </div>\n {stats.forecast.some((f) => f.value > 0) ? (\n <BarList data={stats.forecast} valueFormat={fmt} />\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr('insights.noRenewals', 'No dated renewals in the next 6 months.')}\n </p>\n )}\n </GlassCard>\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-2\">\n <Section title={tr('insights.topCosts', 'Top monthly costs')}>\n <GlassCard treatment=\"plain\" className=\"divide-y divide-border-subtle\">\n {stats.topCosts.map((r) => (\n <div key={r.id} className=\"flex items-center justify-between p-4\">\n <span className=\"truncate text-sm text-text-primary\">{r.label}</span>\n <span className=\"ms-3 shrink-0 text-sm font-semibold tabular-nums text-text-primary\">\n {fmt(monthly(r))}\n <span className=\"text-xs font-normal text-text-secondary\">\n {tr('insights.perMonth', '/mo')}\n </span>\n </span>\n </div>\n ))}\n </GlassCard>\n </Section>\n\n <Section title={tr('insights.healthWatchlist', 'Health watchlist')}>\n {stats.watchlist.length ? (\n <GlassCard treatment=\"plain\" className=\"divide-y divide-border-subtle\">\n {stats.watchlist.map((r) => (\n <div key={r.id} className=\"flex items-center gap-3 p-4\">\n <span className=\"w-32 shrink-0 truncate text-sm text-text-primary\">\n {r.label}\n </span>\n <MiniProgress\n label={tr('common.healthScore', 'Health score')}\n className=\"flex-1\"\n value={r.healthScore ?? 0}\n tone=\"negative\"\n />\n <span\n className={cn(\n 'w-8 shrink-0 text-end text-sm font-medium tabular-nums text-status-warning-text'\n )}\n >\n {r.healthScore}\n </span>\n </div>\n ))}\n </GlassCard>\n ) : (\n <GlassCard treatment=\"plain\" className=\"p-6 text-sm text-text-secondary\">\n {tr(\n 'insights.allHealthy',\n 'Nothing needs review — all scored subscriptions look healthy.'\n )}\n </GlassCard>\n )}\n </Section>\n </div>\n </>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAM,IAAqD;CACzD,OAAO;CACP,QAAQ;CACR,SAAS;CACT,WAAW,IAAI;CACf,QAAQ,IAAI;CACZ,UAAU;CACV,MAAM;CACN,aAAa;AACf,GAEM,KAAW,MAA+B,EAAE,UAAU,EAAe,EAAE,aAAa,IACpF,KAA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U,aAAa;MAAM,CAAA,IAElD,kBAAC,KAAD;OAAG,WAAU;iBACV,EAAG,uBAAuB,yCAAyC;MACnE,CAAA,CAEI;;IACR;;GAEL,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAS,OAAO,EAAG,qBAAqB,mBAAmB;eACzD,kBAAC,GAAD;MAAW,WAAU;MAAQ,WAAU;gBACpC,EAAM,SAAS,KAAK,MACnB,kBAAC,OAAD;OAAgB,WAAU;iBAA1B,CACE,kBAAC,QAAD;QAAM,WAAU;kBAAsC,EAAE;OAAY,CAAA,GACpE,kBAAC,QAAD;QAAM,WAAU;kBAAhB,CACG,EAAI,EAAQ,CAAC,CAAC,GACf,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAG,qBAAqB,KAAK;QAC1B,CAAA,CACF;SACH;SARK,EAAE,EAQP,CACN;KACQ,CAAA;IACJ,CAAA,GAET,kBAAC,GAAD;KAAS,OAAO,EAAG,4BAA4B,kBAAkB;eAC9D,EAAM,UAAU,SACf,kBAAC,GAAD;MAAW,WAAU;MAAQ,WAAU;gBACpC,EAAM,UAAU,KAAK,MACpB,kBAAC,OAAD;OAAgB,WAAU;iBAA1B;QACE,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAE;QACC,CAAA;QACN,kBAAC,GAAD;SACE,OAAO,EAAG,sBAAsB,cAAc;SAC9C,WAAU;SACV,OAAO,EAAE,eAAe;SACxB,MAAK;QACN,CAAA;QACD,kBAAC,QAAD;SACE,WAAW,EACT,iFACF;mBAEC,EAAE;QACC,CAAA;OACH;SAjBK,EAAE,EAiBP,CACN;KACQ,CAAA,IAEX,kBAAC,GAAD;MAAW,WAAU;MAAQ,WAAU;gBACpC,EACC,uBACA,+DACF;KACS,CAAA;IAEN,CAAA,CACN;;EACL,EAAA,CAAA,CAEM;;AAEhB"}
@@ -1,14 +1,2 @@
1
- /**
2
- * Invoices
3
- * @module subscriberbot/pages
4
- *
5
- * The Universal Billing Layer's invoice ledger across every relationship, plus
6
- * the passive payment-method annotations that pay for them. Filter by status,
7
- * mark issued/overdue invoices paid, create invoices, and manage payment
8
- * methods. Reads `subListInvoices` / `subListPaymentInstruments` /
9
- * `subListRelationships` (to name the subscription each invoice bills for);
10
- * writes `subMarkInvoicePaid`, `subCreateInvoice`, `subCreatePaymentInstrument`,
11
- * `subRemovePaymentInstrument`.
12
- */
13
1
  export declare function InvoicesPage(): import("react").JSX.Element;
14
2
  //# sourceMappingURL=InvoicesPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InvoicesPage.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/pages/InvoicesPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAsmBH,wBAAgB,YAAY,gCA8S3B"}
1
+ {"version":3,"file":"InvoicesPage.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/pages/InvoicesPage.tsx"],"names":[],"mappings":"AAopBA,wBAAgB,YAAY,gCAgT3B"}