@gloom-sh/terminal 0.20.17 → 0.20.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/cot.ts +5 -6
- package/src/api-client/data.ts +14 -3
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +64 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- 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 +37 -4
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +1 -2
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +191 -39
- 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/commands/ticker.ts +13 -6
- package/src/cli/context.ts +24 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +276 -52
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +65 -11
- package/src/cli/help.ts +1 -1
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +8 -4
- package/src/cli/index.ts +2 -1
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +192 -38
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +877 -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 +54 -8
- package/src/cli/pane-functions/freshness.ts +39 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +175 -50
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +11 -7
- package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +36 -1
- package/src/cli/pane-functions/screenshot-render.ts +24 -9
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +33 -17
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +22 -4
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +48 -20
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +11 -2
- package/src/components/chart-table/layout.ts +16 -17
- 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 +19 -4
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +32 -13
- 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 +123 -17
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- 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/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- 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/opentui/index.tsx +7 -0
- 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 +34 -2
- 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 +122 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +11 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/market-data/split-terms.ts +28 -0
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -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 +101 -48
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +97 -16
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +27 -14
- 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/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- 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/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- 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/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +10 -5
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +57 -15
- 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/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- 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/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +16 -6
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +7 -4
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +7 -2
- 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/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- 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 +25 -7
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- 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/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -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/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- 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/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- 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/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
- package/src/plugins/builtin/research/event-model.ts +43 -19
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +49 -5
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- 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 +79 -18
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- 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/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
- 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 +16 -7
- 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 +32 -18
- 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/model.ts +6 -1
- 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/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- 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/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- 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/http-fetch.ts +3 -2
- 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 +22 -9
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/history.ts +32 -6
- 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/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +42 -3
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +3 -2
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +48 -4
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/types/ticker.ts +10 -2
- package/src/ui/host.tsx +2 -0
- 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/exchange-announcements.ts +7 -2
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
- 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
|
@@ -7,7 +7,7 @@ import { useShortcut } from "../../../react/input";
|
|
|
7
7
|
import { isPlainKey } from "../../../utils/keyboard";
|
|
8
8
|
import { logFailure } from "../../../utils/log-failure";
|
|
9
9
|
import { instrumentFromTicker } from "../../../market-data/request-types";
|
|
10
|
-
import { useDebouncedPluginPaneState, usePluginPaneState } from "../../runtime";
|
|
10
|
+
import { useDebouncedPluginPaneState, usePluginAppActions, usePluginPaneState } from "../../runtime";
|
|
11
11
|
import { usePaneSettingValue } from "../../../state/app/context";
|
|
12
12
|
import { Box, Text, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
|
|
13
13
|
import { FILL_REST } from "../../../components/ui/fill";
|
|
@@ -27,6 +27,7 @@ import { fundAbroadProfile, venueAbroad, type FundAbroadProfile } from "./fund-a
|
|
|
27
27
|
import { listingAnnouncementsPage, type ExchangeAnnouncementsPage } from "../../../utils/exchange-announcements";
|
|
28
28
|
import { form4TradeText, isOtherIssuerForm4, pricingSupplementTest } from "../../../utils/sec-filings";
|
|
29
29
|
import { formatInsiderName } from "../insider/display";
|
|
30
|
+
import { filingStorySource, useFilingStories, type FilingStory } from "../insider/filing-stories";
|
|
30
31
|
import { parseForm4Xml } from "../insider/insider-data";
|
|
31
32
|
import { createTickerSurfacePaneTemplate } from "../shared/ticker-surface";
|
|
32
33
|
import {
|
|
@@ -176,6 +177,8 @@ function toFeedItems(
|
|
|
176
177
|
loadingDocuments: boolean,
|
|
177
178
|
documentsError: string | null,
|
|
178
179
|
contentErrors: Map<string, string>,
|
|
180
|
+
/** The stories that report the open filing, a Form 4, each a fact that opens it. */
|
|
181
|
+
openStories: { accession: string; stories: readonly FilingStory[]; open: (story: FilingStory) => void } | null = null,
|
|
179
182
|
): FeedDataTableItem[] {
|
|
180
183
|
// A Form 144 names its seller freely; the insider forms read beside it say which way round.
|
|
181
184
|
const knownOwners = filings.flatMap((filing) => ownerNames(filing.form, contentCache.get(filing.accessionNumber)));
|
|
@@ -231,6 +234,13 @@ function toFeedItems(
|
|
|
231
234
|
...(acceptedAt ? [{ label: "SEC-reported acceptance", value: acceptedAt }] : []),
|
|
232
235
|
...(items ? [{ label: "Items", value: items }] : []),
|
|
233
236
|
{ label: "Accession", value: filing.accessionNumber },
|
|
237
|
+
...(openStories?.accession === filing.accessionNumber
|
|
238
|
+
? openStories.stories.map((story) => ({
|
|
239
|
+
label: "Story",
|
|
240
|
+
value: `${story.headline} (${filingStorySource(story)})`,
|
|
241
|
+
link: { label: `Open story: ${story.headline}`, onOpen: () => openStories.open(story) },
|
|
242
|
+
}))
|
|
243
|
+
: []),
|
|
234
244
|
];
|
|
235
245
|
|
|
236
246
|
return {
|
|
@@ -383,6 +393,15 @@ function SecView({ width, height, focused, paneType }: { width: number; height:
|
|
|
383
393
|
const openFiling = openItemId
|
|
384
394
|
? filings.find((filing) => filing.accessionNumber === openItemId) ?? null
|
|
385
395
|
: null;
|
|
396
|
+
// An open Form 4 names the stories that report it, each opening in a pane: back from the filing to the news.
|
|
397
|
+
const openInsiderAccession = openFiling && /^4(?:\/A)?$/i.test(openFiling.form.trim()) ? openFiling.accessionNumber : null;
|
|
398
|
+
const openFilingStories = useFilingStories(openInsiderAccession);
|
|
399
|
+
const { createPaneFromTemplate } = usePluginAppActions();
|
|
400
|
+
const storyLinks = useMemo(() => (openInsiderAccession && openFilingStories.length > 0 ? {
|
|
401
|
+
accession: openInsiderAccession,
|
|
402
|
+
stories: openFilingStories,
|
|
403
|
+
open: (story: FilingStory) => createPaneFromTemplate("news-story-pane", { arg: story.id, values: { title: story.headline } }),
|
|
404
|
+
} : null), [createPaneFromTemplate, openFilingStories, openInsiderAccession]);
|
|
386
405
|
const documentsEntry = useSecFilingDocuments(openFiling ?? null);
|
|
387
406
|
const openDocuments = useResolvedEntryValue(documentsEntry) ?? [];
|
|
388
407
|
const documentsError = documentsEntry?.error && documentsEntry.error.reasonCode !== "NO_DATA" ? documentsEntry.error.message : null;
|
|
@@ -626,6 +645,7 @@ function SecView({ width, height, focused, paneType }: { width: number; height:
|
|
|
626
645
|
loadingDocuments,
|
|
627
646
|
documentsError,
|
|
628
647
|
contentErrors,
|
|
648
|
+
storyLinks,
|
|
629
649
|
)}
|
|
630
650
|
selectedIdx={selectedIdx}
|
|
631
651
|
onSelect={setSelectedIdx}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
|
2
2
|
import { Box } from "../../../ui";
|
|
3
|
-
import { DataTableView, usePaneFooter,
|
|
3
|
+
import { DataTableView, usePaneFooter, usePaneTabs, type DataTableCell, type DataTableKeyEvent, type DataTableVisibleRange } from "../../../components";
|
|
4
4
|
import { handleRefreshKey, loadingErrorFooterInfo } from "../../../components/data-table/table-pane";
|
|
5
5
|
import type { PaneProps } from "../../../types/plugin";
|
|
6
6
|
import type { PluginModule } from "../plugin-module";
|
|
@@ -304,7 +304,7 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
|
|
|
304
304
|
case "name":
|
|
305
305
|
return { text: row.name, color: colors.text };
|
|
306
306
|
case "etf":
|
|
307
|
-
return { text: row.etf, color: colors.textDim };
|
|
307
|
+
return { text: row.etf, color: !row.loading && sectorRowIssues(row).length > 0 ? colors.warning : colors.textDim };
|
|
308
308
|
case "price":
|
|
309
309
|
if (row.loading && row.price === null) {
|
|
310
310
|
return { text: "…", color: colors.textDim };
|
|
@@ -352,13 +352,9 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
|
|
|
352
352
|
|
|
353
353
|
const updatedAgo = useUpdatedAgo(lastRefreshMs);
|
|
354
354
|
const returnAsOfDate = rows.map((row) => row.returnAsOfDate).filter((date): date is string => !!date).sort().at(-1);
|
|
355
|
-
//
|
|
356
|
-
//
|
|
357
|
-
//
|
|
358
|
-
const rowIssueNotices = rows
|
|
359
|
-
.filter((row) => !row.loading && sectorRowIssues(row).length > 0)
|
|
360
|
-
.map((row) => `${row.etf}: ${sectorRowIssues(row).join(" · ")}`);
|
|
361
|
-
usePaneNoticeFooter({ registrationId: "sectors:row-issues", notices: rowIssueNotices, focused });
|
|
355
|
+
// A row with a value the source could not supply says so on that row: its
|
|
356
|
+
// ETF in the warning colour, and the reason under the table while it is
|
|
357
|
+
// selected (`rowNote`). The footer is for the whole board.
|
|
362
358
|
|
|
363
359
|
// Signed out or free, the ETFs' quotes are delayed ones.
|
|
364
360
|
const quoteDelay = useQuoteDelayFooter(rows.map((row) => (row.loading ? null : { dataSource: row.quoteDataSource })), "sectors-delay");
|
|
@@ -406,6 +402,7 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
|
|
|
406
402
|
onHeaderClick={handleHeaderClick}
|
|
407
403
|
getItemKey={(row) => row.etf}
|
|
408
404
|
renderCell={renderCell}
|
|
405
|
+
rowNote={(row) => !row.loading && sectorRowIssues(row).length > 0 ? `${row.etf}: ${sectorRowIssues(row).join("; ")}.` : null}
|
|
409
406
|
selectedTextOverridesCellColor
|
|
410
407
|
emptyStateTitle={loadError ?? "No sectors selected."}
|
|
411
408
|
/>
|
|
@@ -328,7 +328,7 @@ export function sectorRowIssues(row: SectorRow): string[] {
|
|
|
328
328
|
if (row.quoteIssue) issues.push(row.quoteIssue);
|
|
329
329
|
else if (row.quoteUnavailable) issues.push("quote unavailable");
|
|
330
330
|
for (const range of ["1M", "1Y"] as const) {
|
|
331
|
-
if (row.returnIntegrity?.[range]) issues.push(`${range}:
|
|
331
|
+
if (row.returnIntegrity?.[range]) issues.push(`${range}: contradictory prices at the return's start or end`);
|
|
332
332
|
else if (row[range === "1M" ? "return1M" : "return1Y"] == null) issues.push(`${range}: history does not cover the shared window`);
|
|
333
333
|
}
|
|
334
334
|
return issues;
|
|
@@ -245,7 +245,7 @@ export function useCloudUpgradeAction(placement: string): (options?: unknown) =>
|
|
|
245
245
|
if (resolvePlanAccess(apiClient.getCurrentUser()).hasProAccess) return;
|
|
246
246
|
void openUpgradeRef.current({ ...checkout, recordIntent: false });
|
|
247
247
|
};
|
|
248
|
-
if (requestAuthDialog({ mode: "signup", onSignedIn: continueSignedIn, ...(checkout.reason ? { reason: checkout.reason } : {}) })) {
|
|
248
|
+
if (requestAuthDialog({ mode: "signup", onSignedIn: continueSignedIn, checkout: true, ...(checkout.reason ? { reason: checkout.reason } : {}) })) {
|
|
249
249
|
if (checkout.recordIntent !== false) recordUpgradeIntent(checkout.placement);
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
@@ -47,6 +47,48 @@ export function isProvisionalActual(row: { epsActual?: number | null; epsActualS
|
|
|
47
47
|
return row.epsActual != null && row.epsActualSource === "press-release";
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A reported quarter with an actual and no consensus on record says so where
|
|
52
|
+
* its estimate would be, so a blank surprise never reads as a lost figure.
|
|
53
|
+
*/
|
|
54
|
+
export const NO_CONSENSUS = "no consensus";
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A report that is out with no actual yet (the calendar fills it the next
|
|
58
|
+
* day, a press release only when it proves the figure) says so where its
|
|
59
|
+
* actual would be, one word everywhere: ERN, the board, EE's detail. A
|
|
60
|
+
* listing abroad's figures come from its own results documents, with Gloom
|
|
61
|
+
* Pro only, so its row without one is not waiting on anything: it keeps its
|
|
62
|
+
* dash.
|
|
63
|
+
*/
|
|
64
|
+
export const ACTUAL_PENDING = "pending";
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Gloom Cloud reads a report's date from the calendar for a week after it, so
|
|
68
|
+
* an actual is pending only that long: an older report with none (a 2023
|
|
69
|
+
* report known only from its results filing) has none coming, and keeps its
|
|
70
|
+
* dash.
|
|
71
|
+
*/
|
|
72
|
+
const PENDING_DAYS = 7;
|
|
73
|
+
|
|
74
|
+
export function actualPending(
|
|
75
|
+
row: { date?: string | null; epsActual?: number | null; dateStatus?: string | null },
|
|
76
|
+
abroad = false,
|
|
77
|
+
now = Date.now(),
|
|
78
|
+
): boolean {
|
|
79
|
+
if (abroad || row.epsActual != null || row.dateStatus !== "reported") return false;
|
|
80
|
+
const date = Date.parse(`${String(row.date ?? "").slice(0, 10)}T00:00:00Z`);
|
|
81
|
+
return !Number.isFinite(date) || now - date <= (PENDING_DAYS + 1) * 86_400_000;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** NO_CONSENSUS where a column is narrow. */
|
|
85
|
+
export const NO_CONSENSUS_SHORT = "no est";
|
|
86
|
+
|
|
87
|
+
/** A beat stated without its estimate (`difference`) still had a consensus. */
|
|
88
|
+
export function lacksConsensus(row: { epsActual?: number | null; epsEstimate?: number | null; difference?: number | null }): boolean {
|
|
89
|
+
return row.epsActual != null && row.epsEstimate == null && row.difference == null;
|
|
90
|
+
}
|
|
91
|
+
|
|
50
92
|
/** What a provisional figure is, in every report's metadata. */
|
|
51
93
|
export const PROVISIONAL_NOTE = "A provisional EPS (or sales) figure is the company's own press release's, read from its results filing minutes after it is out, on the basis the consensus is measured on. The earnings calendar's figure replaces it, usually the next day.";
|
|
52
94
|
|
|
@@ -67,18 +109,20 @@ type EarningsRecord = CorporateActionsData["earnings"][number];
|
|
|
67
109
|
|
|
68
110
|
/**
|
|
69
111
|
* What follows an earnings row's EPS, one phrase per part. A reported row
|
|
70
|
-
* names its basis, whether the figure is provisional, and its beat
|
|
71
|
-
*
|
|
72
|
-
*
|
|
112
|
+
* names its basis, whether the figure is provisional, and its beat, or that
|
|
113
|
+
* no consensus is on record for it; one out with no actual yet that it is
|
|
114
|
+
* pending; one still to come whether its date is announced; and both their
|
|
115
|
+
* analysts and an adjusted estimate's basis.
|
|
73
116
|
*/
|
|
74
117
|
export function earningsDetailParts(earning: EarningsRecord): string[] {
|
|
75
118
|
if (earning.epsActual == null) {
|
|
76
119
|
const status = earningsDateStatus(earning.dateStatus);
|
|
77
|
-
return [status === "reported" ? null : status, earning.epsAnalysts != null ? `${earning.epsAnalysts} analysts` : null,
|
|
120
|
+
return [status === "reported" ? (actualPending(earning) ? ACTUAL_PENDING : null) : status, earning.epsAnalysts != null ? `${earning.epsAnalysts} analysts` : null,
|
|
78
121
|
earningsEpsBasis(earning.epsBasis) === "adjusted" ? BASIS_TEXT.adjusted : null].filter((part): part is string => !!part);
|
|
79
122
|
}
|
|
80
123
|
return [BASIS_TEXT[epsBasisName(earningsEpsBasis(earning.epsBasis))], isProvisionalActual(earning) ? "provisional" : null,
|
|
81
|
-
|
|
124
|
+
lacksConsensus(earning) ? NO_CONSENSUS
|
|
125
|
+
: earning.difference == null ? null : `${earning.difference > 0 ? "+" : ""}${formatNumber(earning.difference, 2)} vs est`]
|
|
82
126
|
.filter((part): part is string => !!part);
|
|
83
127
|
}
|
|
84
128
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// The words every surface uses for the options features that need Pro
|
|
2
|
+
// (options flow, an IV spike alert) and what a free account has instead:
|
|
3
|
+
// the FLOW walls, Add Event Alert, ALRT's Events tab, `fn ALRT`, and
|
|
4
|
+
// `alerts add` and `alerts list`. Short on purpose, and kept here so they
|
|
5
|
+
// read the same everywhere.
|
|
6
|
+
|
|
7
|
+
/** What a free account has instead of options flow. */
|
|
8
|
+
export const FLOW_FREE = "Free: OMON chain, price and move alerts.";
|
|
9
|
+
|
|
10
|
+
/** What a free account has instead of an IV spike alert: the IV level alert the app checks comes first. */
|
|
11
|
+
const IV_SPIKE_FREE = "Free: IV level alerts, OMON chain, price and move alerts.";
|
|
12
|
+
|
|
13
|
+
/** The FLOW wall's line for a signed-out reader: options flow is Pro, and what is free. */
|
|
14
|
+
export const FLOW_PRO_NOTE = `Options flow is Pro. ${FLOW_FREE}`;
|
|
15
|
+
|
|
16
|
+
/** What is free instead of a Pro alert of `kind`; an IV spike's list leads with IV level alerts. */
|
|
17
|
+
export function proAlertFree(kind: string): string {
|
|
18
|
+
return kind === "iv_spike" ? IV_SPIKE_FREE : FLOW_FREE;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** What is free instead of any of `kinds`: the IV spike list when one of them is an IV spike, which covers flow's too. */
|
|
22
|
+
export function proAlertsFree(kinds: readonly string[]): string {
|
|
23
|
+
return kinds.includes("iv_spike") ? IV_SPIKE_FREE : FLOW_FREE;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Add Event Alert's line under a Pro kind's first field. */
|
|
27
|
+
export function proAlertFormNote(kind: string): string {
|
|
28
|
+
return `Pro: saved now, checked only with Pro. ${proAlertFree(kind)}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** What `alerts add` and the saved toast say after a Pro alert saved without Pro. */
|
|
32
|
+
export function proAlertSavedNote(kind: string): string {
|
|
33
|
+
return `Checked only with Pro. ${proAlertFree(kind)}`;
|
|
34
|
+
}
|
|
@@ -8,7 +8,7 @@ import { indexLevelMarketState } from "../../../market-data/market/index-level";
|
|
|
8
8
|
import { barSizeFromGap, medianBarGap } from "../../../time-series/bar-spacing";
|
|
9
9
|
import { apiClient } from "../../../api-client";
|
|
10
10
|
import { isPerpetualExchange } from "../../../tickers/perpetual-listing";
|
|
11
|
-
import {
|
|
11
|
+
import { hasProAccess } from "../../../api-client/plan-rules";
|
|
12
12
|
import { savedCopyMark } from "../../../data/saved-copies";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -74,7 +74,7 @@ export const REFERENCE_DATA: HeadlessPaneFreshness = { status: "not-a-feed", bas
|
|
|
74
74
|
export const REPORTED_DATA: HeadlessPaneFreshness = { status: "not-a-feed", basis: "reported data" };
|
|
75
75
|
|
|
76
76
|
/** What a news list's as-of is: its newest story, not the time it was read. */
|
|
77
|
-
|
|
77
|
+
const NEWEST_STORY = "newest story";
|
|
78
78
|
|
|
79
79
|
/** Gloom Cloud's delayed quotes run behind each venue by a lag the app knows (`delayedFeedLagMs`). */
|
|
80
80
|
const CLOUD_QUOTE_PROVIDER_ID = "gloomberb-cloud";
|
|
@@ -163,6 +163,5 @@ export async function cloudRealtimeAccess(): Promise<boolean | null> {
|
|
|
163
163
|
export function cloudNewsFreshness(realtime: boolean | null): HeadlessPaneFreshness {
|
|
164
164
|
const stories: HeadlessPaneFreshness = { observedKey: "publishedAt", oldest: null, asOfLabel: NEWEST_STORY };
|
|
165
165
|
if (realtime === true) return { ...stories, status: "live" };
|
|
166
|
-
if (realtime === false) return { ...stories, status: "delayed", delayMinutes: CLOUD_NEWS_DELAY_HOURS * 60 };
|
|
167
166
|
return { ...stories, status: "not-a-feed", basis: "published stories" };
|
|
168
167
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HeadlessPaneContext, HeadlessPaneOptionDef } from "../../../types/headless";
|
|
2
|
+
import { conversionNote, convertMarketCaps, loadFxLegs, normalizeCapCurrency } from "../research/relative-valuation-currency";
|
|
3
|
+
|
|
4
|
+
export const STATEMENT_CURRENCY_OPTION: HeadlessPaneOptionDef = {
|
|
5
|
+
key: "currency", type: "string", placeholder: "code", normalize: normalizeCapCurrency,
|
|
6
|
+
description: "Convert reported money at the app's FX rates, naming each rate and time and keeping the native figures.",
|
|
7
|
+
example: "--currency SGD",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export async function loadStatementCurrency(target: string, nativeCurrencies: readonly string[], context: Pick<HeadlessPaneContext, "marketData">) {
|
|
11
|
+
const currencies = [...new Set(nativeCurrencies)];
|
|
12
|
+
const { legs } = await loadFxLegs(currencies.some((currency) => currency !== target) ? [target, ...currencies] : [], context);
|
|
13
|
+
const { rows, conversions, unconverted } = convertMarketCaps(currencies.map((currency) => ({
|
|
14
|
+
symbol: currency, marketCap: 1, marketCapCurrency: currency,
|
|
15
|
+
})), target, legs);
|
|
16
|
+
return {
|
|
17
|
+
rates: new Map(rows.filter((row) => row.marketCapCurrency === target).map((row) => [row.symbol, row.marketCap!])),
|
|
18
|
+
conversions,
|
|
19
|
+
note: conversionNote(target, conversions, `Statements in ${target}`),
|
|
20
|
+
rateNotes: conversions.flatMap((conversion) => conversionNote(target, [conversion], `Statements in ${target}`) ?? []),
|
|
21
|
+
failures: unconverted.map(({ currency }) => `No ${currency}/${target} rate; ${currency} figures are not converted.`),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -28,7 +28,7 @@ export interface TickerSurfacePaneTemplateOptions {
|
|
|
28
28
|
symbol: string,
|
|
29
29
|
context: PaneTemplateContext,
|
|
30
30
|
options: PaneTemplateCreateOptions | undefined,
|
|
31
|
-
) => Record<string, unknown
|
|
31
|
+
) => Record<string, unknown> | undefined;
|
|
32
32
|
canCreate?: (
|
|
33
33
|
context: PaneTemplateContext,
|
|
34
34
|
options: PaneTemplateCreateOptions | undefined,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { apiClient } from "../../../api-client";
|
|
2
|
-
import type { SupplyChainPayload, SupplyEntity, SupplyEvidenceItem, SupplyOptions, SupplyRow } from "../../../api-client/supply-chain";
|
|
2
|
+
import type { SupplyChainPayload, SupplyEntity, SupplyEvidenceItem, SupplyOptions, SupplyRead, SupplyRow } from "../../../api-client/supply-chain";
|
|
3
3
|
import { createPluginCache } from "../../../data/plugin-cache";
|
|
4
4
|
import { batchReplyItems, cachedCloudResource, createCloudBatchAhead, loadCloudResource, unavailableOnServer } from "../shared/cloud-resource";
|
|
5
|
-
import { activeRelationship, canShowQuote, isUnconfirmed, publicEvidence, supplyOptions, TIER_OPTIONS, trustTier } from "./trust";
|
|
5
|
+
import { activeRelationship, canShowQuote, evidenceDate, isUnconfirmed, publicEvidence, supplyOptions, TIER_OPTIONS, trustTier } from "./trust";
|
|
6
6
|
|
|
7
7
|
export const SUPPLY_UNAVAILABLE = "Supply chain disclosures are not available yet.";
|
|
8
8
|
const SUPPLY_ROLES = ["customer", "supplier", "partner", "competitor", "investee"] as const;
|
|
@@ -45,7 +45,8 @@ export function validSupplyEntity(value: SupplyEntity): boolean {
|
|
|
45
45
|
export function validSupplyRow(value: SupplyRow): boolean {
|
|
46
46
|
return !!value && text(value.id) && validSupplyEntity(value.counterparty) && validSupplyEntity(value.reportingEntity)
|
|
47
47
|
&& SUPPLY_ROLES.includes(value.role) && ["in", "out", "mutual"].includes(value.direction)
|
|
48
|
-
&& nullableText(value.pctScope) &&
|
|
48
|
+
&& nullableText(value.pctScope) && [undefined, null, "total", "segment"].includes(value.pctScopeBasis)
|
|
49
|
+
&& nullableNumber(value.pctOfRevenue) && (value.pctOfRevenue === null || value.pctOfRevenue <= 100)
|
|
49
50
|
&& [null, "revenue", "receivables", "cost", "purchases"].includes(value.pctBasis)
|
|
50
51
|
&& nullableNumber(value.usd) && [null, "disclosed", "derived"].includes(value.usdBasis)
|
|
51
52
|
&& (value.nativeAmount == null || nonnegative(value.nativeAmount))
|
|
@@ -70,7 +71,10 @@ export function validSupplyRow(value: SupplyRow): boolean {
|
|
|
70
71
|
&& (value.whyUnconfirmed === undefined || nullableText(value.whyUnconfirmed))
|
|
71
72
|
&& (value.evidence === undefined || Array.isArray(value.evidence) && value.evidence.every(evidence));
|
|
72
73
|
}
|
|
73
|
-
export function normalizeSupplyRow(
|
|
74
|
+
export function normalizeSupplyRow(input: SupplyRow): SupplyRow {
|
|
75
|
+
// A share basis a server sends as null is no basis read yet, as an absent one is.
|
|
76
|
+
const { pctScopeBasis, ...rest } = input;
|
|
77
|
+
const value: SupplyRow = pctScopeBasis == null ? rest : input;
|
|
74
78
|
const items = value.evidence?.map(publicEvidence);
|
|
75
79
|
const unconfirmed = isUnconfirmed(value) || !activeRelationship(value);
|
|
76
80
|
// Restrict again before cache, exports or screenshot metadata, even if a server regresses.
|
|
@@ -105,14 +109,35 @@ export function validateSupplyChain(data: SupplyChainPayload): SupplyChainPayloa
|
|
|
105
109
|
return { ...data, entity: data.entity ? normalizeEntity(data.entity) : null, says: data.says.map(normalizeSupplyRow), names: data.names.map(normalizeSupplyRow),
|
|
106
110
|
...(data.earlier ? { earlier: { says: data.earlier.says.map(normalizeSupplyRow), names: data.earlier.names.map(normalizeSupplyRow) } } : {}) };
|
|
107
111
|
}
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
/** A server that answered a cutoff (`asOf`) with disclosures published after it, which it does not read. */
|
|
113
|
+
class AsOfUnsupportedError extends Error {
|
|
114
|
+
constructor(readonly asOf: string) {
|
|
115
|
+
super(`Gloom Cloud does not read --as-of ${asOf} yet: it answered with disclosures published after that day, so none are shown.`);
|
|
116
|
+
this.name = "AsOfUnsupportedError";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The disclosures known by `asOf` (YYYY-MM-DD): a server that reads the
|
|
122
|
+
* cutoff sends none published after it, and one that answers with any never
|
|
123
|
+
* has them shown as that day's (AsOfUnsupportedError).
|
|
124
|
+
*/
|
|
125
|
+
function knownBy(data: SupplyChainPayload, asOf: string | undefined): SupplyChainPayload {
|
|
126
|
+
if (!asOf) return data;
|
|
127
|
+
const rows = [...data.says, ...data.names, ...data.earlier?.says ?? [], ...data.earlier?.names ?? []];
|
|
128
|
+
if (rows.some((row) => evidenceDate(row) > asOf)) throw new AsOfUnsupportedError(asOf);
|
|
129
|
+
return data;
|
|
130
|
+
}
|
|
131
|
+
export async function fetchSupplyChain(symbol: string, client: Pick<typeof apiClient, "getCloudSupplyChain"> = apiClient, options: SupplyRead = {}) {
|
|
132
|
+
let data: SupplyChainPayload;
|
|
133
|
+
try { data = validateSupplyChain(await client.getCloudSupplyChain(symbol, options)); }
|
|
110
134
|
catch (error) { throw unavailableOnServer(error, SUPPLY_UNAVAILABLE, [404, 503]); }
|
|
135
|
+
return knownBy(data, options.asOf);
|
|
111
136
|
}
|
|
112
137
|
// Account and plan belong in the key: signing out must never reveal a paid cached response.
|
|
113
|
-
const cacheKey = (symbol: string, access: string, options:
|
|
114
|
-
export const cachedSupplyChain = (symbol: string, access: string, options:
|
|
115
|
-
export const loadSupplyChain = (symbol: string, access: string, force = false, options:
|
|
138
|
+
const cacheKey = (symbol: string, access: string, options: SupplyRead) => `${symbol.toUpperCase()}:${access}:${JSON.stringify(supplyOptions(options.tiers))}:${!!options.includeLeads}${options.asOf ? `:${options.asOf}` : ""}`;
|
|
139
|
+
export const cachedSupplyChain = (symbol: string, access: string, options: SupplyRead = {}) => cachedCloudResource(supplyChainCache, cacheKey(symbol, access, options), validateSupplyChain);
|
|
140
|
+
export const loadSupplyChain = (symbol: string, access: string, force = false, options: SupplyRead = {}) => loadCloudResource(supplyChainCache, cacheKey(symbol, access, options), () => fetchSupplyChain(symbol, apiClient, options), { force, validate: validateSupplyChain });
|
|
116
141
|
/** Symbols per disclosures batch request: a ripple's sixty holdings are two, read sixteen at a time on the server. */
|
|
117
142
|
const SUPPLY_BATCH_MAX = 30;
|
|
118
143
|
const supplyChainsAheadByOptions = new Map<string, ReturnType<typeof createCloudBatchAhead<SupplyChainPayload>>>();
|
|
@@ -4,7 +4,7 @@ import type { PaneScreenshotEvidenceHook } from "../../../cli/pane-functions/scr
|
|
|
4
4
|
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
5
5
|
import { isRecord } from "../../../utils/guards";
|
|
6
6
|
import { fetchSupplyChain, validateSupplyChain } from "./client";
|
|
7
|
-
import { earlierRows } from "./model";
|
|
7
|
+
import { earlierRows, openingSupplyView } from "./model";
|
|
8
8
|
import { isUnconfirmed, matchesSupplyOptions, supplyOptions } from "./trust";
|
|
9
9
|
import { fetchSupplyGraph, graphOptions, validateGraph } from "./graph-client";
|
|
10
10
|
|
|
@@ -80,7 +80,8 @@ export const supplyScreenshotEvidence: PaneScreenshotEvidenceHook<SupplyEvidence
|
|
|
80
80
|
if (resolved.options.evidence === true && (!evidence.evidenceOpen || !evidence.evidenceId)) mismatches.push("Supply chain evidence detail was not opened");
|
|
81
81
|
if (evidence.tab !== (resolved.options.tab ?? "table")) mismatches.push("Supply chain tab does not match");
|
|
82
82
|
if (!graphTab(evidence.tab)) {
|
|
83
|
-
|
|
83
|
+
const view = resolved.options.view ?? openingSupplyView(evidence.payload as SupplyChainPayload, supplyOptions(resolved.options.tiers));
|
|
84
|
+
if (evidence.view !== view) mismatches.push("Supply chain direction does not match");
|
|
84
85
|
if (JSON.stringify(evidence.tiers) !== JSON.stringify(supplyOptions(resolved.options.tiers).tiers)) mismatches.push("Supply chain evidence tiers do not match");
|
|
85
86
|
}
|
|
86
87
|
return mismatches;
|
|
@@ -13,7 +13,7 @@ import { useThemeColors } from "../../../theme/theme-context";
|
|
|
13
13
|
import { useSelectionFill } from "../../../components/ui/selection-fill";
|
|
14
14
|
import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
|
|
15
15
|
import { fillOpaque, fillRect, parseHex } from "../../../components/chart/native/raster/primitives";
|
|
16
|
-
import { counterpartyKind, counterpartyKindLabel, counterpartyLabel, disclosedValue, dollars, isRelatedParty, nativeValue, periodText, relationshipLabel, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
|
|
16
|
+
import { counterpartyKind, counterpartyKindLabel, counterpartyLabel, counterpartyLabelEnd, disclosedValue, dollars, isRelatedParty, nativeValue, periodText, relationshipLabel, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
|
|
17
17
|
import { entityTicker } from "./graph-model";
|
|
18
18
|
import { flowChipLabel, flowGeometry, RELATED_LABEL_CELLS, ribbonY, type FlowRibbon, type PositionedNode } from "./flow-layout";
|
|
19
19
|
import { evidenceDate, evidenceLabel, trustTier } from "./trust";
|
|
@@ -333,7 +333,8 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
|
|
|
333
333
|
{/* The ticker shows only beside the whole name. On the desktop that is CSS: the row wraps, one line shows, and a ticker that does not fit goes to the hidden line. */}
|
|
334
334
|
<Box flexDirection="row" height={1} overflow="hidden" style={desktop ? { flexWrap: "wrap" } : undefined}>
|
|
335
335
|
{!desktop ? <Text fg={node.more ? colors.textMuted : accent}>▍</Text> : null}
|
|
336
|
-
<ClippedText fg={active && !desktop ? chosenText(titleColor) : titleColor} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth}
|
|
336
|
+
<ClippedText fg={active && !desktop ? chosenText(titleColor) : titleColor} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth}
|
|
337
|
+
keepEnd={node.row && !node.more ? counterpartyLabelEnd(node.row) : null} />
|
|
337
338
|
{ticker && (desktop || displayWidth(name) + displayWidth(ticker) + 1 <= inner)
|
|
338
339
|
? <Text fg={active && !desktop ? selectionFill.ink(colors.textDim) : colors.textDim} style={desktop ? { flex: "0 0 auto" } : undefined}>{` ${ticker}`}</Text> : null}
|
|
339
340
|
</Box>
|
|
@@ -377,7 +378,7 @@ function FlowTooltip({ node, focusId, width, desktop, anchor }: { node: Position
|
|
|
377
378
|
flexDirection="column" paddingX={1} backgroundColor={desktop ? undefined : colors.panel} border={!desktop} borderColor={ROLE_COLORS[row.role]}
|
|
378
379
|
style={desktop ? { ...TOOLTIP_SURFACE_STYLE, padding: "0 var(--gloom-space-sm)", zIndex: 20 } : undefined}
|
|
379
380
|
data-gloom-role="supply-flow-tooltip">
|
|
380
|
-
<ClippedText fg={colors.textBright} attributes={TextAttributes.BOLD} text={counterpartyLabel(row)} width={tooltipWidth - 2} />
|
|
381
|
+
<ClippedText fg={colors.textBright} attributes={TextAttributes.BOLD} text={counterpartyLabel(row)} width={tooltipWidth - 2} keepEnd={counterpartyLabelEnd(row)} />
|
|
381
382
|
{lines.map((line, index) => <ClippedText key={index} fg={index === 0 ? colors.text : colors.textDim} text={line} width={tooltipWidth - 2} />)}
|
|
382
383
|
</Box>;
|
|
383
384
|
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { MISSING_VALUE } from "../../../utils/format";
|
|
2
2
|
import type { SupplyEntity } from "../../../api-client/supply-chain";
|
|
3
3
|
import type { GraphPath, GraphPayload } from "../../../api-client/supply-chain-graph";
|
|
4
|
-
import {
|
|
5
|
-
import { isUsListingExchange, publicTickerKey } from "../../../utils/exchanges";
|
|
4
|
+
import { hongKongListingCode, listingSuffixVenue } from "../../../sources/listing-symbols";
|
|
5
|
+
import { canonicalExchange, canonicalTickerKey, isUsListingExchange, publicTickerKey } from "../../../utils/exchanges";
|
|
6
6
|
|
|
7
7
|
export const entityKey = (entity: SupplyEntity) => entity.ticker ? publicTickerKey(entity.ticker, entity.exchange ?? undefined) : `id:${entity.id}`;
|
|
8
8
|
/**
|
|
9
|
-
* The ticker as shown and typed to open it
|
|
10
|
-
*
|
|
11
|
-
* that a US company could hold.
|
|
9
|
+
* The ticker as shown and typed to open it, as every other function writes a
|
|
10
|
+
* listing: a US listing bare, any other with its venue (`STAN:LSE`,
|
|
11
|
+
* `0941:HKEX`), never a bare STAN that a US company could hold. A ticker served
|
|
12
|
+
* with a vendor's venue suffix (`600028.SS`, `000063.SZ`) is read as its venue's
|
|
13
|
+
* listing (`600028:SSE`, `000063:SZSE`).
|
|
12
14
|
*/
|
|
13
|
-
export const entityTicker = (entity: Pick<SupplyEntity, "ticker" | "exchange">) =>
|
|
14
|
-
|
|
15
|
+
export const entityTicker = (entity: Pick<SupplyEntity, "ticker" | "exchange">): string | null => {
|
|
16
|
+
if (!entity.ticker) return entity.ticker;
|
|
17
|
+
const suffixed = listingSuffixVenue(entity.ticker, entity.exchange ?? undefined);
|
|
18
|
+
const symbol = suffixed?.symbol ?? entity.ticker;
|
|
19
|
+
const exchange = suffixed?.exchange ?? entity.exchange;
|
|
20
|
+
return exchange && !isUsListingExchange(exchange) ? canonicalTickerKey(hongKongListingCode(symbol, canonicalExchange(exchange)), exchange) : symbol;
|
|
21
|
+
};
|
|
15
22
|
export const entityLabel = (entity: SupplyEntity) => entityTicker(entity) ?? entity.name;
|
|
16
23
|
/**
|
|
17
24
|
* A trade link whose every disclosure is a related-party (connected) trade,
|
|
@@ -166,7 +166,9 @@ export function SupplyGraphPane({ symbol, tab, width, height, focused }: { symbo
|
|
|
166
166
|
info: data?.asOf ? [{ id: "as-of", parts: [{ text: `as of ${data.asOf}`, tone: "muted" }] }] : [] });
|
|
167
167
|
usePaneNoticeFooter({ registrationId: "supply-graph:notices", focused, notices: [...(resource.data?.refreshError ? [resource.data.refreshError] : []),
|
|
168
168
|
...(data && !data.search.complete ? [`Search limited: ${data.search.reasons.join(", ").replaceAll("_", " ")}. Narrow filters or reduce depth to inspect more routes.`] : []),
|
|
169
|
-
...(data?.access === "preview" ? [`Pro preview: depth ${data.options.depth}. Upgrade for four hops and the full graph.`] : [])
|
|
169
|
+
...(data?.access === "preview" ? [`Pro preview: depth ${data.options.depth}. Upgrade for four hops and the full graph.`] : []),
|
|
170
|
+
// A cutoff the server did not read (the free preview always reads the latest snapshot) is said, never drawn as that day's.
|
|
171
|
+
...(data && options.asOf && data.options.asOf !== options.asOf ? ["Filing cutoff needs Gloom Pro; showing the latest disclosures."] : [])] });
|
|
170
172
|
useRemoteUiNode({ role: "chart-data", label: "Rendered supply chain graph", getMetadata: () => ({ kind: "supply-chain", version: 1, complete: !!data, ready: !!data, plottedValueCount: tab === "graph" ? visibleLinks.length : paths.length, payload: data, tab, evidenceOpen: !!openPath, evidenceId: openPath?.id ?? null, rowIds: tab === "graph" ? visibleLinks : paths.map(path => path.id) }) });
|
|
171
173
|
const filters: QueryBarFilter[] = [
|
|
172
174
|
{ id: "target", kind: "text", label: "To", value: targetDraft, placeholder: "Ticker or id:123", onChange: setTargetDraft, onSubmit: applyTarget, focused, active: targetActive, onActiveChange: setTargetActive, width: 16 },
|
|
@@ -15,7 +15,7 @@ import { cardSurfaceStyle } from "../../../components/ui/card";
|
|
|
15
15
|
import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
|
|
16
16
|
import { drawLine, fillOpaque, parseHex } from "../../../components/chart/native/raster/primitives";
|
|
17
17
|
import { entityLabel, entityTicker, graphNodes, relatedPartyLink } from "./graph-model";
|
|
18
|
-
import { ROLE_COLORS } from "./model";
|
|
18
|
+
import { counterpartyLabel, counterpartyLabelEnd, ROLE_COLORS } from "./model";
|
|
19
19
|
import { blendHex } from "../../../theme/colors";
|
|
20
20
|
|
|
21
21
|
export function SupplyGraph({ data, width, height, focused, selectedId, selectedPath, collapsed, onSelect, onRecenter, onVisible }: {
|
|
@@ -144,7 +144,9 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
|
|
|
144
144
|
const tickerWidth = ticker ? displayWidth(ticker) + 3 : 0;
|
|
145
145
|
const showTicker = company && tickerWidth > 0 && inner >= tickerWidth + 5;
|
|
146
146
|
const prefix = collapsed.includes(node.entity.id) ? "+ " : "";
|
|
147
|
-
|
|
147
|
+
// An undisclosed customer or a cohort reads as the table and the flow name it ("Customer 1"), its letter or number kept.
|
|
148
|
+
const label = company ? null : { counterparty: node.entity, pctBasis: null };
|
|
149
|
+
const name = prefix + (showTicker ? node.entity.name : label ? counterpartyLabel(label) : entityLabel(node.entity));
|
|
148
150
|
const nameWidth = inner - (showTicker ? tickerWidth : 0);
|
|
149
151
|
// A related-party trade with the company before it on the path reads as one, never as a plain supplier or customer.
|
|
150
152
|
const link = node.path ? data.links.find(entry => entry.id === node.path!.linkIds.at(-1)) : undefined;
|
|
@@ -160,7 +162,8 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
|
|
|
160
162
|
<Box flexDirection="column" width="100%">
|
|
161
163
|
<Box flexDirection="row" height={1} gap={desktop ? 1 : 0} overflow="hidden">
|
|
162
164
|
{!desktop ? <Text fg={accent}>▍</Text> : null}
|
|
163
|
-
<ClippedText fg={active && !desktop ? chosenText(company ? colors.textBright : colors.textDim) : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth}
|
|
165
|
+
<ClippedText fg={active && !desktop ? chosenText(company ? colors.textBright : colors.textDim) : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth}
|
|
166
|
+
keepEnd={label ? counterpartyLabelEnd(label) : null} />
|
|
164
167
|
{showTicker ? desktop ? <Badge label={ticker!} tone="accent" /> : <Text fg={active ? chosenText(colors.textDim) : colors.textDim}>{` ${ticker}`}</Text> : null}
|
|
165
168
|
</Box>
|
|
166
169
|
<Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden"><ClippedText fg={active && !desktop ? chosenText(colors.textDim) : colors.textDim} text={detail} width={inner} /></Box>
|
|
@@ -146,13 +146,21 @@ export const supplyChainHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
146
146
|
],
|
|
147
147
|
describe: (args) => `Supply chain | ${args.symbols[0]}${args.options.to ? ` → ${args.options.to}` : ""}`,
|
|
148
148
|
async load(args, ctx) {
|
|
149
|
+
const asOfOption = args.options.asOf ?? args.options["as-of"];
|
|
150
|
+
const asOf = typeof asOfOption === "string" && asOfOption ? asOfOption : undefined;
|
|
149
151
|
if (args.options.tab === "graph" || args.options.tab === "path") {
|
|
150
152
|
const target = String(args.options.to ?? "").trim();
|
|
151
153
|
if (args.options.tab === "path" && !target) throw new Error("Path requires a target company: --to TICKER");
|
|
152
|
-
|
|
154
|
+
const graph = await fetchSupplyGraph(args.symbols[0]!, graphOptions(args.options), target, ctx.apiClient);
|
|
155
|
+
// The free preview reads the graph's latest snapshot whatever the cutoff: said, never served as if it were that day's.
|
|
156
|
+
if (asOf && graph.options.asOf !== asOf) {
|
|
157
|
+
throw new Error(`--as-of ${asOf} on the ${args.options.tab === "path" ? "Path" : "Graph"} tab needs Gloom Pro; the free preview reads the latest disclosures. `
|
|
158
|
+
+ `The Table tab reads it for everyone: gloom fn SPLC ${args.symbols[0]} --as-of ${asOf}`);
|
|
159
|
+
}
|
|
160
|
+
return graphReport(graph, target);
|
|
153
161
|
}
|
|
154
162
|
const options = supplyOptions(args.options.tiers);
|
|
155
|
-
const data = await fetchSupplyChain(args.symbols[0]!, ctx.apiClient, options);
|
|
163
|
+
const data = await fetchSupplyChain(args.symbols[0]!, ctx.apiClient, { ...options, ...asOf ? { asOf } : {} });
|
|
156
164
|
const sources = new Map<HeadlessPaneRow, SupplyRow>();
|
|
157
165
|
const sourced = (source: SupplyRow, row: HeadlessPaneRow) => { sources.set(row, source); return row; };
|
|
158
166
|
// The pane's figures, per tab: Table shows one direction, Flow both.
|
|
@@ -193,10 +201,17 @@ export const supplyChainHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
193
201
|
const locked = lockedDisclosures(data, views);
|
|
194
202
|
const truncated = data.truncated && (!requested || locked > 0);
|
|
195
203
|
// A company with no relationship at all says what SPLC reads and where else to look, not that it is "not covered".
|
|
196
|
-
const none = sections.every((section) => !section.rows?.length) ?
|
|
204
|
+
const none = !sections.every((section) => !section.rows?.length) ? null
|
|
205
|
+
: asOf && data.status === "available" ? `No relationship of ${data.symbol}'s was disclosed by ${asOf}.`
|
|
206
|
+
: asOf ? `No relationship of ${data.symbol}'s was disclosed by ${asOf}; ${supplyEmptyText(data, (symbol) => `fn SPLC ${symbol}`)}`
|
|
207
|
+
: supplyEmptyText(data, (symbol) => `fn SPLC ${symbol}`);
|
|
208
|
+
// Dated by the newest disclosure shown, as each row's Published says, never by the latest period one covers: a
|
|
209
|
+
// filing published on 29 Oct about June is known from 29 Oct.
|
|
210
|
+
const published = [...sources.values()].map(evidenceDate).sort().at(-1) ?? null;
|
|
197
211
|
return { complete: !truncated, errors: truncated ? [data.access === "preview" ? supplyPreviewNote(data, locked) : "Additional relationships need Gloom Pro"] : [],
|
|
198
212
|
sections, ...(none && !requested ? { empty: none } : {}),
|
|
199
|
-
metadata: { symbol: data.symbol, asOf: data.asOf,
|
|
213
|
+
metadata: { symbol: data.symbol, asOf: published, latestPeriod: data.asOf, ...asOf ? { knownBy: asOf } : {},
|
|
214
|
+
view: requested ?? "both", counterparties: figures("counterparties"), locked: figures("locked"),
|
|
200
215
|
counts: data.counts, earlierCounts: data.earlierCounts ?? null, tierCounts: data.tierCounts, tiers: options.tiers, disclaimer: data.disclaimer } };
|
|
201
216
|
},
|
|
202
217
|
};
|