@burdenoff/microfe-subscriberbot 2026.1103.2 → 2026.1105.2

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 (206) 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/DashboardPage.stories.d.ts.map +1 -1
  8. package/dist/stories/pages/EnterpriseSpendPage.stories.d.ts.map +1 -1
  9. package/dist/stories/pages/InboxPage.stories.d.ts.map +1 -1
  10. package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +1 -1
  11. package/dist/subscriberbot/admin/AdminDashboardPage.js +168 -168
  12. package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
  13. package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts.map +1 -1
  14. package/dist/subscriberbot/admin/NegotiationDeskPanel.js +116 -116
  15. package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -1
  16. package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +1 -1
  17. package/dist/subscriberbot/admin/ProcurementDeskPanel.js +211 -211
  18. package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -1
  19. package/dist/subscriberbot/components/Modal.d.ts.map +1 -1
  20. package/dist/subscriberbot/components/Modal.js +43 -33
  21. package/dist/subscriberbot/components/Modal.js.map +1 -1
  22. package/dist/subscriberbot/components/PageLayout.d.ts +6 -0
  23. package/dist/subscriberbot/components/PageLayout.d.ts.map +1 -1
  24. package/dist/subscriberbot/components/PageLayout.js +2 -1
  25. package/dist/subscriberbot/components/PageLayout.js.map +1 -1
  26. package/dist/subscriberbot/components/PostureOptions.d.ts.map +1 -1
  27. package/dist/subscriberbot/components/PostureOptions.js +10 -10
  28. package/dist/subscriberbot/components/PostureOptions.js.map +1 -1
  29. package/dist/subscriberbot/components/StateViews.d.ts +2 -0
  30. package/dist/subscriberbot/components/StateViews.d.ts.map +1 -1
  31. package/dist/subscriberbot/components/StateViews.js +46 -37
  32. package/dist/subscriberbot/components/StateViews.js.map +1 -1
  33. package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
  34. package/dist/subscriberbot/components/StatusBadge.js +6 -6
  35. package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
  36. package/dist/subscriberbot/components/decisions/DecisionBanners.js +6 -6
  37. package/dist/subscriberbot/components/decisions/DecisionCard.d.ts.map +1 -1
  38. package/dist/subscriberbot/components/decisions/DecisionCard.js +149 -147
  39. package/dist/subscriberbot/components/decisions/DecisionCard.js.map +1 -1
  40. package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +1 -1
  41. package/dist/subscriberbot/components/mobile/MobileDashboard.js +143 -135
  42. package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -1
  43. package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts.map +1 -1
  44. package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +114 -114
  45. package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -1
  46. package/dist/subscriberbot/components/mobile/MobileScreen.d.ts +3 -0
  47. package/dist/subscriberbot/components/mobile/MobileScreen.d.ts.map +1 -1
  48. package/dist/subscriberbot/components/mobile/MobileScreen.js +5 -3
  49. package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
  50. package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +4 -4
  51. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts.map +1 -1
  52. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +11 -11
  53. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -1
  54. package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts.map +1 -1
  55. package/dist/subscriberbot/components/negotiations/OutcomeForm.js +29 -29
  56. package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -1
  57. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +1 -1
  58. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +43 -43
  59. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -1
  60. package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +4 -4
  61. package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +1 -1
  62. package/dist/subscriberbot/components/procurement/ProcurementThread.js +14 -14
  63. package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -1
  64. package/dist/subscriberbot/components/savings/SavingsCards.d.ts.map +1 -1
  65. package/dist/subscriberbot/components/savings/SavingsCards.js +242 -237
  66. package/dist/subscriberbot/components/savings/SavingsCards.js.map +1 -1
  67. package/dist/subscriberbot/components/viz.d.ts +1 -0
  68. package/dist/subscriberbot/components/viz.d.ts.map +1 -1
  69. package/dist/subscriberbot/components/viz.js +100 -101
  70. package/dist/subscriberbot/components/viz.js.map +1 -1
  71. package/dist/subscriberbot/hooks/index.js +1 -1
  72. package/dist/subscriberbot/hooks/useFormError.d.ts +7 -0
  73. package/dist/subscriberbot/hooks/useFormError.d.ts.map +1 -0
  74. package/dist/subscriberbot/hooks/useFormError.js +28 -0
  75. package/dist/subscriberbot/hooks/useFormError.js.map +1 -0
  76. package/dist/subscriberbot/hooks/useFormatters.d.ts +11 -0
  77. package/dist/subscriberbot/hooks/useFormatters.d.ts.map +1 -0
  78. package/dist/subscriberbot/hooks/useFormatters.js +13 -0
  79. package/dist/subscriberbot/hooks/useFormatters.js.map +1 -0
  80. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
  81. package/dist/subscriberbot/hooks/useSubscriberBotApi.js +371 -370
  82. package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
  83. package/dist/subscriberbot/hooks/useTr.d.ts.map +1 -1
  84. package/dist/subscriberbot/hooks/useTr.js +1 -1
  85. package/dist/subscriberbot/hooks/useTr.js.map +1 -1
  86. package/dist/subscriberbot/index.js +1 -1
  87. package/dist/subscriberbot/pages/AssetVaultPage.d.ts.map +1 -1
  88. package/dist/subscriberbot/pages/AssetVaultPage.js +124 -124
  89. package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
  90. package/dist/subscriberbot/pages/DashboardPage.d.ts +0 -10
  91. package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -1
  92. package/dist/subscriberbot/pages/DashboardPage.js +115 -98
  93. package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
  94. package/dist/subscriberbot/pages/InboxPage.d.ts +0 -10
  95. package/dist/subscriberbot/pages/InboxPage.d.ts.map +1 -1
  96. package/dist/subscriberbot/pages/InboxPage.js +421 -402
  97. package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
  98. package/dist/subscriberbot/pages/InsightsPage.d.ts.map +1 -1
  99. package/dist/subscriberbot/pages/InsightsPage.js +130 -121
  100. package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
  101. package/dist/subscriberbot/pages/InvoicesPage.d.ts +0 -12
  102. package/dist/subscriberbot/pages/InvoicesPage.d.ts.map +1 -1
  103. package/dist/subscriberbot/pages/InvoicesPage.js +237 -215
  104. package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
  105. package/dist/subscriberbot/pages/RenewalsPage.d.ts.map +1 -1
  106. package/dist/subscriberbot/pages/RenewalsPage.js +303 -295
  107. package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -1
  108. package/dist/subscriberbot/pages/SavingsPage.d.ts.map +1 -1
  109. package/dist/subscriberbot/pages/SavingsPage.js +57 -57
  110. package/dist/subscriberbot/pages/SavingsPage.js.map +1 -1
  111. package/dist/subscriberbot/pages/WorkflowsPage.d.ts +0 -13
  112. package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +1 -1
  113. package/dist/subscriberbot/pages/WorkflowsPage.js +202 -196
  114. package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
  115. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts +0 -18
  116. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +1 -1
  117. package/dist/subscriberbot/pages/agents/AgentDetailPage.js +283 -275
  118. package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
  119. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts +0 -6
  120. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +1 -1
  121. package/dist/subscriberbot/pages/agents/AgentNewPage.js +85 -77
  122. package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
  123. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts +0 -9
  124. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +1 -1
  125. package/dist/subscriberbot/pages/agents/AgentsListPage.js +136 -136
  126. package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
  127. package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +0 -9
  128. package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
  129. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +272 -260
  130. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
  131. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts +0 -10
  132. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts.map +1 -1
  133. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js +96 -96
  134. package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js.map +1 -1
  135. package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts +0 -11
  136. package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts.map +1 -1
  137. package/dist/subscriberbot/pages/decisions/DecisionsPage.js +46 -46
  138. package/dist/subscriberbot/pages/decisions/DecisionsPage.js.map +1 -1
  139. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts +0 -11
  140. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts.map +1 -1
  141. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +181 -171
  142. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js.map +1 -1
  143. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts +0 -9
  144. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts.map +1 -1
  145. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +164 -164
  146. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -1
  147. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts +0 -9
  148. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts.map +1 -1
  149. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +197 -181
  150. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -1
  151. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts +0 -8
  152. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts.map +1 -1
  153. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +79 -79
  154. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -1
  155. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +0 -9
  156. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +1 -1
  157. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +147 -147
  158. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -1
  159. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +0 -10
  160. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +1 -1
  161. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +204 -188
  162. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -1
  163. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +0 -9
  164. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +1 -1
  165. package/dist/subscriberbot/pages/procurement/ProcurementPage.js +80 -80
  166. package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -1
  167. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts +0 -10
  168. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts.map +1 -1
  169. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +484 -458
  170. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
  171. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts +0 -8
  172. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts.map +1 -1
  173. package/dist/subscriberbot/pages/providers/ProviderNewPage.js +146 -136
  174. package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
  175. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts +0 -10
  176. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts.map +1 -1
  177. package/dist/subscriberbot/pages/providers/ProvidersListPage.js +88 -87
  178. package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
  179. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts +0 -11
  180. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
  181. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +520 -490
  182. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
  183. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts +0 -8
  184. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +1 -1
  185. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +112 -91
  186. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
  187. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts +0 -8
  188. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +1 -1
  189. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +97 -96
  190. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
  191. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.d.ts.map +1 -1
  192. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js +76 -74
  193. package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js.map +1 -1
  194. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts +5 -3
  195. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts.map +1 -1
  196. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js +26 -25
  197. package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js.map +1 -1
  198. package/dist/subscriberbot/utils/formatters.d.ts +16 -5
  199. package/dist/subscriberbot/utils/formatters.d.ts.map +1 -1
  200. package/dist/subscriberbot/utils/formatters.js +57 -25
  201. package/dist/subscriberbot/utils/formatters.js.map +1 -1
  202. package/dist/subscriberbot/utils/plaidLink.d.ts +2 -1
  203. package/dist/subscriberbot/utils/plaidLink.d.ts.map +1 -1
  204. package/dist/subscriberbot/utils/plaidLink.js +21 -21
  205. package/dist/subscriberbot/utils/plaidLink.js.map +1 -1
  206. package/package.json +1 -1
@@ -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 /** Product-tour prefix; the header renders `{dataTour}-header`. */\n dataTour?: string;\n}\n\nexport const MobileScreen: FC<MobileScreenProps> = ({\n title,\n eyebrow,\n hero,\n action,\n children,\n className,\n testId,\n dataTour,\n}) => (\n <div className={cn('flex min-h-full flex-col', className)} data-testid={testId}>\n <header\n className=\"bg-action-primary-bg px-4 pb-10 pt-5 text-action-primary-text\"\n data-tour={dataTour ? `${dataTour}-header` : undefined}\n >\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 dataTour?: string;\n}\n\n/** A titled group on the mobile sheet (\"Upcoming renewals\", \"Needs action\"). */\nexport const MobileSection: FC<MobileSectionProps> = ({\n title,\n action,\n children,\n className,\n dataTour,\n}) => (\n <section className={cn('mt-6 first:mt-0', className)} aria-label={title} data-tour={dataTour}>\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":";;;AAgCA,IAAa,KAAuC,EAClD,UACA,YACA,SACA,WACA,aACA,cACA,WACA,kBAEA,kBAAC,OAAD;CAAK,WAAW,EAAG,4BAA4B,CAAS;CAAG,eAAa;WAAxE,CACE,kBAAC,UAAD;EACE,WAAU;EACV,aAAW,IAAW,GAAG,EAAS,WAAW,KAAA;YAF/C,CAIE,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;IAYM,KAAyC,EACpD,UACA,WACA,aACA,cACA,kBAEA,kBAAC,WAAD;CAAS,WAAW,EAAG,mBAAmB,CAAS;CAAG,cAAY;CAAO,aAAW;WAApF,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"}
@@ -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,E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AAW,MAAM,EAAa,EAAE,OAAO,KAAK;KAC5C,WAAW;IACZ,CAAA,CACE,EAAA,CAAA,GACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;KAAO,SAAQ;KAAiB,WAAW;eACxC,EAAG,+BAA+B,0BAA0B;IACxD,CAAA,GACP,kBAAC,SAAD;KACE,IAAG;KACH,MAAK;KACL,KAAI;KACJ,MAAK;KACL,OAAO;KACP,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
+ {"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,g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O,SAAQ;KAAqB,WAAW;eAC5C,EAAG,kCAAkC,iCAAiC,EACrE,SAAS,EAAe,EAAY,eAAe,EAAY,QAAQ,EACzE,CAAC;IACI,CAAA,GACP,kBAAC,SAAD;KACE,IAAG;KACH,MAAK;KACL,KAAI;KACJ,MAAK;KACL,OAAO;KACP,WAAW,MAAM,EAAa,EAAE,OAAO,KAAK;KAC5C,WAAW;IACZ,CAAA,CACE,EAAA,CAAA,GACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;KAAO,SAAQ;KAAiB,WAAW;eACxC,EAAG,+BAA+B,0BAA0B;IACxD,CAAA,GACP,kBAAC,SAAD;KACE,IAAG;KACH,MAAK;KACL,KAAI;KACJ,MAAK;KACL,OAAO;KACP,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,CAAU,CAAC,IAAK,KAAK,KAAU,GAAG,IAAI;AAC9F;AAEA,IAAa,KAA2D,EACtE,YACA,YACA,UACA,kBACI;CACJ,IAAM,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,GAA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AD;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
+ {"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,GAA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QAAQ,EAAQ;IACpB,OAAO;IACP,WAAW,MAAM,EAAQ,EAAE,OAAO,KAAK;IACvC,WAAW;GACZ,CAAA,CACE,EAAA,CAAA;GACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;IAAO,SAAS,WAAW,EAAQ;IAAM,WAAW;cACjD,EAAG,+BAA+B,0BAA0B;GACxD,CAAA,GACP,kBAAC,YAAD;IACE,IAAI,WAAW,EAAQ;IACvB,MAAM;IACN,OAAO;IACP,WAAW,MAAM,EAAW,EAAE,OAAO,KAAK;IAC1C,WAAW;GACZ,CAAA,CACE,EAAA,CAAA;GACJ,MAAY,eAAe,EAAQ,kBAClC,kBAAC,SAAD;IAAO,WAAU;cAAjB,CACE,kBAAC,SAAD;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"}