gloomberb 0.20.17 → 0.20.19

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 (453) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/cot.ts +5 -6
  7. package/src/api-client/data.ts +14 -3
  8. package/src/api-client/heard-from.ts +72 -0
  9. package/src/api-client/index.ts +64 -6
  10. package/src/api-client/mna.ts +18 -0
  11. package/src/api-client/request.ts +162 -40
  12. package/src/api-client/supply-chain.ts +9 -0
  13. package/src/api-client/types/billing.ts +35 -1
  14. package/src/api-client/types/news.ts +45 -0
  15. package/src/api-client/types/world-venues.ts +9 -0
  16. package/src/app/global-shortcuts.ts +5 -3
  17. package/src/app/pro-welcome/keys.ts +27 -0
  18. package/src/app/pro-welcome/model.ts +158 -0
  19. package/src/app/pro-welcome/row.tsx +176 -0
  20. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  21. package/src/app/runtime/external-profile-changes.ts +135 -0
  22. package/src/app.tsx +37 -4
  23. package/src/architecture/core-builtin-allowlist.json +1 -1
  24. package/src/architecture/floating-promise-allowlist.json +1 -2
  25. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  26. package/src/cli/alert-listing.ts +98 -0
  27. package/src/cli/commands/market.ts +191 -39
  28. package/src/cli/commands/overview.ts +7 -1
  29. package/src/cli/commands/plugins.ts +3 -2
  30. package/src/cli/commands/search.ts +30 -6
  31. package/src/cli/commands/ticker.ts +13 -6
  32. package/src/cli/context.ts +24 -5
  33. package/src/cli/csv-export.ts +2 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +3 -1
  35. package/src/cli/desktop-pane-shot-view.ts +0 -1
  36. package/src/cli/desktop-pane-shot.ts +276 -52
  37. package/src/cli/errors.ts +3 -9
  38. package/src/cli/exit-codes.ts +1 -1
  39. package/src/cli/glossary.ts +65 -11
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/history-demergers.ts +117 -0
  42. package/src/cli/history-rows.ts +8 -4
  43. package/src/cli/index.ts +2 -1
  44. package/src/cli/known-gaps.ts +16 -0
  45. package/src/cli/known-us-stocks.ts +18 -0
  46. package/src/cli/listing-arg.ts +192 -38
  47. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  48. package/src/cli/pane-functions/catalog-snapshot.json +877 -0
  49. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  50. package/src/cli/pane-functions/catalog.ts +50 -16
  51. package/src/cli/pane-functions/data.ts +16 -4
  52. package/src/cli/pane-functions/dom.ts +54 -8
  53. package/src/cli/pane-functions/freshness.ts +39 -4
  54. package/src/cli/pane-functions/function-help.ts +3 -3
  55. package/src/cli/pane-functions/headless.ts +9 -1
  56. package/src/cli/pane-functions/index.ts +175 -50
  57. package/src/cli/pane-functions/report-notices.ts +10 -0
  58. package/src/cli/pane-functions/resolver.ts +11 -7
  59. package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
  60. package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
  61. package/src/cli/pane-functions/screenshot-payload.ts +36 -1
  62. package/src/cli/pane-functions/screenshot-render.ts +24 -9
  63. package/src/cli/pane-functions/screenshot-types.ts +9 -0
  64. package/src/cli/quote-answer.ts +33 -17
  65. package/src/cli/registry.ts +22 -2
  66. package/src/cli/result.ts +22 -4
  67. package/src/cli/scroll-truncation.ts +7 -2
  68. package/src/cli/series-search.ts +45 -6
  69. package/src/cli/shot-temp-dir.ts +4 -9
  70. package/src/cli/ticker-resolution.ts +1 -1
  71. package/src/cli/unreachable.ts +21 -0
  72. package/src/components/chart/composite/drawing-store.ts +11 -7
  73. package/src/components/chart/composite/format.ts +1 -0
  74. package/src/components/chart/composite/legend.tsx +48 -20
  75. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  76. package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
  77. package/src/components/chart/composite/panel-surface.tsx +1 -1
  78. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  79. package/src/components/chart/composite/tools.ts +164 -39
  80. package/src/components/chart-table/header.tsx +11 -2
  81. package/src/components/chart-table/layout.ts +16 -17
  82. package/src/components/command-bar/pane-templates/items.ts +17 -1
  83. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  84. package/src/components/command-bar/routes/root/results.ts +34 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +19 -4
  86. package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
  87. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  88. package/src/components/command-bar/selection-runtime.ts +29 -5
  89. package/src/components/command-bar/surface/index.tsx +4 -1
  90. package/src/components/command-bar/workflow/alert.ts +32 -13
  91. package/src/components/data-table/view.tsx +15 -2
  92. package/src/components/form-modal/content.tsx +9 -4
  93. package/src/components/index.ts +1 -1
  94. package/src/components/layout/header.tsx +9 -5
  95. package/src/components/layout/pane/capture-status.ts +6 -0
  96. package/src/components/layout/pane/footer/index.tsx +2 -0
  97. package/src/components/layout/pane/footer/model.ts +123 -17
  98. package/src/components/layout/pane/header.tsx +16 -2
  99. package/src/components/layout/pane/status-footer.ts +24 -0
  100. package/src/components/market-board/index.tsx +4 -2
  101. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  102. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  103. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  104. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  105. package/src/components/onboarding/setup-cards.ts +36 -0
  106. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  107. package/src/components/onboarding/wizard-account.ts +6 -1
  108. package/src/components/onboarding/wizard-model.ts +32 -6
  109. package/src/components/onboarding/wizard-positions.ts +1 -1
  110. package/src/components/price-performance.tsx +26 -8
  111. package/src/components/reader/article-reader.tsx +12 -5
  112. package/src/components/sign-in-gate.tsx +3 -1
  113. package/src/components/toggle-list.tsx +6 -8
  114. package/src/components/ui/confirm-dialog.tsx +47 -7
  115. package/src/components/ui/data-table/opentui/index.tsx +7 -0
  116. package/src/components/ui/data-table/types.ts +8 -0
  117. package/src/components/ui/display.tsx +17 -2
  118. package/src/components/ui/index.ts +1 -1
  119. package/src/components/ui/stat-grid.tsx +4 -0
  120. package/src/components/ui/status.tsx +13 -1
  121. package/src/components/ui/table-layout.ts +34 -2
  122. package/src/components/use-pane-notice-footer.tsx +16 -3
  123. package/src/data/config/store/index.ts +31 -0
  124. package/src/data/config/store/node.ts +61 -11
  125. package/src/data/config/store/normalize.ts +4 -6
  126. package/src/data/config/store/shared-file.ts +309 -0
  127. package/src/data/profile-merge.ts +299 -0
  128. package/src/data/sqlite/checkpointer.ts +11 -1
  129. package/src/data/sqlite/database.ts +1 -1
  130. package/src/data/ticker-repository.ts +134 -10
  131. package/src/data/ticker-store.ts +67 -0
  132. package/src/data/ticker-writes.ts +5 -0
  133. package/src/i18n/es.ts +27 -0
  134. package/src/i18n/ja.ts +27 -0
  135. package/src/i18n/ko.ts +27 -0
  136. package/src/i18n/zh-cn.ts +27 -0
  137. package/src/i18n/zh-tw.ts +27 -0
  138. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  139. package/src/market-data/ah-pair.ts +122 -0
  140. package/src/market-data/coordinator/entries.ts +6 -4
  141. package/src/market-data/coordinator/index.ts +14 -3
  142. package/src/market-data/depositary-pair.ts +6 -2
  143. package/src/market-data/futures-board.ts +36 -29
  144. package/src/market-data/futures-contract.ts +37 -1
  145. package/src/market-data/hooks.tsx +33 -2
  146. package/src/market-data/market/change-basis.ts +11 -1
  147. package/src/market-data/market/header-market.ts +11 -0
  148. package/src/market-data/market/status.ts +40 -4
  149. package/src/market-data/performance.ts +127 -32
  150. package/src/market-data/quotes/time.ts +5 -2
  151. package/src/market-data/split-terms.ts +28 -0
  152. package/src/news/types.ts +28 -0
  153. package/src/notifications/app-badge.ts +2 -3
  154. package/src/notifications/app-notifier.ts +5 -0
  155. package/src/plugins/builtin/account-management/footer.ts +1 -1
  156. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  157. package/src/plugins/builtin/account-management/model.ts +1 -0
  158. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  159. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  160. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  161. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  162. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  163. package/src/plugins/builtin/alerts/cli.ts +101 -48
  164. package/src/plugins/builtin/alerts/command.ts +39 -9
  165. package/src/plugins/builtin/alerts/constants.ts +10 -0
  166. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  167. package/src/plugins/builtin/alerts/event-rows.ts +9 -3
  168. package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
  169. package/src/plugins/builtin/alerts/format.ts +24 -8
  170. package/src/plugins/builtin/alerts/headless.ts +12 -6
  171. package/src/plugins/builtin/alerts/index.tsx +97 -16
  172. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  173. package/src/plugins/builtin/alerts/option-contract.ts +197 -0
  174. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  175. package/src/plugins/builtin/alerts/price.ts +30 -5
  176. package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
  177. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  178. package/src/plugins/builtin/alerts/research-builder.ts +5 -10
  179. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  180. package/src/plugins/builtin/alerts/types.ts +7 -0
  181. package/src/plugins/builtin/analytics/account-returns.ts +1 -1
  182. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  183. package/src/plugins/builtin/analytics/pane-model.ts +2 -2
  184. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  185. package/src/plugins/builtin/analytics/risk-client.ts +27 -14
  186. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  187. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  188. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  189. package/src/plugins/builtin/awards/pane.tsx +1 -1
  190. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  191. package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
  192. package/src/plugins/builtin/catalysts/model.ts +2 -1
  193. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  194. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  195. package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
  196. package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
  197. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  198. package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
  199. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  200. package/src/plugins/builtin/chart-composer/index.tsx +17 -5
  201. package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
  202. package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
  203. package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
  204. package/src/plugins/builtin/chat/index.tsx +0 -1
  205. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  206. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  207. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  208. package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
  209. package/src/plugins/builtin/company-kpis/headless.ts +10 -5
  210. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  211. package/src/plugins/builtin/company-kpis/model.ts +57 -15
  212. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  213. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  214. package/src/plugins/builtin/composite/application.ts +14 -0
  215. package/src/plugins/builtin/composite/broker.ts +12 -0
  216. package/src/plugins/builtin/composite/credit.ts +33 -0
  217. package/src/plugins/builtin/composite/crypto.ts +10 -0
  218. package/src/plugins/builtin/composite/earnings.ts +12 -0
  219. package/src/plugins/builtin/composite/filings.ts +13 -0
  220. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  221. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  222. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  223. package/src/plugins/builtin/composite/ownership.ts +23 -0
  224. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  225. package/src/plugins/builtin/composite/quant.ts +15 -0
  226. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  227. package/src/plugins/builtin/composite/screeners.ts +11 -0
  228. package/src/plugins/builtin/composite/shared.ts +11 -0
  229. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  230. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  231. package/src/plugins/builtin/congress-trades/model.ts +9 -5
  232. package/src/plugins/builtin/correlation/index.tsx +13 -17
  233. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  234. package/src/plugins/builtin/cot/client.ts +2 -3
  235. package/src/plugins/builtin/cot/headless.ts +16 -16
  236. package/src/plugins/builtin/cot/index.tsx +6 -6
  237. package/src/plugins/builtin/cot/model.ts +25 -5
  238. package/src/plugins/builtin/cot/pane.tsx +11 -6
  239. package/src/plugins/builtin/cot/series.ts +11 -8
  240. package/src/plugins/builtin/cpi/model.ts +15 -4
  241. package/src/plugins/builtin/cpi/pane.tsx +29 -7
  242. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  243. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  244. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  245. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  246. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  247. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  248. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  249. package/src/plugins/builtin/doe/model.ts +30 -0
  250. package/src/plugins/builtin/doe/pane.tsx +8 -2
  251. package/src/plugins/builtin/earnings/board-table.ts +9 -4
  252. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  253. package/src/plugins/builtin/earnings/headless.ts +16 -6
  254. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  255. package/src/plugins/builtin/earnings/history-table.ts +7 -4
  256. package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
  257. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  258. package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
  259. package/src/plugins/builtin/econ/calendar-model.ts +16 -0
  260. package/src/plugins/builtin/econ/index.tsx +7 -2
  261. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  262. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  263. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  264. package/src/plugins/builtin/exposure/model.ts +10 -0
  265. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  266. package/src/plugins/builtin/futures/model.ts +14 -1
  267. package/src/plugins/builtin/futures/series.ts +1 -8
  268. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  269. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  270. package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
  271. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  272. package/src/plugins/builtin/insider/detail.tsx +36 -7
  273. package/src/plugins/builtin/insider/filing-stories.ts +110 -0
  274. package/src/plugins/builtin/insider/headless.ts +37 -2
  275. package/src/plugins/builtin/insider/index.tsx +79 -10
  276. package/src/plugins/builtin/insider/model.ts +43 -5
  277. package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
  278. package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
  279. package/src/plugins/builtin/jobs/headless.ts +2 -1
  280. package/src/plugins/builtin/jobs/model.ts +6 -0
  281. package/src/plugins/builtin/jobs/pane.tsx +8 -3
  282. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  283. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  284. package/src/plugins/builtin/mna/detail.tsx +67 -6
  285. package/src/plugins/builtin/mna/headless.ts +128 -13
  286. package/src/plugins/builtin/mna/model.ts +219 -16
  287. package/src/plugins/builtin/mna/pane.tsx +34 -6
  288. package/src/plugins/builtin/money-markets/model.ts +14 -5
  289. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  290. package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
  291. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  292. package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
  293. package/src/plugins/builtin/options/analytics.ts +1 -1
  294. package/src/plugins/builtin/options/view.tsx +18 -11
  295. package/src/plugins/builtin/options-positioning/model.ts +11 -0
  296. package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
  297. package/src/plugins/builtin/options-scenario/client.ts +49 -8
  298. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  299. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  300. package/src/plugins/builtin/options-scenario/headless.ts +7 -3
  301. package/src/plugins/builtin/options-scenario/model.ts +33 -2
  302. package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
  303. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  304. package/src/plugins/builtin/pe-band/client.ts +13 -1
  305. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  306. package/src/plugins/builtin/pe-band/model.ts +63 -10
  307. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  308. package/src/plugins/builtin/perps/cascade.ts +4 -3
  309. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  310. package/src/plugins/builtin/perps/model.ts +4 -3
  311. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  312. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  313. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  314. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  315. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  316. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  317. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  318. package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
  319. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  320. package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
  321. package/src/plugins/builtin/research/event-model.ts +43 -19
  322. package/src/plugins/builtin/research/headless.ts +8 -1
  323. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  324. package/src/plugins/builtin/research-search/index.tsx +3 -1
  325. package/src/plugins/builtin/scanner/denied.tsx +16 -4
  326. package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
  327. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  328. package/src/plugins/builtin/sec/filing-display.tsx +14 -2
  329. package/src/plugins/builtin/sec/headless.ts +42 -4
  330. package/src/plugins/builtin/sec/index.tsx +21 -1
  331. package/src/plugins/builtin/sectors/index.tsx +6 -9
  332. package/src/plugins/builtin/sectors/sector-model.ts +1 -1
  333. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  334. package/src/plugins/builtin/shared/earnings-report.ts +49 -5
  335. package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
  336. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  337. package/src/plugins/builtin/shared/statement-currency.ts +23 -0
  338. package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
  339. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  340. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  341. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  342. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  343. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  344. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  345. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  346. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  347. package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
  348. package/src/plugins/builtin/themes/headless.ts +4 -4
  349. package/src/plugins/builtin/themes/model.ts +11 -8
  350. package/src/plugins/builtin/themes/pane.tsx +2 -2
  351. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  352. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  353. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
  354. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
  355. package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
  356. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
  357. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
  358. package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
  359. package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
  360. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
  361. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
  362. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
  363. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  364. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  365. package/src/plugins/builtin/volatility/model.ts +17 -0
  366. package/src/plugins/builtin/volatility/pane.tsx +16 -7
  367. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  368. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  369. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  370. package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
  371. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  372. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  373. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  374. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  375. package/src/plugins/builtin/world-venue-map/model.ts +6 -1
  376. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  377. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  378. package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
  379. package/src/plugins/catalog-browser.ts +10 -1
  380. package/src/plugins/catalog-data.ts +20 -0
  381. package/src/plugins/catalog-lazy.ts +51 -0
  382. package/src/plugins/catalog-ui.ts +16 -18
  383. package/src/plugins/host-smoke.ts +5 -2
  384. package/src/portfolio/allocation.ts +79 -19
  385. package/src/portfolio/cash-balances.ts +76 -0
  386. package/src/portfolio/mutations.ts +43 -8
  387. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  388. package/src/renderers/browser/activity.ts +16 -0
  389. package/src/renderers/browser/app-badge-host.ts +14 -0
  390. package/src/renderers/browser/main.tsx +5 -0
  391. package/src/renderers/browser/notifications.ts +103 -0
  392. package/src/renderers/browser/ui-host.tsx +4 -0
  393. package/src/renderers/desktop/window-layouts.ts +14 -0
  394. package/src/renderers/dom/data-table/index.tsx +27 -4
  395. package/src/renderers/dom/data-table/row.tsx +2 -0
  396. package/src/renderers/dom/host/tabs.tsx +57 -8
  397. package/src/renderers/dom/styles.css +13 -5
  398. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  399. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  400. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  401. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  402. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  403. package/src/renderers/electrobun/view/http-fetch.ts +3 -2
  404. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  405. package/src/series/standalone-catalog.ts +5 -4
  406. package/src/series/standalone.ts +13 -7
  407. package/src/sources/gloomberb-cloud/index.ts +22 -9
  408. package/src/sources/gloomberb-cloud/news.ts +35 -0
  409. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  410. package/src/sources/provider-errors.ts +34 -7
  411. package/src/sources/provider-router/financials.ts +20 -13
  412. package/src/sources/provider-router/history.ts +32 -6
  413. package/src/sources/provider-router/index.ts +4 -0
  414. package/src/sources/provider-router/search.ts +1 -0
  415. package/src/sync/collections-contributor.ts +3 -1
  416. package/src/sync/config-merge.ts +10 -1
  417. package/src/sync/sanitize.ts +26 -2
  418. package/src/tickers/company-name-listing.ts +16 -2
  419. package/src/tickers/listing-fate.ts +12 -8
  420. package/src/tickers/renamed-listings.ts +43 -10
  421. package/src/tickers/search/home-listing.ts +28 -0
  422. package/src/tickers/search/index.ts +19 -7
  423. package/src/tickers/terminal-codes.ts +11 -1
  424. package/src/time-series/base-series.ts +39 -6
  425. package/src/time-series/chart-seed.ts +2 -2
  426. package/src/time-series/history-quality.ts +4 -1
  427. package/src/time-series/hooks.ts +2 -0
  428. package/src/time-series/price-comparison.ts +17 -23
  429. package/src/time-series/reporting.ts +1 -1
  430. package/src/time-series/resolution.ts +13 -0
  431. package/src/time-series/resolve-context.ts +6 -0
  432. package/src/time-series/resolve.ts +42 -3
  433. package/src/time-series/spec.ts +2 -2
  434. package/src/time-series/types.ts +3 -2
  435. package/src/types/data-provider.ts +11 -0
  436. package/src/types/financials.ts +48 -4
  437. package/src/types/headless.ts +1 -0
  438. package/src/types/issuer-listings.ts +2 -0
  439. package/src/types/plugin-notifications.ts +3 -0
  440. package/src/types/price-history.ts +6 -4
  441. package/src/types/ticker.ts +10 -2
  442. package/src/ui/host.tsx +2 -0
  443. package/src/utils/cli-output.ts +1 -1
  444. package/src/utils/declared-dividends.ts +13 -1
  445. package/src/utils/dividend-cash.ts +5 -1
  446. package/src/utils/exchange-announcements.ts +7 -2
  447. package/src/utils/forward-dividend.ts +4 -3
  448. package/src/utils/fundamentals.ts +40 -0
  449. package/src/utils/network-failure.ts +2 -0
  450. package/src/utils/price-history-integrity.ts +9 -1
  451. package/src/utils/remove-folder.ts +37 -0
  452. package/src/utils/trailing-dividend.ts +1 -1
  453. package/src/plugins/builtin/composite-plugins.ts +0 -285
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gloomberb",
3
- "version": "0.20.17",
3
+ "version": "0.20.19",
4
4
  "packageManager": "bun@1.3.14",
5
5
  "description": "Market research and portfolio tracker for the terminal",
6
6
  "module": "src/public/index.ts",
@@ -68,6 +68,7 @@
68
68
  "docs:snapshot": "bun run scripts/update-docs-snapshot.ts",
69
69
  "listings:snapshot": "bun run scripts/update-major-listings.ts",
70
70
  "japanese-names:snapshot": "bun run scripts/update-japanese-names.ts",
71
+ "catalog:snapshot": "bun run scripts/update-cli-catalog-snapshot.ts",
71
72
  "plugins:manifest": "bun run scripts/generate-plugin-manifest.ts",
72
73
  "plugins:manifest:check": "bun run scripts/generate-plugin-manifest.ts --check",
73
74
  "plugins:registry:check": "bun run scripts/check-registry-plugins.ts",
@@ -104,6 +105,7 @@
104
105
  "check:call-player": "bun run scripts/pane-chrome/call-player.ts",
105
106
  "check:chart-axis-zoom": "bun run scripts/pane-chrome/chart-axis-zoom.ts",
106
107
  "check:chart-panel-layout": "bun run scripts/pane-chrome/chart-panel-layout.ts",
108
+ "check:title-tabs-webkit": "bun run scripts/pane-chrome/title-tab-webkit.ts",
107
109
  "kit:page": "bun run scripts/pane-chrome/kit-page.ts",
108
110
  "audit:ui:compare": "bun run scripts/pane-chrome/ui-audit-compare.ts",
109
111
  "benchmark:pane-drag:compare": "bun run scripts/pane-chrome/frame-budget.ts",
@@ -14,6 +14,7 @@ import { clickOutsideWhileClean } from "../ui/dialog-stack";
14
14
  import { AuthForm, authFormTitle } from "./auth-form";
15
15
  import type { AccountMode } from "./auth-model";
16
16
  import { CloudVerificationPanel } from "./verification-panel";
17
+ import { markHeardFromDue } from "./heard-from";
17
18
 
18
19
  function AuthDialog({
19
20
  initialMode,
@@ -21,10 +22,13 @@ function AuthDialog({
21
22
  resolve,
22
23
  dismiss,
23
24
  onCleanChange,
25
+ onAccount,
24
26
  }: PromptContext<AuthUser | undefined> & {
25
27
  initialMode: AccountMode;
26
28
  reason?: string;
27
29
  onCleanChange: (clean: boolean) => void;
30
+ /** The account the form signed in or up, before its email is confirmed too. */
31
+ onAccount: (user: AuthUser) => void;
28
32
  }) {
29
33
  useAppLanguage();
30
34
  const [mode, setMode] = useState<AccountMode>(initialMode);
@@ -44,7 +48,11 @@ function AuthDialog({
44
48
  <AuthForm
45
49
  initialMode={initialMode}
46
50
  onModeChange={setMode}
47
- onSignedIn={(user) => user.emailVerified ? resolve(user) : setVerifyingUser(user)}
51
+ onSignedIn={(user) => {
52
+ onAccount(user);
53
+ if (user.emailVerified) resolve(user);
54
+ else setVerifyingUser(user);
55
+ }}
48
56
  onEscape={dismiss}
49
57
  onTypedChange={setTyped}
50
58
  />
@@ -57,6 +65,8 @@ export interface AuthDialogRequest {
57
65
  /** What asked for it, under the title: the delayed mark says what is delayed and by how much. */
58
66
  reason?: string;
59
67
  onSignedIn?: (user: AuthUser) => void;
68
+ /** The sign-in goes on to a checkout: nothing else is asked before it. */
69
+ checkout?: boolean;
60
70
  }
61
71
 
62
72
  const authDialogListeners = new Set<(request: AuthDialogRequest) => void>();
@@ -93,6 +103,8 @@ export function AuthDialogHost() {
93
103
  openRef.current = true;
94
104
  openAuthDialogs += 1;
95
105
  const { closeOnClickOutside, setClean } = clickOutsideWhileClean();
106
+ // Signed up, even when the dialog then closes before the email is confirmed.
107
+ let account: AuthUser | null = null;
96
108
  void dialog
97
109
  .prompt<AuthUser | undefined>({
98
110
  closeOnClickOutside,
@@ -102,11 +114,17 @@ export function AuthDialogHost() {
102
114
  initialMode={request.mode ?? "login"}
103
115
  reason={request.reason}
104
116
  onCleanChange={setClean}
117
+ onAccount={(user) => {
118
+ account = user;
119
+ }}
105
120
  />
106
121
  ),
107
122
  })
108
123
  .then((user) => {
109
124
  if (user) request.onSignedIn?.(user);
125
+ // Where it heard about Gloom, once the dialog and what follows it have closed.
126
+ const signedIn = user ?? account;
127
+ if (signedIn && !request.checkout) markHeardFromDue(signedIn.id);
110
128
  })
111
129
  .finally(() => {
112
130
  openRef.current = false;
@@ -4,7 +4,8 @@ import { t, tf } from "../i18n";
4
4
 
5
5
  const DEFAULT_TRIAL_DAYS = 7;
6
6
 
7
- function formatUsdCents(cents: number): string {
7
+ /** Whole dollars when exact, else cents: $70, $56.50. */
8
+ export function formatUsdCents(cents: number): string {
8
9
  const dollars = cents / 100;
9
10
  return Number.isInteger(dollars) ? `$${dollars}` : `$${dollars.toFixed(2)}`;
10
11
  }
@@ -0,0 +1,235 @@
1
+ import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
2
+ import { apiClient } from "../api-client";
3
+ import { HEARD_FROM_ANSWERS, type HeardFromAnswer } from "../api-client/heard-from";
4
+ import { useKeybindings } from "../app/keybindings";
5
+ import {
6
+ OnboardingActions,
7
+ OnboardingButton,
8
+ OnboardingChoiceList,
9
+ OnboardingModal,
10
+ OnboardingTitle,
11
+ } from "../components/onboarding/onboarding-frame";
12
+ import { keyReachesPastOnboardingModal } from "../components/onboarding/onboarding-keyboard";
13
+ import { setupCardOpen, subscribeSetupCards } from "../components/onboarding/setup-cards";
14
+ import { TextField } from "../components/ui/fields";
15
+ import { t } from "../i18n";
16
+ import { useAppLanguage } from "../i18n/react";
17
+ import { useShortcut } from "../react/input";
18
+ import { Box, useUiCapabilities, type InputRenderable } from "../ui";
19
+ import { useDialogState } from "../ui/dialog";
20
+ import { useOptionalAppSelector } from "../state/app/context";
21
+ import { isPlainKey } from "../utils/keyboard";
22
+ import {
23
+ type HeardFromChoice,
24
+ heardFromDueAccount,
25
+ runHeardFromQuestion,
26
+ subscribeHeardFromDue,
27
+ takeHeardFromDue,
28
+ } from "./heard-from";
29
+
30
+ /** The services keep their own names in every language. */
31
+ const LABELS: Record<HeardFromAnswer, string> = {
32
+ search: "Search",
33
+ youtube: "YouTube",
34
+ tiktok: "TikTok",
35
+ instagram: "Instagram",
36
+ x: "X",
37
+ reddit: "Reddit",
38
+ ai_assistant: "AI assistant",
39
+ friend: "Friend or colleague",
40
+ article: "Article or newsletter",
41
+ other: "Other",
42
+ };
43
+ const UNTRANSLATED: ReadonlySet<HeardFromAnswer> = new Set(["youtube", "tiktok", "instagram", "x", "reddit"]);
44
+ const OTHER_INDEX = HEARD_FROM_ANSWERS.indexOf("other");
45
+ const NOTE_MAX_LENGTH = 120;
46
+ const CARD_WIDTH = 56;
47
+
48
+ function choiceLabel(answer: HeardFromAnswer): string {
49
+ return UNTRANSLATED.has(answer) ? LABELS[answer] : t(LABELS[answer]);
50
+ }
51
+
52
+ /**
53
+ * "Where did you hear about Gloom?" on the card the app's other one-question
54
+ * steps use. One row is one answer: a click, or Enter on the highlighted
55
+ * row. Other opens a short note under the list, sent with Enter (empty is
56
+ * fine). Esc, or Skip, skips; from the note, Esc (Back) goes back to the
57
+ * list. The card holds the keyboard while it is up, as setup does.
58
+ */
59
+ function HeardFromCard({ onShown, onDone }: {
60
+ onShown: () => void;
61
+ onDone: (choice: HeardFromChoice) => void;
62
+ }) {
63
+ useAppLanguage();
64
+ const desktop = useUiCapabilities().nativePaneChrome === true;
65
+ const keybindings = useKeybindings();
66
+ const [cursor, setCursor] = useState(0);
67
+ const [noteOpen, setNoteOpen] = useState(false);
68
+ const [note, setNote] = useState("");
69
+ const noteRef = useRef<InputRenderable>(null);
70
+ // Enter can arrive with the typing, ahead of the render that holds it.
71
+ const noteValue = useRef("");
72
+ const cursorRef = useRef(0);
73
+ const closed = useRef(false);
74
+
75
+ const moveCursor = useCallback((next: number) => {
76
+ cursorRef.current = next;
77
+ setCursor(next);
78
+ }, []);
79
+
80
+ const done = useCallback((choice: HeardFromChoice) => {
81
+ if (closed.current) return;
82
+ closed.current = true;
83
+ onDone(choice);
84
+ }, [onDone]);
85
+
86
+ const choose = useCallback((index: number) => {
87
+ const answer = HEARD_FROM_ANSWERS[index];
88
+ if (!answer) return;
89
+ moveCursor(index);
90
+ if (answer === "other") {
91
+ setNoteOpen(true);
92
+ return;
93
+ }
94
+ done({ answer });
95
+ }, [done, moveCursor]);
96
+
97
+ const sendNote = useCallback(() => {
98
+ const text = noteValue.current.trim();
99
+ done(text ? { answer: "other", note: text } : { answer: "other" });
100
+ }, [done]);
101
+
102
+ const shownRef = useRef(onShown);
103
+ useEffect(() => shownRef.current(), []);
104
+
105
+ useEffect(() => {
106
+ if (!noteOpen) return;
107
+ const timer = setTimeout(() => noteRef.current?.focus?.(), 10);
108
+ return () => clearTimeout(timer);
109
+ }, [noteOpen]);
110
+
111
+ useShortcut((event) => {
112
+ const handled = ((): boolean => {
113
+ if (noteOpen) {
114
+ if (isPlainKey(event, "enter", "return")) { sendNote(); return true; }
115
+ if (isPlainKey(event, "escape")) { setNoteOpen(false); return true; }
116
+ return false;
117
+ }
118
+ const last = HEARD_FROM_ANSWERS.length - 1;
119
+ if (isPlainKey(event, "down")) { moveCursor(Math.min(last, cursorRef.current + 1)); return true; }
120
+ if (isPlainKey(event, "up")) { moveCursor(Math.max(0, cursorRef.current - 1)); return true; }
121
+ if (isPlainKey(event, "enter", "return")) { choose(cursorRef.current); return true; }
122
+ if (isPlainKey(event, "escape")) { done(null); return true; }
123
+ return false;
124
+ })();
125
+ if (handled) {
126
+ event.preventDefault();
127
+ event.stopPropagation();
128
+ return;
129
+ }
130
+ if (keyReachesPastOnboardingModal(event, keybindings)) return;
131
+ event.stopPropagation();
132
+ }, { phase: "before", allowEditable: true, scope: "heard-from" });
133
+
134
+ const items = HEARD_FROM_ANSWERS.map((answer) => ({ id: answer, label: choiceLabel(answer) }));
135
+ return (
136
+ <OnboardingModal width={CARD_WIDTH} height={18 + (noteOpen ? 2 : 0)} desktopWidth="min(440px, 100%)">
137
+ <OnboardingTitle standalone title={t("Where did you hear about Gloom?")} />
138
+ <Box flexDirection="column" style={desktop ? { marginTop: 14 } : undefined} paddingTop={desktop ? undefined : 1}>
139
+ <OnboardingChoiceList
140
+ items={items}
141
+ selectedIndex={noteOpen ? OTHER_INDEX : cursor}
142
+ onSelect={moveCursor}
143
+ onActivate={choose}
144
+ />
145
+ </Box>
146
+ {noteOpen ? (
147
+ <Box flexDirection="column" style={desktop ? { marginTop: 10 } : undefined} paddingTop={desktop ? undefined : 1}>
148
+ <TextField
149
+ inputRef={noteRef}
150
+ value={note}
151
+ placeholder={t("Where?")}
152
+ maxLength={NOTE_MAX_LENGTH}
153
+ focused
154
+ width={desktop ? undefined : CARD_WIDTH - 6}
155
+ onChange={(value) => {
156
+ noteValue.current = value;
157
+ setNote(value);
158
+ }}
159
+ />
160
+ </Box>
161
+ ) : null}
162
+ {desktop ? null : <Box height={1} />}
163
+ <OnboardingActions>
164
+ {/* From the note, Esc goes back to the list; from the list, it skips. */}
165
+ <OnboardingButton
166
+ label={noteOpen ? "Back" : "Skip"}
167
+ variant="ghost"
168
+ shortcut="Esc"
169
+ onPress={() => (noteOpen ? setNoteOpen(false) : done(null))}
170
+ />
171
+ <OnboardingButton
172
+ label={noteOpen ? "Send" : "Continue"}
173
+ variant="primary"
174
+ shortcut="Enter"
175
+ onPress={() => (noteOpen ? sendNote() : choose(cursorRef.current))}
176
+ />
177
+ </OnboardingActions>
178
+ </OnboardingModal>
179
+ );
180
+ }
181
+
182
+ function currentAccountId(): string | null {
183
+ return apiClient.getCurrentUser()?.id ?? null;
184
+ }
185
+
186
+ /**
187
+ * Asks the account marked due (account/heard-from.ts) once nothing else is
188
+ * up: no dialog, no setup card ("Which companies do you follow?" goes
189
+ * first) and no open command bar, whose typing the card would take. Mounted
190
+ * by the app only while setup and the sign-in gate are closed, so the first
191
+ * run never shows it.
192
+ */
193
+ export function HeardFromQuestionHost() {
194
+ const dialogOpen = useDialogState((state) => state.isOpen);
195
+ const commandBarOpen = useOptionalAppSelector((state) => state.commandBarOpen, false);
196
+ const cardOpen = useSyncExternalStore(subscribeSetupCards, setupCardOpen, setupCardOpen);
197
+ const due = useSyncExternalStore(subscribeHeardFromDue, heardFromDueAccount, heardFromDueAccount);
198
+ const account = useSyncExternalStore(
199
+ (onChange) => apiClient.subscribeCurrentUser(onChange),
200
+ currentAccountId,
201
+ currentAccountId,
202
+ );
203
+ const [asking, setAsking] = useState<{ shown: () => void; resolve: (choice: HeardFromChoice) => void } | null>(null);
204
+ // Drawn once nothing else is up, and kept up from then on (it is a setup card itself).
205
+ const [drawn, setDrawn] = useState(false);
206
+ const busy = useRef(false);
207
+
208
+ useEffect(() => {
209
+ // Signed out, or another account since: the mark waits for its own account.
210
+ if (!due || due !== account || dialogOpen || cardOpen || commandBarOpen || busy.current) return;
211
+ if (!takeHeardFromDue(due)) return;
212
+ busy.current = true;
213
+ const finished = () => {
214
+ busy.current = false;
215
+ setAsking(null);
216
+ setDrawn(false);
217
+ };
218
+ runHeardFromQuestion({
219
+ getState: () => apiClient.getHeardFrom(),
220
+ reportShown: () => apiClient.reportHeardFromShown(),
221
+ answer: (answer, note) => apiClient.answerHeardFrom(answer, note),
222
+ skip: () => apiClient.skipHeardFrom(),
223
+ ask: (shown) => new Promise<HeardFromChoice>((resolve) => setAsking({ shown, resolve })),
224
+ }).then(finished, finished);
225
+ }, [account, cardOpen, commandBarOpen, dialogOpen, due]);
226
+
227
+ // The read takes a moment: a card, dialog or command bar that opened
228
+ // meanwhile (the companies to follow, after a sign-up) goes first.
229
+ useEffect(() => {
230
+ if (asking && !drawn && !dialogOpen && !cardOpen && !commandBarOpen) setDrawn(true);
231
+ }, [asking, cardOpen, commandBarOpen, dialogOpen, drawn]);
232
+
233
+ if (!asking || !drawn) return null;
234
+ return <HeardFromCard onShown={asking.shown} onDone={asking.resolve} />;
235
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * "Where did you hear about Gloom?", asked once in the app right after an
3
+ * account signs up (or in) on the first run's account step or in the sign-in
4
+ * dialog. The account is marked due there; the question itself waits until
5
+ * nothing else is on screen: setup has closed (so nothing is added inside the
6
+ * first run) and no dialog is open. A sign-in on its way to a checkout never
7
+ * marks it, so the question is never shown before or over one.
8
+ *
9
+ * The service decides whether the account is asked and settles it for good on
10
+ * the first answer or skip. Every call here fails silently: an error, or a
11
+ * service too old to know the question, just means it is not asked.
12
+ */
13
+ import type { HeardFromAnswer, HeardFromState } from "../api-client/heard-from";
14
+ import { logFailure } from "../utils/log-failure";
15
+
16
+ let dueAccount: string | null = null;
17
+ const listeners = new Set<() => void>();
18
+
19
+ function changed() {
20
+ for (const listener of listeners) listener();
21
+ }
22
+
23
+ /** An account just signed up or in here: ask it once nothing else is on screen. */
24
+ export function markHeardFromDue(accountId: string): void {
25
+ if (!accountId || dueAccount === accountId) return;
26
+ dueAccount = accountId;
27
+ changed();
28
+ }
29
+
30
+ /** The account the question is due for, if any. */
31
+ export function heardFromDueAccount(): string | null {
32
+ return dueAccount;
33
+ }
34
+
35
+ /** Takes the due mark: the question is asked at most once per sign-in. */
36
+ export function takeHeardFromDue(accountId: string): boolean {
37
+ if (dueAccount !== accountId) return false;
38
+ dueAccount = null;
39
+ changed();
40
+ return true;
41
+ }
42
+
43
+ export function subscribeHeardFromDue(listener: () => void): () => void {
44
+ listeners.add(listener);
45
+ return () => {
46
+ listeners.delete(listener);
47
+ };
48
+ }
49
+
50
+ /** What the person picked: an answer (Other with its note), or null for Skip. */
51
+ export type HeardFromChoice = { answer: HeardFromAnswer; note?: string } | null;
52
+
53
+ export interface HeardFromQuestionDeps {
54
+ getState(): Promise<HeardFromState>;
55
+ reportShown(): Promise<void>;
56
+ answer(answer: HeardFromAnswer, note?: string): Promise<void>;
57
+ skip(): Promise<void>;
58
+ /** Shows the question and resolves with the choice; `shown` is called once it is on screen. */
59
+ ask(shown: () => void): Promise<HeardFromChoice>;
60
+ }
61
+
62
+ export type HeardFromOutcome = "not-asked" | "answered" | "skipped";
63
+
64
+ /**
65
+ * Asks when the service says to, and keeps the answer. Never throws: a
66
+ * failed read, an older service (its 404) or invalid data ask nothing, and a
67
+ * failed write is only logged, as the question has already closed.
68
+ */
69
+ export async function runHeardFromQuestion(deps: HeardFromQuestionDeps): Promise<HeardFromOutcome> {
70
+ let state: HeardFromState;
71
+ try {
72
+ state = await deps.getState();
73
+ } catch (error) {
74
+ logFailure("heard-from", "Reading whether to ask failed")(error);
75
+ return "not-asked";
76
+ }
77
+ if (!state.ask) return "not-asked";
78
+ let reported = false;
79
+ const shown = () => {
80
+ if (reported) return;
81
+ reported = true;
82
+ deps.reportShown().catch(logFailure("heard-from", "Reporting the question shown failed"));
83
+ };
84
+ let choice: HeardFromChoice;
85
+ try {
86
+ choice = await deps.ask(shown);
87
+ } catch (error) {
88
+ logFailure("heard-from", "Showing the question failed")(error);
89
+ return "not-asked";
90
+ }
91
+ if (!choice) {
92
+ deps.skip().catch(logFailure("heard-from", "Saving the skip failed"));
93
+ return "skipped";
94
+ }
95
+ deps.answer(choice.answer, choice.note).catch(logFailure("heard-from", "Saving the answer failed"));
96
+ return "answered";
97
+ }
@@ -1,4 +1,4 @@
1
- /** The CFTC report: Legacy, Disaggregated, or Traders in Financial Futures (TFF). */
1
+ /** Legacy, Disaggregated (CFTC and ICE Europe), or Traders in Financial Futures (TFF). */
2
2
  export type CotFamily = "legacy" | "disaggregated" | "tff"
3
3
  export type CotClass = "noncommercial" | "commercial" | "producer" | "swap" | "managed-money" | "other-reportable" | "nonreportable"
4
4
  | "dealer" | "asset-manager" | "leveraged-funds"
@@ -39,7 +39,7 @@ interface CotMarket {
39
39
  contractUnits?: string | null
40
40
  }
41
41
  export interface CotPayloadBase {
42
- source: "CFTC"
42
+ source: "CFTC" | "ICE Futures Europe" | "CFTC / ICE Futures Europe"
43
43
  scope: CotPositions
44
44
  reportFamily: CotFamily
45
45
  generatedAt: string
@@ -48,9 +48,8 @@ export interface CotPayloadBase {
48
48
  /** Latest report's actual source download time, not its publication time. */
49
49
  fetchedAt: string | null
50
50
  /**
51
- * The latest report's scheduled release by the CFTC's calendar (3:30 p.m.
52
- * New York on the Friday after its Tuesday, a business day later around a
53
- * federal holiday); null from an older server, which did not say.
51
+ * The publisher's scheduled release. ICE Europe normally publishes Friday
52
+ * at 18:30 London time; CFTC uses its own calendar. Null where unverified.
54
53
  */
55
54
  publishedAt: string | null
56
55
  status: "available" | "partial" | "unavailable"
@@ -71,7 +70,7 @@ export interface CotBoardPayload extends CotPayloadBase {
71
70
  export interface CotHistoryPoint {
72
71
  reportDate: string
73
72
  /** The report's scheduled release; absent from an older server. */
74
- publishedAt?: string
73
+ publishedAt?: string | null
75
74
  openInterest: number | null
76
75
  positions: Array<CotPosition & { id: CotClass; net: number | null; netPercentOfOpenInterest: number | null }>
77
76
  }
@@ -9,7 +9,7 @@ import type { PowerBoard, PowerDetail, PowerFilter, PowerHistory } from "./power
9
9
  import type { PerpBoardPayload, PerpEquitiesPayload, PerpEquityListing, PerpHistoryPayload, PerpRankingsPayload, PerpBoardQuery, PerpHistoryQuery,
10
10
  PerpMarketPayload, PerpLiquidationsPayload, PerpDepthPayload } from "./perps";
11
11
  import type { ExposureRequest, ExposurePayload, ExposureScenario } from "./exposure";
12
- import type { SupplyChainPayload, SupplyOptions } from "./supply-chain";
12
+ import type { SupplyChainPayload, SupplyOptions, SupplyRead } from "./supply-chain";
13
13
  import { createReadCoalescer } from "./coalesce";
14
14
  import { supplyGraphQuery, type GraphOptions, type GraphPayload } from "./supply-chain-graph";
15
15
  import type { AwardDetailPayload, AwardFilter, AwardsPayload } from "./awards";
@@ -166,6 +166,7 @@ import type {
166
166
  CloudMarketScreenerCategory,
167
167
  CloudMarketScreenerPayload,
168
168
  CloudMoverSession,
169
+ CloudInsiderFilingStoriesResponse,
169
170
  CloudNewsListResponse,
170
171
  CloudNewsPayload,
171
172
  CloudSavedSearch,
@@ -933,15 +934,17 @@ export class CloudDataApi {
933
934
  return this.request<CloudShillerPayload>(cloudShillerPath());
934
935
  }
935
936
 
936
- /** Futures-only positions unless `positions` asks for futures and options combined; the default request is unchanged. */
937
+ /** Futures-only positions unless `positions` asks for futures and options combined. */
937
938
  async getCloudCotBoard(report: CotFamily, traderClass: CotClass, positions: CotPositions = "futures-only"): Promise<CotBoardPayload> {
938
939
  const query = new URLSearchParams({ report, traderClass, ...(positions === "combined" ? { scope: positions } : {}) });
940
+ if (report === "disaggregated") query.set("includeIce", "true");
939
941
  return this.request<CotBoardPayload>(`/cloud/cot/board?${query}`);
940
942
  }
941
943
 
942
944
  /** A market's report; `since` (YYYY-MM-DD) lists its history from that day instead of the last three years. */
943
945
  async getCloudCotContract(code: string, report: CotFamily, positions: CotPositions = "futures-only", since?: string): Promise<CotContractPayload> {
944
946
  const query = new URLSearchParams({ report, ...(positions === "combined" ? { scope: positions } : {}), ...(since ? { since } : {}) });
947
+ if (report === "disaggregated") query.set("includeIce", "true");
945
948
  return this.request<CotContractPayload>(`/cloud/cot/contracts/${encodeURIComponent(code)}?${query}`);
946
949
  }
947
950
 
@@ -1056,10 +1059,11 @@ export class CloudDataApi {
1056
1059
  return this.request<{ scenarios: ExposureScenario[] }>("/cloud/exposure/scenarios");
1057
1060
  }
1058
1061
 
1059
- async getCloudSupplyChain(symbol: string, options: SupplyOptions = {}): Promise<SupplyChainPayload> {
1062
+ async getCloudSupplyChain(symbol: string, options: SupplyRead = {}): Promise<SupplyChainPayload> {
1060
1063
  const query = new URLSearchParams();
1061
1064
  if (options.tiers?.length) query.set("tiers", options.tiers.join(","));
1062
1065
  if (options.includeLeads) query.set("includeLeads", "1");
1066
+ if (options.asOf) query.set("asOf", options.asOf);
1063
1067
  return this.request<SupplyChainPayload>(`/cloud/supply-chain/${encodeURIComponent(symbol)}${query.size ? `?${query}` : ""}`);
1064
1068
  }
1065
1069
 
@@ -1722,6 +1726,13 @@ export class CloudDataApi {
1722
1726
  );
1723
1727
  }
1724
1728
 
1729
+ /** The stories that report each Form 4, by accession number: the match a story's own filings come from, run the other way. */
1730
+ async getCloudInsiderFilingStories(accessions: readonly string[]): Promise<CloudInsiderFilingStoriesResponse> {
1731
+ return this.request<CloudInsiderFilingStoriesResponse>(
1732
+ `/news/insider-filing-stories?${new URLSearchParams({ accessions: accessions.join(",") })}`,
1733
+ );
1734
+ }
1735
+
1725
1736
  async getCloudTickerTweets(
1726
1737
  params: CloudTickerTweetsParams,
1727
1738
  ): Promise<CloudTweetSearchResponse> {
@@ -0,0 +1,72 @@
1
+ import type { CloudApiRequest } from "./request";
2
+
3
+ /**
4
+ * "Where did you hear about Gloom?": one optional question a new account is
5
+ * asked once, kept on the account. The service decides whether to ask and
6
+ * settles it for good on the first answer or skip; the account comes from
7
+ * the session alone. The app asks before the email is confirmed
8
+ * (`unconfirmed=1`), since confirming holds nothing up here.
9
+ */
10
+ export const HEARD_FROM_ANSWERS = [
11
+ "search",
12
+ "youtube",
13
+ "tiktok",
14
+ "instagram",
15
+ "x",
16
+ "reddit",
17
+ "ai_assistant",
18
+ "friend",
19
+ "article",
20
+ "other",
21
+ ] as const;
22
+
23
+ export type HeardFromAnswer = (typeof HEARD_FROM_ANSWERS)[number];
24
+
25
+ /** The longest "Other" note the service keeps, in characters. */
26
+ const HEARD_FROM_NOTE_MAX_LENGTH = 120;
27
+
28
+ export interface HeardFromState {
29
+ /** Show the question now. */
30
+ ask: boolean;
31
+ /** The answer is final: it will never be asked again. */
32
+ settled: boolean;
33
+ }
34
+
35
+ function parseHeardFromState(value: unknown): HeardFromState {
36
+ const record = typeof value === "object" && value !== null ? value as Record<string, unknown> : null;
37
+ if (!record || typeof record.ask !== "boolean" || typeof record.settled !== "boolean") {
38
+ throw new Error("The account service returned invalid data.");
39
+ }
40
+ return { ask: record.ask, settled: record.settled };
41
+ }
42
+
43
+ /** One line, trimmed, cut to what the service keeps (counted in characters, not UTF-16 units). */
44
+ function heardFromNote(text: string): string {
45
+ return [...text.replace(/\s+/g, " ").trim()].slice(0, HEARD_FROM_NOTE_MAX_LENGTH).join("").trim();
46
+ }
47
+
48
+ export class CloudHeardFromApi {
49
+ constructor(private readonly request: CloudApiRequest) {}
50
+
51
+ async getHeardFrom(signal?: AbortSignal): Promise<HeardFromState> {
52
+ return parseHeardFromState(await this.request<unknown>("/account/heard-from?unconfirmed=1", { signal }));
53
+ }
54
+
55
+ /** The question is on screen. */
56
+ async reportHeardFromShown(): Promise<void> {
57
+ await this.request<unknown>("/account/heard-from/shown?unconfirmed=1", { method: "POST" });
58
+ }
59
+
60
+ /** An answer; the note only goes with Other. A repeat or a later answer changes nothing. */
61
+ async answerHeardFrom(answer: HeardFromAnswer, note?: string): Promise<void> {
62
+ const other = answer === "other" && note ? heardFromNote(note) : "";
63
+ await this.request<unknown>("/account/heard-from", {
64
+ method: "POST",
65
+ body: JSON.stringify(other ? { answer, other } : { answer }),
66
+ });
67
+ }
68
+
69
+ async skipHeardFrom(): Promise<void> {
70
+ await this.request<unknown>("/account/heard-from", { method: "POST", body: JSON.stringify({ skip: true }) });
71
+ }
72
+ }