@gloom-sh/terminal 0.20.14 → 0.20.16
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/index.ts +54 -0
- package/src/api-client/install-experiments.ts +8 -7
- package/src/api-client/paths.ts +2 -1
- package/src/api-client/product-waitlist.ts +63 -0
- package/src/api-client/request.ts +4 -2
- package/src/api-client/types/billing.ts +45 -0
- package/src/api-client/yearly-plan.ts +132 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/plugin-bindings.ts +3 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
- package/src/app/since-last-visit/keys.ts +26 -0
- package/src/app/since-last-visit/model.ts +266 -0
- package/src/app/since-last-visit/strip.tsx +193 -0
- package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
- package/src/app/since-last-visit/visit-tracker.ts +191 -0
- package/src/app.tsx +15 -0
- package/src/cli/commands/market.ts +8 -4
- package/src/cli/commands/system.ts +29 -1
- package/src/cli/commands/ticker.ts +12 -5
- package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
- package/src/cli/desktop-pane-shot-browser.ts +2 -1
- package/src/cli/desktop-pane-shot-view.ts +3 -7
- package/src/cli/desktop-pane-shot.ts +26 -28
- package/src/cli/help.ts +1 -0
- package/src/cli/history-rows.ts +24 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/options.ts +29 -1
- package/src/cli/pane-functions/catalog.ts +41 -4
- package/src/cli/pane-functions/function-help.ts +1 -1
- package/src/cli/pane-functions/headless.ts +63 -1
- package/src/cli/pane-functions/index.ts +2 -2
- package/src/cli/pane-functions/resolver.ts +43 -0
- package/src/cli/pane-functions/screenshot-payload.ts +3 -0
- package/src/cli/report-tables.ts +20 -5
- package/src/cli/shot-temp-dir.ts +30 -0
- package/src/cli/suffixed-listing-rows.ts +11 -0
- package/src/components/chart/composite/composite-chart.tsx +3 -3
- package/src/components/command-bar/commands/direct/index.ts +31 -8
- package/src/components/command-bar/commands/registry.ts +7 -0
- package/src/components/command-bar/routes/root/command-items.ts +8 -0
- package/src/components/command-bar/routes/root/results.ts +16 -0
- package/src/components/company-logo.tsx +10 -3
- package/src/components/data-table/sections.ts +6 -1
- package/src/components/layout/pane/title.ts +6 -2
- package/src/components/layout/shell/index.tsx +5 -1
- package/src/components/layout/shell/ticker-link-menu.ts +12 -9
- package/src/components/ticker/badge/format.ts +12 -3
- package/src/components/ticker/badge/index.tsx +9 -3
- package/src/components/ticker/list-table-view.tsx +119 -17
- package/src/components/ui/data-table/display-columns.ts +16 -0
- package/src/components/ui/data-table/index.tsx +40 -9
- package/src/components/ui/data-table/types.ts +14 -0
- package/src/core/state/app/layout-reducer.ts +3 -1
- package/src/core/state/app/layout.ts +2 -2
- package/src/data/config/layout.ts +14 -0
- package/src/data/config/store/normalize.ts +11 -1
- package/src/i18n/es.ts +38 -0
- package/src/i18n/ja.ts +38 -0
- package/src/i18n/ko.ts +38 -0
- package/src/i18n/zh-cn.ts +38 -0
- package/src/i18n/zh-tw.ts +38 -0
- package/src/layout/pane-follow.ts +141 -4
- package/src/layout/pane-layout-move.ts +10 -7
- package/src/layout/ticker-navigation.ts +13 -19
- package/src/layout/ticker-retarget.ts +3 -2
- package/src/market-data/market/index-level.ts +19 -0
- package/src/plugins/builtin/account-management/keyboard.ts +14 -0
- package/src/plugins/builtin/account-management/model.ts +2 -0
- package/src/plugins/builtin/account-management/pane.tsx +79 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
- package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
- package/src/plugins/builtin/awards/pane.tsx +6 -8
- package/src/plugins/builtin/changelog/index.tsx +6 -44
- package/src/plugins/builtin/changelog/versions.ts +17 -68
- package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
- package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
- package/src/plugins/builtin/cpi/pane.tsx +1 -1
- package/src/plugins/builtin/debt-maturities/model.ts +1 -1
- package/src/plugins/builtin/earnings/board-table.ts +1 -1
- package/src/plugins/builtin/earnings/board.tsx +36 -16
- package/src/plugins/builtin/earnings/highlight.ts +47 -0
- package/src/plugins/builtin/earnings/history-table.ts +1 -1
- package/src/plugins/builtin/earnings/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
- package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
- package/src/plugins/builtin/exposure/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +6 -4
- package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
- package/src/plugins/builtin/market-valuation/headless.ts +11 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
- package/src/plugins/builtin/market-valuation/view.ts +14 -0
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
- package/src/plugins/builtin/pe-band/pane.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
- package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
- package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
- package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
- package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
- package/src/plugins/builtin/shared/headless-options.ts +1 -1
- package/src/plugins/builtin/social-mentions/model.ts +2 -2
- package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
- package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
- package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
- package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
- package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
- package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
- package/src/portfolio/column-values.ts +20 -8
- package/src/portfolio/suffixed-listings.ts +3 -1
- package/src/portfolio/watchlist-groups.ts +212 -0
- package/src/react/ticker-source.ts +3 -1
- package/src/renderers/dom/styles.css +7 -0
- package/src/state/app/bootstrap.ts +11 -0
- package/src/state/app/context/index.tsx +6 -0
- package/src/sync/collections-contributor.ts +5 -2
- package/src/sync/config-merge.ts +10 -2
- package/src/sync/sanitize.ts +28 -0
- package/src/telemetry/usage-counts.ts +17 -0
- package/src/time-series/chart-seed.ts +1 -1
- package/src/time-series/financial-period-coverage.ts +4 -12
- package/src/time-series/parsed-history-cache.ts +1 -1
- package/src/time-series/resolve.ts +1 -1
- package/src/time-series/use-chart-resolution.ts +6 -1
- package/src/types/config.ts +32 -0
- package/src/types/headless.ts +5 -0
- package/src/types/plugin-context.ts +5 -0
- package/src/types/ticker.ts +14 -0
- package/src/ui/ascii-font.ts +1 -4
- package/src/utils/async-deadline.ts +2 -2
- package/src/utils/csv.ts +44 -5
- package/src/utils/futures-generic.ts +3 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState, type RefObject } from "react";
|
|
2
|
-
import { Box, TextAttributes,
|
|
2
|
+
import { Box, TextAttributes, type ScrollBoxRenderable } from "../../../ui";
|
|
3
3
|
import { usePaneInstance } from "../../../state/app/context";
|
|
4
4
|
import {
|
|
5
5
|
DataTableStackView,
|
|
6
6
|
DataTableView,
|
|
7
|
-
MarkdownText,
|
|
8
7
|
PaneLinkMenu,
|
|
9
8
|
PaneStatusBody,
|
|
10
9
|
useExternalLinkFooter,
|
|
@@ -12,7 +11,6 @@ import {
|
|
|
12
11
|
type DataTableColumn,
|
|
13
12
|
} from "../../../components";
|
|
14
13
|
import { DetailReader } from "../../../components/reader/detail-reader";
|
|
15
|
-
import { DESKTOP_LINE_HEIGHT, READER_COLUMN_FONT, READER_MEASURE } from "../../../components/reader/reader-text";
|
|
16
14
|
import { loadingErrorFooterInfo, usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
17
15
|
import { getReleaseSummaries } from "../../../api-client/release-summaries";
|
|
18
16
|
import { createTtlCache } from "../../../data/ttl-cache";
|
|
@@ -38,7 +36,6 @@ import {
|
|
|
38
36
|
import {
|
|
39
37
|
DEFAULT_CHANGELOG_VERSION_SORT,
|
|
40
38
|
groupChangelogVersions,
|
|
41
|
-
highlightsMarkdown,
|
|
42
39
|
nextChangelogVersionSort,
|
|
43
40
|
parseVersionSummaries,
|
|
44
41
|
sortChangelogVersions,
|
|
@@ -76,7 +73,7 @@ export function resetChangelogCacheForTests(): void {
|
|
|
76
73
|
/**
|
|
77
74
|
* CHANGELOG.md from Gloom Cloud, which reads GitHub with its own credentials,
|
|
78
75
|
* else from GitHub itself; null when neither has it, and then each version
|
|
79
|
-
*
|
|
76
|
+
* takes its first update's title.
|
|
80
77
|
*/
|
|
81
78
|
async function readSummaries(signal: AbortSignal): Promise<string | null> {
|
|
82
79
|
try {
|
|
@@ -164,42 +161,9 @@ function ReleaseNotes({
|
|
|
164
161
|
);
|
|
165
162
|
}
|
|
166
163
|
|
|
167
|
-
/** The pane's inset around the highlights, as a detail reader has: 12px above, 16px below. */
|
|
168
|
-
const HIGHLIGHTS_BOX_STYLE = { padding: "var(--gloom-space-md) var(--gloom-inset) var(--gloom-space-lg)" } as const;
|
|
169
|
-
/** The reader's type and measure; markdown lines take the reader's line height (the host sets Text line height from --cell-h). */
|
|
170
|
-
const HIGHLIGHTS_COLUMN_STYLE = {
|
|
171
|
-
fontSize: READER_COLUMN_FONT,
|
|
172
|
-
lineHeight: DESKTOP_LINE_HEIGHT,
|
|
173
|
-
maxWidth: READER_MEASURE,
|
|
174
|
-
"--cell-h": `${DESKTOP_LINE_HEIGHT}em`,
|
|
175
|
-
} as const;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* A version's highlights above its updates. The desktop and the web set them
|
|
179
|
-
* in the reader's type at the reading measure, as the notes an update opens
|
|
180
|
-
* are, lined up with the table's left edge; the terminal wraps them at `width`.
|
|
181
|
-
*/
|
|
182
|
-
function VersionHighlights({ markdown, width }: { markdown: string; width: number }) {
|
|
183
|
-
const { nativePaneChrome } = useUiCapabilities();
|
|
184
|
-
if (nativePaneChrome) {
|
|
185
|
-
return (
|
|
186
|
-
<Box flexDirection="column" width="100%" flexShrink={0} style={HIGHLIGHTS_BOX_STYLE} data-gloom-ui="changelog-highlights">
|
|
187
|
-
<Box flexDirection="column" width="100%" style={HIGHLIGHTS_COLUMN_STYLE}>
|
|
188
|
-
<MarkdownText text={markdown} />
|
|
189
|
-
</Box>
|
|
190
|
-
</Box>
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
return (
|
|
194
|
-
<Box flexDirection="column" paddingX={1} paddingY={1} flexShrink={0}>
|
|
195
|
-
<MarkdownText text={markdown} lineWidth={Math.max(12, width - 2)} />
|
|
196
|
-
</Box>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
164
|
/**
|
|
201
|
-
* An open version: its
|
|
202
|
-
*
|
|
165
|
+
* An open version: the table of its updates, under the title the stack
|
|
166
|
+
* header already gives it. Enter opens an update's notes.
|
|
203
167
|
*/
|
|
204
168
|
function VersionDetail({
|
|
205
169
|
version,
|
|
@@ -227,12 +191,10 @@ function VersionDetail({
|
|
|
227
191
|
);
|
|
228
192
|
const selectedIndex = resolveSelectedReleaseIndex(releases, selectedReleaseId);
|
|
229
193
|
const columns = useMemo(() => buildReleaseColumns(version.releases), [version.releases]);
|
|
230
|
-
const highlights = useMemo(() => highlightsMarkdown(version), [version]);
|
|
231
194
|
|
|
232
195
|
return (
|
|
233
196
|
<DataTableView<ChangelogRelease, ReleaseColumn>
|
|
234
197
|
focused={focused}
|
|
235
|
-
rootBefore={highlights ? <VersionHighlights markdown={highlights} width={width} /> : undefined}
|
|
236
198
|
selection={{
|
|
237
199
|
kind: "id",
|
|
238
200
|
selectedId: releases[selectedIndex]?.id ?? null,
|
|
@@ -258,8 +220,8 @@ function VersionDetail({
|
|
|
258
220
|
|
|
259
221
|
/**
|
|
260
222
|
* The Changelog, as its own pane (CHG) and as ROADMAP's Changelog view: one
|
|
261
|
-
* row per minor version, then a version's
|
|
262
|
-
*
|
|
223
|
+
* row per minor version, then a version's updates, then an update's notes,
|
|
224
|
+
* one Back at a time.
|
|
263
225
|
*/
|
|
264
226
|
export function ChangelogPane({ focused, width, height }: PaneProps) {
|
|
265
227
|
const paneInstance = usePaneInstance();
|
|
@@ -4,9 +4,10 @@ import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
|
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* The Changelog by minor version: every update of 0.20 under one row, with
|
|
7
|
-
* the version's title
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* the version's title from the repository's CHANGELOG.md, or, for a version
|
|
8
|
+
* it does not cover yet, its first update's title. The website's changelog
|
|
9
|
+
* reads the same file the same way and shows its highlights too; they are
|
|
10
|
+
* read here so the file's own test holds them to that format.
|
|
10
11
|
*
|
|
11
12
|
* CHANGELOG.md has one section per minor version:
|
|
12
13
|
*
|
|
@@ -21,10 +22,7 @@ import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
|
|
|
21
22
|
* skipped here.
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
export const HIGHLIGHTS_MAX = 5;
|
|
26
|
-
|
|
27
|
-
export interface ChangelogHighlight {
|
|
25
|
+
interface ChangelogHighlight {
|
|
28
26
|
/** The bold claim, as written: "A faster, lighter desktop app." */
|
|
29
27
|
lead: string;
|
|
30
28
|
/** The line after the claim (inline markdown), or "". */
|
|
@@ -46,7 +44,6 @@ export interface ChangelogVersion {
|
|
|
46
44
|
/** "0.20" */
|
|
47
45
|
minor: string;
|
|
48
46
|
title: string;
|
|
49
|
-
highlights: ChangelogHighlight[];
|
|
50
47
|
/** Newest first, as GitHub lists them. */
|
|
51
48
|
releases: ChangelogRelease[];
|
|
52
49
|
firstPublishedAt: string;
|
|
@@ -57,7 +54,6 @@ const SECTION = /^##\s+v?(\d+\.\d+)(?:\s*:\s*(.*))?$/;
|
|
|
57
54
|
const VERSIONS = /\s*\(\s*(v?\d+\.\d+\.\d+(?:\s*,\s*v?\d+\.\d+\.\d+)*)\s*\)\s*$/;
|
|
58
55
|
const BULLET = /^[-*]\s+(.+)$/;
|
|
59
56
|
const BOLD_LEAD = /^\*\*(.+?)\*\*\s*(.*)$/;
|
|
60
|
-
const PULL_REFS = /\s*\(\s*#\d+(?:\s*,\s*#\d+)*\s*\)\s*$/;
|
|
61
57
|
const IMAGE = /^!\[[^\]]*\]\([^)\s]+\)$/;
|
|
62
58
|
|
|
63
59
|
/** "**Claim.** Line" as its claim and its line; text without a claim is all claim. */
|
|
@@ -143,35 +139,6 @@ function minorOf(tagName: string): string {
|
|
|
143
139
|
return tagName.match(/^v?(\d+\.\d+)\.\d+$/i)?.[1] ?? tagName;
|
|
144
140
|
}
|
|
145
141
|
|
|
146
|
-
/**
|
|
147
|
-
* A plain bullet's claim: its first sentence, up to a colon that brings in
|
|
148
|
-
* the details. Never inside inline code.
|
|
149
|
-
*/
|
|
150
|
-
function firstClaim(text: string): string {
|
|
151
|
-
let code = false;
|
|
152
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
153
|
-
const char = text[index];
|
|
154
|
-
if (char === "`") code = !code;
|
|
155
|
-
if (code) continue;
|
|
156
|
-
const next = text[index + 1];
|
|
157
|
-
if ((char === "." || char === "!" || char === "?") && (next === undefined || next === " ")) return text.slice(0, index + 1);
|
|
158
|
-
if (char === ":" && next === " ") return `${text.slice(0, index)}.`;
|
|
159
|
-
}
|
|
160
|
-
return text;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* An update's top highlight: the claim of the first bullet of its notes, a
|
|
165
|
-
* plain bullet's first sentence, or its title when the notes have no bullet.
|
|
166
|
-
*/
|
|
167
|
-
export function topHighlight(release: ChangelogRelease): ChangelogHighlight {
|
|
168
|
-
const versions = [release.version.replace(/^v/i, "")];
|
|
169
|
-
const bullet = release.body.split(/\r?\n/).map((line) => line.trim().match(BULLET)?.[1]).find(Boolean);
|
|
170
|
-
if (!bullet) return { lead: release.title, detail: "", versions };
|
|
171
|
-
const lead = bullet.startsWith("**") ? splitLead(bullet).lead : firstClaim(bullet.replace(PULL_REFS, ""));
|
|
172
|
-
return { lead, detail: "", versions };
|
|
173
|
-
}
|
|
174
|
-
|
|
175
142
|
function fallbackTitle(releases: ChangelogRelease[], minor: string): string {
|
|
176
143
|
const first = releases.find((release) => release.version.replace(/^v/i, "") === `${minor}.0`) ?? releases.at(-1);
|
|
177
144
|
return first?.title ?? `Version ${minor}`;
|
|
@@ -190,10 +157,10 @@ function compareMinors(left: string, right: string): number {
|
|
|
190
157
|
|
|
191
158
|
/**
|
|
192
159
|
* The releases (newest first) as one version per minor, the highest first. A
|
|
193
|
-
* version's title
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
160
|
+
* version's title comes from its summary, else from its first update, so a
|
|
161
|
+
* missing or half-written summary never empties a row. With `cut`, the list
|
|
162
|
+
* stopped at its limit, so its oldest version may be missing updates and is
|
|
163
|
+
* left out.
|
|
197
164
|
*/
|
|
198
165
|
export function groupChangelogVersions(
|
|
199
166
|
releases: ChangelogRelease[],
|
|
@@ -210,22 +177,14 @@ export function groupChangelogVersions(
|
|
|
210
177
|
|
|
211
178
|
const versions = [...byMinor]
|
|
212
179
|
.sort(([left], [right]) => compareMinors(left, right))
|
|
213
|
-
.map(([minor, group]): ChangelogVersion => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
minor,
|
|
222
|
-
title: summary?.title ?? fallbackTitle(group, minor),
|
|
223
|
-
highlights,
|
|
224
|
-
releases: group,
|
|
225
|
-
firstPublishedAt: group.at(-1)?.publishedAt ?? "",
|
|
226
|
-
lastPublishedAt: group[0]?.publishedAt ?? "",
|
|
227
|
-
};
|
|
228
|
-
});
|
|
180
|
+
.map(([minor, group]): ChangelogVersion => ({
|
|
181
|
+
id: /^\d+\.\d+$/.test(minor) ? `v${minor}` : minor,
|
|
182
|
+
minor,
|
|
183
|
+
title: summaries.get(minor)?.title ?? fallbackTitle(group, minor),
|
|
184
|
+
releases: group,
|
|
185
|
+
firstPublishedAt: group.at(-1)?.publishedAt ?? "",
|
|
186
|
+
lastPublishedAt: group[0]?.publishedAt ?? "",
|
|
187
|
+
}));
|
|
229
188
|
return cut && versions.length > 1 ? versions.slice(0, -1) : versions;
|
|
230
189
|
}
|
|
231
190
|
|
|
@@ -235,16 +194,6 @@ export function versionOfRelease(versions: ChangelogVersion[], releaseId: string
|
|
|
235
194
|
return versions.find((version) => version.releases.some((release) => release.id === releaseId)) ?? null;
|
|
236
195
|
}
|
|
237
196
|
|
|
238
|
-
/** A version's highlights as the markdown list its detail shows, each naming its updates. */
|
|
239
|
-
export function highlightsMarkdown(version: ChangelogVersion): string {
|
|
240
|
-
return version.highlights.map((highlight) => {
|
|
241
|
-
const claim = `**${highlight.lead}**`;
|
|
242
|
-
const detail = highlight.detail ? ` ${highlight.detail}` : "";
|
|
243
|
-
const shipped = highlight.versions.length ? ` (${highlight.versions.join(", ")})` : "";
|
|
244
|
-
return `- ${claim}${detail}${shipped}`;
|
|
245
|
-
}).join("\n");
|
|
246
|
-
}
|
|
247
|
-
|
|
248
197
|
export type ChangelogVersionColumnId = "date" | "version" | "title" | "updates";
|
|
249
198
|
|
|
250
199
|
export interface ChangelogVersionSort {
|
|
@@ -215,7 +215,8 @@ function rawArgumentFor(manifest: ClientToolManifest, args: Record<string, JsonV
|
|
|
215
215
|
}
|
|
216
216
|
case "tickers":
|
|
217
217
|
case "symbol-list": {
|
|
218
|
-
|
|
218
|
+
// One ticker as `symbol`, as a call to a function that took one (FA before it read several) names it.
|
|
219
|
+
const symbols = args.symbols ?? (typeof args.symbol === "string" ? [args.symbol] : undefined);
|
|
219
220
|
if (symbols == null && manifest.argument.optional) return "";
|
|
220
221
|
if (!Array.isArray(symbols) || !symbols.every((symbol) => typeof symbol === "string")) {
|
|
221
222
|
throw new Error(`${manifest.name} requires a symbols array.`);
|
|
@@ -216,8 +216,9 @@ function clientToolCommand(catalog: PaneFunctionCatalog, found: CatalogFunction,
|
|
|
216
216
|
if (!headless) return null;
|
|
217
217
|
const arg = headless.argument.kind === "ticker"
|
|
218
218
|
? text(args.symbol)
|
|
219
|
+
// A call made while the function took one ticker (FA before it read several) named it as `symbol`.
|
|
219
220
|
: headless.argument.kind === "tickers" || headless.argument.kind === "symbol-list"
|
|
220
|
-
? symbols(args.symbols).join(",")
|
|
221
|
+
? symbols(args.symbols ?? args.symbol).join(",")
|
|
221
222
|
: headless.argument.kind === "free-text"
|
|
222
223
|
? text(args.text)
|
|
223
224
|
: "";
|
|
@@ -51,7 +51,7 @@ const COLUMNS: DataTableColumn[] = [
|
|
|
51
51
|
{ id: "annualized6m", label: "6M Ann", width: 7, align: "right", flexGrow: 1 },
|
|
52
52
|
{ id: "yoy", label: "Y/Y", width: 7, align: "right", flexGrow: 1 },
|
|
53
53
|
{ id: "contribution", label: "M/M Pts", width: 8, align: "right", flexGrow: 1 },
|
|
54
|
-
{ id: "contributionYoy", label: "Y/Y Pts", width: 8, align: "right", flexGrow: 1 },
|
|
54
|
+
{ id: "contributionYoy", label: "Y/Y Pts", width: 8, align: "right", flexGrow: 1, omitWhenEmpty: true },
|
|
55
55
|
];
|
|
56
56
|
const PANELS = [{ id: "main" }];
|
|
57
57
|
/** Legend, four plot rows and the time axis; the read under them takes its own rows. */
|
|
@@ -201,7 +201,7 @@ export type BucketColumn = Omit<DataTableColumn, "id"> & { id: BucketColumnId };
|
|
|
201
201
|
const BUCKET_TEXT_COLUMNS: BucketColumn[] = [
|
|
202
202
|
{ id: "label", label: "MATURITY", width: 15, align: "left" },
|
|
203
203
|
{ id: "value", label: "PRINCIPAL", width: 10, align: "right" },
|
|
204
|
-
{ id: "share", label: "% TOTAL", width: 8, align: "right" },
|
|
204
|
+
{ id: "share", label: "% TOTAL", width: 8, align: "right", omitWhenEmpty: true },
|
|
205
205
|
];
|
|
206
206
|
/** Below this the wall bars are too short to compare. */
|
|
207
207
|
const MIN_WALL_WIDTH = 10;
|
|
@@ -36,7 +36,7 @@ const ALL_COLUMNS: BoardColumn[] = [
|
|
|
36
36
|
{ id: "epsEstimate", label: "EPS EST", width: 7, align: "right" },
|
|
37
37
|
{ id: "analysts", label: "ESTS", width: 4, align: "right" },
|
|
38
38
|
{ id: "epsActual", label: "EPS ACT", width: 7, align: "right", mayBeBlank: true },
|
|
39
|
-
{ id: "basis", label: "BASIS", width: 5, align: "left" },
|
|
39
|
+
{ id: "basis", label: "BASIS", width: 5, align: "left", mayBeBlank: true },
|
|
40
40
|
{ id: "epsSurprise", label: "EPS SURP", width: 8, align: "right", mayBeBlank: true },
|
|
41
41
|
{ id: "revenueEstimate", label: "SALES EST", width: 9, align: "right" },
|
|
42
42
|
{ id: "cap", label: "MKT CAP", width: 8, align: "right" },
|
|
@@ -28,7 +28,9 @@ import { useAssetData, usePluginAppActions, usePluginTickerActions } from "../..
|
|
|
28
28
|
import { earningsResultsAlertValues } from "../alerts/research-builder";
|
|
29
29
|
import { cachedMembers, loadMembers } from "../members/client";
|
|
30
30
|
import { isBoardRowLoading, useQuoteBoard } from "../shared/use-quote-board";
|
|
31
|
-
import {
|
|
31
|
+
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
32
|
+
import { useResearchCloudSession } from "../shared/research-cloud-session";
|
|
33
|
+
import { loadEarningsHighlight } from "./highlight";
|
|
32
34
|
import {
|
|
33
35
|
addDays,
|
|
34
36
|
boardKey,
|
|
@@ -117,7 +119,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
117
119
|
height: number;
|
|
118
120
|
/** Named on the command bar; empty for the market board. */
|
|
119
121
|
scopedSymbols: readonly string[];
|
|
120
|
-
/** `EVTS <ticker>`:
|
|
122
|
+
/** `EVTS <ticker>`: open on this company's report and select its row. */
|
|
121
123
|
highlight?: string | null;
|
|
122
124
|
}) {
|
|
123
125
|
const dataProvider = useAssetData();
|
|
@@ -151,7 +153,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
151
153
|
// range for both views: the table draws its days, the calendar its week (this week for the days ahead).
|
|
152
154
|
const [requestedDate] = usePaneSettingValue<string>("date", "");
|
|
153
155
|
const [requestedWeek] = usePaneSettingValue<string>("week", "");
|
|
154
|
-
const [
|
|
156
|
+
const [chosenRange, setRange] = usePluginPaneState<BoardRange | null>("range", null);
|
|
155
157
|
// The calendar's groups opened past their "+N more" slot, by `calendarGroupKey`.
|
|
156
158
|
const [expanded, setExpanded] = useState(NONE_EXPANDED);
|
|
157
159
|
const desktop = useUiCapabilities().nativePaneChrome === true;
|
|
@@ -171,6 +173,12 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
171
173
|
|
|
172
174
|
const today = newYorkToday();
|
|
173
175
|
const market = !scoped && scope.kind === "all";
|
|
176
|
+
const access = usePlanAccess();
|
|
177
|
+
const session = useResearchCloudSession();
|
|
178
|
+
const accessKey = `${session.requestKey}:${access.hasProAccess ? "pro" : "free"}`;
|
|
179
|
+
const highlightLoader = useCallback((force: boolean) => loadEarningsHighlight(highlight!, today, dataProvider, force, accessKey), [accessKey, dataProvider, highlight, today]);
|
|
180
|
+
const highlightedReport = useAsyncResource(market && highlight ? highlightLoader : null);
|
|
181
|
+
const range = chosenRange ?? (requestedBoardRange(requestedDate, requestedWeek) || highlightedReport.data?.report.date || "");
|
|
174
182
|
// Keyed by content: ticker records change for many reasons, the board reloads only when the list's names do.
|
|
175
183
|
const collectionKey = useMemo(() => {
|
|
176
184
|
if (scope.kind !== "portfolio" && scope.kind !== "watchlist") return "";
|
|
@@ -196,7 +204,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
196
204
|
const weekOffset = boardRangeWeek(range, today);
|
|
197
205
|
const week = useMemo(() => calendarWeekDates(today, weekOffset), [today, weekOffset]);
|
|
198
206
|
// EVTS 0700.HK names its listing, which the market board then keeps whatever the day's cut.
|
|
199
|
-
const highlightListing = market && highlight
|
|
207
|
+
const highlightListing = market && highlight ? boardKey(highlight) : null;
|
|
200
208
|
// The calendar reads its week, reported days included; the table its days. Each report says its currency
|
|
201
209
|
// (CCY), so every board reads the listings abroad too.
|
|
202
210
|
const query = useMemo<EarningsCalendarQuery>(() => {
|
|
@@ -228,6 +236,10 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
228
236
|
const extra = fallback.status === "fulfilled"
|
|
229
237
|
? fallback.value.filter((event) => !covered.has(event.symbol)).map((event) => fallbackReport(event, owned, today))
|
|
230
238
|
: [];
|
|
239
|
+
const target = highlightedReport.data?.report;
|
|
240
|
+
if (target && target.date >= read.from && target.date <= read.to && ![...reports, ...extra].some((report) => boardRowOf(report, target.symbol))) {
|
|
241
|
+
extra.push({ ...target, owned: owned.get(target.symbol) ?? null });
|
|
242
|
+
}
|
|
231
243
|
return {
|
|
232
244
|
queryKey,
|
|
233
245
|
reports: [...reports, ...extra],
|
|
@@ -237,8 +249,8 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
237
249
|
? (cloud.reason instanceof Error ? cloud.reason.message : String(cloud.reason))
|
|
238
250
|
: holdings?.refreshError ?? cloud.value.refreshError,
|
|
239
251
|
};
|
|
240
|
-
}, [calendar, dataProvider, market, named, owned, perTicker, query, queryKey, range, fund, today]);
|
|
241
|
-
const resource = useAsyncResource(loader, {
|
|
252
|
+
}, [calendar, dataProvider, highlightedReport.data, market, named, owned, perTicker, query, queryKey, range, fund, today]);
|
|
253
|
+
const resource = useAsyncResource(highlightedReport.loading ? null : loader, {
|
|
242
254
|
keepPreviousData: true,
|
|
243
255
|
initialData: () => {
|
|
244
256
|
const holdings = fund ? cachedMembers(fund.etf) : null;
|
|
@@ -324,16 +336,23 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
324
336
|
const updatedAgo = useUpdatedAgo(resource.updatedAt);
|
|
325
337
|
const utcDay = useUtcDay();
|
|
326
338
|
// Its source and when the calendar was read, as `fn EVTS` ends; how long ago it loaded goes first on a narrow row.
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
...(
|
|
330
|
-
|
|
339
|
+
const highlightMissing = market && highlight && !resource.loading && !highlightedReport.loading && !data?.reports.some((report) => boardRowOf(report, highlight));
|
|
340
|
+
const footerInfo = useMemo(() => [
|
|
341
|
+
...(highlightMissing ? [{ id: "highlight", capture: true, parts: [{
|
|
342
|
+
text: highlightedReport.error ? `${highlight}: report date unavailable`
|
|
343
|
+
: highlightedReport.data ? `${highlight} reports on ${highlightedReport.data.report.date}; not in this range`
|
|
344
|
+
: `No report date for ${highlight}.`,
|
|
345
|
+
tone: "warning" as const,
|
|
346
|
+
}] }] : []),
|
|
347
|
+
...(data ? [reportFooterSegment(earningsBoardHeadless, { rows: [], metadata: { asOf: data.asOf } }),
|
|
348
|
+
...(updatedAgo ? [ageFooterSegment(updatedAgo)] : [])] : []),
|
|
349
|
+
], [data, highlight, highlightedReport.data, highlightedReport.error, highlightMissing, updatedAgo, utcDay]);
|
|
331
350
|
usePaneStatusFooter({
|
|
332
351
|
registrationId: "earnings-board",
|
|
333
352
|
enabled: !open,
|
|
334
|
-
loading: resource.loading,
|
|
335
|
-
error: resource.error ?? data?.refreshError ?? null,
|
|
336
|
-
stale: !!data?.stale,
|
|
353
|
+
loading: resource.loading || highlightedReport.loading,
|
|
354
|
+
error: resource.error ?? highlightedReport.error ?? data?.refreshError ?? highlightedReport.data?.refreshError ?? null,
|
|
355
|
+
stale: !!data?.stale || !!highlightedReport.data?.stale,
|
|
337
356
|
info: footerInfo,
|
|
338
357
|
});
|
|
339
358
|
const symbol = open?.symbol ?? selectedReport?.symbol ?? null;
|
|
@@ -357,8 +376,9 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
357
376
|
}), [alerts, createPaneFromTemplate, navigateTicker, notify, symbol]);
|
|
358
377
|
|
|
359
378
|
// t, e, c, a and n are footer hints, which bind their own keys.
|
|
360
|
-
const
|
|
361
|
-
|
|
379
|
+
const refresh = useCallback(() => { highlightedReport.reload(); resource.reload(); }, [highlightedReport.reload, resource.reload]);
|
|
380
|
+
const handleKeyDown = useCallback((event: DataTableKeyEvent) => handleRefreshKey(event, refresh), [refresh]);
|
|
381
|
+
usePaneRefreshKey(refresh, { focused, enabled: calendar && !open });
|
|
362
382
|
|
|
363
383
|
const sortColumn = (Object.entries(SORTABLE).find(([, value]) => value === sort.column)?.[0]) ?? null;
|
|
364
384
|
const namesFilter: QueryBarFilter[] = scoped ? [] : [{
|
|
@@ -457,7 +477,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
457
477
|
rootWidth={width}
|
|
458
478
|
rootHeight={height}
|
|
459
479
|
rootBefore={queryBar}
|
|
460
|
-
status={{ loading: resource.loading && !data, error: !data ? resource.error : null, subject: "the earnings calendar" }}
|
|
480
|
+
status={{ loading: (resource.loading || highlightedReport.loading) && !data, error: !data ? resource.error : null, subject: "the earnings calendar" }}
|
|
461
481
|
columns={columns}
|
|
462
482
|
items={rows}
|
|
463
483
|
getItemKey={(row) => row.key}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DataProvider } from "../../../types/data-provider";
|
|
2
|
+
import { boardKey, historyListing, type BoardReport } from "./board-model";
|
|
3
|
+
import { loadEarningsHistory, noHistoryAbroad } from "./client";
|
|
4
|
+
import { loadEarningsCalendar } from "./data/cache";
|
|
5
|
+
import { historyRows } from "./history-model";
|
|
6
|
+
|
|
7
|
+
interface EarningsHighlight {
|
|
8
|
+
report: BoardReport;
|
|
9
|
+
stale: boolean;
|
|
10
|
+
refreshError: string | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function loadEarningsHighlight(symbol: string, today: string, provider: DataProvider | null, force: boolean, accessKey: string): Promise<EarningsHighlight | null> {
|
|
14
|
+
const { listing, abroad, ownAbroad } = historyListing(symbol);
|
|
15
|
+
const [history, upcoming] = await Promise.allSettled([
|
|
16
|
+
abroad ? Promise.resolve(null)
|
|
17
|
+
: ownAbroad ? loadEarningsHistory(listing, force, undefined, accessKey).catch(noHistoryAbroad)
|
|
18
|
+
: loadEarningsHistory(listing, force),
|
|
19
|
+
loadEarningsCalendar(provider, [symbol], { force }),
|
|
20
|
+
]);
|
|
21
|
+
const payload = history.status === "fulfilled" ? history.value?.payload ?? null : null;
|
|
22
|
+
const event = upcoming.status === "fulfilled" ? upcoming.value.events[0] ?? null : null;
|
|
23
|
+
const rows = historyRows(payload, today, event, { abroad: ownAbroad });
|
|
24
|
+
const row = rows.find((candidate) => candidate.upcoming) ?? rows[0];
|
|
25
|
+
if (row) {
|
|
26
|
+
const key = boardKey(symbol);
|
|
27
|
+
const source = payload?.reports.find((report) => report.date === row.date);
|
|
28
|
+
return {
|
|
29
|
+
report: {
|
|
30
|
+
key: `${key}:${row.date}`, symbol: key, name: payload?.name ?? event?.name ?? key,
|
|
31
|
+
date: row.date, timing: row.timing, expectedTiming: row.expectedTiming, dateStatus: row.dateStatus,
|
|
32
|
+
marketCap: source?.marketCap ?? null,
|
|
33
|
+
epsEstimate: row.epsEstimate, epsAnalysts: row.epsAnalysts, epsActual: row.epsActual,
|
|
34
|
+
provisional: row.provisional, epsBasis: row.epsBasis, epsSurprise: row.epsSurprise,
|
|
35
|
+
revenueEstimate: row.revenueEstimate, impliedMove: row.implied, averageMove: null,
|
|
36
|
+
owned: null, currency: row.currency ?? "USD",
|
|
37
|
+
},
|
|
38
|
+
stale: (history.status === "fulfilled" && !!history.value?.stale) || (upcoming.status === "fulfilled" && upcoming.value.stale),
|
|
39
|
+
refreshError: history.status === "rejected" ? (history.reason instanceof Error ? history.reason.message : String(history.reason))
|
|
40
|
+
: history.value?.refreshError ?? (upcoming.status === "rejected" ? (upcoming.reason instanceof Error ? upcoming.reason.message : String(upcoming.reason)) : upcoming.value.refreshError) ?? null,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (history.status === "rejected") throw history.reason;
|
|
44
|
+
if (upcoming.status === "rejected") throw upcoming.reason;
|
|
45
|
+
if (upcoming.value.refreshError) throw new Error(upcoming.value.refreshError);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
@@ -22,7 +22,7 @@ const ALL_COLUMNS: HistoryColumn[] = [
|
|
|
22
22
|
{ id: "epsEstimate", label: "EPS EST", width: 7, align: "right" },
|
|
23
23
|
{ id: "analysts", label: "ESTS", width: 4, align: "right" },
|
|
24
24
|
{ id: "epsActual", label: "EPS ACT", width: 7, align: "right" },
|
|
25
|
-
{ id: "basis", label: "BASIS", width: 5, align: "left" },
|
|
25
|
+
{ id: "basis", label: "BASIS", width: 5, align: "left", mayBeBlank: true },
|
|
26
26
|
{ id: "epsSurprise", label: "EPS SURP", width: 8, align: "right" },
|
|
27
27
|
{ id: "revenueEstimate", label: "SALES EST", width: 9, align: "right" },
|
|
28
28
|
{ id: "revenueActual", label: "SALES ACT", width: 9, align: "right" },
|
|
@@ -139,7 +139,7 @@ export const earningsModule: PluginModule = {
|
|
|
139
139
|
id: "earnings-board-pane",
|
|
140
140
|
paneId: "earnings-calendar",
|
|
141
141
|
label: "Earnings Days",
|
|
142
|
-
description: "The market board: report days by week or day, with implied and past moves; a ticker
|
|
142
|
+
description: "The market board: report days by week or day, with implied and past moves; a ticker opens its report day and selects its row.",
|
|
143
143
|
keywords: ["evts", "events", "earnings calendar", "earnings season", "reporting today"],
|
|
144
144
|
// Bloomberg's calendar: the market board always, never one company's history.
|
|
145
145
|
shortcut: { prefix: "EVTS", argPlaceholder: "ticker", argKind: "ticker", argOptional: true },
|
|
@@ -1010,7 +1010,7 @@ function CallsListView({
|
|
|
1010
1010
|
// for the company, or it has nothing to search for.
|
|
1011
1011
|
if (ticker && calls.length === 0) {
|
|
1012
1012
|
return listPending ? (
|
|
1013
|
-
<PaneStatusBody
|
|
1013
|
+
<PaneStatusBody empty align="center" emptyTitle={`Looking for ${ticker}'s earnings calls...`} />
|
|
1014
1014
|
) : (
|
|
1015
1015
|
<EmptyState {...noCallsText(ticker)} />
|
|
1016
1016
|
);
|
|
@@ -1026,7 +1026,7 @@ function CallsListView({
|
|
|
1026
1026
|
) : selected && selectedUpcoming ? (
|
|
1027
1027
|
<UpcomingCallState call={selected} now={now} />
|
|
1028
1028
|
) : selected && !selectedTranscript && (producing || (!selected.hasTranscript && !transcriptError)) ? (
|
|
1029
|
-
<PaneStatusBody
|
|
1029
|
+
<PaneStatusBody empty emptyTitle="Transcript not ready yet." emptyMessage="Producing the transcript. This usually takes two to three minutes." />
|
|
1030
1030
|
) : (
|
|
1031
1031
|
|
|
1032
1032
|
// The reader gets its own find field: a transcript runs to thousands of
|
|
@@ -50,7 +50,7 @@ export const PERIOD_COLUMNS: DataTableColumn[] = [
|
|
|
50
50
|
{ id: "percentile", label: "PCTL 1Y", width: 9, align: "right" },
|
|
51
51
|
{ id: "change", label: "CHANGE %", width: 11, align: "right" },
|
|
52
52
|
{ id: "breadth", label: "UP/DN 30D", width: 12, align: "right" },
|
|
53
|
-
{ id: "range", label: "HI-LO", width: 11, align: "right" },
|
|
53
|
+
{ id: "range", label: "HI-LO", width: 11, align: "right", omitWhenEmpty: true },
|
|
54
54
|
{ id: "asOf", label: "AS OF", width: 12, align: "left", flexGrow: 1 },
|
|
55
55
|
];
|
|
56
56
|
export function sortPeriods(
|
|
@@ -14,7 +14,7 @@ function sourceInput(arg: string, context: PaneTemplateContext): string {
|
|
|
14
14
|
const source = SOURCE.exec(arg.trim());
|
|
15
15
|
if (!source) return arg;
|
|
16
16
|
const prefix = source[1]!.toUpperCase();
|
|
17
|
-
const match = findNamedCollection(prefix === "PORT" ? context.config.portfolios : context.config.watchlists, source[2]);
|
|
17
|
+
const match = findNamedCollection<{ id: string; name: string }>(prefix === "PORT" ? context.config.portfolios : context.config.watchlists, source[2]);
|
|
18
18
|
return match ? `${prefix}:${match.id}` : arg;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -120,7 +120,7 @@ export const macroFigureGapNotices = (events: readonly Pick<MacroDayEvent, "kind
|
|
|
120
120
|
if (!event.figures) return event.figuresMissing ? [`${label} has no figures: ${event.figuresMissing}.`] : [];
|
|
121
121
|
if (event.figures.computed) return [`${label} actual is ${event.figures.computed}.`];
|
|
122
122
|
// The print its surprise is read from instead, with its own figures.
|
|
123
|
-
const basis = event.figures.surpriseBasis;
|
|
123
|
+
const basis = macroSurpriseBasisLabel(event.figures) != null ? event.figures.surpriseBasis : null;
|
|
124
124
|
const read = basis ? ` Surprise read from ${basis.basis}: ${basis.actual} vs ${basis.forecast} forecast.` : "";
|
|
125
125
|
return event.figures.actualMissing ? [`${label} has no actual: ${event.figures.actualMissing}.${read}`]
|
|
126
126
|
: basis ? [`${label} has no actual.${read}`] : [];
|
|
@@ -150,10 +150,12 @@ export function macroSurpriseExclusionNote(events: readonly Pick<MacroDayEvent,
|
|
|
150
150
|
const unread = events.filter((event) => macroSurpriseOf(event.figures) == null);
|
|
151
151
|
if (!unread.length) return null;
|
|
152
152
|
const noActual = unread.filter((event) => !event.figures?.actual).length;
|
|
153
|
-
const noForecast = unread.
|
|
153
|
+
const noForecast = unread.filter((event) => event.figures?.actual && !event.figures.forecast).length;
|
|
154
|
+
const unavailable = unread.length - noActual - noForecast;
|
|
155
|
+
const reasons = ([[noActual, "no actual"], [noForecast, "no forecast"], [unavailable, "surprise unavailable"]] as const)
|
|
156
|
+
.filter(([count]) => count > 0);
|
|
154
157
|
const prints = `${unread.length} print${unread.length === 1 ? "" : "s"} excluded`;
|
|
155
|
-
return
|
|
156
|
-
: `${prints}: no ${noActual ? "actual" : "forecast"}.`;
|
|
158
|
+
return `${prints}: ${reasons.map(([count, reason]) => reasons.length > 1 ? `${count} ${reason}` : reason).join(", ")}.`;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
/** What a row adds to its release's name: a policy decision's move, and the earnings marker. */
|
|
@@ -5,7 +5,7 @@ import { MISSING_VALUE, formatNumber } from "../../../utils/format";
|
|
|
5
5
|
import { historySpanStat, sinceLabel } from "../shared/history-span";
|
|
6
6
|
import { SeriesDetailChart } from "../shared/series-detail-chart";
|
|
7
7
|
import { valuationAxis, zoneSeriesFor } from "./chart-projection";
|
|
8
|
-
import type
|
|
8
|
+
import { readingPeriodEnd, type IndicatorViewModel } from "./view";
|
|
9
9
|
import { ZoneColorScale } from "./zone-scale";
|
|
10
10
|
|
|
11
11
|
function formatTrillions(billions: number): string {
|
|
@@ -49,8 +49,8 @@ export function IndicatorDetail({
|
|
|
49
49
|
: []),
|
|
50
50
|
{ id: "year-ago", label: "1Y ago", value: view.ratioOneYearAgo == null ? MISSING_VALUE : indicator.formatValue(view.ratioOneYearAgo) },
|
|
51
51
|
// The whole history's, whatever the range the chart shows.
|
|
52
|
-
{ id: "ath", label: sinceLabel("High", view.historyStart), value: indicator.formatValue(view.allTimeHigh.ratio), detail: view.allTimeHigh.date },
|
|
53
|
-
{ id: "atl", label: sinceLabel("Low", view.historyStart), value: indicator.formatValue(view.allTimeLow.ratio), detail: view.allTimeLow.date },
|
|
52
|
+
{ id: "ath", label: sinceLabel("High", view.historyStart), value: indicator.formatValue(view.allTimeHigh.ratio), detail: readingPeriodEnd(view.allTimeHigh.date, view.periodicity) },
|
|
53
|
+
{ id: "atl", label: sinceLabel("Low", view.historyStart), value: indicator.formatValue(view.allTimeLow.ratio), detail: readingPeriodEnd(view.allTimeLow.date, view.periodicity) },
|
|
54
54
|
// A range longer than the history shows all of it, from where it starts.
|
|
55
55
|
...[historySpanStat(view.span)].filter((item): item is StatItem => item !== null),
|
|
56
56
|
], [indicator, levels, view]);
|
|
@@ -14,6 +14,7 @@ import { createCloudSourceDeps } from "./sources";
|
|
|
14
14
|
import { historyStartNotice, sinceLabel } from "../shared/history-span";
|
|
15
15
|
import { formatSigma } from "../shared/trend";
|
|
16
16
|
import {
|
|
17
|
+
readingPeriodEnd,
|
|
17
18
|
selectValuationViews,
|
|
18
19
|
type IndicatorViewModel,
|
|
19
20
|
type ValuationBundle,
|
|
@@ -45,14 +46,14 @@ function detailEntries(view: IndicatorViewModel): HeadlessPaneEntry[] {
|
|
|
45
46
|
{
|
|
46
47
|
label: sinceLabel("High", view.historyStart),
|
|
47
48
|
value: { value: view.allTimeHigh.ratio, date: view.allTimeHigh.date },
|
|
48
|
-
formatted: `${format(view.allTimeHigh.ratio)} ${view.allTimeHigh.date}`,
|
|
49
|
+
formatted: `${format(view.allTimeHigh.ratio)} ${readingPeriodEnd(view.allTimeHigh.date, view.periodicity)}`,
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
label: sinceLabel("Low", view.historyStart),
|
|
52
53
|
value: { value: view.allTimeLow.ratio, date: view.allTimeLow.date },
|
|
53
|
-
formatted: `${format(view.allTimeLow.ratio)} ${view.allTimeLow.date}`,
|
|
54
|
+
formatted: `${format(view.allTimeLow.ratio)} ${readingPeriodEnd(view.allTimeLow.date, view.periodicity)}`,
|
|
54
55
|
},
|
|
55
|
-
{ label: "As of", value: view.asOf },
|
|
56
|
+
{ label: "As of", value: view.asOf, formatted: readingPeriodEnd(view.asOf, view.periodicity) },
|
|
56
57
|
];
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -113,7 +114,9 @@ function projectValuationHeadlessBundle(
|
|
|
113
114
|
align: "right",
|
|
114
115
|
format: (value) => formatSigma(value == null ? null : Number(value)),
|
|
115
116
|
},
|
|
116
|
-
|
|
117
|
+
// The day the reading's period ends, as FA dates its columns; the row keeps the period's first day.
|
|
118
|
+
{ key: "asOf", header: "As of", format: (value, row) => typeof value === "string"
|
|
119
|
+
? readingPeriodEnd(value, row.periodicity as IndicatorViewModel["periodicity"] | undefined) : MISSING_VALUE },
|
|
117
120
|
],
|
|
118
121
|
rows,
|
|
119
122
|
},
|
|
@@ -122,6 +125,10 @@ function projectValuationHeadlessBundle(
|
|
|
122
125
|
: []),
|
|
123
126
|
],
|
|
124
127
|
errors: bundle.errors,
|
|
128
|
+
// The status line counts the stale readings; each is named here, with the period it is of.
|
|
129
|
+
...(rows.some((row) => row.stale) ? {
|
|
130
|
+
notes: rows.filter((row) => row.stale).map((row) => `${row.indicator} is stale: its latest reading is as of ${readingPeriodEnd(row.asOf, row.periodicity)}, older than its release schedule allows.`),
|
|
131
|
+
} : {}),
|
|
125
132
|
metadata: {
|
|
126
133
|
fetchedAt: bundle.fetchedAt,
|
|
127
134
|
sources: bundle.sources,
|