@gloom-sh/terminal 0.20.18 → 0.20.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api-client/cot.ts +5 -6
- package/src/api-client/data.ts +11 -1
- package/src/api-client/index.ts +1 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app.tsx +4 -2
- package/src/architecture/floating-promise-allowlist.json +1 -1
- package/src/cli/commands/market.ts +53 -17
- package/src/cli/commands/ticker.ts +13 -6
- package/src/cli/context.ts +8 -0
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +204 -43
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +1 -1
- package/src/cli/help.ts +1 -1
- package/src/cli/history-rows.ts +2 -2
- package/src/cli/index.ts +1 -1
- package/src/cli/listing-arg.ts +87 -23
- package/src/cli/pane-functions/catalog-snapshot.json +17 -6
- package/src/cli/pane-functions/dom.ts +30 -2
- package/src/cli/pane-functions/freshness.ts +23 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +77 -10
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +3 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +10 -5
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +24 -10
- package/src/cli/pane-functions/screenshot-render.ts +21 -8
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +1 -1
- package/src/cli/result.ts +17 -0
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +5 -2
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +2 -2
- package/src/components/chart-table/layout.ts +5 -6
- package/src/components/command-bar/routes/root/runtime.ts +11 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +13 -5
- package/src/components/layout/pane/footer/model.ts +10 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- package/src/components/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- package/src/components/ui/data-table/opentui/index.tsx +7 -0
- package/src/components/ui/table-layout.ts +32 -1
- package/src/market-data/ah-pair.ts +19 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/market/change-basis.ts +9 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -0
- package/src/plugins/builtin/alerts/cli.ts +65 -18
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +60 -8
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-client.ts +1 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +5 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +14 -4
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +1 -1
- package/src/plugins/builtin/company-kpis/model.ts +21 -9
- package/src/plugins/builtin/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- package/src/plugins/builtin/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/headless.ts +10 -3
- package/src/plugins/builtin/earnings/history-table.ts +4 -2
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/index.tsx +4 -2
- package/src/plugins/builtin/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -8
- package/src/plugins/builtin/options-scenario/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -14
- package/src/plugins/builtin/research/event-model.ts +12 -6
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +32 -3
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +4 -3
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +11 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +61 -13
- package/src/plugins/builtin/volatility/pane.tsx +3 -3
- package/src/plugins/builtin/world-venue-map/headless.ts +4 -2
- package/src/plugins/builtin/world-venue-map/model.ts +6 -1
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- package/src/renderers/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- package/src/renderers/electrobun/view/http-fetch.ts +3 -2
- package/src/sources/gloomberb-cloud/index.ts +8 -6
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/history.ts +32 -6
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +39 -2
- package/src/time-series/types.ts +2 -1
- package/src/types/financials.ts +9 -1
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/ui/host.tsx +2 -0
- package/src/utils/exchange-announcements.ts +7 -2
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { apiClient } from "../../../api-client";
|
|
3
|
+
import type { CloudInsiderFilingStoriesResponse } from "../../../api-client";
|
|
4
|
+
import { shortStoryId } from "../../../news/story-id";
|
|
5
|
+
import { formatShortDate } from "../../../utils/datetime-format";
|
|
6
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
7
|
+
import { createTtlCache } from "../../../data/ttl-cache";
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* The stories that report a Form 4, as Gloom Cloud matches them: the filing's
|
|
11
|
+
* owner named in a story about its company's insiders trading, in the months
|
|
12
|
+
* after its trades, the filing among the ones the story's own page lists. What
|
|
13
|
+
* an INS or SEC row names to go from the filing to the news and back.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export interface FilingStory {
|
|
17
|
+
id: string;
|
|
18
|
+
headline: string;
|
|
19
|
+
/** When the story was first published, ISO. */
|
|
20
|
+
publishedAt: string;
|
|
21
|
+
publisher: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type StoriesClient = Pick<typeof apiClient, "getCloudInsiderFilingStories">;
|
|
25
|
+
|
|
26
|
+
const ACCESSION = /^\d{10}-\d{2}-\d{6}$/;
|
|
27
|
+
/** As many filings as Gloom Cloud reads in one request; a longer list is asked in several. */
|
|
28
|
+
const BATCH = 20;
|
|
29
|
+
/** A filing's stories, by accession, for a few minutes: an INS or SEC pane asks again as its rows redraw. */
|
|
30
|
+
const cache = createTtlCache<FilingStory[]>({ ttlMs: 5 * 60_000, maxEntries: 500 });
|
|
31
|
+
|
|
32
|
+
function storiesOf(item: CloudInsiderFilingStoriesResponse["items"][number]): FilingStory[] {
|
|
33
|
+
return (item.stories ?? []).flatMap((story) => (
|
|
34
|
+
story?.id && story.headline
|
|
35
|
+
? [{ id: story.id, headline: story.headline, publishedAt: story.firstPublishedAt, publisher: story.primaryPublisher ?? "" }]
|
|
36
|
+
: []
|
|
37
|
+
));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The stories reporting each filing, by accession number, from a short-lived
|
|
42
|
+
* cache where it has them. A filing Gloom Cloud could not be asked about is
|
|
43
|
+
* left out of the map: no stories said is not "none". A batch that fails (a
|
|
44
|
+
* server without the lookup, a session it refuses, a rate or capacity limit)
|
|
45
|
+
* ends the asking without an error: the batches answered before it are kept,
|
|
46
|
+
* and the rows that would have named stories name none.
|
|
47
|
+
*/
|
|
48
|
+
export async function loadFilingStories(
|
|
49
|
+
accessions: readonly string[],
|
|
50
|
+
client: StoriesClient = apiClient,
|
|
51
|
+
): Promise<Map<string, FilingStory[]>> {
|
|
52
|
+
const result = new Map<string, FilingStory[]>();
|
|
53
|
+
const wanted: string[] = [];
|
|
54
|
+
// Asked in batches, one request for a page of rows, so each accession is kept as its answer arrives.
|
|
55
|
+
for (const accession of new Set(accessions)) {
|
|
56
|
+
if (!ACCESSION.test(accession)) continue;
|
|
57
|
+
const hit = cache.peek(accession);
|
|
58
|
+
if (hit) result.set(accession, hit);
|
|
59
|
+
else wanted.push(accession);
|
|
60
|
+
}
|
|
61
|
+
for (let start = 0; start < wanted.length; start += BATCH) {
|
|
62
|
+
const batch = wanted.slice(start, start + BATCH);
|
|
63
|
+
let response: CloudInsiderFilingStoriesResponse;
|
|
64
|
+
try {
|
|
65
|
+
response = await client.getCloudInsiderFilingStories(batch);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
// The next batch would meet the same refusal: stop, keeping what was answered.
|
|
68
|
+
logFailure("insider.filing-stories", "Read the stories reporting filings failed")(error);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
for (const item of response.items ?? []) {
|
|
72
|
+
if (!batch.includes(item.accession)) continue;
|
|
73
|
+
const stories = storiesOf(item);
|
|
74
|
+
cache.set(item.accession, stories);
|
|
75
|
+
result.set(item.accession, stories);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The stories reporting one filing, read once it is open; none while they load or when they cannot be read. */
|
|
82
|
+
export function useFilingStories(accession: string | null | undefined): FilingStory[] {
|
|
83
|
+
const [state, setState] = useState<{ accession: string; stories: FilingStory[] } | null>(null);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!accession || !ACCESSION.test(accession)) return;
|
|
86
|
+
let active = true;
|
|
87
|
+
void loadFilingStories([accession])
|
|
88
|
+
.then((found) => {
|
|
89
|
+
if (active) setState({ accession, stories: found.get(accession) ?? [] });
|
|
90
|
+
})
|
|
91
|
+
.catch(logFailure("insider.filing-stories", "Read the stories reporting a filing failed"));
|
|
92
|
+
return () => { active = false; };
|
|
93
|
+
}, [accession]);
|
|
94
|
+
return state && state.accession === accession ? state.stories : [];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** `7 Oct 2026 · Quartz`: when and where a story was first published. */
|
|
98
|
+
export function filingStorySource(story: FilingStory): string {
|
|
99
|
+
const day = story.publishedAt ? formatShortDate(story.publishedAt, { utc: true, fallback: "" }) : "";
|
|
100
|
+
return [day, story.publisher].filter(Boolean).join(" · ");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A story as a report's note names it, with the id `fn story` opens it by:
|
|
105
|
+
* `Story 3224efb6 (7 Oct 2026 · Quartz): Q3 2026 insider stock sales: ...`.
|
|
106
|
+
*/
|
|
107
|
+
export function filingStoryNote(story: FilingStory): string {
|
|
108
|
+
const source = filingStorySource(story);
|
|
109
|
+
return `Story ${shortStoryId(story.id)}${source ? ` (${source})` : ""}: ${story.headline}`;
|
|
110
|
+
}
|
|
@@ -63,6 +63,8 @@ import { REPORT_ROWS } from "../shared/headless-options";
|
|
|
63
63
|
import { mapWithConcurrency } from "../../../utils/concurrency";
|
|
64
64
|
import { describeCollections, findNamedCollection, readWatchlistArgument, watchlistMemberSymbol } from "../../../portfolio/collection-name";
|
|
65
65
|
import type { FxHistoryClient } from "../../../market-data/fx-closes";
|
|
66
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
67
|
+
import { filingStoryNote, loadFilingStories, type FilingStory } from "./filing-stories";
|
|
66
68
|
|
|
67
69
|
const INSIDER_COLUMNS: HeadlessPaneColumn[] = [
|
|
68
70
|
{ key: "form", header: "Form" },
|
|
@@ -319,7 +321,7 @@ function signalQuery(options: HeadlessPaneLoadArgs["options"]): InsiderSignalsQu
|
|
|
319
321
|
/** What a Form 4/A says about itself, for its last row in the report. */
|
|
320
322
|
function amendmentNote(entry: ParsedInsiderFiling): string {
|
|
321
323
|
const original = entry.disclosure?.originalFilingDate;
|
|
322
|
-
return [original ? `Original filed ${original}` : "", ...buildInsiderDisclosureText(entry).split("\n")].filter(Boolean).join("\n");
|
|
324
|
+
return [original ? `Original filed ${original}` : "", ...buildInsiderDisclosureText(entry, { byLine: false }).split("\n")].filter(Boolean).join("\n");
|
|
323
325
|
}
|
|
324
326
|
|
|
325
327
|
export interface InsiderHeadlessDependencies {
|
|
@@ -333,6 +335,8 @@ export interface InsiderHeadlessDependencies {
|
|
|
333
335
|
args: HeadlessPaneLoadArgs,
|
|
334
336
|
ctx: HeadlessPaneContext,
|
|
335
337
|
): Promise<InsiderFilingsLoad>;
|
|
338
|
+
/** The stories reporting each filing, by accession number (Gloom Cloud's match); the report's API client unless a test stands in. */
|
|
339
|
+
loadFilingStories?(accessions: readonly string[], ctx: HeadlessPaneContext): Promise<Map<string, FilingStory[]>>;
|
|
336
340
|
}
|
|
337
341
|
|
|
338
342
|
const defaultDependencies: InsiderHeadlessDependencies = {
|
|
@@ -351,8 +355,38 @@ const defaultDependencies: InsiderHeadlessDependencies = {
|
|
|
351
355
|
limit,
|
|
352
356
|
signal: ctx.signal,
|
|
353
357
|
}),
|
|
358
|
+
loadFilingStories: (accessions, ctx) => loadFilingStories(accessions, ctx.apiClient),
|
|
354
359
|
};
|
|
355
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Each filing's rows with the stories that report it (`stories`, on every row
|
|
363
|
+
* of the filing), and their notes under the filing's last row after any
|
|
364
|
+
* amendment's: back from the Form 4 to the news, `fn story <id>` opening one.
|
|
365
|
+
* A filing Gloom Cloud could not be asked about keeps its rows as they were,
|
|
366
|
+
* and the report says nothing of it: the stories are a lead, not its data.
|
|
367
|
+
*/
|
|
368
|
+
async function withFilingStories(
|
|
369
|
+
rows: HeadlessPaneRow[],
|
|
370
|
+
ctx: HeadlessPaneContext,
|
|
371
|
+
dependencies: InsiderHeadlessDependencies,
|
|
372
|
+
): Promise<HeadlessPaneRow[]> {
|
|
373
|
+
const accessions = [...new Set(rows.map((row) => row.accessionNumber).filter((value): value is string => typeof value === "string"))];
|
|
374
|
+
const load = dependencies.loadFilingStories;
|
|
375
|
+
if (!load || accessions.length === 0) return rows;
|
|
376
|
+
const found = await load(accessions, ctx).catch(logFailure("insider.headless", "Read the stories reporting filings failed", new Map<string, FilingStory[]>()));
|
|
377
|
+
return rows.map((row, index) => {
|
|
378
|
+
const stories = typeof row.accessionNumber === "string" ? found.get(row.accessionNumber) : undefined;
|
|
379
|
+
if (!stories) return row;
|
|
380
|
+
const last = rows[index + 1]?.accessionNumber !== row.accessionNumber;
|
|
381
|
+
const notes = last ? [typeof row.note === "string" ? row.note : "", ...stories.map(filingStoryNote)].filter(Boolean) : [];
|
|
382
|
+
return {
|
|
383
|
+
...row,
|
|
384
|
+
stories: stories.map((story) => ({ ...story })),
|
|
385
|
+
...(last && notes.length ? { note: notes.join("\n") } : {}),
|
|
386
|
+
};
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
|
|
356
390
|
/**
|
|
357
391
|
* "CAR Group (ASX) files no SEC reports." for a listing abroad the SEC lists
|
|
358
392
|
* nothing for, as `filings` says it; null for a US listing or a symbol with no
|
|
@@ -417,11 +451,12 @@ async function readTickerTrades(
|
|
|
417
451
|
.filter((row) => row.status !== "parsed" && row.status !== "disclosure")
|
|
418
452
|
.map((row) => row.accessionNumber))];
|
|
419
453
|
// A filing's lines sit together, so its note goes once, under the last of them.
|
|
420
|
-
const
|
|
454
|
+
const built: HeadlessPaneRow[] = buildInsiderRows(filtered, parsed).map((row, index) => {
|
|
421
455
|
const entry = filtered[index]!;
|
|
422
456
|
const last = filtered[index + 1]?.filing.accessionNumber !== entry.filing.accessionNumber;
|
|
423
457
|
return isAmendedInsiderFiling(entry) && last ? { ...row, note: amendmentNote(entry) || null } : row;
|
|
424
458
|
});
|
|
459
|
+
const rows = await withFilingStories(built, ctx, dependencies);
|
|
425
460
|
return {
|
|
426
461
|
rows,
|
|
427
462
|
empty,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { instrumentFromTicker } from "../../../market-data/request-types";
|
|
15
15
|
import { Box, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
|
|
16
16
|
import {
|
|
17
|
+
ChoiceDialog,
|
|
17
18
|
DataTableStackView,
|
|
18
19
|
EmptyState,
|
|
19
20
|
PaneLinkMenu,
|
|
@@ -29,7 +30,7 @@ import {
|
|
|
29
30
|
type StackSortPreference,
|
|
30
31
|
type StatItem,
|
|
31
32
|
} from "../../../components";
|
|
32
|
-
import { useDebouncedPluginPaneState, usePluginPaneState } from "../../runtime";
|
|
33
|
+
import { useDebouncedPluginPaneState, usePluginAppActions, usePluginPaneState } from "../../runtime";
|
|
33
34
|
import { homeInsiderReportsNote, mayBeSecEquityListing, mayBeUsEquityTicker, noSecReportsNotice, nonUsSecListingVenue } from "../../../utils/sec";
|
|
34
35
|
import { parsePublicTickerKey } from "../../../utils/exchanges";
|
|
35
36
|
import { formatCompact } from "../../../utils/format";
|
|
@@ -71,6 +72,9 @@ import {
|
|
|
71
72
|
} from "./table-model";
|
|
72
73
|
import { renderInsiderCell } from "./table";
|
|
73
74
|
import { InsiderDetail, insiderDetailTitle } from "./detail";
|
|
75
|
+
import { useFilingStories, type FilingStory } from "./filing-stories";
|
|
76
|
+
import { useOptionalDialog, type PromptContext } from "../../../ui/dialog";
|
|
77
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
74
78
|
import { InsiderActivityView, type InsiderViewControl } from "./insiders";
|
|
75
79
|
import { InsiderSignalsView, type InsiderOpenedCompany } from "./signals";
|
|
76
80
|
import { InsiderTickersView } from "./tickers";
|
|
@@ -114,17 +118,27 @@ const TYPE_FILTER_LABELS: Record<InsiderTypeFilter, string> = {
|
|
|
114
118
|
other: "Other",
|
|
115
119
|
};
|
|
116
120
|
|
|
121
|
+
/** `21 Aug`, with the year when it is not this one's. */
|
|
122
|
+
function windowDay(day: string, now = Date.now()): string {
|
|
123
|
+
const sameYear = day.slice(0, 4) === new Date(now).toISOString().slice(0, 4);
|
|
124
|
+
return formatShortDate(`${day}T00:00:00Z`, { utc: true, year: sameYear ? false : "numeric" });
|
|
125
|
+
}
|
|
126
|
+
|
|
117
127
|
/**
|
|
118
128
|
* The 90-day buy and sale totals as figures: one cell per side, and per
|
|
119
|
-
* security when there are several.
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* the
|
|
129
|
+
* security when there are several. The last cell says once, for the band,
|
|
130
|
+
* what they count: trades dated since the window's first day (by trade date,
|
|
131
|
+
* not filing date) in the filings loaded, which a narrow pane gives up before
|
|
132
|
+
* the figures, the 90 days staying in the labels. A side with no trades shows
|
|
133
|
+
* 0 shares, muted. Buys read in the gain colour and sales in the loss colour,
|
|
134
|
+
* as in the table; when the Type filter hides open-market trades the figures
|
|
135
|
+
* dim and say so. With `currency` the dollars read with its code (1.2M USD),
|
|
136
|
+
* as the table's CCY column names them.
|
|
124
137
|
*/
|
|
125
138
|
function summaryItems(figures: InsiderSummaryFigures, typeFilter: InsiderTypeFilter, currency?: string): StatItem[] {
|
|
126
139
|
const securities = new Set(figures.totals.map((total) => total.security));
|
|
127
140
|
const hidden = typeFilter === "other";
|
|
141
|
+
const since = windowDay(figures.window.from);
|
|
128
142
|
const items: StatItem[] = [];
|
|
129
143
|
for (const side of ["P", "S"] as const) {
|
|
130
144
|
const label = side === "P" ? "90d buys" : "90d sales";
|
|
@@ -145,6 +159,16 @@ function summaryItems(figures: InsiderSummaryFigures, typeFilter: InsiderTypeFil
|
|
|
145
159
|
});
|
|
146
160
|
}
|
|
147
161
|
}
|
|
162
|
+
// Once, after the last figure: the trade dates counted, and that they are the loaded filings' trades.
|
|
163
|
+
const last = items.at(-1);
|
|
164
|
+
if (last) {
|
|
165
|
+
const detail = last.detail ?? "";
|
|
166
|
+
const window = `trades since ${since}`;
|
|
167
|
+
const coverage = `${window}, ${figures.filings} ${figures.filings === 1 ? "filing" : "filings"} loaded`;
|
|
168
|
+
const join = (...parts: string[]) => parts.filter(Boolean).join(" \u00b7 ");
|
|
169
|
+
// Narrower, the window keeps its first day longest: what "90d" is from.
|
|
170
|
+
items[items.length - 1] = { ...last, detail: join(detail, coverage), detailVariants: [join(detail, window), join(detail, `since ${since}`), detail] };
|
|
171
|
+
}
|
|
148
172
|
return items;
|
|
149
173
|
}
|
|
150
174
|
|
|
@@ -183,7 +207,8 @@ const freshTradesState = (tickerKey: string, insider: string | null = null): Sta
|
|
|
183
207
|
*/
|
|
184
208
|
function useInsiderTradesState(tickerKey: string, stacked: boolean, insider: string | null = null): InsiderTradesState {
|
|
185
209
|
const [paneSelectedId, setPaneSelectedId] = usePluginPaneState<string | null>(`insider:selectedId:${tickerKey}`, null);
|
|
186
|
-
|
|
210
|
+
// A pane opened on an insider (a story's filings) starts filtered to them, as one opened from the ranking does.
|
|
211
|
+
const [paneNameFilter, setPaneNameFilter] = usePluginPaneState<string | null>(`insider:nameFilter:${tickerKey}`, insider);
|
|
187
212
|
const [paneTypeFilter, setPaneTypeFilter] = usePluginPaneState<InsiderTypeFilter>("insider:typeFilter", DEFAULT_INSIDER_TYPE_FILTER);
|
|
188
213
|
const [paneOpenItemId, setPaneOpenItemIdState] = useDebouncedPluginPaneState<string | null>(`insider:openItemId:${tickerKey}`, null);
|
|
189
214
|
const setPaneOpenItemId = useCallback(
|
|
@@ -425,6 +450,34 @@ function InsiderTradesView({ ticker, viewBar, state, width, height, focused, sta
|
|
|
425
450
|
};
|
|
426
451
|
const handleFilterPress = useCallback(() => filterActionRef.current(), []);
|
|
427
452
|
|
|
453
|
+
// The stories that report the open transaction's filing: back from the Form 4 to the news about it.
|
|
454
|
+
const openStories = useFilingStories(openRow && !openRow.entry.isLoading ? openRow.entry.filing.accessionNumber : null);
|
|
455
|
+
const { createPaneFromTemplate } = usePluginAppActions();
|
|
456
|
+
const dialog = useOptionalDialog();
|
|
457
|
+
const openStory = useCallback((story: FilingStory) => {
|
|
458
|
+
createPaneFromTemplate("news-story-pane", { arg: story.id, values: { title: story.headline } });
|
|
459
|
+
}, [createPaneFromTemplate]);
|
|
460
|
+
const chooseStory = useCallback(() => {
|
|
461
|
+
if (openStories.length === 1) {
|
|
462
|
+
openStory(openStories[0]!);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
if (!dialog || openStories.length === 0) return;
|
|
466
|
+
void dialog.prompt<string>({
|
|
467
|
+
closeOnClickOutside: true,
|
|
468
|
+
content: (ctx: PromptContext<string>) => (
|
|
469
|
+
<ChoiceDialog
|
|
470
|
+
{...ctx}
|
|
471
|
+
title="Stories"
|
|
472
|
+
choices={openStories.map((story, index) => ({ id: String(index), label: story.headline, detail: story.publisher }))}
|
|
473
|
+
/>
|
|
474
|
+
),
|
|
475
|
+
}).then((choice) => {
|
|
476
|
+
const story = choice ? openStories[Number(choice)] : undefined;
|
|
477
|
+
if (story) openStory(story);
|
|
478
|
+
}).catch(logFailure("insider.detail", "Choose a story reporting the filing failed"));
|
|
479
|
+
}, [dialog, openStories, openStory]);
|
|
480
|
+
|
|
428
481
|
// Reading on: the next or previous row opens in place, and the cursor
|
|
429
482
|
// follows it so Back lands on the last one read.
|
|
430
483
|
const openIndex = openRow ? sortedRows.findIndex((row) => row.id === openRow.id) : -1;
|
|
@@ -440,8 +493,9 @@ function InsiderTradesView({ ticker, viewBar, state, width, height, focused, sta
|
|
|
440
493
|
hints: [
|
|
441
494
|
{ id: "insider-next", key: "n", label: "ext", title: "Next Transaction", disabled: openIndex >= sortedRows.length - 1, onPress: () => openAdjacent(1) },
|
|
442
495
|
{ id: "insider-previous", key: "p", label: "rev", title: "Previous Transaction", disabled: openIndex <= 0, onPress: () => openAdjacent(-1) },
|
|
496
|
+
...(openStories.length > 0 ? [{ id: "insider-story", key: "s", label: "tory", title: "Open Story", onPress: chooseStory }] : []),
|
|
443
497
|
],
|
|
444
|
-
} : null), [focused, openAdjacent, openIndex, sortedRows.length]);
|
|
498
|
+
} : null), [chooseStory, focused, openAdjacent, openIndex, openStories.length, sortedRows.length]);
|
|
445
499
|
|
|
446
500
|
const pendingLabel = pendingCount > 0 ? `loading ${pendingCount}...` : "";
|
|
447
501
|
const footerInfo = useMemo(() => [
|
|
@@ -519,7 +573,9 @@ function InsiderTradesView({ ticker, viewBar, state, width, height, focused, sta
|
|
|
519
573
|
onBack={() => setOpenItemId(null)}
|
|
520
574
|
detailTitle={openRow ? insiderDetailTitle(openRow) : undefined}
|
|
521
575
|
detailScrollRef={detailScrollRef}
|
|
522
|
-
detailContent={openRow
|
|
576
|
+
detailContent={openRow
|
|
577
|
+
? <PaneLinkMenu><InsiderDetail row={openRow} width={width} scrollRef={detailScrollRef} stories={openStories} onOpenStory={openStory} /></PaneLinkMenu>
|
|
578
|
+
: <Box flexGrow={1} />}
|
|
523
579
|
selection={{
|
|
524
580
|
kind: "index",
|
|
525
581
|
selectedIndex: sortedRows.length > 0 ? selectedRowIndex : null,
|
|
@@ -720,9 +776,16 @@ function insiderPaneSymbols(settings: Record<string, unknown> | undefined): stri
|
|
|
720
776
|
* selling. A ranked company opens here as INS on its ticker, and Back
|
|
721
777
|
* returns to the ranking.
|
|
722
778
|
*/
|
|
779
|
+
/** The insider a pane was opened on (`settings.insider`, as filed), whose trades it starts filtered to. */
|
|
780
|
+
function insiderPaneInsider(settings: Record<string, unknown> | undefined): string | undefined {
|
|
781
|
+
const insider = settings?.insider;
|
|
782
|
+
return typeof insider === "string" && insider.trim() ? insider.trim() : undefined;
|
|
783
|
+
}
|
|
784
|
+
|
|
723
785
|
function InsiderPane({ width, height, focused }: PaneProps) {
|
|
724
786
|
const { symbol: paneSymbol } = usePaneTickerIdentity();
|
|
725
787
|
const instance = usePaneInstance();
|
|
788
|
+
const openedInsider = insiderPaneInsider(instance?.settings);
|
|
726
789
|
// One list per set of tickers, so the views' loads do not start again on every render.
|
|
727
790
|
const symbolsKey = insiderPaneSymbols(instance?.settings).join(",");
|
|
728
791
|
const symbols = useMemo(() => (symbolsKey ? symbolsKey.split(",") : []), [symbolsKey]);
|
|
@@ -737,7 +800,7 @@ function InsiderPane({ width, height, focused }: PaneProps) {
|
|
|
737
800
|
if (!paneSymbol && instance?.binding?.kind !== "follow") {
|
|
738
801
|
return <InsiderSignalsView width={width} height={height} focused={focused} renderCompany={renderRankedCompany} />;
|
|
739
802
|
}
|
|
740
|
-
return <InsiderView width={width} height={height} focused={focused} />;
|
|
803
|
+
return <InsiderView width={width} height={height} focused={focused} {...(openedInsider ? { insider: openedInsider } : {})} />;
|
|
741
804
|
}
|
|
742
805
|
|
|
743
806
|
const tickerTemplate = createTickerSurfacePaneTemplate({
|
|
@@ -750,6 +813,12 @@ const tickerTemplate = createTickerSurfacePaneTemplate({
|
|
|
750
813
|
canCreate: (_context, options) => !options?.ticker || mayBeSecEquityListing(options.ticker),
|
|
751
814
|
// Typed alone with no active ticker it ranks the market's insider buying or selling.
|
|
752
815
|
withoutTickerTitle: INSIDER_SIGNALS_TITLE,
|
|
816
|
+
// Opened on one insider (a story's filings, `values.insider` as filed): a window of its own, filtered to them.
|
|
817
|
+
settings: (_symbol, _context, options) => {
|
|
818
|
+
const insider = options?.values?.insider?.trim();
|
|
819
|
+
return insider ? { insider } : undefined;
|
|
820
|
+
},
|
|
821
|
+
viewKey: (_symbol, _context, options) => options?.values?.insider?.trim() || undefined,
|
|
753
822
|
});
|
|
754
823
|
|
|
755
824
|
/**
|
|
@@ -94,12 +94,29 @@ export function matchesInsiderTypeFilter(entry: ParsedInsiderFiling, filter: Ins
|
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
/** Heads the footnotes a transaction's own line does not cite, under the ones it does. */
|
|
98
|
+
export const OTHER_FILING_NOTES_LABEL = "Other notes on this filing";
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* A row's remarks and footnotes: the notes its own line cites first, in the
|
|
102
|
+
* order it cites them (a sale's weighted-average range and its 10b5-1 plan),
|
|
103
|
+
* then the filing's remarks, then the notes on its other lines under their own
|
|
104
|
+
* heading, so a sale never reads the tax withholding's note above its own.
|
|
105
|
+
*/
|
|
106
|
+
export function buildInsiderDisclosureText(entry: ParsedInsiderFiling, { byLine = true }: { byLine?: boolean } = {}): string {
|
|
98
107
|
const disclosure = entry.disclosure;
|
|
99
108
|
if (!disclosure) return "";
|
|
109
|
+
const byId = new Map(disclosure.footnotes.map((note) => [note.id, note]));
|
|
110
|
+
// `byLine: false` reads the filing as a whole (a 4/A's note under its rows): its remarks, then every note in order.
|
|
111
|
+
const own = byLine ? (entry.transaction?.footnoteIds ?? []).flatMap((id) => byId.get(id) ?? []) : [];
|
|
112
|
+
const ownIds = new Set(own.map((note) => note.id));
|
|
113
|
+
const others = disclosure.footnotes.filter((note) => !ownIds.has(note.id));
|
|
114
|
+
const line = (note: { id: string; text: string }) => `${note.id}: ${note.text}`;
|
|
100
115
|
return [
|
|
116
|
+
...own.map(line),
|
|
101
117
|
disclosure.remarks ? `Remarks: ${disclosure.remarks}` : "",
|
|
102
|
-
...
|
|
118
|
+
...(own.length > 0 && others.length > 0 ? [OTHER_FILING_NOTES_LABEL] : []),
|
|
119
|
+
...others.map(line),
|
|
103
120
|
].filter(Boolean).join("\n\n");
|
|
104
121
|
}
|
|
105
122
|
|
|
@@ -116,6 +133,13 @@ export interface InsiderSummaryFigures {
|
|
|
116
133
|
totals: InsiderSideTotal[];
|
|
117
134
|
/** Some loaded filings could not be read into complete transactions. */
|
|
118
135
|
incomplete: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* The trade dates the totals count, as UTC days (YYYY-MM-DD): from the first
|
|
138
|
+
* day inside the 90 days to today. A total is by trade date, not filing date.
|
|
139
|
+
*/
|
|
140
|
+
window: { from: string; to: string };
|
|
141
|
+
/** The loaded filings the totals were read from, each counted once. */
|
|
142
|
+
filings: number;
|
|
119
143
|
}
|
|
120
144
|
|
|
121
145
|
/** Words a filer adds or leaves out without naming another class: "Common Stock" and "Common" are one. */
|
|
@@ -146,7 +170,7 @@ export function buildInsiderSummaryFigures(parsed: readonly ParsedInsiderFiling[
|
|
|
146
170
|
if (isInsiderDisclosureOnly(entry)) return false;
|
|
147
171
|
return !transaction?.filingDate || transaction.shares == null || !transaction.transactionType || !transaction.securityTitle;
|
|
148
172
|
});
|
|
149
|
-
const cutoff = now
|
|
173
|
+
const cutoff = insiderSummaryCutoff(now);
|
|
150
174
|
const totals = new Map<string, InsiderSideTotal>();
|
|
151
175
|
// Shares under each spelling of a class, so a total is named the way most of its shares were filed.
|
|
152
176
|
const spellings = new Map<string, Map<string, number>>();
|
|
@@ -172,7 +196,8 @@ export function buildInsiderSummaryFigures(parsed: readonly ParsedInsiderFiling[
|
|
|
172
196
|
const filed = [...spellings.get(key)!];
|
|
173
197
|
total.security = filed.reduce((best, entry) => (entry[1] > best[1] ? entry : best), filed[0]!)[0];
|
|
174
198
|
}
|
|
175
|
-
|
|
199
|
+
const filings = new Set(parsed.map(({ filing }) => filing.accessionNumber)).size;
|
|
200
|
+
return { totals: [...totals.values()], incomplete, window: insiderSummaryWindow(now), filings };
|
|
176
201
|
}
|
|
177
202
|
|
|
178
203
|
/** The oldest filing date that the 90-day totals need loaded before they cover the whole window. */
|
|
@@ -180,11 +205,24 @@ export function insiderSummaryCutoff(now = Date.now()): number {
|
|
|
180
205
|
return now - NINETY_DAYS_MS;
|
|
181
206
|
}
|
|
182
207
|
|
|
208
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* The trade dates the 90-day totals count, as UTC days: a trade is dated to
|
|
212
|
+
* its day's midnight, so the first day counted is the first whose midnight is
|
|
213
|
+
* inside the window, and the last is today.
|
|
214
|
+
*/
|
|
215
|
+
function insiderSummaryWindow(now = Date.now()): { from: string; to: string } {
|
|
216
|
+
const first = Math.ceil(insiderSummaryCutoff(now) / DAY_MS) * DAY_MS;
|
|
217
|
+
return { from: new Date(first).toISOString().slice(0, 10), to: new Date(now).toISOString().slice(0, 10) };
|
|
218
|
+
}
|
|
219
|
+
|
|
183
220
|
/** Summarize only loaded non-derivative buys/sales, grouped by security. */
|
|
184
221
|
export function buildInsiderSummary(parsed: ParsedInsiderFiling[], now = Date.now(), context: readonly ParsedInsiderFiling[] = parsed): string | null {
|
|
185
222
|
const figures = buildInsiderSummaryFigures(parsed, now, context);
|
|
186
223
|
if (!figures) return null;
|
|
187
|
-
|
|
224
|
+
// What the totals count, said before them: the filings read, and the trade dates, not the filing dates.
|
|
225
|
+
const prefix = `${figures.filings} loaded ${figures.filings === 1 ? "filing" : "filings"}, trades dated ${figures.window.from} to ${figures.window.to}: `;
|
|
188
226
|
const coverage = figures.incomplete ? " | Some transactions unavailable or incomplete." : "";
|
|
189
227
|
if (figures.totals.length === 0) return `${prefix}no parsed non-derivative buys/sales.${coverage}`;
|
|
190
228
|
return prefix + figures.totals.map((total) => total.unreconciled
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { apiClient } from "../../../api-client";
|
|
2
|
+
import { ApiRequestError, isTransientFailure } from "../../../api-client/errors";
|
|
2
3
|
import type { IpoCalendarParams, IpoCalendarPayload, IpoDeal, IpoLockup, IpoSourceHealth } from "../../../api-client/ipo";
|
|
3
4
|
import type { HeadlessPaneApiClient } from "../../../types/plugin";
|
|
4
5
|
import { createPluginCache } from "../../../data/plugin-cache";
|
|
6
|
+
import { signalWithTimeout } from "../../../utils/async-deadline";
|
|
5
7
|
import { cachedCloudResource, loadCloudResource, unavailableOnServer, type CloudResource } from "../shared/cloud-resource";
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -88,8 +90,16 @@ export async function fetchIpoCalendar(
|
|
|
88
90
|
signal?: AbortSignal,
|
|
89
91
|
params: IpoCalendarParams = {},
|
|
90
92
|
): Promise<IpoCalendarPayload> {
|
|
93
|
+
const requestSignal = signalWithTimeout(signal, 30_000);
|
|
94
|
+
const read = () => client.getCloudIpoCalendar(params, { signal: requestSignal });
|
|
91
95
|
try {
|
|
92
|
-
|
|
96
|
+
requestSignal.throwIfAborted();
|
|
97
|
+
const data = await read().catch((error: unknown) => {
|
|
98
|
+
if (requestSignal.aborted || !isTransientFailure(error)
|
|
99
|
+
|| (error instanceof ApiRequestError && (error.retryAfterMs ?? 0) > 0)) throw error;
|
|
100
|
+
return read();
|
|
101
|
+
});
|
|
102
|
+
return validateIpoCalendar(data);
|
|
93
103
|
} catch (error) {
|
|
94
104
|
// The route answers 503 until its first pass has run.
|
|
95
105
|
throw unavailableOnServer(error, UNAVAILABLE, [404, 503]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IpoDeal, IpoRegion, IpoSourceHealth, IpoStatus } from "../../../api-client/ipo";
|
|
2
2
|
import type { DataTableColumn } from "../../../components";
|
|
3
|
-
import { getTableWidth } from "../../../components/ui/table-layout";
|
|
3
|
+
import { dropColumnsToFit, getTableWidth } from "../../../components/ui/table-layout";
|
|
4
4
|
import { publicTickerKey } from "../../../utils/exchanges";
|
|
5
5
|
import { MISSING_VALUE, displayWidth, formatCompact } from "../../../utils/format";
|
|
6
6
|
import { compareSortValues, type SortPreference } from "../../../utils/sort-values";
|
|
@@ -358,12 +358,8 @@ export function marketColumnWidth(deals: readonly IpoDeal[]): number {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
export function buildIpoColumns(width: number, marketWidth = 10): IpoColumn[] {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
if (ipoTableWidth(columns) <= width) break;
|
|
364
|
-
columns = columns.filter((column) => column.id !== id);
|
|
365
|
-
}
|
|
366
|
-
return columns;
|
|
361
|
+
const columns = IPO_COLUMNS.map((column) => (column.id === "market" ? { ...column, width: marketWidth } : column));
|
|
362
|
+
return dropColumnsToFit(columns, width - 1, NARROW_DROP_ORDER);
|
|
367
363
|
}
|
|
368
364
|
|
|
369
365
|
/**
|
|
@@ -14,12 +14,13 @@ import {
|
|
|
14
14
|
formatSalaryRange,
|
|
15
15
|
formatShare,
|
|
16
16
|
functionLabel,
|
|
17
|
+
pendingJobsTitle,
|
|
17
18
|
} from "./model";
|
|
18
19
|
|
|
19
20
|
function companyBundle(symbol: string, state: Exclude<JobsCompanyState, { kind: "denied" }>, roleLimit: number): HeadlessBundleResult {
|
|
20
21
|
if (state.kind === "pending") {
|
|
21
22
|
return {
|
|
22
|
-
sections: [{ title: "Hiring", entries: [{ label: "Status", value: "pending", formatted:
|
|
23
|
+
sections: [{ title: "Hiring", entries: [{ label: "Status", value: "pending", formatted: `${pendingJobsTitle(symbol)} A first read usually lands within a few minutes; ask again then.` }] }],
|
|
23
24
|
metadata: { symbol, status: "pending" },
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -51,6 +51,12 @@ const SENIORITY_SHORT: Record<string, string> = {
|
|
|
51
51
|
executive: "Exec",
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
/** What JOBS says while the server looks for a company's careers system: a first read takes minutes, not a load. */
|
|
55
|
+
export function pendingJobsTitle(symbol: string): string {
|
|
56
|
+
return `Looking for ${symbol}'s careers system.`;
|
|
57
|
+
}
|
|
58
|
+
export const PENDING_JOBS_MESSAGE = "Roles show here once it is read, usually within a few minutes. This pane checks again on its own.";
|
|
59
|
+
|
|
54
60
|
export function functionLabel(id: string | null | undefined): string {
|
|
55
61
|
if (!id) return "Unclassified";
|
|
56
62
|
return FUNCTION_LABELS[id] ?? id;
|
|
@@ -47,6 +47,8 @@ import {
|
|
|
47
47
|
buildMoverColumns,
|
|
48
48
|
buildMoverRows,
|
|
49
49
|
buildPostingColumns,
|
|
50
|
+
PENDING_JOBS_MESSAGE,
|
|
51
|
+
pendingJobsTitle,
|
|
50
52
|
buildPostingRows,
|
|
51
53
|
buildShareBars,
|
|
52
54
|
changeTone,
|
|
@@ -562,11 +564,14 @@ function CompanyPanel({
|
|
|
562
564
|
}
|
|
563
565
|
if (!data) return null;
|
|
564
566
|
if (data.kind === "pending") {
|
|
567
|
+
// An answer, not a load: the server is looking, which takes minutes, so the pane says so at once and fills in
|
|
568
|
+
// when the poll above brings the roles. A spinner here stood for minutes and read as a pane that never loaded.
|
|
565
569
|
return (
|
|
566
570
|
<PaneStatusBody
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
571
|
+
empty
|
|
572
|
+
emptyTitle={pendingJobsTitle(symbol)}
|
|
573
|
+
emptyMessage={PENDING_JOBS_MESSAGE}
|
|
574
|
+
retry={{ onRetry: reloadAndWait, pending: loading, label: "Check now", pendingLabel: "Checking...", unchanged: "Still looking." }}
|
|
570
575
|
/>
|
|
571
576
|
);
|
|
572
577
|
}
|