gloomberb 0.20.3 → 0.20.4
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 +1 -1
- package/src/account/auth-dialog.tsx +17 -0
- package/src/api-client/data.ts +6 -0
- package/src/api-client/fx-interventions.ts +64 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/release-summaries.ts +21 -0
- package/src/app/keybindings/actions.ts +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +245 -66
- package/src/cli/commands/market.ts +77 -1
- package/src/cli/commands/news-search.ts +1 -3
- package/src/cli/commands/plugins.ts +27 -5
- package/src/cli/commands/system.ts +19 -3
- package/src/cli/commands/ticker.ts +60 -19
- package/src/cli/index.ts +8 -8
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/report-tables.ts +18 -6
- package/src/cli/result.ts +15 -7
- package/src/cli/types.ts +2 -0
- package/src/components/chart/composite/axis-overlays.tsx +22 -0
- package/src/components/chart/composite/composite-chart.tsx +54 -13
- package/src/components/chart/composite/event-captions.ts +109 -0
- package/src/components/chart/composite/event-guides.ts +74 -0
- package/src/components/chart/composite/rasterizer.ts +2 -0
- package/src/components/chart/composite/text-renderer.ts +2 -0
- package/src/components/chart/composite/types.ts +31 -0
- package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
- package/src/components/command-bar/routes/root/provider-search.ts +5 -4
- package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
- package/src/components/layout/detached-pane-shell.tsx +1 -1
- package/src/components/layout/floating-pane.tsx +5 -1
- package/src/components/layout/pane/footer/index.tsx +21 -14
- package/src/components/layout/pane/footer/model.ts +6 -0
- package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
- package/src/components/layout/shell/active-drag.ts +149 -105
- package/src/components/layout/shell/drag/drop-zones.ts +162 -0
- package/src/components/layout/shell/drag/index.ts +47 -218
- package/src/components/layout/shell/drag/live.ts +10 -3
- package/src/components/layout/shell/drag/overlays.tsx +182 -5
- package/src/components/layout/shell/drag/runtime.ts +29 -6
- package/src/components/layout/shell/drag/shared-edges.ts +156 -0
- package/src/components/layout/shell/index.tsx +11 -6
- package/src/components/layout/shell/menu.ts +11 -2
- package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
- package/src/components/layout/shell/native/window-state.ts +2 -2
- package/src/components/layout/shell/pane/layers.tsx +71 -7
- package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
- package/src/components/layout/shell/window-mode/index.ts +8 -10
- package/src/components/layout/window-edit/mode.ts +39 -7
- package/src/components/layout/window-edit/presentation.ts +1 -1
- package/src/components/onboarding/onboarding-keyboard.ts +4 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -3
- package/src/components/ui/button.tsx +2 -0
- package/src/components/ui/choice-dialog.tsx +1 -0
- package/src/components/ui/data-table/index.tsx +4 -3
- package/src/components/ui/list-view.tsx +7 -12
- package/src/components/ui/loading.tsx +10 -3
- package/src/components/ui/menu.tsx +6 -2
- package/src/components/ui/quote.ts +14 -1
- package/src/data/config/layout.ts +5 -2
- package/src/docs/snapshot.json +29 -5
- package/src/i18n/es.ts +9 -8
- package/src/i18n/ja.ts +9 -8
- package/src/i18n/ko.ts +9 -8
- package/src/i18n/zh-cn.ts +9 -8
- package/src/i18n/zh-tw.ts +9 -8
- package/src/layout/pane-manager/floating-actions.ts +17 -0
- package/src/layout/pane-manager/floating-stack.ts +187 -0
- package/src/layout/pane-manager/floating.ts +4 -2
- package/src/layout/pane-manager/gridlock.ts +5 -1
- package/src/layout/pane-manager/index.ts +11 -0
- package/src/layout/pane-manager/layout-state.ts +10 -3
- package/src/market-data/futures-board.ts +46 -1
- package/src/market-data/futures-contract.ts +12 -3
- package/src/market-data/fx-interventions.ts +270 -0
- package/src/news/news-model.ts +44 -2
- package/src/plugins/builtin/alerts/cli.ts +4 -4
- package/src/plugins/builtin/alerts/format.ts +1 -2
- package/src/plugins/builtin/alerts/headless.ts +1 -2
- package/src/plugins/builtin/alerts/move-checks.ts +12 -6
- package/src/plugins/builtin/alerts/move.ts +30 -9
- package/src/plugins/builtin/alerts/pane.tsx +0 -2
- package/src/plugins/builtin/alerts/storage.ts +4 -2
- package/src/plugins/builtin/alerts/types.ts +12 -0
- package/src/plugins/builtin/changelog/index.tsx +292 -101
- package/src/plugins/builtin/changelog/versions.ts +293 -0
- package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
- package/src/plugins/builtin/chat/message/render-state.ts +2 -5
- package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
- package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
- package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
- package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
- package/src/plugins/builtin/cloud/askg/model.ts +14 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
- package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
- package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
- package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
- package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +47 -6
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
- package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
- package/src/plugins/builtin/cot/headless.ts +14 -2
- package/src/plugins/builtin/earnings/index.tsx +2 -2
- package/src/plugins/builtin/futures/index.tsx +25 -4
- package/src/plugins/builtin/futures/model.ts +28 -32
- package/src/plugins/builtin/futures/series.ts +4 -3
- package/src/plugins/builtin/futures/table.tsx +16 -9
- package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
- package/src/plugins/builtin/help/index.tsx +3 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +18 -4
- package/src/plugins/builtin/layout-manager/index.tsx +8 -8
- package/src/plugins/builtin/news/headless.ts +2 -2
- package/src/plugins/builtin/news/index.tsx +3 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
- package/src/plugins/builtin/research/event-model.ts +9 -1
- package/src/plugins/builtin/research/event-sources.ts +22 -0
- package/src/plugins/builtin/research/headless.ts +3 -3
- package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +28 -13
- package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
- package/src/plugins/installer.ts +45 -0
- package/src/remote/resources.ts +12 -1
- package/src/remote/schema.ts +1 -0
- package/src/remote/semantic-helpers.ts +29 -1
- package/src/remote/semantic-tree.tsx +32 -15
- package/src/renderers/cloudflare/worker.ts +16 -1
- package/src/renderers/dom/styles.css +40 -6
- package/src/renderers/share/layout-view.tsx +1 -1
- package/src/sources/gloomberb-cloud/news.ts +35 -12
- package/src/state/opening-ticker-panes.ts +47 -0
- package/src/test-support/cli-context.ts +2 -0
- package/src/test-support/preload.ts +4 -1
- package/src/tickers/instrument-kind.ts +23 -3
- package/src/types/config.ts +5 -0
- package/src/types/context-menu.ts +2 -0
- package/src/types/plugin-commands.ts +140 -0
- package/src/types/plugin-context.ts +125 -0
- package/src/types/plugin-contributions.ts +55 -0
- package/src/types/plugin-definition.ts +234 -0
- package/src/types/plugin-notifications.ts +38 -0
- package/src/types/plugin-pane-settings.ts +114 -0
- package/src/types/plugin-pane-templates.ts +160 -0
- package/src/types/plugin-panes.ts +221 -0
- package/src/types/plugin-reports.ts +35 -0
- package/src/types/plugin-shared.ts +14 -0
- package/src/types/plugin-state.ts +71 -0
- package/src/types/plugin.ts +14 -1169
- package/src/ui/index.tsx +14 -3
- package/src/updater/github-releases.ts +23 -0
- package/src/utils/cli-output.ts +22 -9
|
@@ -2,7 +2,7 @@ import type { FuturesContractTermsPayload } from "../../../api-client/futures-cu
|
|
|
2
2
|
import type { Quote } from "../../../types/financials";
|
|
3
3
|
import { compareSortValues, type SortDirection } from "../../../utils/sort-values";
|
|
4
4
|
import type { BoardQuoteMap } from "../shared/use-quote-board";
|
|
5
|
-
import { FUTURES_SECTOR_ORDER, type FuturesContract, type FuturesSector } from "../../../market-data/futures-board";
|
|
5
|
+
import { FUTURES_SECTOR_ORDER, futuresGroupFilter, futuresNameKey, type FuturesContract, type FuturesSector } from "../../../market-data/futures-board";
|
|
6
6
|
import { CONTRACT_MONTH_NAME, futuresPriceUnit } from "../../../market-data/futures-contract";
|
|
7
7
|
import { contractMonthLabel } from "../../../utils/contract-month";
|
|
8
8
|
import { quoteDotMarketState } from "../../../market-data/market/status";
|
|
@@ -89,19 +89,21 @@ function dayMonth(date: string): string {
|
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* The row's headline: the contract its quote prices, as futuresContractName
|
|
92
|
-
* words it: the root's front month until its roll date.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
92
|
+
* words it: the root's front month until its roll date. Once the continuous
|
|
93
|
+
* symbol has rolled while the nearer month still trades, a note gives that
|
|
94
|
+
* month's last trade: "WTI Crude Oil Dec 2026, rolled (Nov expires 20 Oct)".
|
|
95
|
+
* The label names only the contract whose price the row shows: the day's
|
|
96
|
+
* most active month, beside the price, read as that month's price ("Cocoa
|
|
97
|
+
* Dec 2026, Mar 2027 most active 5,119" was December's), so it stays in
|
|
98
|
+
* `quote`'s contract lines. The terms only add the note when they name the
|
|
99
|
+
* month the quote prices, so a roll between the two loads never mixes
|
|
100
|
+
* months, and place the month when the quote's name carries none. A name
|
|
101
|
+
* column too narrow for the note drops it.
|
|
100
102
|
*/
|
|
101
103
|
export function futuresContractHeadline(
|
|
102
104
|
contract: FuturesContract,
|
|
103
105
|
quote?: Quote | null,
|
|
104
|
-
terms?: Pick<FuturesContractTermsPayload, "deliveryMonth" | "nearest"
|
|
106
|
+
terms?: Pick<FuturesContractTermsPayload, "deliveryMonth" | "nearest"> | null,
|
|
105
107
|
width = Number.POSITIVE_INFINITY,
|
|
106
108
|
): string {
|
|
107
109
|
const quoted = quotedContractMonth(contract, quote);
|
|
@@ -115,28 +117,13 @@ export function futuresContractHeadline(
|
|
|
115
117
|
const priced = `${month.year}-${String(month.month + 1).padStart(2, "0")}`;
|
|
116
118
|
const plain = `${contract.name} ${contractMonthLabel(month.year, month.month)}`;
|
|
117
119
|
if (!agree) return plain;
|
|
118
|
-
const notes: Array<{ text: string; min: string }> = [];
|
|
119
120
|
const nearest = terms?.nearest;
|
|
120
|
-
if (nearest
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
const active = terms?.mostActive;
|
|
126
|
-
if (active && /^\d{4}-\d{2}$/.test(active.deliveryMonth) && active.deliveryMonth !== priced) {
|
|
127
|
-
// Another year's month says which year it is.
|
|
128
|
-
const name = MONTH_NAMES[Number(active.deliveryMonth.slice(5, 7)) - 1];
|
|
129
|
-
const label = active.deliveryMonth.slice(0, 4) === String(month.year) ? name : `${name} ${active.deliveryMonth.slice(0, 4)}`;
|
|
130
|
-
notes.push({ text: `, ${label} most active`, min: `, ${label} most active` });
|
|
131
|
-
}
|
|
132
|
-
// The month the quote prices leads, so a column that clips the tail still shows it; a note keeps its place
|
|
121
|
+
if (!nearest || nearest.deliveryMonth >= priced) return plain;
|
|
122
|
+
const nearer = MONTH_NAMES[Number(nearest.deliveryMonth.slice(5, 7)) - 1];
|
|
123
|
+
const expiry = nearest.lastTrade ? `expires ${dayMonth(nearest.lastTrade)}` : "still trading";
|
|
124
|
+
// The month the quote prices leads, so a column that clips the tail still shows it; the note keeps its place
|
|
133
125
|
// while the column fits at least its start.
|
|
134
|
-
|
|
135
|
-
for (const note of notes) {
|
|
136
|
-
if (width < headline.length + note.min.length) break;
|
|
137
|
-
headline += note.text;
|
|
138
|
-
}
|
|
139
|
-
return headline;
|
|
126
|
+
return width < plain.length + ", rolled".length ? plain : `${plain}, rolled (${nearer} ${expiry})`;
|
|
140
127
|
}
|
|
141
128
|
|
|
142
129
|
/**
|
|
@@ -148,13 +135,22 @@ export function futuresUnitLabel(contract: FuturesContract, terms?: Pick<Futures
|
|
|
148
135
|
return futuresPriceUnit(contract, terms);
|
|
149
136
|
}
|
|
150
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Whether a row answers a search: its code, symbol, name or everyday names,
|
|
140
|
+
* a number marked as "No. 11" or "#11" alike ("SUGAR NO. 11", the CFTC's
|
|
141
|
+
* name, is Sugar #11), or a sector or group word that holds it (softs,
|
|
142
|
+
* grains, agriculture, metals, energy), which lists that group alone.
|
|
143
|
+
*/
|
|
151
144
|
function matchesFuturesSearch(contract: FuturesContract, query: string, quote?: Quote | null): boolean {
|
|
152
145
|
const normalized = query.trim().toLowerCase();
|
|
153
146
|
if (!normalized) return true;
|
|
147
|
+
const group = futuresGroupFilter(normalized);
|
|
148
|
+
if (group) return group(contract);
|
|
149
|
+
const named = futuresNameKey(normalized);
|
|
154
150
|
return (
|
|
155
151
|
contract.code.toLowerCase().includes(normalized)
|
|
156
|
-
|| contract.name
|
|
157
|
-
|| futuresContractName(contract, quote)
|
|
152
|
+
|| futuresNameKey(contract.name).includes(named)
|
|
153
|
+
|| futuresNameKey(futuresContractName(contract, quote)).includes(named)
|
|
158
154
|
|| contract.symbol.toLowerCase().includes(normalized)
|
|
159
155
|
// Everyday names the board's own does not hold: natgas is Natural Gas.
|
|
160
156
|
|| (contract.aliases ?? []).some((alias) => alias.includes(normalized))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SeriesDefinition } from "../../../series/types";
|
|
2
|
-
import { FUTURES_CONTRACTS, FUTURES_SECTOR_LABELS, type FuturesContract } from "../../../market-data/futures-board";
|
|
2
|
+
import { FUTURES_CONTRACTS, FUTURES_SECTOR_LABELS, futuresGroupTags, type FuturesContract } from "../../../market-data/futures-board";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Grains and softs the board quotes in US cents with no unit of its own
|
|
@@ -37,14 +37,15 @@ const CONTRACT_TAGS: Readonly<Record<string, readonly string[]>> = {
|
|
|
37
37
|
"6S": ["CHF", "franc", "swiss franc", "safe haven"],
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
/** Each continuous front-month contract on the futures board, as `FUT:ES
|
|
40
|
+
/** Each continuous front-month contract on the futures board, as `FUT:ES`, found by its sector and group words too (`catalog softs`). */
|
|
41
41
|
const FRONT_MONTH_SERIES: readonly SeriesDefinition[] = FUTURES_CONTRACTS.map((contract) => ({
|
|
42
42
|
id: `fut:${contract.code}`,
|
|
43
43
|
name: contract.name,
|
|
44
44
|
unit: futuresSeriesUnit(contract),
|
|
45
45
|
frequency: "daily",
|
|
46
46
|
group: "Futures",
|
|
47
|
-
tags: [contract.code, FUTURES_SECTOR_LABELS[contract.sector], "futures", "front month",
|
|
47
|
+
tags: [...new Set([contract.code, FUTURES_SECTOR_LABELS[contract.sector], ...futuresGroupTags(contract), "futures", "front month",
|
|
48
|
+
...CONTRACT_TAGS[contract.code] ?? []])],
|
|
48
49
|
expression: `FUT:${contract.code}`,
|
|
49
50
|
}));
|
|
50
51
|
|
|
@@ -41,17 +41,24 @@ const DEFAULT_FUTURES_COLUMN_IDS = FUTURES_COLUMN_DEFS.map((column) => column.id
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Extra columns only earn their width once the board is wide enough to keep a
|
|
44
|
-
* readable contract name
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
44
|
+
* readable contract name: CONTRACT never gets fewer than 24 cells
|
|
45
|
+
* once a board can hold that much. Each threshold is the width where the
|
|
46
|
+
* column fits with CONTRACT still at 24, the session word (from 100 cells)
|
|
47
|
+
* included. The change in percent always shows, and the week's and month's
|
|
48
|
+
* returns come next: the unit a price counts goes after them, so a board
|
|
49
|
+
* fullscreen on an 80-cell terminal (78 cells) reads SYM CONTRACT LAST CHG%
|
|
50
|
+
* 1W, and a floating one never hides the move behind a scroll (a cent price
|
|
51
|
+
* still says so on itself, 280.15¢). The unit outranks the session change in
|
|
52
|
+
* points, which the change in percent still gives. The previous close (the
|
|
53
|
+
* last price less the change) goes first, then each row's quote time (the
|
|
54
|
+
* status line dates the newest), which leaves a 1280-pixel shot room for "WTI
|
|
55
|
+
* Crude Oil Dec 2026, rolled (Nov expires 20 Oct)".
|
|
50
56
|
*/
|
|
51
57
|
const COLUMN_MIN_PANE_WIDTH: Partial<Record<FuturesColumnId, number>> = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
return1w: 71,
|
|
59
|
+
return1m: 80,
|
|
60
|
+
unit: 106,
|
|
61
|
+
change: 117,
|
|
55
62
|
returnYtd: 126,
|
|
56
63
|
volume: 136,
|
|
57
64
|
time: 170,
|
|
@@ -51,9 +51,9 @@ function loadTerms(symbol: string, batch: boolean): Promise<boolean> {
|
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Each listed row's contract terms, as `quote` reads them: the unit its price
|
|
54
|
-
* counts
|
|
55
|
-
* rolled
|
|
56
|
-
*
|
|
54
|
+
* counts and the nearer month still trading once its continuous symbol has
|
|
55
|
+
* rolled. Only the rows the board lists are asked for, and a row whose terms
|
|
56
|
+
* have not arrived (or that has none) renders without them.
|
|
57
57
|
*/
|
|
58
58
|
export function useFuturesBoardTerms(contracts: readonly FuturesContract[], enabled: boolean): FuturesTermsMap {
|
|
59
59
|
const symbolKey = contracts.map((contract) => contract.symbol).join(",");
|
|
@@ -357,7 +357,7 @@ function HelpPane({ focused, width, height }: PaneProps) {
|
|
|
357
357
|
],
|
|
358
358
|
},
|
|
359
359
|
{
|
|
360
|
-
//
|
|
360
|
+
// Panes in the layout keep the saved layout and floating ones follow the pointer; the keyboard's way is Window Mode below.
|
|
361
361
|
label: "Layout",
|
|
362
362
|
items: [
|
|
363
363
|
keyEntry("layout-drag", ["Drag"], "Floating panes can be dragged by the title bar and resized from the lower-right corner."),
|
|
@@ -374,8 +374,8 @@ function HelpPane({ focused, width, height }: PaneProps) {
|
|
|
374
374
|
? [entry("enter-resize", windowResizeBadges, "Enter window mode to resize the focused window.")]
|
|
375
375
|
: []),
|
|
376
376
|
keyEntry("mode", ["m", "r"], "Switch between move and resize."),
|
|
377
|
-
keyEntry("
|
|
378
|
-
keyEntry("move", ["Arrows", "h/j/k/l"], "Move, resize, or choose
|
|
377
|
+
keyEntry("float", ["d"], "Float the selected window, or return it to the layout."),
|
|
378
|
+
keyEntry("move", ["Arrows", "h/j/k/l"], "Move, resize, or choose where it goes in the layout."),
|
|
379
379
|
keyEntry("step", ["Shift"], "Use larger move and resize steps with direction keys."),
|
|
380
380
|
keyEntry("cycle", ["Tab", "w"], "Cycle windows or resize handles."),
|
|
381
381
|
keyEntry("commit", ["Enter", "Esc"], "Commit pending changes or exit window mode."),
|
|
@@ -61,8 +61,19 @@ import { badgeCell, badgeColumnWidth, mutedCell } from "./table-cells";
|
|
|
61
61
|
const CAPTURE_SCOPE = "help-keybinding-capture";
|
|
62
62
|
const FOOTER_ID = "help-keybindings";
|
|
63
63
|
const NOTE_COLUMN_WIDTH = 26;
|
|
64
|
-
/**
|
|
65
|
-
const
|
|
64
|
+
/** What the table takes besides its columns: its side padding, the gaps between columns and the scrollbar. */
|
|
65
|
+
const TABLE_CHROME = 5;
|
|
66
|
+
/** ACTION keeps at least this beside NOTE; narrower, NOTE is dropped and the footer carries the selected row's. */
|
|
67
|
+
const ACTION_MIN_WIDTH = 30;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Whether the NOTE column shows: only while some row has a note, and ACTION
|
|
71
|
+
* keeps ACTION_MIN_WIDTH cells beside it. At 80 cells an empty NOTE took 26
|
|
72
|
+
* while ACTION read "Change the focused pa…".
|
|
73
|
+
*/
|
|
74
|
+
function showsKeybindingNotes(width: number, keyColumnWidth: number, anyNote: boolean): boolean {
|
|
75
|
+
return anyNote && width - TABLE_CHROME - keyColumnWidth - NOTE_COLUMN_WIDTH >= ACTION_MIN_WIDTH;
|
|
76
|
+
}
|
|
66
77
|
|
|
67
78
|
type KeybindingColumnId = "key" | "action" | "note";
|
|
68
79
|
type KeybindingColumn = DataTableColumn & { id: KeybindingColumnId };
|
|
@@ -371,13 +382,16 @@ export function KeybindingsEditor({
|
|
|
371
382
|
() => badgeColumnWidth([...bindableRows.map((row) => row.chords), [t("Press a key")]]),
|
|
372
383
|
[bindableRows],
|
|
373
384
|
);
|
|
385
|
+
// Decided from every row, not the rows on screen, so ACTION's width holds while the table scrolls.
|
|
386
|
+
const anyNote = useMemo(() => bindableRows.some((row) => !!row.note), [bindableRows]);
|
|
387
|
+
const showNotes = showsKeybindingNotes(width, keyColumnWidth, anyNote);
|
|
374
388
|
const columns = useMemo<KeybindingColumn[]>(() => [
|
|
375
389
|
{ id: "key", label: "KEY", width: keyColumnWidth, align: "left" },
|
|
376
390
|
{ id: "action", label: "ACTION", width: 20, align: "left", flexGrow: 1 },
|
|
377
|
-
...(
|
|
391
|
+
...(showNotes
|
|
378
392
|
? [{ id: "note" as const, label: "NOTE", width: NOTE_COLUMN_WIDTH, align: "left" as const }]
|
|
379
393
|
: []),
|
|
380
|
-
], [keyColumnWidth,
|
|
394
|
+
], [keyColumnWidth, showNotes]);
|
|
381
395
|
|
|
382
396
|
const renderCell = useCallback((
|
|
383
397
|
row: EditorRow,
|
|
@@ -145,7 +145,7 @@ export const layoutManagerModule: PluginModule = {
|
|
|
145
145
|
ctx.registerCommand({
|
|
146
146
|
id: "float-pane",
|
|
147
147
|
label: "Float Pane",
|
|
148
|
-
description: "
|
|
148
|
+
description: "Take a pane out of the layout into a floating window",
|
|
149
149
|
keywords: ["float", "detach", "undock", "window", "pane"],
|
|
150
150
|
category: "config",
|
|
151
151
|
execute: async () => {
|
|
@@ -154,7 +154,7 @@ export const layoutManagerModule: PluginModule = {
|
|
|
154
154
|
const { layout, termWidth, termHeight, focusedPaneId } = getStateRef();
|
|
155
155
|
const focusedPane = getFocusedPane(layout, focusedPaneId);
|
|
156
156
|
if (!focusedPane || !isPaneDocked(layout, focusedPane.instanceId)) {
|
|
157
|
-
notify("Focus a
|
|
157
|
+
notify("Focus a pane in the layout to float it", { type: "info" });
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -167,9 +167,9 @@ export const layoutManagerModule: PluginModule = {
|
|
|
167
167
|
|
|
168
168
|
ctx.registerCommand({
|
|
169
169
|
id: "dock-pane",
|
|
170
|
-
label: "
|
|
171
|
-
description: "
|
|
172
|
-
keywords: ["
|
|
170
|
+
label: "Return to Layout",
|
|
171
|
+
description: "Put a floating pane back into the layout",
|
|
172
|
+
keywords: ["return", "layout", "tile", "attach", "pin", "pane", "dock"],
|
|
173
173
|
category: "config",
|
|
174
174
|
execute: async () => {
|
|
175
175
|
if (!getStateRef) return;
|
|
@@ -177,7 +177,7 @@ export const layoutManagerModule: PluginModule = {
|
|
|
177
177
|
const { layout, focusedPaneId } = getStateRef();
|
|
178
178
|
const focusedPane = getFocusedPane(layout, focusedPaneId);
|
|
179
179
|
if (!focusedPane || !layout.floating.some((entry) => entry.instanceId === focusedPane.instanceId)) {
|
|
180
|
-
notify("Focus a floating pane to
|
|
180
|
+
notify("Focus a floating pane to return it to the layout", { type: "info" });
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -281,11 +281,11 @@ export const layoutManagerModule: PluginModule = {
|
|
|
281
281
|
const focusedPane = getFocusedPane(layout, focusedPaneId);
|
|
282
282
|
const dockedPaneIds = getDockedPaneIds(layout);
|
|
283
283
|
if (dockedPaneIds.length < 2) {
|
|
284
|
-
notify("Need at least 2
|
|
284
|
+
notify("Need at least 2 panes in the layout to swap", { type: "info" });
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
287
|
if (!focusedPane || !isPaneDocked(layout, focusedPane.instanceId)) {
|
|
288
|
-
notify("Focus a
|
|
288
|
+
notify("Focus a pane in the layout to swap it", { type: "info" });
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
291
|
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
} from "../../../types/plugin";
|
|
7
7
|
import type { NewsArticle, NewsQuery } from "../../../news/types";
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
newsFallbackNotice,
|
|
10
10
|
mapCloudNewsArticle,
|
|
11
11
|
readCloudNews,
|
|
12
12
|
type CloudNewsRead,
|
|
@@ -102,7 +102,7 @@ function projectNewsHeadless(
|
|
|
102
102
|
freshness: cloudNewsFreshness(realtime),
|
|
103
103
|
// A coin pair no story is filed under shows the stories that mention the coin, and says so.
|
|
104
104
|
...(response.searchedFor && args.symbols[0]
|
|
105
|
-
? { notes: [
|
|
105
|
+
? { notes: [newsFallbackNotice(parsePublicTickerKey(args.symbols[0]).symbol, response.searchedFor)] }
|
|
106
106
|
// A receipt's or foreign line's stories are its company's, read from the home line.
|
|
107
107
|
: response.companyFrom ? { notes: companyDataNotes(readCompanyFrom(response.companyFrom)) } : {}),
|
|
108
108
|
metadata: {
|
|
@@ -7,7 +7,7 @@ import { useCallback } from "react";
|
|
|
7
7
|
import { useDebouncedPluginPaneState, usePluginPaneState } from "../../runtime";
|
|
8
8
|
import { EmptyState, PaneStatusBody, QueryBar, usePaneNoticeFooter } from "../../../components";
|
|
9
9
|
import { useCompanyDataFooter } from "../../../components/layout/pane/status-footer";
|
|
10
|
-
import {
|
|
10
|
+
import { newsFallbackNotice } from "../../../sources/gloomberb-cloud/news";
|
|
11
11
|
import { newsMuteSettingsDef, newsMutesApplyToFeed, useNewsMuteFilter } from "./wire/mutes";
|
|
12
12
|
import { newsListEmptyCopy } from "./wire/filter-articles";
|
|
13
13
|
import { NEWS_LIST_SEARCH_PLACEHOLDER, useNewsListSearch, useNewsListSearchHint } from "./wire/news/list-search";
|
|
@@ -88,11 +88,11 @@ function TickerNewsView({ width, height, focused }: { width: number; height: num
|
|
|
88
88
|
}, [markArticleRead, popOutArticle, readableArticle]);
|
|
89
89
|
|
|
90
90
|
useNewsListSearchHint("ticker-news", focused && !detailOpen, search.focusSearch);
|
|
91
|
-
// A coin pair no story is filed under lists the stories that mention the coin; the footer says so.
|
|
91
|
+
// A coin pair or a future no story is filed under lists the stories that mention the coin or the commodity; the footer says so.
|
|
92
92
|
const searchedFor = loaded[0]?.searchedFor;
|
|
93
93
|
usePaneNoticeFooter({
|
|
94
94
|
registrationId: "ticker-news-notices",
|
|
95
|
-
notices: searchedFor && instrument ? [
|
|
95
|
+
notices: searchedFor && instrument ? [newsFallbackNotice(instrument.symbol, searchedFor)] : [],
|
|
96
96
|
focused,
|
|
97
97
|
});
|
|
98
98
|
useNewsArticleFooter({
|
|
@@ -52,8 +52,11 @@ const COLUMNS: readonly Column[] = [
|
|
|
52
52
|
{ id: "oi", label: "OI USD", width: 7, align: "right" },
|
|
53
53
|
{ id: "volume", label: "Vol 24h", width: 7, align: "right" },
|
|
54
54
|
];
|
|
55
|
-
/**
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* What a narrow overview gives up first: the volume, then the contract, the premium, the open interest and the
|
|
57
|
+
* funding, so the columns left fit whole rather than squeezed into cut figures ("+0." for +0.0050%).
|
|
58
|
+
*/
|
|
59
|
+
const DROP_ORDER: readonly Column["id"][] = ["volume", "contract", "premium", "oi", "funding"];
|
|
57
60
|
const GAP = 2;
|
|
58
61
|
const span = (columns: readonly Column[]) => columns.reduce((sum, column) => sum + column.width, 0) + GAP * (columns.length - 1);
|
|
59
62
|
|
|
@@ -252,22 +252,22 @@ function EntryDetail({ entry, width, host, status, failure }: {
|
|
|
252
252
|
) : null}
|
|
253
253
|
|
|
254
254
|
<Box paddingTop={1} flexDirection="column">
|
|
255
|
-
{contributes.length > 0 ? <KeyValueRow labelWidth={
|
|
256
|
-
{opensWith.length > 0 ? <KeyValueRow labelWidth={
|
|
255
|
+
{contributes.length > 0 ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Adds" value={contributes.join(", ")} /> : null}
|
|
256
|
+
{opensWith.length > 0 ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Opens with" value={opensWith.join(", ")} /> : null}
|
|
257
257
|
{/*
|
|
258
258
|
* Declared by the plugin author and not enforced: plugins are not
|
|
259
259
|
* sandboxed, so this is a hint about intent, not a limit. Labelled
|
|
260
260
|
* "Declares" rather than "Network" so it does not read as a guarantee.
|
|
261
261
|
*/}
|
|
262
|
-
{entry.hosts.length > 0 ? <KeyValueRow labelWidth={
|
|
263
|
-
{entry.repo ? <KeyValueRow labelWidth={
|
|
264
|
-
{entry.minGloomberb ? <KeyValueRow labelWidth={
|
|
265
|
-
{entry.linked ? <KeyValueRow labelWidth={
|
|
266
|
-
{entry.installedCommit ? <KeyValueRow labelWidth={
|
|
267
|
-
{!entry.installed && entry.availableCommit ? <KeyValueRow labelWidth={
|
|
268
|
-
{entry.needsSetup ? <KeyValueRow labelWidth={
|
|
269
|
-
{entry.loadError ? <KeyValueRow labelWidth={
|
|
270
|
-
{entry.lastError && !entry.loadError ? <KeyValueRow labelWidth={
|
|
262
|
+
{entry.hosts.length > 0 ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Declares" value={entry.hosts.join(", ")} /> : null}
|
|
263
|
+
{entry.repo ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Source" value={`github.com/${entry.repo}`} /> : null}
|
|
264
|
+
{entry.minGloomberb ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Requires" value={requiredGloomberb(entry.minGloomberb) ? `Gloom ${entry.minGloomberb}, this is ${VERSION}` : `Gloom ${entry.minGloomberb}`} /> : null}
|
|
265
|
+
{entry.linked ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Linked" value={entry.directory ?? "local checkout"} /> : null}
|
|
266
|
+
{entry.installedCommit ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Commit" value={entry.installedCommit.slice(0, 7)} /> : null}
|
|
267
|
+
{!entry.installed && entry.availableCommit ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Pinned" value={`${entry.availableVersion ?? ""} ${entry.availableCommit.slice(0, 7)}`.trim()} /> : null}
|
|
268
|
+
{entry.needsSetup ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Setup" value="Missing a required setting. Press s." /> : null}
|
|
269
|
+
{entry.loadError ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Error" value={entry.loadError} /> : null}
|
|
270
|
+
{entry.lastError && !entry.loadError ? <KeyValueRow labelWidth={11} width={rowWidth} emphasis={false} label="Last error" value={entry.lastError} /> : null}
|
|
271
271
|
</Box>
|
|
272
272
|
|
|
273
273
|
{!entry.installed && !entry.bundled && entry.repo ? (
|
|
@@ -528,7 +528,9 @@ export function renderSummarySegments(segments: PortfolioSummarySegment[], width
|
|
|
528
528
|
<Box key={segment.id} flexDirection="row">
|
|
529
529
|
{segmentIndex > 0 && <Text fg={colors.textDim}>{" "}</Text>}
|
|
530
530
|
{segment.parts.map((part, partIndex) => (
|
|
531
|
-
|
|
531
|
+
// A row too narrow for its segment cuts the muted basis ("vs Thu 5 Nov close"), never the
|
|
532
|
+
// label or the figure: "Avg +1." read as a different number than +1.02%.
|
|
533
|
+
<Box key={`${segment.id}:${partIndex}`} flexDirection="row" flexShrink={part.tone === "muted" ? 1 : 0}>
|
|
532
534
|
{partIndex > 0 && <Text fg={colors.textDim}>{" "}</Text>}
|
|
533
535
|
<Text
|
|
534
536
|
fg={part.color ?? (part.tone === "label" || part.tone === "muted" ? colors.textDim : colors.text)}
|
|
@@ -69,6 +69,8 @@ export interface EventRow {
|
|
|
69
69
|
/** Keep the supplied ranges and comparison inputs available in detail/export. */
|
|
70
70
|
estimateInputs?: { eps?: AnalystEstimateRecord; revenue?: AnalystEstimateRecord };
|
|
71
71
|
estimateGrowthMetric?: "eps" | "revenue";
|
|
72
|
+
/** An estimate row's growth over the year-ago figure, as a fraction, of `estimateGrowthMetric`. */
|
|
73
|
+
estimateGrowth?: number;
|
|
72
74
|
fiscalPeriodEnd?: string;
|
|
73
75
|
periodDateSource?: FinancialStatement["dateSource"];
|
|
74
76
|
providerPeriodDate?: string;
|
|
@@ -341,6 +343,10 @@ export function buildEventRows(
|
|
|
341
343
|
// quarters give it when they all agree on one.
|
|
342
344
|
const feedCurrencies = new Set(earnings.map((earning) => earning.currency).filter(Boolean));
|
|
343
345
|
const feedCurrency = feedCurrencies.size === 1 ? [...feedCurrencies][0] : undefined;
|
|
346
|
+
// So do the oldest reported quarters (before 2024), which the feed leaves unlabelled, but only where the
|
|
347
|
+
// company's own EPS is in that currency too: one company's EPS then reads in one unit down the table, and an
|
|
348
|
+
// unlabelled figure nothing else vouches for stays unlabelled.
|
|
349
|
+
const reportedCurrency = feedCurrency && fundamentalsEpsCurrency(financials) === feedCurrency ? feedCurrency : undefined;
|
|
344
350
|
for (const [index, earning] of earnings.entries()) {
|
|
345
351
|
// A pending announcement must never inherit the previous report's actuals.
|
|
346
352
|
const statement = earning.epsActual == null ? undefined : statementForEarningsDate(quarterlyStatements, earning);
|
|
@@ -357,7 +363,7 @@ export function buildEventRows(
|
|
|
357
363
|
period: statement ? quarterLabel(statement.date) : earning.fiscalPeriod ? quarterLabel(earning.fiscalPeriod) : "-",
|
|
358
364
|
...(earning.time?.trim() ? { reportTime: earning.time.trim() } : {}),
|
|
359
365
|
detail: upcomingEarningsDetail(earning),
|
|
360
|
-
epsCurrency: earning.currency ?? (earning.epsActual == null ? feedCurrency :
|
|
366
|
+
epsCurrency: earning.currency ?? (earning.epsActual == null ? feedCurrency : reportedCurrency),
|
|
361
367
|
revenueCurrency: statement ? statement.currency ?? financials?.financialCurrency : undefined,
|
|
362
368
|
qEps: earning.epsActual ?? earning.epsEstimate,
|
|
363
369
|
qRevenue: statement?.totalRevenue,
|
|
@@ -386,6 +392,7 @@ export function buildEventRows(
|
|
|
386
392
|
for (const pair of buildEstimatePairs(estimates)) {
|
|
387
393
|
const isFiscal = isFiscalEstimatePeriod(pair.period);
|
|
388
394
|
if (!isFiscal && isReportedQuarter(pair.date, reportedPeriodEnds)) continue;
|
|
395
|
+
const growth = pair.eps?.growth ?? pair.revenue?.growth;
|
|
389
396
|
rows.push({
|
|
390
397
|
id: `estimate:${pair.date}:${pair.period}`,
|
|
391
398
|
date: pair.date,
|
|
@@ -399,6 +406,7 @@ export function buildEventRows(
|
|
|
399
406
|
...(pair.revenue ? { revenue: { ...pair.revenue } } : {}),
|
|
400
407
|
},
|
|
401
408
|
estimateGrowthMetric: pair.eps?.growth != null ? "eps" : pair.revenue?.growth != null ? "revenue" : undefined,
|
|
409
|
+
...growth != null ? { estimateGrowth: growth } : {},
|
|
402
410
|
epsCurrency: pair.eps?.currency,
|
|
403
411
|
revenueCurrency: pair.revenue?.currency,
|
|
404
412
|
qEps: isFiscal ? undefined : pair.eps?.average,
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
TickerFinancials,
|
|
6
6
|
} from "../../../types/financials";
|
|
7
7
|
import { formatEventMetric } from "./event-model";
|
|
8
|
+
import { formatPercent, formatPercentRaw } from "../../../utils/format";
|
|
8
9
|
import { loadEarningsCalendar } from "../earnings/data/cache";
|
|
9
10
|
import { calendarEventOf, newYorkDay, withResolvedEarnings } from "../shared/earnings-calendar";
|
|
10
11
|
|
|
@@ -28,6 +29,27 @@ export const EVENT_COLUMNS = [
|
|
|
28
29
|
{ key: "detail", header: "Detail" },
|
|
29
30
|
];
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* The columns of the earnings estimates report, as its pane heads them: what corporate actions
|
|
34
|
+
* call Value is a reported quarter's EPS surprise or an estimate's growth over the year-ago
|
|
35
|
+
* figure, each in a column of its own.
|
|
36
|
+
*/
|
|
37
|
+
export const EARNINGS_ESTIMATE_COLUMNS = [
|
|
38
|
+
...EVENT_COLUMNS.filter((column) => column.key !== "value" && column.key !== "detail"),
|
|
39
|
+
{
|
|
40
|
+
key: "surprisePercent", header: "EPS surp", align: "right" as const,
|
|
41
|
+
format: (value: unknown) => value == null ? "-" : formatPercentRaw(Number(value)),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "estimateGrowth", header: "YoY growth", align: "right" as const,
|
|
45
|
+
format: (value: unknown) => value == null ? "-" : formatPercent(Number(value)),
|
|
46
|
+
// The text says which figure grew, as the pane does; exports keep the percent a number.
|
|
47
|
+
textFormat: (value: unknown, row: Record<string, unknown>) => value == null ? "-"
|
|
48
|
+
: `${formatPercent(Number(value))} ${row.estimateGrowthMetric === "revenue" ? "rev" : "EPS"}`,
|
|
49
|
+
},
|
|
50
|
+
{ key: "detail", header: "Detail" },
|
|
51
|
+
];
|
|
52
|
+
|
|
31
53
|
export interface EventSources {
|
|
32
54
|
actions: CorporateActionsData | null;
|
|
33
55
|
estimates: AnalystResearchData | null;
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
HeadlessRowsResult,
|
|
11
11
|
} from "../../../types/plugin";
|
|
12
12
|
import { buildEventRows, eventSourceNotice, type EventRow } from "./event-model";
|
|
13
|
-
import {
|
|
13
|
+
import { EARNINGS_ESTIMATE_COLUMNS, loadEventSources } from "./event-sources";
|
|
14
14
|
import { REPORTED_DATA } from "../shared/report-freshness";
|
|
15
15
|
import { EPS_BASIS_NOTE } from "../shared/earnings-report";
|
|
16
16
|
import { REPORT_FILTER, REPORT_ROWS } from "../shared/headless-options";
|
|
@@ -73,7 +73,7 @@ function projectEarningsEstimatesHeadless(
|
|
|
73
73
|
if (unmatchedReportedPeriods.length) errors.push(`No statement period identified for ${unmatchedReportedPeriods.length} reported earnings row(s); quarterly revenue is unavailable.`);
|
|
74
74
|
|
|
75
75
|
return {
|
|
76
|
-
columns:
|
|
76
|
+
columns: EARNINGS_ESTIMATE_COLUMNS,
|
|
77
77
|
rows,
|
|
78
78
|
errors: errors.length ? errors : undefined,
|
|
79
79
|
metadata: {
|
|
@@ -124,7 +124,7 @@ export function createEarningsEstimatesHeadless(
|
|
|
124
124
|
maximum: 200,
|
|
125
125
|
},
|
|
126
126
|
],
|
|
127
|
-
columns:
|
|
127
|
+
columns: EARNINGS_ESTIMATE_COLUMNS,
|
|
128
128
|
describe: (args) => `Earnings Estimates | ${String(args.argument)}`,
|
|
129
129
|
async load(args, context) {
|
|
130
130
|
return projectEarningsEstimatesHeadless(
|
|
@@ -15,6 +15,7 @@ import { freeQuotesDelayMinutes, resolvePlanAccess, usePlanAccess, type PlanAcce
|
|
|
15
15
|
import { useViewport } from "../../../react/input";
|
|
16
16
|
import { type DialogApi, useOptionalDialog } from "../../../ui/dialog";
|
|
17
17
|
import { promptCloudUpgrade } from "../../../account/upgrade-dialog";
|
|
18
|
+
import { isAuthDialogOpen, requestAuthDialog } from "../../../account/auth-dialog";
|
|
18
19
|
import { type CheckoutHandoffTarget, promptCheckoutHandoff } from "../../../account/checkout-handoff";
|
|
19
20
|
|
|
20
21
|
const CLOUD_UPGRADE_URL = "https://gloom.sh/cloud?upgrade=pro";
|
|
@@ -195,8 +196,14 @@ function isCloudUpgradeOptions(value: unknown): value is CloudUpgradeOptions {
|
|
|
195
196
|
*
|
|
196
197
|
* A signed-in account without Pro sees the upgrade sheet first (what Pro adds,
|
|
197
198
|
* what today costs), and checkout opens only once they choose to go on, with
|
|
198
|
-
* the checkout hand-off over the app until Pro arrives. Signed
|
|
199
|
-
*
|
|
199
|
+
* the checkout hand-off over the app until Pro arrives. Signed out, the
|
|
200
|
+
* sign-up dialog opens first, as the UPGRADE command's does, and the upgrade
|
|
201
|
+
* goes on once signed in, to the sheet for an account without Pro and to
|
|
202
|
+
* nothing for one that has it: the Cloud page it opened before left a
|
|
203
|
+
* terminal over SSH with no browser looking as if `$` did nothing. A press
|
|
204
|
+
* while the dialog is up does nothing. Only with no dialog host (an isolated
|
|
205
|
+
* render) does it open the public Cloud page. Pro accounts get the billing
|
|
206
|
+
* portal.
|
|
200
207
|
*/
|
|
201
208
|
export function useCloudUpgradeAction(placement: string): (options?: unknown) => Promise<void> {
|
|
202
209
|
const rendererHost = useRendererHost();
|
|
@@ -227,6 +234,20 @@ export function useCloudUpgradeAction(placement: string): (options?: unknown) =>
|
|
|
227
234
|
})
|
|
228
235
|
)).catch(logFailure("shared.cloud-upgrade", "Open Cloud upgrade page failed"));
|
|
229
236
|
};
|
|
237
|
+
if (checkout.sheet !== false && !apiClient.isSignedIn()) {
|
|
238
|
+
// A press while the sign-up dialog is up asks for nothing new, and counts nothing.
|
|
239
|
+
if (isAuthDialogOpen()) return;
|
|
240
|
+
// Counted once, on this press: the upgrade that goes on after sign-up does not count it again. An account that
|
|
241
|
+
// signs in with Pro already has what the press was for, so nothing more opens.
|
|
242
|
+
const continueSignedIn = () => {
|
|
243
|
+
if (resolvePlanAccess(apiClient.getCurrentUser()).hasProAccess) return;
|
|
244
|
+
void openUpgradeRef.current({ ...checkout, recordIntent: false });
|
|
245
|
+
};
|
|
246
|
+
if (requestAuthDialog({ mode: "signup", onSignedIn: continueSignedIn })) {
|
|
247
|
+
if (checkout.recordIntent !== false) recordUpgradeIntent(checkout.placement);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
230
251
|
if (
|
|
231
252
|
checkout.sheet === false ||
|
|
232
253
|
!dialog ||
|
|
@@ -236,7 +257,7 @@ export function useCloudUpgradeAction(placement: string): (options?: unknown) =>
|
|
|
236
257
|
await openCheckout(checkout);
|
|
237
258
|
return;
|
|
238
259
|
}
|
|
239
|
-
recordUpgradeIntent(checkout.placement);
|
|
260
|
+
if (checkout.recordIntent !== false) recordUpgradeIntent(checkout.placement);
|
|
240
261
|
// Checkout is opening or just opened: a second sheet would lead nowhere.
|
|
241
262
|
if (isCloudUpgradeBlocked("checkout")) return;
|
|
242
263
|
const interval = await promptCloudUpgrade(dialog, {
|
|
@@ -245,6 +266,9 @@ export function useCloudUpgradeAction(placement: string): (options?: unknown) =>
|
|
|
245
266
|
});
|
|
246
267
|
if (interval) await openCheckout({ ...checkout, interval, recordIntent: false });
|
|
247
268
|
}, [dialog, placement, rendererHost]);
|
|
269
|
+
// The sign-up dialog's continuation runs the newest action, after the sign-in re-rendered it.
|
|
270
|
+
const openUpgradeRef = useRef(openUpgrade);
|
|
271
|
+
openUpgradeRef.current = openUpgrade;
|
|
248
272
|
useEffect(() => {
|
|
249
273
|
cloudUpgradeOpeners.add(openUpgrade);
|
|
250
274
|
return () => {
|