@gloom-sh/terminal 0.20.14 → 0.20.16

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 (144) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/index.ts +54 -0
  3. package/src/api-client/install-experiments.ts +8 -7
  4. package/src/api-client/paths.ts +2 -1
  5. package/src/api-client/product-waitlist.ts +63 -0
  6. package/src/api-client/request.ts +4 -2
  7. package/src/api-client/types/billing.ts +45 -0
  8. package/src/api-client/yearly-plan.ts +132 -0
  9. package/src/app/global-shortcuts.ts +5 -3
  10. package/src/app/pane-runtime/index.tsx +2 -2
  11. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  12. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  13. package/src/app/since-last-visit/keys.ts +26 -0
  14. package/src/app/since-last-visit/model.ts +266 -0
  15. package/src/app/since-last-visit/strip.tsx +193 -0
  16. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  17. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  18. package/src/app.tsx +15 -0
  19. package/src/cli/commands/market.ts +8 -4
  20. package/src/cli/commands/system.ts +29 -1
  21. package/src/cli/commands/ticker.ts +12 -5
  22. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  23. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  24. package/src/cli/desktop-pane-shot-view.ts +3 -7
  25. package/src/cli/desktop-pane-shot.ts +26 -28
  26. package/src/cli/help.ts +1 -0
  27. package/src/cli/history-rows.ts +24 -0
  28. package/src/cli/index.ts +4 -0
  29. package/src/cli/options.ts +29 -1
  30. package/src/cli/pane-functions/catalog.ts +41 -4
  31. package/src/cli/pane-functions/function-help.ts +1 -1
  32. package/src/cli/pane-functions/headless.ts +63 -1
  33. package/src/cli/pane-functions/index.ts +2 -2
  34. package/src/cli/pane-functions/resolver.ts +43 -0
  35. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  36. package/src/cli/report-tables.ts +20 -5
  37. package/src/cli/shot-temp-dir.ts +30 -0
  38. package/src/cli/suffixed-listing-rows.ts +11 -0
  39. package/src/components/chart/composite/composite-chart.tsx +3 -3
  40. package/src/components/command-bar/commands/direct/index.ts +31 -8
  41. package/src/components/command-bar/commands/registry.ts +7 -0
  42. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  43. package/src/components/command-bar/routes/root/results.ts +16 -0
  44. package/src/components/company-logo.tsx +10 -3
  45. package/src/components/data-table/sections.ts +6 -1
  46. package/src/components/layout/pane/title.ts +6 -2
  47. package/src/components/layout/shell/index.tsx +5 -1
  48. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  49. package/src/components/ticker/badge/format.ts +12 -3
  50. package/src/components/ticker/badge/index.tsx +9 -3
  51. package/src/components/ticker/list-table-view.tsx +119 -17
  52. package/src/components/ui/data-table/display-columns.ts +16 -0
  53. package/src/components/ui/data-table/index.tsx +40 -9
  54. package/src/components/ui/data-table/types.ts +14 -0
  55. package/src/core/state/app/layout-reducer.ts +3 -1
  56. package/src/core/state/app/layout.ts +2 -2
  57. package/src/data/config/layout.ts +14 -0
  58. package/src/data/config/store/normalize.ts +11 -1
  59. package/src/i18n/es.ts +38 -0
  60. package/src/i18n/ja.ts +38 -0
  61. package/src/i18n/ko.ts +38 -0
  62. package/src/i18n/zh-cn.ts +38 -0
  63. package/src/i18n/zh-tw.ts +38 -0
  64. package/src/layout/pane-follow.ts +141 -4
  65. package/src/layout/pane-layout-move.ts +10 -7
  66. package/src/layout/ticker-navigation.ts +13 -19
  67. package/src/layout/ticker-retarget.ts +3 -2
  68. package/src/market-data/market/index-level.ts +19 -0
  69. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  70. package/src/plugins/builtin/account-management/model.ts +2 -0
  71. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  72. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  73. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  74. package/src/plugins/builtin/awards/pane.tsx +6 -8
  75. package/src/plugins/builtin/changelog/index.tsx +6 -44
  76. package/src/plugins/builtin/changelog/versions.ts +17 -68
  77. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  78. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  79. package/src/plugins/builtin/cpi/pane.tsx +1 -1
  80. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  81. package/src/plugins/builtin/earnings/board-table.ts +1 -1
  82. package/src/plugins/builtin/earnings/board.tsx +36 -16
  83. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  84. package/src/plugins/builtin/earnings/history-table.ts +1 -1
  85. package/src/plugins/builtin/earnings/index.tsx +1 -1
  86. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  87. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  88. package/src/plugins/builtin/exposure/index.tsx +1 -1
  89. package/src/plugins/builtin/macro-day/model.ts +6 -4
  90. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  91. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  92. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  93. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  94. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  95. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  96. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  97. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
  98. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  99. package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
  100. package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
  101. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  102. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  103. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  104. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  105. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  106. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  107. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  108. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  109. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  110. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  111. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  112. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  113. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  114. package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
  115. package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
  116. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  117. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  118. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  119. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  120. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  121. package/src/portfolio/column-values.ts +20 -8
  122. package/src/portfolio/suffixed-listings.ts +3 -1
  123. package/src/portfolio/watchlist-groups.ts +212 -0
  124. package/src/react/ticker-source.ts +3 -1
  125. package/src/renderers/dom/styles.css +7 -0
  126. package/src/state/app/bootstrap.ts +11 -0
  127. package/src/state/app/context/index.tsx +6 -0
  128. package/src/sync/collections-contributor.ts +5 -2
  129. package/src/sync/config-merge.ts +10 -2
  130. package/src/sync/sanitize.ts +28 -0
  131. package/src/telemetry/usage-counts.ts +17 -0
  132. package/src/time-series/chart-seed.ts +1 -1
  133. package/src/time-series/financial-period-coverage.ts +4 -12
  134. package/src/time-series/parsed-history-cache.ts +1 -1
  135. package/src/time-series/resolve.ts +1 -1
  136. package/src/time-series/use-chart-resolution.ts +6 -1
  137. package/src/types/config.ts +32 -0
  138. package/src/types/headless.ts +5 -0
  139. package/src/types/plugin-context.ts +5 -0
  140. package/src/types/ticker.ts +14 -0
  141. package/src/ui/ascii-font.ts +1 -4
  142. package/src/utils/async-deadline.ts +2 -2
  143. package/src/utils/csv.ts +44 -5
  144. package/src/utils/futures-generic.ts +3 -0
package/src/i18n/ko.ts CHANGED
@@ -15,6 +15,7 @@ export const ko: Record<string, string> = {
15
15
  "Linked to {source}": "{source}에 연결됨",
16
16
  "Link to {source}": "{source}에 연결",
17
17
  "Unlink from {source}": "{source} 연결 해제",
18
+ "Unlinked": "연결 해제됨",
18
19
  "Working…": "처리 중…",
19
20
  "Searching…": "검색 중…",
20
21
  "Loading...": "불러오는 중...",
@@ -775,6 +776,43 @@ export const ko: Record<string, string> = {
775
776
  "Status": "상태",
776
777
  "Manage Pro": "Pro 관리",
777
778
  "Opening...": "여는 중...",
779
+ "Payment": "결제",
780
+ "Pay invoice": "청구서 결제",
781
+ "Your Pro payment did not go through.": "Pro 결제가 완료되지 않았습니다.",
782
+ "Could not refresh your account. Try again.": "계정을 새로고침하지 못했습니다. 다시 시도해 주세요.",
783
+ "Could not open invoice payment. Try again.": "청구서 결제 화면을 열지 못했습니다. 다시 시도해 주세요.",
784
+ "Invoice opened in your browser.": "브라우저에서 청구서를 열었습니다.",
785
+ "Yearly is {yearly} a year, {savings} less than twelve monthly payments of {monthly} ({twelve}).": "연간 요금은 연 {yearly}로, 월 {monthly}씩 12번 내는 금액({twelve})보다 {savings} 저렴합니다.",
786
+ "The total changed since you reviewed it. Review it again.": "검토한 이후 총액이 변경되었습니다. 다시 검토해 주세요.",
787
+ "This total has expired. Review it again.": "이 총액은 만료되었습니다. 다시 검토해 주세요.",
788
+ "This review is no longer valid. Review the switch again.": "이 검토는 더 이상 유효하지 않습니다. 전환을 다시 검토해 주세요.",
789
+ "Your switch is already going through. Refresh in a moment.": "전환이 이미 진행 중입니다. 잠시 후 새로고침해 주세요.",
790
+ "Your switch to yearly is waiting for its payment.": "연간 요금 전환이 결제를 기다리고 있습니다.",
791
+ "Yearly billing can't be set up for this plan here. Your plan is unchanged.": "이 요금제는 여기서 연간 결제를 설정할 수 없습니다. 요금제는 변경되지 않았습니다.",
792
+ "The switch didn't go through and your plan is unchanged. Try again in a minute.": "전환이 완료되지 않았으며 요금제는 변경되지 않았습니다. 잠시 후 다시 시도해 주세요.",
793
+ "We couldn't confirm the switch. Refresh your account before trying again.": "전환을 확인하지 못했습니다. 다시 시도하기 전에 계정을 새로고침해 주세요.",
794
+ "Couldn't work out the yearly total. Try again in a minute.": "연간 총액을 계산하지 못했습니다. 잠시 후 다시 시도해 주세요.",
795
+ "Yearly Pro, today to {date}": "연간 Pro, 오늘부터 {date}까지",
796
+ "Credit for the rest of this month": "이번 달 남은 기간 크레딧",
797
+ "Tax": "세금",
798
+ "Account credit": "계정 크레딧",
799
+ "Due today": "오늘 결제 금액",
800
+ "Then {amount} a year plus tax, renewing {date}.": "이후 연 {amount}(세금 별도), {date}에 갱신됩니다.",
801
+ "Then {amount} a year, renewing {date}.": "이후 연 {amount}, {date}에 갱신됩니다.",
802
+ "Your switch to yearly needs the payment confirmed. You stay on monthly billing until it is paid.": "연간 요금 전환에는 결제 확인이 필요합니다. 결제될 때까지 월간 결제가 유지됩니다.",
803
+ "Unpaid by {date}, the switch is dropped.": "{date}까지 결제되지 않으면 전환이 취소됩니다.",
804
+ "Your payment is processing. You move to yearly billing once it clears.": "결제를 처리하고 있습니다. 완료되면 연간 결제로 전환됩니다.",
805
+ "You're on yearly billing.": "연간 결제로 전환되었습니다.",
806
+ "Paid {amount} today.": "오늘 {amount}를 결제했습니다.",
807
+ "Renews {date} at {amount}.": "{date}에 {amount}로 갱신됩니다.",
808
+ "Review Yearly": "연간 요금 검토",
809
+ "Switch to yearly billing": "연간 결제로 전환",
810
+ "Your saved payment method is charged today, and your plan stays monthly until it is paid.": "저장된 결제 수단으로 오늘 청구되며, 결제될 때까지 요금제는 월간으로 유지됩니다.",
811
+ "Switching...": "전환 중...",
812
+ "Pay {amount} and Switch": "{amount} 결제하고 전환",
813
+ "Switch to Yearly": "연간으로 전환",
814
+ "Not Now": "나중에",
815
+ "Confirm Payment": "결제 확인",
778
816
  "Upgrade to Pro": "Pro로 업그레이드",
779
817
  "Change Password": "비밀번호 변경",
780
818
  "Delete Account": "계정 삭제",
package/src/i18n/zh-cn.ts CHANGED
@@ -17,6 +17,7 @@ export const zhCN: Record<string, string> = {
17
17
  "Linked to {source}": "已链接到 {source}",
18
18
  "Link to {source}": "链接到 {source}",
19
19
  "Unlink from {source}": "取消链接 {source}",
20
+ "Unlinked": "已取消链接",
20
21
  "Working…": "处理中…",
21
22
  "Searching…": "搜索中…",
22
23
  "Loading...": "加载中...",
@@ -777,6 +778,43 @@ export const zhCN: Record<string, string> = {
777
778
  "Status": "状态",
778
779
  "Manage Pro": "管理 Pro",
779
780
  "Opening...": "正在打开...",
781
+ "Payment": "付款",
782
+ "Pay invoice": "支付账单",
783
+ "Your Pro payment did not go through.": "Pro 付款未成功。",
784
+ "Could not refresh your account. Try again.": "无法刷新账户,请重试。",
785
+ "Could not open invoice payment. Try again.": "无法打开账单付款页面,请重试。",
786
+ "Invoice opened in your browser.": "已在浏览器中打开账单。",
787
+ "Yearly is {yearly} a year, {savings} less than twelve monthly payments of {monthly} ({twelve}).": "年付为每年 {yearly},比按月付款 12 次(每次 {monthly},共 {twelve})少 {savings}。",
788
+ "The total changed since you reviewed it. Review it again.": "查看后总额已变化。请重新查看。",
789
+ "This total has expired. Review it again.": "此总额已过期。请重新查看。",
790
+ "This review is no longer valid. Review the switch again.": "此确认已失效。请重新查看切换。",
791
+ "Your switch is already going through. Refresh in a moment.": "切换正在处理中。请稍后刷新。",
792
+ "Your switch to yearly is waiting for its payment.": "年付切换正在等待付款。",
793
+ "Yearly billing can't be set up for this plan here. Your plan is unchanged.": "无法在此为该方案设置年付。方案未变。",
794
+ "The switch didn't go through and your plan is unchanged. Try again in a minute.": "切换未成功,方案未变。请一分钟后重试。",
795
+ "We couldn't confirm the switch. Refresh your account before trying again.": "无法确认切换。请先刷新账户再重试。",
796
+ "Couldn't work out the yearly total. Try again in a minute.": "无法计算年付总额。请一分钟后重试。",
797
+ "Yearly Pro, today to {date}": "年付 Pro,今天至 {date}",
798
+ "Credit for the rest of this month": "本月剩余时间的抵扣",
799
+ "Tax": "税费",
800
+ "Account credit": "账户余额",
801
+ "Due today": "今日应付",
802
+ "Then {amount} a year plus tax, renewing {date}.": "之后每年 {amount}(另加税费),于 {date} 续订。",
803
+ "Then {amount} a year, renewing {date}.": "之后每年 {amount},于 {date} 续订。",
804
+ "Your switch to yearly needs the payment confirmed. You stay on monthly billing until it is paid.": "年付切换需要确认付款。付款完成前仍按月计费。",
805
+ "Unpaid by {date}, the switch is dropped.": "如在 {date} 前未付款,切换将被取消。",
806
+ "Your payment is processing. You move to yearly billing once it clears.": "付款正在处理中。完成后将改为年付。",
807
+ "You're on yearly billing.": "已改为年付。",
808
+ "Paid {amount} today.": "今日已付 {amount}。",
809
+ "Renews {date} at {amount}.": "将于 {date} 以 {amount} 续订。",
810
+ "Review Yearly": "查看年付",
811
+ "Switch to yearly billing": "切换为年付",
812
+ "Your saved payment method is charged today, and your plan stays monthly until it is paid.": "今天将从已保存的付款方式扣款,付款完成前方案仍按月计费。",
813
+ "Switching...": "正在切换...",
814
+ "Pay {amount} and Switch": "支付 {amount} 并切换",
815
+ "Switch to Yearly": "改为年付",
816
+ "Not Now": "暂不",
817
+ "Confirm Payment": "确认付款",
780
818
  "Upgrade to Pro": "升级到 Pro",
781
819
  "Change Password": "修改密码",
782
820
  "Delete Account": "删除账户",
package/src/i18n/zh-tw.ts CHANGED
@@ -17,6 +17,7 @@ export const zhTW: Record<string, string> = {
17
17
  "Linked to {source}": "已連結至 {source}",
18
18
  "Link to {source}": "連結至 {source}",
19
19
  "Unlink from {source}": "取消連結 {source}",
20
+ "Unlinked": "已取消連結",
20
21
  "Working…": "處理中…",
21
22
  "Searching…": "搜尋中…",
22
23
  "Loading...": "載入中...",
@@ -777,6 +778,43 @@ export const zhTW: Record<string, string> = {
777
778
  "Status": "狀態",
778
779
  "Manage Pro": "管理 Pro",
779
780
  "Opening...": "正在開啟...",
781
+ "Payment": "付款",
782
+ "Pay invoice": "支付帳單",
783
+ "Your Pro payment did not go through.": "Pro 付款未成功。",
784
+ "Could not refresh your account. Try again.": "無法重新整理帳戶,請重試。",
785
+ "Could not open invoice payment. Try again.": "無法開啟帳單付款頁面,請重試。",
786
+ "Invoice opened in your browser.": "已在瀏覽器中開啟帳單。",
787
+ "Yearly is {yearly} a year, {savings} less than twelve monthly payments of {monthly} ({twelve}).": "年繳為每年 {yearly},比按月付款 12 次(每次 {monthly},共 {twelve})少 {savings}。",
788
+ "The total changed since you reviewed it. Review it again.": "檢視後總額已變更。請重新檢視。",
789
+ "This total has expired. Review it again.": "此總額已過期。請重新檢視。",
790
+ "This review is no longer valid. Review the switch again.": "此確認已失效。請重新檢視切換。",
791
+ "Your switch is already going through. Refresh in a moment.": "切換正在處理中。請稍後重新整理。",
792
+ "Your switch to yearly is waiting for its payment.": "年繳切換正在等待付款。",
793
+ "Yearly billing can't be set up for this plan here. Your plan is unchanged.": "無法在此為此方案設定年繳。方案未變更。",
794
+ "The switch didn't go through and your plan is unchanged. Try again in a minute.": "切換未成功,方案未變更。請一分鐘後再試。",
795
+ "We couldn't confirm the switch. Refresh your account before trying again.": "無法確認切換。請先重新整理帳戶再試。",
796
+ "Couldn't work out the yearly total. Try again in a minute.": "無法計算年繳總額。請一分鐘後再試。",
797
+ "Yearly Pro, today to {date}": "年繳 Pro,今天至 {date}",
798
+ "Credit for the rest of this month": "本月剩餘期間的折抵",
799
+ "Tax": "稅金",
800
+ "Account credit": "帳戶餘額",
801
+ "Due today": "今日應付",
802
+ "Then {amount} a year plus tax, renewing {date}.": "之後每年 {amount}(另加稅金),於 {date} 續訂。",
803
+ "Then {amount} a year, renewing {date}.": "之後每年 {amount},於 {date} 續訂。",
804
+ "Your switch to yearly needs the payment confirmed. You stay on monthly billing until it is paid.": "年繳切換需要確認付款。付款完成前仍按月計費。",
805
+ "Unpaid by {date}, the switch is dropped.": "若在 {date} 前未付款,切換將被取消。",
806
+ "Your payment is processing. You move to yearly billing once it clears.": "付款正在處理中。完成後將改為年繳。",
807
+ "You're on yearly billing.": "已改為年繳。",
808
+ "Paid {amount} today.": "今日已付 {amount}。",
809
+ "Renews {date} at {amount}.": "將於 {date} 以 {amount} 續訂。",
810
+ "Review Yearly": "檢視年繳",
811
+ "Switch to yearly billing": "切換為年繳",
812
+ "Your saved payment method is charged today, and your plan stays monthly until it is paid.": "今天將從已儲存的付款方式扣款,付款完成前方案仍按月計費。",
813
+ "Switching...": "正在切換...",
814
+ "Pay {amount} and Switch": "支付 {amount} 並切換",
815
+ "Switch to Yearly": "改為年繳",
816
+ "Not Now": "暫不",
817
+ "Confirm Payment": "確認付款",
780
818
  "Upgrade to Pro": "升級到 Pro",
781
819
  "Change Password": "修改密碼",
782
820
  "Delete Account": "刪除帳戶",
@@ -1,4 +1,13 @@
1
- import { TICKER_RESEARCH_PANE_ID, type PaneInstanceConfig } from "../types/config";
1
+ // Only types and the layout model: the public share page bundles this module, and the pane
2
+ // manager and ticker navigation would bring the app (and its signed-in clients) in with it.
3
+ import {
4
+ findPaneInstance,
5
+ getPlacedPaneInstanceIds,
6
+ TICKER_RESEARCH_PANE_ID,
7
+ type LayoutConfig,
8
+ type PaneInstanceConfig,
9
+ type PaneUnlinkedFrom,
10
+ } from "../types/config";
2
11
  import type { BrokerContractRef } from "../types/instrument";
3
12
 
4
13
  const PANE_TITLE_MNEMONIC = /^([A-Z][A-Z0-9]{0,7})(?=\s|$)/;
@@ -25,24 +34,152 @@ export function pinnedTitle(instance: PaneInstanceConfig, pinned: string): strin
25
34
  return !rest || TITLE_TICKER.test(rest) ? `${mnemonic} ${pinned}` : null;
26
35
  }
27
36
 
37
+ /** True when `fromInstanceId`'s follow chain reaches `targetInstanceId`. */
38
+ export function followBindingReaches(
39
+ layout: LayoutConfig,
40
+ fromInstanceId: string,
41
+ targetInstanceId: string,
42
+ seen = new Set<string>(),
43
+ ): boolean {
44
+ if (seen.has(fromInstanceId)) return false;
45
+ seen.add(fromInstanceId);
46
+ const instance = findPaneInstance(layout, fromInstanceId);
47
+ if (instance?.binding?.kind !== "follow") return false;
48
+ const next = instance.binding.sourceInstanceId;
49
+ return next === targetInstanceId || followBindingReaches(layout, next, targetInstanceId, seen);
50
+ }
51
+
52
+ /** Who cut a follower's link, and the kind of pane it followed (`PaneUnlinkedFrom`). */
53
+ interface PaneUnlink {
54
+ /** The app, not the user: the source closed or left the layout, or another research pane took it. */
55
+ auto?: boolean;
56
+ sourcePaneId?: string | null;
57
+ }
58
+
59
+ /** What a pin that cuts `instance`'s link records of it; none when it follows nothing. */
60
+ function unlinkedFrom(instance: PaneInstanceConfig, unlink: PaneUnlink): PaneUnlinkedFrom | undefined {
61
+ if (instance.binding?.kind !== "follow") return undefined;
62
+ return {
63
+ instanceId: instance.binding.sourceInstanceId,
64
+ ...(unlink.sourcePaneId ? { paneId: unlink.sourcePaneId } : {}),
65
+ ...(unlink.auto ? { auto: true as const } : {}),
66
+ };
67
+ }
68
+
69
+ /**
70
+ * What a ticker the user picks for `instance` (ticker search, a ticker link in it) records: the
71
+ * link that takes it off, or the one an earlier pin cut, now the user's own pin. A pane the app
72
+ * pinned stops following its source back once the user has chosen what it shows.
73
+ */
74
+ export function userUnlinkedFrom(instance: PaneInstanceConfig, layout: LayoutConfig): PaneUnlinkedFrom | undefined {
75
+ if (instance.binding?.kind === "follow") {
76
+ return unlinkedFrom(instance, { sourcePaneId: findPaneInstance(layout, instance.binding.sourceInstanceId)?.paneId });
77
+ }
78
+ const earlier = instance.unlinkedFrom;
79
+ return earlier && { instanceId: earlier.instanceId, ...(earlier.paneId ? { paneId: earlier.paneId } : {}) };
80
+ }
81
+
82
+ /** A follower its link left, which its title marks until it follows a pane again. */
83
+ export function isUnlinkedFollower(instance: PaneInstanceConfig): boolean {
84
+ return !!instance.unlinkedFrom && instance.binding?.kind !== "follow";
85
+ }
86
+
87
+ /** `instance` following `sourceInstanceId`, with no record of an older link. */
88
+ export function linkFollower(instance: PaneInstanceConfig, sourceInstanceId: string): PaneInstanceConfig {
89
+ const { unlinkedFrom: _unlinkedFrom, ...rest } = instance;
90
+ return { ...rest, binding: { kind: "follow", sourceInstanceId } };
91
+ }
92
+
28
93
  /**
29
94
  * Pins a follower on the symbol it shows (unlink, a closed source, a single-pane share), or
30
95
  * unbinds it when nothing resolved, retitled to name that symbol. Ticker Research computes its
31
- * own title and is never retitled.
96
+ * own title and is never retitled. `unlink` records the link it cuts (`PaneUnlinkedFrom`); a
97
+ * shared pane leaves without one.
32
98
  */
33
99
  export function pinFollowingPane(
34
100
  instance: PaneInstanceConfig,
35
101
  symbol: string | null | undefined,
36
102
  instrument?: BrokerContractRef | null,
103
+ unlink?: PaneUnlink,
37
104
  ): PaneInstanceConfig {
105
+ const left = unlink ? unlinkedFrom(instance, unlink) : undefined;
106
+ const cut = left ? { ...instance, unlinkedFrom: left } : instance;
38
107
  const pinned = symbol?.trim();
39
- if (!pinned) return { ...instance, binding: { kind: "none" } };
108
+ if (!pinned) return { ...cut, binding: { kind: "none" } };
40
109
  const title = pinnedTitle(instance, pinned);
41
110
  return {
42
- ...instance,
111
+ ...cut,
43
112
  // Only a broker contract is worth keeping: a derived public `null` would stop the pinned pane
44
113
  // matching `T AAPL` reuse, which tells null and unspecified contracts apart.
45
114
  binding: { kind: "fixed", symbol: pinned, ...(instrument ? { instrument } : {}) },
46
115
  ...(title ? { title } : {}),
47
116
  };
48
117
  }
118
+
119
+ /**
120
+ * `normalizePaneLayout`'s `pinOrphan` for the app: a follower whose source is gone is pinned
121
+ * by the app, naming the kind of pane it followed from `previous`, the layout before the change.
122
+ */
123
+ export function pinOrphanedFollower(
124
+ previous: LayoutConfig,
125
+ ): (instance: PaneInstanceConfig, symbol: string | null) => PaneInstanceConfig {
126
+ return (instance, symbol) => {
127
+ const sourceId = instance.binding?.kind === "follow" ? instance.binding.sourceInstanceId : null;
128
+ const sourcePaneId = sourceId ? findPaneInstance(previous, sourceId)?.paneId : undefined;
129
+ return pinFollowingPane(instance, symbol, undefined, { auto: true, sourcePaneId });
130
+ };
131
+ }
132
+
133
+ /**
134
+ * A research pane the app pinned (`PaneUnlinkedFrom.auto`) follows again once a source is free
135
+ * for it in `layout`: the pane it followed, back with no research pane following it (the one
136
+ * that took it closed, or moved on), or, while that pane is gone, one of its kind that `layout`
137
+ * adds to `previous` with none (a portfolio closed and opened again). A list that was already
138
+ * there when the link was cut does not take the pane away from its ticker. A pane the user
139
+ * unlinked, or gave a ticker of its own, stays pinned.
140
+ */
141
+ export function relinkPinnedResearchPanes(layout: LayoutConfig, previous: LayoutConfig): LayoutConfig {
142
+ if (!layout.instances.some((pane) => pane.unlinkedFrom?.auto)) return layout;
143
+ // Relinking moves no pane, so what is placed stays as `layout` has it.
144
+ const placed = new Set(getPlacedPaneInstanceIds(layout));
145
+ let next = layout;
146
+ for (const pane of layout.instances) {
147
+ const from = pane.unlinkedFrom;
148
+ if (
149
+ pane.paneId !== TICKER_RESEARCH_PANE_ID
150
+ || !from?.auto
151
+ || pane.binding?.kind === "follow"
152
+ || !placed.has(pane.instanceId)
153
+ ) continue;
154
+ const hasResearch = (sourceId: string) => next.instances.some((instance) => (
155
+ instance.paneId === TICKER_RESEARCH_PANE_ID
156
+ && instance.binding?.kind === "follow"
157
+ && instance.binding.sourceInstanceId === sourceId
158
+ && placed.has(instance.instanceId)
159
+ ));
160
+ const free = (candidate: PaneInstanceConfig) => (
161
+ candidate.instanceId !== pane.instanceId
162
+ && placed.has(candidate.instanceId)
163
+ && !hasResearch(candidate.instanceId)
164
+ && !followBindingReaches(next, candidate.instanceId, pane.instanceId)
165
+ );
166
+ const original = findPaneInstance(next, from.instanceId);
167
+ const source = original
168
+ ? (free(original) ? original : undefined)
169
+ : from.paneId
170
+ ? next.instances.find((candidate) => (
171
+ candidate.paneId === from.paneId
172
+ && !findPaneInstance(previous, candidate.instanceId)
173
+ && free(candidate)
174
+ ))
175
+ : undefined;
176
+ if (!source) continue;
177
+ next = {
178
+ ...next,
179
+ instances: next.instances.map((instance) => (
180
+ instance.instanceId === pane.instanceId ? linkFollower(instance, source.instanceId) : instance
181
+ )),
182
+ };
183
+ }
184
+ return next;
185
+ }
@@ -11,7 +11,7 @@ import {
11
11
  type PaneMovedFrom,
12
12
  type PaneMovedLink,
13
13
  } from "../types/config";
14
- import { pinFollowingPane } from "./pane-follow";
14
+ import { linkFollower, pinOrphanedFollower } from "./pane-follow";
15
15
  import { findDockLeaf, getNodeAtPath, getRepresentativeLeafId } from "./pane-manager/dock-tree";
16
16
  import { dockPane, insertAtRootEdge, resizeSplitAtPath } from "./pane-manager/docking";
17
17
  import { floatAtRect } from "./pane-manager/floating-actions";
@@ -68,20 +68,23 @@ function movedLink(before: PaneInstanceConfig, after: PaneInstanceConfig, symbol
68
68
 
69
69
  /**
70
70
  * Pins every pane whose link source is gone on the ticker it showed, the way
71
- * closing that source does, and says which links were cut.
71
+ * closing that source does, and says which links were cut. `previous` is the
72
+ * layout the source left.
72
73
  */
73
74
  function pinOrphanedFollowers(
74
75
  layout: LayoutConfig,
76
+ previous: LayoutConfig,
75
77
  resolveSymbol: ResolvePaneSymbol,
76
78
  ): { layout: LayoutConfig; links: PaneMovedLink[] } {
77
79
  const ids = new Set(layout.instances.map((instance) => instance.instanceId));
80
+ const pin = pinOrphanedFollower(previous);
78
81
  const links: PaneMovedLink[] = [];
79
82
  let changed = false;
80
83
  const instances = layout.instances.map((instance) => {
81
84
  if (instance.binding?.kind !== "follow" || ids.has(instance.binding.sourceInstanceId)) return instance;
82
85
  changed = true;
83
86
  const symbol = resolveSymbol(instance.instanceId)?.trim() || null;
84
- const pinned = pinFollowingPane(instance, symbol);
87
+ const pinned = pin(instance, symbol);
85
88
  if (symbol) links.push(movedLink(instance, pinned, symbol));
86
89
  return pinned;
87
90
  });
@@ -132,14 +135,14 @@ export function movePaneToOwnLayout(
132
135
  const floating: FloatingPlacementMemory | undefined = floatingEntry
133
136
  ? { x: floatingEntry.x, y: floatingEntry.y, width: floatingEntry.width, height: floatingEntry.height }
134
137
  : undefined;
135
- const left = pinOrphanedFollowers(removePane(layout, paneId), resolveSymbol);
138
+ const left = pinOrphanedFollowers(removePane(layout, paneId), layout, resolveSymbol);
136
139
 
137
140
  // Alone in its layout the pane has nothing to follow, so it keeps the ticker it shows.
138
141
  let moved: PaneInstanceConfig = instance;
139
142
  const links: PaneMovedLink[] = [];
140
143
  if (instance.binding?.kind === "follow") {
141
144
  const symbol = resolveSymbol(paneId)?.trim() || null;
142
- moved = pinFollowingPane(instance, symbol);
145
+ moved = pinOrphanedFollower(layout)(instance, symbol);
143
146
  if (symbol) links.push(movedLink(instance, moved, symbol));
144
147
  }
145
148
  links.push(...left.links);
@@ -223,7 +226,7 @@ function relink(layout: LayoutConfig, links: readonly PaneMovedLink[]): LayoutCo
223
226
  ...next,
224
227
  instances: next.instances.map((entry) => (
225
228
  entry.instanceId === link.instanceId
226
- ? { ...entry, binding: { kind: "follow", sourceInstanceId: link.sourceInstanceId }, ...("title" in link ? { title: link.title } : {}) }
229
+ ? { ...linkFollower(entry, link.sourceInstanceId), ...("title" in link ? { title: link.title } : {}) }
227
230
  : entry
228
231
  )),
229
232
  };
@@ -246,7 +249,7 @@ export function movePaneBack(
246
249
  const instance = findPaneInstance(layout, paneId);
247
250
  const movedFrom = instance?.movedFrom;
248
251
  if (!instance || !movedFrom) return null;
249
- const left = pinOrphanedFollowers(removePane(layout, paneId), resolveSymbol).layout;
252
+ const left = pinOrphanedFollowers(removePane(layout, paneId), layout, resolveSymbol).layout;
250
253
  const { movedFrom: _movedFrom, ...returning } = instance;
251
254
  // A copy an undo put back in the target gives way to the pane coming home.
252
255
  const base = findPaneInstance(target, paneId) ? removePane(target, paneId) : target;
@@ -45,21 +45,6 @@ export function isTickerLinkPeer(
45
45
  return instance.paneId === TICKER_RESEARCH_PANE_ID || canFollowTickerSource(instance, panes);
46
46
  }
47
47
 
48
- /** True when `fromInstanceId`'s follow chain reaches `targetInstanceId`. */
49
- export function followBindingReaches(
50
- layout: LayoutConfig,
51
- fromInstanceId: string,
52
- targetInstanceId: string,
53
- seen = new Set<string>(),
54
- ): boolean {
55
- if (seen.has(fromInstanceId)) return false;
56
- seen.add(fromInstanceId);
57
- const instance = findPaneInstance(layout, fromInstanceId);
58
- if (instance?.binding?.kind !== "follow") return false;
59
- const next = instance.binding.sourceInstanceId;
60
- return next === targetInstanceId || followBindingReaches(layout, next, targetInstanceId, seen);
61
- }
62
-
63
48
  /** The visible Ticker Research pane that follows `sourceInstanceId`, if any. */
64
49
  export function findTickerResearchFollower(
65
50
  layout: LayoutConfig,
@@ -75,17 +60,26 @@ export function findTickerResearchFollower(
75
60
  }
76
61
 
77
62
  /**
78
- * Enter opens the follower already bound to the source pane; Shift+Enter (`newPane`) and sources
79
- * without a follower fall back to opening a ticker pane.
63
+ * Enter focuses the follower already bound to the source pane. A source without one opens the
64
+ * ticker in a research pane, reusing a pinned one rather than stacking another: the one the app
65
+ * unlinked (`PaneUnlinkedFrom.auto`), else the only one the layout has. Shift+Enter (`newPane`)
66
+ * opens a new pane.
80
67
  */
81
68
  export function resolveTickerActivation(
82
69
  layout: LayoutConfig,
83
70
  sourcePaneId: string | null | undefined,
84
71
  options?: { newPane?: boolean },
85
- ): { kind: "focus"; paneId: string } | { kind: "open" } {
72
+ ): { kind: "focus"; paneId: string } | { kind: "open"; reusePaneId?: string } {
86
73
  if (options?.newPane) return { kind: "open" };
87
74
  const follower = findTickerResearchFollower(layout, sourcePaneId);
88
- return follower ? { kind: "focus", paneId: follower.instanceId } : { kind: "open" };
75
+ if (follower) return { kind: "focus", paneId: follower.instanceId };
76
+ const pinned = layout.instances.filter((instance) => (
77
+ instance.paneId === TICKER_RESEARCH_PANE_ID
78
+ && instance.binding?.kind === "fixed"
79
+ && isPaneInLayout(layout, instance.instanceId)
80
+ ));
81
+ const reuse = pinned.find((instance) => instance.unlinkedFrom?.auto) ?? (pinned.length === 1 ? pinned[0] : undefined);
82
+ return reuse ? { kind: "open", reusePaneId: reuse.instanceId } : { kind: "open" };
89
83
  }
90
84
 
91
85
  export function resolveTickerNavigationReplacementPane(
@@ -8,7 +8,7 @@ import {
8
8
  import type { BrokerContractRef, TickerListingRef } from "../types/instrument";
9
9
  import type { PaneDef } from "../types/plugin";
10
10
  import { tickerInstrumentLabel } from "../tickers/instrument-label";
11
- import { pinnedTitle } from "./pane-follow";
11
+ import { pinnedTitle, userUnlinkedFrom } from "./pane-follow";
12
12
  import { isPaneInLayout } from "./pane-manager";
13
13
  import { isTickerLinkPeer } from "./ticker-navigation";
14
14
 
@@ -79,7 +79,8 @@ export function retargetTickerPane(
79
79
  };
80
80
  const research = target.paneId === TICKER_RESEARCH_PANE_ID;
81
81
  const title = research ? tickerInstrumentLabel(symbol, instrument) : pinnedTitle(target, symbol);
82
- const pinned: PaneInstanceConfig = { ...target, binding, ...(title ? { title } : {}) };
82
+ const unlinkedFrom = userUnlinkedFrom(target, layout);
83
+ const pinned: PaneInstanceConfig = { ...target, binding, ...(title ? { title } : {}), ...(unlinkedFrom ? { unlinkedFrom } : {}) };
83
84
  const next = paneDef?.retargetTicker?.(pinned, symbol, previous) ?? pinned;
84
85
  return {
85
86
  ...layout,
@@ -1,6 +1,7 @@
1
1
  import { classifyInstrumentType, isCryptoVenuePerpetual } from "../../tickers/instrument-kind";
2
2
  import type { PriceBasis } from "../../types/instrument";
3
3
  import type { MarketState, Quote } from "../../types/financials";
4
+ import { isRoundTheClockCoin } from "../../utils/crypto-pair";
4
5
 
5
6
  /**
6
7
  * The unit an index level is in, as a chart's axis and series name it. A
@@ -89,3 +90,21 @@ export function reportedQuoteVolume(
89
90
  if (volume === 0 && (isIndexLevel(quote!.instrumentType) || isCryptoVenuePerpetual(quote!.instrumentType, quote!.name))) return null;
90
91
  return volume;
91
92
  }
93
+
94
+ /**
95
+ * The currency a quote's volume is a value in, where it is one: a coin's is
96
+ * the value traded in its quote currency (BTC-USD's in US dollars), whether it
97
+ * is the composite's or one exchange's day, as its bars' and the crypto
98
+ * board's are, never a count of coins. Null for a listing that counts shares
99
+ * or contracts, and for a quote that names no currency. `symbol` and
100
+ * `exchange` stand in for a quote that names no listing.
101
+ */
102
+ export function quoteVolumeCurrency(
103
+ quote: { symbol?: string | null; exchangeName?: string | null; currency?: string | null } | null | undefined,
104
+ symbol?: string,
105
+ exchange?: string,
106
+ ): string | null {
107
+ const currency = quote?.currency?.trim();
108
+ if (!currency) return null;
109
+ return isRoundTheClockCoin(quote?.symbol || symbol, quote?.exchangeName || exchange) ? currency : null;
110
+ }
@@ -37,6 +37,8 @@ export function useAccountManagementKeyboard({
37
37
  endTrial,
38
38
  copyInvite,
39
39
  turnOffEmailAlerts,
40
+ yearlyPlanAction,
41
+ dismissYearlyReview,
40
42
  }: {
41
43
  activeField: AccountFieldKey;
42
44
  cyclePortfolio: (delta: number) => void;
@@ -57,6 +59,10 @@ export function useAccountManagementKeyboard({
57
59
  endTrial: () => Promise<void>;
58
60
  copyInvite: () => void;
59
61
  turnOffEmailAlerts: () => Promise<void>;
62
+ /** The yearly row's action: review, pay or open the invoice. */
63
+ yearlyPlanAction: () => void;
64
+ /** Closes the yearly review while it is open, else null. */
65
+ dismissYearlyReview: (() => void) | null;
60
66
  }): FieldRing<AccountFieldKey> {
61
67
  const actions: Partial<Record<AccountFieldKey, () => void>> = {
62
68
  sharedPortfolioId: () => { void openPortfolioDialog(); },
@@ -68,6 +74,8 @@ export function useAccountManagementKeyboard({
68
74
  assistantsAction: openAssistants,
69
75
  deleteAccountAction: () => { void deleteAccount(); },
70
76
  emailAlertsOffAction: () => { void turnOffEmailAlerts(); },
77
+ yearlyPlanAction,
78
+ yearlyPlanDismissAction: () => dismissYearlyReview?.(),
71
79
  };
72
80
  for (const key of TOGGLE_FIELDS) actions[key] = () => setDraftValue(key, !draftRef.current[key]);
73
81
 
@@ -91,6 +99,12 @@ export function useAccountManagementKeyboard({
91
99
  void saveProfile();
92
100
  return;
93
101
  }
102
+ // Esc closes the yearly review, as Cancel does a form.
103
+ if (dismissYearlyReview && !event.targetEditable && isPlainKey(event, "escape")) {
104
+ consume();
105
+ dismissYearlyReview();
106
+ return;
107
+ }
94
108
  if (event.targetEditable || activeField !== "sharedPortfolioId") return;
95
109
  if (isPlainKey(event, "left", "h", "[")) {
96
110
  consume();
@@ -24,6 +24,8 @@ export type AccountFieldKey =
24
24
  | "chatEmailNotificationsEnabled"
25
25
  | "emailAlertsOffAction"
26
26
  | "upgradeAction"
27
+ | "yearlyPlanAction"
28
+ | "yearlyPlanDismissAction"
27
29
  | "cancelTrialAction"
28
30
  | "inviteCopyAction"
29
31
  | "assistantsAction"