@burdenoff/microfe-subscriberbot 2026.1103.2 → 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 (198) 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/AgentNewPage.stories.d.ts.map +1 -1
  5. package/dist/stories/pages/BankConnectionsPage.stories.d.ts +1 -0
  6. package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -1
  7. package/dist/stories/pages/EnterpriseSpendPage.stories.d.ts.map +1 -1
  8. package/dist/stories/pages/InboxPage.stories.d.ts.map +1 -1
  9. package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +1 -1
  10. package/dist/subscriberbot/admin/AdminDashboardPage.js +168 -168
  11. package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
  12. package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts.map +1 -1
  13. package/dist/subscriberbot/admin/NegotiationDeskPanel.js +116 -116
  14. package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -1
  15. package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +1 -1
  16. package/dist/subscriberbot/admin/ProcurementDeskPanel.js +211 -211
  17. package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -1
  18. package/dist/subscriberbot/components/Modal.d.ts.map +1 -1
  19. package/dist/subscriberbot/components/Modal.js +43 -33
  20. package/dist/subscriberbot/components/Modal.js.map +1 -1
  21. package/dist/subscriberbot/components/PostureOptions.d.ts.map +1 -1
  22. package/dist/subscriberbot/components/PostureOptions.js +10 -10
  23. package/dist/subscriberbot/components/PostureOptions.js.map +1 -1
  24. package/dist/subscriberbot/components/StateViews.d.ts.map +1 -1
  25. package/dist/subscriberbot/components/StateViews.js +45 -37
  26. package/dist/subscriberbot/components/StateViews.js.map +1 -1
  27. package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
  28. package/dist/subscriberbot/components/StatusBadge.js +6 -6
  29. package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
  30. package/dist/subscriberbot/components/decisions/DecisionBanners.js +6 -6
  31. package/dist/subscriberbot/components/decisions/DecisionCard.d.ts.map +1 -1
  32. package/dist/subscriberbot/components/decisions/DecisionCard.js +149 -147
  33. package/dist/subscriberbot/components/decisions/DecisionCard.js.map +1 -1
  34. package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +1 -1
  35. package/dist/subscriberbot/components/mobile/MobileDashboard.js +127 -127
  36. package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -1
  37. package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts.map +1 -1
  38. package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +114 -114
  39. package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -1
  40. package/dist/subscriberbot/components/mobile/MobileScreen.js +1 -1
  41. package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
  42. package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +4 -4
  43. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts.map +1 -1
  44. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +11 -11
  45. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -1
  46. package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts.map +1 -1
  47. package/dist/subscriberbot/components/negotiations/OutcomeForm.js +29 -29
  48. package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -1
  49. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +1 -1
  50. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +43 -43
  51. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -1
  52. package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +4 -4
  53. package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +1 -1
  54. package/dist/subscriberbot/components/procurement/ProcurementThread.js +14 -14
  55. package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -1
  56. package/dist/subscriberbot/components/savings/SavingsCards.d.ts.map +1 -1
  57. package/dist/subscriberbot/components/savings/SavingsCards.js +242 -237
  58. package/dist/subscriberbot/components/savings/SavingsCards.js.map +1 -1
  59. package/dist/subscriberbot/components/viz.d.ts +1 -0
  60. package/dist/subscriberbot/components/viz.d.ts.map +1 -1
  61. package/dist/subscriberbot/components/viz.js +100 -101
  62. package/dist/subscriberbot/components/viz.js.map +1 -1
  63. package/dist/subscriberbot/hooks/index.js +1 -1
  64. package/dist/subscriberbot/hooks/useFormError.d.ts +7 -0
  65. package/dist/subscriberbot/hooks/useFormError.d.ts.map +1 -0
  66. package/dist/subscriberbot/hooks/useFormError.js +28 -0
  67. package/dist/subscriberbot/hooks/useFormError.js.map +1 -0
  68. package/dist/subscriberbot/hooks/useFormatters.d.ts +11 -0
  69. package/dist/subscriberbot/hooks/useFormatters.d.ts.map +1 -0
  70. package/dist/subscriberbot/hooks/useFormatters.js +13 -0
  71. package/dist/subscriberbot/hooks/useFormatters.js.map +1 -0
  72. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
  73. package/dist/subscriberbot/hooks/useSubscriberBotApi.js +371 -370
  74. package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
  75. package/dist/subscriberbot/hooks/useTr.d.ts.map +1 -1
  76. package/dist/subscriberbot/hooks/useTr.js +1 -1
  77. package/dist/subscriberbot/hooks/useTr.js.map +1 -1
  78. package/dist/subscriberbot/index.js +1 -1
  79. package/dist/subscriberbot/pages/AssetVaultPage.d.ts.map +1 -1
  80. package/dist/subscriberbot/pages/AssetVaultPage.js +124 -124
  81. package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
  82. package/dist/subscriberbot/pages/DashboardPage.d.ts +0 -10
  83. package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -1
  84. package/dist/subscriberbot/pages/DashboardPage.js +107 -98
  85. package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
  86. package/dist/subscriberbot/pages/InboxPage.d.ts +0 -10
  87. package/dist/subscriberbot/pages/InboxPage.d.ts.map +1 -1
  88. package/dist/subscriberbot/pages/InboxPage.js +421 -402
  89. package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
  90. package/dist/subscriberbot/pages/InsightsPage.d.ts.map +1 -1
  91. package/dist/subscriberbot/pages/InsightsPage.js +130 -121
  92. package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
  93. package/dist/subscriberbot/pages/InvoicesPage.d.ts +0 -12
  94. package/dist/subscriberbot/pages/InvoicesPage.d.ts.map +1 -1
  95. package/dist/subscriberbot/pages/InvoicesPage.js +237 -215
  96. package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
  97. package/dist/subscriberbot/pages/RenewalsPage.d.ts.map +1 -1
  98. package/dist/subscriberbot/pages/RenewalsPage.js +303 -295
  99. package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -1
  100. package/dist/subscriberbot/pages/SavingsPage.d.ts.map +1 -1
  101. package/dist/subscriberbot/pages/SavingsPage.js +57 -57
  102. package/dist/subscriberbot/pages/SavingsPage.js.map +1 -1
  103. package/dist/subscriberbot/pages/WorkflowsPage.d.ts +0 -13
  104. package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +1 -1
  105. package/dist/subscriberbot/pages/WorkflowsPage.js +202 -196
  106. package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
  107. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts +0 -18
  108. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +1 -1
  109. package/dist/subscriberbot/pages/agents/AgentDetailPage.js +283 -275
  110. package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
  111. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts +0 -6
  112. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +1 -1
  113. package/dist/subscriberbot/pages/agents/AgentNewPage.js +85 -77
  114. package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
  115. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts +0 -9
  116. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +1 -1
  117. package/dist/subscriberbot/pages/agents/AgentsListPage.js +136 -136
  118. package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
  119. package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +0 -9
  120. package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
  121. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +267 -260
  122. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
  123. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts +0 -10
  124. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts.map +1 -1
  125. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js +96 -96
  126. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js.map +1 -1
  127. package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts +0 -11
  128. package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts.map +1 -1
  129. package/dist/subscriberbot/pages/decisions/DecisionsPage.js +46 -46
  130. package/dist/subscriberbot/pages/decisions/DecisionsPage.js.map +1 -1
  131. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts +0 -11
  132. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts.map +1 -1
  133. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +181 -171
  134. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js.map +1 -1
  135. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts +0 -9
  136. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts.map +1 -1
  137. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +164 -164
  138. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -1
  139. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts +0 -9
  140. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts.map +1 -1
  141. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +197 -181
  142. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -1
  143. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts +0 -8
  144. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts.map +1 -1
  145. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +79 -79
  146. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -1
  147. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +0 -9
  148. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +1 -1
  149. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +147 -147
  150. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -1
  151. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +0 -10
  152. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +1 -1
  153. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +204 -188
  154. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -1
  155. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +0 -9
  156. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +1 -1
  157. package/dist/subscriberbot/pages/procurement/ProcurementPage.js +80 -80
  158. package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -1
  159. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts +0 -10
  160. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts.map +1 -1
  161. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +484 -458
  162. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
  163. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts +0 -8
  164. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts.map +1 -1
  165. package/dist/subscriberbot/pages/providers/ProviderNewPage.js +146 -136
  166. package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
  167. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts +0 -10
  168. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts.map +1 -1
  169. package/dist/subscriberbot/pages/providers/ProvidersListPage.js +88 -87
  170. package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
  171. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts +0 -11
  172. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
  173. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +520 -490
  174. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
  175. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts +0 -8
  176. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +1 -1
  177. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +104 -90
  178. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
  179. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts +0 -8
  180. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +1 -1
  181. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +97 -96
  182. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
  183. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.d.ts.map +1 -1
  184. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js +76 -74
  185. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js.map +1 -1
  186. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts +5 -3
  187. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts.map +1 -1
  188. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js +26 -25
  189. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js.map +1 -1
  190. package/dist/subscriberbot/utils/formatters.d.ts +16 -5
  191. package/dist/subscriberbot/utils/formatters.d.ts.map +1 -1
  192. package/dist/subscriberbot/utils/formatters.js +57 -25
  193. package/dist/subscriberbot/utils/formatters.js.map +1 -1
  194. package/dist/subscriberbot/utils/plaidLink.d.ts +2 -1
  195. package/dist/subscriberbot/utils/plaidLink.d.ts.map +1 -1
  196. package/dist/subscriberbot/utils/plaidLink.js +21 -21
  197. package/dist/subscriberbot/utils/plaidLink.js.map +1 -1
  198. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
- import { formatCurrency 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 { useState as n } from "react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  //#region src/subscriberbot/components/negotiations/OutcomeForm.tsx
6
6
  var a = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", o = "mb-1 block text-xs font-medium text-text-secondary", s = ({ negotiation: s, pending: c, error: l, submitLabel: u, onSubmit: d }) => {
7
- let f = t(), [p, m] = n("SUCCEEDED"), [h, g] = n(""), [_, v] = n(""), [y, b] = n(""), [x, S] = n(!!s.relationshipId);
7
+ let { formatCurrency: f } = t(), p = e(), [m, h] = n("SUCCEEDED"), [g, _] = n(""), [v, y] = n(""), [b, x] = n(""), [S, C] = n(!!s.relationshipId);
8
8
  return /* @__PURE__ */ i("form", {
9
9
  onSubmit: (e) => {
10
10
  e.preventDefault(), d({
11
- outcome: p,
12
- ...p === "SUCCEEDED" && h ? { newAmount: Number(h) } : {},
13
- ...p === "SUCCEEDED" && _ ? { oneTimeCredit: Number(_) } : {},
14
- ...y.trim() ? { summary: y.trim() } : {},
15
- ...p === "SUCCEEDED" && s.relationshipId ? { applyToRelationship: x } : {}
11
+ outcome: m,
12
+ ...m === "SUCCEEDED" && g ? { newAmount: Number(g) } : {},
13
+ ...m === "SUCCEEDED" && v ? { oneTimeCredit: Number(v) } : {},
14
+ ...b.trim() ? { summary: b.trim() } : {},
15
+ ...m === "SUCCEEDED" && s.relationshipId ? { applyToRelationship: S } : {}
16
16
  });
17
17
  },
18
18
  className: "space-y-3",
@@ -23,74 +23,74 @@ var a = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 t
23
23
  children: [
24
24
  /* @__PURE__ */ r("legend", {
25
25
  className: o,
26
- children: f("negotiations.outcome.result", "Result")
26
+ children: p("negotiations.outcome.result", "Result")
27
27
  }),
28
28
  /* @__PURE__ */ i("label", {
29
29
  className: "inline-flex items-center gap-2",
30
30
  children: [/* @__PURE__ */ r("input", {
31
31
  type: "radio",
32
32
  name: "outcome",
33
- checked: p === "SUCCEEDED",
34
- onChange: () => m("SUCCEEDED")
35
- }), f("negotiations.outcome.succeeded", "The bill was lowered or credited")]
33
+ checked: m === "SUCCEEDED",
34
+ onChange: () => h("SUCCEEDED")
35
+ }), p("negotiations.outcome.succeeded", "The bill was lowered or credited")]
36
36
  }),
37
37
  /* @__PURE__ */ i("label", {
38
38
  className: "inline-flex items-center gap-2",
39
39
  children: [/* @__PURE__ */ r("input", {
40
40
  type: "radio",
41
41
  name: "outcome",
42
- checked: p === "NO_SAVINGS",
43
- onChange: () => m("NO_SAVINGS")
44
- }), f("negotiations.outcome.noSavings", "No savings offered")]
42
+ checked: m === "NO_SAVINGS",
43
+ onChange: () => h("NO_SAVINGS")
44
+ }), p("negotiations.outcome.noSavings", "No savings offered")]
45
45
  })
46
46
  ]
47
47
  }),
48
- p === "SUCCEEDED" && /* @__PURE__ */ i("div", {
48
+ m === "SUCCEEDED" && /* @__PURE__ */ i("div", {
49
49
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
50
50
  children: [/* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
51
51
  htmlFor: "outcome-new-amount",
52
52
  className: o,
53
- children: f("negotiations.outcome.newAmount", "New price ({{current}} today)", { current: e(s.currentAmount, s.currency) })
53
+ children: p("negotiations.outcome.newAmount", "New price ({{current}} today)", { current: f(s.currentAmount, s.currency) })
54
54
  }), /* @__PURE__ */ r("input", {
55
55
  id: "outcome-new-amount",
56
56
  type: "number",
57
57
  min: "0",
58
58
  step: "0.01",
59
- value: h,
60
- onChange: (e) => g(e.target.value),
59
+ value: g,
60
+ onChange: (e) => _(e.target.value),
61
61
  className: a
62
62
  })] }), /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
63
63
  htmlFor: "outcome-credit",
64
64
  className: o,
65
- children: f("negotiations.outcome.credit", "One-off credit or refund")
65
+ children: p("negotiations.outcome.credit", "One-off credit or refund")
66
66
  }), /* @__PURE__ */ r("input", {
67
67
  id: "outcome-credit",
68
68
  type: "number",
69
69
  min: "0",
70
70
  step: "0.01",
71
- value: _,
72
- onChange: (e) => v(e.target.value),
71
+ value: v,
72
+ onChange: (e) => y(e.target.value),
73
73
  className: a
74
74
  })] })]
75
75
  }),
76
76
  /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
77
77
  htmlFor: "outcome-summary",
78
78
  className: o,
79
- children: f("negotiations.outcome.summary", "What was agreed")
79
+ children: p("negotiations.outcome.summary", "What was agreed")
80
80
  }), /* @__PURE__ */ r("textarea", {
81
81
  id: "outcome-summary",
82
82
  rows: 2,
83
- value: y,
84
- onChange: (e) => b(e.target.value),
83
+ value: b,
84
+ onChange: (e) => x(e.target.value),
85
85
  className: a
86
86
  })] }),
87
- p === "SUCCEEDED" && s.relationshipId && /* @__PURE__ */ i("label", {
87
+ m === "SUCCEEDED" && s.relationshipId && /* @__PURE__ */ i("label", {
88
88
  className: "inline-flex items-center gap-2 text-sm text-text-primary",
89
89
  children: [/* @__PURE__ */ r("input", {
90
90
  type: "checkbox",
91
- checked: x,
92
- onChange: (e) => S(e.target.checked)
93
- }), f("negotiations.outcome.apply", "Update the tracked subscription with the new price")]
91
+ checked: S,
92
+ onChange: (e) => C(e.target.checked)
93
+ }), p("negotiations.outcome.apply", "Update the tracked subscription with the new price")]
94
94
  }),
95
95
  l && /* @__PURE__ */ r("p", {
96
96
  role: "alert",
@@ -1 +1 @@
1
- {"version":3,"file":"OutcomeForm.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/OutcomeForm.tsx"],"sourcesContent":["/**\n * Outcome form shared by the customer (self-serve) and the negotiation desk.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { formatCurrency } from '../../utils/formatters';\nimport type {\n SubNegotiation,\n SubNegotiationOutcome,\n SubRecordNegotiationOutcomeInput,\n} from '../../types/negotiation';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface OutcomeFormProps {\n negotiation: SubNegotiation;\n pending: boolean;\n error?: string | null;\n submitLabel: string;\n onSubmit: (input: SubRecordNegotiationOutcomeInput) => void;\n}\n\nexport const OutcomeForm: FC<OutcomeFormProps> = ({\n negotiation,\n pending,\n error,\n submitLabel,\n onSubmit,\n}) => {\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubNegotiationOutcome>('SUCCEEDED');\n const [newAmount, setNewAmount] = useState('');\n const [credit, setCredit] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(negotiation.relationshipId));\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(outcome === 'SUCCEEDED' && newAmount ? { newAmount: Number(newAmount) } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: Number(credit) } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && negotiation.relationshipId\n ? { applyToRelationship: apply }\n : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"negotiation-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('negotiations.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('negotiations.outcome.succeeded', 'The bill was lowered or credited')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('negotiations.outcome.noSavings', 'No savings offered')}\n </label>\n </fieldset>\n {outcome === 'SUCCEEDED' && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"outcome-new-amount\" className={labelCls}>\n {tr('negotiations.outcome.newAmount', 'New price ({{current}} today)', {\n current: formatCurrency(negotiation.currentAmount, negotiation.currency),\n })}\n </label>\n <input\n id=\"outcome-new-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={newAmount}\n onChange={(e) => setNewAmount(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"outcome-credit\" className={labelCls}>\n {tr('negotiations.outcome.credit', 'One-off credit or refund')}\n </label>\n <input\n id=\"outcome-credit\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n )}\n <div>\n <label htmlFor=\"outcome-summary\" className={labelCls}>\n {tr('negotiations.outcome.summary', 'What was agreed')}\n </label>\n <textarea\n id=\"outcome-summary\"\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && negotiation.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('negotiations.outcome.apply', 'Update the tracked subscription with the new price')}\n </label>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {submitLabel}\n </button>\n </form>\n );\n};\n"],"mappings":";;;;;AAYA,IAAM,IACJ,wMACI,IAAW,sDAUJ,KAAqC,EAChD,gBACA,YACA,UACA,gBACA,kBACI;CACJ,IAAM,IAAK,EAAM,GACX,CAAC,GAAS,KAAc,EAAgC,WAAW,GACnE,CAAC,GAAW,KAAgB,EAAS,EAAE,GACvC,CAAC,GAAQ,KAAa,EAAS,EAAE,GACjC,CAAC,GAAS,KAAc,EAAS,EAAE,GACnC,CAAC,GAAO,KAAY,EAAS,EAAQ,EAAY,cAAe;CAetE,OACE,kBAAC,QAAD;EAAM,WAdc,MAAiB;GAErC,AADA,EAAE,eAAe,GACjB,EAAS;IACP;IACA,GAAI,MAAY,eAAe,IAAY,EAAE,WAAW,OAAO,CAAS,EAAE,IAAI,CAAC;IAC/E,GAAI,MAAY,eAAe,IAAS,EAAE,eAAe,OAAO,CAAM,EAAE,IAAI,CAAC;IAC7E,GAAI,EAAQ,KAAK,IAAI,EAAE,SAAS,EAAQ,KAAK,EAAE,IAAI,CAAC;IACpD,GAAI,MAAY,eAAe,EAAY,iBACvC,EAAE,qBAAqB,EAAM,IAC7B,CAAC;GACP,CAAC;EACH;EAGgC,WAAU;EA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AAA,GACP,kBAAC,YAAD;IACE,IAAG;IACH,MAAM;IACN,OAAO;IACP,WAAW,MAAM,EAAW,EAAE,OAAO,KAAK;IAC1C,WAAW;GACZ,CAAA,CACE,EAAA,CAAA;GACJ,MAAY,eAAe,EAAY,kBACtC,kBAAC,SAAD;IAAO,WAAU;cAAjB,CACE,kBAAC,SAAD;KAAO,MAAK;KAAW,SAAS;KAAO,WAAW,MAAM,EAAS,EAAE,OAAO,OAAO;IAAI,CAAA,GACpF,EAAG,8BAA8B,oDAAoD,CACjF;;GAER,KACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB;GACA,CAAA;GAEL,kBAAC,UAAD;IACE,MAAK;IACL,UAAU;IACV,WAAU;cAET;GACK,CAAA;EACJ;;AAEV"}
1
+ {"version":3,"file":"OutcomeForm.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/OutcomeForm.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Outcome form shared by the customer (self-serve) and the negotiation desk.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubNegotiation,\n SubNegotiationOutcome,\n SubRecordNegotiationOutcomeInput,\n} from '../../types/negotiation';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface OutcomeFormProps {\n negotiation: SubNegotiation;\n pending: boolean;\n error?: string | null;\n submitLabel: string;\n onSubmit: (input: SubRecordNegotiationOutcomeInput) => void;\n}\n\nexport const OutcomeForm: FC<OutcomeFormProps> = ({\n negotiation,\n pending,\n error,\n submitLabel,\n onSubmit,\n}) => {\n const { formatCurrency } = useFormatters();\n\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubNegotiationOutcome>('SUCCEEDED');\n const [newAmount, setNewAmount] = useState('');\n const [credit, setCredit] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(negotiation.relationshipId));\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(outcome === 'SUCCEEDED' && newAmount ? { newAmount: Number(newAmount) } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: Number(credit) } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && negotiation.relationshipId\n ? { applyToRelationship: apply }\n : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"negotiation-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('negotiations.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('negotiations.outcome.succeeded', 'The bill was lowered or credited')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('negotiations.outcome.noSavings', 'No savings offered')}\n </label>\n </fieldset>\n {outcome === 'SUCCEEDED' && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"outcome-new-amount\" className={labelCls}>\n {tr('negotiations.outcome.newAmount', 'New price ({{current}} today)', {\n current: formatCurrency(negotiation.currentAmount, negotiation.currency),\n })}\n </label>\n <input\n id=\"outcome-new-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={newAmount}\n onChange={(e) => setNewAmount(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"outcome-credit\" className={labelCls}>\n {tr('negotiations.outcome.credit', 'One-off credit or refund')}\n </label>\n <input\n id=\"outcome-credit\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n )}\n <div>\n <label htmlFor=\"outcome-summary\" className={labelCls}>\n {tr('negotiations.outcome.summary', 'What was agreed')}\n </label>\n <textarea\n id=\"outcome-summary\"\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && negotiation.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('negotiations.outcome.apply', 'Update the tracked subscription with the new price')}\n </label>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {submitLabel}\n </button>\n </form>\n );\n};\n"],"mappings":";;;;;AAaA,IAAM,IACJ,wMACI,IAAW,sDAUJ,KAAqC,EAChD,gBACA,YACA,UACA,gBACA,kBACI;CACJ,IAAM,EAAE,sBAAmB,EAAc,GAEnC,IAAK,EAAM,GACX,CAAC,GAAS,KAAc,EAAgC,WAAW,GACnE,CAAC,GAAW,KAAgB,EAAS,EAAE,GACvC,CAAC,GAAQ,KAAa,EAAS,EAAE,GACjC,CAAC,GAAS,KAAc,EAAS,EAAE,GACnC,CAAC,GAAO,KAAY,EAAS,EAAQ,EAAY,cAAe;CAetE,OACE,kBAAC,QAAD;EAAM,WAdc,MAAiB;GAErC,AADA,EAAE,eAAe,GACjB,EAAS;IACP;IACA,GAAI,MAAY,eAAe,IAAY,EAAE,WAAW,OAAO,CAAS,EAAE,IAAI,CAAC;IAC/E,GAAI,MAAY,eAAe,IAAS,EAAE,eAAe,OAAO,CAA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ACP,WAAW,MAAM,EAAU,EAAE,OAAO,KAAK;KACzC,WAAW;IACZ,CAAA,CACE,EAAA,CAAA,CACF;;GAEP,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;IAAO,SAAQ;IAAkB,WAAW;cACzC,EAAG,gCAAgC,iBAAiB;GAChD,CAAA,GACP,kBAAC,YAAD;IACE,IAAG;IACH,MAAM;IACN,OAAO;IACP,WAAW,MAAM,EAAW,EAAE,OAAO,KAAK;IAC1C,WAAW;GACZ,CAAA,CACE,EAAA,CAAA;GACJ,MAAY,eAAe,EAAY,kBACtC,kBAAC,SAAD;IAAO,WAAU;cAAjB,CACE,kBAAC,SAAD;KAAO,MAAK;KAAW,SAAS;KAAO,WAAW,MAAM,EAAS,EAAE,OAAO,OAAO;IAAI,CAAA,GACpF,EAAG,8BAA8B,oDAAoD,CACjF;;GAER,KACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB;GACA,CAAA;GAEL,kBAAC,UAAD;IACE,MAAK;IACL,UAAU;IACV,WAAU;cAET;GACK,CAAA;EACJ;;AAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProcurementOutcomeForm.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAEV,qBAAqB,EACrB,gCAAgC,EACjC,MAAM,yBAAyB,CAAC;AAMjC,UAAU,2BAA2B;IACnC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,IAAI,CAAC;CAC7D;AAcD,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAsKlE,CAAC"}
1
+ {"version":3,"file":"ProcurementOutcomeForm.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx"],"names":[],"mappings":"AACA;;;;GAIG;AACH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAEV,qBAAqB,EACrB,gCAAgC,EACjC,MAAM,yBAAyB,CAAC;AAMjC,UAAU,2BAA2B;IACnC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,IAAI,CAAC;CAC7D;AAcD,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAwKlE,CAAC"}
@@ -1,5 +1,5 @@
1
- import { formatCurrency 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 { useState as n } from "react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  //#region src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx
@@ -10,17 +10,17 @@ function s(e, t, n, r) {
10
10
  return Math.round((i * Math.min(12, Math.max(0, n)) / 12 + r) * 100) / 100;
11
11
  }
12
12
  var c = ({ request: c, pending: l, error: u, onSubmit: d }) => {
13
- let f = t(), [p, m] = n("SUCCEEDED"), [h, g] = n(""), [_, v] = n(String(c.termMonths)), [y, b] = n(""), [x, S] = n(""), [C, w] = n(""), [T, E] = n(!!c.relationshipId), D = Number(h), O = Number(_) || c.termMonths, k = Number(y) || 0, A = h ? s(c.baselineAnnualValue, D, O, k) : 0, j = Math.round(A * c.feeRate * 100) / 100;
13
+ let { formatCurrency: f } = t(), p = e(), [m, h] = n("SUCCEEDED"), [g, _] = n(""), [v, y] = n(String(c.termMonths)), [b, x] = n(""), [S, C] = n(""), [w, T] = n(""), [E, D] = n(!!c.relationshipId), O = Number(g), k = Number(v) || c.termMonths, A = Number(b) || 0, j = g ? s(c.baselineAnnualValue, O, k, A) : 0, M = Math.round(j * c.feeRate * 100) / 100;
14
14
  return /* @__PURE__ */ i("form", {
15
15
  onSubmit: (e) => {
16
16
  e.preventDefault(), d({
17
- outcome: p,
18
- ...h ? { finalAnnualValue: D } : {},
19
- ..._ ? { finalTermMonths: O } : {},
20
- ...p === "SUCCEEDED" && y ? { oneTimeCredit: k } : {},
21
- ...x.trim() ? { nonPriceWins: x.trim() } : {},
22
- ...C.trim() ? { summary: C.trim() } : {},
23
- ...p === "SUCCEEDED" && c.relationshipId ? { applyToRelationship: T } : {}
17
+ outcome: m,
18
+ ...g ? { finalAnnualValue: O } : {},
19
+ ...v ? { finalTermMonths: k } : {},
20
+ ...m === "SUCCEEDED" && b ? { oneTimeCredit: A } : {},
21
+ ...S.trim() ? { nonPriceWins: S.trim() } : {},
22
+ ...w.trim() ? { summary: w.trim() } : {},
23
+ ...m === "SUCCEEDED" && c.relationshipId ? { applyToRelationship: E } : {}
24
24
  });
25
25
  },
26
26
  className: "space-y-3",
@@ -31,25 +31,25 @@ var c = ({ request: c, pending: l, error: u, onSubmit: d }) => {
31
31
  children: [
32
32
  /* @__PURE__ */ r("legend", {
33
33
  className: o,
34
- children: f("procurement.outcome.result", "Result")
34
+ children: p("procurement.outcome.result", "Result")
35
35
  }),
36
36
  /* @__PURE__ */ i("label", {
37
37
  className: "inline-flex items-center gap-2",
38
38
  children: [/* @__PURE__ */ r("input", {
39
39
  type: "radio",
40
40
  name: `outcome-${c.id}`,
41
- checked: p === "SUCCEEDED",
42
- onChange: () => m("SUCCEEDED")
43
- }), f("procurement.outcome.succeeded", "Savings secured")]
41
+ checked: m === "SUCCEEDED",
42
+ onChange: () => h("SUCCEEDED")
43
+ }), p("procurement.outcome.succeeded", "Savings secured")]
44
44
  }),
45
45
  /* @__PURE__ */ i("label", {
46
46
  className: "inline-flex items-center gap-2",
47
47
  children: [/* @__PURE__ */ r("input", {
48
48
  type: "radio",
49
49
  name: `outcome-${c.id}`,
50
- checked: p === "NO_SAVINGS",
51
- onChange: () => m("NO_SAVINGS")
52
- }), f("procurement.outcome.noSavings", "No savings")]
50
+ checked: m === "NO_SAVINGS",
51
+ onChange: () => h("NO_SAVINGS")
52
+ }), p("procurement.outcome.noSavings", "No savings")]
53
53
  })
54
54
  ]
55
55
  }),
@@ -59,41 +59,41 @@ var c = ({ request: c, pending: l, error: u, onSubmit: d }) => {
59
59
  /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
60
60
  htmlFor: `final-${c.id}`,
61
61
  className: o,
62
- children: f("procurement.outcome.finalValue", "Final annual value ({{currency}})", { currency: c.currency })
62
+ children: p("procurement.outcome.finalValue", "Final annual value ({{currency}})", { currency: c.currency })
63
63
  }), /* @__PURE__ */ r("input", {
64
64
  id: `final-${c.id}`,
65
65
  type: "number",
66
66
  min: "0",
67
67
  step: "0.01",
68
- value: h,
69
- onChange: (e) => g(e.target.value),
68
+ value: g,
69
+ onChange: (e) => _(e.target.value),
70
70
  className: a
71
71
  })] }),
72
72
  /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
73
73
  htmlFor: `term-${c.id}`,
74
74
  className: o,
75
- children: f("procurement.outcome.finalTerm", "Final term (months)")
75
+ children: p("procurement.outcome.finalTerm", "Final term (months)")
76
76
  }), /* @__PURE__ */ r("input", {
77
77
  id: `term-${c.id}`,
78
78
  type: "number",
79
79
  min: "1",
80
80
  max: "60",
81
81
  step: "1",
82
- value: _,
83
- onChange: (e) => v(e.target.value),
82
+ value: v,
83
+ onChange: (e) => y(e.target.value),
84
84
  className: a
85
85
  })] }),
86
- p === "SUCCEEDED" && /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
86
+ m === "SUCCEEDED" && /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
87
87
  htmlFor: `credit-${c.id}`,
88
88
  className: o,
89
- children: f("procurement.outcome.credit", "One-off credit")
89
+ children: p("procurement.outcome.credit", "One-off credit")
90
90
  }), /* @__PURE__ */ r("input", {
91
91
  id: `credit-${c.id}`,
92
92
  type: "number",
93
93
  min: "0",
94
94
  step: "0.01",
95
- value: y,
96
- onChange: (e) => b(e.target.value),
95
+ value: b,
96
+ onChange: (e) => x(e.target.value),
97
97
  className: a
98
98
  })] })
99
99
  ]
@@ -101,38 +101,38 @@ var c = ({ request: c, pending: l, error: u, onSubmit: d }) => {
101
101
  /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
102
102
  htmlFor: `wins-${c.id}`,
103
103
  className: o,
104
- children: f("procurement.outcome.wins", "Non-price wins (price caps, extra seats, payment terms)")
104
+ children: p("procurement.outcome.wins", "Non-price wins (price caps, extra seats, payment terms)")
105
105
  }), /* @__PURE__ */ r("input", {
106
106
  id: `wins-${c.id}`,
107
- value: x,
108
- onChange: (e) => S(e.target.value),
107
+ value: S,
108
+ onChange: (e) => C(e.target.value),
109
109
  className: a
110
110
  })] }),
111
111
  /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("label", {
112
112
  htmlFor: `summary-${c.id}`,
113
113
  className: o,
114
- children: f("procurement.outcome.summary", "Summary for the customer")
114
+ children: p("procurement.outcome.summary", "Summary for the customer")
115
115
  }), /* @__PURE__ */ r("textarea", {
116
116
  id: `summary-${c.id}`,
117
117
  rows: 2,
118
- value: C,
119
- onChange: (e) => w(e.target.value),
118
+ value: w,
119
+ onChange: (e) => T(e.target.value),
120
120
  className: a
121
121
  })] }),
122
- p === "SUCCEEDED" && c.relationshipId && /* @__PURE__ */ i("label", {
122
+ m === "SUCCEEDED" && c.relationshipId && /* @__PURE__ */ i("label", {
123
123
  className: "inline-flex items-center gap-2 text-sm text-text-primary",
124
124
  children: [/* @__PURE__ */ r("input", {
125
125
  type: "checkbox",
126
- checked: T,
127
- onChange: (e) => E(e.target.checked)
128
- }), f("procurement.outcome.apply", "Update the tracked subscription to the new price")]
126
+ checked: E,
127
+ onChange: (e) => D(e.target.checked)
128
+ }), p("procurement.outcome.apply", "Update the tracked subscription to the new price")]
129
129
  }),
130
- p === "SUCCEEDED" && h && /* @__PURE__ */ r("p", {
130
+ m === "SUCCEEDED" && g && /* @__PURE__ */ r("p", {
131
131
  className: "text-xs text-text-secondary",
132
132
  "data-testid": "procurement-outcome-preview",
133
- children: f("procurement.outcome.preview", "First-year savings {{savings}} · success fee {{fee}}", {
134
- savings: e(A, c.currency),
135
- fee: e(j, c.currency)
133
+ children: p("procurement.outcome.preview", "First-year savings {{savings}} · success fee {{fee}}", {
134
+ savings: f(j, c.currency),
135
+ fee: f(M, c.currency)
136
136
  })
137
137
  }),
138
138
  u && /* @__PURE__ */ r("p", {
@@ -142,9 +142,9 @@ var c = ({ request: c, pending: l, error: u, onSubmit: d }) => {
142
142
  }),
143
143
  /* @__PURE__ */ r("button", {
144
144
  type: "submit",
145
- disabled: l || p === "SUCCEEDED" && !h,
145
+ disabled: l || m === "SUCCEEDED" && !g,
146
146
  className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50",
147
- children: f("procurement.outcome.save", "Save outcome and bill fee")
147
+ children: p("procurement.outcome.save", "Save outcome and bill fee")
148
148
  })
149
149
  ]
150
150
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ProcurementOutcomeForm.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx"],"sourcesContent":["/**\n * Outcome form used by the procurement desk to close a request (BOFF-4158).\n * Savings and the success fee are computed by the service from the baseline\n * (the vendor quote, else the current price); the form previews them.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { formatCurrency } from '../../utils/formatters';\nimport type {\n SubProcurementOutcome,\n SubProcurementRequest,\n SubRecordProcurementOutcomeInput,\n} from '../../types/procurement';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface ProcurementOutcomeFormProps {\n request: SubProcurementRequest;\n pending: boolean;\n error?: string | null;\n onSubmit: (input: SubRecordProcurementOutcomeInput) => void;\n}\n\n/** First-year savings preview, mirroring the service maths. */\nfunction previewSavings(\n baseline: number | null,\n finalValue: number,\n termMonths: number,\n credit: number\n): number {\n if (baseline == null || !Number.isFinite(finalValue)) return 0;\n const annual = Math.max(0, baseline - finalValue);\n return Math.round(((annual * Math.min(12, Math.max(0, termMonths))) / 12 + credit) * 100) / 100;\n}\n\nexport const ProcurementOutcomeForm: FC<ProcurementOutcomeFormProps> = ({\n request,\n pending,\n error,\n onSubmit,\n}) => {\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubProcurementOutcome>('SUCCEEDED');\n const [finalValue, setFinalValue] = useState('');\n const [finalTerm, setFinalTerm] = useState(String(request.termMonths));\n const [credit, setCredit] = useState('');\n const [wins, setWins] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(request.relationshipId));\n\n const finalNumber = Number(finalValue);\n const termNumber = Number(finalTerm) || request.termMonths;\n const creditNumber = Number(credit) || 0;\n const firstYear = finalValue\n ? previewSavings(request.baselineAnnualValue, finalNumber, termNumber, creditNumber)\n : 0;\n const fee = Math.round(firstYear * request.feeRate * 100) / 100;\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(finalValue ? { finalAnnualValue: finalNumber } : {}),\n ...(finalTerm ? { finalTermMonths: termNumber } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: creditNumber } : {}),\n ...(wins.trim() ? { nonPriceWins: wins.trim() } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && request.relationshipId ? { applyToRelationship: apply } : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"procurement-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('procurement.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('procurement.outcome.succeeded', 'Savings secured')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('procurement.outcome.noSavings', 'No savings')}\n </label>\n </fieldset>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <div>\n <label htmlFor={`final-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalValue', 'Final annual value ({{currency}})', {\n currency: request.currency,\n })}\n </label>\n <input\n id={`final-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={finalValue}\n onChange={(e) => setFinalValue(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`term-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalTerm', 'Final term (months)')}\n </label>\n <input\n id={`term-${request.id}`}\n type=\"number\"\n min=\"1\"\n max=\"60\"\n step=\"1\"\n value={finalTerm}\n onChange={(e) => setFinalTerm(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && (\n <div>\n <label htmlFor={`credit-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.credit', 'One-off credit')}\n </label>\n <input\n id={`credit-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n )}\n </div>\n <div>\n <label htmlFor={`wins-${request.id}`} className={labelCls}>\n {tr(\n 'procurement.outcome.wins',\n 'Non-price wins (price caps, extra seats, payment terms)'\n )}\n </label>\n <input\n id={`wins-${request.id}`}\n value={wins}\n onChange={(e) => setWins(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`summary-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.summary', 'Summary for the customer')}\n </label>\n <textarea\n id={`summary-${request.id}`}\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && request.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('procurement.outcome.apply', 'Update the tracked subscription to the new price')}\n </label>\n )}\n {outcome === 'SUCCEEDED' && finalValue && (\n <p className=\"text-xs text-text-secondary\" data-testid=\"procurement-outcome-preview\">\n {tr(\n 'procurement.outcome.preview',\n 'First-year savings {{savings}} · success fee {{fee}}',\n {\n savings: formatCurrency(firstYear, request.currency),\n fee: formatCurrency(fee, request.currency),\n }\n )}\n </p>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending || (outcome === 'SUCCEEDED' && !finalValue)}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {tr('procurement.outcome.save', 'Save outcome and bill fee')}\n </button>\n </form>\n );\n};\n"],"mappings":";;;;;AAcA,IAAM,IACJ,wMACI,IAAW;AAUjB,SAAS,EACP,GACA,GACA,GACA,GACQ;CACR,IAAI,KAAY,QAAQ,CAAC,OAAO,SAAS,CAAU,GAAG,OAAO;CAC7D,IAAM,IAAS,KAAK,IAAI,GAAG,IAAW,CAAU;CAChD,OAAO,KAAK,OAAQ,IAAS,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,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,2BAA2B;GACrD,CAAA;EACJ;;AAEV"}
1
+ {"version":3,"file":"ProcurementOutcomeForm.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Outcome form used by the procurement desk to close a request (BOFF-4158).\n * Savings and the success fee are computed by the service from the baseline\n * (the vendor quote, else the current price); the form previews them.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubProcurementOutcome,\n SubProcurementRequest,\n SubRecordProcurementOutcomeInput,\n} from '../../types/procurement';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface ProcurementOutcomeFormProps {\n request: SubProcurementRequest;\n pending: boolean;\n error?: string | null;\n onSubmit: (input: SubRecordProcurementOutcomeInput) => void;\n}\n\n/** First-year savings preview, mirroring the service maths. */\nfunction previewSavings(\n baseline: number | null,\n finalValue: number,\n termMonths: number,\n credit: number\n): number {\n if (baseline == null || !Number.isFinite(finalValue)) return 0;\n const annual = Math.max(0, baseline - finalValue);\n return Math.round(((annual * Math.min(12, Math.max(0, termMonths))) / 12 + credit) * 100) / 100;\n}\n\nexport const ProcurementOutcomeForm: FC<ProcurementOutcomeFormProps> = ({\n request,\n pending,\n error,\n onSubmit,\n}) => {\n const { formatCurrency } = useFormatters();\n\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubProcurementOutcome>('SUCCEEDED');\n const [finalValue, setFinalValue] = useState('');\n const [finalTerm, setFinalTerm] = useState(String(request.termMonths));\n const [credit, setCredit] = useState('');\n const [wins, setWins] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(request.relationshipId));\n\n const finalNumber = Number(finalValue);\n const termNumber = Number(finalTerm) || request.termMonths;\n const creditNumber = Number(credit) || 0;\n const firstYear = finalValue\n ? previewSavings(request.baselineAnnualValue, finalNumber, termNumber, creditNumber)\n : 0;\n const fee = Math.round(firstYear * request.feeRate * 100) / 100;\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(finalValue ? { finalAnnualValue: finalNumber } : {}),\n ...(finalTerm ? { finalTermMonths: termNumber } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: creditNumber } : {}),\n ...(wins.trim() ? { nonPriceWins: wins.trim() } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && request.relationshipId ? { applyToRelationship: apply } : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"procurement-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('procurement.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('procurement.outcome.succeeded', 'Savings secured')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('procurement.outcome.noSavings', 'No savings')}\n </label>\n </fieldset>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <div>\n <label htmlFor={`final-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalValue', 'Final annual value ({{currency}})', {\n currency: request.currency,\n })}\n </label>\n <input\n id={`final-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={finalValue}\n onChange={(e) => setFinalValue(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`term-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalTerm', 'Final term (months)')}\n </label>\n <input\n id={`term-${request.id}`}\n type=\"number\"\n min=\"1\"\n max=\"60\"\n step=\"1\"\n value={finalTerm}\n onChange={(e) => setFinalTerm(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && (\n <div>\n <label htmlFor={`credit-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.credit', 'One-off credit')}\n </label>\n <input\n id={`credit-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n )}\n </div>\n <div>\n <label htmlFor={`wins-${request.id}`} className={labelCls}>\n {tr(\n 'procurement.outcome.wins',\n 'Non-price wins (price caps, extra seats, payment terms)'\n )}\n </label>\n <input\n id={`wins-${request.id}`}\n value={wins}\n onChange={(e) => setWins(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`summary-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.summary', 'Summary for the customer')}\n </label>\n <textarea\n id={`summary-${request.id}`}\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && request.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('procurement.outcome.apply', 'Update the tracked subscription to the new price')}\n </label>\n )}\n {outcome === 'SUCCEEDED' && finalValue && (\n <p className=\"text-xs text-text-secondary\" data-testid=\"procurement-outcome-preview\">\n {tr(\n 'procurement.outcome.preview',\n 'First-year savings {{savings}} · success fee {{fee}}',\n {\n savings: formatCurrency(firstYear, request.currency),\n fee: formatCurrency(fee, request.currency),\n }\n )}\n </p>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending || (outcome === 'SUCCEEDED' && !finalValue)}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {tr('procurement.outcome.save', 'Save outcome and bill fee')}\n </button>\n </form>\n );\n};\n"],"mappings":";;;;;AAeA,IAAM,IACJ,wMACI,IAAW;AAUjB,SAAS,EACP,GACA,GACA,GACA,GACQ;CACR,IAAI,KAAY,QAAQ,CAAC,OAAO,SAAS,CAAU,GAAG,OAAO;CAC7D,IAAM,IAAS,KAAK,IAAI,GAAG,IAAW,CAAU;CAChD,OAAO,KAAK,OAAQ,IAAS,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,CAAU,CAAC,IAAK,KAAK,KAAU,GAAG,IAAI;AAC9F;AAEA,IAAa,KAA2D,EACtE,YACA,YACA,UACA,kBACI;CACJ,IAAM,EAAE,sBAAmB,EAAc,GAEnC,IAAK,EAAM,GACX,CAAC,GAAS,KAAc,EAAgC,WAAW,GACnE,CAAC,GAAY,KAAiB,EAAS,EAAE,GACzC,CAAC,GAAW,KAAgB,EAAS,OAAO,EAAQ,UAAU,CAAC,GAC/D,CAAC,GAAQ,KAAa,EAAS,EAAE,GACjC,CAAC,GAAM,KAAW,EAAS,EAAE,GAC7B,CAAC,GAAS,KAAc,EAAS,EAAE,GACnC,CAAC,GAAO,KAAY,EAAS,EAAQ,EAAQ,cAAe,GAE5D,IAAc,OAAO,CAAU,GAC/B,IAAa,OAAO,CAAS,KAAK,EAAQ,YAC1C,IAAe,OAAO,CAAM,KAAK,GACjC,IAAY,IACd,EAAe,EAAQ,qBAAqB,GAAa,GAAY,CAAY,IACjF,GACE,IAAM,KAAK,MAAM,IAAY,EAAQ,UAAU,GAAG,IAAI;CAe5D,OACE,kBAAC,QAAD;EAAM,WAdc,MAAiB;GAErC,AADA,EAAE,eAAe,GACjB,EAAS;IACP;IACA,GAAI,IAAa,EAAE,kBAAkB,EAAY,IAAI,CAAC;IACtD,GAAI,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;KAAO,MAAK;KAAW,SAAS;KAAO,WAAW,MAAM,EAAS,EAAE,OAAO,OAAO;IAAI,CAAA,GACpF,EAAG,6BAA6B,kDAAkD,CAC9E;;GAER,MAAY,eAAe,KAC1B,kBAAC,KAAD;IAAG,WAAU;IAA8B,eAAY;cACpD,EACC,+BACA,wDACA;KACE,SAAS,EAAe,GAAW,EAAQ,QAAQ;KACnD,KAAK,EAAe,GAAK,EAAQ,QAAQ;IAC3C,CACF;GACC,CAAA;GAEJ,KACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB;GACA,CAAA;GAEL,kBAAC,UAAD;IACE,MAAK;IACL,UAAU,KAAY,MAAY,eAAe,CAAC;IAClD,WAAU;cAET,EAAG,4BAA4B,2BAA2B;GACrD,CAAA;EACJ;;AAEV"}
@@ -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, procurementStatusTone as r } from "./labels.js";
4
4
  import { jsx as i } from "react/jsx-runtime";
5
5
  //#region src/subscriberbot/components/procurement/ProcurementStatusPill.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": "procurement-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":"ProcurementThread.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/procurement/ProcurementThread.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AASnE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAgD3F,CAAC"}
1
+ {"version":3,"file":"ProcurementThread.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/procurement/ProcurementThread.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AASnE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAkD3F,CAAC"}
@@ -1,6 +1,6 @@
1
- import { cn as e } from "../../utils/cn.js";
2
- import { formatDateTime as t } from "../../utils/formatters.js";
3
- import { useTr as n } from "../../hooks/useTr.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";
4
4
  import { EVENT_LABEL as r, STATUS_LABEL as i } from "./labels.js";
5
5
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
6
  //#region src/subscriberbot/components/procurement/ProcurementThread.tsx
@@ -18,30 +18,30 @@ var s = {
18
18
  fallback: "Subscriber Bot"
19
19
  }
20
20
  }, c = ({ events: c, customerLabel: l }) => {
21
- let u = n();
21
+ let { formatDateTime: u } = t(), d = e();
22
22
  return c.length === 0 ? null : /* @__PURE__ */ a("ol", {
23
23
  className: "space-y-3",
24
24
  "data-testid": "procurement-thread",
25
- children: c.map((n) => {
26
- let c = s[n.actorRole] ?? s.system, d = n.actorRole === "customer" && l ? l : u(c.key, c.fallback), f = r[n.kind], p = n.toStatus ? i[n.toStatus] : null;
25
+ children: c.map((e) => {
26
+ let t = s[e.actorRole] ?? s.system, c = e.actorRole === "customer" && l ? l : d(t.key, t.fallback), f = r[e.kind], p = e.toStatus ? i[e.toStatus] : null;
27
27
  return /* @__PURE__ */ o("li", {
28
- "data-kind": n.kind,
29
- className: e("rounded-lg border p-3", n.internal ? "border-status-warning-text/30 bg-status-warning-bg-subtle" : "border-border-subtle bg-bg-surface"),
28
+ "data-kind": e.kind,
29
+ className: n("rounded-lg border p-3", e.internal ? "border-status-warning-text/30 bg-status-warning-bg-subtle" : "border-border-subtle bg-bg-surface"),
30
30
  children: [/* @__PURE__ */ o("div", {
31
31
  className: "flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary",
32
32
  children: [/* @__PURE__ */ o("span", {
33
33
  className: "font-medium text-text-primary",
34
- children: [u(f.key, f.fallback), p && n.kind !== "CREATED" && n.fromStatus !== n.toStatus ? ` → ${u(p.key, p.fallback)}` : ""]
34
+ children: [d(f.key, f.fallback), p && e.kind !== "CREATED" && e.fromStatus !== e.toStatus ? ` → ${d(p.key, p.fallback)}` : ""]
35
35
  }), /* @__PURE__ */ o("span", { children: [
36
- d,
36
+ c,
37
37
  " · ",
38
- t(n.createdAt)
38
+ u(e.createdAt)
39
39
  ] })]
40
- }), n.message && /* @__PURE__ */ a("p", {
40
+ }), e.message && /* @__PURE__ */ a("p", {
41
41
  className: "mt-1.5 whitespace-pre-wrap text-sm text-text-primary",
42
- children: n.message
42
+ children: e.message
43
43
  })]
44
- }, n.id);
44
+ }, e.id);
45
45
  })
46
46
  });
47
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ProcurementThread.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementThread.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatDateTime } from '../../utils/formatters';\nimport type { SubProcurementEvent } from '../../types/procurement';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'procurement.role.customer', fallback: 'You' },\n expert: { key: 'procurement.role.expert', fallback: 'Procurement expert' },\n system: { key: 'procurement.role.system', fallback: 'Subscriber Bot' },\n};\n\n/**\n * The request's message thread and timeline, oldest first. Internal desk notes\n * only ever reach the desk (the API filters them for customers); they are\n * highlighted so an expert never mistakes one for a customer-visible message.\n */\nexport const ProcurementThread: FC<{ events: SubProcurementEvent[]; 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=\"procurement-thread\">\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\n key={event.id}\n data-kind={event.kind}\n className={cn(\n 'rounded-lg border p-3',\n event.internal\n ? 'border-status-warning-text/30 bg-status-warning-bg-subtle'\n : 'border-border-subtle bg-bg-surface'\n )}\n >\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' && event.fromStatus !== event.toStatus\n ? ` → ${tr(to.key, to.fallback)}`\n : ''}\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;EAA6B,UAAU;CAAM;CAC9D,QAAQ;EAAE,KAAK;EAA2B,UAAU;CAAqB;CACzE,QAAQ;EAAE,KAAK;EAA2B,UAAU;CAAiB;AACvE,GAOa,KAAoF,EAC/F,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;IAEE,aAAW,EAAM;IACjB,WAAW,EACT,yBACA,EAAM,WACF,8DACA,oCACN;cARF,CAUE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,EAAG,EAAM,KAAK,EAAM,QAAQ,GAC5B,KAAM,EAAM,SAAS,aAAa,EAAM,eAAe,EAAM,WAC1D,MAAM,EAAG,EAAG,KAAK,EAAG,QAAQ,MAC5B,EACA;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;MAzBG,EAAM,EAyBT;EAER,CAAC;CACC,CAAA;AAER"}
1
+ {"version":3,"file":"ProcurementThread.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementThread.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport type { SubProcurementEvent } from '../../types/procurement';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'procurement.role.customer', fallback: 'You' },\n expert: { key: 'procurement.role.expert', fallback: 'Procurement expert' },\n system: { key: 'procurement.role.system', fallback: 'Subscriber Bot' },\n};\n\n/**\n * The request's message thread and timeline, oldest first. Internal desk notes\n * only ever reach the desk (the API filters them for customers); they are\n * highlighted so an expert never mistakes one for a customer-visible message.\n */\nexport const ProcurementThread: FC<{ events: SubProcurementEvent[]; 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=\"procurement-thread\">\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\n key={event.id}\n data-kind={event.kind}\n className={cn(\n 'rounded-lg border p-3',\n event.internal\n ? 'border-status-warning-text/30 bg-status-warning-bg-subtle'\n : 'border-border-subtle bg-bg-surface'\n )}\n >\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' && event.fromStatus !== event.toStatus\n ? ` → ${tr(to.key, to.fallback)}`\n : ''}\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":";;;;;;AAQA,IAAM,IAAgE;CACpE,UAAU;EAAE,KAAK;EAA6B,UAAU;CAAM;CAC9D,QAAQ;EAAE,KAAK;EAA2B,UAAU;CAAqB;CACzE,QAAQ;EAAE,KAAK;EAA2B,UAAU;CAAiB;AACvE,GAOa,KAAoF,EAC/F,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;IAEE,aAAW,EAAM;IACjB,WAAW,EACT,yBACA,EAAM,WACF,8DACA,oCACN;cARF,CAUE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,EAAG,EAAM,KAAK,EAAM,QAAQ,GAC5B,KAAM,EAAM,SAAS,aAAa,EAAM,eAAe,EAAM,WAC1D,MAAM,EAAG,EAAG,KAAK,EAAG,QAAQ,MAC5B,EACA;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;MAzBG,EAAM,EAyBT;EAER,CAAC;CACC,CAAA;AAER"}
@@ -1 +1 @@
1
- {"version":3,"file":"SavingsCards.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/savings/SavingsCards.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AA6B1D,OAAO,KAAK,EAEV,UAAU,EAEV,sBAAsB,EACtB,WAAW,EACZ,MAAM,aAAa,CAAC;AA8BrB,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,WAAW,CAAA;CAAE,CA0HrD,CAAC;AAySF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC3D,CAoIA,CAAC"}
1
+ {"version":3,"file":"SavingsCards.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/savings/SavingsCards.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AA6B1D,OAAO,KAAK,EAEV,UAAU,EAEV,sBAAsB,EACtB,WAAW,EACZ,MAAM,aAAa,CAAC;AA0BrB,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,WAAW,CAAA;CAAE,CA4HrD,CAAC;AAyTF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC3D,CAsIA,CAAC"}