gloomberb 0.20.13 → 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 +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
- package/src/account/auth-dialog.tsx +22 -4
- package/src/account/auth-form.tsx +6 -1
- package/src/account/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +54 -0
- package/src/api-client/install-experiments.ts +8 -7
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/paths.ts +2 -1
- package/src/api-client/product-waitlist.ts +63 -0
- package/src/api-client/request.ts +16 -4
- 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/architecture/floating-promise-allowlist.json +0 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +103 -27
- package/src/cli/commands/overview.ts +18 -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/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +24 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/known-gaps.ts +2 -2
- package/src/cli/listing-arg.ts +79 -11
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +29 -1
- package/src/cli/pane-functions/catalog.ts +70 -12
- package/src/cli/pane-functions/function-help.ts +1 -1
- package/src/cli/pane-functions/headless.ts +68 -3
- package/src/cli/pane-functions/index.ts +2 -2
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/resolver.ts +104 -15
- package/src/cli/pane-functions/screenshot-payload.ts +3 -0
- package/src/cli/report-tables.ts +20 -5
- package/src/cli/result.ts +22 -4
- package/src/cli/shot-temp-dir.ts +30 -0
- package/src/cli/suffixed-listing-rows.ts +11 -0
- package/src/cli/symbol-args.ts +5 -3
- package/src/cli/symbol-list.ts +23 -10
- package/src/cli/symbol-rows.ts +135 -3
- package/src/cli/treasury-yields.ts +15 -1
- package/src/components/chart/composite/composite-chart.tsx +3 -3
- package/src/components/chart/composite/format.ts +2 -1
- package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
- package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
- package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
- package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
- package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
- package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
- package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
- package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
- package/src/components/chart/composite/panel-surface/props.ts +79 -0
- package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
- package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
- package/src/components/chart/composite/panel-surface.tsx +81 -1177
- package/src/components/command-bar/commands/collection-list.ts +1 -0
- 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 +19 -2
- package/src/components/command-bar/routes/root/runtime.ts +3 -2
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/root/shortcuts.ts +15 -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 +16 -6
- package/src/components/layout/shell/index.tsx +5 -1
- package/src/components/layout/shell/ticker-link-menu.ts +12 -9
- package/src/components/pane-settings-dialog/tui.tsx +6 -3
- package/src/components/pane-settings-dialog.tsx +2 -1
- package/src/components/pane-template-wizard.tsx +2 -0
- 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/choice-dialog.tsx +1 -1
- package/src/components/ui/confirm-dialog.tsx +3 -2
- 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/components/ui/frame.tsx +7 -3
- package/src/components/ui/icon.tsx +4 -2
- package/src/components/ui/list-view.tsx +8 -0
- package/src/components/ui/number-prompt-dialog.tsx +2 -1
- package/src/components/use-pane-notice-footer.tsx +3 -1
- 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/docs/snapshot.json +2 -2
- package/src/i18n/es.ts +39 -0
- package/src/i18n/ja.ts +39 -0
- package/src/i18n/ko.ts +39 -0
- package/src/i18n/zh-cn.ts +39 -0
- package/src/i18n/zh-tw.ts +39 -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/format.ts +35 -1
- package/src/market-data/market/index-level.ts +19 -0
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/resolution.ts +16 -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/password-dialog.tsx +2 -2
- 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/analytics/risk-client.ts +12 -2
- package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
- package/src/plugins/builtin/analytics/risk-math.ts +23 -6
- package/src/plugins/builtin/analytics/risk-model.ts +20 -9
- package/src/plugins/builtin/analytics/risk-pane.tsx +2 -2
- 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/chart-composer/catalog-inventory.ts +5 -2
- package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +1 -1
- package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
- package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
- package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
- package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
- package/src/plugins/builtin/cpi/headless.ts +6 -1
- package/src/plugins/builtin/cpi/model.ts +17 -0
- package/src/plugins/builtin/cpi/pane.tsx +4 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +89 -11
- package/src/plugins/builtin/crypto-board/pane.tsx +20 -5
- package/src/plugins/builtin/debt-maturities/model.ts +1 -1
- package/src/plugins/builtin/dividend-yield/client.ts +24 -2
- package/src/plugins/builtin/dividend-yield/headless.ts +4 -2
- package/src/plugins/builtin/dividend-yield/ranking.ts +2 -1
- package/src/plugins/builtin/dividend-yield/view.ts +5 -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 +9 -1
- package/src/plugins/builtin/earnings/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/econ/calendar-model.ts +17 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ-statistics/headless.ts +21 -0
- 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/headless.ts +21 -10
- package/src/plugins/builtin/macro-day/model.ts +42 -3
- package/src/plugins/builtin/macro-day/pane.tsx +26 -8
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- 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/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +15 -4
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/pane.tsx +7 -1
- 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/bulk-symbols.ts +4 -2
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
- package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +178 -17
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +95 -18
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +24 -6
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -1
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +38 -16
- 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/cloud-upgrade.ts +4 -2
- package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
- 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/adr-pair/headless.ts +45 -2
- 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 +280 -35
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +4 -5
- package/src/plugins/builtin/ticker-detail/overview/model.ts +9 -2
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +10 -2
- 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/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +34 -12
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- 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/dialog-host.tsx +5 -5
- package/src/renderers/dom/styles.css +7 -0
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/sources/gloomberb-cloud/normalizers.ts +5 -0
- package/src/sources/provider-router/history.ts +5 -2
- 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/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +4 -3
- package/src/tickers/company-name.ts +19 -1
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +3 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/time-series/base-series.ts +4 -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/types.ts +5 -2
- package/src/time-series/use-chart-resolution.ts +6 -1
- package/src/types/config.ts +32 -0
- package/src/types/financials.ts +13 -0
- package/src/types/headless.ts +7 -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/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/async-deadline.ts +2 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/csv.ts +44 -5
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +60 -3
- package/src/utils/futures-generic.ts +17 -0
- package/src/utils/trailing-dividend.ts +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gloomberb",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.16",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Market research and portfolio tracker for the terminal",
|
|
6
6
|
"module": "src/public/index.ts",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"check:pane-screenshot": "bun run scripts/pane-chrome/screenshot.ts",
|
|
96
96
|
"check:pane-rest": "bun run scripts/pane-chrome/rest-diff.ts",
|
|
97
97
|
"check:pane-layout": "bun run scripts/pane-chrome/layout-sweep.ts",
|
|
98
|
+
"check:pane-data": "bun run scripts/pane-chrome/data-sweep.ts",
|
|
98
99
|
"check:ui-tokens": "bun run scripts/pane-chrome/ui-tokens.ts",
|
|
99
100
|
"ui:benchmark": "bun run scripts/pane-chrome/ui-benchmark.ts",
|
|
100
101
|
"askg:tool-sweep": "bun run scripts/askg-tool-sweep.ts",
|
|
@@ -539,7 +539,25 @@ index b9445d2cca9477dfe06026da451b6d19268fcbdd..1f5795ab76800a64fdb0acf4a1ed0186
|
|
|
539
539
|
this._hasPointer = true;
|
|
540
540
|
this._lastPointerModifiers = mouseEvent.modifiers;
|
|
541
541
|
if (this._console.visible) {
|
|
542
|
-
@@ -
|
|
542
|
+
@@ -24327,6 +24557,17 @@ Captured external output:
|
|
543
|
+
const sameElement = maybeRenderableId === this.lastOverRenderableNum;
|
|
544
|
+
this.lastOverRenderableNum = maybeRenderableId;
|
|
545
|
+
const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
|
|
546
|
+
+ // A press where the pointer was not last over took it there: some terminals report no motion between presses,
|
|
547
|
+
+ // so what it was over would keep its hover (a chart its crosshair) until the next move.
|
|
548
|
+
+ if (!sameElement && mouseEvent.type === "down" && !this.capturedRenderable && this.lastOverRenderable !== maybeRenderable) {
|
|
549
|
+
+ if (this.lastOverRenderable && !this.lastOverRenderable.isDestroyed) {
|
|
550
|
+
+ this.lastOverRenderable.processMouseEvent(new MouseEvent(this.lastOverRenderable, { ...mouseEvent, type: "out" }));
|
|
551
|
+
+ }
|
|
552
|
+
+ this.lastOverRenderable = maybeRenderable;
|
|
553
|
+
+ if (maybeRenderable) {
|
|
554
|
+
+ maybeRenderable.processMouseEvent(new MouseEvent(maybeRenderable, { ...mouseEvent, type: "over" }));
|
|
555
|
+
+ }
|
|
556
|
+
+ }
|
|
557
|
+
if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && !this.currentSelection?.isDragging && !mouseEvent.modifiers.ctrl) {
|
|
558
|
+
const canStartSelection = Boolean(maybeRenderable && maybeRenderable.selectable && !maybeRenderable.isDestroyed && maybeRenderable.shouldStartSelection(mouseEvent.x, mouseEvent.y));
|
|
559
|
+
if (canStartSelection && maybeRenderable) {
|
|
560
|
+
@@ -24437,6 +24678,8 @@ Captured external output:
|
|
543
561
|
return;
|
|
544
562
|
}
|
|
545
563
|
const baseEvent = {
|
|
@@ -548,7 +566,7 @@ index b9445d2cca9477dfe06026da451b6d19268fcbdd..1f5795ab76800a64fdb0acf4a1ed0186
|
|
|
548
566
|
type: "move",
|
|
549
567
|
button: 0,
|
|
550
568
|
x: this._latestPointer.x,
|
|
551
|
-
@@ -24527,6 +
|
|
569
|
+
@@ -24527,6 +24770,7 @@ Captured external output:
|
|
552
570
|
const pendingSplitFooterTransition = this.pendingSplitFooterTransition;
|
|
553
571
|
const previousGeometry = calculateRenderGeometry(this._screenMode, this._terminalWidth, this._terminalHeight, this._footerHeight);
|
|
554
572
|
const prevWidth = this._terminalWidth;
|
|
@@ -556,7 +574,7 @@ index b9445d2cca9477dfe06026da451b6d19268fcbdd..1f5795ab76800a64fdb0acf4a1ed0186
|
|
|
556
574
|
const previousTerminalHeight = this._terminalHeight;
|
|
557
575
|
const visiblePreviousSplitHeight = pendingSplitFooterTransition?.sourceHeight ?? previousGeometry.effectiveFooterHeight;
|
|
558
576
|
this._terminalWidth = width;
|
|
559
|
-
@@ -24832,6 +
|
|
577
|
+
@@ -24832,6 +25076,11 @@ Captured external output:
|
|
560
578
|
this.clock.clearTimeout(this.resizeTimeoutId);
|
|
561
579
|
this.resizeTimeoutId = null;
|
|
562
580
|
}
|
|
@@ -568,7 +586,7 @@ index b9445d2cca9477dfe06026da451b6d19268fcbdd..1f5795ab76800a64fdb0acf4a1ed0186
|
|
|
568
586
|
if (this.capabilityTimeoutId !== null) {
|
|
569
587
|
this.clock.clearTimeout(this.capabilityTimeoutId);
|
|
570
588
|
this.capabilityTimeoutId = null;
|
|
571
|
-
@@ -24847,6 +
|
|
589
|
+
@@ -24847,6 +25096,7 @@ Captured external output:
|
|
572
590
|
}
|
|
573
591
|
this.themeModeState.cancelRefresh();
|
|
574
592
|
this._isRunning = false;
|
|
@@ -10,30 +10,43 @@ import type { AuthUser } from "../api-client";
|
|
|
10
10
|
import { DialogFrame } from "../components/ui/frame";
|
|
11
11
|
import { useAppLanguage } from "../i18n/react";
|
|
12
12
|
import { useDialog, type PromptContext } from "../ui/dialog";
|
|
13
|
+
import { clickOutsideWhileClean } from "../ui/dialog-stack";
|
|
13
14
|
import { AuthForm, authFormTitle } from "./auth-form";
|
|
14
15
|
import type { AccountMode } from "./auth-model";
|
|
15
16
|
import { CloudVerificationPanel } from "./verification-panel";
|
|
16
17
|
|
|
17
18
|
function AuthDialog({
|
|
18
19
|
initialMode,
|
|
20
|
+
reason,
|
|
19
21
|
resolve,
|
|
20
22
|
dismiss,
|
|
21
|
-
|
|
23
|
+
onCleanChange,
|
|
24
|
+
}: PromptContext<AuthUser | undefined> & {
|
|
25
|
+
initialMode: AccountMode;
|
|
26
|
+
reason?: string;
|
|
27
|
+
onCleanChange: (clean: boolean) => void;
|
|
28
|
+
}) {
|
|
22
29
|
useAppLanguage();
|
|
23
30
|
const [mode, setMode] = useState<AccountMode>(initialMode);
|
|
24
31
|
const [verifyingUser, setVerifyingUser] = useState<AuthUser | null>(null);
|
|
32
|
+
const [typed, setTyped] = useState(false);
|
|
33
|
+
// A click outside closes it only while it is clean: never with something typed, nor once the account
|
|
34
|
+
// waits on its emailed code.
|
|
35
|
+
useEffect(() => onCleanChange(!typed && !verifyingUser), [onCleanChange, typed, verifyingUser]);
|
|
25
36
|
|
|
26
|
-
|
|
37
|
+
// The close button always closes it, so a mouse is never trapped in it.
|
|
38
|
+
if (verifyingUser) return <DialogFrame title={`Confirm ${verifyingUser.email}`} onClose={dismiss}>
|
|
27
39
|
<CloudVerificationPanel onVerified={resolve} onContinueFree={() => resolve(verifyingUser)} />
|
|
28
40
|
</DialogFrame>;
|
|
29
41
|
|
|
30
42
|
return (
|
|
31
|
-
<DialogFrame title={authFormTitle(mode)}>
|
|
43
|
+
<DialogFrame title={authFormTitle(mode)} subtitle={reason} onClose={dismiss}>
|
|
32
44
|
<AuthForm
|
|
33
45
|
initialMode={initialMode}
|
|
34
46
|
onModeChange={setMode}
|
|
35
47
|
onSignedIn={(user) => user.emailVerified ? resolve(user) : setVerifyingUser(user)}
|
|
36
48
|
onEscape={dismiss}
|
|
49
|
+
onTypedChange={setTyped}
|
|
37
50
|
/>
|
|
38
51
|
</DialogFrame>
|
|
39
52
|
);
|
|
@@ -41,6 +54,8 @@ function AuthDialog({
|
|
|
41
54
|
|
|
42
55
|
export interface AuthDialogRequest {
|
|
43
56
|
mode?: AccountMode;
|
|
57
|
+
/** What asked for it, under the title: the delayed mark says what is delayed and by how much. */
|
|
58
|
+
reason?: string;
|
|
44
59
|
onSignedIn?: (user: AuthUser) => void;
|
|
45
60
|
}
|
|
46
61
|
|
|
@@ -77,13 +92,16 @@ export function AuthDialogHost() {
|
|
|
77
92
|
if (openRef.current) return;
|
|
78
93
|
openRef.current = true;
|
|
79
94
|
openAuthDialogs += 1;
|
|
95
|
+
const { closeOnClickOutside, setClean } = clickOutsideWhileClean();
|
|
80
96
|
void dialog
|
|
81
97
|
.prompt<AuthUser | undefined>({
|
|
82
|
-
closeOnClickOutside
|
|
98
|
+
closeOnClickOutside,
|
|
83
99
|
content: (context: unknown) => (
|
|
84
100
|
<AuthDialog
|
|
85
101
|
{...(context as PromptContext<AuthUser | undefined>)}
|
|
86
102
|
initialMode={request.mode ?? "login"}
|
|
103
|
+
reason={request.reason}
|
|
104
|
+
onCleanChange={setClean}
|
|
87
105
|
/>
|
|
88
106
|
),
|
|
89
107
|
})
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* own panel. The sign-in attempt it shares with onboarding lives in
|
|
5
5
|
* `email-auth-attempt`, the non-React logic in `auth-model`.
|
|
6
6
|
*/
|
|
7
|
-
import { useCallback, useRef, useState, type ReactNode } from "react";
|
|
7
|
+
import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
|
|
8
8
|
import { apiClient, type AuthUser } from "../api-client";
|
|
9
9
|
import { matchesKeyChord, parseKeyChord } from "../app/keybindings";
|
|
10
10
|
import { Button, Spinner, TextField } from "../components";
|
|
@@ -50,6 +50,8 @@ export interface AuthFormProps {
|
|
|
50
50
|
onModeChange?: (mode: AccountMode) => void;
|
|
51
51
|
/** Extra actions below the buttons, e.g. the gate's QR alternative. */
|
|
52
52
|
footer?: ReactNode;
|
|
53
|
+
/** Whether anything is typed in it, so a dialog holding it closes on a stray click only while nothing would be lost. */
|
|
54
|
+
onTypedChange?: (typed: boolean) => void;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export function AuthForm({
|
|
@@ -59,6 +61,7 @@ export function AuthForm({
|
|
|
59
61
|
shortcutScope,
|
|
60
62
|
onModeChange,
|
|
61
63
|
footer,
|
|
64
|
+
onTypedChange,
|
|
62
65
|
}: AuthFormProps) {
|
|
63
66
|
useAppLanguage();
|
|
64
67
|
// The desktop and the web size the column and let its rows fill it, as the kit's dialogs do.
|
|
@@ -70,6 +73,8 @@ export function AuthForm({
|
|
|
70
73
|
const [activeField, setActiveField] = useState<EmailAuthField>("email");
|
|
71
74
|
const [showPassword, setShowPassword] = useState(false);
|
|
72
75
|
const [resetState, setResetState] = useState<ResetState>("idle");
|
|
76
|
+
const typed = email !== "" || password !== "";
|
|
77
|
+
useEffect(() => onTypedChange?.(typed), [onTypedChange, typed]);
|
|
73
78
|
const emailInputRef = useRef<InputRenderable>(null);
|
|
74
79
|
const passwordInputRef = useRef<InputRenderable>(null);
|
|
75
80
|
const {
|
|
@@ -17,7 +17,7 @@ import { t } from "../i18n";
|
|
|
17
17
|
import { useAppLanguage } from "../i18n/react";
|
|
18
18
|
import { useViewport } from "../react/input";
|
|
19
19
|
import { colors } from "../theme/colors";
|
|
20
|
-
import { Box,
|
|
20
|
+
import { Box, useUiCapabilities } from "../ui";
|
|
21
21
|
import { type DialogApi, type PromptContext, useDialogKeyboard } from "../ui/dialog";
|
|
22
22
|
import { logFailure } from "../utils/log-failure";
|
|
23
23
|
import { accountSession } from "./session";
|
|
@@ -187,21 +187,14 @@ function CheckoutHandoffDialog({
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
// The kit's frame, as every other dialog: its close button is a mouse's way out. A click outside never closes
|
|
191
|
+
// it: from the first moment a checkout is being opened or paid for in the browser.
|
|
190
192
|
return (
|
|
191
|
-
<
|
|
192
|
-
<Box
|
|
193
|
-
|
|
193
|
+
<DialogFrame title={title} subtitle={subtitle} footer={t("esc to close")} onClose={dismiss}>
|
|
194
|
+
<Box flexDirection="column" alignItems="center">
|
|
195
|
+
{panel(termHeight - TERMINAL_DIALOG_ROWS)}
|
|
194
196
|
</Box>
|
|
195
|
-
|
|
196
|
-
<Text fg={colors.textDim}>{subtitle}</Text>
|
|
197
|
-
</Box>
|
|
198
|
-
<Box height={1} />
|
|
199
|
-
{panel(termHeight - TERMINAL_DIALOG_ROWS)}
|
|
200
|
-
<Box height={1} />
|
|
201
|
-
<Box height={1}>
|
|
202
|
-
<Text fg={colors.textMuted}>{t("esc to close")}</Text>
|
|
203
|
-
</Box>
|
|
204
|
-
</Box>
|
|
197
|
+
</DialogFrame>
|
|
205
198
|
);
|
|
206
199
|
}
|
|
207
200
|
|
|
@@ -11,13 +11,15 @@ import { t, tf } from "../i18n";
|
|
|
11
11
|
import { useAppLanguage } from "../i18n/react";
|
|
12
12
|
import { useViewport } from "../react/input";
|
|
13
13
|
import { colors } from "../theme/colors";
|
|
14
|
-
import { Box,
|
|
14
|
+
import { Box, useUiCapabilities } from "../ui";
|
|
15
15
|
import { Button } from "../components/ui/button";
|
|
16
16
|
import { DialogActions } from "../components/ui/dialog-actions";
|
|
17
17
|
import { FORM_DIALOG_WIDTH, DialogFrame } from "../components/ui/frame";
|
|
18
18
|
import { SignInCodePanel } from "../components/sign-in-code-panel";
|
|
19
|
-
import { useDialog, useDialogKeyboard, type PromptContext } from "../ui/dialog";
|
|
19
|
+
import { useDialog, useDialogKeyboard, type DialogApi, type PromptContext } from "../ui/dialog";
|
|
20
|
+
import { clickOutsideWhileClean } from "../ui/dialog-stack";
|
|
20
21
|
import { isPlainKey, type KeyboardModifierEventLike } from "../utils/keyboard";
|
|
22
|
+
import { logFailure } from "../utils/log-failure";
|
|
21
23
|
import { DeviceSignInController, type DeviceSignInSnapshot } from "./device-signin";
|
|
22
24
|
|
|
23
25
|
/** How long the approval stays on screen before `onApproved` moves on. */
|
|
@@ -110,12 +112,22 @@ export function DeviceSignInPanel({
|
|
|
110
112
|
const TERMINAL_DIALOG_ROWS = 12;
|
|
111
113
|
const DESKTOP_DIALOG_ROWS = 10;
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
/** Whether the person may be acting on the code now: shown and waiting, or approved and about to close. */
|
|
116
|
+
function isDeviceSignInPending(snapshot: Pick<DeviceSignInSnapshot, "phase">): boolean {
|
|
117
|
+
return snapshot.phase === "waiting" || snapshot.phase === "approved";
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function DeviceSignInDialog({ resolve, dismiss, onCleanChange }: PromptContext<AuthUser | undefined> & {
|
|
121
|
+
/** A click outside closes it only while no code is out: never while one may be approved in the browser. */
|
|
122
|
+
onCleanChange?: (clean: boolean) => void;
|
|
123
|
+
}) {
|
|
114
124
|
useAppLanguage();
|
|
115
125
|
const { nativePaneChrome } = useUiCapabilities();
|
|
116
126
|
const { height: termHeight } = useViewport();
|
|
117
127
|
// Closes on approval after a beat so the confirmation is visible; enter skips the wait.
|
|
118
128
|
const { snapshot, retry } = useDeviceSignIn({ onApproved: resolve });
|
|
129
|
+
const pending = isDeviceSignInPending(snapshot);
|
|
130
|
+
useEffect(() => onCleanChange?.(!pending), [onCleanChange, pending]);
|
|
119
131
|
|
|
120
132
|
useDialogKeyboard((event) => {
|
|
121
133
|
event.stopPropagation();
|
|
@@ -147,24 +159,28 @@ export function DeviceSignInDialog({ resolve, dismiss }: PromptContext<AuthUser
|
|
|
147
159
|
);
|
|
148
160
|
}
|
|
149
161
|
|
|
162
|
+
// The kit's frame, as every other dialog: its close button is a mouse's way out.
|
|
150
163
|
return (
|
|
151
|
-
<
|
|
152
|
-
<Box
|
|
153
|
-
<
|
|
154
|
-
</Box>
|
|
155
|
-
<Box height={1}>
|
|
156
|
-
<Text fg={colors.textDim}>{subtitle}</Text>
|
|
157
|
-
</Box>
|
|
158
|
-
<Box height={1} />
|
|
159
|
-
<DeviceSignInPanel snapshot={snapshot} height={Math.max(4, termHeight - TERMINAL_DIALOG_ROWS)} />
|
|
160
|
-
<Box height={1} />
|
|
161
|
-
<Box height={1}>
|
|
162
|
-
<Text fg={colors.textMuted}>{t("r to refresh the code · esc to cancel")}</Text>
|
|
164
|
+
<DialogFrame title={title} subtitle={subtitle} footer={t("r to refresh the code · esc to cancel")} onClose={dismiss}>
|
|
165
|
+
<Box flexDirection="column" alignItems="center">
|
|
166
|
+
<DeviceSignInPanel snapshot={snapshot} height={Math.max(4, termHeight - TERMINAL_DIALOG_ROWS)} />
|
|
163
167
|
</Box>
|
|
164
|
-
</
|
|
168
|
+
</DialogFrame>
|
|
165
169
|
);
|
|
166
170
|
}
|
|
167
171
|
|
|
172
|
+
/** Gloom's device sign-in as a full dialog, closing on a click outside while no code is out. */
|
|
173
|
+
export function promptDeviceSignIn(dialog: DialogApi): Promise<AuthUser | undefined> {
|
|
174
|
+
const { closeOnClickOutside, setClean } = clickOutsideWhileClean();
|
|
175
|
+
return dialog.prompt<AuthUser | undefined>({
|
|
176
|
+
size: "full",
|
|
177
|
+
closeOnClickOutside,
|
|
178
|
+
content: (context: unknown) => (
|
|
179
|
+
<DeviceSignInDialog {...(context as PromptContext<AuthUser | undefined>)} onCleanChange={setClean} />
|
|
180
|
+
),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
168
184
|
export interface DeviceSignInDialogRequest {
|
|
169
185
|
onSignedIn?: (user: AuthUser) => void;
|
|
170
186
|
}
|
|
@@ -186,19 +202,14 @@ export function DeviceSignInDialogHost() {
|
|
|
186
202
|
const listener = (request: DeviceSignInDialogRequest) => {
|
|
187
203
|
if (openRef.current) return;
|
|
188
204
|
openRef.current = true;
|
|
189
|
-
void dialog
|
|
190
|
-
.prompt<AuthUser | undefined>({
|
|
191
|
-
size: "full",
|
|
192
|
-
content: (context: unknown) => (
|
|
193
|
-
<DeviceSignInDialog {...(context as PromptContext<AuthUser | undefined>)} />
|
|
194
|
-
),
|
|
195
|
-
})
|
|
205
|
+
void promptDeviceSignIn(dialog)
|
|
196
206
|
.then((signedInUser) => {
|
|
197
207
|
if (signedInUser) request.onSignedIn?.(signedInUser);
|
|
198
208
|
})
|
|
199
209
|
.finally(() => {
|
|
200
210
|
openRef.current = false;
|
|
201
|
-
})
|
|
211
|
+
})
|
|
212
|
+
.catch(logFailure("account.device-signin-dialog", "Device sign-in dialog failed"));
|
|
202
213
|
};
|
|
203
214
|
dialogRequestListeners.add(listener);
|
|
204
215
|
return () => {
|
|
@@ -28,6 +28,16 @@ interface CryptoDayRange {
|
|
|
28
28
|
highAt: string;
|
|
29
29
|
start: string;
|
|
30
30
|
end: string;
|
|
31
|
+
/**
|
|
32
|
+
* The spot exchanges whose own 24-hour low reached `low`; one of several checked makes the low that exchange's,
|
|
33
|
+
* not the market's. Absent from a server that does not check, or when no exchange could be read.
|
|
34
|
+
*/
|
|
35
|
+
lowVenues?: string[];
|
|
36
|
+
highVenues?: string[];
|
|
37
|
+
/** The exchanges whose own 24-hour range was read beside the composite's. */
|
|
38
|
+
venuesChecked?: string[];
|
|
39
|
+
/** The exchanges' own candles around the extremes are still being read: a later answer names them. */
|
|
40
|
+
venuesPending?: boolean;
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
export interface CryptoMarketAsset {
|
package/src/api-client/errors.ts
CHANGED
|
@@ -165,7 +165,9 @@ export function parseApiErrorMessage(body: string): string {
|
|
|
165
165
|
(value): value is string =>
|
|
166
166
|
typeof value === "string" && value.trim().length > 0,
|
|
167
167
|
);
|
|
168
|
-
|
|
168
|
+
// A route can send the schema's refusal as its message, the same object written out as text.
|
|
169
|
+
const wrapped = parts.length === 1 ? parseApiErrorDetails(parts[0]!) : undefined;
|
|
170
|
+
return (wrapped && validationErrorText(wrapped)) || parts.join(" ") || validationErrorText(record) || NO_MESSAGE;
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
const NO_MESSAGE = "The server returned an error without a message.";
|
package/src/api-client/index.ts
CHANGED
|
@@ -27,11 +27,13 @@ import { CloudApiSocket } from "./socket";
|
|
|
27
27
|
import { CloudCollectionsApi } from "./collections";
|
|
28
28
|
import { CloudFeedbackApi } from "./feedback";
|
|
29
29
|
import { CloudRoadmapApi } from "./roadmap";
|
|
30
|
+
import { CloudWaitlistApi } from "./product-waitlist";
|
|
30
31
|
import { CloudNotesApi } from "./notes";
|
|
31
32
|
import { CloudTeamsApi } from "./teams";
|
|
32
33
|
import { CloudTelemetryApi } from "./telemetry";
|
|
33
34
|
import { CloudThesesApi } from "./theses";
|
|
34
35
|
import { CloudViewsApi } from "./views";
|
|
36
|
+
import { readYearlyPlanStatus, readYearlyResult, readYearlyReview } from "./yearly-plan";
|
|
35
37
|
import type { CommandSearchReport } from "./telemetry";
|
|
36
38
|
import type {
|
|
37
39
|
AssistCommandDescriptor,
|
|
@@ -39,6 +41,9 @@ import type {
|
|
|
39
41
|
AuthUser,
|
|
40
42
|
CloudCancelFeedback,
|
|
41
43
|
CloudSyncPushResponse,
|
|
44
|
+
CloudYearlyPlanStatus,
|
|
45
|
+
CloudYearlyResult,
|
|
46
|
+
CloudYearlyReview,
|
|
42
47
|
CloudSyncSnapshotResponse,
|
|
43
48
|
PersistedAuthUser
|
|
44
49
|
} from "./types";
|
|
@@ -49,6 +54,7 @@ export type { ChatPaneLink } from "./chat-pane-link";
|
|
|
49
54
|
export { NoteConflictError } from "./notes";
|
|
50
55
|
export { ThesisConflictError, ThesisGoalpostError } from "./theses";
|
|
51
56
|
export { TeamRevisionConflictError } from "./views";
|
|
57
|
+
export { yearlyRefusalCode } from "./yearly-plan";
|
|
52
58
|
export type * from "./types";
|
|
53
59
|
export type {
|
|
54
60
|
CommandSearchChoice,
|
|
@@ -183,6 +189,7 @@ class GloomApiClient {
|
|
|
183
189
|
private readonly notes: CloudNotesApi = new CloudNotesApi((path, options) => this.request(path, options));
|
|
184
190
|
private readonly feedback: CloudFeedbackApi = new CloudFeedbackApi((path, options) => this.request(path, options));
|
|
185
191
|
private readonly roadmap: CloudRoadmapApi = new CloudRoadmapApi((path, options) => this.request(path, options));
|
|
192
|
+
private readonly waitlist: CloudWaitlistApi = new CloudWaitlistApi((path, options) => this.request(path, options));
|
|
186
193
|
private readonly telemetry: CloudTelemetryApi = new CloudTelemetryApi((path, options) => this.request(path, options));
|
|
187
194
|
private readonly theses: CloudThesesApi = new CloudThesesApi((path, options) => this.request(path, options));
|
|
188
195
|
private readonly collections: CloudCollectionsApi = new CloudCollectionsApi((path, options) => this.request(path, options));
|
|
@@ -629,6 +636,50 @@ class GloomApiClient {
|
|
|
629
636
|
return this.request<{ url: string }>("/stripe/portal", { method: "POST", body: JSON.stringify({}) });
|
|
630
637
|
}
|
|
631
638
|
|
|
639
|
+
async createInvoicePayment(): Promise<{ url: string }> {
|
|
640
|
+
const result = await this.request<{ url: string }>("/stripe/pay-invoice", {
|
|
641
|
+
method: "POST",
|
|
642
|
+
body: JSON.stringify({}),
|
|
643
|
+
});
|
|
644
|
+
const url = new URL(result.url);
|
|
645
|
+
if (url.origin !== "https://invoice.stripe.com" || url.username || url.password) {
|
|
646
|
+
throw new Error("Could not open invoice payment.");
|
|
647
|
+
}
|
|
648
|
+
return { url: url.href };
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/** Whether this account's monthly Pro can move to yearly billing; reads only. */
|
|
652
|
+
async getCloudYearlyPlan(): Promise<CloudYearlyPlanStatus> {
|
|
653
|
+
return readYearlyPlanStatus(await this.request<unknown>("/stripe/subscription/yearly", { method: "GET" }));
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** The exact charge of switching to yearly now. Charges nothing. */
|
|
657
|
+
async previewCloudYearlyPlan(): Promise<CloudYearlyReview> {
|
|
658
|
+
const body = await this.request<{ review?: unknown }>("/stripe/subscription/yearly/preview", {
|
|
659
|
+
method: "POST",
|
|
660
|
+
body: JSON.stringify({}),
|
|
661
|
+
});
|
|
662
|
+
const review = readYearlyReview(body?.review);
|
|
663
|
+
if (!review) throw new Error("Couldn't work out the yearly total. Try again in a minute.");
|
|
664
|
+
return review;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Switches to yearly billing for exactly what `token`'s review showed. Call it
|
|
669
|
+
* only after the person confirmed that review. Refusals (a total that moved,
|
|
670
|
+
* a switch already going through) are ApiRequestErrors; `yearlyRefusalCode`
|
|
671
|
+
* names them.
|
|
672
|
+
*/
|
|
673
|
+
async confirmCloudYearlyPlan(token: string): Promise<CloudYearlyResult> {
|
|
674
|
+
const body = await this.request<unknown>("/stripe/subscription/yearly/confirm", {
|
|
675
|
+
method: "POST",
|
|
676
|
+
body: JSON.stringify({ token }),
|
|
677
|
+
});
|
|
678
|
+
const result = readYearlyResult(body);
|
|
679
|
+
if (!result) throw new Error("We couldn't confirm the switch. Refresh your account before trying again.");
|
|
680
|
+
return result;
|
|
681
|
+
}
|
|
682
|
+
|
|
632
683
|
/**
|
|
633
684
|
* Ends the Pro trial and Pro now, unbilled. Call it only once the person
|
|
634
685
|
* confirmed a warning that says so. `endedNow` is false when the server
|
|
@@ -931,6 +982,9 @@ class GloomApiClient {
|
|
|
931
982
|
listFeedback = this.feedback.listFeedback.bind(this.feedback);
|
|
932
983
|
getRoadmap = this.roadmap.getRoadmap.bind(this.roadmap);
|
|
933
984
|
setRoadmapVote = this.roadmap.setRoadmapVote.bind(this.roadmap);
|
|
985
|
+
getWaitlist = this.waitlist.getWaitlist.bind(this.waitlist);
|
|
986
|
+
joinWaitlist = this.waitlist.joinWaitlist.bind(this.waitlist);
|
|
987
|
+
leaveWaitlist = this.waitlist.leaveWaitlist.bind(this.waitlist);
|
|
934
988
|
reportCrashErrors = this.telemetry.reportCrashErrors.bind(this.telemetry);
|
|
935
989
|
reportUsageCounts = this.telemetry.reportUsageCounts.bind(this.telemetry);
|
|
936
990
|
reportInstallExperiment = this.telemetry.reportInstallExperiment.bind(this.telemetry);
|
|
@@ -5,18 +5,19 @@
|
|
|
5
5
|
* The registry and the bucketing live with the Gloom Cloud API, as they do for
|
|
6
6
|
* the web terminal's experiments (web-experiments.ts). The app asks for its
|
|
7
7
|
* arm at the moment an experiment's change would show, in every arm
|
|
8
|
-
* (`experiment_assign
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* usage counts already go under
|
|
12
|
-
*
|
|
13
|
-
* here without a release.
|
|
8
|
+
* (`experiment_assign`), and once it has gone on with that arm it confirms
|
|
9
|
+
* it (`experiment_exposed`). The API records the assignment as
|
|
10
|
+
* `experiment_assigned` and the confirmation as `experiment_exposed`, both
|
|
11
|
+
* under `install:<id>`, the id its usage counts already go under. Later usage
|
|
12
|
+
* can read against the assigned arm or the arm it saw. Turning an experiment
|
|
13
|
+
* off there takes effect here without a release.
|
|
14
14
|
*
|
|
15
15
|
* It is covered by the Usage setting and sends nothing with it off, under
|
|
16
16
|
* Do Not Track or Global Privacy Control, or in an automated browser: those
|
|
17
17
|
* installs get the control and are not counted. An answer that fails or
|
|
18
18
|
* comes too late gets the control too, so the change never holds anything
|
|
19
|
-
* up, and confirms nothing: an install never
|
|
19
|
+
* up, and confirms nothing: an install never confirms an exposure to an arm
|
|
20
|
+
* it did not see.
|
|
20
21
|
*/
|
|
21
22
|
import { apiClient, type InstallExperimentAnswer, type InstallExperimentReport } from "./index";
|
|
22
23
|
import { VERSION } from "../version";
|
|
@@ -37,6 +37,13 @@ export interface MoneyMarketRow {
|
|
|
37
37
|
fetchedAt: string | null;
|
|
38
38
|
unavailableReason: "source-unavailable" | "metadata-unavailable" | "metadata-mismatch" | "no-observations" | "components-unavailable" | null;
|
|
39
39
|
notes: string[];
|
|
40
|
+
/** A bill's coupon equivalent (investment rate), percent, beside its discount-basis `value`; on bill rows only. */
|
|
41
|
+
couponEquivalent?: number | null;
|
|
42
|
+
couponEquivalentAsOf?: string | null;
|
|
43
|
+
/** Who published the row's latest value (`U.S. Treasury`, `FRED`); older servers send none. */
|
|
44
|
+
sourceName?: string;
|
|
45
|
+
/** When the publisher last changed what was read, when it says. */
|
|
46
|
+
publishedAt?: string | null;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
interface BillSnapshot {
|
package/src/api-client/paths.ts
CHANGED
|
@@ -125,7 +125,8 @@ function normalizeCloudLogoSymbol(
|
|
|
125
125
|
symbol: string,
|
|
126
126
|
): string | null {
|
|
127
127
|
let normalized = symbol.trim().toUpperCase();
|
|
128
|
-
|
|
128
|
+
// A coin is its code alone: BTC-USD:CCC and BTC/USDT are both BTC.
|
|
129
|
+
if (kind === "crypto") normalized = parsePublicTickerKey(normalized).symbol.replace(CRYPTO_QUOTE, "");
|
|
129
130
|
return LOGO_SYMBOL_RE.test(normalized) ? normalized : null;
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ApiRequestError } from "./errors";
|
|
2
|
+
import type { CloudApiRequest } from "./request";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The no-charge waitlist for an add-on that is not built yet. The signed-in
|
|
6
|
+
* account reads its place on the list, joins it (agreeing to one email if the
|
|
7
|
+
* add-on launches) and leaves it. The service takes the account and its
|
|
8
|
+
* address from the session: nothing here sends either. The address must be
|
|
9
|
+
* verified, since joining consents to email it: the service refuses every
|
|
10
|
+
* call of an unverified account with a 403.
|
|
11
|
+
*/
|
|
12
|
+
export type WaitlistProduct = "pharma-signals";
|
|
13
|
+
|
|
14
|
+
/** The service's 403 for an account whose address is not verified. */
|
|
15
|
+
const EMAIL_VERIFICATION_REQUIRED = "Email verification required";
|
|
16
|
+
|
|
17
|
+
/** Whether the waitlist refused a call because the account's address is not verified yet. */
|
|
18
|
+
export function isEmailVerificationRequired(error: unknown): boolean {
|
|
19
|
+
return error instanceof ApiRequestError && error.status === 403 && error.message === EMAIL_VERIFICATION_REQUIRED;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface WaitlistState {
|
|
23
|
+
product: WaitlistProduct;
|
|
24
|
+
joined: boolean;
|
|
25
|
+
/** ISO time of the latest join while on the list; null off it. */
|
|
26
|
+
joinedAt: string | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
30
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function parseWaitlistState(value: unknown, product: WaitlistProduct): WaitlistState {
|
|
34
|
+
if (!isRecord(value) || value.product !== product || typeof value.joined !== "boolean") {
|
|
35
|
+
throw new Error("The waitlist service returned invalid data.");
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
product,
|
|
39
|
+
joined: value.joined,
|
|
40
|
+
joinedAt: value.joined && typeof value.joinedAt === "string" ? value.joinedAt : null,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export class CloudWaitlistApi {
|
|
45
|
+
constructor(private readonly request: CloudApiRequest) {}
|
|
46
|
+
|
|
47
|
+
async getWaitlist(product: WaitlistProduct, signal?: AbortSignal): Promise<WaitlistState> {
|
|
48
|
+
return parseWaitlistState(await this.request<unknown>(`/account/waitlist/${product}`, { signal }), product);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Joins, or changes nothing when already on the list. The body is the consent: one email at launch. */
|
|
52
|
+
async joinWaitlist(product: WaitlistProduct): Promise<WaitlistState> {
|
|
53
|
+
return parseWaitlistState(await this.request<unknown>(`/account/waitlist/${product}`, {
|
|
54
|
+
method: "PUT",
|
|
55
|
+
body: JSON.stringify({ launchEmail: true }),
|
|
56
|
+
}), product);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Leaves the list, which takes the launch email back; leaving when off it changes nothing. */
|
|
60
|
+
async leaveWaitlist(product: WaitlistProduct): Promise<WaitlistState> {
|
|
61
|
+
return parseWaitlistState(await this.request<unknown>(`/account/waitlist/${product}`, { method: "DELETE" }), product);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { logFailure } from "../utils/log-failure";
|
|
2
|
+
import { debugLog } from "../utils/debug-log";
|
|
2
3
|
import { httpFetch, isHttpFetchStreaming } from "../utils/http-transport";
|
|
3
4
|
import { OperationTimeoutError } from "../utils/async-deadline";
|
|
4
5
|
import {
|
|
@@ -18,6 +19,9 @@ import {
|
|
|
18
19
|
import { SESSION_COOKIE_NAMES } from "./session-cookie";
|
|
19
20
|
import { asDataServiceFailure, DataServiceUnreachableError, isDroppedConnection } from "../utils/network-failure";
|
|
20
21
|
|
|
22
|
+
/** Request failures with the endpoint they were for, which their messages leave out. */
|
|
23
|
+
const requestLog = debugLog.createLogger("cloud-api");
|
|
24
|
+
|
|
21
25
|
/** The public Gloom Cloud API, which the web app's same-origin `/api` path forwards to. */
|
|
22
26
|
export const DEFAULT_API_URL = "https://api.gloom.sh";
|
|
23
27
|
/**
|
|
@@ -303,7 +307,8 @@ export async function putWithRevision<T, Current extends { revision: number }>(
|
|
|
303
307
|
* beside a list check that still answers for the listing itself. Nor the
|
|
304
308
|
* batched searches and ticker changes a list of symbols starts with: a service
|
|
305
309
|
* without them answers 404, and whatever they leave unanswered is looked up
|
|
306
|
-
* one symbol at a time, which is tracked.
|
|
310
|
+
* one symbol at a time, which is tracked. Nor the Pro tab's yearly billing
|
|
311
|
+
* status: a server without it answers 404 and the tab shows no yearly row.
|
|
307
312
|
*/
|
|
308
313
|
function isBackgroundRequest(path: string): boolean {
|
|
309
314
|
return path.startsWith("/telemetry/")
|
|
@@ -314,7 +319,8 @@ function isBackgroundRequest(path: string): boolean {
|
|
|
314
319
|
|| path.startsWith("/market/issuer-listings?")
|
|
315
320
|
|| path === "/market/ticker-changes/batch"
|
|
316
321
|
|| path === "/market/search/batch"
|
|
317
|
-
|| path === "/market/organization-tickers"
|
|
322
|
+
|| path === "/market/organization-tickers"
|
|
323
|
+
|| path === "/stripe/subscription/yearly";
|
|
318
324
|
}
|
|
319
325
|
|
|
320
326
|
function throwIfRequestAborted(signal: AbortSignal | null | undefined): void {
|
|
@@ -577,11 +583,17 @@ export class CloudApiRequestTransport {
|
|
|
577
583
|
const answered = () => this.answers > answersAtStart;
|
|
578
584
|
const generation = cloudApiTransportGeneration;
|
|
579
585
|
const what = path.startsWith("/market/") ? "Cloud market request" : "Cloud request";
|
|
580
|
-
|
|
586
|
+
// The endpoint stays out of the message, which reports and panes print; the debug log's line names it.
|
|
587
|
+
const endpoint = path.split("?")[0]!;
|
|
588
|
+
const failed = (message: string) => {
|
|
589
|
+
requestLog.warn(message, { endpoint });
|
|
590
|
+
return new OperationTimeoutError(message);
|
|
591
|
+
};
|
|
592
|
+
const timedOut = (ms: number) => failed(`${what} timed out after ${ms}ms`);
|
|
581
593
|
const timers: Array<ReturnType<typeof setTimeout>> = [];
|
|
582
594
|
if (this.hungAt != null && Date.now() - this.hungAt < HUNG_FAIL_FAST_MS && !controller.signal.aborted) {
|
|
583
595
|
callerSignal?.removeEventListener("abort", abortFromCaller);
|
|
584
|
-
throw new DataServiceUnreachableError(
|
|
596
|
+
throw new DataServiceUnreachableError(failed(`${what} not sent: the last one got no answer`));
|
|
585
597
|
}
|
|
586
598
|
this.pending += 1;
|
|
587
599
|
try {
|