@gloom-sh/terminal 0.20.17 → 0.20.18
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 +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/data.ts +3 -2
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +63 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +33 -2
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +138 -22
- package/src/cli/commands/overview.ts +7 -1
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/context.ts +16 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot.ts +72 -9
- package/src/cli/glossary.ts +64 -10
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +6 -2
- package/src/cli/index.ts +1 -0
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +105 -15
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +866 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +24 -6
- package/src/cli/pane-functions/freshness.ts +17 -1
- package/src/cli/pane-functions/index.ts +100 -42
- package/src/cli/pane-functions/resolver.ts +8 -5
- package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
- package/src/cli/pane-functions/screenshot-payload.ts +21 -0
- package/src/cli/pane-functions/screenshot-render.ts +3 -1
- package/src/cli/quote-answer.ts +32 -16
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +5 -4
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +43 -18
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart-table/header.tsx +9 -0
- package/src/components/chart-table/layout.ts +11 -11
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +8 -1
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/workflow/alert.ts +19 -8
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +113 -15
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +2 -1
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +103 -0
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +2 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/split-terms.ts +28 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +36 -30
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/index.tsx +38 -9
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +26 -13
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +5 -2
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +9 -4
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +38 -8
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +3 -0
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
- package/src/plugins/builtin/research/event-model.ts +31 -13
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +19 -4
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +76 -16
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +17 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +13 -4
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +28 -16
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/index.ts +14 -3
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +1 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/ticker.ts +10 -2
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
|
+
import { MISSING_VALUE, formatCurrency } from "../../../utils/format";
|
|
2
2
|
import {
|
|
3
3
|
staticSeries,
|
|
4
4
|
scalarPoint,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
usePaneTabs,
|
|
26
26
|
type ChartTableChart,
|
|
27
27
|
type DataTableColumn,
|
|
28
|
+
type PaneFooterSegment,
|
|
28
29
|
type StatItem,
|
|
29
30
|
} from "../../../components";
|
|
30
31
|
import {
|
|
@@ -60,11 +61,12 @@ import {
|
|
|
60
61
|
NO_HOLDINGS_HINT,
|
|
61
62
|
portfolioRiskRequests,
|
|
62
63
|
portfolioRiskTickers,
|
|
63
|
-
|
|
64
|
-
riskCoverageNotices,
|
|
64
|
+
riskCoverageParts,
|
|
65
65
|
riskCoverageShortfall,
|
|
66
|
+
riskPaneWarnings,
|
|
66
67
|
riskPercentile,
|
|
67
68
|
riskEvidence,
|
|
69
|
+
riskRowWarnings,
|
|
68
70
|
riskReturnsCurrency,
|
|
69
71
|
riskValue,
|
|
70
72
|
RISK_VIEWS,
|
|
@@ -83,6 +85,7 @@ import { CorrelationMatrixGrid, correlationMatrixFits, useCorrelationMatrixNavig
|
|
|
83
85
|
import { usePluginTickerActions } from "../../runtime";
|
|
84
86
|
import { TICKER_RESEARCH_PANE_ID } from "../../../types/config";
|
|
85
87
|
import { formatTickerListInput } from "../../../tickers/list";
|
|
88
|
+
import { getTableWidth } from "../../../components/ui/table-layout";
|
|
86
89
|
|
|
87
90
|
const titles = {
|
|
88
91
|
risk: "Risk",
|
|
@@ -421,8 +424,8 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
421
424
|
[portfolio?.id, tickers],
|
|
422
425
|
);
|
|
423
426
|
const requests = useMemo(
|
|
424
|
-
() => (portfolio ? portfolioRiskRequests(localTickers, portfolio.id) : []),
|
|
425
|
-
[localTickers, portfolio
|
|
427
|
+
() => (portfolio ? portfolioRiskRequests(localTickers, portfolio.id, !(portfolio.brokerId || portfolio.brokerInstanceId || portfolio.brokerAccountId)) : []),
|
|
428
|
+
[localTickers, portfolio],
|
|
426
429
|
);
|
|
427
430
|
const session = useResearchCloudSession();
|
|
428
431
|
const loader = useCallback(
|
|
@@ -562,7 +565,8 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
562
565
|
// A broker linked to the portfolio may still be sending its account history.
|
|
563
566
|
const evidenceLoading = evidenceMissing && view === "performance" && brokerPerformance.loading;
|
|
564
567
|
const detailScrollRef = useRef<ScrollBoxRenderable | null>(null);
|
|
565
|
-
//
|
|
568
|
+
// Evidence that says the same thing on every row belongs in the footer, not repeated per row; a shared date shows
|
|
569
|
+
// where there is room, so every number keeps its date beside it.
|
|
566
570
|
const showPercentile = rows.some((row) => row.percentile != null);
|
|
567
571
|
const sharedDate =
|
|
568
572
|
rows.length > 1 &&
|
|
@@ -628,48 +632,70 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
628
632
|
[frozen, importEvidence, portfolios.length, nextPortfolio],
|
|
629
633
|
);
|
|
630
634
|
// Only real data limitations raise the footer warning; the empty evidence
|
|
631
|
-
// views say what they need in the body, with the import action.
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
...(model
|
|
635
|
+
// views say what they need in the body, with the import action. What
|
|
636
|
+
// concerns one holding is its row's: a left-out holding's reason is its
|
|
637
|
+
// detail, a holding's or an option's failure its note under the table.
|
|
638
|
+
const failures = [
|
|
639
|
+
...(model ? riskPaneWarnings(model) : []),
|
|
640
|
+
...(view === "performance" ? model?.performanceEstimate?.warnings ?? [] : []),
|
|
636
641
|
...shocks.errors,
|
|
637
642
|
...(derived.error ? [derived.error] : []),
|
|
638
643
|
...(resource.error ? [resource.error] : []),
|
|
639
644
|
];
|
|
645
|
+
const notices = [
|
|
646
|
+
...(model?.notes ?? []),
|
|
647
|
+
...failures,
|
|
648
|
+
];
|
|
640
649
|
// What the basket views cover of the book and leave out, unless the body already says why they show nothing.
|
|
641
650
|
// Stress showing its shocks alone says instead why the basket scenarios are not there.
|
|
651
|
+
const coverage = useMemo(
|
|
652
|
+
() => (!model || !BASKET_VIEWS.has(view) || basketBody || stressShortfall ? null : riskCoverageParts(model.coverage)),
|
|
653
|
+
[basketBody, model, stressShortfall, view],
|
|
654
|
+
);
|
|
642
655
|
const coverageText = !model || !BASKET_VIEWS.has(view) || basketBody
|
|
643
656
|
? null
|
|
644
657
|
: stressShortfall
|
|
645
658
|
? `Index, 10Y, VIX and episode scenarios: ${stressShortfall.title.replace(/\.$/, "").replace(/^[A-Z](?=[a-z])/, (letter) => letter.toLowerCase())}`
|
|
646
|
-
:
|
|
659
|
+
: coverage?.text ?? null;
|
|
660
|
+
// The days the returns are on, for a basket that mixes markets: the views read from its returns say so.
|
|
661
|
+
const calendar = model && DAILY_CLOSE_VIEWS.has(view) && !basketBody && !stressShortfall ? model.calendar ?? null : null;
|
|
647
662
|
const asOfDate = (stressShortfall ? rows : model?.rows[view])?.find((row) => row.asOf)?.asOf?.slice(0, 10) ?? null;
|
|
648
663
|
// The views estimated from returns name the currency a non-USD account's returns were converted into.
|
|
649
664
|
const returnsCurrency = BASKET_VIEWS.has(view) && view !== "holdings" && !stressShortfall ? riskReturnsCurrency(model) : null;
|
|
650
|
-
// Dated evidence only when a row has a date; a missing date is not a claim about history.
|
|
651
|
-
const asOfText = !model
|
|
652
|
-
? null
|
|
653
|
-
: [
|
|
654
|
-
...(basketBody ? [] : [
|
|
655
|
-
...(coverageText ? [coverageText] : []),
|
|
656
|
-
...(asOfDate && footerEvidence ? [footerEvidence] : []),
|
|
657
|
-
// The coverage names the currency of its basket value; a non-USD account's returns say what they converted into.
|
|
658
|
-
// An evidence view with nothing in it has no amounts for a currency to describe.
|
|
659
|
-
...(returnsCurrency ? [returnsCurrency] : coverageText || evidenceMissing ? [] : [model.portfolio.currency]),
|
|
660
|
-
...(EVIDENCE_VIEWS.has(view) && model.evidence ? [model.evidence.source] : []),
|
|
661
|
-
]),
|
|
662
|
-
].join(" · ") || null;
|
|
663
665
|
// What the figures are read from and to when: the basket's daily closes, or the marks and evidence of that day.
|
|
664
666
|
// The shocks alone are repriced at the current marks.
|
|
665
667
|
const sourceText = basketBody || !asOfDate
|
|
666
668
|
? null
|
|
667
669
|
: DAILY_CLOSE_VIEWS.has(view) && !stressShortfall ? `daily closes to ${asOfDate}` : `as of ${asOfDate}`;
|
|
670
|
+
// Each fact its own segment, in the order a narrow footer keeps them: what the numbers cover, how the tail rows are
|
|
671
|
+
// estimated and on which days; the date and the currency give way first. A capture keeps the first three, which say
|
|
672
|
+
// what its rows leave out and how they read. Dated evidence only when a row has a date; a missing date is not a
|
|
673
|
+
// claim about history.
|
|
674
|
+
const tailMethodShort = view === "risk" && footerEvidence ? footerEvidence.replace(/^historical, 1-day, \d+%, /, "historical, ") : null;
|
|
675
|
+
const infoSegments = useMemo((): PaneFooterSegment[] => {
|
|
676
|
+
if (!model || basketBody) return [];
|
|
677
|
+
const muted = (text: string) => [{ text, tone: "muted" as const }];
|
|
678
|
+
const text = (id: string, value: string | null | undefined, extra: Partial<PaneFooterSegment> = {}): PaneFooterSegment[] =>
|
|
679
|
+
value ? [{ id, parts: muted(value), ...extra }] : [];
|
|
680
|
+
return [
|
|
681
|
+
...text("coverage", coverageText, { capture: true, ...(coverage && coverage.short !== coverage.text ? { variants: [muted(coverage.short), muted(coverage.shortest)] } : {}) }),
|
|
682
|
+
// The tail rows' labels say 1D and 95%: a narrow row keeps the rest of the method.
|
|
683
|
+
...text("method", asOfDate ? footerEvidence : null, { capture: true, ...(tailMethodShort && tailMethodShort !== footerEvidence ? { variants: [muted(tailMethodShort)] } : {}) }),
|
|
684
|
+
...text("calendar", calendar, { capture: true }),
|
|
685
|
+
...text("source", sourceText, { asOf: true }),
|
|
686
|
+
// The coverage names the currency of its basket value; a non-USD account's returns say what they converted into.
|
|
687
|
+
// An evidence view with nothing in it has no amounts for a currency to describe.
|
|
688
|
+
...text("currency", returnsCurrency ?? (coverageText || evidenceMissing ? null : model.portfolio.currency)),
|
|
689
|
+
...text("evidence", EVIDENCE_VIEWS.has(view) && model.evidence ? model.evidence.source : null),
|
|
690
|
+
];
|
|
691
|
+
}, [asOfDate, basketBody, calendar, coverage, coverageText, evidenceMissing, footerEvidence, model, returnsCurrency, sourceText, tailMethodShort, view]);
|
|
668
692
|
usePaneNoticeFooter({
|
|
669
693
|
registrationId: "portfolio-risk-notices",
|
|
670
694
|
notices,
|
|
671
695
|
focused,
|
|
672
696
|
enabled: !openRow,
|
|
697
|
+
// A capture's footer says what the basket leaves out and how it reads; of the warnings it prints only what failed.
|
|
698
|
+
captureNotes: failures,
|
|
673
699
|
});
|
|
674
700
|
usePaneFooter(
|
|
675
701
|
"portfolio-risk",
|
|
@@ -685,14 +711,9 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
685
711
|
},
|
|
686
712
|
]
|
|
687
713
|
: []),
|
|
688
|
-
// Coverage first: a narrow footer cuts the method and the date before what the numbers cover.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
: []),
|
|
692
|
-
// The source and its date, which a capture's own dated status line stands in for.
|
|
693
|
-
...(sourceText
|
|
694
|
-
? [{ id: "source", asOf: true, parts: [{ text: sourceText, tone: "muted" as const }] }]
|
|
695
|
-
: []),
|
|
714
|
+
// Coverage first: a narrow footer cuts the method and the date before what the numbers cover. The source's
|
|
715
|
+
// date gives way to a capture's own dated status line.
|
|
716
|
+
...infoSegments,
|
|
696
717
|
...(actionStatus
|
|
697
718
|
? [
|
|
698
719
|
{
|
|
@@ -704,7 +725,7 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
704
725
|
],
|
|
705
726
|
hints,
|
|
706
727
|
}),
|
|
707
|
-
[resource.loading, view, episodeResource.loading,
|
|
728
|
+
[resource.loading, view, episodeResource.loading, infoSegments, actionStatus, hints],
|
|
708
729
|
);
|
|
709
730
|
useShortcut(
|
|
710
731
|
(event) => {
|
|
@@ -738,6 +759,15 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
738
759
|
const chart = useMemo<ChartTableChart | null>(() => {
|
|
739
760
|
if (!model) return null;
|
|
740
761
|
if (view === "performance") {
|
|
762
|
+
if (model.performanceEstimate) return {
|
|
763
|
+
series: [staticSeries(
|
|
764
|
+
model.performanceEstimate.points.map((row) => scalarPoint(new Date(row.date), row.value)),
|
|
765
|
+
{ id: "estimated-value", label: model.performanceEstimate.label, color: colors.positive, calendarSpaced: true },
|
|
766
|
+
)],
|
|
767
|
+
formatValue: (value: number) => formatCurrency(value, model.portfolio.currency),
|
|
768
|
+
formatAxisValue: formatPlainAxis,
|
|
769
|
+
remoteKind: "portfolio-risk-history",
|
|
770
|
+
};
|
|
741
771
|
if (!model.performance) return null;
|
|
742
772
|
return {
|
|
743
773
|
series: [staticSeries(
|
|
@@ -772,6 +802,20 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
772
802
|
: sharedUnit
|
|
773
803
|
? sharedUnit.length <= 3 ? `Value ${sharedUnit}` : sharedUnit
|
|
774
804
|
: "Value";
|
|
805
|
+
// Dates that differ always show; one every row shares shows where the row has room for it beside the figures.
|
|
806
|
+
const asOfColumn = useMemo<DataTableColumn | null>(() => {
|
|
807
|
+
const column: DataTableColumn = { id: "asOf", label: "As of", width: 11, align: "left" };
|
|
808
|
+
if (!sharedDate) return column;
|
|
809
|
+
const figures = [
|
|
810
|
+
{ width: 19, align: "left" as const },
|
|
811
|
+
{ width: sharedUnit || attributionParts ? Math.max(9, valueHeader.length) : rows.some((row) => row.amount != null) ? 18 : 16, align: "right" as const },
|
|
812
|
+
...(attributionParts ? ATTRIBUTION_PARTS.map(() => ({ width: 11, align: "right" as const })) : []),
|
|
813
|
+
...(factorFits ? [{ width: 9, align: "right" as const }] : []),
|
|
814
|
+
...(showPercentile ? [{ width: 8, align: "right" as const }] : []),
|
|
815
|
+
];
|
|
816
|
+
// A cell for the scrollbar a long table draws.
|
|
817
|
+
return getTableWidth([...figures, column]) + 1 <= width ? column : null;
|
|
818
|
+
}, [attributionParts, factorFits, rows, sharedDate, sharedUnit, showPercentile, valueHeader, width]);
|
|
775
819
|
const columns = useMemo<DataTableColumn[]>(
|
|
776
820
|
() => [
|
|
777
821
|
{
|
|
@@ -797,9 +841,8 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
797
841
|
...(showPercentile
|
|
798
842
|
? [{ id: "percentile", label: "Pctl 1Y", width: 8, align: "right" as const }]
|
|
799
843
|
: []),
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
: [{ id: "asOf", label: "As of", width: 11, align: "left" as const }]),
|
|
844
|
+
// Every row's date where there is room, the one they share too: each number says when it is from.
|
|
845
|
+
...(asOfColumn ? [asOfColumn] : []),
|
|
803
846
|
// Attribution's evidence is the three effects, now columns of their own.
|
|
804
847
|
...(width >= 95 && !footerEvidence && !attributionParts
|
|
805
848
|
? [
|
|
@@ -813,7 +856,7 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
813
856
|
]
|
|
814
857
|
: []),
|
|
815
858
|
],
|
|
816
|
-
[width, view, valueHeader, sharedUnit, attributionParts, factorFits, footerEvidence, showPercentile,
|
|
859
|
+
[width, view, valueHeader, sharedUnit, attributionParts, factorFits, footerEvidence, showPercentile, asOfColumn, rows],
|
|
817
860
|
);
|
|
818
861
|
const selectView = (value: string) => {
|
|
819
862
|
setView(value);
|
|
@@ -982,6 +1025,10 @@ export function PortfolioRiskPane({ focused, width, height }: PaneProps) {
|
|
|
982
1025
|
return { text: factorFits ? withoutFactorFit(row.detail) : row.detail };
|
|
983
1026
|
}}
|
|
984
1027
|
selectedTextOverridesCellColor
|
|
1028
|
+
rowNote={(row) => {
|
|
1029
|
+
const notes = model ? riskRowWarnings(model, row.label) : [];
|
|
1030
|
+
return notes.length ? `${row.label}: ${notes.join(" ")}` : null;
|
|
1031
|
+
}}
|
|
985
1032
|
onActivate={(row) => setOpen(row.id)}
|
|
986
1033
|
detailOpen={!!openRow}
|
|
987
1034
|
detailTitle={openRow?.label}
|
|
@@ -194,7 +194,7 @@ function AwardsView({ width, height, focused, symbol }: PaneProps & { symbol: st
|
|
|
194
194
|
// The same coverage notes `fn AWARDS` prints: what the awards shown may be missing.
|
|
195
195
|
...(data ? awardsCoverageNotes(data) : []),
|
|
196
196
|
...(loaded?.refreshError ? [loaded.refreshError] : []),
|
|
197
|
-
...(data?.truncated && Object.values(data.truncated).some(Boolean) ? ["Some
|
|
197
|
+
...(data?.truncated && Object.values(data.truncated).some(Boolean) ? ["Some breakdowns list only their first entries; narrow the date range or scope to see the rest."] : []),
|
|
198
198
|
...(tab === "company" && currencies.length > 1 && !currency ? [`Chart in ${chartCurrency}; select a currency to inspect other obligations.`] : []),
|
|
199
199
|
...(tab === "company" && scopes.length > 1 && !source ? [`Chart covers ${awardScope(chartSource).toLowerCase()}; select a scope to inspect other contracts.`] : []),
|
|
200
200
|
...(data && (tab === "feed" || tab === "company") ? [futureAwardDatesNote(rows, data.generatedAt)].filter((note): note is string => !!note) : []),
|
|
@@ -2,7 +2,7 @@ import { MISSING_VALUE } from "../../../utils/format";
|
|
|
2
2
|
import { logFailure } from "../../../utils/log-failure";
|
|
3
3
|
import { useCallback, useEffect, useId, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import {
|
|
5
|
-
Badge, Button, DataTableView, IconButton, PaneStatusBody, RatioBar, SegmentedControl, Notice, SectionHeading, confirmDialog, usePaneFooter, usePaneNoticeFooter,
|
|
5
|
+
Badge, Button, DataTableView, IconButton, PaneStatusBody, RatioBar, SegmentedControl, Notice, RowNote, SectionHeading, confirmDialog, usePaneFooter, usePaneNoticeFooter,
|
|
6
6
|
type DataTableCell, type DataTableColumn, type SelectControl,
|
|
7
7
|
} from "../../../components";
|
|
8
8
|
import { loadingErrorFooterInfo, usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
@@ -505,7 +505,7 @@ export function BrokerOrdersView({
|
|
|
505
505
|
}}
|
|
506
506
|
selection={{ kind: "id", selectedId: selected ? brokerOrderKey(selected) : "", getId: brokerOrderKey, onChange: (key) => { selectedKeyRef.current = key; setSelectedKey(key); } }}
|
|
507
507
|
onActivate={modifyOrder} selectedTextOverridesCellColor emptyStateTitle="No open orders in this account."
|
|
508
|
-
rootAfter={selectedNote ? <
|
|
508
|
+
rootAfter={selectedNote ? <RowNote tone={selectedNote.tone}>{selectedNote.text}</RowNote> : undefined} />
|
|
509
509
|
: <DataTableView<BrokerExecution> rootWidth={width} rootHeight={Math.max(2, height - 2)} focused={focused && !dialogOpen}
|
|
510
510
|
columns={activityColumns.map((column) => column.id === "quantity" && summaries ? { ...column, label: "Cumulative qty" } : column)}
|
|
511
511
|
items={snapshot?.executions ?? []} sortColumnId={null} sortDirection="desc" getItemKey={(execution) => execution.execId}
|
|
@@ -25,9 +25,15 @@ export function policyObservations(data: CentralBankRatesPayload): { asOf: strin
|
|
|
25
25
|
return data.rows.filter((row) => row.status !== "unavailable").map((row) => ({ asOf: row.asOf, stale: row.status === "stale" }));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/** Why a bank's row has no rate, or an old one; the board says it under itself while the row is selected. */
|
|
29
|
+
export function policyRowNote(row: CentralBankRow): string | null {
|
|
30
|
+
return row.status === "stale" ? `${row.label}: stale, latest observation ${row.asOf ?? "unknown"}${row.lagDays == null ? "" : ` (${row.lagDays} days old)`}.`
|
|
31
|
+
: row.status === "unavailable" ? `${row.label}: ${(row.unavailableReason ?? "unavailable").replaceAll("-", " ")}.` : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Every listed row's note, as the report lists them. */
|
|
28
35
|
export function policyNotices(data: CentralBankRatesPayload): string[] {
|
|
29
|
-
return data.rows.filter((row) => !hasNoPolicyRate(row)).flatMap((row) => row
|
|
30
|
-
: row.status === "unavailable" ? [`${row.label}: ${(row.unavailableReason ?? "unavailable").replaceAll("-", " ")}.`] : []);
|
|
36
|
+
return data.rows.filter((row) => !hasNoPolicyRate(row)).flatMap((row) => policyRowNote(row) ?? []);
|
|
31
37
|
}
|
|
32
38
|
export function policyHistory(row: CentralBankRow) {
|
|
33
39
|
return row.history.filter((point) => (!row.percentile.windowStart || point.date >= row.percentile.windowStart)
|
|
@@ -16,7 +16,7 @@ import { getCachedCentralBankRates, loadCentralBankRates } from "./client";
|
|
|
16
16
|
import { centralBankRatesHeadless } from "./headless";
|
|
17
17
|
import { reportFooterSegment } from "../shared/source-footer";
|
|
18
18
|
import {
|
|
19
|
-
hasNoPolicyRate, policyBoardRow, policyChange, policyChangeDate, policyHistory, policyLevel,
|
|
19
|
+
hasNoPolicyRate, policyBoardRow, policyChange, policyChangeDate, policyHistory, policyLevel, policyObservations, policyRate, policyRowNote,
|
|
20
20
|
policySource,
|
|
21
21
|
} from "./model";
|
|
22
22
|
|
|
@@ -68,7 +68,8 @@ export function CentralBankRatesPane({ width, height, focused }: PaneProps) {
|
|
|
68
68
|
useAutoRefresh(resource.updatedAt, resource.load);
|
|
69
69
|
usePaneRefreshKey(() => resource.reload(), { focused });
|
|
70
70
|
usePaneNoticeFooter({ registrationId: "central-bank-rates:notices", focused,
|
|
71
|
-
|
|
71
|
+
// A bank with no rate or an old one says so on its row (`rowNote`); the footer is the board's.
|
|
72
|
+
notices: resource.data?.refreshError ? [resource.data.refreshError] : [] });
|
|
72
73
|
usePaneStatusLinkFooter({ registrationId: "central-bank-rates", focused, loading: resource.loading, error: resource.error,
|
|
73
74
|
url: selected?.observation.sourceUrl ?? null, showOpenHint: true,
|
|
74
75
|
// Its sources and the rows' dates, as `fn CBR` ends; how long ago it loaded goes first on a narrow row.
|
|
@@ -82,7 +83,8 @@ export function CentralBankRatesPane({ width, height, focused }: PaneProps) {
|
|
|
82
83
|
{/* The board heads the move's date LAST CHANGE, so the move itself is MOVE. */}
|
|
83
84
|
{data ? <MarketBoardStack rows={rows} width={width} height={height} focused={focused}
|
|
84
85
|
selectedId={selectedId} onSelectedIdChange={setSelectedId} openId={openId} onOpenIdChange={setOpenId}
|
|
85
|
-
valueWidth={14} changeLabel="MOVE" labelHeader="JURISDICTION" labelWidth={14} labelDetailHeader="INSTRUMENT"
|
|
86
|
+
valueWidth={14} changeLabel="MOVE" labelHeader="JURISDICTION" labelWidth={14} labelDetailHeader="INSTRUMENT"
|
|
87
|
+
rowNote={(row) => policyRowNote(row.observation)} renderDetail={(row) => <PolicyDetail row={row.observation} width={width} height={Math.max(5, height - 2)} focused={focused} />} /> : null}
|
|
86
88
|
</PaneStatusBody>
|
|
87
89
|
</Box>;
|
|
88
90
|
}
|
|
@@ -67,7 +67,7 @@ export function applyChartComposerCapabilityOptions(
|
|
|
67
67
|
let next = spec;
|
|
68
68
|
if ((options.rangePreset ?? options.range) === "YTD") {
|
|
69
69
|
// A year of daily bars, shown from the prior year's last close.
|
|
70
|
-
next = { ...next, viewport: { ...next.viewport, range: "1Y", dateWindow: yearToDateWindow(next) } };
|
|
70
|
+
next = { ...next, viewport: { ...next.viewport, range: "1Y", dateWindow: { ...yearToDateWindow(next), endAtLatestObservation: true } } };
|
|
71
71
|
}
|
|
72
72
|
const selectedRange = chartRange(options);
|
|
73
73
|
const range = capabilityId === "intraday-price-chart" && typeof options.session === "string"
|
|
@@ -90,7 +90,9 @@ export function applyChartComposerCapabilityOptions(
|
|
|
90
90
|
? readPriceWindow(typeof options.from === "string" ? options.from : undefined, typeof options.to === "string" ? options.to : undefined)
|
|
91
91
|
: null;
|
|
92
92
|
if (window) {
|
|
93
|
-
next = { ...next, viewport: { ...next.viewport, range: rangeCovering(window.from), dateWindow: {
|
|
93
|
+
next = { ...next, viewport: { ...next.viewport, range: rangeCovering(window.from), dateWindow: {
|
|
94
|
+
start: window.from, end: window.to, ...(options.to == null ? { endAtLatestObservation: true } : {}),
|
|
95
|
+
} } };
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
if (capabilityId === "price-chart" && options.extendedHours === true) {
|
|
@@ -4,7 +4,6 @@ import { Box } from "../../../ui";
|
|
|
4
4
|
import {
|
|
5
5
|
DataTableView,
|
|
6
6
|
QueryBar,
|
|
7
|
-
usePaneNoticeFooter,
|
|
8
7
|
usePaneTabs,
|
|
9
8
|
useQueryBarSearch,
|
|
10
9
|
type DataTableCell,
|
|
@@ -243,11 +242,6 @@ export function DataCatalogPane({ focused, width, height }: PaneProps) {
|
|
|
243
242
|
}
|
|
244
243
|
}, []);
|
|
245
244
|
|
|
246
|
-
usePaneNoticeFooter({
|
|
247
|
-
registrationId: `${DATA_CATALOG_PANE_ID}:notices`,
|
|
248
|
-
focused,
|
|
249
|
-
notices: selectedRow?.limitation ? [`${selectedRow.label}: ${selectedRow.limitation}`] : [],
|
|
250
|
-
});
|
|
251
245
|
|
|
252
246
|
usePaneStatusLinkFooter({
|
|
253
247
|
registrationId: DATA_CATALOG_PANE_ID,
|
|
@@ -315,6 +309,8 @@ export function DataCatalogPane({ focused, width, height }: PaneProps) {
|
|
|
315
309
|
getItemKey={(row) => row.id}
|
|
316
310
|
onActivate={chartSelected}
|
|
317
311
|
renderCell={renderCell}
|
|
312
|
+
// A series' limitation is its row's, under the table while it is selected; the footer is the catalog's.
|
|
313
|
+
rowNote={(row) => row.limitation ? `${row.label}: ${row.limitation}` : null}
|
|
318
314
|
selectedTextOverridesCellColor
|
|
319
315
|
emptyStateTitle={emptyCopy.title}
|
|
320
316
|
emptyStateHint={emptyCopy.hint}
|
|
@@ -1217,8 +1217,11 @@ function ChartComposerSurface({
|
|
|
1217
1217
|
const timeZone = exchange?.kind === "security"
|
|
1218
1218
|
? intradaySessionTimeZone(exchange.instrument.symbol, exchange.instrument.exchange)
|
|
1219
1219
|
: "UTC";
|
|
1220
|
-
|
|
1221
|
-
|
|
1220
|
+
const end = window.endAtLatestObservation && viewport?.end
|
|
1221
|
+
? /^\d{4}-\d{2}-\d{2}$/.test(window.end) ? viewport.end.toISOString().slice(0, 10) : viewport.end.toISOString()
|
|
1222
|
+
: window.end;
|
|
1223
|
+
return formatChartDateWindow({ ...window, end }, timeZone);
|
|
1224
|
+
}, [spec.series, spec.viewport.dateWindow, viewport?.end]);
|
|
1222
1225
|
|
|
1223
1226
|
// A generic future (CL1) is a rolling series: its roll rule and adjustment are chart controls.
|
|
1224
1227
|
const generic = useMemo(() => chartFuturesGeneric(spec), [spec]);
|
|
@@ -35,9 +35,14 @@ function openAuth(
|
|
|
35
35
|
const RESEND_VERIFICATION = "Resend Verification Email";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* The account actions as buttons:
|
|
38
|
+
* The account actions as buttons: Sign up free and Log in, or the resend for
|
|
39
39
|
* an unconfirmed address. One look for the wall and for the inline copy, so
|
|
40
40
|
* the same action never reads as two different controls.
|
|
41
|
+
*
|
|
42
|
+
* Where both show, Sign up free leads and is the primary: most people who
|
|
43
|
+
* meet a wall have no account yet, and a Log in form is a dead end for them.
|
|
44
|
+
* Log in stays beside it. A surface that offers Log in alone (a saved login)
|
|
45
|
+
* keeps it as its primary.
|
|
41
46
|
*/
|
|
42
47
|
function AuthButtons({ showSignup, needsVerification, onAuth, onResend, stopPropagation = false }: {
|
|
43
48
|
showSignup: boolean;
|
|
@@ -50,8 +55,8 @@ function AuthButtons({ showSignup, needsVerification, onAuth, onResend, stopProp
|
|
|
50
55
|
if (needsVerification) return <Button label={t(RESEND_VERIFICATION)} stopPropagation={stopPropagation} onPress={onResend} />;
|
|
51
56
|
return (
|
|
52
57
|
<>
|
|
53
|
-
<Button label={t("
|
|
54
|
-
|
|
58
|
+
{showSignup && <Button label={t("Sign up free")} variant="primary" stopPropagation={stopPropagation} onPress={() => onAuth("signup")} />}
|
|
59
|
+
<Button label={t("Log in")} variant={showSignup ? "secondary" : "primary"} stopPropagation={stopPropagation} onPress={() => onAuth("login")} />
|
|
55
60
|
</>
|
|
56
61
|
);
|
|
57
62
|
}
|
|
@@ -79,17 +84,17 @@ export function InlineAuthActions({ showSignup = true, needsVerification = false
|
|
|
79
84
|
usePaneMenuItems(`inline-auth:${useId()}`, () => needsVerification
|
|
80
85
|
? [{ id: "resend-verification", label: t(RESEND_VERIFICATION), onSelect: resend }]
|
|
81
86
|
: [
|
|
82
|
-
{ id: "log-in", label: t("Log in"), onSelect: logIn },
|
|
83
87
|
...(showSignup ? [{ id: "sign-up", label: t("Sign up free"), onSelect: signUp }] : []),
|
|
88
|
+
{ id: "log-in", label: t("Log in"), onSelect: logIn },
|
|
84
89
|
], [openCommandBar, needsVerification, showSignup]);
|
|
85
90
|
if (variant === "plain") {
|
|
86
91
|
return (
|
|
87
92
|
<Box flexDirection="row">
|
|
88
|
-
<Button label={t("Log in")} variant="plain" compact stopPropagation onPress={logIn} />
|
|
89
93
|
{showSignup && <>
|
|
90
|
-
<Text fg={colors.textDim}> / </Text>
|
|
91
94
|
<Button label={t("Sign up free")} variant="plain" compact stopPropagation onPress={signUp} />
|
|
95
|
+
<Text fg={colors.textDim}> / </Text>
|
|
92
96
|
</>}
|
|
97
|
+
<Button label={t("Log in")} variant="plain" compact stopPropagation onPress={logIn} />
|
|
93
98
|
</Box>
|
|
94
99
|
);
|
|
95
100
|
}
|
|
@@ -577,13 +577,15 @@ export function CompanyPicker({
|
|
|
577
577
|
/**
|
|
578
578
|
* Mounted next to the onboarding. Opens once per session, when a brand-new
|
|
579
579
|
* account is signed in with only the seeded lists and the onboarding is not
|
|
580
|
-
* running.
|
|
580
|
+
* running. It waits for an open command bar to close: the card takes every
|
|
581
|
+
* key, so what the user was typing there would go nowhere.
|
|
581
582
|
*/
|
|
582
583
|
export function CompanyPickerHost({ pluginRegistry }: { pluginRegistry: PluginRegistry }) {
|
|
583
584
|
const dispatch = useAppDispatch();
|
|
584
585
|
const stateRef = useAppStateRef();
|
|
585
586
|
const toast = useToastHost();
|
|
586
587
|
const onboardingDone = useAppSelector((state) => state.config.onboardingComplete && !state.config.onboardingProgress);
|
|
588
|
+
const commandBarOpen = useAppSelector((state) => state.commandBarOpen);
|
|
587
589
|
const [user, setUser] = useState<AuthUser | null>(() => apiClient.getCurrentUser());
|
|
588
590
|
const [open, setOpen] = useState(false);
|
|
589
591
|
const askedRef = useRef(false);
|
|
@@ -591,12 +593,12 @@ export function CompanyPickerHost({ pluginRegistry }: { pluginRegistry: PluginRe
|
|
|
591
593
|
useEffect(() => apiClient.subscribeCurrentUser(() => setUser(apiClient.getCurrentUser())), []);
|
|
592
594
|
|
|
593
595
|
useEffect(() => {
|
|
594
|
-
if (askedRef.current || !onboardingDone || !isNewAccount(user)) return;
|
|
596
|
+
if (askedRef.current || !onboardingDone || commandBarOpen || !isNewAccount(user)) return;
|
|
595
597
|
const watchlistId = stateRef.current.config.watchlists[0]?.id;
|
|
596
598
|
if (!needsCompanyPicks(stateRef.current.tickers.values(), watchlistId)) return;
|
|
597
599
|
askedRef.current = true;
|
|
598
600
|
setOpen(true);
|
|
599
|
-
}, [onboardingDone, stateRef, user]);
|
|
601
|
+
}, [commandBarOpen, onboardingDone, stateRef, user]);
|
|
600
602
|
|
|
601
603
|
const searchCompanies = useCallback<SearchCompanies>(
|
|
602
604
|
(query) => pluginRegistry.marketData.search(query),
|
|
@@ -24,7 +24,7 @@ export function registerCloudUpgradeCommand(ctx: GloomPluginContext): void {
|
|
|
24
24
|
};
|
|
25
25
|
if (!apiClient.isSignedIn()) {
|
|
26
26
|
// Upgrading needs an account first; continue to checkout once signed in.
|
|
27
|
-
if (!requestAuthDialog({ mode: "signup", onSignedIn: openUpgrade })) {
|
|
27
|
+
if (!requestAuthDialog({ mode: "signup", onSignedIn: openUpgrade, checkout: true })) {
|
|
28
28
|
ctx.openCommandBar("Sign Up");
|
|
29
29
|
}
|
|
30
30
|
return;
|
|
@@ -7,9 +7,10 @@ import type { HeadlessBundleSection, HeadlessPaneColumn, HeadlessPaneDefinition
|
|
|
7
7
|
import { withoutQuietColumns } from "../shared/research-cells";
|
|
8
8
|
import { resolveHeadlessIssuerListing } from "../shared/headless-market-data";
|
|
9
9
|
import { companyQuery, fetchCompanyData, type CompanyDataset, type CompanyMode } from "./client";
|
|
10
|
-
import { allGuidance, allObservations, companyCellText, companyColumns, companyEmptyState, companyPreviewNote, KPI_COVERAGE_NOTE, kpiFreeLimitNote, QUIET_COLUMNS,
|
|
10
|
+
import { allGuidance, allObservations, companyCellText, companyColumns, companyEmptyState, companyPreviewNote, guidanceIssueNote, KPI_COVERAGE_NOTE, kpiFreeLimitNote, QUIET_COLUMNS,
|
|
11
11
|
type CompanyRow } from "./model";
|
|
12
12
|
import type { KpiObservation } from "../../../api-client/company-kpis";
|
|
13
|
+
import { currentKpiSeries } from "./latest";
|
|
13
14
|
|
|
14
15
|
/** What the server takes as a metric; anything else is not a metric id and is not sent. */
|
|
15
16
|
const METRIC_ID = /^[a-z0-9_]{1,80}$/;
|
|
@@ -108,9 +109,13 @@ export function companyHeadless(mode: CompanyMode): HeadlessPaneDefinition<"bund
|
|
|
108
109
|
const shown = rows.filter(keep);
|
|
109
110
|
return { title, columns: reportColumns(mode, history, revisions, shown, observations), rows: shown.map((row) => ({ ...row })), ...(empty && first ? { empty } : {}) };
|
|
110
111
|
};
|
|
111
|
-
const latest = ("series" in data ? data.series.map((series) => series.latest) : data.guidance).filter(keep);
|
|
112
|
+
const latest = ("series" in data ? currentKpiSeries(data.series).map((series) => series.latest) : data.guidance).filter(keep);
|
|
112
113
|
const ignored = data.access === "preview" ? PRO_FILTERS.filter((key) => typeof args.options[key] === "string" && args.options[key] !== "") : [];
|
|
113
114
|
const notes = [ageNote(data, latest, mode),
|
|
115
|
+
...("guidance" in data ? data.guidance.filter(keep).flatMap((row) => {
|
|
116
|
+
const note = guidanceIssueNote(row, data.guidance);
|
|
117
|
+
return note ? [`${row.metric.name}: ${note}.`] : [];
|
|
118
|
+
}) : []),
|
|
114
119
|
ignored.length ? `The free preview is fixed: ${ignored.map(optionFlag).join(", ")} ${ignored.length > 1 ? "need" : "needs"} Gloom Pro.` : null,
|
|
115
120
|
...companyDataNotes(data.companyFrom)].filter((note): note is string => !!note);
|
|
116
121
|
// A company with nothing on file says so once, as the pane does, rather than "not covered".
|
|
@@ -119,10 +124,10 @@ export function companyHeadless(mode: CompanyMode): HeadlessPaneDefinition<"bund
|
|
|
119
124
|
return { complete: !data.truncated, ...(nothingOnFile ? { empty: `${title} ${hint}` } : {}), errors: data.truncated ? [data.access === "preview" ? companyPreviewNote(data, mode === "guidance") : "Response limit reached; narrow the metric or date range"] : [],
|
|
120
125
|
...(notes.length ? { notes } : {}),
|
|
121
126
|
sections: "series" in data ? [
|
|
122
|
-
section("Latest KPIs", data.series.map((series) => series.latest), { first: true }),
|
|
127
|
+
section("Latest KPIs", currentKpiSeries(data.series).map((series) => series.latest), { first: true }),
|
|
123
128
|
section("KPI history", data.series.flatMap((series) => series.observations)),
|
|
124
129
|
section("Revisions and conflicts", data.revisions, { revisions: true }),
|
|
125
|
-
] : [section("
|
|
130
|
+
] : [section("Latest disclosed guidance", data.guidance, { first: true }), section("Guidance history", data.history, { history: true })],
|
|
126
131
|
metadata: { symbol: data.symbol, asOf: data.asOf, access: data.access, coverage: data.coverage, dictionary: data.dictionary,
|
|
127
132
|
lockedRows: data.lockedRows, totalRows: data.totalRows, methodology: data.methodology } };
|
|
128
133
|
},
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { KpiPeriod } from "../../../api-client/company-kpis";
|
|
2
|
+
|
|
3
|
+
const DAY_MS = 86_400_000;
|
|
4
|
+
/**
|
|
5
|
+
* A series whose latest figure ended this long before the company's newest
|
|
6
|
+
* figure of its kind (a year's, or a quarter's, half's, year to date's or
|
|
7
|
+
* date's) is one the company no longer reports: nine months, so a year stays
|
|
8
|
+
* until the next one and a quarter until the third one after it.
|
|
9
|
+
*/
|
|
10
|
+
const NO_LONGER_REPORTED_DAYS = 270;
|
|
11
|
+
|
|
12
|
+
type Kind = "year" | "interim";
|
|
13
|
+
const kindOf = (period: Pick<KpiPeriod, "kind">): Kind => (period.kind === "year" ? "year" : "interim");
|
|
14
|
+
const endOf = (period: Pick<KpiPeriod, "end">): number => (period.end ? Date.parse(period.end) : Number.NaN);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The series whose latest figure is still the company's: Latest KPIs lists
|
|
18
|
+
* these, KPI history every one. HSBC's series of diluted quarterly EPS ended
|
|
19
|
+
* with Q1 FY2024, two years before its newest quarter, and Latest listed that
|
|
20
|
+
* EPS beside FY2025's; AIA's FY2024 segment figures stood beside its FY2025
|
|
21
|
+
* ones, and Xiaomi's third quarter of 2025 beside its second of 2026. A
|
|
22
|
+
* series is left out once its latest figure ended NO_LONGER_REPORTED_DAYS or
|
|
23
|
+
* more before the newest figure of its kind among all the company's series (a
|
|
24
|
+
* quarter's, half's or date's, before the newest of either kind). A figure
|
|
25
|
+
* with no end date stays.
|
|
26
|
+
*/
|
|
27
|
+
export function currentKpiSeries<T extends { latest: { period: Pick<KpiPeriod, "kind" | "end"> } }>(series: readonly T[]): T[] {
|
|
28
|
+
const newest = new Map<Kind, number>();
|
|
29
|
+
for (const { latest } of series) {
|
|
30
|
+
const end = endOf(latest.period);
|
|
31
|
+
const kind = kindOf(latest.period);
|
|
32
|
+
if (Number.isFinite(end) && end > (newest.get(kind) ?? Number.NEGATIVE_INFINITY)) newest.set(kind, end);
|
|
33
|
+
}
|
|
34
|
+
// A year stands until the next year; a quarter, half or date is measured against the newest figure of any kind,
|
|
35
|
+
// so one long older than the company's latest year is no current quarter either.
|
|
36
|
+
const reference = (kind: Kind) => kind === "year"
|
|
37
|
+
? newest.get("year")
|
|
38
|
+
: Math.max(newest.get("interim") ?? Number.NEGATIVE_INFINITY, newest.get("year") ?? Number.NEGATIVE_INFINITY);
|
|
39
|
+
return series.filter(({ latest }) => {
|
|
40
|
+
const end = endOf(latest.period);
|
|
41
|
+
const latestOfKind = reference(kindOf(latest.period));
|
|
42
|
+
return !Number.isFinite(end) || latestOfKind === undefined || !Number.isFinite(latestOfKind)
|
|
43
|
+
|| (latestOfKind - end) / DAY_MS < NO_LONGER_REPORTED_DAYS;
|
|
44
|
+
});
|
|
45
|
+
}
|