@gloom-sh/terminal 0.20.9 → 0.20.11

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 (212) hide show
  1. package/package.json +1 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
  3. package/src/api-client/auth.ts +6 -0
  4. package/src/api-client/data.ts +1 -0
  5. package/src/api-client/earnings.ts +15 -0
  6. package/src/api-client/index.ts +14 -3
  7. package/src/api-client/socket-connection.ts +355 -0
  8. package/src/api-client/socket-features.ts +75 -0
  9. package/src/api-client/socket-frames.ts +161 -0
  10. package/src/api-client/socket-listeners.ts +207 -0
  11. package/src/api-client/socket-quotes.ts +332 -0
  12. package/src/api-client/socket.ts +150 -983
  13. package/src/api-client/types/account.ts +10 -0
  14. package/src/api-client/types/billing.ts +10 -0
  15. package/src/api-client/types/econ.ts +19 -7
  16. package/src/api-client/types/market.ts +7 -0
  17. package/src/api-client/types/screener.ts +2 -0
  18. package/src/brokers/signed-in/adapter.ts +19 -5
  19. package/src/brokers/signed-in/client.ts +13 -1
  20. package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
  21. package/src/cli/commands/market.ts +18 -8
  22. package/src/cli/commands/overview.ts +26 -7
  23. package/src/cli/commands/ticker.ts +40 -15
  24. package/src/cli/desktop-pane-shot.ts +39 -0
  25. package/src/cli/errors.ts +20 -3
  26. package/src/cli/fx-pair.ts +11 -2
  27. package/src/cli/history-rows.ts +34 -3
  28. package/src/cli/index.ts +1 -1
  29. package/src/cli/listing-arg.ts +51 -13
  30. package/src/cli/pane-functions/headless.ts +4 -2
  31. package/src/cli/pane-functions/index.ts +1 -0
  32. package/src/cli/pane-functions/resolver.ts +2 -1
  33. package/src/cli/pane-functions/screenshot-assessment.ts +73 -5
  34. package/src/cli/pane-functions/screenshot-types.ts +4 -0
  35. package/src/components/chart/composite/chart-layout.ts +7 -4
  36. package/src/components/chart/composite/composite-chart.tsx +6 -16
  37. package/src/components/chart/composite/toolbar.tsx +258 -82
  38. package/src/components/chart/composite/use-composite-chart-keyboard.ts +5 -6
  39. package/src/components/chart/native/kitty/manager.ts +2 -0
  40. package/src/components/chart/native/surface/manager.ts +211 -11
  41. package/src/components/command-bar/list/model.ts +13 -0
  42. package/src/components/command-bar/panel/index.tsx +2 -13
  43. package/src/components/command-bar/panel/layout.ts +1 -7
  44. package/src/components/command-bar/panel/runtime.ts +0 -1
  45. package/src/components/command-bar/panel/types.ts +0 -2
  46. package/src/components/command-bar/routes/ticker-search/actions.ts +2 -0
  47. package/src/components/command-bar/routes/ticker-search/results.ts +15 -8
  48. package/src/components/command-bar/surface/index.tsx +10 -5
  49. package/src/components/command-bar/workflow/alert.ts +21 -7
  50. package/src/components/data-table/column-menu.tsx +89 -0
  51. package/src/components/data-table/sort-menu.tsx +9 -2
  52. package/src/components/data-table/table-pane.ts +3 -1
  53. package/src/components/data-table/view.tsx +33 -6
  54. package/src/components/form-modal/content.tsx +10 -0
  55. package/src/components/index.ts +1 -1
  56. package/src/components/layout/pane/footer/index.tsx +25 -11
  57. package/src/components/layout/pane/footer/model.ts +88 -21
  58. package/src/components/layout/pane/sidebar.tsx +125 -15
  59. package/src/components/layout/shell/active-drag.ts +18 -13
  60. package/src/components/layout/shell/drag/magnets.ts +34 -18
  61. package/src/components/metric-treemap/heat-surface.tsx +2 -1
  62. package/src/components/metric-treemap/index.tsx +3 -2
  63. package/src/components/ticker/list-table-view.tsx +5 -0
  64. package/src/components/ui/confirm-dialog.tsx +253 -7
  65. package/src/components/ui/data-table/column-order.ts +180 -0
  66. package/src/components/ui/data-table/index.tsx +13 -2
  67. package/src/components/ui/data-table/opentui/index.tsx +267 -23
  68. package/src/components/ui/data-table/opentui/model.ts +43 -4
  69. package/src/components/ui/data-table/types.ts +56 -0
  70. package/src/components/ui/data-table/use-column-order.ts +135 -0
  71. package/src/components/ui/index.ts +1 -1
  72. package/src/components/ui/list-view.tsx +4 -3
  73. package/src/components/ui/status.tsx +9 -6
  74. package/src/components/ui/table-layout.ts +120 -0
  75. package/src/docs/snapshot.json +39 -2
  76. package/src/i18n/es.ts +14 -0
  77. package/src/i18n/ja.ts +14 -0
  78. package/src/i18n/ko.ts +14 -0
  79. package/src/i18n/zh-cn.ts +14 -0
  80. package/src/i18n/zh-tw.ts +14 -0
  81. package/src/market-data/coordinator/index.ts +4 -3
  82. package/src/market-data/coordinator/quotes.ts +12 -4
  83. package/src/market-data/fx-closes.ts +14 -2
  84. package/src/market-data/market/change-basis.ts +35 -1
  85. package/src/market-data/market/status.ts +37 -0
  86. package/src/market-data/performance.ts +4 -1
  87. package/src/market-data/quotes/freshness.ts +12 -0
  88. package/src/market-data/quotes/live-valuation.ts +26 -3
  89. package/src/market-data/quotes/regular-session-valuation.ts +1 -1
  90. package/src/market-data/realized-volatility.ts +3 -0
  91. package/src/market-data/us-bond-market.ts +115 -0
  92. package/src/plugins/builtin/account-management/invite-row.tsx +54 -0
  93. package/src/plugins/builtin/account-management/keyboard.ts +3 -0
  94. package/src/plugins/builtin/account-management/model.ts +1 -0
  95. package/src/plugins/builtin/account-management/pane.tsx +51 -5
  96. package/src/plugins/builtin/account-management/trial-cancel.ts +32 -7
  97. package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
  98. package/src/plugins/builtin/broker-manager/index.tsx +6 -6
  99. package/src/plugins/builtin/broker-manager/model.ts +15 -6
  100. package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
  101. package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
  102. package/src/plugins/builtin/broker-manager/table.ts +10 -4
  103. package/src/plugins/builtin/chat/sidebar.tsx +33 -16
  104. package/src/plugins/builtin/cloud/askg/pane-session.ts +94 -0
  105. package/src/plugins/builtin/cloud/askg/pane.tsx +40 -83
  106. package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
  107. package/src/plugins/builtin/congress-trades/pane.tsx +8 -2
  108. package/src/plugins/builtin/correlation/compute.ts +4 -3
  109. package/src/plugins/builtin/earnings/board-model.ts +33 -0
  110. package/src/plugins/builtin/earnings/board-table.ts +50 -11
  111. package/src/plugins/builtin/earnings/board.tsx +29 -13
  112. package/src/plugins/builtin/earnings/calendar.tsx +15 -3
  113. package/src/plugins/builtin/earnings/client.ts +4 -1
  114. package/src/plugins/builtin/earnings/headless.ts +27 -14
  115. package/src/plugins/builtin/econ/calendar-source.ts +3 -0
  116. package/src/plugins/builtin/equity-screener/live.ts +74 -18
  117. package/src/plugins/builtin/equity-screener/model.ts +19 -4
  118. package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
  119. package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
  120. package/src/plugins/builtin/equity-screener/results.ts +22 -2
  121. package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
  122. package/src/plugins/builtin/futures/index.tsx +15 -1
  123. package/src/plugins/builtin/futures/table.tsx +1 -1
  124. package/src/plugins/builtin/fx-matrix/index.tsx +2 -0
  125. package/src/plugins/builtin/help/index.tsx +1 -1
  126. package/src/plugins/builtin/holders/pane.tsx +30 -20
  127. package/src/plugins/builtin/ipo-calendar/model.ts +3 -3
  128. package/src/plugins/builtin/iv-history/events.ts +5 -0
  129. package/src/plugins/builtin/iv-history/headless.ts +19 -12
  130. package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
  131. package/src/plugins/builtin/macro-day/headless.ts +27 -8
  132. package/src/plugins/builtin/macro-day/model.ts +17 -4
  133. package/src/plugins/builtin/macro-day/releases.ts +36 -15
  134. package/src/plugins/builtin/market-halts/model.ts +3 -2
  135. package/src/plugins/builtin/market-movers/headless.ts +2 -1
  136. package/src/plugins/builtin/market-movers/index.tsx +3 -2
  137. package/src/plugins/builtin/market-movers/model.ts +75 -22
  138. package/src/plugins/builtin/market-movers/screener.ts +2 -1
  139. package/src/plugins/builtin/market-movers/table.ts +7 -5
  140. package/src/plugins/builtin/options/view.tsx +2 -0
  141. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  142. package/src/plugins/builtin/pe-band/model.ts +4 -0
  143. package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
  144. package/src/plugins/builtin/portfolio-list/cell-version.ts +4 -4
  145. package/src/plugins/builtin/portfolio-list/cli/render.ts +9 -4
  146. package/src/plugins/builtin/portfolio-list/pane/index.tsx +15 -1
  147. package/src/plugins/builtin/portfolio-list/summary/index.tsx +24 -7
  148. package/src/plugins/builtin/portfolio-list/summary/totals.ts +40 -11
  149. package/src/plugins/builtin/portfolio-list/table.tsx +18 -1
  150. package/src/plugins/builtin/rate-path/pane.tsx +2 -0
  151. package/src/plugins/builtin/research/analyst-headless.ts +9 -1
  152. package/src/plugins/builtin/research/analyst-pane.tsx +10 -4
  153. package/src/plugins/builtin/research/client.ts +25 -1
  154. package/src/plugins/builtin/research/corporate-actions-pane.tsx +2 -1
  155. package/src/plugins/builtin/research/event-model.ts +3 -13
  156. package/src/plugins/builtin/research/event-sources.ts +3 -1
  157. package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
  158. package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
  159. package/src/plugins/builtin/seasonality/pane.tsx +2 -1
  160. package/src/plugins/builtin/short-interest/headless.ts +2 -0
  161. package/src/plugins/builtin/short-interest/publications-headless.ts +2 -0
  162. package/src/plugins/builtin/short-interest/watch-headless.ts +1 -0
  163. package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
  164. package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
  165. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
  166. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
  167. package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
  168. package/src/plugins/builtin/vol-surface/pane.tsx +2 -1
  169. package/src/plugins/builtin/world-indices/index.tsx +5 -1
  170. package/src/plugins/builtin/yield-curve/headless.ts +5 -1
  171. package/src/plugins/builtin/yield-curve/index.tsx +7 -1
  172. package/src/portfolio/column-values.ts +47 -14
  173. package/src/portfolio/return-metrics.ts +4 -2
  174. package/src/renderers/dom/data-table/column-drag.ts +147 -0
  175. package/src/renderers/dom/data-table/index.tsx +22 -0
  176. package/src/renderers/dom/data-table/row.tsx +27 -5
  177. package/src/renderers/dom/host/image-surface.tsx +19 -9
  178. package/src/renderers/dom/host/input.tsx +4 -0
  179. package/src/renderers/dom/styles.css +22 -0
  180. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +23 -1
  181. package/src/renderers/opentui/chart-surface.tsx +1 -0
  182. package/src/renderers/opentui/frame-hits.ts +33 -0
  183. package/src/renderers/opentui/host.tsx +2 -0
  184. package/src/renderers/opentui/native-surface.ts +14 -21
  185. package/src/renderers/opentui/test-utils.tsx +3 -0
  186. package/src/sources/gloomberb-cloud/normalizers.ts +2 -0
  187. package/src/sources/provider-errors.ts +12 -0
  188. package/src/sources/provider-router/index.ts +12 -4
  189. package/src/state/app/context/index.tsx +22 -0
  190. package/src/state/pane-session.ts +145 -0
  191. package/src/test-support/app-store.ts +24 -1
  192. package/src/tickers/search/home-listing.ts +44 -1
  193. package/src/tickers/search/index.ts +5 -2
  194. package/src/tickers/search/ranking.ts +7 -7
  195. package/src/tickers/us-listing.ts +11 -5
  196. package/src/time-series/base-series.ts +7 -1
  197. package/src/time-series/fundamentals/current-valuation.ts +8 -0
  198. package/src/time-series/fundamentals/series.ts +6 -0
  199. package/src/time-series/live-quotes.ts +3 -9
  200. package/src/time-series/resolve.ts +1 -0
  201. package/src/types/financials.ts +20 -0
  202. package/src/types/headless.ts +9 -0
  203. package/src/ui/host.tsx +20 -0
  204. package/src/ui/pointer-drag.ts +11 -2
  205. package/src/utils/exchanges.ts +13 -8
  206. package/src/utils/fundamentals.ts +14 -3
  207. package/src/utils/price-earnings.ts +17 -10
  208. package/src/utils/price-history-integrity.ts +15 -0
  209. package/src/utils/reason-codes.ts +79 -0
  210. package/src/utils/share-multiples.cases.json +1667 -0
  211. package/src/utils/share-multiples.ts +384 -0
  212. package/src/utils/untrusted-text.ts +11 -0
package/src/i18n/zh-tw.ts CHANGED
@@ -73,6 +73,7 @@ export const zhTW: Record<string, string> = {
73
73
  "Could not apply that setting.": "無法套用該設定。",
74
74
  "Enter {action} · Esc cancel": "Enter {action} · Esc 取消",
75
75
  "y {action} · Enter or Esc {cancel}": "y {action} · Enter 或 Esc {cancel}",
76
+ "y {action} · Tab note · Enter or Esc {cancel}": "y {action} · Tab 備註 · Enter 或 Esc {cancel}",
76
77
  "Published {date}": "已發布 {date}",
77
78
  "Language": "語言",
78
79
  "Unsupported language": "不支援的語言",
@@ -751,6 +752,9 @@ export const zhTW: Record<string, string> = {
751
752
  "Link copied.": "已複製連結。",
752
753
  "New link copied. The old one no longer works.": "已複製新連結。舊連結已失效。",
753
754
  "Copy failed. Select the link below.": "複製失敗。請選取下方的連結。",
755
+ "Invite": "邀請",
756
+ "Free months earned: {earned} of {cap}": "已獲得免費月數:{earned}/{cap}",
757
+ "Copy failed. Select the link instead.": "複製失敗。請選取連結。",
754
758
  "Failed to create the calendar link.": "無法建立行事曆連結。",
755
759
  "Regenerate Link": "重新產生連結",
756
760
  "Calendars using the current link stop updating.": "使用目前連結的行事曆將停止更新。",
@@ -809,6 +813,13 @@ export const zhTW: Record<string, string> = {
809
813
  "If you keep your trial, you can still cancel before it ends without being charged.": "如果保留試用,在試用結束前取消仍不會收費。",
810
814
  "End Trial Now": "立即結束試用",
811
815
  "Keep Trial": "保留試用",
816
+ "What made you decide to cancel? (optional)": "是什麼讓你決定取消?(選填)",
817
+ "Bugs or reliability": "錯誤或穩定性問題",
818
+ "Missing feature": "缺少功能",
819
+ "Too expensive": "太貴了",
820
+ "Not using it enough": "用得不夠多",
821
+ "Only needed it temporarily": "只是暫時需要",
822
+ "Anything else? (optional)": "還有什麼想說的嗎?(選填)",
812
823
  "Ending trial...": "正在結束試用...",
813
824
  "Ending...": "正在結束...",
814
825
  "Trial ended. Pro is off and you won't be charged.": "試用已結束。Pro 已關閉,不會收費。",
@@ -1648,6 +1659,8 @@ export const zhTW: Record<string, string> = {
1648
1659
  "Sign in to Gloom": "登入 Gloom",
1649
1660
  "Continue in your browser or scan the code.": "在瀏覽器中繼續,或掃描 QR 碼。",
1650
1661
  "Other AI apps linked to {broker} get disconnected. Connect them to Gloom instead.": "已連結 {broker} 的其他 AI 應用程式會被中斷連線。請改為將它們連線到 Gloom。",
1662
+ "{broker} will ask to replace your existing Gloom connection. Choose to replace it.": "{broker} 會詢問是否取代你現有的 Gloom 連線。請選擇取代。",
1663
+ "{broker} may ask to replace your existing Gloom connection. If it does, choose to replace it.": "{broker} 可能會詢問是否取代你現有的 Gloom 連線。如果詢問,請選擇取代。",
1651
1664
  "Waiting for {broker}...": "正在等待 {broker}...",
1652
1665
  "Contacting Gloom...": "正在連線 Gloom...",
1653
1666
  "Something went wrong.": "發生錯誤。",
@@ -1688,6 +1701,7 @@ export const zhTW: Record<string, string> = {
1688
1701
  "newline": "換行",
1689
1702
  "Denied in {seconds} s": "{seconds} 秒後拒絕",
1690
1703
  "choose": "選擇",
1704
+ "note": "備註",
1691
1705
  "select": "選定",
1692
1706
  "here": "此處",
1693
1707
  "new pane": "新面板",
@@ -93,9 +93,10 @@ import { readsInBatches } from "../batched-reads";
93
93
  /** How long a streamed tick may reuse the quote fields read from the cache. */
94
94
  const STREAM_QUOTE_BASELINE_TTL_MS = 60_000;
95
95
  /**
96
- * A repeat of an unchanged quote only moves its arrival time. Writing that
97
- * would re-render every reader per heartbeat, so it is recorded at most this
98
- * often: often enough that quote ages and the stream watchdog see a live feed.
96
+ * A repeat of an unchanged quote, or one restamped within the same minute,
97
+ * only moves its arrival time and stamp. Writing that would re-render every
98
+ * reader per heartbeat, so it is recorded at most this often: often enough
99
+ * that quote ages and the stream watchdog see a live feed.
99
100
  */
100
101
  const STREAM_RECEIPT_REFRESH_MS = 5_000;
101
102
  /** Keeps a long session of browsing from holding a baseline per visited symbol. */
@@ -7,6 +7,7 @@ import { QueryStore } from "../query-store";
7
7
  import type { QueryEntry } from "../result-types";
8
8
  import { buildQuoteKey, instrumentFromQuoteTarget, toMarketDataContext } from "../selectors";
9
9
  import { measurePerf } from "../../utils/perf-marks";
10
+ import { quoteStampBucket } from "../quotes/freshness";
10
11
  import { withSavedCopyMarkOf } from "../../data/saved-copies";
11
12
  import {
12
13
  failureStatus,
@@ -491,8 +492,13 @@ export class QuoteSubscriptionManager {
491
492
  }
492
493
 
493
494
  /**
494
- * Whether a tick would change nothing but its arrival time. Unavailable
495
- * numbers are NaN on the wire and count as equal to each other; key order and
495
+ * Whether a tick would change nothing but its arrival time, or its stamp
496
+ * within the minute it already has. Most of a busy symbol's ticks restamp a
497
+ * quote whose price, size and book did not move, and a stamp that stays in the
498
+ * same minute changes no chart bar, as-of clock or session edge, so the pane
499
+ * has nothing to redraw (the caller still refreshes the receipt now and then).
500
+ * A stamp that reaches another minute is a change. Unavailable numbers are NaN
501
+ * on the wire and count as equal to each other; key order and
496
502
  * absent-versus-undefined keys do not matter.
497
503
  */
498
504
  export function areStreamQuotesEquivalent(current: Quote | null | undefined, next: Quote): boolean {
@@ -500,12 +506,14 @@ export function areStreamQuotesEquivalent(current: Quote | null | undefined, nex
500
506
  if (current === next) return true;
501
507
  const left = current as unknown as Record<string, unknown>;
502
508
  const right = next as unknown as Record<string, unknown>;
509
+ const sameStampMinute = Object.is(quoteStampBucket(current), quoteStampBucket(next))
510
+ && Number.isFinite(current.lastUpdated);
503
511
  for (const key in left) {
504
- if (key === "receivedAt" || key === "provenance") continue;
512
+ if (key === "receivedAt" || key === "provenance" || (key === "lastUpdated" && sameStampMinute)) continue;
505
513
  if (!Object.is(left[key], right[key])) return false;
506
514
  }
507
515
  for (const key in right) {
508
- if (key === "receivedAt" || key === "provenance") continue;
516
+ if (key === "receivedAt" || key === "provenance" || (key === "lastUpdated" && sameStampMinute)) continue;
509
517
  if (!(key in left) && right[key] !== undefined) return false;
510
518
  }
511
519
  return current.provenance === next.provenance
@@ -46,7 +46,8 @@ export function dailyFxCloses(
46
46
  if (!row || typeof row.date !== "string" || !Number.isFinite(Date.parse(row.date)) || !isDay(row.date.slice(0, 10))
47
47
  || !Number.isFinite(row.close) || row.close <= 0) throw new FxHistoryError("unavailable");
48
48
  const date = new Date(row.date).toISOString().slice(0, 10);
49
- if (date >= today) continue;
49
+ // A close the source copied from the open, which nothing rebuilt, is no day's close: the day before it stands in.
50
+ if (date >= today || row.closeCopied === true) continue;
50
51
  const rate = leg.invert ? 1 / row.close : row.close;
51
52
  const previous = closes.get(date);
52
53
  if (previous != null && previous !== rate) throw new FxHistoryError("unavailable");
@@ -88,6 +89,11 @@ export interface FxCloseReading {
88
89
  date: string;
89
90
  /** When the close was taken, as an ISO time (17:00 New York), when the service says. */
90
91
  closedAt?: string;
92
+ /**
93
+ * The day asked for, when its close is the source's copy of its open, which
94
+ * nothing rebuilt: `date` is then the trading day before it.
95
+ */
96
+ copiedClose?: string;
91
97
  }
92
98
 
93
99
  /**
@@ -134,16 +140,22 @@ export async function readFxCloseOnDate(
134
140
  if (response.status !== "success" && response.status !== "partial") return { reading: null, served };
135
141
  const today = isoDay(now.getTime());
136
142
  let best: FxCloseReading | null = null;
143
+ let copied: string | undefined;
137
144
  for (const row of Array.isArray(response.data) ? response.data : []) {
138
145
  const at = typeof row?.date === "string" ? Date.parse(row.date) : Number.NaN;
139
146
  if (!Number.isFinite(at) || !Number.isFinite(row.close) || row.close <= 0) continue;
140
147
  const rowDay = isoDay(at);
141
148
  if (rowDay > date || rowDay >= today || Date.parse(`${rowDay}T00:00:00Z`) < day - FX_MAX_AGE_DAYS * DAY_MS) continue;
149
+ // A close the source copied from the open, which nothing rebuilt, is no day's close: the day before it stands in.
150
+ if (row.closeCopied === true) {
151
+ if (rowDay === date) copied = rowDay;
152
+ continue;
153
+ }
142
154
  const close = fxFigureAsSent(row.close);
143
155
  const closedAt = typeof row.closedAt === "string" && Number.isFinite(Date.parse(row.closedAt)) ? row.closedAt : undefined;
144
156
  if (!best || rowDay > best.date) best = { rate: leg.invert ? 1 / close : close, close, date: rowDay, ...(closedAt ? { closedAt } : {}) };
145
157
  }
146
- return { reading: best, served };
158
+ return { reading: best && copied ? { ...best, copiedClose: copied } : best, served };
147
159
  }
148
160
 
149
161
  /**
@@ -11,7 +11,13 @@ import { futuresChangeBasis, futuresQuoteMonth, futuresSettleText, isFuturesInst
11
11
  import { quoteTradingDay } from "../quotes/day-range";
12
12
  import { splitRatioText } from "../quotes/session-split";
13
13
  import { hasPublishedSessionCalendar, isVenueTradingDay, latestRegularSessionOpen, previousPublishedSession, sessionCalendarTimeZone } from "./freshness";
14
- import { getActiveQuoteDisplay, getRegularSessionDisplay, regularSessionDisplayDate } from "./status";
14
+ import {
15
+ EXTENDED_SESSION_MARKS,
16
+ getActiveQuoteDisplay,
17
+ getRegularSessionDisplay,
18
+ regularSessionDisplayDate,
19
+ type ExtendedSession,
20
+ } from "./status";
15
21
 
16
22
  const DAY_MS = 86_400_000;
17
23
  const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
@@ -406,6 +412,34 @@ export function combinedChangeBasisLabel(bases: Iterable<QuoteChangeBasis | null
406
412
  return labels.size === 1 ? [...labels][0]! : MIXED_CHANGE_BASIS_LABEL;
407
413
  }
408
414
 
415
+ /** An extended session as a day's move names its print in words, where there is room: "after hours vs Tue 10 Nov close". */
416
+ const EXTENDED_PRINT_WORDS: Record<ExtendedSession, string> = { PRE: "pre-market", POST: "after hours", OVERNIGHT: "overnight" };
417
+
418
+ /**
419
+ * The basis of a day's move summed over the prices a book is valued at, when
420
+ * some are pre-market, after-hours or overnight prints (its latest print): the
421
+ * session of those prints, then the close the moves are from, so the line says
422
+ * which print it compares with which close. `marks` gives the session as a row
423
+ * marks its price ("AH vs Tue 10 Nov close"), otherwise in words ("after hours
424
+ * vs Tue 10 Nov close"); prints from several sessions read EXT or "extended
425
+ * hours". Without an extended print, the close alone, as
426
+ * combinedChangeBasisLabel gives it; null without a basis.
427
+ */
428
+ export function dayMoveBasisLabel(
429
+ bases: Iterable<QuoteChangeBasis | null | undefined>,
430
+ prints: Iterable<ExtendedSession | null | undefined>,
431
+ { marks = false, now = Date.now() }: { marks?: boolean; now?: number } = {},
432
+ ): string | null {
433
+ const basis = combinedChangeBasisLabel(bases, now);
434
+ const sessions = new Set<ExtendedSession>();
435
+ for (const print of prints) if (print) sessions.add(print);
436
+ if (!basis || sessions.size === 0) return basis;
437
+ const [session] = sessions;
438
+ const print = sessions.size > 1 ? (marks ? "EXT" : "extended hours")
439
+ : marks ? EXTENDED_SESSION_MARKS[session!] : EXTENDED_PRINT_WORDS[session!];
440
+ return `${print} ${basis}`;
441
+ }
442
+
409
443
  /**
410
444
  * The basis as `--json` gives it beside a move: the kind, the dated session
411
445
  * (`date`), the venue's closures in between and the label and note a change
@@ -331,6 +331,43 @@ export function getActiveQuoteDisplay(quote: Quote | null | undefined): ActiveQu
331
331
  return { price: quote.price, change: quote.change, changePercent: quote.changePercent };
332
332
  }
333
333
 
334
+ /** A price and its move, with the extended session it is a print of when it is not the regular session's. */
335
+ export interface SessionPriceDisplay extends ActiveQuoteDisplay {
336
+ /** Set when the price is a pre-market, after-hours or overnight print. */
337
+ session?: ExtendedSession;
338
+ /** That print is the midpoint of the session's bid and ask, nothing having traded in it. */
339
+ mark?: true;
340
+ }
341
+
342
+ /**
343
+ * The latest print (getActiveQuoteDisplay), naming its session when it is a
344
+ * pre-market, after-hours or overnight trade rather than the regular
345
+ * session's price or close: the extended print `quote` shows beside Last
346
+ * (getExtendedSessionDisplay) at the same price. A quote that says nothing
347
+ * has traded in the session yet (extendedSessionPrint false) carries the
348
+ * close, which names none. Whatever is priced at the latest print (a
349
+ * position's value and day, an alert's current price) says which session the
350
+ * price is from with this.
351
+ */
352
+ export function getLatestPrintDisplay(quote: Quote | null | undefined): SessionPriceDisplay | null {
353
+ const latest = getActiveQuoteDisplay(quote);
354
+ if (!latest || quote?.extendedSessionPrint === false) return latest;
355
+ const extended = getExtendedSessionDisplay(quote);
356
+ if (!extended || extended.price !== latest.price) return latest;
357
+ return { ...latest, session: extended.session, ...(extended.mark ? { mark: true as const } : {}) };
358
+ }
359
+
360
+ /**
361
+ * The extended session `price` is a print of: the quote's latest print's
362
+ * (getLatestPrintDisplay) when that is the price and a pre-market,
363
+ * after-hours or overnight trade. Null for a regular session's price or close,
364
+ * and for any other price (an option's mark, a future's settlement).
365
+ */
366
+ export function extendedPrintSession(quote: Quote | null | undefined, price: number | null | undefined): ExtendedSession | null {
367
+ const latest = getLatestPrintDisplay(quote);
368
+ return latest?.session && price != null && latest.price === price ? latest.session : null;
369
+ }
370
+
334
371
  function isPositive(value: number | undefined): value is number {
335
372
  return isFiniteNumber(value) && value > 0;
336
373
  }
@@ -1,5 +1,5 @@
1
1
  import type { PricePoint, Quote } from "../types/financials";
2
- import { pricePointIntegrity } from "../utils/price-history-integrity";
2
+ import { pricePointCloseCopied, pricePointIntegrity } from "../utils/price-history-integrity";
3
3
  import { calendarMonthsBefore } from "../utils/calendar-date";
4
4
  import { barSessionDay, isReturnPeriod, periodBaseDay, periodBaseIndex } from "./market/period-return";
5
5
 
@@ -56,6 +56,9 @@ function normalizePriceReturnHistory(points: readonly PricePoint[]): readonly Pr
56
56
  for (const point of points) {
57
57
  const date = coercePointDate(point.date as Date | string | number);
58
58
  if (!date || (!Number.isFinite(point.close) && !pricePointIntegrity(point))) continue;
59
+ // A pair's close its source copied from the open, which nothing rebuilt, is no day's close: a horizon's base or end
60
+ // falls on the close before it, as across a holiday.
61
+ if (pricePointCloseCopied(point)) continue;
59
62
  byTimestamp.set(date.getTime(), { ...point, date });
60
63
  }
61
64
  const history = [...byTimestamp.entries()]
@@ -33,6 +33,18 @@ export function hasValidQuoteObservationTime(quote: Pick<Quote, "lastUpdated">,
33
33
  && Number.isFinite(new Date(timestamp).getTime()) && Number.isFinite(new Date(now).getTime());
34
34
  }
35
35
 
36
+ /**
37
+ * The size of the stamp window a chart bar, an as-of clock and a session edge
38
+ * all move on: a whole minute. A stamp that stays inside the held one's window
39
+ * changes none of them.
40
+ */
41
+ const QUOTE_STAMP_BUCKET_MS = 60_000;
42
+
43
+ /** The whole minute a quote's stamp falls in; NaN for an unusable stamp. */
44
+ export function quoteStampBucket(quote: Pick<Quote, "lastUpdated">): number {
45
+ return Number.isFinite(quote.lastUpdated) ? Math.floor(quote.lastUpdated / QUOTE_STAMP_BUCKET_MS) : Number.NaN;
46
+ }
47
+
36
48
  /** The source date of a validated daily fund observation, including an old NAV. */
37
49
  export function dailyNavDate(quote: Quote, now = Date.now()): string | null {
38
50
  if (quote.priceObservation !== "nav" || quote.instrumentType !== "MUTUALFUND"
@@ -1,11 +1,11 @@
1
- import type { AnalystResearchData, CorporateActionsData, Fundamentals, Quote } from "../../types/financials";
1
+ import type { AnalystResearchData, CorporateActionsData, Fundamentals, Quote, TickerFinancials } from "../../types/financials";
2
2
  import { atRegularSessionPrice, regularSessionValuationPrice } from "./regular-session-valuation";
3
3
  import { hasLikelyQuoteUnitMismatch, resolveCurrencyUnit } from "../../utils/currency-units";
4
4
  import { cashInMajorUnits } from "../../utils/dividend-cash";
5
5
  import { cashDistribution, dividendReferencePrice, trailingDividendYield, type CashDistribution } from "../../utils/trailing-dividend";
6
6
  import { priceEarningsEps } from "../../utils/fundamentals";
7
7
  import { selectMarketCapitalization, type MarketCapitalization } from "../../utils/market-capitalization";
8
- import { priceEarningsOnEarnings, type PriceEarnings } from "../../utils/price-earnings";
8
+ import { NOT_MEANINGFUL, priceEarningsOnEarnings, type PriceEarnings } from "../../utils/price-earnings";
9
9
 
10
10
  /**
11
11
  * Price-derived statistics repriced at the quote's regular session price
@@ -69,16 +69,39 @@ function repriceMultiple(
69
69
  * currency than the price is repriced at the rate the served P/E converted it at.
70
70
  */
71
71
  export function liveTrailingPE(quote: Quote | null | undefined, fundamentals: Fundamentals | undefined): PriceEarnings | undefined {
72
+ // Withdrawn as no multiple of the share (utils/share-multiples).
73
+ if (fundamentals?.notMeaningful?.trailingPE) return NOT_MEANINGFUL;
72
74
  const stored = pricedFundamentals(quote, fundamentals)?.trailingPE;
73
- return priceEarningsOnEarnings(repriceMultiple(stored, priceEarningsEps(fundamentals), quote, fundamentals), fundamentals?.eps);
75
+ return priceEarningsOnEarnings(repriceMultiple(stored, priceEarningsEps(fundamentals, quote?.currency), quote, fundamentals), fundamentals?.eps);
74
76
  }
75
77
 
76
78
  /** Forward P/E over the regular session price; not meaningful when the forward EPS behind it is zero or a loss. */
77
79
  export function liveForwardPE(quote: Quote | null | undefined, fundamentals: Fundamentals | undefined): PriceEarnings | undefined {
80
+ if (fundamentals?.notMeaningful?.forwardPE) return NOT_MEANINGFUL;
78
81
  const stored = pricedFundamentals(quote, fundamentals)?.forwardPE;
79
82
  return priceEarningsOnEarnings(repriceMultiple(stored, fundamentals?.forwardEps, quote, fundamentals), fundamentals?.forwardEps);
80
83
  }
81
84
 
85
+ /**
86
+ * `financials` at the regular session price (atRegularSessionPrice) with the trailing and forward P/E the Overview,
87
+ * the portfolio and EQS show (liveTrailingPE, liveForwardPE): one the source measured at an older print is the price
88
+ * over its EPS. A P/E with no number (N/M, or none) stays as the block has it, for its reason.
89
+ */
90
+ export function atLivePriceEarnings<T extends Pick<TickerFinancials, "quote" | "fundamentals">>(financials: T): T {
91
+ const priced = atRegularSessionPrice(financials);
92
+ if (!priced.fundamentals) return priced;
93
+ const trailing = liveTrailingPE(financials.quote, financials.fundamentals);
94
+ const forward = liveForwardPE(financials.quote, financials.fundamentals);
95
+ return {
96
+ ...priced,
97
+ fundamentals: {
98
+ ...priced.fundamentals,
99
+ ...typeof trailing === "number" ? { trailingPE: trailing } : {},
100
+ ...typeof forward === "number" ? { forwardPE: forward } : {},
101
+ },
102
+ };
103
+ }
104
+
82
105
  /** Forward dividend yield over the regular session price, as a ratio like the stored yield. */
83
106
  export function liveDividendYield(quote: Quote | null | undefined, fundamentals: Fundamentals | undefined): number | undefined {
84
107
  const stored = pricedFundamentals(quote, fundamentals)?.dividendYield;
@@ -188,7 +188,7 @@ export function atRegularSessionPrice<T extends Pick<TickerFinancials, "quote" |
188
188
  if (!fundamentals || fundamentals.stale === true) {
189
189
  return { ...financials, quote: { ...quote, marketCap: scaledAmount(quote.marketCap, capMove(quote.marketCap)) } };
190
190
  }
191
- const trailing = per(fundamentals.trailingPE, priceEarningsEps(fundamentals));
191
+ const trailing = per(fundamentals.trailingPE, priceEarningsEps(fundamentals, quote.currency));
192
192
  const forward = per(fundamentals.forwardPE, fundamentals.forwardEps);
193
193
  const dividend = fundamentals.dividendRate != null && positive(fundamentals.dividendYield)
194
194
  ? fundamentals.dividendRate / fundamentals.dividendYield : undefined;
@@ -2,6 +2,7 @@ import type { PricePoint } from "../types/financials";
2
2
  import { barsPerYear, type BarsPerYearInstrument } from "./bars-per-year";
3
3
  import {
4
4
  mergePriceHistoryIntegrity,
5
+ pricePointCloseCopied,
5
6
  pricePointIntegrity,
6
7
  pricePointOpenWithheld,
7
8
  pricePointWicks,
@@ -113,6 +114,8 @@ function observations(points: readonly PricePoint[]): Observation[] | null {
113
114
  for (const point of points) {
114
115
  const time = new Date(point.date).getTime();
115
116
  if (!Number.isFinite(time)) return null;
117
+ // A pair's close its source copied from the open, which nothing rebuilt, is no day's close: the bar is left out.
118
+ if (pricePointCloseCopied(point)) continue;
116
119
  dates.set(time, point);
117
120
  }
118
121
  return [...dates.entries()].sort(([a], [b]) => a - b).map(([time, point]) => ({
@@ -0,0 +1,115 @@
1
+ /**
2
+ * The US bond market's full holidays, as SIFMA recommends them: the federal
3
+ * holidays (Columbus Day and Veterans Day among them, when stocks trade) and
4
+ * Good Friday, except a Good Friday the March jobs report comes out on (the
5
+ * first Friday of April: 2010-04-02, 2012-04-06, 2015-04-03, 2021-04-02,
6
+ * 2023-04-07, 2026-04-03), when SIFMA recommends an early close instead and
7
+ * the Treasury curve and FRED's daily rates have the day. A Treasury curve and
8
+ * a FRED rate series have no observation on a full holiday. A holiday on a Sunday closes the Monday after it; one on a Saturday
9
+ * closes the Friday before it, except New Year's Day and Veterans Day, which
10
+ * close nothing then (the market traded Fri 31 Dec 2021 and Fri 10 Nov 2023).
11
+ * Juneteenth is a holiday from 2022. Early closes are trading days.
12
+ */
13
+
14
+ const DAY_MS = 86_400_000;
15
+ const WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
16
+ const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
17
+
18
+ const isoDay = (time: number) => new Date(time).toISOString().slice(0, 10);
19
+
20
+ /** The `nth` `weekday` (0 Sunday) of a month (0 January), or its last when `nth` is -1. */
21
+ function nthWeekday(year: number, month: number, weekday: number, nth: number): number {
22
+ if (nth < 0) {
23
+ const last = Date.UTC(year, month + 1, 0);
24
+ return last - ((new Date(last).getUTCDay() - weekday + 7) % 7) * DAY_MS;
25
+ }
26
+ const first = Date.UTC(year, month, 1);
27
+ return first + (((weekday - new Date(first).getUTCDay() + 7) % 7) + (nth - 1) * 7) * DAY_MS;
28
+ }
29
+
30
+ /** Good Friday: Easter Sunday (the Gregorian computus) less two days. */
31
+ function goodFriday(year: number): number {
32
+ const a = year % 19, b = Math.floor(year / 100), c = year % 100;
33
+ const d = Math.floor(b / 4), e = b % 4, f = Math.floor((b + 8) / 25), g = Math.floor((b - f + 1) / 3);
34
+ const h = (19 * a + b - d - g + 15) % 30, i = Math.floor(c / 4), k = c % 4;
35
+ const l = (32 + 2 * e + 2 * i - h - k) % 7, m = Math.floor((a + 11 * h + 22 * l) / 451);
36
+ const month = Math.floor((h + l - 7 * m + 114) / 31);
37
+ const day = ((h + l - 7 * m + 114) % 31) + 1;
38
+ return Date.UTC(year, month - 1, day) - 2 * DAY_MS;
39
+ }
40
+
41
+ const holidaysByYear = new Map<number, ReadonlyMap<string, string>>();
42
+
43
+ /** Each closed day of a year with the holiday it is for. */
44
+ function holidays(year: number): ReadonlyMap<string, string> {
45
+ const kept = holidaysByYear.get(year);
46
+ if (kept) return kept;
47
+ const days = new Map<string, string>();
48
+ // A fixed date on a Sunday closes the Monday; on a Saturday the Friday, where the market moves it.
49
+ const fixed = (month: number, day: number, name: string, saturdayCloses = true) => {
50
+ const date = Date.UTC(year, month, day);
51
+ const weekday = new Date(date).getUTCDay();
52
+ if (weekday === 6 && !saturdayCloses) return;
53
+ days.set(isoDay(date + (weekday === 0 ? DAY_MS : weekday === 6 ? -DAY_MS : 0)), name);
54
+ };
55
+ fixed(0, 1, "New Year's Day", false);
56
+ days.set(isoDay(nthWeekday(year, 0, 1, 3)), "Martin Luther King Jr. Day");
57
+ days.set(isoDay(nthWeekday(year, 1, 1, 3)), "Washington's Birthday");
58
+ // A Good Friday in April's first week is the March jobs report's day: an early close, not a holiday.
59
+ const friday = goodFriday(year);
60
+ if (!(new Date(friday).getUTCMonth() === 3 && new Date(friday).getUTCDate() <= 7)) days.set(isoDay(friday), "Good Friday");
61
+ days.set(isoDay(nthWeekday(year, 4, 1, -1)), "Memorial Day");
62
+ if (year >= 2022) fixed(5, 19, "Juneteenth");
63
+ fixed(6, 4, "Independence Day");
64
+ days.set(isoDay(nthWeekday(year, 8, 1, 1)), "Labor Day");
65
+ days.set(isoDay(nthWeekday(year, 9, 1, 2)), "Columbus Day");
66
+ fixed(10, 11, "Veterans Day", false);
67
+ days.set(isoDay(nthWeekday(year, 10, 4, 4)), "Thanksgiving Day");
68
+ fixed(11, 25, "Christmas Day");
69
+ holidaysByYear.set(year, days);
70
+ return days;
71
+ }
72
+
73
+ /** The holiday a day (`YYYY-MM-DD`) closes the US bond market for, or null for a trading day or a weekend. */
74
+ export function usBondMarketHoliday(date: string): string | null {
75
+ const year = Number(date.slice(0, 4));
76
+ return Number.isInteger(year) ? holidays(year).get(date.slice(0, 10)) ?? null : null;
77
+ }
78
+
79
+ /** `Wed 11 Nov`: a day as the closure note names it. */
80
+ function dayText(date: string): string {
81
+ const day = new Date(`${date.slice(0, 10)}T00:00:00Z`);
82
+ return `${WEEKDAYS[day.getUTCDay()]} ${day.getUTCDate()} ${MONTHS[day.getUTCMonth()]}`;
83
+ }
84
+
85
+ /**
86
+ * Why a day asked for shows an earlier one, for a series observed on US bond
87
+ * market days (the Treasury curve, FRED's daily rates): "Wed 11 Nov: US bond
88
+ * market closed (Veterans Day); showing Tue 10 Nov", or "Sat 7 Nov: weekend;
89
+ * showing Fri 6 Nov" when every day between them is a weekend or a holiday.
90
+ * Null when the day shown is the day asked for, or when a trading day between
91
+ * them has no observation either, which a closure does not explain.
92
+ */
93
+ export function usBondMarketClosedNote(asked: string, shown: string): string | null {
94
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(asked) || !/^\d{4}-\d{2}-\d{2}$/.test(shown) || shown >= asked) return null;
95
+ const from = Date.parse(`${shown}T00:00:00Z`) + DAY_MS;
96
+ for (let time = from; time <= Date.parse(`${asked}T00:00:00Z`); time += DAY_MS) {
97
+ const day = isoDay(time);
98
+ if (new Date(time).getUTCDay() % 6 !== 0 && !usBondMarketHoliday(day)) return null;
99
+ }
100
+ const holiday = usBondMarketHoliday(asked);
101
+ const why = holiday ? `US bond market closed (${holiday})` : new Date(`${asked}T00:00:00Z`).getUTCDay() % 6 === 0 ? "weekend"
102
+ : "US bond market closed";
103
+ return `${dayText(asked)}: ${why}; showing ${dayText(shown)}`;
104
+ }
105
+
106
+ /**
107
+ * Whether a FRED series is observed on US bond market days: the Treasury's
108
+ * constant-maturity, bill and real yields and their spreads, SOFR, and the
109
+ * corporate yields and spreads priced off them. A stock index or an oil price
110
+ * trades on Veterans Day and is no such series.
111
+ */
112
+ export function followsUsBondMarket(seriesId: string): boolean {
113
+ return /^(?:DGS\d+(?:MO)?|DTB\d+(?:WK)?|DTB\d+YR|DFII\d+|T\d+Y(?:\d+[MY]|FF|IE)|T5YIFR|SOFR\w*|BAML\w+|DAAA|DBAA|AAA10Y|BAA10Y)$/i
114
+ .test(seriesId.trim());
115
+ }
@@ -0,0 +1,54 @@
1
+ import type { Ref } from "react";
2
+ import { Button, FieldLabel } from "../../../components";
3
+ import { terminalButtonColumns } from "../../../components/ui/button";
4
+ import type { ReferralInvite } from "../../../api-client";
5
+ import { t, tf } from "../../../i18n";
6
+ import { colors } from "../../../theme/colors";
7
+ import { Box, Text, type BoxRenderable } from "../../../ui";
8
+ import { displayWidth } from "../../../utils/format";
9
+
10
+ /** The link as people read it, without the scheme; Copy gives the whole URL. */
11
+ function inviteLinkText(url: string): string {
12
+ return url.replace(/^https?:\/\//, "");
13
+ }
14
+
15
+ /**
16
+ * The Pro tab's Invite row: the account's invite link, selectable, a Copy
17
+ * button beside it (under it when the pane is too narrow for both), and the
18
+ * free months the link has earned so far.
19
+ */
20
+ export function InviteRow({
21
+ invite,
22
+ active,
23
+ width,
24
+ labelWidth,
25
+ nodeRef,
26
+ onCopy,
27
+ onFocus,
28
+ }: {
29
+ invite: ReferralInvite;
30
+ active: boolean;
31
+ width: number;
32
+ labelWidth: number;
33
+ nodeRef: Ref<BoxRenderable>;
34
+ onCopy: () => void;
35
+ onFocus: () => void;
36
+ }) {
37
+ const link = inviteLinkText(invite.url);
38
+ const copyLabel = t("Copy");
39
+ const besideLink = displayWidth(link) + 1 + terminalButtonColumns({ label: copyLabel }) <= width - labelWidth - 1;
40
+ return (
41
+ <Box ref={nodeRef} flexDirection="row" gap={1} onMouseDown={onFocus}>
42
+ <FieldLabel label={t("Invite")} active={active} width={labelWidth} />
43
+ <Box flexDirection="column" flexShrink={1}>
44
+ <Box flexDirection={besideLink ? "row" : "column"} gap={besideLink ? 1 : 0} alignItems={besideLink ? "center" : "flex-start"}>
45
+ <Text selectable fg={colors.text}>{link}</Text>
46
+ <Button label={copyLabel} active={active} onPress={onCopy} />
47
+ </Box>
48
+ <Text fg={colors.textDim}>
49
+ {tf("Free months earned: {earned} of {cap}", { earned: invite.earned, cap: invite.cap })}
50
+ </Text>
51
+ </Box>
52
+ </Box>
53
+ );
54
+ }
@@ -35,6 +35,7 @@ export function useAccountManagementKeyboard({
35
35
  setDraftValue,
36
36
  deleteAccount,
37
37
  endTrial,
38
+ copyInvite,
38
39
  turnOffEmailAlerts,
39
40
  }: {
40
41
  activeField: AccountFieldKey;
@@ -54,6 +55,7 @@ export function useAccountManagementKeyboard({
54
55
  setDraftValue: <K extends keyof AccountDraft>(key: K, value: AccountDraft[K]) => void;
55
56
  deleteAccount: () => Promise<void>;
56
57
  endTrial: () => Promise<void>;
58
+ copyInvite: () => void;
57
59
  turnOffEmailAlerts: () => Promise<void>;
58
60
  }): FieldRing<AccountFieldKey> {
59
61
  const actions: Partial<Record<AccountFieldKey, () => void>> = {
@@ -62,6 +64,7 @@ export function useAccountManagementKeyboard({
62
64
  passwordAction: openPasswordDialog,
63
65
  upgradeAction: openUpgrade,
64
66
  cancelTrialAction: () => { void endTrial(); },
67
+ inviteCopyAction: copyInvite,
65
68
  assistantsAction: openAssistants,
66
69
  deleteAccountAction: () => { void deleteAccount(); },
67
70
  emailAlertsOffAction: () => { void turnOffEmailAlerts(); },
@@ -25,6 +25,7 @@ export type AccountFieldKey =
25
25
  | "emailAlertsOffAction"
26
26
  | "upgradeAction"
27
27
  | "cancelTrialAction"
28
+ | "inviteCopyAction"
28
29
  | "assistantsAction"
29
30
  | "passwordAction"
30
31
  | "deleteAccountAction";