@agg-build/ui 1.2.9 → 1.2.11

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.
Files changed (100) hide show
  1. package/dist/{chunk-PFOSEY46.mjs → chunk-3ZSNHGAB.mjs} +835 -401
  2. package/dist/{chunk-5PSAIGOT.mjs → chunk-54PCEK6G.mjs} +137 -61
  3. package/dist/{chunk-7JKGAWU5.mjs → chunk-ENAGASVU.mjs} +1538 -1369
  4. package/dist/{chunk-K23CJ5UP.mjs → chunk-J7K2U44E.mjs} +481 -258
  5. package/dist/{chunk-5MDFM2MX.mjs → chunk-NWJHFGBZ.mjs} +1 -1
  6. package/dist/{chunk-QFW5NDJ6.mjs → chunk-SJLHOAKK.mjs} +1001 -1015
  7. package/dist/{chunk-PYKD4W4T.mjs → chunk-YP75TIY6.mjs} +601 -326
  8. package/dist/events.js +2038 -1559
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +5417 -4261
  11. package/dist/index.mjs +56 -50
  12. package/dist/modals.js +3262 -2384
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +3677 -2709
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +992 -918
  17. package/dist/primitives.mjs +5 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +1360 -1129
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/deposit/deposit-modal.types.d.mts +10 -1
  23. package/dist/types/deposit/deposit-modal.types.d.ts +10 -1
  24. package/dist/types/deposit/index.d.mts +1 -1
  25. package/dist/types/deposit/index.d.ts +1 -1
  26. package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -2
  27. package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -2
  28. package/dist/types/deposit/steps/deposit-method.d.mts +2 -1
  29. package/dist/types/deposit/steps/deposit-method.d.ts +2 -1
  30. package/dist/types/events/item/event-list-item.types.d.mts +3 -1
  31. package/dist/types/events/item/event-list-item.types.d.ts +3 -1
  32. package/dist/types/events/item/event-list-item.utils.d.mts +26 -2
  33. package/dist/types/events/item/event-list-item.utils.d.ts +26 -2
  34. package/dist/types/events/item-details/event-list-item-details.types.d.mts +30 -1
  35. package/dist/types/events/item-details/event-list-item-details.types.d.ts +30 -1
  36. package/dist/types/events/market-details/index.d.mts +1 -1
  37. package/dist/types/events/market-details/index.d.ts +1 -1
  38. package/dist/types/events/market-details/market-details.types.d.mts +27 -2
  39. package/dist/types/events/market-details/market-details.types.d.ts +27 -2
  40. package/dist/types/events/market-details/market-details.utils.d.mts +18 -4
  41. package/dist/types/events/market-details/market-details.utils.d.ts +18 -4
  42. package/dist/types/events/market-details/orderbook-aggregation.d.mts +38 -2
  43. package/dist/types/events/market-details/orderbook-aggregation.d.ts +38 -2
  44. package/dist/types/events/shared/chart-auto-fallback.d.mts +43 -0
  45. package/dist/types/events/shared/chart-auto-fallback.d.ts +43 -0
  46. package/dist/types/events/shared/display-outcome-price.d.mts +14 -0
  47. package/dist/types/events/shared/display-outcome-price.d.ts +14 -0
  48. package/dist/types/events/shared/display-outcome-venue.d.mts +30 -0
  49. package/dist/types/events/shared/display-outcome-venue.d.ts +30 -0
  50. package/dist/types/events/shared/display-reference-price.d.mts +4 -0
  51. package/dist/types/events/shared/display-reference-price.d.ts +4 -0
  52. package/dist/types/events/shared/select-outcome-price.d.mts +21 -0
  53. package/dist/types/events/shared/select-outcome-price.d.ts +21 -0
  54. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
  55. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
  56. package/dist/types/pages/user-profile/components/positions-value-card.d.mts +2 -1
  57. package/dist/types/pages/user-profile/components/positions-value-card.d.ts +2 -1
  58. package/dist/types/pages/user-profile/index.d.mts +2 -2
  59. package/dist/types/pages/user-profile/index.d.ts +2 -2
  60. package/dist/types/pages/user-profile/user-profile.types.d.mts +54 -1
  61. package/dist/types/pages/user-profile/user-profile.types.d.ts +54 -1
  62. package/dist/types/primitives/chart/chart.utils.d.mts +9 -10
  63. package/dist/types/primitives/chart/chart.utils.d.ts +9 -10
  64. package/dist/types/primitives/icon/index.d.mts +2 -1
  65. package/dist/types/primitives/icon/index.d.ts +2 -1
  66. package/dist/types/primitives/icon/registry.d.mts +8 -0
  67. package/dist/types/primitives/icon/registry.d.ts +8 -0
  68. package/dist/types/primitives/icon/svg/circle-xmark.d.mts +5 -0
  69. package/dist/types/primitives/icon/svg/circle-xmark.d.ts +5 -0
  70. package/dist/types/primitives/icon/svg/spinner.d.mts +5 -0
  71. package/dist/types/primitives/icon/svg/spinner.d.ts +5 -0
  72. package/dist/types/primitives/toast/index.d.mts +2 -0
  73. package/dist/types/primitives/toast/index.d.ts +2 -0
  74. package/dist/types/primitives/tooltip/tooltip.types.d.mts +1 -0
  75. package/dist/types/primitives/tooltip/tooltip.types.d.ts +1 -0
  76. package/dist/types/primitives/typography/index.d.mts +1 -1
  77. package/dist/types/primitives/typography/index.d.ts +1 -1
  78. package/dist/types/primitives/typography/typography.types.d.mts +2 -0
  79. package/dist/types/primitives/typography/typography.types.d.ts +2 -0
  80. package/dist/types/shared/transfer-fee-summary.d.mts +10 -0
  81. package/dist/types/shared/transfer-fee-summary.d.ts +10 -0
  82. package/dist/types/shared/utils.d.mts +3 -0
  83. package/dist/types/shared/utils.d.ts +3 -0
  84. package/dist/types/trading/place-order/index.d.mts +1 -1
  85. package/dist/types/trading/place-order/index.d.ts +1 -1
  86. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +9 -0
  87. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +9 -0
  88. package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -2
  89. package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -2
  90. package/dist/types/trading/place-order/index.place-order.utils.d.mts +49 -6
  91. package/dist/types/trading/place-order/index.place-order.utils.d.ts +49 -6
  92. package/dist/types/withdraw/index.d.mts +1 -1
  93. package/dist/types/withdraw/index.d.ts +1 -1
  94. package/dist/types/withdraw/steps/withdraw-success.d.mts +13 -7
  95. package/dist/types/withdraw/steps/withdraw-success.d.ts +13 -7
  96. package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +2 -0
  97. package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +2 -0
  98. package/dist/types/withdraw/withdraw-modal.types.d.mts +5 -0
  99. package/dist/types/withdraw/withdraw-modal.types.d.ts +5 -0
  100. package/package.json +3 -3
package/dist/trading.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  SettlementDetails,
7
7
  parseAmount,
8
8
  parseVenue
9
- } from "./chunk-K23CJ5UP.mjs";
9
+ } from "./chunk-J7K2U44E.mjs";
10
10
  import {
11
11
  SETTLEMENT_SECTION_ID,
12
12
  Settlement,
@@ -21,9 +21,9 @@ import {
21
21
  getTradingValueLabel,
22
22
  getTradingVenueLabel,
23
23
  useEventTradingContext
24
- } from "./chunk-5PSAIGOT.mjs";
25
- import "./chunk-5MDFM2MX.mjs";
26
- import "./chunk-QFW5NDJ6.mjs";
24
+ } from "./chunk-54PCEK6G.mjs";
25
+ import "./chunk-NWJHFGBZ.mjs";
26
+ import "./chunk-SJLHOAKK.mjs";
27
27
  export {
28
28
  PlaceOrder,
29
29
  PlaceOrderFailureView,
@@ -77,9 +77,10 @@ export interface WalletDepositFlowData {
77
77
  */
78
78
  successSummary?: Partial<WalletDepositSummary>;
79
79
  }
80
- /** Optional config for the "Send crypto" tab. All fields have sensible defaults. */
80
+ /** Optional config for the "Send crypto" tab. Fee estimates are derived from the shared estimator. */
81
81
  export interface SendCryptoConfig {
82
82
  minDeposit?: string;
83
+ /** @deprecated Send crypto now derives fees from the shared transfer estimator. */
83
84
  feeEstimate?: string;
84
85
  eta?: string;
85
86
  }
@@ -129,6 +130,14 @@ export interface DepositModalControlledProps {
129
130
  onConfirmWalletDeposit?: (params: WalletDepositConfirmParams) => Promise<void> | void;
130
131
  /** Called after the wallet deposit flow reaches its completion state. */
131
132
  onDoneWalletDeposit?: () => void;
133
+ /**
134
+ * Called when the user backs out of the wallet processing screen — e.g.
135
+ * after a wallet popup was dismissed silently or an in-flight tx was
136
+ * canceled/replaced from the wallet UI without a clean error. The hook
137
+ * implementation should clear any pending transaction state so a retry
138
+ * starts fresh. The modal handles returning to the wallet form on its own.
139
+ */
140
+ onCancelWalletDeposit?: () => void;
132
141
  /**
133
142
  * Fired whenever the wallet-flow network dropdown changes (including the
134
143
  * initial auto-select). The parent can use this to read the on-chain
@@ -77,9 +77,10 @@ export interface WalletDepositFlowData {
77
77
  */
78
78
  successSummary?: Partial<WalletDepositSummary>;
79
79
  }
80
- /** Optional config for the "Send crypto" tab. All fields have sensible defaults. */
80
+ /** Optional config for the "Send crypto" tab. Fee estimates are derived from the shared estimator. */
81
81
  export interface SendCryptoConfig {
82
82
  minDeposit?: string;
83
+ /** @deprecated Send crypto now derives fees from the shared transfer estimator. */
83
84
  feeEstimate?: string;
84
85
  eta?: string;
85
86
  }
@@ -129,6 +130,14 @@ export interface DepositModalControlledProps {
129
130
  onConfirmWalletDeposit?: (params: WalletDepositConfirmParams) => Promise<void> | void;
130
131
  /** Called after the wallet deposit flow reaches its completion state. */
131
132
  onDoneWalletDeposit?: () => void;
133
+ /**
134
+ * Called when the user backs out of the wallet processing screen — e.g.
135
+ * after a wallet popup was dismissed silently or an in-flight tx was
136
+ * canceled/replaced from the wallet UI without a clean error. The hook
137
+ * implementation should clear any pending transaction state so a retry
138
+ * starts fresh. The modal handles returning to the wallet form on its own.
139
+ */
140
+ onCancelWalletDeposit?: () => void;
132
141
  /**
133
142
  * Fired whenever the wallet-flow network dropdown changes (including the
134
143
  * initial auto-select). The parent can use this to read the on-chain
@@ -1,5 +1,5 @@
1
1
  import type { DepositModalProps } from "./deposit-modal.types";
2
- export type { CardFlowData, CardProviderOption, CardTransactionStatus, DepositMethod, DepositModalControlledProps, DepositModalProps, DepositSelectOption, SendCryptoConfig, VenueBalance, DepositModalSelfDrivenProps, WalletDepositConfirmParams, WalletDepositFlowData, WalletTransactionStatus, } from "./deposit-modal.types";
2
+ export type { CardFlowData, CardProviderOption, CardTransactionStatus, DepositMethod, DepositModalControlledProps, DepositModalProps, DepositModalSelfDrivenProps, DepositSelectOption, SendCryptoConfig, VenueBalance, WalletDepositConfirmParams, WalletDepositFlowData, WalletTransactionStatus, } from "./deposit-modal.types";
3
3
  export { CARD_NETWORK_OPTIONS } from "./deposit-modal.constants";
4
4
  interface PendingCardSession {
5
5
  sessionId: string;
@@ -1,5 +1,5 @@
1
1
  import type { DepositModalProps } from "./deposit-modal.types";
2
- export type { CardFlowData, CardProviderOption, CardTransactionStatus, DepositMethod, DepositModalControlledProps, DepositModalProps, DepositSelectOption, SendCryptoConfig, VenueBalance, DepositModalSelfDrivenProps, WalletDepositConfirmParams, WalletDepositFlowData, WalletTransactionStatus, } from "./deposit-modal.types";
2
+ export type { CardFlowData, CardProviderOption, CardTransactionStatus, DepositMethod, DepositModalControlledProps, DepositModalProps, DepositModalSelfDrivenProps, DepositSelectOption, SendCryptoConfig, VenueBalance, WalletDepositConfirmParams, WalletDepositFlowData, WalletTransactionStatus, } from "./deposit-modal.types";
3
3
  export { CARD_NETWORK_OPTIONS } from "./deposit-modal.constants";
4
4
  interface PendingCardSession {
5
5
  sessionId: string;
@@ -6,7 +6,6 @@ export interface CryptoTransferStepProps {
6
6
  selectedNetwork: string;
7
7
  depositAddress: string;
8
8
  minDeposit: string;
9
- feeEstimate: string;
10
9
  eta: string;
11
10
  isLoadingAddress?: boolean;
12
11
  addressError?: string;
@@ -16,4 +15,4 @@ export interface CryptoTransferStepProps {
16
15
  onCopyAddress?: () => void;
17
16
  onDone: () => void;
18
17
  }
19
- export declare const CryptoTransferStep: ({ tokenOptions, networkOptions, selectedToken, selectedNetwork, depositAddress, minDeposit, feeEstimate, eta, isLoadingAddress, addressError, onBack, onTokenChange, onNetworkChange, onCopyAddress, onDone, }: CryptoTransferStepProps) => JSX.Element;
18
+ export declare const CryptoTransferStep: ({ tokenOptions, networkOptions, selectedToken, selectedNetwork, depositAddress, minDeposit, eta, isLoadingAddress, addressError, onBack, onTokenChange, onNetworkChange, onCopyAddress, onDone, }: CryptoTransferStepProps) => JSX.Element;
@@ -6,7 +6,6 @@ export interface CryptoTransferStepProps {
6
6
  selectedNetwork: string;
7
7
  depositAddress: string;
8
8
  minDeposit: string;
9
- feeEstimate: string;
10
9
  eta: string;
11
10
  isLoadingAddress?: boolean;
12
11
  addressError?: string;
@@ -16,4 +15,4 @@ export interface CryptoTransferStepProps {
16
15
  onCopyAddress?: () => void;
17
16
  onDone: () => void;
18
17
  }
19
- export declare const CryptoTransferStep: ({ tokenOptions, networkOptions, selectedToken, selectedNetwork, depositAddress, minDeposit, feeEstimate, eta, isLoadingAddress, addressError, onBack, onTokenChange, onNetworkChange, onCopyAddress, onDone, }: CryptoTransferStepProps) => JSX.Element;
18
+ export declare const CryptoTransferStep: ({ tokenOptions, networkOptions, selectedToken, selectedNetwork, depositAddress, minDeposit, eta, isLoadingAddress, addressError, onBack, onTokenChange, onNetworkChange, onCopyAddress, onDone, }: CryptoTransferStepProps) => JSX.Element;
@@ -3,10 +3,11 @@ export interface DepositMethodStepProps {
3
3
  balance: number;
4
4
  walletLabel: string;
5
5
  walletBalance: number;
6
+ walletToken: string;
6
7
  isWalletBalanceLoading?: boolean;
7
8
  showWalletMethod?: boolean;
8
9
  highlightedMethod?: DepositMethod;
9
10
  depositAddressesReady?: boolean;
10
11
  onSelectMethod: (method: DepositMethod) => void;
11
12
  }
12
- export declare const DepositMethodStep: ({ balance, walletLabel, walletBalance, isWalletBalanceLoading, showWalletMethod, highlightedMethod, depositAddressesReady, onSelectMethod, }: DepositMethodStepProps) => JSX.Element;
13
+ export declare const DepositMethodStep: ({ balance, walletLabel, walletBalance, walletToken, isWalletBalanceLoading, showWalletMethod, highlightedMethod, depositAddressesReady, onSelectMethod, }: DepositMethodStepProps) => JSX.Element;
@@ -3,10 +3,11 @@ export interface DepositMethodStepProps {
3
3
  balance: number;
4
4
  walletLabel: string;
5
5
  walletBalance: number;
6
+ walletToken: string;
6
7
  isWalletBalanceLoading?: boolean;
7
8
  showWalletMethod?: boolean;
8
9
  highlightedMethod?: DepositMethod;
9
10
  depositAddressesReady?: boolean;
10
11
  onSelectMethod: (method: DepositMethod) => void;
11
12
  }
12
- export declare const DepositMethodStep: ({ balance, walletLabel, walletBalance, isWalletBalanceLoading, showWalletMethod, highlightedMethod, depositAddressesReady, onSelectMethod, }: DepositMethodStepProps) => JSX.Element;
13
+ export declare const DepositMethodStep: ({ balance, walletLabel, walletBalance, walletToken, isWalletBalanceLoading, showWalletMethod, highlightedMethod, depositAddressesReady, onSelectMethod, }: DepositMethodStepProps) => JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { VenueEventWithMarkets, VenueMarket, VenueMarketOutcome } from "@agg-build/hooks";
1
+ import type { MarketStatus, VenueEventWithMarkets, VenueMarket, VenueMarketOutcome } from "@agg-build/hooks";
2
2
  export type { VenueEventWithMarkets, VenueMarket, VenueMarketOutcome };
3
3
  export type EventListItemEvent = VenueEventWithMarkets;
4
4
  export type EventListItemVenueInfo = {
@@ -37,6 +37,8 @@ export type EventListItemBaseProps = {
37
37
  href?: string;
38
38
  /** Accessible label applied to the clickable card element. */
39
39
  ariaLabel?: string;
40
+ /** When set, scopes the lazy market fetch (used to expand the card chips beyond the inline set) to markets matching this status. The parent list passes its own status filter so the expanded chips stay consistent with the listing. */
41
+ marketStatus?: MarketStatus;
40
42
  };
41
43
  export type EventListItemLoadingProps = EventListItemBaseProps & {
42
44
  /** Forces the component into its loading state. */
@@ -1,4 +1,4 @@
1
- import type { VenueEventWithMarkets, VenueMarket, VenueMarketOutcome } from "@agg-build/hooks";
1
+ import type { MarketStatus, VenueEventWithMarkets, VenueMarket, VenueMarketOutcome } from "@agg-build/hooks";
2
2
  export type { VenueEventWithMarkets, VenueMarket, VenueMarketOutcome };
3
3
  export type EventListItemEvent = VenueEventWithMarkets;
4
4
  export type EventListItemVenueInfo = {
@@ -37,6 +37,8 @@ export type EventListItemBaseProps = {
37
37
  href?: string;
38
38
  /** Accessible label applied to the clickable card element. */
39
39
  ariaLabel?: string;
40
+ /** When set, scopes the lazy market fetch (used to expand the card chips beyond the inline set) to markets matching this status. The parent list passes its own status filter so the expanded chips stay consistent with the listing. */
41
+ marketStatus?: MarketStatus;
40
42
  };
41
43
  export type EventListItemLoadingProps = EventListItemBaseProps & {
42
44
  /** Forces the component into its loading state. */
@@ -1,5 +1,18 @@
1
1
  import type { AggUiLabels, VenueMarket, VenueMarketOutcome } from "@agg-build/hooks";
2
2
  import type { EventListItemEvent, EventListItemVenueInfoMap, VenueEventWithMarkets } from "./event-list-item.types";
3
+ /**
4
+ * Filter a list of venue strings against a runtime-derived set of
5
+ * tradeable venues. When `tradableVenues` is null (loading / unknown)
6
+ * the input is returned unchanged so callers can optimistically show
7
+ * all venues until the orderbook signal arrives. When `tradableVenues`
8
+ * is a Set, only venues present in it are kept.
9
+ *
10
+ * The Set is typically produced by `useTradableVenues(venueMarkets)`
11
+ * from `@agg-build/hooks`, which observes per-outcome midpoints from the
12
+ * engine and treats a venue as tradeable iff at least one of its
13
+ * outcomes has a non-null midpoint.
14
+ */
15
+ export declare const filterVenuesByTradable: <T extends string>(venues: readonly T[], tradableVenues: ReadonlySet<string> | null | undefined) => T[];
3
16
  export declare const resolveEventListItemEvent: (fetchedEvent: VenueEventWithMarkets | undefined) => EventListItemEvent | undefined;
4
17
  export declare const normalizeProbability: (value: number | null | undefined) => number | undefined;
5
18
  export declare const isYesLabel: (label: string) => boolean;
@@ -46,7 +59,18 @@ export declare const selectPrimaryVenueMarket: (venueMarkets: VenueMarket[]) =>
46
59
  export declare const resolveTileTitle: (event: VenueEventWithMarkets, primaryVenueMarket: VenueMarket | undefined, titleOverride: string | undefined) => string;
47
60
  export declare const resolveTileImage: (event: VenueEventWithMarkets, primaryVenueMarket: VenueMarket | undefined, imageOverride: string | null | undefined) => string | undefined;
48
61
  export declare const formatCountLabel: (count: number, singular: string, plural: string) => string;
49
- export declare const getVenueSummary: (venueMarkets: VenueMarket[]) => {
62
+ export declare const getVenueSummary: (venueMarkets: VenueMarket[], options?: {
63
+ /**
64
+ * Runtime-derived set of venues that have a live orderbook (typically
65
+ * sourced from `useTradableVenues`). When provided as a Set, only
66
+ * venues in the set count toward `venueCount` and `singleVenue`.
67
+ * When `null` (loading) or `undefined` (caller doesn't have the
68
+ * signal), no filter is applied and all venues count — callers
69
+ * showing a "X venues" badge accept that the count may briefly
70
+ * include non-tradeable venues until midpoints resolve.
71
+ */
72
+ tradableVenues?: ReadonlySet<string> | null;
73
+ }) => {
50
74
  marketCount: number;
51
75
  venueCount: number;
52
76
  singleVenue: import("@agg-build/hooks").Venue | undefined;
@@ -98,6 +122,6 @@ export declare function resolveBestMidpointForMarket(market: {
98
122
  id: string;
99
123
  venue: string;
100
124
  }> | null;
101
- }, midpointsByVenueMarketId: Map<string, number | null>, spreadByVenueMarketId?: Map<string, number | null>): BestMidpointResult | undefined;
125
+ }, midpointsByVenueMarketId: Map<string, number | null>, _spreadByVenueMarketId?: Map<string, number | null>): BestMidpointResult | undefined;
102
126
  export declare const resolveDisplayVolume: (eventVolume: number | null | undefined, venueMarkets: ReadonlyArray<DisplayVolumeMarket>) => number | undefined;
103
127
  export {};
@@ -1,5 +1,18 @@
1
1
  import type { AggUiLabels, VenueMarket, VenueMarketOutcome } from "@agg-build/hooks";
2
2
  import type { EventListItemEvent, EventListItemVenueInfoMap, VenueEventWithMarkets } from "./event-list-item.types";
3
+ /**
4
+ * Filter a list of venue strings against a runtime-derived set of
5
+ * tradeable venues. When `tradableVenues` is null (loading / unknown)
6
+ * the input is returned unchanged so callers can optimistically show
7
+ * all venues until the orderbook signal arrives. When `tradableVenues`
8
+ * is a Set, only venues present in it are kept.
9
+ *
10
+ * The Set is typically produced by `useTradableVenues(venueMarkets)`
11
+ * from `@agg-build/hooks`, which observes per-outcome midpoints from the
12
+ * engine and treats a venue as tradeable iff at least one of its
13
+ * outcomes has a non-null midpoint.
14
+ */
15
+ export declare const filterVenuesByTradable: <T extends string>(venues: readonly T[], tradableVenues: ReadonlySet<string> | null | undefined) => T[];
3
16
  export declare const resolveEventListItemEvent: (fetchedEvent: VenueEventWithMarkets | undefined) => EventListItemEvent | undefined;
4
17
  export declare const normalizeProbability: (value: number | null | undefined) => number | undefined;
5
18
  export declare const isYesLabel: (label: string) => boolean;
@@ -46,7 +59,18 @@ export declare const selectPrimaryVenueMarket: (venueMarkets: VenueMarket[]) =>
46
59
  export declare const resolveTileTitle: (event: VenueEventWithMarkets, primaryVenueMarket: VenueMarket | undefined, titleOverride: string | undefined) => string;
47
60
  export declare const resolveTileImage: (event: VenueEventWithMarkets, primaryVenueMarket: VenueMarket | undefined, imageOverride: string | null | undefined) => string | undefined;
48
61
  export declare const formatCountLabel: (count: number, singular: string, plural: string) => string;
49
- export declare const getVenueSummary: (venueMarkets: VenueMarket[]) => {
62
+ export declare const getVenueSummary: (venueMarkets: VenueMarket[], options?: {
63
+ /**
64
+ * Runtime-derived set of venues that have a live orderbook (typically
65
+ * sourced from `useTradableVenues`). When provided as a Set, only
66
+ * venues in the set count toward `venueCount` and `singleVenue`.
67
+ * When `null` (loading) or `undefined` (caller doesn't have the
68
+ * signal), no filter is applied and all venues count — callers
69
+ * showing a "X venues" badge accept that the count may briefly
70
+ * include non-tradeable venues until midpoints resolve.
71
+ */
72
+ tradableVenues?: ReadonlySet<string> | null;
73
+ }) => {
50
74
  marketCount: number;
51
75
  venueCount: number;
52
76
  singleVenue: import("@agg-build/hooks").Venue | undefined;
@@ -98,6 +122,6 @@ export declare function resolveBestMidpointForMarket(market: {
98
122
  id: string;
99
123
  venue: string;
100
124
  }> | null;
101
- }, midpointsByVenueMarketId: Map<string, number | null>, spreadByVenueMarketId?: Map<string, number | null>): BestMidpointResult | undefined;
125
+ }, midpointsByVenueMarketId: Map<string, number | null>, _spreadByVenueMarketId?: Map<string, number | null>): BestMidpointResult | undefined;
102
126
  export declare const resolveDisplayVolume: (eventVolume: number | null | undefined, venueMarkets: ReadonlyArray<DisplayVolumeMarket>) => number | undefined;
103
127
  export {};
@@ -1,4 +1,4 @@
1
- import type { ChartTimeRange, EventTradingState } from "@agg-build/hooks";
1
+ import type { ChartTimeRange, EventTradingState, UseMidpointsResult } from "@agg-build/hooks";
2
2
  import type { LineChartPoint, LineChartType } from "../../primitives/chart";
3
3
  import type { EventListItemVenueInfoMap, VenueEventWithMarkets } from "../item/event-list-item.types";
4
4
  import type { OutcomeByVenue } from "./event-list-item-details.utils";
@@ -45,6 +45,8 @@ export type EventListItemDetailsBaseProps = {
45
45
  defaultTimeRange?: EventListItemDetailsTimeRange;
46
46
  /** Called when the details card is clicked. */
47
47
  onClick?: (event?: EventListItemDetailsEvent) => void;
48
+ /** Pre-fetched midpoint data (best price included) passed from parent. Optional for backward compatibility. */
49
+ midpointsResult?: UseMidpointsResult;
48
50
  };
49
51
  export type EventListItemDetailsLoadingProps = EventListItemDetailsBaseProps & {
50
52
  /** Forces the details component into its loading state. */
@@ -108,6 +110,8 @@ export type EventListItemDetailsGraphSectionProps = {
108
110
  venueInfo?: EventListItemVenueInfoMap;
109
111
  /** Venue markets used to build the chart series. */
110
112
  venueMarkets: EventListItemDetailsContentProps["event"]["venueMarkets"];
113
+ /** Market id used to scope the chart to the active market cluster. */
114
+ selectedMarketId?: string | null;
111
115
  /**
112
116
  * WS+REST merged prices (WS wins) keyed by outcome ID. General-purpose live
113
117
  * prices for contexts where per-venue accuracy or availability doesn't matter.
@@ -125,7 +129,32 @@ export type EventListItemDetailsGraphSectionProps = {
125
129
  * than the WS price of a single venue.
126
130
  */
127
131
  restMidpoints: Map<string, number>;
132
+ /** Canonical yes-side midpoint/reference price for the active cluster. */
133
+ bestMidpoint?: number;
134
+ /**
135
+ * Trusted top-of-book per-outcome prices keyed by outcome ID. Drives the
136
+ * outcome selector switch when present so the displayed price is the live
137
+ * bestAsk rather than a stale midpoint.
138
+ */
139
+ bestPrices?: ReadonlyMap<string, {
140
+ bestBid?: number;
141
+ bestAsk?: number;
142
+ }>;
128
143
  /** Override live WS subscriptions for the chart hook.
129
144
  * Set to `false` when a parent manages subscriptions centrally. */
130
145
  live?: boolean;
146
+ /**
147
+ * Per-chart range override that takes precedence over the user's global
148
+ * `selectedChartTimeRange`. The auto-fallback effect sets this to `"ALL"`
149
+ * when the user-selected range is empty for the current subject, so the
150
+ * chart displays usable data without mutating the user's preference.
151
+ * `null` means "use the user's selection".
152
+ */
153
+ rangeOverride: import("@agg-build/hooks").ChartTimeRange | null;
154
+ /**
155
+ * Called by the graph section's auto-fallback effect to set a local
156
+ * override. Passing `null` clears the override (used by the parent on
157
+ * subject change / explicit user range pick).
158
+ */
159
+ onRangeOverrideChange: (range: import("@agg-build/hooks").ChartTimeRange | null) => void;
131
160
  };
@@ -1,4 +1,4 @@
1
- import type { ChartTimeRange, EventTradingState } from "@agg-build/hooks";
1
+ import type { ChartTimeRange, EventTradingState, UseMidpointsResult } from "@agg-build/hooks";
2
2
  import type { LineChartPoint, LineChartType } from "../../primitives/chart";
3
3
  import type { EventListItemVenueInfoMap, VenueEventWithMarkets } from "../item/event-list-item.types";
4
4
  import type { OutcomeByVenue } from "./event-list-item-details.utils";
@@ -45,6 +45,8 @@ export type EventListItemDetailsBaseProps = {
45
45
  defaultTimeRange?: EventListItemDetailsTimeRange;
46
46
  /** Called when the details card is clicked. */
47
47
  onClick?: (event?: EventListItemDetailsEvent) => void;
48
+ /** Pre-fetched midpoint data (best price included) passed from parent. Optional for backward compatibility. */
49
+ midpointsResult?: UseMidpointsResult;
48
50
  };
49
51
  export type EventListItemDetailsLoadingProps = EventListItemDetailsBaseProps & {
50
52
  /** Forces the details component into its loading state. */
@@ -108,6 +110,8 @@ export type EventListItemDetailsGraphSectionProps = {
108
110
  venueInfo?: EventListItemVenueInfoMap;
109
111
  /** Venue markets used to build the chart series. */
110
112
  venueMarkets: EventListItemDetailsContentProps["event"]["venueMarkets"];
113
+ /** Market id used to scope the chart to the active market cluster. */
114
+ selectedMarketId?: string | null;
111
115
  /**
112
116
  * WS+REST merged prices (WS wins) keyed by outcome ID. General-purpose live
113
117
  * prices for contexts where per-venue accuracy or availability doesn't matter.
@@ -125,7 +129,32 @@ export type EventListItemDetailsGraphSectionProps = {
125
129
  * than the WS price of a single venue.
126
130
  */
127
131
  restMidpoints: Map<string, number>;
132
+ /** Canonical yes-side midpoint/reference price for the active cluster. */
133
+ bestMidpoint?: number;
134
+ /**
135
+ * Trusted top-of-book per-outcome prices keyed by outcome ID. Drives the
136
+ * outcome selector switch when present so the displayed price is the live
137
+ * bestAsk rather than a stale midpoint.
138
+ */
139
+ bestPrices?: ReadonlyMap<string, {
140
+ bestBid?: number;
141
+ bestAsk?: number;
142
+ }>;
128
143
  /** Override live WS subscriptions for the chart hook.
129
144
  * Set to `false` when a parent manages subscriptions centrally. */
130
145
  live?: boolean;
146
+ /**
147
+ * Per-chart range override that takes precedence over the user's global
148
+ * `selectedChartTimeRange`. The auto-fallback effect sets this to `"ALL"`
149
+ * when the user-selected range is empty for the current subject, so the
150
+ * chart displays usable data without mutating the user's preference.
151
+ * `null` means "use the user's selection".
152
+ */
153
+ rangeOverride: import("@agg-build/hooks").ChartTimeRange | null;
154
+ /**
155
+ * Called by the graph section's auto-fallback effect to set a local
156
+ * override. Passing `null` clears the override (used by the parent on
157
+ * subject change / explicit user range pick).
158
+ */
159
+ onRangeOverrideChange: (range: import("@agg-build/hooks").ChartTimeRange | null) => void;
131
160
  };
@@ -7,6 +7,6 @@ export declare const MarketDetails: {
7
7
  displayName: string;
8
8
  };
9
9
  export declare const MarketDetailsList: {
10
- ({ eventId, markets: providedMarkets, eventTradingState, onClick, onOutcomeSelect, onExpandedMarketChange, defaultTab, classNames, live, }: MarketDetailsListProps): JSX.Element;
10
+ ({ eventId, markets: providedMarkets, eventTradingState, onClick, onOutcomeSelect, onExpandedMarketChange, autoSelectFallbackMarket, defaultTab, classNames, live, midpointsResult, }: MarketDetailsListProps): JSX.Element;
11
11
  displayName: string;
12
12
  };
@@ -7,6 +7,6 @@ export declare const MarketDetails: {
7
7
  displayName: string;
8
8
  };
9
9
  export declare const MarketDetailsList: {
10
- ({ eventId, markets: providedMarkets, eventTradingState, onClick, onOutcomeSelect, onExpandedMarketChange, defaultTab, classNames, live, }: MarketDetailsListProps): JSX.Element;
10
+ ({ eventId, markets: providedMarkets, eventTradingState, onClick, onOutcomeSelect, onExpandedMarketChange, autoSelectFallbackMarket, defaultTab, classNames, live, midpointsResult, }: MarketDetailsListProps): JSX.Element;
11
11
  displayName: string;
12
12
  };
@@ -1,4 +1,4 @@
1
- import type { EventTradingState, VenueMarket } from "@agg-build/hooks";
1
+ import type { EventTradingState, UseMidpointsResult, VenueMarket } from "@agg-build/hooks";
2
2
  import type React from "react";
3
3
  import type { VenueLogoName } from "../../primitives/venue-logo/venue-logo.types";
4
4
  export type MarketDetailsTab = "order-book" | "graph" | "other";
@@ -45,6 +45,11 @@ export type MarketDetailsBaseProps = {
45
45
  otherContent?: React.ReactNode;
46
46
  /** Whether the market details should render a loading state. */
47
47
  isLoading?: boolean;
48
+ /**
49
+ * When true, if a global selected outcome does not belong to this card,
50
+ * do not fall back to a local default outcome for selected-state rendering.
51
+ */
52
+ suppressOutcomeFallbackSelection?: boolean;
48
53
  /** Override live WS subscriptions for chart and orderbook hooks.
49
54
  * Set to `false` when a parent component already manages subscriptions
50
55
  * (e.g. useEventOrderbookData on the event page).
@@ -82,6 +87,12 @@ export type MarketDetailsWithMarketsProps = MarketDetailsBaseProps & {
82
87
  * shows the correct logo alongside the best price.
83
88
  */
84
89
  midpointsFallbackVenues?: Map<string, string>;
90
+ /**
91
+ * Pre-fetched midpoint data (best price included) passed from parent.
92
+ * Optional for backward compatibility. When provided, reduces unnecessary
93
+ * redundant API calls for midpoint data.
94
+ */
95
+ midpointsResult?: UseMidpointsResult;
85
96
  };
86
97
  export type MarketDetailsProps = MarketDetailsLoadingProps | MarketDetailsWithMarketsProps;
87
98
  export type MarketDetailsContentProps = MarketDetailsBaseProps & {
@@ -91,6 +102,8 @@ export type MarketDetailsContentProps = MarketDetailsBaseProps & {
91
102
  midpointsFallback?: Map<string, number>;
92
103
  /** See MarketDetailsWithMarketsProps.midpointsFallbackVenues. */
93
104
  midpointsFallbackVenues?: Map<string, string>;
105
+ /** See MarketDetailsWithMarketsProps.midpointsResult. */
106
+ midpointsResult?: UseMidpointsResult;
94
107
  };
95
108
  export type MarketDetailsListClassNames = Partial<{
96
109
  root: string;
@@ -112,6 +125,12 @@ export type MarketDetailsListProps = {
112
125
  marketId: string;
113
126
  outcomeId: string;
114
127
  }) => void;
128
+ /** Whether selected market changes should expand the matching accordion item. */
129
+ expandSelectedMarketOnChange?: boolean;
130
+ /** Whether fallback market selection should expand a card when none is expanded. */
131
+ autoExpandFallbackMarket?: boolean;
132
+ /** Whether the list should auto-select a fallback market when none is selected. */
133
+ autoSelectFallbackMarket?: boolean;
115
134
  /** Default tab to display. */
116
135
  defaultTab?: MarketDetailsTab;
117
136
  /** Class names for the market details list. */
@@ -119,13 +138,19 @@ export type MarketDetailsListProps = {
119
138
  /** Override live WS subscriptions for child MarketDetails.
120
139
  * Set to `false` when a parent manages subscriptions centrally. */
121
140
  live?: boolean;
141
+ /**
142
+ * Pre-fetched midpoint data (best price included) passed from parent.
143
+ * Optional for backward compatibility. When provided, reduces unnecessary
144
+ * redundant API calls for midpoint data.
145
+ */
146
+ midpointsResult?: UseMidpointsResult;
122
147
  };
123
148
  export type MarketDetailsOrderBookTone = "positive" | "negative";
124
149
  export type MarketDetailsOutcomeTone = MarketDetailsOrderBookTone;
125
150
  export type MarketDetailsHeaderOutcomeItem = {
126
151
  id: string;
127
152
  label: string;
128
- title: string;
153
+ title?: string | null;
129
154
  probability: number | undefined;
130
155
  tone: MarketDetailsOutcomeTone;
131
156
  venue: VenueLogoName;
@@ -1,4 +1,4 @@
1
- import type { EventTradingState, VenueMarket } from "@agg-build/hooks";
1
+ import type { EventTradingState, UseMidpointsResult, VenueMarket } from "@agg-build/hooks";
2
2
  import type React from "react";
3
3
  import type { VenueLogoName } from "../../primitives/venue-logo/venue-logo.types";
4
4
  export type MarketDetailsTab = "order-book" | "graph" | "other";
@@ -45,6 +45,11 @@ export type MarketDetailsBaseProps = {
45
45
  otherContent?: React.ReactNode;
46
46
  /** Whether the market details should render a loading state. */
47
47
  isLoading?: boolean;
48
+ /**
49
+ * When true, if a global selected outcome does not belong to this card,
50
+ * do not fall back to a local default outcome for selected-state rendering.
51
+ */
52
+ suppressOutcomeFallbackSelection?: boolean;
48
53
  /** Override live WS subscriptions for chart and orderbook hooks.
49
54
  * Set to `false` when a parent component already manages subscriptions
50
55
  * (e.g. useEventOrderbookData on the event page).
@@ -82,6 +87,12 @@ export type MarketDetailsWithMarketsProps = MarketDetailsBaseProps & {
82
87
  * shows the correct logo alongside the best price.
83
88
  */
84
89
  midpointsFallbackVenues?: Map<string, string>;
90
+ /**
91
+ * Pre-fetched midpoint data (best price included) passed from parent.
92
+ * Optional for backward compatibility. When provided, reduces unnecessary
93
+ * redundant API calls for midpoint data.
94
+ */
95
+ midpointsResult?: UseMidpointsResult;
85
96
  };
86
97
  export type MarketDetailsProps = MarketDetailsLoadingProps | MarketDetailsWithMarketsProps;
87
98
  export type MarketDetailsContentProps = MarketDetailsBaseProps & {
@@ -91,6 +102,8 @@ export type MarketDetailsContentProps = MarketDetailsBaseProps & {
91
102
  midpointsFallback?: Map<string, number>;
92
103
  /** See MarketDetailsWithMarketsProps.midpointsFallbackVenues. */
93
104
  midpointsFallbackVenues?: Map<string, string>;
105
+ /** See MarketDetailsWithMarketsProps.midpointsResult. */
106
+ midpointsResult?: UseMidpointsResult;
94
107
  };
95
108
  export type MarketDetailsListClassNames = Partial<{
96
109
  root: string;
@@ -112,6 +125,12 @@ export type MarketDetailsListProps = {
112
125
  marketId: string;
113
126
  outcomeId: string;
114
127
  }) => void;
128
+ /** Whether selected market changes should expand the matching accordion item. */
129
+ expandSelectedMarketOnChange?: boolean;
130
+ /** Whether fallback market selection should expand a card when none is expanded. */
131
+ autoExpandFallbackMarket?: boolean;
132
+ /** Whether the list should auto-select a fallback market when none is selected. */
133
+ autoSelectFallbackMarket?: boolean;
115
134
  /** Default tab to display. */
116
135
  defaultTab?: MarketDetailsTab;
117
136
  /** Class names for the market details list. */
@@ -119,13 +138,19 @@ export type MarketDetailsListProps = {
119
138
  /** Override live WS subscriptions for child MarketDetails.
120
139
  * Set to `false` when a parent manages subscriptions centrally. */
121
140
  live?: boolean;
141
+ /**
142
+ * Pre-fetched midpoint data (best price included) passed from parent.
143
+ * Optional for backward compatibility. When provided, reduces unnecessary
144
+ * redundant API calls for midpoint data.
145
+ */
146
+ midpointsResult?: UseMidpointsResult;
122
147
  };
123
148
  export type MarketDetailsOrderBookTone = "positive" | "negative";
124
149
  export type MarketDetailsOutcomeTone = MarketDetailsOrderBookTone;
125
150
  export type MarketDetailsHeaderOutcomeItem = {
126
151
  id: string;
127
152
  label: string;
128
- title: string;
153
+ title?: string | null;
129
154
  probability: number | undefined;
130
155
  tone: MarketDetailsOutcomeTone;
131
156
  venue: VenueLogoName;
@@ -34,10 +34,11 @@ export type ResolvedMarket = {
34
34
  export declare const resolveMarketFromVenueMarkets: (venueMarkets: VenueMarket[], marketId: string | undefined) => ResolvedMarket | undefined;
35
35
  export declare const resolveDisplayOutcomeLabels: (labels: string[]) => string[];
36
36
  export declare const resolveInitialOutcomeLabel: (labels: string[], defaultOutcomeLabel: string | undefined) => string | undefined;
37
- export declare const resolveScopedSelectedOutcome: ({ venueMarkets, selectedOutcomeId, defaultOutcomeLabel, }: {
37
+ export declare const resolveScopedSelectedOutcome: ({ venueMarkets, selectedOutcomeId, defaultOutcomeLabel, suppressFallbackWhenSelectedOutcomeOutOfScope, }: {
38
38
  venueMarkets: VenueMarket[];
39
39
  selectedOutcomeId: string | null | undefined;
40
40
  defaultOutcomeLabel: string | undefined;
41
+ suppressFallbackWhenSelectedOutcomeOutOfScope?: boolean;
41
42
  }) => {
42
43
  outcomeId: string | null;
43
44
  outcomeLabel: string | undefined;
@@ -45,21 +46,34 @@ export declare const resolveScopedSelectedOutcome: ({ venueMarkets, selectedOutc
45
46
  export declare const resolveAverageProbabilityByLabel: (venueMarkets: VenueMarket[], labels: string[]) => Map<string, number | undefined>;
46
47
  export declare const formatProbabilityPercent: (value: number | null | undefined, formatPercent?: (value: number) => string) => string;
47
48
  export declare const resolveOutcomeTone: (label: string, index: number) => MarketDetailsOrderBookTone;
48
- export declare const resolveHeaderOutcomeItems: (venueMarkets: VenueMarket[]) => MarketDetailsHeaderOutcomeItem[];
49
- export declare const resolveSubtitle: ({ venueMarkets, volume, formatCompactCurrency, labels, }: {
49
+ export declare const resolveHeaderOutcomeItems: (venueMarkets: VenueMarket[], scopedMarket?: VenueMarket | null) => MarketDetailsHeaderOutcomeItem[];
50
+ export declare const resolveSubtitle: ({ venueMarkets, volume, formatCompactCurrency, labels, tradableVenues, }: {
50
51
  venueMarkets: VenueMarket[];
51
52
  volume: number | undefined;
52
53
  formatCompactCurrency: (value: number) => string;
53
54
  labels: AggUiLabels;
55
+ /**
56
+ * Optional runtime-derived set of venues that have a live orderbook.
57
+ * Forwarded to `getVenueSummary` to filter `venueCount` to only
58
+ * tradeable venues. When omitted the count includes all venues
59
+ * regardless of orderbook availability.
60
+ */
61
+ tradableVenues?: ReadonlySet<string> | null;
54
62
  }) => string;
55
63
  export declare const resolveOtherTabRows: (market: ResolvedMarket, labels: AggUiLabels) => MarketDetailsMetaRow[];
56
- export declare const buildMarketDetailsModel: ({ venueMarkets, marketId, title, image, formatCompactCurrency, labels, }: {
64
+ export declare const buildMarketDetailsModel: ({ venueMarkets, marketId, title, image, formatCompactCurrency, labels, tradableVenues, }: {
57
65
  venueMarkets: VenueMarket[];
58
66
  marketId: string | undefined;
59
67
  title: string | undefined;
60
68
  image: string | null | undefined;
61
69
  formatCompactCurrency: (value: number) => string;
62
70
  labels: AggUiLabels;
71
+ /**
72
+ * Forwarded to `resolveSubtitle` → `getVenueSummary` so the "X venues"
73
+ * subtitle reflects only venues with a live orderbook. Optional;
74
+ * subtitle counts all cluster venues when omitted.
75
+ */
76
+ tradableVenues?: ReadonlySet<string> | null;
63
77
  }) => {
64
78
  market: ResolvedMarket;
65
79
  primaryVenueMarket: VenueMarket;