@agg-build/hooks 2.1.0 → 2.1.2

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/dist/index.d.ts CHANGED
@@ -271,6 +271,12 @@ type VenueMarket = {
271
271
  sportsMarketType?: string | null | undefined;
272
272
  /** Sort rank within a sports section (0=moneyline, 1=spread, 2=total, 3+=other). */
273
273
  sectionRank?: number | null | undefined;
274
+ /** Period identifier for sports markets (e.g., "1H", "2H", "Q1", etc.). */
275
+ period?: string | null | undefined;
276
+ /** Normalized subject category for prop-tab grouping (e.g., game_lines, exact_score, etc.). */
277
+ marketCategory?: string | null | undefined;
278
+ /** Line value for spread/total markets (e.g., 2.5 for totals, 3 for spreads). */
279
+ lineValue?: number | null | undefined;
274
280
  matchedVenueMarkets?: {
275
281
  id: string;
276
282
  venue: Venue;
@@ -324,10 +330,18 @@ type VenueEvent = {
324
330
  startDate?: string | null | undefined;
325
331
  endDate?: string | null | undefined;
326
332
  creationDate?: string | null | undefined;
333
+ /**
334
+ * Scheduled kickoff/start of the underlying game (sports events only).
335
+ * Distinct from `endDate` (market close/expiration), which can sit well
336
+ * after the game. The FE prefers this over `endDate` for the game-date
337
+ * title suffix. Null for non-sports events.
338
+ */
339
+ gameStartTime?: string | null | undefined;
327
340
  slug?: string | null | undefined;
328
341
  subtitle?: string | null | undefined;
329
342
  venues?: Venue[];
330
343
  venueCount?: number | undefined;
344
+ groupMarketCount?: number | undefined;
331
345
  marketCount?: number | undefined;
332
346
  /**
333
347
  * ISO-8601 duration denormalized from Series.recurrence. `null` means
@@ -676,6 +690,13 @@ interface AggUiLabels {
676
690
  categoryTabsAria: string;
677
691
  };
678
692
  userProfile: {
693
+ balance: {
694
+ availableBalance: string;
695
+ balanceByNetwork: string;
696
+ paperModeNetwork: string;
697
+ paperModeWarning: string;
698
+ networkTooltipDescription: string;
699
+ };
679
700
  activity: {
680
701
  depositType: string;
681
702
  redeemType: string;
@@ -1080,6 +1101,7 @@ interface AggUiLabels {
1080
1101
  orderSkip: string;
1081
1102
  orderRetryRemaining: string;
1082
1103
  resolvedEarningsTitle: string;
1104
+ resolvedResolutionDateLabel: string;
1083
1105
  resolvedSharesLabel: string;
1084
1106
  resolvedTotalPayoutLabel: string;
1085
1107
  claimWinnings: string;
@@ -1290,6 +1312,7 @@ declare const resolveAggUiLabels: (locale: string) => AggUiLabels;
1290
1312
 
1291
1313
  type ThemeMode = "light" | "dark";
1292
1314
  type ChartTimeRange = "1H" | "6H" | "1D" | "1W" | "1M" | "ALL";
1315
+ type AggUiTradingExecutionMode = "live" | "paper";
1293
1316
  interface AggUiGeneralConfig {
1294
1317
  /** Locale for number and date formatting */
1295
1318
  locale: string;
@@ -1376,6 +1399,11 @@ interface AggUiSearchConfig {
1376
1399
  isShowingAllResults: boolean;
1377
1400
  }
1378
1401
  type AggUiSearchConfigInput = Partial<AggUiSearchConfig>;
1402
+ interface AggUiTradingConfig {
1403
+ /** Default execution mode used by trading surfaces unless a component prop overrides it. */
1404
+ executionMode: AggUiTradingExecutionMode;
1405
+ }
1406
+ type AggUiTradingConfigInput = Partial<AggUiTradingConfig>;
1379
1407
  interface AggUiConfig {
1380
1408
  /** Enable AGG development logs */
1381
1409
  enableLogs: boolean;
@@ -1399,6 +1427,8 @@ interface AggUiConfig {
1399
1427
  formatting: AggUiFormattingConfig;
1400
1428
  /** Search configuration */
1401
1429
  search: AggUiSearchConfig;
1430
+ /** Trading configuration */
1431
+ trading: AggUiTradingConfig;
1402
1432
  /**
1403
1433
  * Optional wallet action implementations.
1404
1434
  * When walletActions.sendToken is provided, DepositModal uses it for the
@@ -1432,6 +1462,8 @@ interface AggUiConfigInput {
1432
1462
  formatting?: AggUiFormattingConfigInput;
1433
1463
  /** Search config overrides */
1434
1464
  search?: AggUiSearchConfigInput;
1465
+ /** Trading config overrides */
1466
+ trading?: AggUiTradingConfigInput;
1435
1467
  /**
1436
1468
  * Optional wallet action implementations for deposit flows.
1437
1469
  * Provide this once at the provider level for plug-and-play deposit UX.
@@ -3333,10 +3365,42 @@ declare function useLiveOutcomePrices(venueMarkets: VenueMarket[] | null | undef
3333
3365
  */
3334
3366
  declare function findLivePriceById(livePrices: Map<string, number>, id: string): number | undefined;
3335
3367
 
3368
+ interface MarketLiveState {
3369
+ marketId: string;
3370
+ orderbook: OrderbookState | null;
3371
+ orderbookSnapshotVersion: number;
3372
+ orderbookError: string | null;
3373
+ trades: WsTrade[];
3374
+ isConnected: boolean;
3375
+ integrity: "ok" | "resyncing";
3376
+ }
3377
+
3336
3378
  type LiveBestPrices = ReadonlyMap<string, {
3337
3379
  bestBid?: number;
3338
3380
  bestAsk?: number;
3339
3381
  }>;
3382
+ /**
3383
+ * A WS-derived best-price candidate for one outcome, carrying the venue that
3384
+ * produced each side *and* a freshness stamp. This is the richer companion to
3385
+ * {@link LiveBestPrices}: it keeps the venue attribution that the bare
3386
+ * `{ bestBid, bestAsk }` map throws away, so display surfaces can switch the
3387
+ * venue logo to whichever venue currently owns the best live price — keeping
3388
+ * the logo paired with the price instead of pinned to the REST snapshot.
3389
+ */
3390
+ interface LiveBestPriceCandidate {
3391
+ bestBid?: number;
3392
+ bestAsk?: number;
3393
+ /** Venue that owns the cross-venue best bid (best place to sell). */
3394
+ bestBidVenue?: string;
3395
+ /** Venue that owns the cross-venue best ask (cheapest place to buy). */
3396
+ bestAskVenue?: string;
3397
+ midpoint?: number;
3398
+ /** Venue the midpoint is attributed to (cheapest-ask side, then best-bid). */
3399
+ midpointVenue?: string;
3400
+ /** Orderbook timestamp (seconds) of the freshest book backing this candidate. */
3401
+ updatedAt?: number;
3402
+ }
3403
+ type LiveBestPriceCandidates = ReadonlyMap<string, LiveBestPriceCandidate>;
3340
3404
  /**
3341
3405
  * WS-derived cross-venue + cross-outcome best bid/ask per outcome.
3342
3406
  *
@@ -3364,6 +3428,35 @@ declare function mergeBestPricesPreferringLive(rest: ReadonlyMap<string, {
3364
3428
  bestBid?: number;
3365
3429
  bestAsk?: number;
3366
3430
  }>;
3431
+ /**
3432
+ * Pull the per-outcome best bid/ask, attributed venues, midpoint and freshness
3433
+ * out of a single live orderbook state. Pure — exported for unit tests.
3434
+ */
3435
+ declare const extractOutcomeBestCandidate: (state: MarketLiveState | undefined) => LiveBestPriceCandidate;
3436
+ /**
3437
+ * Cross-venue + cross-outcome venue-attributed best-price candidates.
3438
+ *
3439
+ * Pure (no React) so the cross-venue fold can be unit-tested directly:
3440
+ * - Pass 1: per-outcome candidate from each outcome's own aggregated book.
3441
+ * - Pass 2: fold across MVMO groups. Lowest ask wins (cheapest to buy),
3442
+ * highest bid wins (best to sell), and the *winning venue* + freshest
3443
+ * timestamp travel with the chosen price to every member of the group.
3444
+ * This is what lets a different venue's live book switch both the price
3445
+ * and the venue logo on every WS update.
3446
+ *
3447
+ * Mirrors the price fold in {@link useLiveBestPrices} and the REST fold in
3448
+ * `useMidpoints.extractBestPrices`, but additionally tracks venue + freshness.
3449
+ */
3450
+ declare function buildLiveBestPriceCandidates(outcomeIds: string[], states: Array<MarketLiveState | undefined>, venueMarkets: VenueMarket[] | null | undefined): Map<string, LiveBestPriceCandidate>;
3451
+ /**
3452
+ * React hook companion to {@link useLiveBestPrices} that additionally carries
3453
+ * venue attribution + freshness per outcome. Recomputes on every WS update
3454
+ * (snapshot/delta) that moves price, venue ownership, or timestamp.
3455
+ *
3456
+ * Empty until WS books land for the subscribed outcomes. Designed to feed a
3457
+ * unified price+venue selector so the venue logo always follows the live price.
3458
+ */
3459
+ declare function useLiveBestPriceCandidates(venueMarkets: VenueMarket[] | null | undefined): LiveBestPriceCandidates;
3367
3460
 
3368
3461
  /**
3369
3462
  * Subscribe to real-time trade feed for a canonical market.
@@ -5487,4 +5580,4 @@ declare function useAppConfig(): UseAppConfigResult;
5487
5580
  */
5488
5581
  declare function useCachedAppConfig(): UseAppConfigResult;
5489
5582
 
5490
- export { AUTH_CHOOSER_OPEN_EVENT, type AggAuthContextValue, type AggAuthSignInOptions, type AggBalanceContextValue, AggBalanceProvider, AggProvider, type AggProviderProps, AggProvider as AggSdkProvider, type AggProviderProps as AggSdkProviderProps, type AggUiConfig, type AggUiConfigInput, type AggUiLabels, type AggUiLabelsInput, AggUiProvider, CHART_TIME_RANGES, CONFIRMED_MATCH_STATUSES, type ChartTimeRange, type ClosedPositionTotals, type ComputePriceGapsOptions, DEFAULT_AGG_ROOT_CLASS_NAME, type DagStepProgress, type EventListStateContextValue, EventListStateProvider, type EventListStateSnapshot, type EventTradingContextValue, type EventTradingState, type ExecutionProgressPhase, type ExecutionTerminalOrderEvent, type GeoBlockState, type GetOrdersQuery, type GetPositionsQuery, type InvalidateUserActivityOptions, type InvalidateUserMoneyStateOptions, type LiveBestPrices, type LiveCandle, MAX_PRICE_GAP_PCT, MIN_PRICE_GAP_PCT, type MarketChartCandle, type MarketChartData, type MarketChartVenueData, type MarketOrderbookData, type MarketOrderbookIntegrity, MarketStatus, type MarketTradingState, MatchStatus, MatchType, type OrderEligibility, type OrderEligibilityReason, type OrderListItem, type OrderbookResult, type PositionGroup, type PriceGapValue, type RedeemEvent, type RedeemLegLifecycle, type RedeemLifecycleState, RedeemRejectedError, type RollingChartWindow, type ScaledCandlePoint, type SdkUiConfig, type SdkUiConfigInput, type SdkUiProviderProps, type SmartRouteLoadingReason, type ThemeMode, TradeSide, type TradingAction, type TradingState, type TradingStateBase, type TradingStateKind, type UseAggAuthOptions, type UseAggAuthReturn, type UseAppConfigResult, type UseArbFeedResult, type UseCategoriesOptions, type UseCategoryChildrenOptions, type UseEnrichedVenueEventOptions, type UseExecuteManagedOptions, type UseExecutionOrdersOptions, type UseExecutionPositionsOptions, type UseExecutionProgressOptions, type UseExecutionProgressResult, type UseExternalIdOptions, type UseExternalIdReturn, type UseLinkAccountReturn, type UseLiveCandleOverlayOptions, type UseLiveCandleOverlayResult, type UseLiveCandlesOptions, type UseLiveCandlesResult, type UseLiveMarketResult, type UseMarketArbResult, type UseMarketChartOptions, type UseMarketChartResult, type UseMarketOrderbookOptions, type UseMarketOrderbookResult, type UseMarketOrderbookVenueOutcome, type UseMarketSearchOptions, type UseMidpointsOptions, type UseMidpointsResult, type UseOrderBookOptions, type UseOrderbookQuoteOptions, type UseOrderbookQuoteResult, type UseOrdersOptions, type UsePositionsOptions, type UseQuoteManagedOptions, type UseRedeemLifecycleInput, type UseRollingChartWindowOptions, type UseSearchOptions, type UseSmartRouteOptions, type UseSmartRouteResult, type UseTradableVenuesResult, type UseUserActivityOptions, type UseUserHoldingsOptions, type UseVenueEventOptions, type UseVenueEventsOptions, type UseVenueMarketMidpointsOptions, type UseVenueMarketsOptions, type UseViewportMidpointsOptions, type UseVisibleIdsOptions, type UseVisibleIdsResult, type UserActivityInvalidationStrategy, Venue, type VenueAvailabilityState, type VenueEvent, type VenueEventWithMarkets, type VenueMarket, type VenueMarketOutcome, type WalletActionSendTokenParams, type WalletActions, computeClosedPositionTotals, computePriceGaps, defaultAggUiConfig, defaultAggUiConfig as defaultSdkUiConfig, executionKeys, findLivePriceById, getBuilder, getOrCreateBuilder, getVenueAvailabilityState, getVisibleVenueIdsByConfig, getVisibleVenuesByConfig, getWalletAddressFromUserProfile, invalidateBalanceQueries, invalidatePositionQueries, invalidateUserActivityQueries, invalidateUserClaimState, invalidateUserMoneyState, isVenueDisabledByConfig, mergeBestPricesPreferringLive, normalizeVenueId, optimizedImageUrl, parseEmail, parseEmailStrict, rangeToSeconds, requestAggAuthChooserOpen, resolveAggUiLabels, resolveDefaultMarket as resolveDefaultTradingMarket, resolveEventTradingState, resolveMarketTradingState, resolveMarketWinningOutcome, resolveOrderEligibility, resolveRollingWindow, resolveTradingStateKind, sortVenues, timeRangeToInterval, tradingReducer, useAggAuth, useAggAuthContext, useAggAuthState, useAggBalance, useAggBalanceContext, useAggBalanceState, useAggClient, useAggLabels, useAggUiConfig, useAggWebSocket, useAppConfig, useArbFeed, useCachedAppConfig, useCategories, useCategoryChildren, useDebouncedValue, useEnrichedVenueEvent, useEventListState, useEventOrderbookData, useEventTradingContext, useExecuteManaged, useExecutionOrders, useExecutionPositions, useExecutionProgress, useExternalId, useGeoBlock, useLabels, useLinkAccount, useLiveBestPrices, useLiveCandleOverlay, useLiveCandles, useLiveMarket, useLiveMarketStores, useLiveOutcomePrices, useLiveTrades, useMarketArb, useMarketChart, useMarketOrderbook, useMarketSearch, useMidpoints, useOnBalanceUpdate, useOnOrderEvent, useOnOrderSubmitted, useOnRedeemEvent, useOnWithdrawalLifecycle, useOptionalAggClient, useOrderBook, useOrderbookQuote, useOrders, usePositions, useQuoteManaged, useRampQuotes, useRampSession, useRedeem, useRedeemEligibleCount, useRedeemLifecycle, useRedeemLifecycles, useRollingChartWindow, useSdkLabels, useSdkUiConfig, useSearch, useSmartRoute, useTradableVenues, useUserActivity, useUserHoldings, useVenueEvent, useVenueEvents, useVenueMarketMidpoints, useVenueMarkets, useViewportMidpoints, useVisibleIds, userActivityQueryKeys };
5583
+ export { AUTH_CHOOSER_OPEN_EVENT, type AggAuthContextValue, type AggAuthSignInOptions, type AggBalanceContextValue, AggBalanceProvider, AggProvider, type AggProviderProps, AggProvider as AggSdkProvider, type AggProviderProps as AggSdkProviderProps, type AggUiConfig, type AggUiConfigInput, type AggUiLabels, type AggUiLabelsInput, AggUiProvider, type AggUiTradingExecutionMode, CHART_TIME_RANGES, CONFIRMED_MATCH_STATUSES, type ChartTimeRange, type ClosedPositionTotals, type ComputePriceGapsOptions, DEFAULT_AGG_ROOT_CLASS_NAME, type DagStepProgress, type EventListStateContextValue, EventListStateProvider, type EventListStateSnapshot, type EventTradingContextValue, type EventTradingState, type ExecutionProgressPhase, type ExecutionTerminalOrderEvent, type GeoBlockState, type GetOrdersQuery, type GetPositionsQuery, type InvalidateUserActivityOptions, type InvalidateUserMoneyStateOptions, type LiveBestPriceCandidate, type LiveBestPriceCandidates, type LiveBestPrices, type LiveCandle, MAX_PRICE_GAP_PCT, MIN_PRICE_GAP_PCT, type MarketChartCandle, type MarketChartData, type MarketChartVenueData, type MarketOrderbookData, type MarketOrderbookIntegrity, MarketStatus, type MarketTradingState, MatchStatus, MatchType, type OrderEligibility, type OrderEligibilityReason, type OrderListItem, type OrderbookResult, type PositionGroup, type PriceGapValue, type RedeemEvent, type RedeemLegLifecycle, type RedeemLifecycleState, RedeemRejectedError, type RollingChartWindow, type ScaledCandlePoint, type SdkUiConfig, type SdkUiConfigInput, type SdkUiProviderProps, type SmartRouteLoadingReason, type ThemeMode, TradeSide, type TradingAction, type TradingState, type TradingStateBase, type TradingStateKind, type UseAggAuthOptions, type UseAggAuthReturn, type UseAppConfigResult, type UseArbFeedResult, type UseCategoriesOptions, type UseCategoryChildrenOptions, type UseEnrichedVenueEventOptions, type UseExecuteManagedOptions, type UseExecutionOrdersOptions, type UseExecutionPositionsOptions, type UseExecutionProgressOptions, type UseExecutionProgressResult, type UseExternalIdOptions, type UseExternalIdReturn, type UseLinkAccountReturn, type UseLiveCandleOverlayOptions, type UseLiveCandleOverlayResult, type UseLiveCandlesOptions, type UseLiveCandlesResult, type UseLiveMarketResult, type UseMarketArbResult, type UseMarketChartOptions, type UseMarketChartResult, type UseMarketOrderbookOptions, type UseMarketOrderbookResult, type UseMarketOrderbookVenueOutcome, type UseMarketSearchOptions, type UseMidpointsOptions, type UseMidpointsResult, type UseOrderBookOptions, type UseOrderbookQuoteOptions, type UseOrderbookQuoteResult, type UseOrdersOptions, type UsePositionsOptions, type UseQuoteManagedOptions, type UseRedeemLifecycleInput, type UseRollingChartWindowOptions, type UseSearchOptions, type UseSmartRouteOptions, type UseSmartRouteResult, type UseTradableVenuesResult, type UseUserActivityOptions, type UseUserHoldingsOptions, type UseVenueEventOptions, type UseVenueEventsOptions, type UseVenueMarketMidpointsOptions, type UseVenueMarketsOptions, type UseViewportMidpointsOptions, type UseVisibleIdsOptions, type UseVisibleIdsResult, type UserActivityInvalidationStrategy, Venue, type VenueAvailabilityState, type VenueEvent, type VenueEventWithMarkets, type VenueMarket, type VenueMarketOutcome, type WalletActionSendTokenParams, type WalletActions, buildLiveBestPriceCandidates, computeClosedPositionTotals, computePriceGaps, defaultAggUiConfig, defaultAggUiConfig as defaultSdkUiConfig, executionKeys, extractOutcomeBestCandidate, findLivePriceById, getBuilder, getOrCreateBuilder, getVenueAvailabilityState, getVisibleVenueIdsByConfig, getVisibleVenuesByConfig, getWalletAddressFromUserProfile, invalidateBalanceQueries, invalidatePositionQueries, invalidateUserActivityQueries, invalidateUserClaimState, invalidateUserMoneyState, isVenueDisabledByConfig, mergeBestPricesPreferringLive, normalizeVenueId, optimizedImageUrl, parseEmail, parseEmailStrict, rangeToSeconds, requestAggAuthChooserOpen, resolveAggUiLabels, resolveDefaultMarket as resolveDefaultTradingMarket, resolveEventTradingState, resolveMarketTradingState, resolveMarketWinningOutcome, resolveOrderEligibility, resolveRollingWindow, resolveTradingStateKind, sortVenues, timeRangeToInterval, tradingReducer, useAggAuth, useAggAuthContext, useAggAuthState, useAggBalance, useAggBalanceContext, useAggBalanceState, useAggClient, useAggLabels, useAggUiConfig, useAggWebSocket, useAppConfig, useArbFeed, useCachedAppConfig, useCategories, useCategoryChildren, useDebouncedValue, useEnrichedVenueEvent, useEventListState, useEventOrderbookData, useEventTradingContext, useExecuteManaged, useExecutionOrders, useExecutionPositions, useExecutionProgress, useExternalId, useGeoBlock, useLabels, useLinkAccount, useLiveBestPriceCandidates, useLiveBestPrices, useLiveCandleOverlay, useLiveCandles, useLiveMarket, useLiveMarketStores, useLiveOutcomePrices, useLiveTrades, useMarketArb, useMarketChart, useMarketOrderbook, useMarketSearch, useMidpoints, useOnBalanceUpdate, useOnOrderEvent, useOnOrderSubmitted, useOnRedeemEvent, useOnWithdrawalLifecycle, useOptionalAggClient, useOrderBook, useOrderbookQuote, useOrders, usePositions, useQuoteManaged, useRampQuotes, useRampSession, useRedeem, useRedeemEligibleCount, useRedeemLifecycle, useRedeemLifecycles, useRollingChartWindow, useSdkLabels, useSdkUiConfig, useSearch, useSmartRoute, useTradableVenues, useUserActivity, useUserHoldings, useVenueEvent, useVenueEvents, useVenueMarketMidpoints, useVenueMarkets, useViewportMidpoints, useVisibleIds, userActivityQueryKeys };