gloomberb 0.20.16 → 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 +16 -5
- 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/api-client/types/econ.ts +3 -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 +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/fred-series.ts +3 -1
- package/src/cli/commands/market.ts +138 -22
- package/src/cli/commands/overview.ts +72 -14
- 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 +74 -0
- package/src/cli/desktop-pane-shot.ts +75 -11
- package/src/cli/glossary.ts +64 -10
- package/src/cli/help.ts +4 -2
- 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/headless.ts +7 -2
- package/src/cli/pane-functions/index.ts +102 -44
- 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-bridge.ts +4 -2
- 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/report-tables.ts +17 -3
- package/src/cli/result.ts +8 -10
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +80 -25
- 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/display-columns.ts +4 -1
- package/src/components/ui/data-table/hooks.ts +2 -3
- package/src/components/ui/data-table/index.tsx +4 -1
- package/src/components/ui/data-table/types.ts +19 -4
- package/src/components/ui/data-table/visible-range.ts +11 -1
- 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 +7 -3
- 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 +9 -3
- 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/credit-conditions/series.ts +2 -2
- 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/board-model.ts +12 -0
- package/src/plugins/builtin/earnings/board-table.ts +7 -4
- package/src/plugins/builtin/earnings/board.tsx +2 -2
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/highlight.ts +1 -1
- 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 +18 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
- package/src/plugins/builtin/econ/index.tsx +3 -0
- package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
- package/src/plugins/builtin/econ-statistics/client.ts +11 -10
- package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
- package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
- package/src/plugins/builtin/econ-statistics/view.ts +9 -3
- 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/fred-catalog.ts +256 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/series-cache.ts +3 -0
- package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
- package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
- 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 +67 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +31 -16
- 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/time-sales/headless.ts +4 -1
- package/src/plugins/builtin/time-sales/pane.tsx +2 -0
- package/src/plugins/builtin/time-sales/window.ts +12 -0
- package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
- package/src/plugins/builtin/treasury-daily/client.ts +23 -11
- 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-entry.tsx +2 -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/fred-publisher.ts +25 -0
- package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
- 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/base-series.ts +3 -0
- package/src/time-series/ice-credit.ts +1 -0
- package/src/time-series/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +2 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/headless.ts +4 -2
- 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/throttled-fetch.ts +15 -1
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
package/src/api-client/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { CloudCollectionsApi } from "./collections";
|
|
|
28
28
|
import { CloudFeedbackApi } from "./feedback";
|
|
29
29
|
import { CloudRoadmapApi } from "./roadmap";
|
|
30
30
|
import { CloudWaitlistApi } from "./product-waitlist";
|
|
31
|
+
import { CloudHeardFromApi } from "./heard-from";
|
|
31
32
|
import { CloudNotesApi } from "./notes";
|
|
32
33
|
import { CloudTeamsApi } from "./teams";
|
|
33
34
|
import { CloudTelemetryApi } from "./telemetry";
|
|
@@ -40,6 +41,8 @@ import type {
|
|
|
40
41
|
AssistCommandResponse,
|
|
41
42
|
AuthUser,
|
|
42
43
|
CloudCancelFeedback,
|
|
44
|
+
CloudRetentionOffer,
|
|
45
|
+
CloudRetentionOfferAnswer,
|
|
43
46
|
CloudSyncPushResponse,
|
|
44
47
|
CloudYearlyPlanStatus,
|
|
45
48
|
CloudYearlyResult,
|
|
@@ -78,6 +81,15 @@ const ASSIST_COMMAND_LIMIT = 150;
|
|
|
78
81
|
export const ASSIST_ARG_OPTION_LIMIT = 128;
|
|
79
82
|
/** The longest cancel note the server keeps, in UTF-16 units as its schema counts them. */
|
|
80
83
|
export const CLOUD_CANCEL_COMMENT_MAX = 500;
|
|
84
|
+
|
|
85
|
+
/** The reason and note a cancel step sends, the note trimmed to what the server keeps. */
|
|
86
|
+
function cancelFeedbackBody(feedback: CloudCancelFeedback): CloudCancelFeedback {
|
|
87
|
+
const comment = feedback.comment === undefined ? undefined : sliceWholeCharacters(feedback.comment.trim(), CLOUD_CANCEL_COMMENT_MAX);
|
|
88
|
+
return {
|
|
89
|
+
...(feedback.reason ? { reason: feedback.reason } : {}),
|
|
90
|
+
...(comment ? { comment } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
81
93
|
const ASSIST_ARG_OPTION_VALUE_MAX_LENGTH = 40;
|
|
82
94
|
const ASSIST_ARG_OPTION_LABEL_MAX_LENGTH = 60;
|
|
83
95
|
const ASSIST_REQUEST_TIMEOUT_MS = 6_000;
|
|
@@ -190,6 +202,7 @@ class GloomApiClient {
|
|
|
190
202
|
private readonly feedback: CloudFeedbackApi = new CloudFeedbackApi((path, options) => this.request(path, options));
|
|
191
203
|
private readonly roadmap: CloudRoadmapApi = new CloudRoadmapApi((path, options) => this.request(path, options));
|
|
192
204
|
private readonly waitlist: CloudWaitlistApi = new CloudWaitlistApi((path, options) => this.request(path, options));
|
|
205
|
+
private readonly heardFrom: CloudHeardFromApi = new CloudHeardFromApi((path, options) => this.request(path, options));
|
|
193
206
|
private readonly telemetry: CloudTelemetryApi = new CloudTelemetryApi((path, options) => this.request(path, options));
|
|
194
207
|
private readonly theses: CloudThesesApi = new CloudThesesApi((path, options) => this.request(path, options));
|
|
195
208
|
private readonly collections: CloudCollectionsApi = new CloudCollectionsApi((path, options) => this.request(path, options));
|
|
@@ -688,15 +701,55 @@ class GloomApiClient {
|
|
|
688
701
|
* reason and note, when given, go to the billing provider with the cancel.
|
|
689
702
|
*/
|
|
690
703
|
async endCloudTrial(feedback: CloudCancelFeedback = {}): Promise<{ canceled: boolean; endedNow?: boolean }> {
|
|
691
|
-
const comment = feedback.comment === undefined ? undefined : sliceWholeCharacters(feedback.comment.trim(), CLOUD_CANCEL_COMMENT_MAX);
|
|
692
704
|
return this.request<{ canceled: boolean; endedNow?: boolean }>("/stripe/subscription/cancel", {
|
|
693
705
|
method: "POST",
|
|
694
|
-
body: JSON.stringify({
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
706
|
+
body: JSON.stringify({ ...cancelFeedbackBody(feedback), endTrialNow: true }),
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Stops a paid Pro plan from renewing: it keeps Pro to the end of the period
|
|
712
|
+
* it paid for. The same request gloom.sh's cancel window sends, the reason
|
|
713
|
+
* and note with it when given. Call it only once the person confirmed.
|
|
714
|
+
*/
|
|
715
|
+
async cancelCloudSubscription(feedback: CloudCancelFeedback = {}): Promise<{ canceled: boolean; endedNow?: boolean }> {
|
|
716
|
+
return this.request<{ canceled: boolean; endedNow?: boolean }>("/stripe/subscription/cancel", {
|
|
717
|
+
method: "POST",
|
|
718
|
+
body: JSON.stringify(cancelFeedbackBody(feedback)),
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* The save offer and the kept price the cancel flow shows, read as it opens.
|
|
724
|
+
* The server counts this as the cancel flow starting.
|
|
725
|
+
*/
|
|
726
|
+
async getCloudRetentionOffer(options?: { signal?: AbortSignal }): Promise<CloudRetentionOfferAnswer> {
|
|
727
|
+
const body = await this.request<Partial<CloudRetentionOfferAnswer> | null>("/stripe/subscription/retention-offer", {
|
|
728
|
+
method: "GET",
|
|
729
|
+
...(options?.signal ? { signal: options.signal } : {}),
|
|
699
730
|
});
|
|
731
|
+
const offer = body?.offer === "discount" || body?.offer === "trial_extension" ? body.offer : null;
|
|
732
|
+
const kept = body?.keptPrice;
|
|
733
|
+
return {
|
|
734
|
+
offer,
|
|
735
|
+
extendedTrialEndsAt: typeof body?.extendedTrialEndsAt === "string" ? body.extendedTrialEndsAt : null,
|
|
736
|
+
keptPrice: kept && Number.isFinite(kept.amount) && Number.isFinite(kept.listAmount)
|
|
737
|
+
&& (kept.interval === "month" || kept.interval === "year")
|
|
738
|
+
? { amount: kept.amount, listAmount: kept.listAmount, interval: kept.interval }
|
|
739
|
+
: null,
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/** Takes the save offer the cancel flow showed, with the reason and note picked. */
|
|
744
|
+
async acceptCloudRetentionOffer(feedback: CloudCancelFeedback = {}): Promise<{ offer: CloudRetentionOffer | null; extendedTrialEndsAt: string | null }> {
|
|
745
|
+
const body = await this.request<{ offer?: unknown; extendedTrialEndsAt?: unknown } | null>("/stripe/subscription/retention-offer", {
|
|
746
|
+
method: "POST",
|
|
747
|
+
body: JSON.stringify(cancelFeedbackBody(feedback)),
|
|
748
|
+
});
|
|
749
|
+
return {
|
|
750
|
+
offer: body?.offer === "discount" || body?.offer === "trial_extension" ? body.offer : null,
|
|
751
|
+
extendedTrialEndsAt: typeof body?.extendedTrialEndsAt === "string" ? body.extendedTrialEndsAt : null,
|
|
752
|
+
};
|
|
700
753
|
}
|
|
701
754
|
|
|
702
755
|
/**
|
|
@@ -985,6 +1038,10 @@ class GloomApiClient {
|
|
|
985
1038
|
getWaitlist = this.waitlist.getWaitlist.bind(this.waitlist);
|
|
986
1039
|
joinWaitlist = this.waitlist.joinWaitlist.bind(this.waitlist);
|
|
987
1040
|
leaveWaitlist = this.waitlist.leaveWaitlist.bind(this.waitlist);
|
|
1041
|
+
getHeardFrom = this.heardFrom.getHeardFrom.bind(this.heardFrom);
|
|
1042
|
+
reportHeardFromShown = this.heardFrom.reportHeardFromShown.bind(this.heardFrom);
|
|
1043
|
+
answerHeardFrom = this.heardFrom.answerHeardFrom.bind(this.heardFrom);
|
|
1044
|
+
skipHeardFrom = this.heardFrom.skipHeardFrom.bind(this.heardFrom);
|
|
988
1045
|
reportCrashErrors = this.telemetry.reportCrashErrors.bind(this.telemetry);
|
|
989
1046
|
reportUsageCounts = this.telemetry.reportUsageCounts.bind(this.telemetry);
|
|
990
1047
|
reportInstallExperiment = this.telemetry.reportInstallExperiment.bind(this.telemetry);
|
package/src/api-client/mna.ts
CHANGED
|
@@ -58,6 +58,8 @@ export interface MnaDeal {
|
|
|
58
58
|
announced: string;
|
|
59
59
|
/** Expected close as the parties state it, e.g. "2026-12-31" or "Q1 2027". */
|
|
60
60
|
expectedClose: string | null;
|
|
61
|
+
/** The merger agreement's outside date, as a filing states it; null or left out (older servers) when none was read. */
|
|
62
|
+
outsideDate?: MnaOutsideDate | null;
|
|
61
63
|
closed: string | null;
|
|
62
64
|
/** One line on the latest development. */
|
|
63
65
|
headline: string;
|
|
@@ -68,6 +70,22 @@ export interface MnaDeal {
|
|
|
68
70
|
stale: boolean;
|
|
69
71
|
}
|
|
70
72
|
|
|
73
|
+
/**
|
|
74
|
+
* The day after which either side may end the merger agreement if the deal
|
|
75
|
+
* has not closed: a deadline, not an expected close. Some agreements move it
|
|
76
|
+
* later on their own on a stated condition (regulatory approvals still
|
|
77
|
+
* pending); `extendedTo` is that day and `extension` the condition, briefly.
|
|
78
|
+
*/
|
|
79
|
+
export interface MnaOutsideDate {
|
|
80
|
+
/** `YYYY-MM-DD`. */
|
|
81
|
+
date: string;
|
|
82
|
+
extendedTo: string | null;
|
|
83
|
+
/** What moves it, e.g. "if only antitrust approvals and the Nasdaq listing remain". */
|
|
84
|
+
extension: string | null;
|
|
85
|
+
/** The filing it is read from. */
|
|
86
|
+
source: { form: string; filed: string; url: string | null };
|
|
87
|
+
}
|
|
88
|
+
|
|
71
89
|
export type MnaStatusFilter = MnaStatus | "all";
|
|
72
90
|
export type MnaTargetFilter = "all" | "public" | "private";
|
|
73
91
|
export type MnaRegionFilter = "all" | "us" | "intl";
|
|
@@ -3,6 +3,8 @@ export type SupplyTier = 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
3
3
|
export type SupplyTierFilter = "sec" | "company" | "call" | "reported" | "unconfirmed";
|
|
4
4
|
type SupplyClaim = "disclosed" | "company_confirmed" | "reported" | "rumored";
|
|
5
5
|
export interface SupplyOptions { tiers?: SupplyTierFilter[]; includeLeads?: boolean; }
|
|
6
|
+
/** A read of the disclosures: the trust filters, and the day they were known by (YYYY-MM-DD), when one is asked for. */
|
|
7
|
+
export type SupplyRead = SupplyOptions & { asOf?: string };
|
|
6
8
|
export interface SupplyEvidenceItem {
|
|
7
9
|
id: string;
|
|
8
10
|
tier: SupplyTier;
|
|
@@ -47,6 +49,13 @@ export interface SupplyRow {
|
|
|
47
49
|
direction: "in" | "out" | "mutual";
|
|
48
50
|
pctOfRevenue: number | null;
|
|
49
51
|
pctScope: string | null;
|
|
52
|
+
/**
|
|
53
|
+
* For a share tagged with a business segment, what the filing's sentence
|
|
54
|
+
* makes it a share of: "total" for the whole company's revenue the segment
|
|
55
|
+
* earns (NVDA's 16% of total revenue, from Compute & Networking), "segment"
|
|
56
|
+
* for the segment's own. Absent while unread, and from older servers.
|
|
57
|
+
*/
|
|
58
|
+
pctScopeBasis?: "total" | "segment" | null;
|
|
50
59
|
pctBasis: "revenue" | "receivables" | "cost" | "purchases" | null;
|
|
51
60
|
usd: number | null;
|
|
52
61
|
usdBasis: "disclosed" | "derived" | null;
|
|
@@ -38,12 +38,46 @@ interface CloudPricingTier {
|
|
|
38
38
|
|
|
39
39
|
/** `/account/cloud`, reduced to the plan fields the apps read. */
|
|
40
40
|
export interface CloudAccountPlan {
|
|
41
|
-
subscription
|
|
41
|
+
/** The account's own Cloud subscription; Pro through a team is never here. */
|
|
42
|
+
subscription?: {
|
|
43
|
+
status: string | null;
|
|
44
|
+
/** Paid or trialing now. */
|
|
45
|
+
active?: boolean;
|
|
46
|
+
/** ISO end of the period paid for: the renewal, or the end once cancelled. */
|
|
47
|
+
currentPeriodEnd?: string | null;
|
|
48
|
+
/** A cancel is scheduled for the period end. */
|
|
49
|
+
cancelAtPeriodEnd?: boolean;
|
|
50
|
+
};
|
|
42
51
|
effectivePlan?: "free" | "pro";
|
|
43
52
|
/** Whether a checkout started now comes with the free trial attached. */
|
|
44
53
|
trialAvailable?: boolean;
|
|
45
54
|
/** The last charge failed; checkout opens the unpaid invoice instead. */
|
|
46
55
|
paymentFailed?: boolean;
|
|
56
|
+
/** The team whose plan gives this account Pro, when its own plan does not. */
|
|
57
|
+
proTeam?: { id: string; name: string } | null;
|
|
58
|
+
/**
|
|
59
|
+
* ISO time the account first paid for Pro, while its own subscription is
|
|
60
|
+
* paid; null on a trial, through a team, or when unknown. Older servers
|
|
61
|
+
* leave it out.
|
|
62
|
+
*/
|
|
63
|
+
firstChargeAt?: string | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The one save offer the cancel flow can make, as the server decides it. */
|
|
67
|
+
export type CloudRetentionOffer = "trial_extension" | "discount";
|
|
68
|
+
|
|
69
|
+
/** The subscriber's price when it is below what a new subscriber pays, in integer cents. */
|
|
70
|
+
export interface CloudKeptPrice {
|
|
71
|
+
amount: number;
|
|
72
|
+
listAmount: number;
|
|
73
|
+
interval: "month" | "year";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** What the cancel flow offers this subscription, read as it opens. */
|
|
77
|
+
export interface CloudRetentionOfferAnswer {
|
|
78
|
+
offer: CloudRetentionOffer | null;
|
|
79
|
+
extendedTrialEndsAt: string | null;
|
|
80
|
+
keptPrice: CloudKeptPrice | null;
|
|
47
81
|
}
|
|
48
82
|
|
|
49
83
|
/** Moving a monthly Pro subscription to yearly billing, in integer cents. */
|
|
@@ -147,6 +147,9 @@ export interface CloudFredObservationPayload {
|
|
|
147
147
|
* 1 Sep and were released 20 Oct. Absent on daily series and older points.
|
|
148
148
|
*/
|
|
149
149
|
releasedOn?: string;
|
|
150
|
+
firstReleased?: string;
|
|
151
|
+
revisedOn?: string;
|
|
152
|
+
firstReleaseValue?: number;
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
export interface CloudFredSeriesInfoPayload {
|
|
@@ -19,6 +19,7 @@ import { registerPaneDocsHandler } from "../docs/requests";
|
|
|
19
19
|
import { isMoveDownShortcut, isMoveUpShortcut } from "../components/command-bar/keyboard-handlers";
|
|
20
20
|
import { pressStarPromptKey } from "./star-prompt/runtime";
|
|
21
21
|
import { pressSinceLastVisitKey } from "./since-last-visit/keys";
|
|
22
|
+
import { pressProWelcomeKey } from "./pro-welcome/keys";
|
|
22
23
|
import {
|
|
23
24
|
copyActiveSelection,
|
|
24
25
|
isCopyShortcut,
|
|
@@ -177,8 +178,9 @@ export function useAppGlobalShortcuts({
|
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
// Toasts float above everything, so their keys work over a dialog too.
|
|
180
|
-
// The since-last-visit strip, then the
|
|
181
|
-
// the same keys once no toast does, but only over
|
|
181
|
+
// The since-last-visit strip, then the Pro row under it, then the status
|
|
182
|
+
// bar's star line, answer the same keys once no toast does, but only over
|
|
183
|
+
// the workspace itself.
|
|
182
184
|
if (action === "notification-action" || action === "notification-dismiss") {
|
|
183
185
|
if (ranAlready(action)) return;
|
|
184
186
|
const toastHandled = action === "notification-action"
|
|
@@ -190,7 +192,7 @@ export function useAppGlobalShortcuts({
|
|
|
190
192
|
&& !state.commandBarOpen
|
|
191
193
|
&& !state.inputCaptured
|
|
192
194
|
&& !isDetachedWindow
|
|
193
|
-
&& (pressSinceLastVisitKey(kind) || pressStarPromptKey(kind))
|
|
195
|
+
&& (pressSinceLastVisitKey(kind) || pressProWelcomeKey(kind) || pressStarPromptKey(kind))
|
|
194
196
|
);
|
|
195
197
|
if (handled) {
|
|
196
198
|
event.preventDefault();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface ProWelcomeKeyHandlers {
|
|
2
|
+
open(): void;
|
|
3
|
+
dismiss(): void;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** What the notification keys do while the row shows; null otherwise. */
|
|
7
|
+
let keyHandlers: ProWelcomeKeyHandlers | null = null;
|
|
8
|
+
|
|
9
|
+
/** Hands the notification keys to the row while it shows; returns the release. */
|
|
10
|
+
export function bindProWelcomeKeys(handlers: ProWelcomeKeyHandlers): () => void {
|
|
11
|
+
keyHandlers = handlers;
|
|
12
|
+
return () => {
|
|
13
|
+
if (keyHandlers === handlers) keyHandlers = null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Runs the row's open (its first function) or dismiss for the notification
|
|
19
|
+
* keys. False when the row is not showing, so the key goes on to whatever
|
|
20
|
+
* else wants it.
|
|
21
|
+
*/
|
|
22
|
+
export function pressProWelcomeKey(kind: "open" | "dismiss"): boolean {
|
|
23
|
+
if (!keyHandlers) return false;
|
|
24
|
+
if (kind === "open") keyHandlers.open();
|
|
25
|
+
else keyHandlers.dismiss();
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { CloudAccountPlan } from "../../api-client";
|
|
2
|
+
import type { PlanAccess } from "../../api-client/plan-rules";
|
|
3
|
+
import { kindFromListingSyntax, resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
|
|
4
|
+
import type { AppConfig } from "../../types/config";
|
|
5
|
+
import type { TickerInstrumentKind } from "../../types/instrument";
|
|
6
|
+
import type { TickerRecord } from "../../types/ticker";
|
|
7
|
+
import { trackedListings } from "../since-last-visit/model";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The row a new Pro payer sees in their first two weeks: a few Pro functions
|
|
11
|
+
* they have not opened yet, each on one of their own tickers. Everything it
|
|
12
|
+
* reads is already on this machine (the command bar's recent runs, the
|
|
13
|
+
* layouts, the portfolios, watchlists and recently viewed tickers) except the
|
|
14
|
+
* first charge's date, which the account's own plan answer carries. Nothing
|
|
15
|
+
* about it is kept per account or sent anywhere.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const DAY_MS = 86_400_000;
|
|
19
|
+
/** Days after the first paid charge the row may show: day 0 (the charge) through this one. */
|
|
20
|
+
const PRO_WELCOME_LAST_DAY = 14;
|
|
21
|
+
/** Fewer unopened functions than this and the row has nothing worth a row. */
|
|
22
|
+
const MIN_FUNCTIONS = 2;
|
|
23
|
+
const MAX_FUNCTIONS = 3;
|
|
24
|
+
|
|
25
|
+
/** A Pro function the row can name: its command, what it is, and the tickers it has data for. */
|
|
26
|
+
export interface ProWelcomeFunction {
|
|
27
|
+
templateId: string;
|
|
28
|
+
/** The command bar's mnemonic (`CALLS`), which the button's tooltip teaches. */
|
|
29
|
+
shortcut: string;
|
|
30
|
+
/** What it is, ahead of the ticker: "Earnings calls" AAPL. */
|
|
31
|
+
label: string;
|
|
32
|
+
kinds: readonly TickerInstrumentKind[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Pro's functions that open on a ticker, in the order the upgrade sheet
|
|
37
|
+
* sells them: earnings calls, then options flow and X, then the rest.
|
|
38
|
+
*/
|
|
39
|
+
const PRO_WELCOME_FUNCTIONS: readonly ProWelcomeFunction[] = [
|
|
40
|
+
{ templateId: "earnings-calls-pane", shortcut: "CALLS", label: "Earnings calls", kinds: ["equity"] },
|
|
41
|
+
{ templateId: "scanner-flow-pane", shortcut: "FLOW", label: "Options flow", kinds: ["equity", "fund"] },
|
|
42
|
+
{ templateId: "social-mentions-pane", shortcut: "BUZZ", label: "X mentions", kinds: ["equity", "fund", "crypto"] },
|
|
43
|
+
{ templateId: "jobs-pane", shortcut: "JOBS", label: "Hiring", kinds: ["equity"] },
|
|
44
|
+
{ templateId: "filing-events-pane", shortcut: "EK", label: "8-K events", kinds: ["equity"] },
|
|
45
|
+
{ templateId: "risk-factors-pane", shortcut: "RISK", label: "Risk factors", kinds: ["equity"] },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
/** One button on the row: a function on one of the user's tickers. */
|
|
49
|
+
export interface ProWelcomeChip {
|
|
50
|
+
fn: ProWelcomeFunction;
|
|
51
|
+
symbol: string;
|
|
52
|
+
/** The saved ticker, when the symbol is one; the pane opens on it. */
|
|
53
|
+
ticker: TickerRecord | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ProWelcomeEligibility {
|
|
57
|
+
access: Pick<PlanAccess, "isPayingPro" | "isTrialActive">;
|
|
58
|
+
/** The account's plan answer; null until it came. */
|
|
59
|
+
plan: Pick<CloudAccountPlan, "firstChargeAt" | "proTeam"> | null;
|
|
60
|
+
/** Dismissed for good on this machine. */
|
|
61
|
+
dismissed: boolean;
|
|
62
|
+
now: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A payer of their own Pro plan from the day of their first paid charge
|
|
67
|
+
* through day 14. Not on a trial (no charge yet), not with Pro through a team
|
|
68
|
+
* seat, not once dismissed, and not when the server gave no first charge.
|
|
69
|
+
*/
|
|
70
|
+
export function proWelcomeEligible({ access, plan, dismissed, now }: ProWelcomeEligibility): boolean {
|
|
71
|
+
if (dismissed || !access.isPayingPro || access.isTrialActive) return false;
|
|
72
|
+
if (!plan || plan.proTeam) return false;
|
|
73
|
+
const firstCharge = Date.parse(plan.firstChargeAt ?? "");
|
|
74
|
+
if (!Number.isFinite(firstCharge)) return false;
|
|
75
|
+
// A charge a moment ahead of this machine's clock is today's.
|
|
76
|
+
const day = Math.floor(Math.max(0, now - firstCharge) / DAY_MS);
|
|
77
|
+
return day <= PRO_WELCOME_LAST_DAY;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type LayoutsConfig = Pick<AppConfig, "layout" | "layouts" | "recentCommands">;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The pane templates this machine shows the user opened: run from the
|
|
84
|
+
* command bar lately, or open in a layout (saved ones too).
|
|
85
|
+
*/
|
|
86
|
+
export function openedFunctions(
|
|
87
|
+
config: LayoutsConfig,
|
|
88
|
+
paneIdOf: (templateId: string) => string | null,
|
|
89
|
+
functions: readonly ProWelcomeFunction[] = PRO_WELCOME_FUNCTIONS,
|
|
90
|
+
): Set<string> {
|
|
91
|
+
const paneIds = new Set<string>();
|
|
92
|
+
for (const layout of [config.layout, ...config.layouts.map((saved) => saved.layout)]) {
|
|
93
|
+
for (const instance of layout?.instances ?? []) paneIds.add(instance.paneId);
|
|
94
|
+
}
|
|
95
|
+
const ran = new Set((config.recentCommands ?? []).map((command) => command.id));
|
|
96
|
+
const opened = new Set<string>();
|
|
97
|
+
for (const fn of functions) {
|
|
98
|
+
const paneId = paneIdOf(fn.templateId);
|
|
99
|
+
if (ran.has(`pane-template:${fn.templateId}`) || (paneId && paneIds.has(paneId))) opened.add(fn.templateId);
|
|
100
|
+
}
|
|
101
|
+
return opened;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface OwnTicker {
|
|
105
|
+
symbol: string;
|
|
106
|
+
ticker: TickerRecord | null;
|
|
107
|
+
kind: TickerInstrumentKind;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The user's own tickers, best first: holdings, then watchlists (team
|
|
112
|
+
* collections and imported portfolios are not their own), and with none of
|
|
113
|
+
* those the tickers they viewed most recently.
|
|
114
|
+
*/
|
|
115
|
+
export function ownTickers(
|
|
116
|
+
config: Pick<AppConfig, "portfolios" | "watchlists">,
|
|
117
|
+
tickers: ReadonlyMap<string, TickerRecord>,
|
|
118
|
+
recentTickers: readonly string[],
|
|
119
|
+
): OwnTicker[] {
|
|
120
|
+
const tracked = trackedListings(config, tickers).map(({ symbol }) => symbol);
|
|
121
|
+
const symbols = tracked.length > 0 ? tracked : recentTickers;
|
|
122
|
+
const seen = new Set<string>();
|
|
123
|
+
const own: OwnTicker[] = [];
|
|
124
|
+
for (const symbol of symbols) {
|
|
125
|
+
if (!symbol || seen.has(symbol)) continue;
|
|
126
|
+
seen.add(symbol);
|
|
127
|
+
const ticker = tickers.get(symbol) ?? null;
|
|
128
|
+
const kind = ticker ? resolveTickerInstrumentKind(ticker) : kindFromListingSyntax(symbol) ?? "equity";
|
|
129
|
+
own.push({ symbol, ticker, kind });
|
|
130
|
+
}
|
|
131
|
+
return own;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Two or three functions the user has not opened, each on one of their own
|
|
136
|
+
* tickers it has data for, a different one each while there are enough;
|
|
137
|
+
* empty when fewer than two can be named. `available` leaves out a function
|
|
138
|
+
* whose plugin is off or missing.
|
|
139
|
+
*/
|
|
140
|
+
export function pickProWelcomeChips(
|
|
141
|
+
own: readonly OwnTicker[],
|
|
142
|
+
opened: ReadonlySet<string>,
|
|
143
|
+
available: (templateId: string) => boolean,
|
|
144
|
+
functions: readonly ProWelcomeFunction[] = PRO_WELCOME_FUNCTIONS,
|
|
145
|
+
): ProWelcomeChip[] {
|
|
146
|
+
const chips: ProWelcomeChip[] = [];
|
|
147
|
+
const used = new Set<string>();
|
|
148
|
+
for (const fn of functions) {
|
|
149
|
+
if (chips.length >= MAX_FUNCTIONS) break;
|
|
150
|
+
if (opened.has(fn.templateId) || !available(fn.templateId)) continue;
|
|
151
|
+
const fits = own.filter((entry) => fn.kinds.includes(entry.kind));
|
|
152
|
+
const pick = fits.find((entry) => !used.has(entry.symbol)) ?? fits[0];
|
|
153
|
+
if (!pick) continue;
|
|
154
|
+
used.add(pick.symbol);
|
|
155
|
+
chips.push({ fn, symbol: pick.symbol, ticker: pick.ticker });
|
|
156
|
+
}
|
|
157
|
+
return chips.length >= MIN_FUNCTIONS ? chips : [];
|
|
158
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { Box, Text, useActionShortcut, useUiCapabilities } from "../../ui";
|
|
3
|
+
import { Button, terminalButtonColumns } from "../../components/ui/button";
|
|
4
|
+
import { DesktopPaneLinkChip, TerminalPaneLinkChip } from "../../components/ui/pane-link-chip";
|
|
5
|
+
import { t, tf } from "../../i18n";
|
|
6
|
+
import { useAppLanguage } from "../../i18n/react";
|
|
7
|
+
import { useViewport } from "../../react/input";
|
|
8
|
+
import { useThemeColors } from "../../theme/theme-context";
|
|
9
|
+
import { displayWidth } from "../../utils/format";
|
|
10
|
+
import { bindProWelcomeKeys } from "./keys";
|
|
11
|
+
import type { ProWelcomeChip } from "./model";
|
|
12
|
+
import type { ProWelcome } from "./use-pro-welcome";
|
|
13
|
+
|
|
14
|
+
/** Cells between the lead and the chips, and before Dismiss. */
|
|
15
|
+
const GAP = 2;
|
|
16
|
+
/** A window this wide (in cells) says the lead and the functions in full on the desktop and the web. */
|
|
17
|
+
const NATIVE_FULL_COLUMNS = 110;
|
|
18
|
+
|
|
19
|
+
interface RowFit {
|
|
20
|
+
lead: string;
|
|
21
|
+
/** Functions by their mnemonic (`CALLS · AAPL`) rather than their name. */
|
|
22
|
+
short: boolean;
|
|
23
|
+
chips: number;
|
|
24
|
+
dismissKey: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** What a chip says: the function and the ticker it opens on, short as the command itself (`CALLS AAPL`). */
|
|
28
|
+
function chipText(chip: ProWelcomeChip, short: boolean): string {
|
|
29
|
+
return short ? `${chip.fn.shortcut} ${chip.symbol}` : `${t(chip.fn.label)} · ${chip.symbol}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The chip's lead square: the function's letter, as its pane's chip has. */
|
|
33
|
+
function chipIcon(chip: ProWelcomeChip): string {
|
|
34
|
+
return chip.fn.shortcut.slice(0, 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** A terminal chip's cells: its square, its words and the space after them, then one between chips. */
|
|
38
|
+
function terminalChipColumns(chip: ProWelcomeChip, short: boolean): number {
|
|
39
|
+
return displayWidth(` ${chipIcon(chip)} `) + displayWidth(chipText(chip, short)) + 1 + 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* What the terminal's one row has room for: a lead and Dismiss always; then
|
|
44
|
+
* every function by its name, else by its command, else as many as fit;
|
|
45
|
+
* then Dismiss's key; then the lead in full. A window too narrow for any
|
|
46
|
+
* function says the least lead and one command when one fits.
|
|
47
|
+
*/
|
|
48
|
+
function fitTerminalRow(
|
|
49
|
+
width: number,
|
|
50
|
+
chips: readonly ProWelcomeChip[],
|
|
51
|
+
[fullLead, shortLead, tinyLead]: readonly [string, string, string],
|
|
52
|
+
dismissColumns: { withKey: number; bare: number },
|
|
53
|
+
): RowFit {
|
|
54
|
+
const fit = (option: Omit<RowFit, "chips">): RowFit => {
|
|
55
|
+
let room = width - 2 - displayWidth(option.lead) - GAP - GAP
|
|
56
|
+
- (option.dismissKey ? dismissColumns.withKey : dismissColumns.bare);
|
|
57
|
+
let count = 0;
|
|
58
|
+
for (const chip of chips) {
|
|
59
|
+
const columns = terminalChipColumns(chip, option.short);
|
|
60
|
+
if (columns > room) break;
|
|
61
|
+
room -= columns;
|
|
62
|
+
count += 1;
|
|
63
|
+
}
|
|
64
|
+
return { ...option, chips: count };
|
|
65
|
+
};
|
|
66
|
+
const options = [
|
|
67
|
+
fit({ lead: fullLead, short: false, dismissKey: true }),
|
|
68
|
+
fit({ lead: shortLead, short: false, dismissKey: true }),
|
|
69
|
+
fit({ lead: shortLead, short: true, dismissKey: true }),
|
|
70
|
+
fit({ lead: shortLead, short: true, dismissKey: false }),
|
|
71
|
+
fit({ lead: tinyLead, short: true, dismissKey: false }),
|
|
72
|
+
];
|
|
73
|
+
const whole = options.find((option) => option.chips === chips.length);
|
|
74
|
+
if (whole) return whole;
|
|
75
|
+
const most = options.reduce((best, option) => (option.chips > best.chips ? option : best));
|
|
76
|
+
return most.chips > 0 ? most : options.at(-1)!;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The row a new Pro payer sees under the header in their first two weeks: a
|
|
81
|
+
* few Pro functions they have not opened, each a chip that opens it on one
|
|
82
|
+
* of their own tickers. Dismiss puts it away for good on this machine (the
|
|
83
|
+
* notification dismiss key too; the notification action key opens the first).
|
|
84
|
+
*/
|
|
85
|
+
export function ProWelcomeRow({ welcome }: { welcome: ProWelcome }) {
|
|
86
|
+
useAppLanguage();
|
|
87
|
+
const colors = useThemeColors();
|
|
88
|
+
const { nativePaneChrome = false } = useUiCapabilities();
|
|
89
|
+
const { width } = useViewport();
|
|
90
|
+
const dismissKey = useActionShortcut("notification-dismiss");
|
|
91
|
+
const chips = welcome.chips ?? [];
|
|
92
|
+
const first = chips[0] ?? null;
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!first) return;
|
|
96
|
+
return bindProWelcomeKeys({ open: () => welcome.open(first), dismiss: welcome.dismiss });
|
|
97
|
+
}, [first, welcome]);
|
|
98
|
+
|
|
99
|
+
if (chips.length === 0) return null;
|
|
100
|
+
|
|
101
|
+
const fullLead = t("Try Pro on your tickers");
|
|
102
|
+
const shortLead = t("Try Pro");
|
|
103
|
+
const tinyLead = "Pro";
|
|
104
|
+
const dismissButton = { label: "Dismiss", compact: true, shortcut: dismissKey || undefined } as const;
|
|
105
|
+
const bareDismissButton = { label: "Dismiss", compact: true } as const;
|
|
106
|
+
const wide = width >= NATIVE_FULL_COLUMNS;
|
|
107
|
+
// The desktop and the web lay the chips out in CSS: one that has no room wraps out of sight.
|
|
108
|
+
const fit: RowFit = nativePaneChrome
|
|
109
|
+
? { lead: wide ? fullLead : shortLead, short: !wide, chips: chips.length, dismissKey: true }
|
|
110
|
+
: fitTerminalRow(
|
|
111
|
+
width,
|
|
112
|
+
chips,
|
|
113
|
+
[fullLead, shortLead, tinyLead],
|
|
114
|
+
{ withKey: terminalButtonColumns(dismissButton), bare: terminalButtonColumns(bareDismissButton) },
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const chipNodes = chips.slice(0, fit.chips).map((chip) => {
|
|
118
|
+
const command = `${chip.fn.shortcut} ${chip.symbol}`;
|
|
119
|
+
return nativePaneChrome ? (
|
|
120
|
+
<DesktopPaneLinkChip
|
|
121
|
+
key={chip.fn.templateId}
|
|
122
|
+
content={{ title: chipText(chip, fit.short), detail: "", icon: chipIcon(chip) }}
|
|
123
|
+
variant="inline"
|
|
124
|
+
onOpen={() => welcome.open(chip)}
|
|
125
|
+
tooltip={tf("Open {command}", { command })}
|
|
126
|
+
role="pro-welcome-chip"
|
|
127
|
+
linkKey={`pro-welcome:${chip.fn.shortcut}`}
|
|
128
|
+
/>
|
|
129
|
+
) : (
|
|
130
|
+
<Box key={chip.fn.templateId} paddingRight={1}>
|
|
131
|
+
<TerminalPaneLinkChip
|
|
132
|
+
content={{ title: chipText(chip, fit.short), detail: "", icon: chipIcon(chip) }}
|
|
133
|
+
width={terminalChipColumns(chip, fit.short) - 1}
|
|
134
|
+
onOpen={() => welcome.open(chip)}
|
|
135
|
+
/>
|
|
136
|
+
</Box>
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<Box
|
|
142
|
+
flexDirection="row"
|
|
143
|
+
height={1}
|
|
144
|
+
alignItems="center"
|
|
145
|
+
flexShrink={0}
|
|
146
|
+
backgroundColor={colors.panel}
|
|
147
|
+
data-gloom-role="pro-welcome"
|
|
148
|
+
style={nativePaneChrome ? { paddingInline: "var(--gloom-inset)", gap: "var(--gloom-space-sm)" } : undefined}
|
|
149
|
+
paddingX={nativePaneChrome ? undefined : 1}
|
|
150
|
+
>
|
|
151
|
+
<Box flexShrink={0} paddingRight={nativePaneChrome ? undefined : GAP}>
|
|
152
|
+
<Text fg={colors.textDim}>{fit.lead}</Text>
|
|
153
|
+
</Box>
|
|
154
|
+
<Box
|
|
155
|
+
flexDirection="row"
|
|
156
|
+
flexGrow={1}
|
|
157
|
+
flexShrink={1}
|
|
158
|
+
minWidth={0}
|
|
159
|
+
overflow="hidden"
|
|
160
|
+
// A chip the window has no room for wraps out of sight rather than being cut.
|
|
161
|
+
style={nativePaneChrome ? { flexWrap: "wrap", height: "100%", alignContent: "flex-start", alignItems: "center", gap: "var(--gloom-space-sm)" } : undefined}
|
|
162
|
+
>
|
|
163
|
+
{chipNodes}
|
|
164
|
+
</Box>
|
|
165
|
+
<Box flexDirection="row" flexShrink={0} paddingLeft={nativePaneChrome ? undefined : GAP}>
|
|
166
|
+
<Button
|
|
167
|
+
{...(fit.dismissKey ? dismissButton : bareDismissButton)}
|
|
168
|
+
variant="plain"
|
|
169
|
+
title={t("Stop suggesting Pro functions")}
|
|
170
|
+
stopPropagation
|
|
171
|
+
onPress={welcome.dismiss}
|
|
172
|
+
/>
|
|
173
|
+
</Box>
|
|
174
|
+
</Box>
|
|
175
|
+
);
|
|
176
|
+
}
|