@gloom-sh/terminal 0.20.12 → 0.20.14
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.
- package/package.json +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
- package/src/account/auth-dialog.tsx +22 -4
- package/src/account/auth-form.tsx +6 -1
- package/src/account/billing.ts +3 -2
- package/src/account/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/account/upgrade-dialog.tsx +8 -8
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +10 -2
- package/src/api-client/install-experiments.ts +146 -0
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/request.ts +12 -2
- package/src/api-client/telemetry.ts +47 -0
- package/src/api-client/types/market.ts +4 -0
- package/src/api-client/types/news.ts +16 -0
- package/src/architecture/floating-promise-allowlist.json +17 -34
- package/src/brokers/signed-in/adapter.ts +2 -2
- package/src/brokers/signed-in/catalog.ts +13 -4
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +146 -55
- package/src/cli/commands/overview.ts +21 -7
- package/src/cli/commands/search.ts +103 -9
- package/src/cli/commands/ticker.ts +22 -13
- package/src/cli/earnings-calendar.ts +33 -53
- package/src/cli/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +11 -2
- package/src/cli/listing-arg.ts +183 -28
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/catalog.ts +81 -12
- package/src/cli/pane-functions/dom.ts +8 -1
- package/src/cli/pane-functions/freshness.ts +2 -2
- package/src/cli/pane-functions/headless.ts +13 -10
- package/src/cli/pane-functions/index.ts +1 -1
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/report.ts +4 -1
- package/src/cli/pane-functions/resolver.ts +61 -15
- package/src/cli/perpetual-contract.ts +4 -4
- package/src/cli/quote-answer.ts +6 -2
- package/src/cli/result.ts +24 -5
- package/src/cli/symbol-args.ts +5 -3
- package/src/cli/symbol-list.ts +23 -10
- package/src/cli/symbol-rows.ts +135 -3
- package/src/cli/treasury-yields.ts +15 -1
- package/src/components/chart/composite/axis-overlays.tsx +5 -2
- package/src/components/chart/composite/composite-chart.tsx +1 -0
- package/src/components/chart/composite/format.ts +103 -16
- package/src/components/chart/composite/legend.tsx +60 -25
- package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
- package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
- package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
- package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
- package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
- package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
- package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
- package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
- package/src/components/chart/composite/panel-surface/props.ts +79 -0
- package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
- package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
- package/src/components/chart/composite/panel-surface.tsx +81 -1177
- package/src/components/chart/composite/time-axis.ts +51 -29
- package/src/components/chart/composite/toolbar.tsx +42 -6
- package/src/components/chart/curve/curve-surface.tsx +5 -5
- package/src/components/command-bar/commands/collection-list.ts +1 -0
- package/src/components/command-bar/list/badge.ts +8 -5
- package/src/components/command-bar/list/model.ts +0 -5
- package/src/components/command-bar/list/view.tsx +39 -2
- package/src/components/command-bar/routes/root/plugin-install.ts +4 -2
- package/src/components/command-bar/routes/root/provider-search.ts +23 -3
- package/src/components/command-bar/routes/root/results.ts +23 -11
- package/src/components/command-bar/routes/root/runtime.ts +3 -2
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
- package/src/components/command-bar/routes/root/start-here.ts +1 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +2 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +23 -4
- package/src/components/data-table/view.tsx +29 -6
- package/src/components/form-modal/host.tsx +1 -1
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +3 -3
- package/src/components/layout/pane/error-boundary.tsx +2 -1
- package/src/components/layout/pane/title.ts +10 -4
- package/src/components/markdown-text.tsx +36 -0
- package/src/components/market-board/index.tsx +4 -3
- package/src/components/onboarding/first-run-workspace.ts +46 -11
- package/src/components/onboarding/onboarding-keyboard.ts +57 -5
- package/src/components/onboarding/onboarding-wizard.tsx +91 -24
- package/src/components/onboarding/portfolio-step/index.tsx +1 -0
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +36 -9
- package/src/components/onboarding/portfolio-step/types.ts +2 -0
- package/src/components/onboarding/tickers-step-model.ts +140 -0
- package/src/components/onboarding/tickers-step.tsx +116 -0
- package/src/components/onboarding/use-onboarding-broker-form.ts +1 -1
- package/src/components/onboarding/use-onboarding-progress.ts +100 -11
- package/src/components/onboarding/use-onboarding-upgrade.ts +3 -2
- package/src/components/onboarding/wizard-model.ts +3 -1
- package/src/components/onboarding/wizard-tickers.ts +139 -0
- package/src/components/pane-settings-dialog/tui.tsx +6 -3
- package/src/components/pane-settings-dialog.tsx +2 -1
- package/src/components/pane-template-wizard.tsx +2 -0
- package/src/components/price-performance.tsx +2 -2
- package/src/components/speedometer-gauge/model.ts +2 -1
- package/src/components/speedometer-gauge/terminal.tsx +13 -8
- package/src/components/ui/choice-dialog.tsx +102 -33
- package/src/components/ui/confirm-dialog.tsx +3 -2
- package/src/components/ui/frame.tsx +7 -3
- package/src/components/ui/icon.tsx +4 -2
- package/src/components/ui/list-view.tsx +8 -0
- package/src/components/ui/multi-select/dialog.tsx +1 -7
- package/src/components/ui/not-meaningful.ts +16 -0
- package/src/components/ui/number-prompt-dialog.tsx +2 -1
- package/src/components/ui/query-bar.tsx +16 -4
- package/src/components/ui/stat-grid.tsx +27 -6
- package/src/components/use-pane-notice-footer.tsx +3 -1
- package/src/data/config/store/normalize.ts +2 -0
- package/src/docs/snapshot.json +3 -3
- package/src/i18n/es.ts +6 -2
- package/src/i18n/ja.ts +6 -2
- package/src/i18n/ko.ts +6 -2
- package/src/i18n/zh-cn.ts +6 -2
- package/src/i18n/zh-tw.ts +6 -2
- package/src/layout-marketplace/model.ts +2 -1
- package/src/market-data/futures-contract.ts +2 -1
- package/src/market-data/hooks.tsx +1 -1
- package/src/market-data/market/change-basis.ts +27 -5
- package/src/market-data/market/format.ts +48 -14
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/listing-enterprise-value.ts +3 -3
- package/src/market-data/quotes/resolution.ts +16 -0
- package/src/market-data/quotes/time.ts +17 -10
- package/src/market-data/tax-equivalent.ts +3 -2
- package/src/news/aggregator.ts +19 -8
- package/src/news/hooks.ts +1 -1
- package/src/news/news-model.ts +49 -0
- package/src/news/types.ts +9 -0
- package/src/plugins/builtin/account-management/calendar-tab.tsx +8 -3
- package/src/plugins/builtin/account-management/pane.tsx +9 -8
- package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +4 -5
- package/src/plugins/builtin/alerts/format.ts +6 -5
- package/src/plugins/builtin/alerts/headless.ts +3 -2
- package/src/plugins/builtin/alerts/history.ts +2 -1
- package/src/plugins/builtin/alerts/pane.tsx +2 -1
- package/src/plugins/builtin/alerts/price-text.ts +2 -1
- package/src/plugins/builtin/alerts/scheduled.ts +6 -5
- package/src/plugins/builtin/analytics/account-returns.ts +6 -7
- package/src/plugins/builtin/analytics/display.ts +2 -1
- package/src/plugins/builtin/analytics/pane-model.ts +5 -9
- package/src/plugins/builtin/analytics/risk-client.ts +12 -2
- package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
- package/src/plugins/builtin/analytics/risk-math.ts +23 -6
- package/src/plugins/builtin/analytics/risk-model.ts +26 -15
- package/src/plugins/builtin/analytics/risk-pane.tsx +8 -7
- package/src/plugins/builtin/analytics/view.tsx +5 -5
- package/src/plugins/builtin/attention/model.ts +6 -5
- package/src/plugins/builtin/attention/pane.tsx +5 -4
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +8 -7
- package/src/plugins/builtin/awards/model.ts +4 -3
- package/src/plugins/builtin/awards/pane.tsx +4 -4
- package/src/plugins/builtin/backtest/format.ts +3 -2
- package/src/plugins/builtin/backtest/report.ts +3 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/add-flow.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders-data.ts +3 -3
- package/src/plugins/builtin/broker-trading/orders.tsx +3 -2
- package/src/plugins/builtin/broker-trading/ticket.tsx +2 -2
- package/src/plugins/builtin/buildout/cells.tsx +2 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -3
- package/src/plugins/builtin/buildout/data-runtime.ts +21 -23
- package/src/plugins/builtin/buildout/detail/values.ts +2 -1
- package/src/plugins/builtin/buildout/format.ts +4 -3
- package/src/plugins/builtin/buildout/pane/index.tsx +3 -3
- package/src/plugins/builtin/catalysts/detail.tsx +2 -1
- package/src/plugins/builtin/catalysts/model.ts +6 -5
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +3 -2
- package/src/plugins/builtin/cds/model.ts +8 -8
- package/src/plugins/builtin/cds/pane.tsx +3 -2
- package/src/plugins/builtin/central-bank-rates/headless.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +3 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -5
- package/src/plugins/builtin/changelog/index.tsx +2 -2
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
- package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
- package/src/plugins/builtin/chart-composer/index.tsx +4 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +8 -4
- package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
- package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
- package/src/plugins/builtin/chart-composer/use-series-catalog.ts +3 -1
- package/src/plugins/builtin/chart-composer/user-series.ts +3 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +2 -1
- package/src/plugins/builtin/chat/controller/utils.ts +2 -1
- package/src/plugins/builtin/clinical-trials/model.ts +4 -3
- package/src/plugins/builtin/clinical-trials/sponsor-tickers.ts +4 -2
- package/src/plugins/builtin/cloud/askg/lock-note.ts +16 -4
- package/src/plugins/builtin/cloud/askg/model.ts +2 -1
- package/src/plugins/builtin/cloud/askg/pane.tsx +35 -1
- package/src/plugins/builtin/cloud/company-picker.tsx +1 -3
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/team/pane.tsx +12 -12
- package/src/plugins/builtin/cloud/thesis/detail.tsx +13 -8
- package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
- package/src/plugins/builtin/cloud-tweets/model.ts +2 -2
- package/src/plugins/builtin/comment-letters/pane.tsx +2 -1
- package/src/plugins/builtin/commodity-balances/headless.ts +3 -2
- package/src/plugins/builtin/company-attention/app-rank.tsx +5 -4
- package/src/plugins/builtin/company-attention/building-model.ts +7 -7
- package/src/plugins/builtin/company-attention/headless.ts +6 -5
- package/src/plugins/builtin/company-attention/model.ts +4 -4
- package/src/plugins/builtin/company-attention/moves-model.ts +9 -9
- package/src/plugins/builtin/company-attention/signals-model.ts +9 -9
- package/src/plugins/builtin/company-kpis/headless.ts +2 -1
- package/src/plugins/builtin/company-kpis/model.ts +15 -10
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -2
- package/src/plugins/builtin/congress-trades/detail.tsx +6 -5
- package/src/plugins/builtin/congress-trades/headless.ts +2 -1
- package/src/plugins/builtin/congress-trades/model.ts +6 -6
- package/src/plugins/builtin/congress-trades/table.tsx +7 -6
- package/src/plugins/builtin/connections/pane.tsx +5 -5
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/index.tsx +4 -1
- package/src/plugins/builtin/correlation/matrix/selection.ts +2 -1
- package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -3
- package/src/plugins/builtin/cot/headless.ts +3 -2
- package/src/plugins/builtin/cot/model.ts +2 -1
- package/src/plugins/builtin/cot/pane.tsx +4 -3
- package/src/plugins/builtin/cpi/headless.ts +10 -4
- package/src/plugins/builtin/cpi/model.ts +25 -7
- package/src/plugins/builtin/cpi/pane.tsx +3 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +5 -4
- package/src/plugins/builtin/credit-boards/headless.ts +2 -1
- package/src/plugins/builtin/credit-boards/model.ts +5 -5
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/index.tsx +2 -2
- package/src/plugins/builtin/credit-documents/model.ts +2 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/defi-view.tsx +7 -7
- package/src/plugins/builtin/crypto-board/defi.ts +2 -2
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +93 -14
- package/src/plugins/builtin/crypto-board/pane.tsx +28 -13
- package/src/plugins/builtin/crypto-board/supply.ts +2 -2
- package/src/plugins/builtin/crypto-etf-flows/model.ts +4 -4
- package/src/plugins/builtin/custom-view/index.tsx +3 -1
- package/src/plugins/builtin/custom-view/pane.tsx +5 -1
- package/src/plugins/builtin/custom-view/view-spec.ts +11 -0
- package/src/plugins/builtin/debt-maturities/model.ts +3 -3
- package/src/plugins/builtin/debt-maturities/pane.tsx +2 -2
- package/src/plugins/builtin/dividend-yield/client.ts +31 -5
- package/src/plugins/builtin/dividend-yield/headless.ts +20 -13
- package/src/plugins/builtin/dividend-yield/pane.tsx +12 -10
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +4 -1
- package/src/plugins/builtin/dividend-yield/ranking.ts +21 -12
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +8 -4
- package/src/plugins/builtin/docs/use-docs.ts +4 -2
- package/src/plugins/builtin/doe/headless.ts +2 -1
- package/src/plugins/builtin/doe/model.ts +12 -11
- package/src/plugins/builtin/earnings/board-model.ts +14 -8
- package/src/plugins/builtin/earnings/board-table.ts +13 -8
- package/src/plugins/builtin/earnings/calendar-model.ts +5 -5
- package/src/plugins/builtin/earnings/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings/format.ts +16 -14
- package/src/plugins/builtin/earnings/headless.ts +57 -19
- package/src/plugins/builtin/earnings/history-model.ts +11 -7
- package/src/plugins/builtin/earnings/history-table.ts +22 -9
- package/src/plugins/builtin/earnings/history.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/format.ts +6 -5
- package/src/plugins/builtin/earnings-calls/upcoming.ts +5 -5
- package/src/plugins/builtin/earnings-ripple/headless.ts +2 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/earnings-ripple/model.ts +3 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +6 -6
- package/src/plugins/builtin/econ/calendar-model.ts +19 -3
- package/src/plugins/builtin/econ/detail-view.tsx +2 -2
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ/index.tsx +7 -6
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -1
- package/src/plugins/builtin/econ-statistics/headless.ts +25 -4
- package/src/plugins/builtin/econ-statistics/pane.tsx +2 -2
- package/src/plugins/builtin/equity-screener/headless.ts +5 -5
- package/src/plugins/builtin/equity-screener/model.ts +6 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +7 -7
- package/src/plugins/builtin/equity-screener/screen-check.ts +2 -1
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/estimate-revisions/model.ts +3 -2
- package/src/plugins/builtin/estimate-revisions/pane.tsx +8 -8
- package/src/plugins/builtin/executives/format.ts +4 -4
- package/src/plugins/builtin/exposure/headless.ts +8 -8
- package/src/plugins/builtin/exposure/model.ts +4 -3
- package/src/plugins/builtin/exposure/pane.tsx +6 -5
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/headless.ts +2 -1
- package/src/plugins/builtin/filing-events/feed.ts +2 -1
- package/src/plugins/builtin/futures/table.tsx +8 -8
- package/src/plugins/builtin/futures-curve/headless.ts +18 -18
- package/src/plugins/builtin/futures-curve/model.ts +5 -5
- package/src/plugins/builtin/futures-curve/pane.tsx +8 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/fx-matrix/pairs.ts +2 -1
- package/src/plugins/builtin/gpu/board.tsx +6 -5
- package/src/plugins/builtin/gpu/changes.tsx +2 -1
- package/src/plugins/builtin/gpu/equities.tsx +2 -2
- package/src/plugins/builtin/gpu/headless.ts +4 -3
- package/src/plugins/builtin/gpu/model.ts +8 -7
- package/src/plugins/builtin/help/functions-table.tsx +41 -9
- package/src/plugins/builtin/help/index.tsx +6 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +35 -7
- package/src/plugins/builtin/help/shortcut-table.tsx +19 -7
- package/src/plugins/builtin/help/table-cells.tsx +51 -0
- package/src/plugins/builtin/holders/pane.tsx +4 -1
- package/src/plugins/builtin/insider/base-values.ts +2 -2
- package/src/plugins/builtin/insider/display.ts +2 -1
- package/src/plugins/builtin/insider/headless.ts +16 -16
- package/src/plugins/builtin/insider/insider-data.ts +2 -1
- package/src/plugins/builtin/insider/signals-model.ts +3 -3
- package/src/plugins/builtin/insider/table-model.ts +27 -13
- package/src/plugins/builtin/insider/table.tsx +1 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +4 -4
- package/src/plugins/builtin/iv-history/format.ts +8 -7
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/iv-history/pane.tsx +3 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +5 -4
- package/src/plugins/builtin/jobs/headless.ts +11 -11
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/jobs/pane.tsx +5 -5
- package/src/plugins/builtin/jodi/model.ts +2 -2
- package/src/plugins/builtin/jodi/pane.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/headless.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/model.ts +2 -1
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -2
- package/src/plugins/builtin/macro-day/headless.ts +27 -15
- package/src/plugins/builtin/macro-day/model.ts +42 -4
- package/src/plugins/builtin/macro-day/pane.tsx +30 -12
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- package/src/plugins/builtin/market-halts/model.ts +11 -10
- package/src/plugins/builtin/market-halts/pane.tsx +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +4 -4
- package/src/plugins/builtin/market-movers/session-table.ts +3 -3
- package/src/plugins/builtin/market-movers/session.ts +2 -1
- package/src/plugins/builtin/market-movers/table.ts +5 -5
- package/src/plugins/builtin/market-valuation/detail.tsx +2 -2
- package/src/plugins/builtin/market-valuation/headless.ts +7 -7
- package/src/plugins/builtin/market-valuation/pane.tsx +7 -7
- package/src/plugins/builtin/members/breadth-pane.tsx +5 -4
- package/src/plugins/builtin/members/headless.ts +2 -1
- package/src/plugins/builtin/members/model.ts +3 -2
- package/src/plugins/builtin/members/pane.tsx +10 -9
- package/src/plugins/builtin/mna/distress/model.ts +2 -1
- package/src/plugins/builtin/mna/model.ts +5 -5
- package/src/plugins/builtin/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +17 -5
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/model.ts +3 -2
- package/src/plugins/builtin/money-markets/pane.tsx +11 -5
- package/src/plugins/builtin/news/headless.ts +5 -2
- package/src/plugins/builtin/news/wire/breaking/notifications.ts +21 -19
- package/src/plugins/builtin/news/wire/news/row.ts +3 -1
- package/src/plugins/builtin/news/wire/news/table.tsx +3 -2
- package/src/plugins/builtin/news/wire/persisted-articles.ts +28 -3
- package/src/plugins/builtin/notes/headless.ts +2 -1
- package/src/plugins/builtin/notes/model.ts +2 -1
- package/src/plugins/builtin/openfda/pane.tsx +4 -3
- package/src/plugins/builtin/options/carry.ts +3 -2
- package/src/plugins/builtin/options/market-reference.ts +2 -1
- package/src/plugins/builtin/options/table.ts +48 -9
- package/src/plugins/builtin/options/view.tsx +47 -17
- package/src/plugins/builtin/options-calculator/headless.ts +3 -2
- package/src/plugins/builtin/options-calculator/pane.tsx +7 -7
- package/src/plugins/builtin/options-positioning/headless.ts +8 -7
- package/src/plugins/builtin/options-positioning/model.ts +10 -10
- package/src/plugins/builtin/options-positioning/pane.tsx +5 -5
- package/src/plugins/builtin/options-scenario/collar.ts +5 -4
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +11 -10
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +15 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +2 -1
- package/src/plugins/builtin/options-scenario/csp.ts +6 -5
- package/src/plugins/builtin/options-scenario/headless.ts +6 -5
- package/src/plugins/builtin/options-scenario/hedge.ts +3 -3
- package/src/plugins/builtin/options-scenario/pane.tsx +7 -6
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +1 -1
- package/src/plugins/builtin/pe-band/headless.ts +9 -8
- package/src/plugins/builtin/pe-band/pane.tsx +7 -7
- package/src/plugins/builtin/perps/cascade.ts +3 -2
- package/src/plugins/builtin/perps/headless.ts +10 -9
- package/src/plugins/builtin/perps/model.ts +14 -14
- package/src/plugins/builtin/perps/pane.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/index.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/pane/futures-terms.ts +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +26 -7
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +4 -2
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +8 -5
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +25 -15
- package/src/plugins/builtin/power/detail.tsx +6 -5
- package/src/plugins/builtin/power/gas-model.ts +8 -7
- package/src/plugins/builtin/power/gas.tsx +2 -1
- package/src/plugins/builtin/power/headless.ts +7 -6
- package/src/plugins/builtin/power/model.ts +3 -2
- package/src/plugins/builtin/power/prices-headless.ts +10 -9
- package/src/plugins/builtin/power/prices-model.ts +3 -2
- package/src/plugins/builtin/power/prices.tsx +2 -1
- package/src/plugins/builtin/primary-dealers/model.ts +3 -3
- package/src/plugins/builtin/primary-dealers/pane.tsx +2 -2
- package/src/plugins/builtin/rate-path/headless.ts +8 -7
- package/src/plugins/builtin/rate-path/model.ts +6 -5
- package/src/plugins/builtin/rate-path/pane.tsx +6 -5
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +2 -1
- package/src/plugins/builtin/realized-vol/headless.ts +11 -10
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/relative-rotation/pane.tsx +6 -6
- package/src/plugins/builtin/research/analyst-headless.ts +5 -5
- package/src/plugins/builtin/research/analyst-model.ts +7 -7
- package/src/plugins/builtin/research/analyst-pane.tsx +7 -7
- package/src/plugins/builtin/research/client.ts +14 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +40 -30
- package/src/plugins/builtin/research/event-model.ts +55 -22
- package/src/plugins/builtin/research/event-sources.ts +26 -8
- package/src/plugins/builtin/research/relative-valuation-columns.ts +20 -12
- package/src/plugins/builtin/research/relative-valuation-currency.ts +16 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +33 -21
- package/src/plugins/builtin/research/relative-valuation-model.ts +31 -17
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +29 -14
- package/src/plugins/builtin/research-search/model.ts +2 -1
- package/src/plugins/builtin/research-search/saved-view.tsx +4 -3
- package/src/plugins/builtin/revenue-breakdown/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/headless.ts +7 -7
- package/src/plugins/builtin/reverse-dcf/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -2
- package/src/plugins/builtin/scanner/flow-model.ts +7 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/headless.ts +3 -2
- package/src/plugins/builtin/scanner/hilo-model.ts +2 -1
- package/src/plugins/builtin/scanner/live-headless.ts +2 -2
- package/src/plugins/builtin/scanner/live-model.ts +3 -2
- package/src/plugins/builtin/scanner/live-pane.tsx +5 -5
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/seasonality/pane.tsx +4 -3
- package/src/plugins/builtin/sec/filing-display.tsx +12 -15
- package/src/plugins/builtin/sec/fund-facts.ts +2 -2
- package/src/plugins/builtin/sec/headless.ts +2 -1
- package/src/plugins/builtin/sec/index.tsx +6 -2
- package/src/plugins/builtin/sectors/headless.ts +4 -4
- package/src/plugins/builtin/sectors/index.tsx +7 -7
- package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
- package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +90 -6
- package/src/plugins/builtin/shared/earnings-report.ts +13 -6
- package/src/plugins/builtin/shared/research-cells.tsx +2 -2
- package/src/plugins/builtin/shared/source-footer.ts +2 -1
- package/src/plugins/builtin/shared/trend.ts +2 -2
- package/src/plugins/builtin/shared/use-quote-board.ts +9 -8
- package/src/plugins/builtin/short-interest/headless.ts +6 -6
- package/src/plugins/builtin/short-interest/model.ts +9 -9
- package/src/plugins/builtin/short-interest/publications-model.ts +5 -5
- package/src/plugins/builtin/short-interest/publications-pane.tsx +3 -2
- package/src/plugins/builtin/short-interest/watch-headless.ts +5 -5
- package/src/plugins/builtin/short-interest/watch-pane.tsx +6 -6
- package/src/plugins/builtin/short-volume/model.ts +5 -5
- package/src/plugins/builtin/short-volume/pane.tsx +4 -4
- package/src/plugins/builtin/social-mentions/headless.ts +2 -1
- package/src/plugins/builtin/social-mentions/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/graph-model.ts +2 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/headless.ts +3 -2
- package/src/plugins/builtin/supply-chain/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +2 -1
- package/src/plugins/builtin/themes/headless.ts +2 -1
- package/src/plugins/builtin/themes/model.ts +3 -2
- package/src/plugins/builtin/themes/pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/format.ts +9 -9
- package/src/plugins/builtin/thirteenf/headless.ts +3 -2
- package/src/plugins/builtin/thirteenf/model.ts +2 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +2 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +5 -4
- package/src/plugins/builtin/thirteenf/report-notes.ts +2 -1
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/table.ts +6 -5
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -3
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +4 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +83 -35
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -1
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +2 -2
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +14 -18
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +8 -13
- package/src/plugins/builtin/ticker-detail/headless.ts +33 -6
- package/src/plugins/builtin/ticker-detail/overview/chart-scale.ts +52 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -9
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -14
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +6 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +2 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +43 -9
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +7 -5
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +4 -4
- package/src/plugins/builtin/ticker-detail/settings.ts +17 -0
- package/src/plugins/builtin/time-sales/headless.ts +3 -2
- package/src/plugins/builtin/time-sales/model.ts +7 -5
- package/src/plugins/builtin/time-sales/pane.tsx +7 -6
- package/src/plugins/builtin/trace-bonds/model.ts +3 -2
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/client.ts +2 -1
- package/src/plugins/builtin/treasury-auctions/headless.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +3 -2
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +10 -9
- package/src/plugins/builtin/treasury-auctions/hk.ts +5 -5
- package/src/plugins/builtin/treasury-auctions/model.ts +4 -4
- package/src/plugins/builtin/treasury-auctions/pane.tsx +18 -18
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -1
- package/src/plugins/builtin/treasury-daily/model.ts +2 -2
- package/src/plugins/builtin/vol-surface/events.ts +5 -4
- package/src/plugins/builtin/vol-surface/headless.ts +19 -18
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +8 -7
- package/src/plugins/builtin/vol-surface/stored.ts +2 -1
- package/src/plugins/builtin/vol-surface/tables.ts +4 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -4
- package/src/plugins/builtin/volatility/pane.tsx +6 -6
- package/src/plugins/builtin/world-indices/headless.ts +7 -7
- package/src/plugins/builtin/world-indices/index.tsx +3 -1
- package/src/plugins/builtin/world-venue-map/headless.ts +2 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +2 -1
- package/src/plugins/builtin/world-venue-map/layers.ts +3 -2
- package/src/plugins/builtin/world-venue-map/use-geo.ts +4 -2
- package/src/plugins/builtin/yield-curve/curves.ts +3 -3
- package/src/plugins/builtin/yield-curve/headless.ts +7 -6
- package/src/plugins/builtin/yield-curve/index.tsx +5 -4
- package/src/plugins/builtin/yield-curve/swaps.tsx +2 -1
- package/src/portfolio/allocation.ts +5 -5
- package/src/portfolio/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +61 -45
- package/src/portfolio/futures-positions.ts +2 -1
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- package/src/renderers/dom/dialog-host.tsx +5 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +7 -1
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/renderers/opentui/ui-host.tsx +32 -2
- package/src/renderers/share/layout-view.tsx +2 -1
- package/src/sources/gloomberb-cloud/news.ts +9 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +7 -0
- package/src/sources/provider-router/history.ts +5 -2
- package/src/sources/provider-router/search.ts +15 -10
- package/src/state/hooks/inline-tickers.ts +3 -2
- package/src/state/hooks/quote-streaming.ts +9 -10
- package/src/team/collections-sync.ts +8 -3
- package/src/telemetry/usage-counts.ts +26 -0
- package/src/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +6 -5
- package/src/tickers/company-name.ts +36 -2
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/listing-venues.ts +26 -1
- package/src/tickers/renamed-listings.ts +2 -1
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +22 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/tickers/starter-symbols.ts +7 -0
- package/src/time-series/base-series.ts +4 -0
- package/src/time-series/fundamentals/statement-fields.ts +11 -14
- package/src/time-series/history-acquisition.ts +1 -1
- package/src/time-series/log-scale.ts +9 -0
- package/src/time-series/reporting.ts +3 -3
- package/src/time-series/resolve.ts +6 -4
- package/src/time-series/transforms.ts +10 -5
- package/src/time-series/types.ts +5 -2
- package/src/types/config.ts +9 -0
- package/src/types/data-provider.ts +3 -2
- package/src/types/financials.ts +28 -0
- package/src/types/headless.ts +2 -0
- package/src/types/instrument.ts +6 -0
- package/src/types/plugin-panes.ts +1 -1
- package/src/types/plugin-reports.ts +8 -0
- package/src/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/datetime-format.ts +74 -33
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +98 -17
- package/src/utils/format.ts +4 -9
- package/src/utils/fundamentals.ts +38 -16
- package/src/utils/futures-generic.ts +14 -0
- package/src/utils/growth.ts +67 -0
- package/src/utils/keyboard.ts +6 -0
- package/src/utils/options.ts +1 -1
- package/src/utils/report-timing.ts +2 -2
- package/src/utils/served-rates.ts +45 -0
- package/src/utils/text-wrap.ts +84 -3
- package/src/utils/trailing-dividend.ts +13 -3
- package/src/utils/zoned-date-time.ts +47 -22
|
@@ -58,6 +58,34 @@ export interface PeriodPnlRow {
|
|
|
58
58
|
contribution: number | null;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* One currency's part of the book over the period: its holdings' price P&L
|
|
63
|
+
* (local), its move on their start value (FX), the two together, and the
|
|
64
|
+
* total's share of the book. Over the holdings that have both closes, as the
|
|
65
|
+
* book's total is; `unpriced` names the ones it leaves out.
|
|
66
|
+
*/
|
|
67
|
+
export interface PeriodCurrencyPnl {
|
|
68
|
+
/** The major currency its holdings are priced in: GBP for a price in pence. */
|
|
69
|
+
currency: string;
|
|
70
|
+
/** The book's own currency, which has no FX line. */
|
|
71
|
+
own: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The holdings' price P&L, in the book's currency at the end's rate. Each
|
|
74
|
+
* figure is null when every holding in the currency is left out: there is
|
|
75
|
+
* nothing to add up, which is not a P&L of 0.
|
|
76
|
+
*/
|
|
77
|
+
local: number | null;
|
|
78
|
+
/** The currency's move on the holdings' start value; 0 in the book's currency. */
|
|
79
|
+
fx: number | null;
|
|
80
|
+
total: number | null;
|
|
81
|
+
/** Each over the book's contribution base, in percent. */
|
|
82
|
+
localContribution: number | null;
|
|
83
|
+
fxContribution: number | null;
|
|
84
|
+
contribution: number | null;
|
|
85
|
+
/** Its holdings without a close at one end of the window or a rate: left out of the figures. */
|
|
86
|
+
unpriced: string[];
|
|
87
|
+
}
|
|
88
|
+
|
|
61
89
|
export interface PeriodPnl {
|
|
62
90
|
rows: PeriodPnlRow[];
|
|
63
91
|
/** The FX line: every holding's currency move, together. */
|
|
@@ -75,6 +103,8 @@ export interface PeriodPnl {
|
|
|
75
103
|
contributionBasis: "net" | "gross";
|
|
76
104
|
/** Holdings without a close at one end of the window, or without a rate for their currency. */
|
|
77
105
|
unpriced: string[];
|
|
106
|
+
/** The book by the currency its holdings are priced in: the book's own first, then the others by code. */
|
|
107
|
+
currencies: PeriodCurrencyPnl[];
|
|
78
108
|
}
|
|
79
109
|
|
|
80
110
|
const finite = (value: number | null | undefined): value is number => value != null && Number.isFinite(value);
|
|
@@ -117,5 +147,25 @@ export function periodPnl(holdings: readonly PeriodPnlHolding[], bookCurrency: s
|
|
|
117
147
|
const fx = rows.reduce((sum, row) => sum + (finite(row.fx) ? row.fx : 0), 0);
|
|
118
148
|
const total = rows.reduce((sum, row) => sum + (finite(row.pnl) && finite(row.fx) ? row.pnl + row.fx : 0), 0);
|
|
119
149
|
const share = (value: number) => contributionBase ? (value / contributionBase) * 100 : null;
|
|
120
|
-
|
|
150
|
+
// Each holding counts under the major currency it converts through, priced or not, so a part that leaves one out says so.
|
|
151
|
+
const groups = new Map<string, { currency: string; own: boolean; counted: number; local: number; fx: number; unpriced: string[] }>();
|
|
152
|
+
for (const row of rows) {
|
|
153
|
+
const { currency, own } = periodCurrency(row.currency, bookCurrency);
|
|
154
|
+
const key = own ? heldCurrencyUnit(bookCurrency).currency || bookCurrency : currency;
|
|
155
|
+
const group = groups.get(key) ?? { currency: key, own, counted: 0, local: 0, fx: 0, unpriced: [] };
|
|
156
|
+
groups.set(key, group);
|
|
157
|
+
if (finite(row.pnl) && finite(row.fx)) {
|
|
158
|
+
group.counted += 1;
|
|
159
|
+
group.local += row.pnl;
|
|
160
|
+
group.fx += row.fx;
|
|
161
|
+
} else {
|
|
162
|
+
group.unpriced.push(row.symbol);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const currencies = [...groups.values()]
|
|
166
|
+
.map(({ currency, own, counted, local, fx, unpriced }): PeriodCurrencyPnl => counted === 0
|
|
167
|
+
? { currency, own, local: null, fx: null, total: null, localContribution: null, fxContribution: null, contribution: null, unpriced }
|
|
168
|
+
: { currency, own, local, fx, total: local + fx, localContribution: share(local), fxContribution: share(fx), contribution: share(local + fx), unpriced })
|
|
169
|
+
.sort((a, b) => Number(b.own) - Number(a.own) || a.currency.localeCompare(b.currency));
|
|
170
|
+
return { rows, fx, fxContribution: share(fx), total, totalContribution: share(total), contributionBase, contributionBasis: shorts ? "gross" : "net", unpriced, currencies };
|
|
121
171
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** @jsxImportSource react */
|
|
2
2
|
import { useEffect, useRef, type ReactNode } from "react";
|
|
3
|
-
import { DialogHostProvider } from "../../ui/dialog";
|
|
3
|
+
import { DialogHostProvider, type DialogOptions } from "../../ui/dialog";
|
|
4
4
|
import {
|
|
5
5
|
bridgeDialogContent,
|
|
6
6
|
DialogBridgeRegistrationProvider,
|
|
7
7
|
useDialogBridgeSlot,
|
|
8
8
|
} from "../../ui/dialog-bridge";
|
|
9
|
-
import { useDialogStack } from "../../ui/dialog-stack";
|
|
9
|
+
import { closesOnClickOutside, useDialogStack } from "../../ui/dialog-stack";
|
|
10
10
|
import { blendHex } from "../../theme/colors";
|
|
11
11
|
import { useThemeColors } from "../../theme/theme-context";
|
|
12
12
|
import { isEditableTarget, isInsideDialogSurface } from "./host/focus-scope";
|
|
@@ -14,7 +14,7 @@ import { isEditableTarget, isInsideDialogSurface } from "./host/focus-scope";
|
|
|
14
14
|
interface DialogState {
|
|
15
15
|
id: string;
|
|
16
16
|
content: ReactNode | ((context: { dialogId: string; dismiss(): void; resolve(value: unknown): void }) => ReactNode);
|
|
17
|
-
closeOnClickOutside:
|
|
17
|
+
closeOnClickOutside: DialogOptions["closeOnClickOutside"];
|
|
18
18
|
returnFocus: HTMLElement | null;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -42,7 +42,7 @@ export function WebDialogHostProvider({ children }: { children: ReactNode }) {
|
|
|
42
42
|
return {
|
|
43
43
|
id,
|
|
44
44
|
content: options.content as DialogState["content"],
|
|
45
|
-
closeOnClickOutside: options.closeOnClickOutside
|
|
45
|
+
closeOnClickOutside: options.closeOnClickOutside,
|
|
46
46
|
returnFocus,
|
|
47
47
|
};
|
|
48
48
|
},
|
|
@@ -99,7 +99,7 @@ export function WebDialogHostProvider({ children }: { children: ReactNode }) {
|
|
|
99
99
|
data-topmost={isTopmost ? "true" : "false"}
|
|
100
100
|
onMouseDown={(event) => {
|
|
101
101
|
if (event.target !== event.currentTarget) return;
|
|
102
|
-
if (isTopmost && dialogState.closeOnClickOutside) {
|
|
102
|
+
if (isTopmost && closesOnClickOutside(dialogState.closeOnClickOutside)) {
|
|
103
103
|
close(dialogState.id, undefined);
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
DesktopCoreRequest,
|
|
13
13
|
} from "../../shared/protocol";
|
|
14
14
|
import { encodeRpcValue } from "../../shared/rpc-codec";
|
|
15
|
+
import { logFailure } from "../../../../utils/log-failure";
|
|
15
16
|
import { desktopBootFramePath, removeDesktopBootFrame } from "../window/boot-frame";
|
|
16
17
|
import { MAIN_WINDOW_RPC_KEY, paneIdFromDetachedRpcKey } from "../window/focus";
|
|
17
18
|
import type { DesktopBackend, DesktopRpc } from "./backend";
|
|
@@ -52,7 +53,12 @@ export async function handleDesktopBackendRequest(
|
|
|
52
53
|
request.payload.channel === "nightly" ? "nightly" : "stable",
|
|
53
54
|
);
|
|
54
55
|
case "update.start":
|
|
55
|
-
|
|
56
|
+
// The download reports its failures as progress. One that escapes it ends
|
|
57
|
+
// the same way, so the window does not wait on a download that stopped.
|
|
58
|
+
desktopUpdater.download(request.payload.release, (progress) => sendUpdateProgress(rpc, progress)).catch((error: unknown) => {
|
|
59
|
+
logFailure("desktop-update", "Desktop update download failed")(error);
|
|
60
|
+
sendUpdateProgress(rpc, { phase: "error", error: "Desktop update failed" });
|
|
61
|
+
});
|
|
56
62
|
return null;
|
|
57
63
|
case "update.apply":
|
|
58
64
|
// Only the main window offers Restart; a popped-out window never relaunches the app.
|
|
@@ -42,7 +42,7 @@ export function createCapabilityInvoker(options: {
|
|
|
42
42
|
? withDeadline(
|
|
43
43
|
request,
|
|
44
44
|
options.timeoutMs,
|
|
45
|
-
`Asset data request timed out after ${options.timeoutMs}ms
|
|
45
|
+
`Asset data request timed out after ${options.timeoutMs}ms`,
|
|
46
46
|
)
|
|
47
47
|
: request;
|
|
48
48
|
if (!invokeOptions.signal) {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
useDialogBridgeSlot,
|
|
18
18
|
type DialogContentBridge,
|
|
19
19
|
} from "../../ui/dialog-bridge";
|
|
20
|
-
import { useDialogStack, type DialogKind } from "../../ui/dialog-stack";
|
|
20
|
+
import { closesOnClickOutside, useDialogStack, type DialogKind } from "../../ui/dialog-stack";
|
|
21
21
|
|
|
22
22
|
interface DialogRecord {
|
|
23
23
|
id: string;
|
|
@@ -26,7 +26,7 @@ interface DialogRecord {
|
|
|
26
26
|
size?: DialogOptions["size"];
|
|
27
27
|
style?: DialogStyle;
|
|
28
28
|
closeOnEscape?: boolean;
|
|
29
|
-
closeOnClickOutside?:
|
|
29
|
+
closeOnClickOutside?: DialogOptions["closeOnClickOutside"];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function renderDialogContent(content: unknown, context: AlertContext | PromptContext<unknown>): ReactNode {
|
|
@@ -82,7 +82,6 @@ function DialogLayer({
|
|
|
82
82
|
? Math.max(1, Math.min(style.maxHeight, viewportHeight))
|
|
83
83
|
: viewportHeight;
|
|
84
84
|
const closeOnEscape = dialog.closeOnEscape ?? true;
|
|
85
|
-
const closeOnClickOutside = dialog.closeOnClickOutside ?? false;
|
|
86
85
|
const zIndex = 9_998 + index * 2;
|
|
87
86
|
|
|
88
87
|
useKeyboard((event) => {
|
|
@@ -124,7 +123,7 @@ function DialogLayer({
|
|
|
124
123
|
alignItems="center"
|
|
125
124
|
justifyContent="center"
|
|
126
125
|
onMouseDown={() => {
|
|
127
|
-
if (isTopmost && closeOnClickOutside) close(dialog.id);
|
|
126
|
+
if (isTopmost && closesOnClickOutside(dialog.closeOnClickOutside)) close(dialog.id);
|
|
128
127
|
}}
|
|
129
128
|
>
|
|
130
129
|
<box
|
|
@@ -175,6 +175,33 @@ const OpenTuiScrollBox = forwardRef<unknown, OpenTuiPrimitiveProps>(function Ope
|
|
|
175
175
|
});
|
|
176
176
|
const OpenTuiInputPrimitive = createOpenTuiPrimitive("input");
|
|
177
177
|
|
|
178
|
+
/**
|
|
179
|
+
* A field's placeholder in the terminal's dim role: faint as well as in the
|
|
180
|
+
* placeholder colour, so an example value (`10`, `USD`) does not read as one
|
|
181
|
+
* typed, nor as the hint under the field in the same muted colour (review,
|
|
182
|
+
* 12 Nov 2026: AP's placeholders and hints were one grey). The desktop draws
|
|
183
|
+
* its placeholder inside a sunken field and keeps the colour alone.
|
|
184
|
+
*/
|
|
185
|
+
function dimPlaceholder(props: OpenTuiPrimitiveProps): OpenTuiPrimitiveProps {
|
|
186
|
+
const { placeholder, placeholderColor } = props as { placeholder?: unknown; placeholderColor?: unknown };
|
|
187
|
+
if (typeof placeholder !== "string" || placeholder.length === 0) return props;
|
|
188
|
+
// One styled text per placeholder and colour, so a re-render does not hand the field a new one to apply.
|
|
189
|
+
const key = `${typeof placeholderColor === "string" ? placeholderColor : ""}\u0000${placeholder}`;
|
|
190
|
+
let styled = dimPlaceholders.get(key);
|
|
191
|
+
if (!styled) {
|
|
192
|
+
if (dimPlaceholders.size >= 256) dimPlaceholders.clear();
|
|
193
|
+
styled = new OpenTuiStyledText([{
|
|
194
|
+
__isChunk: true,
|
|
195
|
+
text: withoutControlCharacters(placeholder),
|
|
196
|
+
fg: typeof placeholderColor === "string" ? RGBA.fromHex(placeholderColor) : undefined,
|
|
197
|
+
attributes: OpenTuiTextAttributes.DIM,
|
|
198
|
+
}] as any);
|
|
199
|
+
dimPlaceholders.set(key, styled);
|
|
200
|
+
}
|
|
201
|
+
return { ...props, placeholder: styled };
|
|
202
|
+
}
|
|
203
|
+
const dimPlaceholders = new Map<string, OpenTuiStyledText>();
|
|
204
|
+
|
|
178
205
|
interface PasteEventLike {
|
|
179
206
|
bytes: Uint8Array;
|
|
180
207
|
}
|
|
@@ -188,7 +215,7 @@ interface PasteEventLike {
|
|
|
188
215
|
const OpenTuiInput = forwardRef<unknown, OpenTuiPrimitiveProps>(function OpenTuiInput({ joinPastedLines: join, onPaste, ...props }, ref) {
|
|
189
216
|
const handlePaste = typeof onPaste === "function" ? onPaste as (event: PasteEventLike) => void : null;
|
|
190
217
|
return createElement(OpenTuiInputPrimitive, {
|
|
191
|
-
...props,
|
|
218
|
+
...dimPlaceholder(props),
|
|
192
219
|
ref,
|
|
193
220
|
onPaste: join === true || join === "list" || handlePaste
|
|
194
221
|
? (event: PasteEventLike) => {
|
|
@@ -198,7 +225,10 @@ const OpenTuiInput = forwardRef<unknown, OpenTuiPrimitiveProps>(function OpenTui
|
|
|
198
225
|
: undefined,
|
|
199
226
|
});
|
|
200
227
|
});
|
|
201
|
-
const
|
|
228
|
+
const OpenTuiTextareaPrimitive = createOpenTuiPrimitive("textarea");
|
|
229
|
+
const OpenTuiTextarea = forwardRef<unknown, OpenTuiPrimitiveProps>(function OpenTuiTextarea(props, ref) {
|
|
230
|
+
return createElement(OpenTuiTextareaPrimitive, { ...dimPlaceholder(props), ref });
|
|
231
|
+
});
|
|
202
232
|
const OpenTuiMediaSurface = createOpenTuiPrimitive("box");
|
|
203
233
|
|
|
204
234
|
const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsxImportSource react */
|
|
2
|
+
import { formatShortDate } from "../../utils/datetime-format";
|
|
2
3
|
import type { CSSProperties } from "react";
|
|
3
4
|
import type { DockLayoutNode, PaneInstanceConfig } from "../../types/config";
|
|
4
5
|
import type { LayoutMarketplaceEntry } from "../../shares/portable-layout";
|
|
@@ -79,7 +80,7 @@ function formatDate(value: string): string {
|
|
|
79
80
|
const date = new Date(value);
|
|
80
81
|
return Number.isNaN(date.getTime())
|
|
81
82
|
? ""
|
|
82
|
-
: date
|
|
83
|
+
: formatShortDate(date);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
export function LayoutShareView({
|
|
@@ -82,6 +82,14 @@ function mapCloudNewsStoryItem(
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/** A folded row's notices, when the service says how many (two or more) and since when. */
|
|
86
|
+
function routineNotices(payload: CloudNewsPayload["routine"]): NewsArticle["routine"] | null {
|
|
87
|
+
if (!payload || !Number.isInteger(payload.notices) || payload.notices < 2) return null;
|
|
88
|
+
const since = new Date(payload.since);
|
|
89
|
+
if (Number.isNaN(since.getTime())) return null;
|
|
90
|
+
return { kind: payload.kind, notices: payload.notices, since, programme: payload.programme ?? null };
|
|
91
|
+
}
|
|
92
|
+
|
|
85
93
|
export function mapCloudNewsArticle(
|
|
86
94
|
item: CloudNewsPayload,
|
|
87
95
|
fallbackTicker?: string,
|
|
@@ -124,6 +132,7 @@ export function mapCloudNewsArticle(
|
|
|
124
132
|
isDeveloping: !!item.flags?.developing,
|
|
125
133
|
sourceCount: item.sourceCount,
|
|
126
134
|
items: item.items?.map(mapCloudNewsStoryItem) ?? [],
|
|
135
|
+
...(routineNotices(item.routine) ? { routine: routineNotices(item.routine)! } : {}),
|
|
127
136
|
};
|
|
128
137
|
}
|
|
129
138
|
|
|
@@ -124,6 +124,8 @@ export function mapQuote(
|
|
|
124
124
|
delisting: parseListingDelisting(quote.delisting),
|
|
125
125
|
intradayBar: readIntradayBar(quote.intradayBar),
|
|
126
126
|
staleReason: readStaleReason(quote.staleReason),
|
|
127
|
+
// An exchange's name, shown as the quote's source: nothing longer or stranger is.
|
|
128
|
+
priceVenue: typeof quote.priceVenue === "string" && /^[A-Za-z][A-Za-z0-9 .-]{0,23}$/.test(quote.priceVenue) ? quote.priceVenue : undefined,
|
|
127
129
|
priceBasis,
|
|
128
130
|
priceObservation,
|
|
129
131
|
currency: currency || quote.currency,
|
|
@@ -143,6 +145,9 @@ export function mapQuote(
|
|
|
143
145
|
low52w: normalizePriceValueByDivisor(quote.low52w, divisor),
|
|
144
146
|
// The service read the 52-week range from its stored daily bars, its source's being unusable.
|
|
145
147
|
yearRangeBasis: quote.yearRangeBasis === "daily-bars" ? "daily-bars" : undefined,
|
|
148
|
+
// What a coin's day range and volume measure: the composite's, or one exchange's own day.
|
|
149
|
+
statsBasis: quote.statsBasis === "composite" || quote.statsBasis === "exchange" ? quote.statsBasis : undefined,
|
|
150
|
+
rangeWidened: quote.rangeWidened === true ? true : undefined,
|
|
146
151
|
// No live quote: the close of the latest daily bar of this session.
|
|
147
152
|
dailyClose: readDailyClose(quote.dailyClose),
|
|
148
153
|
bid: normalizePriceValueByDivisor(quote.bid, divisor),
|
|
@@ -300,6 +305,8 @@ export function mapPricePoint(
|
|
|
300
305
|
...(point.partial === true ? { partial: true } : {}),
|
|
301
306
|
...(point.filled === true ? { filled: true } : {}),
|
|
302
307
|
...(point.unsettled === true ? { unsettled: true } : {}),
|
|
308
|
+
...(point.sessionClose === true ? { sessionClose: true } : {}),
|
|
309
|
+
...(point.beforeClose === true ? { beforeClose: true } : {}),
|
|
303
310
|
...(typeof point.rescaled === "number" && Number.isFinite(point.rescaled) && point.rescaled > 0 && point.rescaled !== 1
|
|
304
311
|
? { rescaled: point.rescaled } : {}),
|
|
305
312
|
...(typeof point.contract === "string" && FUTURES_CONTRACT_CODE.test(point.contract) ? { contract: point.contract } : {}),
|
|
@@ -779,8 +779,11 @@ export class ProviderRouterHistoryRoutes {
|
|
|
779
779
|
if (behind) throw new Error(`Latest history for ${target.symbol} is behind`);
|
|
780
780
|
// A reason the service gave ("ADX listings have daily bars only.") says why; one that has no
|
|
781
781
|
// listing for the symbol says it is not a ticker; otherwise no source answered. A coin trades
|
|
782
|
-
// around the clock and its sources are there: they could not answer just now.
|
|
783
|
-
|
|
782
|
+
// around the clock and its sources are there: they could not answer just now. So could a
|
|
783
|
+
// source that failed (a timeout, a 5xx) rather than had nothing: that is no listing without
|
|
784
|
+
// history, and never reads as one ("No history provider available").
|
|
785
|
+
const failed = coin || attempts.misses.failure !== undefined;
|
|
786
|
+
throw noProviderError(failed ? `No source could load history for ${request.target.symbol} just now` : request.missingProviderError,
|
|
784
787
|
attempts.misses, request.target.symbol);
|
|
785
788
|
}
|
|
786
789
|
// A window of dates no source could answer, because one failed rather than had nothing, is that failure:
|
|
@@ -12,11 +12,16 @@ const SEARCH_CACHE_MAX_ENTRIES = 100;
|
|
|
12
12
|
|
|
13
13
|
const SEARCH_PROVIDER_TIMEOUT_MS = 5_000;
|
|
14
14
|
/**
|
|
15
|
-
* A keystroke path cannot wait the batch budget on a
|
|
15
|
+
* A keystroke path cannot wait the batch budget on a broker that is failing
|
|
16
16
|
* slowly. A broker whose gateway is down is the common case, and five seconds
|
|
17
|
-
* of it is indistinguishable from the feature being broken.
|
|
17
|
+
* of it is indistinguishable from the feature being broken. A data provider
|
|
18
|
+
* keeps the batch budget: its answer is the search's, and one that takes a
|
|
19
|
+
* second (a name it has not searched lately, a client far from it) given up
|
|
20
|
+
* leaves the person with no rows, or with only another spelling's (HSB-C for
|
|
21
|
+
* "hsbc", which it reads as a ticker and answers without HSBC's Hong Kong
|
|
22
|
+
* 0005).
|
|
18
23
|
*/
|
|
19
|
-
const
|
|
24
|
+
const INTERACTIVE_BROKER_SEARCH_TIMEOUT_MS = 800;
|
|
20
25
|
|
|
21
26
|
interface BrokerSearchCandidate {
|
|
22
27
|
brokerId: string;
|
|
@@ -154,8 +159,8 @@ export class ProviderRouterSearchRoutes {
|
|
|
154
159
|
): { first: Promise<InstrumentSearchResult[]>; settled: Promise<void> } {
|
|
155
160
|
const results: InstrumentSearchResult[] = [];
|
|
156
161
|
const resultIndexByKey = new Map<string, number>();
|
|
157
|
-
const
|
|
158
|
-
?
|
|
162
|
+
const brokerTimeoutMs = context?.interactive
|
|
163
|
+
? INTERACTIVE_BROKER_SEARCH_TIMEOUT_MS
|
|
159
164
|
: SEARCH_PROVIDER_TIMEOUT_MS;
|
|
160
165
|
|
|
161
166
|
const cacheResults = (ttl = SEARCH_CACHE_TTL_MS) => {
|
|
@@ -196,7 +201,7 @@ export class ProviderRouterSearchRoutes {
|
|
|
196
201
|
try {
|
|
197
202
|
const items = await settleWithin(
|
|
198
203
|
candidate.broker.searchInstruments!(query, candidate.instance),
|
|
199
|
-
|
|
204
|
+
brokerTimeoutMs,
|
|
200
205
|
);
|
|
201
206
|
record(items && annotateBrokerSearchResults(items, candidate));
|
|
202
207
|
} catch (error) {
|
|
@@ -206,15 +211,15 @@ export class ProviderRouterSearchRoutes {
|
|
|
206
211
|
|
|
207
212
|
const searchProvider = (provider: DataProvider) => (async () => {
|
|
208
213
|
try {
|
|
209
|
-
record(await withDeadline(provider.search(query, context),
|
|
214
|
+
record(await withDeadline(provider.search(query, context), SEARCH_PROVIDER_TIMEOUT_MS, `${provider.id} search timed out`));
|
|
210
215
|
} catch (error) {
|
|
211
216
|
const timedOut = error instanceof OperationTimeoutError;
|
|
212
217
|
if (isNetworkFailure(error)) {
|
|
213
218
|
unreachable ??= error;
|
|
214
|
-
} else if (isProviderBusy(error) ||
|
|
215
|
-
//
|
|
219
|
+
} else if (isProviderBusy(error) || timedOut) {
|
|
220
|
+
// Its full budget waited out: no answer, which is not one that found nothing.
|
|
216
221
|
busy = true;
|
|
217
|
-
} else if (
|
|
222
|
+
} else if (shouldLogProviderError(error)) {
|
|
218
223
|
this.deps.logProviderError(`${provider.id} failed: ${error}`);
|
|
219
224
|
}
|
|
220
225
|
}
|
|
@@ -133,10 +133,11 @@ let pendingQuoteBatch: { requests: Map<string, QuoteRequest>; promise: Promise<v
|
|
|
133
133
|
function queueQuoteLoad(symbol: string, request: QuoteRequest): Promise<void> {
|
|
134
134
|
if (!pendingQuoteBatch) {
|
|
135
135
|
const requests = new Map<string, QuoteRequest>();
|
|
136
|
-
|
|
136
|
+
// A batch that fails rejects for every badge in it, which records the failure.
|
|
137
|
+
const promise = new Promise<void>((resolve, reject) => {
|
|
137
138
|
setTimeout(() => {
|
|
138
139
|
pendingQuoteBatch = null;
|
|
139
|
-
|
|
140
|
+
loadInlineQuotes(requests).then(resolve, reject);
|
|
140
141
|
}, 0);
|
|
141
142
|
});
|
|
142
143
|
pendingQuoteBatch = { requests, promise };
|
|
@@ -250,26 +250,25 @@ export function useQuoteUpdates(
|
|
|
250
250
|
const schedule = (delayMs: number) => {
|
|
251
251
|
timer = setTimeout(() => {
|
|
252
252
|
timer = null;
|
|
253
|
-
|
|
253
|
+
refresh();
|
|
254
254
|
}, Math.max(0, delayMs));
|
|
255
255
|
};
|
|
256
|
-
|
|
256
|
+
// A poll nobody waits on: a failed one is logged and the next comes on schedule.
|
|
257
|
+
const refresh = () => {
|
|
257
258
|
if (cancelled) return;
|
|
258
259
|
schedule(pollIntervalMs);
|
|
259
260
|
if (inFlight) return;
|
|
260
261
|
inFlight = true;
|
|
261
262
|
lastPollRef.current = { key: instrumentKey, at: Date.now() };
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
inFlight = false;
|
|
268
|
-
}
|
|
263
|
+
coordinator.loadQuotesBatch(instruments, { forceRefresh: true })
|
|
264
|
+
.catch(logFailure("state.hooks.quote-streaming", "Polling broker quotes failed"))
|
|
265
|
+
.finally(() => {
|
|
266
|
+
inFlight = false;
|
|
267
|
+
});
|
|
269
268
|
};
|
|
270
269
|
const last = lastPollRef.current;
|
|
271
270
|
const dueIn = last?.key === instrumentKey ? last.at + pollIntervalMs - Date.now() : 0;
|
|
272
|
-
if (dueIn <= 0)
|
|
271
|
+
if (dueIn <= 0) refresh();
|
|
273
272
|
else schedule(dueIn);
|
|
274
273
|
return () => {
|
|
275
274
|
cancelled = true;
|
|
@@ -107,7 +107,7 @@ export function useTeamCollectionsSync(host: Omit<TeamCollectionsHost, "dispatch
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const pullCollections = async () => {
|
|
111
111
|
if (!apiClient.isVerified()) return;
|
|
112
112
|
const currentTeams = teamStore.getSnapshot().teams;
|
|
113
113
|
const lists = await Promise.all(currentTeams.map((team) => apiClient.listTeamCollections(team.id).catch(logFailure("team.collections-sync", "Listing team collections failed", null))));
|
|
@@ -123,6 +123,11 @@ export function useTeamCollectionsSync(host: Omit<TeamCollectionsHost, "dispatch
|
|
|
123
123
|
});
|
|
124
124
|
await applyCollections(teamIds, collections);
|
|
125
125
|
};
|
|
126
|
+
// Nothing waits on a refresh: one that fails (a ticker that cannot be saved)
|
|
127
|
+
// is logged, and the next sign-in or team change pulls again.
|
|
128
|
+
const refresh = () => {
|
|
129
|
+
pullCollections().catch(logFailure("team.collections-sync", "Refreshing team collections failed"));
|
|
130
|
+
};
|
|
126
131
|
|
|
127
132
|
const applyEvent = async (event: TeamCollectionEvent) => {
|
|
128
133
|
if (event.change === "created" || event.change === "updated") {
|
|
@@ -206,9 +211,9 @@ export function useTeamCollectionsSync(host: Omit<TeamCollectionsHost, "dispatch
|
|
|
206
211
|
|
|
207
212
|
const teamKey = teams.map((team) => team.id).join(",");
|
|
208
213
|
useEffect(() => {
|
|
209
|
-
|
|
214
|
+
refresh();
|
|
210
215
|
const unsubscribeUser = apiClient.subscribeCurrentUser(() => {
|
|
211
|
-
|
|
216
|
+
refresh();
|
|
212
217
|
});
|
|
213
218
|
const unsubscribeEvents = apiClient.subscribeCloudEvent("collection.updated", (data) => {
|
|
214
219
|
void applyEvent(data as TeamCollectionEvent);
|
|
@@ -241,6 +241,32 @@ export function recordRestoredFunctions(fns: readonly UsageFunction[]): void {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
/** The install as its usage counts name it: the random install id, the surface and the OS. */
|
|
245
|
+
export interface UsageInstall {
|
|
246
|
+
installId: string;
|
|
247
|
+
surface: UsageCountsSurface;
|
|
248
|
+
os?: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The install as usage counts report it, for what else the Usage setting
|
|
253
|
+
* covers that is filed under the install id (an install experiment, see
|
|
254
|
+
* api-client/install-experiments.ts). Null while nothing can be sent: no
|
|
255
|
+
* host yet, Usage counts off, or no install id. Never throws.
|
|
256
|
+
*/
|
|
257
|
+
export async function usageInstall(): Promise<UsageInstall | null> {
|
|
258
|
+
try {
|
|
259
|
+
const current = host;
|
|
260
|
+
if (!current || !current.isEnabled()) return null;
|
|
261
|
+
const installId = await current.getInstallId();
|
|
262
|
+
if (!installId) return null;
|
|
263
|
+
return { installId, surface: current.surface, ...(current.os ? { os: current.os } : {}) };
|
|
264
|
+
} catch (error) {
|
|
265
|
+
logFailure("telemetry-usage-counts", "Could not read the install id")(error);
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
244
270
|
/** Installs the surface's host and schedules what was counted before it. */
|
|
245
271
|
export function installUsageCounter(next: UsageCounterHost): () => void {
|
|
246
272
|
host = next;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { PersistedResourceValue } from "../types/persistence";
|
|
2
2
|
import type { PluginPersistence } from "../types/plugin";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A mid-morning UTC moment for a test to hold the clock at (`setSystemTime`),
|
|
6
|
+
* when it reads the time of day off a copy `seedResource` saved: that copy is
|
|
7
|
+
* dated a minute before the clock, so in the first minute of a day it is from
|
|
8
|
+
* the day before and reads with its date ("saved copy from 13 Nov 23:59")
|
|
9
|
+
* instead of "saved copy from 23:59". Its minutes and seconds are ones no time
|
|
10
|
+
* zone's midnight falls on, so the minute before it is never another day's
|
|
11
|
+
* wherever the test runs.
|
|
12
|
+
*/
|
|
13
|
+
export const SAVED_COPY_TEST_NOW = Date.parse("2026-11-13T10:17:42Z");
|
|
14
|
+
|
|
4
15
|
export class MemoryPluginPersistence implements PluginPersistence {
|
|
5
16
|
private readonly state = new Map<string, { schemaVersion: number; value: unknown }>();
|
|
6
17
|
private readonly resources = new Map<string, PersistedResourceValue<unknown>>();
|
|
@@ -83,6 +94,7 @@ export class MemoryPluginPersistence implements PluginPersistence {
|
|
|
83
94
|
provenance?: unknown;
|
|
84
95
|
} = {},
|
|
85
96
|
): void {
|
|
97
|
+
// A minute back: see SAVED_COPY_TEST_NOW for what a test that reads this copy's time of day holds the clock for.
|
|
86
98
|
const now = Date.now();
|
|
87
99
|
this.resources.set(this.resourceKey(kind, key, options.sourceKey), {
|
|
88
100
|
value,
|
|
@@ -5,7 +5,7 @@ import type { InstrumentSearchResult } from "../types/instrument";
|
|
|
5
5
|
import { canonicalExchange, isUsEquityExchange, isUsListingExchange, parsePublicTickerKey } from "../utils/exchanges";
|
|
6
6
|
import { companyLines, companyNameExtraWords, companyNameMatch, foldNameLetters, namedByService, runTogether, sameCompany, shortCompanyName } from "./company-name";
|
|
7
7
|
import { LISTING_SEARCH_LIMIT } from "./search";
|
|
8
|
-
import { lineDistance, primaryCompanyLine } from "./search/home-listing";
|
|
8
|
+
import { isFundReceipt, lineDistance, primaryCompanyLine } from "./search/home-listing";
|
|
9
9
|
import { classifyInstrumentKind, isCryptoInstrumentType } from "./search/ranking";
|
|
10
10
|
import { isProviderBusy, type ProviderBusyError } from "../sources/provider-errors";
|
|
11
11
|
import { readTerminalListingCode, type TerminalListing, type TerminalListingCode } from "./terminal-codes";
|
|
@@ -64,8 +64,8 @@ const NOT_COMMON = /preferred|warrant|right|unit|note|bond|debenture/i;
|
|
|
64
64
|
*/
|
|
65
65
|
const DEBT_NAME = /\d(?:[.,]\d+)?\s?%|\bsubordinated\b|\b(?:notes?|bonds?|debentures?)\s+due\b|\bdue\s+(?:\d{1,2}\s+\p{L}+\s+)?(?:19|20)\d{2}\b/iu;
|
|
66
66
|
|
|
67
|
-
/** Whether a search row is a bond, by its type or by its name. */
|
|
68
|
-
function isDebtLine(type: string, name: string | null | undefined): boolean {
|
|
67
|
+
/** Whether a search row is a bond or another line that is not the common share, by its type or by its name. */
|
|
68
|
+
export function isDebtLine(type: string, name: string | null | undefined): boolean {
|
|
69
69
|
return NOT_COMMON.test(type) || DEBT_NAME.test(name ?? "");
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -178,8 +178,9 @@ function rankCompanyLines(name: string, results: readonly InstrumentSearchResult
|
|
|
178
178
|
|| parsePublicTickerKey(result.symbol).exchange) return [];
|
|
179
179
|
// A word alone names a company by these lines only; the company's other lines are still its lines.
|
|
180
180
|
const namesCompany = !(options.oneWord && (match.abbreviated > 0 || isCryptoInstrumentType(type) || !(order === 0 || named || match.extra === 0)));
|
|
181
|
-
// A receipt is a company's shares too, however search types it ("Depositary Receipt" or "American Depositary Receipt")
|
|
182
|
-
|
|
181
|
+
// A receipt is a company's shares too, however search types it ("Depositary Receipt" or "American Depositary Receipt"),
|
|
182
|
+
// unless it is one on a fund search lists under its name: the Tracker Fund's Thai receipt is the fund's line.
|
|
183
|
+
const stock = RECEIPT.test(type) ? (isFundReceipt(result, results) ? 1 : 0) : classifyInstrumentKind(type) === "equity" ? 0 : 1;
|
|
183
184
|
const home = result.homeListing === true;
|
|
184
185
|
const line = home ? 0 : 1 + lineDistance(type, exchange, result.symbol);
|
|
185
186
|
return [{
|
|
@@ -31,9 +31,14 @@ const NAME_NOISE = new Set([
|
|
|
31
31
|
"anonim", "sirketi", "ortakligi",
|
|
32
32
|
]);
|
|
33
33
|
// Turkish legal forms short enough to open another company's name (AO Smith, AO World): a legal form only as its last word.
|
|
34
|
-
|
|
34
|
+
// So is a partnership limited by shares (Hermès International SCA), whatever a venue spells out.
|
|
35
|
+
const LAST_WORD_NOISE = new Set(["ao", "tas", "sca"]);
|
|
36
|
+
// A legal form a venue spells out in words that are no legal form alone: Hermès International Société en commandite par actions.
|
|
37
|
+
const SPELLED_SCA = /\bsociete en commandite par actions\b/g;
|
|
35
38
|
// Words a venue adds to the share it lists ("Microsoft Corporation Common Stock"), never part of whose it is.
|
|
36
|
-
const SHARE_NOISE = new Set(["common", "ordinary", "stock", "shares"]);
|
|
39
|
+
const SHARE_NOISE = new Set(["common", "ordinary", "stock", "shares", "share"]);
|
|
40
|
+
// A venue's short form of a share class word, read as the word: "Volkswagen AG Pref. Share" in Zurich is its "Preferred Stock".
|
|
41
|
+
const SHARE_WORD_FORMS: Readonly<Record<string, string>> = { pref: "preferred", pfd: "preferred" };
|
|
37
42
|
|
|
38
43
|
/** A company's name for comparing its listings: "Kotobuki Spirits Co., Ltd." is "kotobuki spirits". */
|
|
39
44
|
function companyKey(name: string): string {
|
|
@@ -41,7 +46,9 @@ function companyKey(name: string): string {
|
|
|
41
46
|
.replace(/\([^)]*\)/g, " ")
|
|
42
47
|
.replace(/\b(?:(?:american|global) )?depositary (?:shares?|receipts?)\b/g, " ")
|
|
43
48
|
.replace(/\./g, "")
|
|
49
|
+
.replace(SPELLED_SCA, "sca")
|
|
44
50
|
.split(/[^\p{L}\p{N}]+/u)
|
|
51
|
+
.map((word) => SHARE_WORD_FORMS[word] ?? word)
|
|
45
52
|
.filter((word) => word && !NAME_NOISE.has(word));
|
|
46
53
|
// The last word before any share wording, never a name's only one.
|
|
47
54
|
let last = words.length - 1;
|
|
@@ -77,6 +84,19 @@ export function sameCompany(left: string | null | undefined, right: string | nul
|
|
|
77
84
|
return [...fewer].every((word) => more.has(word));
|
|
78
85
|
}
|
|
79
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Whether two names are one company's name however each venue writes the legal
|
|
89
|
+
* form and the share wording: "Deutsche Post AG" and "Deutsche Post" are, "DHL
|
|
90
|
+
* Express" and "DHL" are not (`sameCompany` would read them as one, since one
|
|
91
|
+
* name's words are all in the other's). For a name the data service gives a
|
|
92
|
+
* company besides its own (a former name, a trade name), which a line is told
|
|
93
|
+
* by only when it is exactly that name. An empty name matches none.
|
|
94
|
+
*/
|
|
95
|
+
export function sameCompanyName(left: string | null | undefined, right: string | null | undefined): boolean {
|
|
96
|
+
const a = companyKey(left ?? "");
|
|
97
|
+
return a !== "" && a === companyKey(right ?? "");
|
|
98
|
+
}
|
|
99
|
+
|
|
80
100
|
// Words that tell one class of a company's shares from another ("Berkshire Hathaway Inc. Class B"), never its business.
|
|
81
101
|
const SHARE_CLASS_WORD = /^(?:class|series|[a-z]|\d+)$/;
|
|
82
102
|
|
|
@@ -317,6 +337,20 @@ function nameWord(word: string, opening: boolean, domain: boolean): string {
|
|
|
317
337
|
return `${word.charAt(0)}${word.slice(1).toLowerCase()}`;
|
|
318
338
|
}
|
|
319
339
|
|
|
340
|
+
/**
|
|
341
|
+
* The name a company is introduced by beside its lines on other venues
|
|
342
|
+
* ("Prudential plc trades on HKEX as 2378:HKEX", "HSBC Holdings plc also
|
|
343
|
+
* lists 0005:HKEX"): the name its home line is listed under, which tells
|
|
344
|
+
* Prudential plc from Prudential Financial, else its issuer's, cased. Without
|
|
345
|
+
* the comma or the full stop a listing's name can carry beside its legal form:
|
|
346
|
+
* "HSBC Holdings, plc." is HSBC Holdings plc.
|
|
347
|
+
*/
|
|
348
|
+
export function companyLinesName(listedName: string | null | undefined, issuerName: string): string {
|
|
349
|
+
return (listedName?.trim() || companyNameCase(issuerName))
|
|
350
|
+
.replace(/,\s*(?=(?:plc|inc|ltd|limited|corp|sa|ag|nv|se)\b)/i, " ")
|
|
351
|
+
.replace(/\.$/, "");
|
|
352
|
+
}
|
|
353
|
+
|
|
320
354
|
/**
|
|
321
355
|
* A company name a source writes in capitals (an ETF's holdings file: "APPLE INC", "MERCK & CO INC") as it is
|
|
322
356
|
* normally written: "Apple Inc", "Merck & Co Inc". Legal forms and short words take their usual case, initials
|