@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,217 +1,217 @@
1
- import { cn as e } from "../../utils/cn.js";
2
- import { formatCurrency as t, formatIntervalSuffix as n } from "../../utils/formatters.js";
1
+ import { useTr as e } from "../../hooks/useTr.js";
2
+ import { useFormatters as t } from "../../hooks/useFormatters.js";
3
+ import { cn as n } from "../../utils/cn.js";
3
4
  import { StatusBadge as r } from "../StatusBadge.js";
4
- import { useTr as i } from "../../hooks/useTr.js";
5
- import { useCancelRelationship as a, useTransitionRelationship as o } from "../../hooks/useSubscriberBotApi.js";
6
- import { daysUntil as s, isSwipeTrailingClick as c, quickActionsFor as l, renewalCountdown as u, swipeClickDeadline as d, swipeOffset as f, swipeSettlesOpen as p } from "../../utils/portfolio.js";
7
- import { RelationshipGlyph as m } from "./RelationshipGlyph.js";
8
- import { useRef as h, useState as g } from "react";
9
- import { Ban as _, ChevronRight as v, MoreHorizontal as y, Pause as b, Play as x } from "lucide-react";
10
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
11
- import { AlertDialog as T, AlertDialogAction as E, AlertDialogCancel as D, AlertDialogContent as O, AlertDialogDescription as k, AlertDialogFooter as A, AlertDialogHeader as j, AlertDialogTitle as M, BottomSheet as N, BottomSheetContent as P, BottomSheetDescription as F, BottomSheetHeader as I, BottomSheetTitle as L } from "@burdenoff/fe-libs/ui";
5
+ import { useCancelRelationship as i, useTransitionRelationship as a } from "../../hooks/useSubscriberBotApi.js";
6
+ import { daysUntil as o, isSwipeTrailingClick as s, quickActionsFor as c, renewalCountdown as l, swipeClickDeadline as u, swipeOffset as d, swipeSettlesOpen as f } from "../../utils/portfolio.js";
7
+ import { RelationshipGlyph as p } from "./RelationshipGlyph.js";
8
+ import { useRef as m, useState as h } from "react";
9
+ import { Ban as g, ChevronRight as _, MoreHorizontal as v, Pause as y, Play as b } from "lucide-react";
10
+ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
11
+ import { AlertDialog as w, AlertDialogAction as T, AlertDialogCancel as E, AlertDialogContent as D, AlertDialogDescription as O, AlertDialogFooter as k, AlertDialogHeader as A, AlertDialogTitle as j, BottomSheet as M, BottomSheetContent as N, BottomSheetDescription as P, BottomSheetHeader as F, BottomSheetTitle as I } from "@burdenoff/fe-libs/ui";
12
12
  //#region src/subscriberbot/components/mobile/MobileRelationshipList.tsx
13
- var R = 84, z = 8, B = {
13
+ var L = 84, R = 8, z = {
14
14
  activate: {
15
15
  key: "relationships.detail.actions.activate",
16
16
  fallback: "Activate",
17
- icon: x,
17
+ icon: b,
18
18
  tone: "bg-status-success-bg-subtle text-status-success-text"
19
19
  },
20
20
  resume: {
21
21
  key: "mobile.relationships.resume",
22
22
  fallback: "Resume",
23
- icon: x,
23
+ icon: b,
24
24
  tone: "bg-status-success-bg-subtle text-status-success-text"
25
25
  },
26
26
  pause: {
27
27
  key: "relationships.detail.actions.pause",
28
28
  fallback: "Pause",
29
- icon: b,
29
+ icon: y,
30
30
  tone: "bg-status-warning-bg-subtle text-status-warning-text"
31
31
  },
32
32
  cancel: {
33
33
  key: "relationships.detail.actions.cancel",
34
34
  fallback: "Cancel",
35
- icon: _,
35
+ icon: g,
36
36
  tone: "bg-status-error-bg-subtle text-status-error-text"
37
37
  }
38
- }, V = ({ items: r, navigateTo: s }) => {
39
- let c = i(), u = o(), d = a(), [f, p] = g(null), [m, h] = g(null), [_, y] = g(null), [b, x] = g(null), R = u.isPending || d.isPending, z = (e) => x(e instanceof Error ? e.message : c("mobile.relationships.actionFailed", "That action could not be completed.")), V = (e, t) => {
40
- if (p(null), h(null), x(null), t.destructive) {
41
- y(e);
38
+ }, B = ({ items: r, navigateTo: o }) => {
39
+ let { formatCurrency: s, formatIntervalSuffix: l } = t(), u = e(), d = a(), f = i(), [p, m] = h(null), [g, v] = h(null), [y, b] = h(null), [L, R] = h(null), B = d.isPending || f.isPending, H = (e) => R(e instanceof Error ? e.message : u("mobile.relationships.actionFailed", "That action could not be completed.")), U = (e, t) => {
40
+ if (m(null), v(null), R(null), t.destructive) {
41
+ b(e);
42
42
  return;
43
43
  }
44
- u.mutate({
44
+ d.mutate({
45
45
  id: e.id,
46
46
  status: t.target
47
- }, { onError: z });
47
+ }, { onError: H });
48
48
  };
49
- return /* @__PURE__ */ w(S, { children: [
50
- b && /* @__PURE__ */ C("div", {
49
+ return /* @__PURE__ */ C(x, { children: [
50
+ L && /* @__PURE__ */ S("div", {
51
51
  role: "alert",
52
52
  className: "mt-4 rounded-xl border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
53
- children: b
53
+ children: L
54
54
  }),
55
- /* @__PURE__ */ C("ul", {
55
+ /* @__PURE__ */ S("ul", {
56
56
  className: "mt-4 space-y-3",
57
57
  "data-testid": "sb-mobile-relationship-list",
58
- children: r.map((e) => /* @__PURE__ */ C(H, {
58
+ children: r.map((e) => /* @__PURE__ */ S(V, {
59
59
  relationship: e,
60
- open: f === e.id,
61
- busy: R,
62
- onOpenChange: (t) => p(t ? e.id : null),
63
- onSelect: () => s(`/relationships/${e.id}`),
60
+ open: p === e.id,
61
+ busy: B,
62
+ onOpenChange: (t) => m(t ? e.id : null),
63
+ onSelect: () => o(`/relationships/${e.id}`),
64
64
  onMore: () => {
65
- p(null), h(e);
65
+ m(null), v(e);
66
66
  },
67
- onAction: (t) => V(e, t)
67
+ onAction: (t) => U(e, t)
68
68
  }, e.id))
69
69
  }),
70
- /* @__PURE__ */ C(N, {
71
- open: m != null,
72
- onOpenChange: (e) => !e && h(null),
73
- children: /* @__PURE__ */ C(P, {
70
+ /* @__PURE__ */ S(M, {
71
+ open: g != null,
72
+ onOpenChange: (e) => !e && v(null),
73
+ children: /* @__PURE__ */ S(N, {
74
74
  "data-testid": "sb-mobile-relationship-actions",
75
- children: m && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ w(I, { children: [/* @__PURE__ */ C(L, { children: m.label }), /* @__PURE__ */ w(F, { children: [t(m.amount, m.currency), n(m.interval)] })] }), /* @__PURE__ */ w("div", {
75
+ children: g && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C(F, { children: [/* @__PURE__ */ S(I, { children: g.label }), /* @__PURE__ */ C(P, { children: [s(g.amount, g.currency), l(g.interval)] })] }), /* @__PURE__ */ C("div", {
76
76
  className: "flex flex-col gap-2 py-2",
77
- children: [/* @__PURE__ */ w("button", {
77
+ children: [/* @__PURE__ */ C("button", {
78
78
  type: "button",
79
- className: "flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-left text-sm font-medium text-text-primary active:bg-bg-sunken",
79
+ className: "flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-start text-sm font-medium text-text-primary active:bg-bg-sunken",
80
80
  onClick: () => {
81
- let e = m.id;
82
- h(null), s(`/relationships/${e}`);
81
+ let e = g.id;
82
+ v(null), o(`/relationships/${e}`);
83
83
  },
84
- children: [c("mobile.relationships.viewDetails", "View details"), /* @__PURE__ */ C(v, { className: "h-4 w-4 text-text-secondary" })]
85
- }), l(m.status).map((t) => {
86
- let n = B[t.id], r = n.icon;
87
- return /* @__PURE__ */ w("button", {
84
+ children: [u("mobile.relationships.viewDetails", "View details"), /* @__PURE__ */ S(_, { className: "rtl:rotate-180 h-4 w-4 text-text-secondary" })]
85
+ }), c(g.status).map((e) => {
86
+ let t = z[e.id], r = t.icon;
87
+ return /* @__PURE__ */ C("button", {
88
88
  type: "button",
89
- disabled: R,
90
- className: e("flex min-h-12 items-center gap-3 rounded-xl px-4 text-left text-sm font-medium disabled:opacity-50", n.tone),
91
- onClick: () => V(m, t),
89
+ disabled: B,
90
+ className: n("flex min-h-12 items-center gap-3 rounded-xl px-4 text-start text-sm font-medium disabled:opacity-50", t.tone),
91
+ onClick: () => U(g, e),
92
92
  children: [
93
- /* @__PURE__ */ C(r, { className: "h-4 w-4" }),
93
+ /* @__PURE__ */ S(r, { className: "h-4 w-4" }),
94
94
  " ",
95
- c(n.key, n.fallback)
95
+ u(t.key, t.fallback)
96
96
  ]
97
- }, t.id);
97
+ }, e.id);
98
98
  })]
99
99
  })] })
100
100
  })
101
101
  }),
102
- /* @__PURE__ */ C(T, {
103
- open: _ != null,
104
- onOpenChange: (e) => !e && y(null),
105
- children: /* @__PURE__ */ w(O, { children: [/* @__PURE__ */ w(j, { children: [/* @__PURE__ */ C(M, { children: c("mobile.relationships.cancelTitle", "Cancel {{label}}?", { label: _?.label ?? "" }) }), /* @__PURE__ */ C(k, { children: c("mobile.relationships.cancelDescription", "This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.") })] }), /* @__PURE__ */ w(A, { children: [/* @__PURE__ */ C(D, { children: c("mobile.relationships.keep", "Keep it") }), /* @__PURE__ */ C(E, {
102
+ /* @__PURE__ */ S(w, {
103
+ open: y != null,
104
+ onOpenChange: (e) => !e && b(null),
105
+ children: /* @__PURE__ */ C(D, { children: [/* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: u("mobile.relationships.cancelTitle", "Cancel {{label}}?", { label: y?.label ?? "" }) }), /* @__PURE__ */ S(O, { children: u("mobile.relationships.cancelDescription", "This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.") })] }), /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(E, { children: u("mobile.relationships.keep", "Keep it") }), /* @__PURE__ */ S(T, {
106
106
  onClick: () => {
107
- if (!_) return;
108
- let e = _.id;
109
- y(null), d.mutate(e, { onError: z });
107
+ if (!y) return;
108
+ let e = y.id;
109
+ b(null), f.mutate(e, { onError: H });
110
110
  },
111
- children: c("mobile.relationships.confirmCancel", "Cancel relationship")
111
+ children: u("mobile.relationships.confirmCancel", "Cancel relationship")
112
112
  })] })] })
113
113
  })
114
114
  ] });
115
- }, H = ({ relationship: a, open: o, busy: _, onOpenChange: v, onSelect: b, onMore: x, onAction: S }) => {
116
- let T = i(), E = l(a.status), D = E.length * R, [O, k] = g(null), A = h(null), j = h(0), M = O ?? (o ? -D : 0), N = s(a.renewsAt), P = N != null && (a.status === "ACTIVE" || a.status === "TRIAL") ? u(N) : null, F = (e) => {
117
- D === 0 || e.pointerType === "mouse" || (A.current = {
115
+ }, V = ({ relationship: i, open: a, busy: g, onOpenChange: _, onSelect: y, onMore: b, onAction: x }) => {
116
+ let { formatCurrency: w, formatIntervalSuffix: T } = t(), E = e(), D = c(i.status), O = D.length * L, [k, A] = h(null), j = m(null), M = m(0), N = k ?? (a ? -O : 0), P = o(i.renewsAt), F = P != null && (i.status === "ACTIVE" || i.status === "TRIAL") ? l(P) : null, I = (e) => {
117
+ O === 0 || e.pointerType === "mouse" || (j.current = {
118
118
  x: e.clientX,
119
119
  y: e.clientY,
120
120
  swiping: !1,
121
121
  moved: !1
122
122
  });
123
- }, I = (e) => {
124
- let t = A.current;
123
+ }, B = (e) => {
124
+ let t = j.current;
125
125
  if (!t) return;
126
126
  let n = e.clientX - t.x, r = e.clientY - t.y;
127
127
  if (!t.swiping) {
128
- if (Math.abs(r) > z && Math.abs(r) > Math.abs(n)) {
129
- A.current = null;
128
+ if (Math.abs(r) > R && Math.abs(r) > Math.abs(n)) {
129
+ j.current = null;
130
130
  return;
131
131
  }
132
- if (Math.abs(n) < z) return;
132
+ if (Math.abs(n) < R) return;
133
133
  t.swiping = !0, e.currentTarget.setPointerCapture(e.pointerId);
134
134
  }
135
- t.moved = !0, k(f(n, o, D));
136
- }, L = () => {
137
- let e = A.current;
138
- A.current = null, e?.swiping && O != null && v(p(O, D)), k(null), e?.moved && (j.current = d(Date.now()));
135
+ t.moved = !0, A(d(n, a, O));
136
+ }, V = () => {
137
+ let e = j.current;
138
+ j.current = null, e?.swiping && k != null && _(f(k, O)), A(null), e?.moved && (M.current = u(Date.now()));
139
139
  };
140
- return /* @__PURE__ */ w("li", {
140
+ return /* @__PURE__ */ C("li", {
141
141
  className: "relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken",
142
142
  "data-testid": "sb-mobile-relationship-row",
143
- "data-relationship-id": a.id,
144
- children: [E.length > 0 && /* @__PURE__ */ C("div", {
143
+ "data-relationship-id": i.id,
144
+ children: [D.length > 0 && /* @__PURE__ */ S("div", {
145
145
  className: "absolute inset-y-0 right-0 flex",
146
- style: { width: D },
147
- "aria-hidden": !o,
148
- children: E.map((t) => {
149
- let n = B[t.id], r = n.icon;
150
- return /* @__PURE__ */ w("button", {
146
+ style: { width: O },
147
+ "aria-hidden": !a,
148
+ children: D.map((e) => {
149
+ let t = z[e.id], r = t.icon;
150
+ return /* @__PURE__ */ C("button", {
151
151
  type: "button",
152
- tabIndex: o ? 0 : -1,
153
- disabled: _,
154
- onClick: () => S(t),
155
- className: e("flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50", n.tone),
156
- style: { width: R },
157
- children: [/* @__PURE__ */ C(r, { className: "h-5 w-5" }), T(n.key, n.fallback)]
158
- }, t.id);
152
+ tabIndex: a ? 0 : -1,
153
+ disabled: g,
154
+ onClick: () => x(e),
155
+ className: n("flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50", t.tone),
156
+ style: { width: L },
157
+ children: [/* @__PURE__ */ S(r, { className: "h-5 w-5" }), E(t.key, t.fallback)]
158
+ }, e.id);
159
159
  })
160
- }), /* @__PURE__ */ w("div", {
161
- className: e("relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4", O == null && "transition-transform duration-200 ease-out"),
162
- style: { transform: `translateX(${M}px)` },
163
- onPointerDown: F,
164
- onPointerMove: I,
165
- onPointerUp: L,
166
- onPointerCancel: L,
160
+ }), /* @__PURE__ */ C("div", {
161
+ className: n("relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4", k == null && "transition-transform duration-200 ease-out"),
162
+ style: { transform: `translateX(${N}px)` },
163
+ onPointerDown: I,
164
+ onPointerMove: B,
165
+ onPointerUp: V,
166
+ onPointerCancel: V,
167
167
  onClickCapture: (e) => {
168
- c(Date.now(), j.current) && (j.current = 0, e.preventDefault(), e.stopPropagation());
168
+ s(Date.now(), M.current) && (M.current = 0, e.preventDefault(), e.stopPropagation());
169
169
  },
170
- children: [/* @__PURE__ */ w("button", {
170
+ children: [/* @__PURE__ */ C("button", {
171
171
  type: "button",
172
172
  onClick: () => {
173
- if (o) {
174
- v(!1);
173
+ if (a) {
174
+ _(!1);
175
175
  return;
176
176
  }
177
- b();
177
+ y();
178
178
  },
179
- className: "flex min-w-0 flex-1 items-center gap-3 text-left",
180
- children: [/* @__PURE__ */ C(m, { kind: a.kind }), /* @__PURE__ */ w("span", {
179
+ className: "flex min-w-0 flex-1 items-center gap-3 text-start",
180
+ children: [/* @__PURE__ */ S(p, { kind: i.kind }), /* @__PURE__ */ C("span", {
181
181
  className: "min-w-0 flex-1",
182
182
  children: [
183
- /* @__PURE__ */ C("span", {
183
+ /* @__PURE__ */ S("span", {
184
184
  className: "block truncate font-semibold text-text-primary",
185
- children: a.label
185
+ children: i.label
186
186
  }),
187
- /* @__PURE__ */ w("span", {
187
+ /* @__PURE__ */ C("span", {
188
188
  className: "block text-base tabular-nums text-text-primary",
189
- children: [t(a.amount, a.currency), /* @__PURE__ */ C("span", {
189
+ children: [w(i.amount, i.currency), /* @__PURE__ */ S("span", {
190
190
  className: "text-sm text-text-secondary",
191
- children: n(a.interval)
191
+ children: T(i.interval)
192
192
  })]
193
193
  }),
194
- /* @__PURE__ */ w("span", {
194
+ /* @__PURE__ */ C("span", {
195
195
  className: "mt-0.5 flex items-center gap-2",
196
- children: [/* @__PURE__ */ C(r, { status: a.status }), P && /* @__PURE__ */ C("span", {
197
- className: e("truncate text-xs", P.tone === "later" ? "text-text-secondary" : "text-status-warning-text"),
198
- children: T(P.key, P.fallback, P.params)
196
+ children: [/* @__PURE__ */ S(r, { status: i.status }), F && /* @__PURE__ */ S("span", {
197
+ className: n("truncate text-xs", F.tone === "later" ? "text-text-secondary" : "text-status-warning-text"),
198
+ children: E(F.key, F.fallback, F.params)
199
199
  })]
200
200
  })
201
201
  ]
202
202
  })]
203
- }), /* @__PURE__ */ C("button", {
203
+ }), /* @__PURE__ */ S("button", {
204
204
  type: "button",
205
- onClick: x,
206
- "aria-label": T("mobile.relationships.moreActions", "More actions for {{label}}", { label: a.label }),
205
+ onClick: b,
206
+ "aria-label": E("mobile.relationships.moreActions", "More actions for {{label}}", { label: i.label }),
207
207
  className: "flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken",
208
208
  "data-testid": "sb-mobile-relationship-more",
209
- children: /* @__PURE__ */ C(y, { className: "h-5 w-5" })
209
+ children: /* @__PURE__ */ S(v, { className: "h-5 w-5" })
210
210
  })]
211
211
  })]
212
212
  });
213
213
  };
214
214
  //#endregion
215
- export { V as MobileRelationshipList };
215
+ export { B as MobileRelationshipList };
216
216
 
217
217
  //# sourceMappingURL=MobileRelationshipList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileRelationshipList.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"sourcesContent":["/**\n * Mobile relationship list\n * @module subscriberbot/components/mobile\n *\n * Card rows for phone widths. Each row opens the relationship on tap, reveals\n * its lifecycle actions on a left swipe, and offers the same actions through\n * an overflow (⋯) button that opens a bottom sheet — so the actions stay\n * reachable without the gesture (keyboard, screen readers, desktop browsers\n * resized to phone width). Actions are filtered through the svc state machine\n * (`quickActionsFor`); cancelling asks for confirmation first.\n */\n\nimport {\n useRef,\n useState,\n type FC,\n type MouseEvent as ReactMouseEvent,\n type PointerEvent as ReactPointerEvent,\n} from 'react';\nimport { Ban, ChevronRight, MoreHorizontal, Pause, Play, type LucideIcon } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n BottomSheet,\n BottomSheetContent,\n BottomSheetDescription,\n BottomSheetHeader,\n BottomSheetTitle,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from '../StatusBadge';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { useCancelRelationship, useTransitionRelationship } from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatIntervalSuffix } from '../../utils/formatters';\nimport {\n daysUntil,\n isSwipeTrailingClick,\n quickActionsFor,\n renewalCountdown,\n swipeClickDeadline,\n swipeOffset,\n swipeSettlesOpen,\n type QuickAction,\n type QuickActionId,\n} from '../../utils/portfolio';\nimport type { SubRelationship } from '../../types';\n\n/** Width of one revealed action button. */\nconst ACTION_WIDTH = 84;\n/** Horizontal travel before a touch counts as a swipe rather than a tap/scroll. */\nconst SWIPE_SLOP = 8;\n\nconst ACTION_META: Record<\n QuickActionId,\n { key: string; fallback: string; icon: LucideIcon; tone: string }\n> = {\n activate: {\n key: 'relationships.detail.actions.activate',\n fallback: 'Activate',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n resume: {\n key: 'mobile.relationships.resume',\n fallback: 'Resume',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n pause: {\n key: 'relationships.detail.actions.pause',\n fallback: 'Pause',\n icon: Pause,\n tone: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n cancel: {\n key: 'relationships.detail.actions.cancel',\n fallback: 'Cancel',\n icon: Ban,\n tone: 'bg-status-error-bg-subtle text-status-error-text',\n },\n};\n\ninterface MobileRelationshipListProps {\n items: SubRelationship[];\n navigateTo: (relativePath: string) => void;\n}\n\nexport const MobileRelationshipList: FC<MobileRelationshipListProps> = ({ items, navigateTo }) => {\n const tr = useTr();\n const transition = useTransitionRelationship();\n const cancel = useCancelRelationship();\n const [openRowId, setOpenRowId] = useState<string | null>(null);\n const [sheetFor, setSheetFor] = useState<SubRelationship | null>(null);\n const [confirmCancel, setConfirmCancel] = useState<SubRelationship | null>(null);\n const [error, setError] = useState<string | null>(null);\n const busy = transition.isPending || cancel.isPending;\n\n const onError = (e: unknown) =>\n setError(\n e instanceof Error\n ? e.message\n : tr('mobile.relationships.actionFailed', 'That action could not be completed.')\n );\n\n const run = (relationship: SubRelationship, action: QuickAction) => {\n setOpenRowId(null);\n setSheetFor(null);\n setError(null);\n if (action.destructive) {\n setConfirmCancel(relationship);\n return;\n }\n transition.mutate({ id: relationship.id, status: action.target }, { onError });\n };\n\n const confirmCancellation = () => {\n if (!confirmCancel) return;\n const id = confirmCancel.id;\n setConfirmCancel(null);\n cancel.mutate(id, { onError });\n };\n\n return (\n <>\n {error && (\n <div\n role=\"alert\"\n className=\"mt-4 rounded-xl border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {error}\n </div>\n )}\n\n <ul className=\"mt-4 space-y-3\" data-testid=\"sb-mobile-relationship-list\">\n {items.map((r) => (\n <SwipeRow\n key={r.id}\n relationship={r}\n open={openRowId === r.id}\n busy={busy}\n onOpenChange={(open) => setOpenRowId(open ? r.id : null)}\n onSelect={() => navigateTo(`/relationships/${r.id}`)}\n onMore={() => {\n setOpenRowId(null);\n setSheetFor(r);\n }}\n onAction={(action) => run(r, action)}\n />\n ))}\n </ul>\n\n <BottomSheet open={sheetFor != null} onOpenChange={(open) => !open && setSheetFor(null)}>\n <BottomSheetContent data-testid=\"sb-mobile-relationship-actions\">\n {sheetFor && (\n <>\n <BottomSheetHeader>\n <BottomSheetTitle>{sheetFor.label}</BottomSheetTitle>\n <BottomSheetDescription>\n {formatCurrency(sheetFor.amount, sheetFor.currency)}\n {formatIntervalSuffix(sheetFor.interval)}\n </BottomSheetDescription>\n </BottomSheetHeader>\n <div className=\"flex flex-col gap-2 py-2\">\n <button\n type=\"button\"\n className=\"flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-left text-sm font-medium text-text-primary active:bg-bg-sunken\"\n onClick={() => {\n const id = sheetFor.id;\n setSheetFor(null);\n navigateTo(`/relationships/${id}`);\n }}\n >\n {tr('mobile.relationships.viewDetails', 'View details')}\n <ChevronRight className=\"h-4 w-4 text-text-secondary\" />\n </button>\n {quickActionsFor(sheetFor.status).map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n disabled={busy}\n className={cn(\n 'flex min-h-12 items-center gap-3 rounded-xl px-4 text-left text-sm font-medium disabled:opacity-50',\n meta.tone\n )}\n onClick={() => run(sheetFor, action)}\n >\n <Icon className=\"h-4 w-4\" /> {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n </>\n )}\n </BottomSheetContent>\n </BottomSheet>\n\n <AlertDialog\n open={confirmCancel != null}\n onOpenChange={(open) => !open && setConfirmCancel(null)}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tr('mobile.relationships.cancelTitle', 'Cancel {{label}}?', {\n label: confirmCancel?.label ?? '',\n })}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tr(\n 'mobile.relationships.cancelDescription',\n 'This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.'\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>{tr('mobile.relationships.keep', 'Keep it')}</AlertDialogCancel>\n <AlertDialogAction onClick={confirmCancellation}>\n {tr('mobile.relationships.confirmCancel', 'Cancel relationship')}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n );\n};\n\ninterface SwipeRowProps {\n relationship: SubRelationship;\n open: boolean;\n busy: boolean;\n onOpenChange: (open: boolean) => void;\n onSelect: () => void;\n onMore: () => void;\n onAction: (action: QuickAction) => void;\n}\n\nconst SwipeRow: FC<SwipeRowProps> = ({\n relationship: r,\n open,\n busy,\n onOpenChange,\n onSelect,\n onMore,\n onAction,\n}) => {\n const tr = useTr();\n const actions = quickActionsFor(r.status);\n const revealWidth = actions.length * ACTION_WIDTH;\n const [dragOffset, setDragOffset] = useState<number | null>(null);\n const gesture = useRef<{ x: number; y: number; swiping: boolean; moved: boolean } | null>(null);\n\n // A swipe ends with a synthetic click. While the pointer is captured that\n // click targets the capturing card element rather than the inner button,\n // so it is swallowed in the card's capture phase, and only within a short\n // window after the gesture — a later deliberate tap always goes through,\n // and a cancelled swipe (which dispatches no click) leaves nothing pending.\n const swipeClickUntil = useRef(0);\n\n const offset = dragOffset ?? (open ? -revealWidth : 0);\n const days = daysUntil(r.renewsAt);\n const countdown =\n days != null && (r.status === 'ACTIVE' || r.status === 'TRIAL') ? renewalCountdown(days) : null;\n\n const onPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {\n if (revealWidth === 0 || e.pointerType === 'mouse') return;\n gesture.current = { x: e.clientX, y: e.clientY, swiping: false, moved: false };\n };\n\n const onPointerMove = (e: ReactPointerEvent<HTMLDivElement>) => {\n const g = gesture.current;\n if (!g) return;\n const dx = e.clientX - g.x;\n const dy = e.clientY - g.y;\n if (!g.swiping) {\n if (Math.abs(dy) > SWIPE_SLOP && Math.abs(dy) > Math.abs(dx)) {\n // Vertical scroll — let the page have it.\n gesture.current = null;\n return;\n }\n if (Math.abs(dx) < SWIPE_SLOP) return;\n g.swiping = true;\n e.currentTarget.setPointerCapture(e.pointerId);\n }\n g.moved = true;\n setDragOffset(swipeOffset(dx, open, revealWidth));\n };\n\n const endGesture = () => {\n const g = gesture.current;\n gesture.current = null;\n if (g?.swiping && dragOffset != null) {\n onOpenChange(swipeSettlesOpen(dragOffset, revealWidth));\n }\n setDragOffset(null);\n if (g?.moved) swipeClickUntil.current = swipeClickDeadline(Date.now());\n };\n\n const onClickCapture = (e: ReactMouseEvent<HTMLDivElement>) => {\n if (!isSwipeTrailingClick(Date.now(), swipeClickUntil.current)) return;\n swipeClickUntil.current = 0;\n e.preventDefault();\n e.stopPropagation();\n };\n\n const handleSelect = () => {\n if (open) {\n onOpenChange(false);\n return;\n }\n onSelect();\n };\n\n return (\n <li\n className=\"relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-row\"\n data-relationship-id={r.id}\n >\n {/* Action tray, revealed under the card by a left swipe. Hidden from\n assistive tech and the tab order while closed — the ⋯ sheet is the\n accessible path to the same actions. */}\n {actions.length > 0 && (\n <div\n className=\"absolute inset-y-0 right-0 flex\"\n style={{ width: revealWidth }}\n aria-hidden={!open}\n >\n {actions.map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n tabIndex={open ? 0 : -1}\n disabled={busy}\n onClick={() => onAction(action)}\n className={cn(\n 'flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50',\n meta.tone\n )}\n style={{ width: ACTION_WIDTH }}\n >\n <Icon className=\"h-5 w-5\" />\n {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n )}\n\n <div\n className={cn(\n 'relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4',\n dragOffset == null && 'transition-transform duration-200 ease-out'\n )}\n style={{ transform: `translateX(${offset}px)` }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endGesture}\n onPointerCancel={endGesture}\n onClickCapture={onClickCapture}\n >\n <button\n type=\"button\"\n onClick={handleSelect}\n className=\"flex min-w-0 flex-1 items-center gap-3 text-left\"\n >\n <RelationshipGlyph kind={r.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">{r.label}</span>\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n <span className=\"text-sm text-text-secondary\">\n {formatIntervalSuffix(r.interval)}\n </span>\n </span>\n <span className=\"mt-0.5 flex items-center gap-2\">\n <StatusBadge status={r.status} />\n {countdown && (\n <span\n className={cn(\n 'truncate text-xs',\n countdown.tone === 'later' ? 'text-text-secondary' : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n </span>\n </button>\n <button\n type=\"button\"\n onClick={onMore}\n aria-label={tr('mobile.relationships.moreActions', 'More actions for {{label}}', {\n label: r.label,\n })}\n className=\"flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-more\"\n >\n <MoreHorizontal className=\"h-5 w-5\" />\n </button>\n </div>\n </li>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAuDA,IAAM,IAAe,IAEf,IAAa,GAEb,IAGF;CACF,UAAU;EACR,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;AACF,GAOa,KAA2D,EAAE,UAAO,oBAAiB;CAChG,IAAM,IAAK,EAAM,GACX,IAAa,EAA0B,GACvC,IAAS,EAAsB,GAC/B,CAAC,GAAW,KAAgB,EAAwB,IAAI,GACxD,CAAC,GAAU,KAAe,EAAiC,IAAI,GAC/D,CAAC,GAAe,KAAoB,E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C5B,CAAA,CACF;;MACN,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACE,kBAAC,GAAD,EAAa,QAAQ,EAAE,OAAS,CAAA,GAC/B,KACC,kBAAC,QAAD;QACE,WAAW,EACT,oBACA,EAAU,SAAS,UAAU,wBAAwB,0BACvD;kBAEC,EAAG,EAAU,KAAK,EAAU,UAAU,EAAU,MAAM;OACnD,CAAA,CAEJ;;KACF;MACA;OACR,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAG,oCAAoC,8BAA8B,EAC/E,OAAO,EAAE,MACX,CAAC;IACD,WAAU;IACV,eAAY;cAEZ,kBAAC,GAAD,EAAgB,WAAU,UAAW,CAAA;GAC/B,CAAA,CACL;IACH;;AAER"}
1
+ {"version":3,"file":"MobileRelationshipList.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Mobile relationship list\n * @module subscriberbot/components/mobile\n *\n * Card rows for phone widths. Each row opens the relationship on tap, reveals\n * its lifecycle actions on a left swipe, and offers the same actions through\n * an overflow (⋯) button that opens a bottom sheet — so the actions stay\n * reachable without the gesture (keyboard, screen readers, desktop browsers\n * resized to phone width). Actions are filtered through the svc state machine\n * (`quickActionsFor`); cancelling asks for confirmation first.\n */\n\nimport {\n useRef,\n useState,\n type FC,\n type MouseEvent as ReactMouseEvent,\n type PointerEvent as ReactPointerEvent,\n} from 'react';\nimport { Ban, ChevronRight, MoreHorizontal, Pause, Play, type LucideIcon } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n BottomSheet,\n BottomSheetContent,\n BottomSheetDescription,\n BottomSheetHeader,\n BottomSheetTitle,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from '../StatusBadge';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { useCancelRelationship, useTransitionRelationship } from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport {\n daysUntil,\n isSwipeTrailingClick,\n quickActionsFor,\n renewalCountdown,\n swipeClickDeadline,\n swipeOffset,\n swipeSettlesOpen,\n type QuickAction,\n type QuickActionId,\n} from '../../utils/portfolio';\nimport type { SubRelationship } from '../../types';\n\n/** Width of one revealed action button. */\nconst ACTION_WIDTH = 84;\n/** Horizontal travel before a touch counts as a swipe rather than a tap/scroll. */\nconst SWIPE_SLOP = 8;\n\nconst ACTION_META: Record<\n QuickActionId,\n { key: string; fallback: string; icon: LucideIcon; tone: string }\n> = {\n activate: {\n key: 'relationships.detail.actions.activate',\n fallback: 'Activate',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n resume: {\n key: 'mobile.relationships.resume',\n fallback: 'Resume',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n pause: {\n key: 'relationships.detail.actions.pause',\n fallback: 'Pause',\n icon: Pause,\n tone: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n cancel: {\n key: 'relationships.detail.actions.cancel',\n fallback: 'Cancel',\n icon: Ban,\n tone: 'bg-status-error-bg-subtle text-status-error-text',\n },\n};\n\ninterface MobileRelationshipListProps {\n items: SubRelationship[];\n navigateTo: (relativePath: string) => void;\n}\n\nexport const MobileRelationshipList: FC<MobileRelationshipListProps> = ({ items, navigateTo }) => {\n const { formatCurrency, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const transition = useTransitionRelationship();\n const cancel = useCancelRelationship();\n const [openRowId, setOpenRowId] = useState<string | null>(null);\n const [sheetFor, setSheetFor] = useState<SubRelationship | null>(null);\n const [confirmCancel, setConfirmCancel] = useState<SubRelationship | null>(null);\n const [error, setError] = useState<string | null>(null);\n const busy = transition.isPending || cancel.isPending;\n\n const onError = (e: unknown) =>\n setError(\n e instanceof Error\n ? e.message\n : tr('mobile.relationships.actionFailed', 'That action could not be completed.')\n );\n\n const run = (relationship: SubRelationship, action: QuickAction) => {\n setOpenRowId(null);\n setSheetFor(null);\n setError(null);\n if (action.destructive) {\n setConfirmCancel(relationship);\n return;\n }\n transition.mutate({ id: relationship.id, status: action.target }, { onError });\n };\n\n const confirmCancellation = () => {\n if (!confirmCancel) return;\n const id = confirmCancel.id;\n setConfirmCancel(null);\n cancel.mutate(id, { onError });\n };\n\n return (\n <>\n {error && (\n <div\n role=\"alert\"\n className=\"mt-4 rounded-xl border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {error}\n </div>\n )}\n\n <ul className=\"mt-4 space-y-3\" data-testid=\"sb-mobile-relationship-list\">\n {items.map((r) => (\n <SwipeRow\n key={r.id}\n relationship={r}\n open={openRowId === r.id}\n busy={busy}\n onOpenChange={(open) => setOpenRowId(open ? r.id : null)}\n onSelect={() => navigateTo(`/relationships/${r.id}`)}\n onMore={() => {\n setOpenRowId(null);\n setSheetFor(r);\n }}\n onAction={(action) => run(r, action)}\n />\n ))}\n </ul>\n\n <BottomSheet open={sheetFor != null} onOpenChange={(open) => !open && setSheetFor(null)}>\n <BottomSheetContent data-testid=\"sb-mobile-relationship-actions\">\n {sheetFor && (\n <>\n <BottomSheetHeader>\n <BottomSheetTitle>{sheetFor.label}</BottomSheetTitle>\n <BottomSheetDescription>\n {formatCurrency(sheetFor.amount, sheetFor.currency)}\n {formatIntervalSuffix(sheetFor.interval)}\n </BottomSheetDescription>\n </BottomSheetHeader>\n <div className=\"flex flex-col gap-2 py-2\">\n <button\n type=\"button\"\n className=\"flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-start text-sm font-medium text-text-primary active:bg-bg-sunken\"\n onClick={() => {\n const id = sheetFor.id;\n setSheetFor(null);\n navigateTo(`/relationships/${id}`);\n }}\n >\n {tr('mobile.relationships.viewDetails', 'View details')}\n <ChevronRight className=\"rtl:rotate-180 h-4 w-4 text-text-secondary\" />\n </button>\n {quickActionsFor(sheetFor.status).map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n disabled={busy}\n className={cn(\n 'flex min-h-12 items-center gap-3 rounded-xl px-4 text-start text-sm font-medium disabled:opacity-50',\n meta.tone\n )}\n onClick={() => run(sheetFor, action)}\n >\n <Icon className=\"h-4 w-4\" /> {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n </>\n )}\n </BottomSheetContent>\n </BottomSheet>\n\n <AlertDialog\n open={confirmCancel != null}\n onOpenChange={(open) => !open && setConfirmCancel(null)}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tr('mobile.relationships.cancelTitle', 'Cancel {{label}}?', {\n label: confirmCancel?.label ?? '',\n })}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tr(\n 'mobile.relationships.cancelDescription',\n 'This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.'\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>{tr('mobile.relationships.keep', 'Keep it')}</AlertDialogCancel>\n <AlertDialogAction onClick={confirmCancellation}>\n {tr('mobile.relationships.confirmCancel', 'Cancel relationship')}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n );\n};\n\ninterface SwipeRowProps {\n relationship: SubRelationship;\n open: boolean;\n busy: boolean;\n onOpenChange: (open: boolean) => void;\n onSelect: () => void;\n onMore: () => void;\n onAction: (action: QuickAction) => void;\n}\n\nconst SwipeRow: FC<SwipeRowProps> = ({\n relationship: r,\n open,\n busy,\n onOpenChange,\n onSelect,\n onMore,\n onAction,\n}) => {\n const { formatCurrency, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const actions = quickActionsFor(r.status);\n const revealWidth = actions.length * ACTION_WIDTH;\n const [dragOffset, setDragOffset] = useState<number | null>(null);\n const gesture = useRef<{ x: number; y: number; swiping: boolean; moved: boolean } | null>(null);\n\n // A swipe ends with a synthetic click. While the pointer is captured that\n // click targets the capturing card element rather than the inner button,\n // so it is swallowed in the card's capture phase, and only within a short\n // window after the gesture — a later deliberate tap always goes through,\n // and a cancelled swipe (which dispatches no click) leaves nothing pending.\n const swipeClickUntil = useRef(0);\n\n const offset = dragOffset ?? (open ? -revealWidth : 0);\n const days = daysUntil(r.renewsAt);\n const countdown =\n days != null && (r.status === 'ACTIVE' || r.status === 'TRIAL') ? renewalCountdown(days) : null;\n\n const onPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {\n if (revealWidth === 0 || e.pointerType === 'mouse') return;\n gesture.current = { x: e.clientX, y: e.clientY, swiping: false, moved: false };\n };\n\n const onPointerMove = (e: ReactPointerEvent<HTMLDivElement>) => {\n const g = gesture.current;\n if (!g) return;\n const dx = e.clientX - g.x;\n const dy = e.clientY - g.y;\n if (!g.swiping) {\n if (Math.abs(dy) > SWIPE_SLOP && Math.abs(dy) > Math.abs(dx)) {\n // Vertical scroll — let the page have it.\n gesture.current = null;\n return;\n }\n if (Math.abs(dx) < SWIPE_SLOP) return;\n g.swiping = true;\n e.currentTarget.setPointerCapture(e.pointerId);\n }\n g.moved = true;\n setDragOffset(swipeOffset(dx, open, revealWidth));\n };\n\n const endGesture = () => {\n const g = gesture.current;\n gesture.current = null;\n if (g?.swiping && dragOffset != null) {\n onOpenChange(swipeSettlesOpen(dragOffset, revealWidth));\n }\n setDragOffset(null);\n if (g?.moved) swipeClickUntil.current = swipeClickDeadline(Date.now());\n };\n\n const onClickCapture = (e: ReactMouseEvent<HTMLDivElement>) => {\n if (!isSwipeTrailingClick(Date.now(), swipeClickUntil.current)) return;\n swipeClickUntil.current = 0;\n e.preventDefault();\n e.stopPropagation();\n };\n\n const handleSelect = () => {\n if (open) {\n onOpenChange(false);\n return;\n }\n onSelect();\n };\n\n return (\n <li\n className=\"relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-row\"\n data-relationship-id={r.id}\n >\n {/* Action tray, revealed under the card by a left swipe. Hidden from\n assistive tech and the tab order while closed — the ⋯ sheet is the\n accessible path to the same actions. */}\n {actions.length > 0 && (\n <div\n className=\"absolute inset-y-0 right-0 flex\"\n style={{ width: revealWidth }}\n aria-hidden={!open}\n >\n {actions.map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n tabIndex={open ? 0 : -1}\n disabled={busy}\n onClick={() => onAction(action)}\n className={cn(\n 'flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50',\n meta.tone\n )}\n style={{ width: ACTION_WIDTH }}\n >\n <Icon className=\"h-5 w-5\" />\n {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n )}\n\n <div\n className={cn(\n 'relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4',\n dragOffset == null && 'transition-transform duration-200 ease-out'\n )}\n style={{ transform: `translateX(${offset}px)` }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endGesture}\n onPointerCancel={endGesture}\n onClickCapture={onClickCapture}\n >\n <button\n type=\"button\"\n onClick={handleSelect}\n className=\"flex min-w-0 flex-1 items-center gap-3 text-start\"\n >\n <RelationshipGlyph kind={r.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">{r.label}</span>\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n <span className=\"text-sm text-text-secondary\">\n {formatIntervalSuffix(r.interval)}\n </span>\n </span>\n <span className=\"mt-0.5 flex items-center gap-2\">\n <StatusBadge status={r.status} />\n {countdown && (\n <span\n className={cn(\n 'truncate text-xs',\n countdown.tone === 'later' ? 'text-text-secondary' : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n </span>\n </button>\n <button\n type=\"button\"\n onClick={onMore}\n aria-label={tr('mobile.relationships.moreActions', 'More actions for {{label}}', {\n label: r.label,\n })}\n className=\"flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-more\"\n >\n <MoreHorizontal className=\"h-5 w-5\" />\n </button>\n </div>\n </li>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAwDA,IAAM,IAAe,IAEf,IAAa,GAEb,IAGF;CACF,UAAU;EACR,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;AACF,GAOa,KAA2D,EAAE,UAAO,oBAAiB;CAChG,IAAM,EAAE,mBAAgB,4BAAyB,EAAc,GAEzD,IAAK,EAAM,GACX,IAAa,EAA0B,GACvC,IAAS,EAAsB,GAC/B,CAAC,GAAW,KAAgB,EAAwB,IAAI,GACxD,CAAC,GAAU,KAAe,EAAiC,IAAI,GAC/D,CAAC,GAAe,KAAoB,EAAiC,IAAI,GACzE,CAAC,GAAO,KAAY,EAAwB,IAAI,GAChD,IAAO,EAAW,aAAa,EAAO,WAEtC,KAAW,MACf,EACE,aAAa,QACT,EAAE,UACF,EAAG,qCAAqC,qCAAqC,CACnF,GAEI,KAAO,GAA+B,MAAwB;EAIlE,IAHA,EAAa,IAAI,GACjB,EAAY,IAAI,GAChB,EAAS,IAAI,GACT,EAAO,aAAa;GACtB,EAAiB,CAAY;GAC7B;EACF;EACA,EAAW,OAAO;GAAE,IAAI,EAAa;GAAI,QAAQ,EAAO;EAAO,GAAG,EAAE,WAAQ,CAAC;CAC/E;CASA,OACE,kBAAA,GAAA,EAAA,UAAA;EACG,KACC,kBAAC,OAAD;G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GAAD,EAAgB,WAAU,UAAW,CAAA;GAC/B,CAAA,CACL;IACH;;AAER"}
@@ -11,7 +11,7 @@ var r = ({ title: r, eyebrow: i, hero: a, action: o, children: s, className: c,
11
11
  children: [/* @__PURE__ */ n("div", {
12
12
  className: "min-w-0",
13
13
  children: [i ? /* @__PURE__ */ t("p", {
14
- className: "text-sm opacity-80",
14
+ className: "text-sm",
15
15
  children: i
16
16
  }) : null, /* @__PURE__ */ t("h1", {
17
17
  className: "text-2xl font-bold tracking-tight",
@@ -1 +1 @@
1
- {"version":3,"file":"MobileScreen.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileScreen.tsx"],"sourcesContent":["/**\n * Mobile screen frame\n * @module subscriberbot/components/mobile\n *\n * The phone layout from the approved mobile mock (`sb-24-mobile-app.jpg`): a\n * brand-coloured hero band carrying the screen title (and, on the overview,\n * the headline number), with the content on a rounded sheet that overlaps the\n * band. Used below the `md` breakpoint only; desktop pages keep PageLayout.\n *\n * Semantic tokens only — the hero uses the product's action-primary pairing\n * so it follows the active brand and colour mode.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\ninterface MobileScreenProps {\n title: string;\n /** Small line above the title (e.g. the greeting). */\n eyebrow?: ReactNode;\n /** Optional hero content under the title (e.g. the recurring-spend figure). */\n hero?: ReactNode;\n /** Optional trailing control in the hero (e.g. an add button). */\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n /** Stable hook for Playwright and the assistant page context. */\n testId?: string;\n}\n\nexport const MobileScreen: FC<MobileScreenProps> = ({\n title,\n eyebrow,\n hero,\n action,\n children,\n className,\n testId,\n}) => (\n <div className={cn('flex min-h-full flex-col', className)} data-testid={testId}>\n <header className=\"bg-action-primary-bg px-4 pb-10 pt-5 text-action-primary-text\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n {eyebrow ? <p className=\"text-sm opacity-80\">{eyebrow}</p> : null}\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n </div>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n {hero ? <div className=\"mt-4\">{hero}</div> : null}\n </header>\n <div className=\"-mt-6 flex-1 rounded-t-3xl bg-bg-canvas px-4 pb-6 pt-5\">{children}</div>\n </div>\n);\n\ninterface MobileSectionProps {\n title: string;\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n}\n\n/** A titled group on the mobile sheet (\"Upcoming renewals\", \"Needs action\"). */\nexport const MobileSection: FC<MobileSectionProps> = ({ title, action, children, className }) => (\n <section className={cn('mt-6 first:mt-0', className)} aria-label={title}>\n <div className=\"mb-3 flex items-center justify-between gap-3\">\n <h2 className=\"text-lg font-semibold text-text-primary\">{title}</h2>\n {action}\n </div>\n {children}\n </section>\n);\n"],"mappings":";;;AA8BA,IAAa,KAAuC,EAClD,UACA,YACA,SACA,WACA,aACA,cACA,gBAEA,kBAAC,OAAD;CAAK,WAAW,EAAG,4BAA4B,CAAS;CAAG,eAAa;WAAxE,CACE,kBAAC,UAAD;EAAQ,WAAU;YAAlB,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,IAAU,kBAAC,KAAD;KAAG,WAAU;eAAsB;IAAW,CAAA,IAAI,MAC7D,kBAAC,MAAD;KAAI,WAAU;eAAqC;IAAU,CAAA,CAC1D;OACJ,IAAS,kBAAC,OAAD;IAAK,WAAU;cAAY;GAAY,CAAA,IAAI,IAClD;MACJ,IAAO,kBAAC,OAAD;GAAK,WAAU;aAAQ;EAAU,CAAA,IAAI,IACvC;KACR,kBAAC,OAAD;EAAK,WAAU;EAA0D;CAAc,CAAA,CACpF;IAWM,KAAyC,EAAE,UAAO,WAAQ,aAAU,mBAC/E,kBAAC,WAAD;CAAS,WAAW,EAAG,mBAAmB,CAAS;CAAG,cAAY;WAAlE,CACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,MAAD;GAAI,WAAU;aAA2C;EAAU,CAAA,GAClE,CACE;KACJ,CACM"}
1
+ {"version":3,"file":"MobileScreen.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileScreen.tsx"],"sourcesContent":["/**\n * Mobile screen frame\n * @module subscriberbot/components/mobile\n *\n * The phone layout from the approved mobile mock (`sb-24-mobile-app.jpg`): a\n * brand-coloured hero band carrying the screen title (and, on the overview,\n * the headline number), with the content on a rounded sheet that overlaps the\n * band. Used below the `md` breakpoint only; desktop pages keep PageLayout.\n *\n * Semantic tokens only — the hero uses the product's action-primary pairing\n * so it follows the active brand and colour mode.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\ninterface MobileScreenProps {\n title: string;\n /** Small line above the title (e.g. the greeting). */\n eyebrow?: ReactNode;\n /** Optional hero content under the title (e.g. the recurring-spend figure). */\n hero?: ReactNode;\n /** Optional trailing control in the hero (e.g. an add button). */\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n /** Stable hook for Playwright and the assistant page context. */\n testId?: string;\n}\n\nexport const MobileScreen: FC<MobileScreenProps> = ({\n title,\n eyebrow,\n hero,\n action,\n children,\n className,\n testId,\n}) => (\n <div className={cn('flex min-h-full flex-col', className)} data-testid={testId}>\n <header className=\"bg-action-primary-bg px-4 pb-10 pt-5 text-action-primary-text\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n {eyebrow ? <p className=\"text-sm\">{eyebrow}</p> : null}\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n </div>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n {hero ? <div className=\"mt-4\">{hero}</div> : null}\n </header>\n <div className=\"-mt-6 flex-1 rounded-t-3xl bg-bg-canvas px-4 pb-6 pt-5\">{children}</div>\n </div>\n);\n\ninterface MobileSectionProps {\n title: string;\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n}\n\n/** A titled group on the mobile sheet (\"Upcoming renewals\", \"Needs action\"). */\nexport const MobileSection: FC<MobileSectionProps> = ({ title, action, children, className }) => (\n <section className={cn('mt-6 first:mt-0', className)} aria-label={title}>\n <div className=\"mb-3 flex items-center justify-between gap-3\">\n <h2 className=\"text-lg font-semibold text-text-primary\">{title}</h2>\n {action}\n </div>\n {children}\n </section>\n);\n"],"mappings":";;;AA8BA,IAAa,KAAuC,EAClD,UACA,YACA,SACA,WACA,aACA,cACA,gBAEA,kBAAC,OAAD;CAAK,WAAW,EAAG,4BAA4B,CAAS;CAAG,eAAa;WAAxE,CACE,kBAAC,UAAD;EAAQ,WAAU;YAAlB,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,IAAU,kBAAC,KAAD;KAAG,WAAU;eAAW;IAAW,CAAA,IAAI,MAClD,kBAAC,MAAD;KAAI,WAAU;eAAqC;IAAU,CAAA,CAC1D;OACJ,IAAS,kBAAC,OAAD;IAAK,WAAU;cAAY;GAAY,CAAA,IAAI,IAClD;MACJ,IAAO,kBAAC,OAAD;GAAK,WAAU;aAAQ;EAAU,CAAA,IAAI,IACvC;KACR,kBAAC,OAAD;EAAK,WAAU;EAA0D;CAAc,CAAA,CACpF;IAWM,KAAyC,EAAE,UAAO,WAAQ,aAAU,mBAC/E,kBAAC,WAAD;CAAS,WAAW,EAAG,mBAAmB,CAAS;CAAG,cAAY;WAAlE,CACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,MAAD;GAAI,WAAU;aAA2C;EAAU,CAAA,GAClE,CACE;KACJ,CACM"}
@@ -1,14 +1,14 @@
1
- import { cn as e } from "../../utils/cn.js";
2
- import { useTr as t } from "../../hooks/useTr.js";
1
+ import { useTr as e } from "../../hooks/useTr.js";
2
+ import { cn as t } from "../../utils/cn.js";
3
3
  import { STATUS_LABEL as n, statusTone as r } from "./labels.js";
4
4
  import { jsx as i } from "react/jsx-runtime";
5
5
  //#region src/subscriberbot/components/negotiations/NegotiationStatusPill.tsx
6
6
  var a = ({ status: a, className: o }) => {
7
- let s = t(), c = n[a];
7
+ let s = e(), c = n[a];
8
8
  return /* @__PURE__ */ i("span", {
9
9
  "data-testid": "negotiation-status",
10
10
  "data-status": a,
11
- className: e("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium", r(a), o),
11
+ className: t("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium", r(a), o),
12
12
  children: s(c.key, c.fallback)
13
13
  });
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NegotiationTimeline.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/negotiations/NegotiationTimeline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AASnE,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAqC7F,CAAC"}
1
+ {"version":3,"file":"NegotiationTimeline.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/negotiations/NegotiationTimeline.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AASnE,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAuC7F,CAAC"}
@@ -1,5 +1,5 @@
1
- import { formatDateTime as e } from "../../utils/formatters.js";
2
- import { useTr as t } from "../../hooks/useTr.js";
1
+ import { useTr as e } from "../../hooks/useTr.js";
2
+ import { useFormatters as t } from "../../hooks/useFormatters.js";
3
3
  import { EVENT_LABEL as n, STATUS_LABEL as r } from "./labels.js";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region src/subscriberbot/components/negotiations/NegotiationTimeline.tsx
@@ -17,29 +17,29 @@ var o = {
17
17
  fallback: "Subscriber Bot"
18
18
  }
19
19
  }, s = ({ events: s, customerLabel: c }) => {
20
- let l = t();
20
+ let { formatDateTime: l } = t(), u = e();
21
21
  return s.length === 0 ? null : /* @__PURE__ */ i("ol", {
22
22
  className: "space-y-3",
23
23
  "data-testid": "negotiation-timeline",
24
- children: s.map((t) => {
25
- let s = o[t.actorRole] ?? o.system, u = t.actorRole === "customer" && c ? c : l(s.key, s.fallback), d = n[t.kind], f = t.toStatus ? r[t.toStatus] : null;
24
+ children: s.map((e) => {
25
+ let t = o[e.actorRole] ?? o.system, s = e.actorRole === "customer" && c ? c : u(t.key, t.fallback), d = n[e.kind], f = e.toStatus ? r[e.toStatus] : null;
26
26
  return /* @__PURE__ */ a("li", {
27
27
  className: "rounded-lg border border-border-subtle bg-bg-surface p-3",
28
28
  children: [/* @__PURE__ */ a("div", {
29
29
  className: "flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary",
30
30
  children: [/* @__PURE__ */ a("span", {
31
31
  className: "font-medium text-text-primary",
32
- children: [l(d.key, d.fallback), f && t.kind !== "CREATED" ? ` → ${l(f.key, f.fallback)}` : ""]
32
+ children: [u(d.key, d.fallback), f && e.kind !== "CREATED" ? ` → ${u(f.key, f.fallback)}` : ""]
33
33
  }), /* @__PURE__ */ a("span", { children: [
34
- u,
34
+ s,
35
35
  " · ",
36
- e(t.createdAt)
36
+ l(e.createdAt)
37
37
  ] })]
38
- }), t.message && /* @__PURE__ */ i("p", {
38
+ }), e.message && /* @__PURE__ */ i("p", {
39
39
  className: "mt-1.5 whitespace-pre-wrap text-sm text-text-primary",
40
- children: t.message
40
+ children: e.message
41
41
  })]
42
- }, t.id);
42
+ }, e.id);
43
43
  })
44
44
  });
45
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NegotiationTimeline.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/NegotiationTimeline.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { formatDateTime } from '../../utils/formatters';\nimport type { SubNegotiationEvent } from '../../types/negotiation';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'negotiations.role.customer', fallback: 'You' },\n negotiator: { key: 'negotiations.role.negotiator', fallback: 'Negotiation desk' },\n system: { key: 'negotiations.role.system', fallback: 'Subscriber Bot' },\n};\n\nexport const NegotiationTimeline: FC<{ events: SubNegotiationEvent[]; customerLabel?: string }> = ({\n events,\n customerLabel,\n}) => {\n const tr = useTr();\n if (events.length === 0) return null;\n return (\n <ol className=\"space-y-3\" data-testid=\"negotiation-timeline\">\n {events.map((event) => {\n const role = ROLE_LABEL[event.actorRole] ?? ROLE_LABEL.system!;\n const who =\n event.actorRole === 'customer' && customerLabel\n ? customerLabel\n : tr(role.key, role.fallback);\n const label = EVENT_LABEL[event.kind];\n const to = event.toStatus ? STATUS_LABEL[event.toStatus] : null;\n return (\n <li key={event.id} className=\"rounded-lg border border-border-subtle bg-bg-surface p-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">\n {tr(label.key, label.fallback)}\n {to && event.kind !== 'CREATED' ? ` → ${tr(to.key, to.fallback)}` : ''}\n </span>\n <span>\n {who} · {formatDateTime(event.createdAt)}\n </span>\n </div>\n {event.message && (\n <p className=\"mt-1.5 whitespace-pre-wrap text-sm text-text-primary\">\n {event.message}\n </p>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n"],"mappings":";;;;;AAMA,IAAM,IAAgE;CACpE,UAAU;EAAE,KAAK;EAA8B,UAAU;CAAM;CAC/D,YAAY;EAAE,KAAK;EAAgC,UAAU;CAAmB;CAChF,QAAQ;EAAE,KAAK;EAA4B,UAAU;CAAiB;AACxE,GAEa,KAAsF,EACjG,WACA,uBACI;CACJ,IAAM,IAAK,EAAM;CAEjB,OADI,EAAO,WAAW,IAAU,OAE9B,kBAAC,MAAD;EAAI,WAAU;EAAY,eAAY;YACnC,EAAO,KAAK,MAAU;GACrB,IAAM,IAAO,EAAW,EAAM,cAAc,EAAW,QACjD,IACJ,EAAM,cAAc,cAAc,IAC9B,IACA,EAAG,EAAK,KAAK,EAAK,QAAQ,GAC1B,IAAQ,EAAY,EAAM,OAC1B,IAAK,EAAM,WAAW,EAAa,EAAM,YAAY;GAC3D,OACE,kBAAC,MAAD;IAAmB,WAAU;cAA7B,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,EAAG,EAAM,KAAK,EAAM,QAAQ,GAC5B,KAAM,EAAM,SAAS,YAAY,MAAM,EAAG,EAAG,KAAK,EAAG,QAAQ,MAAM,EAChE;SACN,kBAAC,QAAD,EAAA,UAAA;MACG;MAAI;MAAI,EAAe,EAAM,SAAS;KACnC,EAAA,CAAA,CACH;QACJ,EAAM,WACL,kBAAC,KAAD;KAAG,WAAU;eACV,EAAM;IACN,CAAA,CAEH;MAfK,EAAM,EAeX;EAER,CAAC;CACC,CAAA;AAER"}
1
+ {"version":3,"file":"NegotiationTimeline.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/NegotiationTimeline.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type { SubNegotiationEvent } from '../../types/negotiation';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'negotiations.role.customer', fallback: 'You' },\n negotiator: { key: 'negotiations.role.negotiator', fallback: 'Negotiation desk' },\n system: { key: 'negotiations.role.system', fallback: 'Subscriber Bot' },\n};\n\nexport const NegotiationTimeline: FC<{ events: SubNegotiationEvent[]; customerLabel?: string }> = ({\n events,\n customerLabel,\n}) => {\n const { formatDateTime } = useFormatters();\n\n const tr = useTr();\n if (events.length === 0) return null;\n return (\n <ol className=\"space-y-3\" data-testid=\"negotiation-timeline\">\n {events.map((event) => {\n const role = ROLE_LABEL[event.actorRole] ?? ROLE_LABEL.system!;\n const who =\n event.actorRole === 'customer' && customerLabel\n ? customerLabel\n : tr(role.key, role.fallback);\n const label = EVENT_LABEL[event.kind];\n const to = event.toStatus ? STATUS_LABEL[event.toStatus] : null;\n return (\n <li key={event.id} className=\"rounded-lg border border-border-subtle bg-bg-surface p-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">\n {tr(label.key, label.fallback)}\n {to && event.kind !== 'CREATED' ? ` → ${tr(to.key, to.fallback)}` : ''}\n </span>\n <span>\n {who} · {formatDateTime(event.createdAt)}\n </span>\n </div>\n {event.message && (\n <p className=\"mt-1.5 whitespace-pre-wrap text-sm text-text-primary\">\n {event.message}\n </p>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n"],"mappings":";;;;;AAOA,IAAM,IAAgE;CACpE,UAAU;EAAE,KAAK;EAA8B,UAAU;CAAM;CAC/D,YAAY;EAAE,KAAK;EAAgC,UAAU;CAAmB;CAChF,QAAQ;EAAE,KAAK;EAA4B,UAAU;CAAiB;AACxE,GAEa,KAAsF,EACjG,WACA,uBACI;CACJ,IAAM,EAAE,sBAAmB,EAAc,GAEnC,IAAK,EAAM;CAEjB,OADI,EAAO,WAAW,IAAU,OAE9B,kBAAC,MAAD;EAAI,WAAU;EAAY,eAAY;YACnC,EAAO,KAAK,MAAU;GACrB,IAAM,IAAO,EAAW,EAAM,cAAc,EAAW,QACjD,IACJ,EAAM,cAAc,cAAc,IAC9B,IACA,EAAG,EAAK,KAAK,EAAK,QAAQ,GAC1B,IAAQ,EAAY,EAAM,OAC1B,IAAK,EAAM,WAAW,EAAa,EAAM,YAAY;GAC3D,OACE,kBAAC,MAAD;IAAmB,WAAU;cAA7B,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,EAAG,EAAM,KAAK,EAAM,QAAQ,GAC5B,KAAM,EAAM,SAAS,YAAY,MAAM,EAAG,EAAG,KAAK,EAAG,QAAQ,MAAM,EAChE;SACN,kBAAC,QAAD,EAAA,UAAA;MACG;MAAI;MAAI,EAAe,EAAM,SAAS;KACnC,EAAA,CAAA,CACH;QACJ,EAAM,WACL,kBAAC,KAAD;KAAG,WAAU;eACV,EAAM;IACN,CAAA,CAEH;MAfK,EAAM,EAeX;EAER,CAAC;CACC,CAAA;AAER"}
@@ -1 +1 @@
1
- {"version":3,"file":"OutcomeForm.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/negotiations/OutcomeForm.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EACV,cAAc,EAEd,gCAAgC,EACjC,MAAM,yBAAyB,CAAC;AAMjC,UAAU,gBAAgB;IACxB,WAAW,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,IAAI,CAAC;CAC7D;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAoH5C,CAAC"}
1
+ {"version":3,"file":"OutcomeForm.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/negotiations/OutcomeForm.tsx"],"names":[],"mappings":"AACA;;GAEG;AACH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EACV,cAAc,EAEd,gCAAgC,EACjC,MAAM,yBAAyB,CAAC;AAMjC,UAAU,gBAAgB;IACxB,WAAW,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,IAAI,CAAC;CAC7D;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAsH5C,CAAC"}