declare class WidgetSdkError extends Error { readonly code: string; readonly status?: number; constructor(message: string, code: string, status?: number); } declare class AuthError extends WidgetSdkError { constructor(message?: string); } declare class ForbiddenError extends WidgetSdkError { constructor(message?: string); } declare class RateLimitError extends WidgetSdkError { readonly retryAfter?: number; constructor(retryAfter?: number, message?: string); } declare const LIMIT_CODES: readonly ["daily_cap", "quota_exhausted", "assistant_paused"]; type LimitCode = (typeof LIMIT_CODES)[number]; declare function isLimitCode(code: unknown): code is LimitCode; interface LimitDetails { limitCode: LimitCode; resetsAt?: string; /** The brand's or the built-in text, already in the user's language. */ message?: string; } declare class LimitError extends RateLimitError { readonly limitCode: LimitCode; readonly resetsAt?: string; readonly limitMessage?: string; constructor(details: LimitDetails, retryAfter?: number); } declare class UpstreamError extends WidgetSdkError { constructor(status: number, message?: string); } declare class NetworkError extends WidgetSdkError { readonly cause?: unknown; constructor(message?: string, cause?: unknown); } declare class ParseError extends WidgetSdkError { readonly line?: string; constructor(message?: string, line?: string); } interface SportSpec { readonly slipPrefix: string; readonly monitorPrefix: string; readonly label: string; readonly slippable: boolean; readonly wireKey: string | undefined; } declare const SPORTS: { readonly basketball: { readonly slipPrefix: "bb:"; readonly monitorPrefix: "nba:"; readonly label: "NBA"; readonly slippable: true; readonly wireKey: "nba"; }; readonly americanfootball: { readonly slipPrefix: "af:"; readonly monitorPrefix: "nfl:"; readonly label: "NFL"; readonly slippable: true; readonly wireKey: "nfl"; }; readonly tennis: { readonly slipPrefix: "tn:"; readonly monitorPrefix: "tennis:"; readonly label: "Tennis"; readonly slippable: true; readonly wireKey: "tennis"; }; }; type NonFootballSport = keyof typeof SPORTS; /** The sport keys the server accepts on a signal or widget event: only a sport with a wireKey. */ type WireSport = NonNullable<(typeof SPORTS)[NonFootballSport]['wireKey']>; type QualifiedType = 'game' | 'team' | 'player' | 'competition' | 'market'; /** The sports whose prices can reach an operator slip or a pin: those the map marks slippable. */ type SlipSport = { [K in NonFootballSport]: (typeof SPORTS)[K]['slippable'] extends true ? K : never; }[NonFootballSport]; /** undefined means football: every sport the map does not know is football. */ declare function sportOf(v: unknown): NonFootballSport | undefined; /** True for football (no sport) and for a sport the map marks slippable: the only cases that may pin or slip. */ declare function mayPinOrSlip(v: unknown): boolean; /** The sport when it may take a slip pick or a pin; undefined for football and for a sport that never does. */ declare function slipSportOf(v: unknown): SlipSport | undefined; /** The key the server reads as `sport`; undefined for football and for a sport without a wireKey. */ declare function toWireSport(v: unknown): WireSport | undefined; /** A server sport key (a set's `sport`) back to the key the server reads on a signal; undefined unless the map carries it as a wireKey. */ declare function fromWireSport(v: unknown): WireSport | undefined; /** The local part of a qualified id. A tennis match id is unique only within its tour, so it carries the tour (ADR 0004). */ declare function localIdOf(sport: unknown, id: number | string, tour?: string): string; declare function qualifiedId(sport: unknown, type: QualifiedType, id: string): string; interface ProgressEventData { phase: string; message: string; } interface AnswerEventData { text: string; } interface EntityCardRecord { wins: number; losses: number; draws?: number; ties?: number; } interface EntityCardStat { label: string; value: string; note?: string | null; muted?: boolean; record?: EntityCardRecord; } interface EntityCardScope { competitionId: number | null; label: string; imagePath?: string | null; period?: string | null; stats: EntityCardStat[]; } interface EntityCard { entityId: number; entityType: string; mentionText: string; canonicalName: string; isUsed?: boolean; imagePath?: string; subtitle?: string; seasonName?: string; chip?: string | null; scopes?: EntityCardScope[]; [key: string]: unknown; } interface EntityCardEventData { card: EntityCard; } interface CompareCell { value: string | null; note?: string; } interface CompareColumn { label: string; entityId?: number; seasonName?: string; } interface CompareRow { key: string; label: string; cells: CompareCell[]; lead?: 0 | 1; } interface CompareCard { kind: 'players' | 'seasons'; columns: CompareColumn[]; title?: string; seasonName?: string; scopeLabel?: string; competitionId?: number; scopeImagePath?: string; chip?: string; rows: CompareRow[]; period?: string; } interface CompareCardEventData { card: CompareCard; } interface ActionButtonEventData { action: Record; } interface IntentChipEventData { intent: Record; } interface ActionsLoadingEventData { message: string; } type GreetingDashboardLayout = 'market' | 'goal' | 'discovery'; type GreetingDashboardSpan = 'half' | 'full'; type GreetingDashboardTileEmphasis = 'hero'; interface GreetingDashboardSignalRef { entityType: string; entityId: string; } interface OddsForms { decimal: string; american?: string; fractional?: string; } interface PriceOption { key: string; value: number; formats: OddsForms; } interface GreetingDashboardTile { icon: string; title: string; titleFormats?: OddsForms | null; subtitle?: string | null; subtitleFormats?: OddsForms | null; span: GreetingDashboardSpan; badgeText?: string | null; badgeFormats?: OddsForms | null; imageUrls?: string[] | null; actionValue: string; actionValueFormats?: OddsForms | null; priceFormats?: OddsForms | null; actionRef?: string | null; signal: GreetingDashboardSignalRef; /** "hero": the personalized lead tile (always full width). Older servers omit it. */ emphasis?: GreetingDashboardTileEmphasis | null; /** Hero top-row line ("Tip-off 02:30 · in 6 h"); shown only when the hero has no price. Older servers omit it. */ meta?: string | null; /** Short text marks (team abbreviations) drawn as circles when imageUrls is empty. Older servers omit it. */ imageCodes?: string[] | null; } interface GreetingDashboard { layout: GreetingDashboardLayout; title: string; subtitle?: string | null; footerTip?: string | null; tiles: GreetingDashboardTile[]; /** Per-visitor layer. Absent when the server has nothing to add. */ personal?: GreetingPersonalSection; /** greeting_v2 only: the market-first board. */ marketFirst?: GreetingMarketFirstSection; } /** `another_market` and `build_combo` are sent only by a server older than the canvas greeting. */ type GreetingChipToken = 'live_games' | 'another_market' | 'build_combo'; interface GreetingPriceSelection { label: string; /** Invariant decimal text ("2.5"). */ line?: string; /** Provider side ("Over", "Home", a player name). */ side?: string; matchOddsId: number; formats: OddsForms; quotedAtUtc: string; /** The price's moves since the visitor's last visit; absent when there is nothing to show. */ trail?: GreetingPriceTrail; } /** When isNew is false, points[0] is the price at the last visit; when true, the line was first posted after it. */ interface GreetingPriceTrail { isNew: boolean; points: GreetingTrailPoint[]; } interface GreetingTrailPoint { atUtc: string; price: number; priceFormats: OddsForms; } interface GreetingStripRow { market: string; marketLabel: string; yourMarket: boolean; selections: GreetingPriceSelection[]; stat?: string; } /** One sentence about the game with one pick: the card's hook row and its fact rows. */ interface GreetingFactRow { market: string; label: string; selection: GreetingPriceSelection; stat: string; } /** One game of the "What can I bet on" answer: its title and kick-off, and the fact row with the pick it speaks to. */ interface GreetingTopBet { matchId: string; title: string; startsAtUtc: string; competition?: string; fact: GreetingFactRow; } /** The answer to the "What can I bet on tonight/today?" chip: up to three bets, in the order the server ranked them. */ interface GreetingTopBets { sport: string; day: 'tonight' | 'today'; bets: GreetingTopBet[]; } interface GreetingFeaturedCard { matchId: string; startsAtUtc: string; competition?: string; /** The matchup line the server words ("Wales v Portugal"); absent from an older server. */ title?: string; home: GreetingEntityChip; away: GreetingEntityChip; market: string; marketLabel: string; yourMarket: boolean; player?: string; /** @deprecated Only an older server sends it. */ chooser?: boolean; selections: GreetingPriceSelection[]; stat?: string; /** The bubble's fact with its pick, drawn above the market chip. */ hook?: GreetingFactRow; facts?: GreetingFactRow[]; /** How many markets the match has priced; the All markets button shows at 2 or more. */ marketCount?: number; /** The other markets the card's menu names. */ markets?: GreetingStripRow[]; /** @deprecated Only an older server sends it. */ strip?: GreetingStripRow[]; /** @deprecated Only an older server sends it; `markets` replaces it. */ otherMarkets?: GreetingStripRow[]; } /** @deprecated Only an older server sends alternatives. */ interface GreetingMarketRow { matchId: string; home: string; away: string; startsAtUtc: string; competition?: string; selections: GreetingPriceSelection[]; stat?: string; /** This game's own market label (an NBA row names its player); absent when the row shares the card's. */ marketLabel?: string; } interface GreetingMarketFirstSection { /** The partner-voice line above the card. */ hello?: string; featured?: GreetingFeaturedCard; /** @deprecated Only an older server sends it. */ alternatives?: GreetingMarketRow[]; asks: { actionLabel: string; actionValue: string; }[]; since: { text: string; }[]; chips: GreetingChipToken[]; /** The Smart Acca tab's preset. Optional: absent when the server has no preset to send. */ builder?: GreetingBuilderPreset; coolOff: boolean; /** The visitor has no favourite in any sport: the panel offers the Favourites sheet below the chips. */ favouritesPrompt?: boolean; yourMarketLabel: string; /** @deprecated Only an older server sends it. */ chooserPrompt?: string; } /** The one price the bubble's lead speaks about; the widget reprices it on add and never sells this stored price. */ interface GreetingBubblePrice { market: string; marketLabel: string; /** The pick's own label ("Over 2.5 goals"); absent from an older server, where `marketLabel` is the provider's name. */ label?: string; selection: GreetingPriceSelection; } interface GreetingBubble { greetingId: string; matchId?: string; market?: string; text: string; cta?: string; price?: GreetingBubblePrice; /** The sport the bubble speaks about; absent from older servers, where the pill is football. */ sport?: string; /** The matchup title the bubble draws above its text, with the kick-off time. */ game?: string; startsAtUtc?: string; } type GreetingPersonalTier = 'cold' | 'some' | 'known'; type GreetingEntityKind = 'competition' | 'team' | 'player' | 'match'; type GreetingGamesScope = 'page' | 'pinned' | 'starredTeams' | 'starredLeagues' | 'learnedTeam' | 'all'; interface GreetingEntityChip { kind: GreetingEntityKind; id: string; label: string; playing: boolean; /** True or absent, never false; competitions only: the league has no game in the window. The widget reads `nextGameAtUtc` first and the flag only when there is no usable instant, so a flag beside a parseable instant is ignored. Absent from older servers. */ noGamesToday?: true; /** Competitions only: the kick-off of the league's next game that has not started, omitted when a game is live or the server cannot tell. The widget decides "today" in the visitor's zone. */ nextGameAtUtc?: string; /** Team or player image; absent when the server has none (NFL sends none yet). */ imagePath?: string; } interface GreetingPersonalSection { tier: GreetingPersonalTier; ribbon?: { stars: GreetingEntityChip[]; moreStars: number; usual?: { marketKey: string; label: string; }; fromChats: GreetingEntityChip[]; }; /** followTargets: the team or player itself, or both teams of a pinned match; may be empty. One Follow button per entry. */ guess?: { kind: GreetingEntityKind; id: string; label: string; reason: string; followTargets: GreetingEntityChip[]; card?: GreetingTeamCard; imagePath?: string; }; /** Absent in cool-off only; with no key it is the default preset (pack's first market, all games, singles). legs 1 = singles. matchIds: bare ids, max 12; send an empty list with gamesScope 'all' to the grid endpoint as widen=true. The only place combo size and total travel; render as control state, never as text. */ builder?: GreetingBuilderPreset; teamCards: GreetingTeamCard[]; playerCards: GreetingPlayerCard[]; facts: GreetingFact[]; /** NBA and NFL only: the team availability line, apart from the facts and not one of the three. `text` carries no time; the widget draws `asOfUtc` beside it. Absent from older servers. */ injury?: GreetingInjury; /** Facts and injury line for each game in the builder's games select. Absent from an older server: the top-level facts then stay. */ gameFacts?: GreetingGameFacts[]; /** The bare id of the game the top-level `facts` and `injury` are about; always set when they are about a game, omitted otherwise and by older servers. With it the widget keeps them on the opening choice when that is All games or holds this game, and drops them under a single game or a league that does not. Without it the widget goes by each fact's own `matchId`. */ factsMatchId?: string; asks: { actionLabel: string; actionValue: string; }[]; since: { text: string; }[]; followSuggestions: GreetingEntityChip[]; /** Starred teams with no game in the window, at most 2. */ idleTeams?: GreetingIdleTeam[]; /** True when the visitor has a starred team, player or league in a sport other than this section's. Omitted when false and by older servers. */ hasStarsElsewhere?: boolean; } /** `imagePath`: the subject's image (team crest or player headshot), absent when the server has none. */ interface GreetingFact { marketKey: string; text: string; hits: number; window: number; matchId?: string; reference?: GreetingFactReference; imagePath?: string; } /** What a fact speaks to, never a price: the widget prices it live from the builder grid. Absent means the fact is text only. */ interface GreetingFactReference { /** The value to send as BuilderGridRequest.sport. */ sport: string; /** Bare id, as in the grid's matchIds. */ matchId: string; /** The value to send as BuilderGridRequest.marketKey. */ marketKey: string; /** Omitted when the pick has no line (a spread). */ line?: number; /** The grid leg's own `side`. */ side?: 'home' | 'away' | 'over'; /** The player, props only. */ subject?: string; /** Football team totals only, which are Over-only today. The widget shows the leg only if its own `direction` equals this. */ direction?: 'over'; } interface GreetingInjury { text: string; asOfUtc: string; } interface GreetingGameFacts { matchId: string; facts: GreetingFact[]; injury?: GreetingInjury; } interface GreetingBuilderPreset { marketKey: string; gamesScope: GreetingGamesScope; matchIds: string[]; legs: number; totalTarget: string; totalOptions: PriceOption[]; /** The visitor's usual market first, then pack order. Absent from older servers; never empty when present. */ marketOptions?: GreetingMarketOption[]; /** Option ids: 'all' (matchIds [] means widen), 'teams', 'leagues', 'learned', 'league:', 'game:'. Absent from older servers. */ gamesOptions?: GreetingGamesOption[]; /** The option the preset opens on. */ gamesOptionId?: string; /** A short localized line about when games return ("Next games tomorrow."); shown with the pause note. Omitted when the server has nothing to say. */ nextGames?: string | null; /** The kick-off of the next games, the instant `nextGames` speaks about; the widget writes the sentence in the visitor's zone. Absent from older servers. */ nextGamesAtUtc?: string; /** True or absent, never false: the visitor's usual market had no lines in the first-choice games, so the games slot moved wider (C13). */ widenedForMarket?: true; } interface GreetingMarketOption { key: string; label: string; usual?: boolean; } interface GreetingGamesOption { id: string; label: string; group?: 'league' | 'game'; matchIds: string[]; startsAtUtc?: string; mine?: boolean; } interface GreetingIdleTeam { teamId: string; label: string; actionLabel: string; actionValue: string; imagePath?: string; } type GreetingFormResult = 'W' | 'D' | 'L'; /** `lines` stays on the wire for older widgets; the widget never draws a team card's lines. `h2h.wins` are the home side's. */ interface GreetingTeamCard { teamId: string; label: string; matchId?: string; form: GreetingFormResult[]; h2h?: { meetings: number; wins: number; draws: number; losses: number; }; lines: string[]; homeLabel?: string; awayLabel?: string; homeForm?: GreetingFormResult[]; awayForm?: GreetingFormResult[]; startsAtUtc?: string; competitionLabel?: string; fact?: string; imagePath?: string; homeTeamImagePath?: string; awayTeamImagePath?: string; } type GreetingPlayerStatus = 'available' | 'doubtful' | 'out' | 'unknown'; interface GreetingPlayerHit { label: string; hits: number; window: number; } /** `lines` stays on the wire for older widgets: drawn only when `hits` is absent. */ interface GreetingPlayerCard { playerId: string; label: string; status: GreetingPlayerStatus; statusAsOfUtc?: string; lines: string[]; hits?: GreetingPlayerHit[]; matchLabel?: string; startsAtUtc?: string; imagePath?: string; } /** One sport's dashboard in a multi-sport greeting. `sport` is the server key ("football", "nba"); `label` is localized by the server. */ interface GreetingDashboardSet { sport: string; label: string; /** Absent when there is no live count to mark. */ liveGames?: number; dashboard: GreetingDashboard; /** This sport's chips; absent from older servers, where the turn's own chips are shown for every sport. */ suggestedActions?: GreetingSetChip[]; /** This sport's own greeting meta; absent from older servers and single-payload turns. */ greeting?: GreetingEventMeta; } /** Identifies the greeting for the greeting events. `sport`, `case` and the step fields are open tokens, not closed lists. */ interface GreetingEventMeta { greetingId: string; case: string; sport: string; market?: string; marketStep: string; matchStep: string; matchId?: string; competitionId?: string; chooserShown: boolean; /** What led the greeting: `fact`, `price_move`, `popular_match`, `big_change` or `none`. Absent from older servers. */ hook?: string; /** The fact key (`goals`, `btts`, `result`) when `hook` is `fact`. */ hookFact?: string; } /** A bound chip carries `actionRef`; a prose chip carries `actionValue`. */ interface GreetingSetChip { actionLabel: string; actionRef?: string; actionValue?: string; } interface ClubFanDashboardHeadToHead { meetings: number; wins: number; draws: number; losses: number; label: string; homeWinsLabel: string; drawsLabel: string; awayWinsLabel: string; } interface ClubFanDashboardCardBase { title?: string | null; } interface ClubFanDashboardPrefillCard extends ClubFanDashboardCardBase { actionLabel: string; actionRef: string; actionType: string; rank: number; } interface FormMatch { result: 'W' | 'D' | 'L'; teamScore: number; oppScore: number; teamIsHome: boolean; opponentCrestUrl?: string | null; } interface FixtureCardData { homeName: string; awayName: string; competition: string; kickoffUnix: number; venue?: string | null; homeForm: FormMatch[]; awayForm: FormMatch[]; h2H?: ClubFanDashboardHeadToHead | null; fact?: string | null; homeCrestUrl?: string | null; awayCrestUrl?: string | null; kickoffLabel: string; dateLabel: string; venueLabel: string; formLabel: string; } interface FixtureCard extends ClubFanDashboardCardBase { cardType: 'fixture'; data: FixtureCardData; } interface CountdownData { kickoffUnix: number; homeName: string; awayName: string; daysUnit: string; hoursUnit: string; minutesUnit: string; secondsUnit: string; } interface CountdownCard extends ClubFanDashboardCardBase { cardType: 'countdown'; data: CountdownData; } interface InjuryRow { playerName: string; status: string; injuryType?: string | null; expectedReturnLabel?: string | null; } interface InjuriesCardData { ours: InjuryRow[]; theirs: InjuryRow[]; oursName: string; theirsName: string; oursCrestUrl?: string | null; theirsCrestUrl?: string | null; emptyLabel: string; oursIsHome: boolean; } interface InjuriesCard extends ClubFanDashboardCardBase { cardType: 'injuries'; data: InjuriesCardData; } interface ReasonToBetData { angles: string[]; } interface ReasonToBetCard extends ClubFanDashboardCardBase { cardType: 'reasonToBet'; data: ReasonToBetData; } interface WhereToWatchData { stations: string[]; } interface WhereToWatchCard extends ClubFanDashboardCardBase { cardType: 'whereToWatch'; data: WhereToWatchData; } interface CongestedWeekEntry { opponent: string; kickoffUnix: number; competition: string; dayLabel: string; timeLabel: string; } interface CongestedWeekData { entries: CongestedWeekEntry[]; } interface CongestedWeekCard extends ClubFanDashboardPrefillCard { cardType: 'congestedWeek'; data: CongestedWeekData; } interface TransferRow { playerName: string; otherClub: string; type?: string | null; } interface TransfersData { in: TransferRow[]; out: TransferRow[]; } interface TransfersCard extends ClubFanDashboardCardBase { cardType: 'transfers'; data: TransfersData; } interface LinkRow { label: string; url: string; } interface LinksData { links: LinkRow[]; } interface LinksCard extends ClubFanDashboardCardBase { cardType: 'links'; data: LinksData; } interface PostMatchResultData { homeName: string; awayName: string; homeScore: number; awayScore: number; competition?: string | null; kickoffLabel: string; resultLabel: string; homeCrestUrl?: string | null; awayCrestUrl?: string | null; outcome: 'win' | 'draw' | 'loss'; } interface PostMatchGoalLine { text: string; scoredByClub: boolean; } interface PostMatchGoalsData { goals: PostMatchGoalLine[]; } interface PostMatchStatRow { label: string; clubValue: string; oppValue: string; clubNum: number; oppNum: number; } interface PostMatchStatsData { rows: PostMatchStatRow[]; clubIsHome: boolean; homeName: string; awayName: string; } interface PostMatchTopPerformerData { playerName: string; ratingLabel: string; } interface PostMatchNextData { opponentName: string; clubIsHome: boolean; whenLabel: string; } interface PostMatchResultCard extends ClubFanDashboardCardBase { cardType: 'postMatchResult'; data: PostMatchResultData; } interface PostMatchGoalsCard extends ClubFanDashboardPrefillCard { cardType: 'postMatchGoals'; data: PostMatchGoalsData; } interface PostMatchStatsCard extends ClubFanDashboardPrefillCard { cardType: 'postMatchStats'; data: PostMatchStatsData; } interface PostMatchTopPerformerCard extends ClubFanDashboardPrefillCard { cardType: 'postMatchTopPerformer'; data: PostMatchTopPerformerData; } interface PostMatchNextCard extends ClubFanDashboardCardBase { cardType: 'postMatchNext'; data: PostMatchNextData; } interface RestingNextData { opponentName: string; competition?: string | null; clubIsHome: boolean; whenLabel: string; } interface RestingStandingsData { position: number; points: number; played: number; wins: number; draws: number; losses: number; goalDifference: number; seasonName?: string | null; positionLabel: string; recordLabel: string; } interface RestingSeasonData { topScorerName?: string | null; topScorerGoals: number; keyPlayerName?: string | null; seasonGames: number; seasonScored: number; seasonConceded: number; scorerLabel: string; playerLabel: string; tallyLabel: string; } interface RestingFormData { letters: string[]; } interface RestingNextCard extends ClubFanDashboardPrefillCard { cardType: 'restingNext'; data: RestingNextData; } interface RestingStandingsCard extends ClubFanDashboardPrefillCard { cardType: 'restingStandings'; data: RestingStandingsData; } interface RestingSeasonCard extends ClubFanDashboardPrefillCard { cardType: 'restingSeason'; data: RestingSeasonData; } interface RestingFormCard extends ClubFanDashboardCardBase { cardType: 'restingForm'; data: RestingFormData; } interface LiveScoreData { homeName: string; awayName: string; homeScore: number; awayScore: number; competition?: string | null; minuteLabel: string; statusLabel: string; minute: number; clockRunning: boolean; homeCrestUrl?: string | null; awayCrestUrl?: string | null; } interface LiveEventLine { minuteLabel: string; text: string; scoredByClub: boolean; minute: number; type: 'goal' | 'yellow' | 'red' | 'sub' | 'other'; side: 'home' | 'away'; player?: string | null; playerOff?: string | null; } interface LiveTimelineData { events: LiveEventLine[]; } interface LiveStatRow { label: string; clubValue: string; oppValue: string; clubNum: number; oppNum: number; } interface MomentumPoint { minute: number; value: number; } interface LiveStatsData { rows: LiveStatRow[]; momentumLabel?: string | null; momentum: MomentumPoint[]; clubIsHome: boolean; homeName: string; awayName: string; } interface LiveScoreCard extends ClubFanDashboardCardBase { cardType: 'liveScore'; data: LiveScoreData; } interface LiveTimelineCard extends ClubFanDashboardCardBase { cardType: 'liveTimeline'; data: LiveTimelineData; } interface LiveStatsCard extends ClubFanDashboardCardBase { cardType: 'liveStats'; data: LiveStatsData; } type ClubFanDashboardCard = FixtureCard | CountdownCard | InjuriesCard | ReasonToBetCard | WhereToWatchCard | CongestedWeekCard | TransfersCard | LinksCard | PostMatchResultCard | PostMatchGoalsCard | PostMatchStatsCard | PostMatchTopPerformerCard | PostMatchNextCard | RestingNextCard | RestingStandingsCard | RestingSeasonCard | RestingFormCard | LiveScoreCard | LiveTimelineCard | LiveStatsCard; interface ClubFanDashboardPayload { phase: string; greeting: string; greetingIsLead?: boolean; cards: ClubFanDashboardCard[]; } interface TurnCompleteEventData { conversationId: string; agentId?: string | null; routeDecision: string; isAgentRouted: boolean; totalLatencyMs: number; dashboard?: GreetingDashboard | null; /** One dashboard per offered sport; sent only to a widget that named `sport_switch`, for a brand with 2+ sports. `dashboard` is the default sport's. */ dashboards?: GreetingDashboardSet[]; /** The sport `dashboard` belongs to. Present only with `dashboards`. */ defaultSport?: string; /** Why `defaultSport` won: hero, page, remembered, lean or first. */ defaultSportSource?: string; clubFanDashboard?: ClubFanDashboardPayload | null; /** The opened sport's greeting meta; absent for a non-betting greeting and from older servers. */ greeting?: GreetingEventMeta; greetingBubble?: GreetingBubble; /** The three-bets answer; sent only on the turn the "What can I bet on" chip starts. */ topBets?: GreetingTopBets | null; } interface StreamErrorEventData { code: string; message: string; terminal: boolean; /** B4 Q7: set only on a limit refusal or the greeting's limit notice. */ resetsAt?: string | null; retryAfterSeconds?: number | null; } interface BettingInsightOdds { value: number; valueFormats: OddsForms; bookmakerId?: number; bookmakerName?: string; quotedAtUtc?: string; isLive?: boolean; matchOddsId?: number; previousValue?: number | null; previousValueFormats?: OddsForms | null; previousValueAtUtc?: string | null; movementDirection?: 'shortened' | 'drifted' | null; } interface BettingInsight { insightId: string; matchId: number; phase: string; ruleId: string; text: string; marketDeveloperName?: string; marketLabel?: string; selectionLabel?: string; selectionSide?: string | null; line?: string | null; odds?: BettingInsightOdds | null; strength?: number; disclaimer?: string | null; homeTeamName?: string; awayTeamName?: string; competitionName?: string; addToSlipEnabled?: boolean; homeTeamImagePath?: string; awayTeamImagePath?: string; competitionImagePath?: string; kickoffUtc?: string; isMarketFloor?: boolean; pinEnabled?: boolean; /** Server-rendered kickoff chip in the operator's zone + language (e.g. "Today 19:00"). Prefer over local formatting of kickoffUtc. */ kickoffLabel?: string | null; [key: string]: unknown; } interface BettingInsightEventData { insight: BettingInsight; } interface NbaInsightSelection { key: string; marketDeveloperName: string; selectionLabel: string; side?: string | null; line?: string | null; price: number; priceFormats: OddsForms; quotedAtUtc: string; matchOddsId?: number | null; } interface NbaGameValue { date: string; opponent?: string | null; value: number; minutes: number; } interface NbaListedTeammate { name: string; status: string; statusLabel: string; } interface NbaPropReasonEvidence { playerId: number; playerName: string; stat: string; statLabel: string; line: string; side: string; hits: number; n: number; pushes: number; average: number; averageMinutes: number; games: NbaGameValue[]; openingLine?: string | null; teammates: NbaListedTeammate[]; leftOut: string[]; } interface NbaLinePoint { atUtc: string; line: string; price: number; priceFormats: OddsForms; text: string; textFormats: OddsForms; } interface NbaLineLane { points: NbaLinePoint[]; selectionKey?: string | null; } interface NbaInjuryEvent { atUtc: string; teamName: string; text: string; } interface NbaLineMoveEvidence { dateLabel: string; spread?: NbaLineLane | null; total?: NbaLineLane | null; injuries: NbaInjuryEvent[]; } interface NbaSplitRow { playerId: number; playerName: string; stat: string; statLabel: string; line: string; withoutHits: number; withoutN: number; withHits: number; withN: number; selectionKey: string; } interface NbaTeammateOutEvidence { outPlayerId: number; outPlayerName: string; teamName: string; status: string; statusLabel: string; seenAtUtc?: string | null; missedGames: number; rows: NbaSplitRow[]; } interface NbaCoHitLeg { playerId: number; playerName: string; stat: string; statLabel: string; rung: string; hits: number; n: number; selectionKey: string; } interface NbaJointGame { date: string; valueA: number; valueB: number; both: boolean; } interface NbaCoHitEvidence { legs: NbaCoHitLeg[]; games: NbaJointGame[]; bothHits: number; n: number; /** @deprecated no longer rendered; older servers still send it */ combinedPrice?: number; } interface NbaLadderRung { at: string; l5Hits: number; l5N: number; l8Hits: number; l8N: number; selectionKey: string; } interface NbaLadderStat { stat: string; statLabel: string; mainLine?: string | null; overPrice?: number | null; overPriceFormats?: OddsForms | null; underPrice?: number | null; underPriceFormats?: OddsForms | null; rungs: NbaLadderRung[]; } interface NbaLadderEvidence { playerId: number; playerName: string; stats: NbaLadderStat[]; } interface NbaMatchupTeam { teamId: number; abbr: string; name: string; n: number; pace: number; offRating: number; defRating: number; paceRank: number | null; offRatingRank: number | null; defRatingRank: number | null; teamsRanked: number; smallSample: boolean; daysRest: number | null; backToBack: boolean; } interface NbaMatchupPosition { defendingTeamAbbr: string; position: string; positionLabel: string; stat: string; statLabel: string; allowedPerGame: number; rank: number; teamsRanked: number; leagueAvg: number; n: number; smallSample: boolean; playerName: string | null; mainLine: string | null; overSelectionKey: string | null; underSelectionKey: string | null; } interface NbaMatchupEvidence { teams: NbaMatchupTeam[]; position: NbaMatchupPosition | null; } interface NbaQuarterRung { at: string; hits: number; n: number; selectionKey: string; } interface NbaQuarterStat { stat: string; statLabel: string; rungs: NbaQuarterRung[]; } interface NbaQuarterLadderEvidence { playerId: number; playerName: string; window: '1q' | 'first3min'; stats: NbaQuarterStat[]; gamesWithoutPlayByPlay: number; } interface NbaSettleLine { stat: string; statLabel: string; line: string; actual: string | null; result: 'over' | 'under' | 'push' | 'void'; } interface NbaSettlePlayer { playerId: number; playerName: string; lines: NbaSettleLine[]; } interface NbaSettleSummary { over: number; under: number; pushes: number; voids: number; n: number; } interface NbaSettleRecapEvidence { finalScore: string; lineBasis: 'last_before_tip'; players: NbaSettlePlayer[]; morePlayers: number; summary: NbaSettleSummary; } interface NbaVsMeeting { date: string; value: number; result: 'over' | 'under' | 'push'; } interface NbaVsOpponentEvidence { playerId: number; playerName: string; stat: string; statLabel: string; opponentTeamId: number; opponentName: string; mainLine: string; overSelectionKey: string | null; underSelectionKey: string | null; meetings: NbaVsMeeting[]; meetingsN: number; vsAverage: number; othersAverage: number; othersN: number; fromSeason: string; smallSample: boolean; } interface NbaInsight { insightId: string; matchId: number; kind: string; ruleId: string; text: string; title: string; marketDeveloperName: string; marketLabel: string; selections: NbaInsightSelection[]; notes: string[]; disclaimer?: string | null; homeTeamName?: string | null; awayTeamName?: string | null; competitionName?: string | null; addToSlipEnabled: boolean; kickoffUtc?: string | null; pinEnabled: boolean; kickoffLabel?: string | null; quotedAtUtc: string; propReason?: NbaPropReasonEvidence | null; lineMove?: NbaLineMoveEvidence | null; teammateOut?: NbaTeammateOutEvidence | null; coHit?: NbaCoHitEvidence | null; ladder?: NbaLadderEvidence | null; matchup?: NbaMatchupEvidence | null; quarterLadder?: NbaQuarterLadderEvidence | null; settleRecap?: NbaSettleRecapEvidence | null; vsOpponent?: NbaVsOpponentEvidence | null; homeTeamImagePath?: string | null; awayTeamImagePath?: string | null; competitionImagePath?: string | null; } interface NbaInsightEventData { insight: NbaInsight; } type NflInsightKind = 'settle_recap' | 'prop_reason' | 'ladder' | 'injury_report' | 'line_move' | 'ats_record' | 'matchup'; interface NflInsightSelection { key: string; marketDeveloperName: string; selectionLabel: string; side: string; line?: string | null; price: number; priceFormats: OddsForms; quotedAtUtc: string; matchOddsId?: number | null; } interface NflPropReasonGame { week: number; opponent: string; value?: number | null; result?: string | null; } interface NflPropReasonEvidence { playerId: number; playerName: string; propType: string; propLabel: string; line: string; hits: number; misses: number; pushes: number; n: number; games: NflPropReasonGame[]; } interface NflLadderRung { at: string; hits: number; selectionKey: string; } interface NflLadderEvidence { playerId: number; playerName: string; propType: string; propLabel: string; n: number; rungs: NflLadderRung[]; } interface NflInjuryPlayer { name: string; position?: string | null; status: string; statusLabel: string; } interface NflInjuryReportEvidence { teamId: number; teamName: string; teamAbbr: string; opponentAbbr: string; players: NflInjuryPlayer[]; morePlayers: number; } interface NflLineMoveLane { market: string; side: string; openLine?: string | null; openPrice: number; openPriceFormats: OddsForms; openAt: string; line?: string | null; price: number; priceFormats: OddsForms; quotedAtUtc: string; } interface NflLineMoveEvidence { lanes: NflLineMoveLane[]; } interface NflAtsGame { week: number; opponentAbbr: string; spreadLine: string; result: string; } interface NflAtsRecordEvidence { teamId: number; teamName: string; teamAbbr: string; finishedGames: number; n: number; w: number; l: number; p: number; withoutOpening: number; games: NflAtsGame[]; } interface NflMatchupEvidence { defenseTeamName: string; defenseAbbr: string; offenseTeamName: string; offenseAbbr: string; position: string; basis: string; yardsPerGame: number; touchdownsPerGame: number; rank: number; rankedTeams: number; n: number; } interface NflSettleRecapLine { propType: string; propLabel: string; line?: string | null; actual?: number | null; result: string; } interface NflSettleRecapPlayer { playerId: number; name: string; lines: NflSettleRecapLine[]; } interface NflSettleRecapSummary { over: number; under: number; pushes: number; yes: number; no: number; voids: number; n: number; } interface NflSettleRecapEvidence { finalScore: string; lineBasis: string; players: NflSettleRecapPlayer[]; morePlayers: number; summary: NflSettleRecapSummary; } interface NflInsight { insightId: string; matchId: number; kind: string; text: string; title: string; marketDeveloperName?: string | null; marketLabel?: string | null; selections: NflInsightSelection[]; disclaimer?: string | null; homeTeamName: string; awayTeamName: string; homeTeamAbbr: string; awayTeamAbbr: string; competitionName: string; addToSlipEnabled: boolean; pinEnabled: boolean; kickoffUtc?: string | null; kickoffLabel?: string | null; quotedAtUtc?: string | null; sport: string; propReason?: NflPropReasonEvidence | null; ladder?: NflLadderEvidence | null; injuryReport?: NflInjuryReportEvidence | null; lineMove?: NflLineMoveEvidence | null; atsRecord?: NflAtsRecordEvidence | null; matchup?: NflMatchupEvidence | null; settleRecap?: NflSettleRecapEvidence | null; homeTeamImagePath?: string | null; awayTeamImagePath?: string | null; competitionImagePath?: string | null; [key: string]: unknown; } interface NflInsightEventData { insight: NflInsight; } type TennisInsightKind = 'serve_return' | 'serve_form' | 'season_path'; interface TennisInsightPlayer { playerId: number; name: string; shortName: string; countryCode?: string | null; } interface TennisInsightPrices { label: string; p1Name: string; p1: OddsForms; p2Name: string; p2: OddsForms; quotedAtUtc: string; } interface TennisFieldDot { playerId: number; servePct: number; returnPct: number; } interface TennisMarkedPlayer { player: TennisInsightPlayer; servePct: number; returnPct: number; matches: number; serveRank?: number | null; returnRank?: number | null; rankLine: string; } interface TennisServeReturnEvidence { tourServePct: number; tourReturnPct: number; fieldSize: number; field: TennisFieldDot[]; marked: TennisMarkedPlayer[]; xAxis: string; yAxis: string; tourAverage: string; } interface TennisServeFormMatch { matchId: number; opponent: string; opponentCountryCode?: string | null; result: 'W' | 'L'; score?: string | null; roundLabel?: string | null; tournamentName?: string | null; servePct: number; firstServeWonPct?: number | null; breakPointsSavedPct?: number | null; } interface TennisServeFormLabels { metric: string; tourAverage: string; average: string; inWins: string; inLosses: string; range: string; win: string; loss: string; } interface TennisServeFormEvidence { player: TennisInsightPlayer; tourServePct: number; tourSeason: number; matches: TennisServeFormMatch[]; average: number; winsAverage?: number | null; lossesAverage?: number | null; min: number; max: number; labels: TennisServeFormLabels; } interface TennisSeasonEvent { tournamentId: number; /** May be "" when the source has no name; the event still counts in the record. */ name: string; surface?: string | null; round: string; roundIndex: number; roundLabel: string; /** Short axis form of `roundLabel` (e.g. "QF"). */ roundShort: string; wins: number; losses: number; title: boolean; alive: boolean; laterRoundsMissing: boolean; } /** `code` is "hard", "clay", "grass", or "other" for a bar with no known surface. */ interface TennisSurfaceLegend { code: string; label: string; } interface TennisSeasonPathEvidence { player: TennisInsightPlayer; wins: number; losses: number; titles: number; events: TennisSeasonEvent[]; record: string; legend: TennisSurfaceLegend[]; titleMark: string; laterRoundsMissingLabel: string; /** Names the dashed outline on an event still being played. Absent -> that outline is not drawn. */ aliveLabel?: string | null; } interface TennisInsight { insightId: string; kind: string; tour: string; season: number; title: string; subtitle?: string | null; matchId?: number | null; prices?: TennisInsightPrices | null; serveReturn?: TennisServeReturnEvidence | null; serveForm?: TennisServeFormEvidence | null; seasonPath?: TennisSeasonPathEvidence | null; } interface TennisInsightEventData { insight: TennisInsight; } interface MarketOddsRow { selectionLabel: string; side?: string | null; line?: string | null; price: number; priceFormats: OddsForms; bookmakerId?: number; bookmakerName?: string | null; isLive?: boolean; quotedAtUtc?: string; matchOddsId?: number | null; isMainLine?: boolean; /** The bookmaker is not taking this selection. Absent on older servers -> treated as open. */ isSuspended?: boolean; /** The selection text exactly as the visitor should read it. Present only when it differs from `selectionLabel` + `line`, which the slip keeps getting raw. */ displayLabel?: string | null; previousPrice?: number | null; previousPriceFormats?: OddsForms | null; previousPriceAtUtc?: string | null; movementDirection?: 'shortened' | 'drifted' | null; movementLookbackHours?: number | null; [key: string]: unknown; } interface MarketOddsCard { matchId: number; homeTeamName?: string | null; awayTeamName?: string | null; competitionName?: string | null; kickoffUtc?: string | null; marketDeveloperName?: string; marketLabel?: string; mainLine?: string | null; rows?: MarketOddsRow[]; disclaimer?: string | null; addToSlipEnabled?: boolean; pinEnabled?: boolean; homeTeamImagePath?: string | null; awayTeamImagePath?: string | null; competitionImagePath?: string | null; /** Server-rendered kickoff chip in the operator's zone + language. Prefer over local formatting of kickoffUtc. */ kickoffLabel?: string | null; /** `basketball` on an NBA game card, `americanfootball` on an NFL one; absent or null reads as football. */ sport?: string | null; /** Short team names (NFL), drawn as the badge in place of a crest. */ homeTeamAbbr?: string | null; awayTeamAbbr?: string | null; /** The strongest stat for this card's market and fixture, already in the turn's language. */ insight?: MarketOddsCardInsight | null; /** Up to 2 stats for this card's exact market, strongest first; insights[0] is always the same * object as insight. Null exactly when insight is null. Absent on older servers. */ insights?: MarketOddsCardInsight[] | null; /** Why the server sent this card unasked: `your_market` for the market the user bets on. */ tag?: string | null; /** Present when the card is for a live (in-progress) fixture; null on pre-match cards. */ live?: MarketOddsLiveBlock | null; /** Open markets the Following tab lists for this match. The widget shows "All markets (N)" * when it is 2 or more. Absent on older servers. */ marketCount?: number | null; [key: string]: unknown; } /** Live state snapshot attached to a MarketOddsCard for an in-progress fixture. */ interface MarketOddsLiveBlock { /** LiveMonitorPhase vocabulary: preMatch | live | fullTime | postponed | gone. */ phase: string; homeScore?: number | null; awayScore?: number | null; minuteLabel?: string | null; isSuspended: boolean; isSettled: boolean; /** ISO-8601 UTC timestamp of the newest price in this snapshot. */ asOfUtc: string; /** null when the market is open; "suspended" | "no_live_price" | "full_time" when closed. */ closedReason?: string | null; /** The live fact for this match. The server sends it only while the card is open; the widget refreshes or clears it on each live update. */ fact?: LiveMonitorFact | null; } interface MarketOddsCardInsight { insightId: string; ruleId: string; text: string; } interface MarketOddsEventData { card: MarketOddsCard; } interface ComboLeg { matchId: number; homeTeamName: string; awayTeamName: string; competitionName?: string | null; kickoffUtc: string; /** Server-rendered, operator zone + language, like MarketOddsCard. */ kickoffLabel?: string | null; homeTeamImagePath?: string | null; awayTeamImagePath?: string | null; marketDeveloperName: string; marketLabel: string; selectionLabel: string; side?: string | null; line?: string | null; price: number; priceFormats: OddsForms; matchOddsId: number; bookmakerId: number; quotedAtUtc: string; /** Over or Under, derived from the bookmaker's raw label and never from the localized `selectionLabel`. Absent for a market that is not Over/Under and from an older server. */ direction?: 'over' | 'under'; /** The server allows pinning this leg's match. Absent on an older server, which means no pin. */ pinEnabled?: boolean; /** The stat behind the leg. Absent or null on an open answer when the leg has none (stage 3 contract §3); * an older server always sends one. */ insight?: { insightId: string; ruleId: string; text: string; } | null; /** A player prop's recent-games count for its own side: `hits` of the last `games` games (5 to `window`). * Counts only, the widget writes the sentence. Absent when the leg has none. */ fact?: { hits: number; games: number; window: number; } | null; } interface ComboReplacedLeg { matchId: number; homeTeamName: string; awayTeamName: string; reason: 'no_price' | 'suspended' | 'kicked_off' | 'outside_limits'; } interface ComboCard { /** Stable for the same legs: the sorted matchOddsIds joined by "-". */ comboId: string; kind: 'around' | 'at_least'; target: number; targetFormats: OddsForms; legCount: number; /** In kickoff order. */ legs: ComboLeg[]; /** Product of leg prices, rounded half-away-from-zero to 2 dp. */ total: number; totalFormats: OddsForms; /** "1.57 × 2.20 × 1.44 = 4.97", prices with 2 dp, "×" is U+00D7. */ multiplication: string; /** R12: legs swapped out since the tile was built; usually empty. */ replacedLegs: ComboReplacedLeg[]; /** Server-rendered in the turn's language; null when replacedLegs is empty (G5). Shown as given. */ replacedNote: string | null; /** The operator's AddToSlipEnabled. */ addToSlipEnabled: boolean; [key: string]: unknown; } interface ComboCardEventData { card: ComboCard; } /** Onboarding presets stage 2 grid (contract §2). A pick has exactly ComboLeg's fields, so the * widget draws one leg shape everywhere. */ type PresetPick = ComboLeg; interface PresetComboCell { /** The asked target, e.g. 5.0. */ total: number; totalFormats: OddsForms; /** The asked leg count. */ legs: number; combo: { comboId: string; /** The built product, 2 dp. */ total: number; totalFormats: OddsForms; /** "1.57 × 2.20 × 1.44 = 4.97", as ComboCard.multiplication. */ multiplication: string; /** In kickoff order. */ legs: PresetPick[]; }; } /** Stage 3 contract §2: `pool: 'open'` asks for the open grid, whose legs may carry no stat. */ interface PresetGridOptions { pool?: 'open'; } interface PresetGrid { builtAtUtc: string; /** min(6, OperatorConfig.MaxAccaLegs), G9. */ maxLegs: number; combos: PresetComboCell[]; totalOptions: PriceOption[]; [key: string]: unknown; } /** The sentence builder's grid: GET price-presets with a combo size and a total. Every field is always present; nulls are null. */ type BuilderGridStatus = 'ok' | 'miss' | 'paused' | 'noSwap'; interface BuilderGridPayload { status: BuilderGridStatus; sport: string; requestedLegs: number; totalTarget: string; widened: boolean; total: number | null; totalFormats: OddsForms | null; multiplication: string | null; legs: ComboLeg[]; legCountThatLands: number | null; /** True when no combo lands on the asked total and `legs` is the closest one. */ nearest?: boolean; /** Which combo of `variants` this is (0 is the best). Null on miss, paused and noSwap; absent from an older server. */ variant?: number | null; /** How many distinct combos the server can offer for this ask. */ variants?: number | null; } /** The most ids a builder request may list in `swapped`; the server answers 400 for more. */ declare const MAX_SWAPPED_IDS = 12; /** `total` and the combo size are the visitor's control state; the server decides what lands. */ interface BuilderGridRequest { sport: string; marketKey?: string | null; matchIds: string[]; legs: number; total: string; widen: boolean; /** * Ask for every allowed pick of the market in the one game in `matchIds` (with legs 1, total 'any', widen false) instead of the one best pick. * A fact's price uses it to find its own bet among them. A server that does not know the flag drops it and answers the one pick. */ allLegs?: boolean; /** Which combo to answer: 0 is the best, 1 and up are the next ones. Left out at 0. */ variant?: number; /** The `matchOddsId`s of the legs a swap keeps; the answer is those legs plus one new leg. */ keep?: number[]; /** The `matchOddsId`s of legs already swapped out of this slot; the new leg is none of them. */ swapped?: number[]; /** The `matchOddsId` of one price to look up again for add-to-slip; needs one matchId and a marketKey, and no widen. */ reprice?: number; operatorUserId?: string; anonymousUserId?: string; } /** Favourites. `id` is opaque to the widget (sport-qualified upstream: `nba:team:14`; football is bare). */ type FavouriteKind = 'competition' | 'team' | 'player'; interface FavouriteEntity { kind: FavouriteKind; id: string; name: string; imageUrl?: string; /** Players only. */ teamName?: string; /** Search results only. */ starred?: boolean; } interface FavouritesPayload { competitions: FavouriteEntity[]; teams: FavouriteEntity[]; players: FavouriteEntity[]; /** Always present; teams and players only. */ suggestions: FavouriteEntity[]; } /** The list call's answer when the server refuses the visitor's ids (400 NoAcceptedIdentity): the brand has anonymous ids off. */ type FavouritesNoIdentity = 'noAcceptedIdentity'; type FavouriteStarResult = 'starred' | 'alreadyStarred' | 'atCap'; interface FavouriteStarResponse { status: FavouriteStarResult; count?: number; cap?: number; } interface AvailableMarket { marketDeveloperName: string; marketLabel: string; rank: number; hasInsight: boolean; suspended: boolean; } interface MarketOddsBlock { card: MarketOddsCard; insight?: { text: string; }; } interface PlayerPropPrice { matchOddsId: number; label: string; line: number | null; price: number; priceFormats: OddsForms; quotedAtUtc: string; /** Games in the sample that cleared this price. NFL only. */ hits?: number | null; } interface PlayerPropStatGame { opponent: string; isHome: boolean; value: number; } interface PlayerPropStat { /** `points`, `rebounds`, `assists` or `threes` for NBA; an NFL stat key otherwise. */ stat: string; /** Server-localized long and short stat words. */ label: string; shortLabel: string; marketDeveloperName: string; line: number | null; over: PlayerPropPrice | null; under: PlayerPropPrice | null; ladder: PlayerPropPrice[]; /** Newest first. NFL only; `hits` on the prices in this stat count within these games. */ games?: PlayerPropStatGame[] | null; } interface PlayerPropFact { playerId: number; playerName: string; side: 'home' | 'away'; stat: string; /** Server-localized long and short stat words. */ label: string; shortLabel: string; marketDeveloperName: string; at: number; hits: number; games: number; window: 'last' | 'home' | 'away'; price: PlayerPropPrice; } interface NflFormGame { opponent: string; isHome: boolean; teamScore: number; opponentScore: number; openingSpread: number | null; ats: 'covered' | 'missed' | 'push' | null; year: number; opponentCrestUrl?: string | null; } interface NflForm { home: NflFormGame[]; away: NflFormGame[]; headToHead: NflFormGame[]; } interface NbaFormGame { etDate: string; opponent: string; isHome: boolean; teamScore: number; opponentScore: number; openingSpread: number | null; ats: 'covered' | 'missed' | 'push' | null; opponentCrestUrl?: string | null; } interface NbaNextGame { etDate: string; opponent: string; isHome: boolean; opponentCrestUrl?: string | null; } interface NbaTeamFormRest { rest: 'b2b_second' | 'three_in_four' | 'b2b_first' | 'rest'; restDays: number; previousEtDate: string; next: NbaNextGame | null; last5: NbaFormGame[]; wins: number; losses: number; venueWins: number; venueLosses: number; } interface NbaFormRest { etDate: string; home?: NbaTeamFormRest | null; away?: NbaTeamFormRest | null; } interface PlayerPropGame { pts: number; reb: number; ast: number; fg3m: number; opponent: string; } /** A player's box line so far in a game in progress. */ interface PlayerPropLive { secondsPlayed: number; pts: number; reb: number; ast: number; fg3m: number; fgm: number; fga: number; pf: number; } interface PlayerPropsBundle { matchId: number; startsAtUtc: string; homeAbbreviation: string; awayAbbreviation: string; addToSlipEnabled: boolean; /** True for in-game prices on a game in progress. Absent from servers older than live props. */ live?: boolean; /** When the live box was last refreshed. Only on a live bundle. */ boxAsOfUtc?: string | null; players: Array<{ playerId: number; name: string; position: string | null; jerseyNumber: string | null; side: 'home' | 'away'; imagePath?: string | null; last5: PlayerPropGame[]; stats: PlayerPropStat[]; /** The player's box line so far. Only on a live bundle. */ live?: PlayerPropLive | null; /** NFL only. The player's live box line. Only on a live bundle. */ nflLive?: NflPropLive | null; }>; /** NFL only. */ facts?: PlayerPropFact[] | null; /** NFL only. */ form?: NflForm | null; /** NBA only. */ nbaForm?: NbaFormRest | null; } interface OddsMovementPoint { atUtc?: string | null; price?: number | null; priceFormats: OddsForms; } interface OddsMovementCard { matchId: number; homeTeamName?: string | null; awayTeamName?: string | null; competitionName?: string | null; kickoffUtc?: string | null; marketDeveloperName?: string; marketLabel?: string; selectionLabel?: string; side?: string | null; line?: string | null; bookmakerId?: number; bookmakerName?: string | null; openingPrice?: number; openingPriceFormats: OddsForms; currentPrice?: number; currentPriceFormats: OddsForms; movementDirection?: 'shortened' | 'drifted' | null; windowHours?: number; points?: OddsMovementPoint[]; excludedSuspendedCount?: number; disclaimer?: string | null; isSuspended?: boolean; pinEnabled?: boolean; matchOddsId?: number | null; /** Server-rendered kickoff chip in the operator's zone + language. Prefer over local formatting of kickoffUtc. */ kickoffLabel?: string | null; /** The selection as the widget shows it, when selectionLabel and line would not read right joined. selectionLabel and line stay raw for the pin, history and slip. */ displayLabel?: string | null; [key: string]: unknown; } interface OddsMovementEventData { card: OddsMovementCard; } type PinKind = 'match' | 'market' | 'selection'; interface PinRef { key: string; kind: PinKind; matchId: number; marketDeveloperName?: string; line?: string | null; selectionLabel?: string; matchOddsId?: number | null; withHistory?: boolean; /** Absent reads as football on the server, so football pins and stored pins stay unchanged. */ sport?: SlipSport; /** 'atp' | 'wta', required on a tennis pin (lowercase; the server is case-sensitive). */ tour?: string; } interface LiveMonitorStatPrice { marketDeveloperName: string; marketLabel: string; selectionLabel: string; price?: number | null; priceFormats?: OddsForms | null; matchOddsId?: number | null; isSuspended: boolean; addToSlipEnabled: boolean; /** The chip's selection text as the visitor should read it; `selectionLabel` is still what the slip gets. */ displayLabel?: string | null; } interface LiveMonitorStatRow { label: string; homeValue: string; awayValue: string; homeNum: number; awayNum: number; market?: LiveMonitorStatPrice | null; } /** Events arrive oldest first. */ interface LiveMonitorEvent { minuteLabel: string; text: string; type: 'goal' | 'yellow' | 'red' | 'sub' | 'other' | 'td' | 'fg' | 'safety' | 'turnover'; /** The team that made the play; for an NFL `turnover` row, the team that took the ball. */ side: 'home' | 'away'; player?: string | null; /** True when this goal is an own goal (type stays 'goal'); the scorer strip marks it "(OG)". */ ownGoal?: boolean; /** True when this goal is a scored in-play penalty (type stays 'goal'); the scorer strip marks it "(pen)". */ penalty?: boolean; } type MonitorPhase = 'preMatch' | 'live' | 'fullTime' | 'postponed' | 'gone'; type HeadToHead = ClubFanDashboardHeadToHead; interface FormAndH2H { homeForm: FormMatch[]; awayForm: FormMatch[]; h2h: HeadToHead | null; homeShortCode?: string | null; awayShortCode?: string | null; } interface LiveMonitorFact { id: number; factKey: string; kind: 'league' | 'lookup' | 'tested' | 'record' | 'coachEurope' | 'milestone' | 'quarterLead' | 'quarterTotal'; minute: number; minuteLabel: string; subjectLabel: string; text: string; basis: string; market?: LiveMonitorStatPrice | null; marketState?: 'open' | 'held' | 'suspended' | null; evidence?: LiveMonitorFactEvidence | null; kickoffPrice?: number | null; kickoffPriceFormats?: OddsForms | null; } interface LiveMonitorFactEvidence { hits?: number | null; cases?: number | null; ratePct?: number | null; similarPct?: number | null; since?: string | null; } type MonitorSport = 'football' | SlipSport; /** Basketball block of a followed game. Away is the visitor. */ interface LiveMonitorBasketball { period: number; clock?: string | null; /** Raw feed word: "Half", "End of Q3", "Final". */ statusText?: string | null; homeAbbreviation: string; awayAbbreviation: string; homeNickname: string; awayNickname: string; homePeriods: (number | null)[]; awayPeriods: (number | null)[]; homeTimeoutsLeft?: number | null; awayTimeoutsLeft?: number | null; } interface NflSituation { possession: 'home' | 'away'; down: number; distance: number; ballOn: string; goalToGo: boolean; } interface NflPropLive { passCmp: number; passAtt: number; passYds: number; passTd: number; int: number; rushAtt: number; rushYds: number; rushTd: number; rec: number; recYds: number; recTd: number; } /** American football block of a followed game. Away is the visitor. Period is null before kickoff and after the game. */ interface LiveMonitorAmericanFootball { period: number | null; clock: string | null; statusText: string | null; homeAbbreviation: string; awayAbbreviation: string; homeNickname: string; awayNickname: string; homePeriods: (number | null)[]; awayPeriods: (number | null)[]; situation?: NflSituation | null; lastPlay?: string | null; } interface LiveMonitorMatch { matchId: number; phase: MonitorPhase; status: 'ok' | 'stale' | 'gone'; homeTeamName?: string | null; awayTeamName?: string | null; competitionName?: string | null; kickoffUtc?: string | null; homeScore?: number | null; awayScore?: number | null; liveMinute?: number | null; liveAddedTime?: number | null; liveStatus?: string | null; minuteLabel?: string | null; events: LiveMonitorEvent[]; statRows: LiveMonitorStatRow[]; momentum: MomentumPoint[]; availableMarkets?: AvailableMarket[]; homeCrestUrl?: string | null; awayCrestUrl?: string | null; competitionCrestUrl?: string | null; asOfUtc: string; momentumHomePct?: number | null; /** Active live facts, current first. Absent on older servers. */ facts?: LiveMonitorFact[]; /** Pinned + pre-match only -- absent/null once the match goes live, is unpinned, or on older servers. */ formAndH2H?: FormAndH2H | null; /** Absent on older servers; read it as football. */ sport?: MonitorSport; /** Set only on a basketball match. */ basketball?: LiveMonitorBasketball | null; /** Set only on an American football match. */ americanFootball?: LiveMonitorAmericanFootball | null; /** Set only on a tennis match, even a gone one: a tennis id is unique only within its tour. */ tour?: string; /** Set only on a pinned tennis match that was found. */ tennis?: LiveMonitorTennis | null; [key: string]: unknown; } interface TennisPlayerSide { playerId: number; name: string; shortName: string; countryCode?: string | null; rank?: number | null; racePosition?: number | null; } interface TennisMatchHeader { tour: string; matchId: number; tournamentId: number; season: number; tournamentName?: string | null; category?: string | null; surface?: string | null; round?: string | null; bestOf?: number | null; startsAtUtc?: string | null; scheduledDate?: string | null; timeTba: boolean; phase: string; } interface TennisWl { w: number; l: number; } interface TennisPlayerRecord { surfaceWl?: TennisWl | null; tiebreakWl?: TennisWl | null; decidingWl?: TennisWl | null; /** Omitted when the player has no career row. */ seasonWl?: TennisWl | null; titles?: number | null; } interface TennisMeeting { year: number; tournamentName?: string | null; round?: string | null; surface?: string | null; winnerId: number; score?: string | null; } interface TennisHeadToHead { p1Wins: number; p2Wins: number; last?: TennisMeeting | null; /** Newest first, at most three. Absent on an older server; the widget falls back to `last`. */ meetings?: TennisMeeting[] | null; } interface TennisCardLabels { p1RankRace?: string | null; p2RankRace?: string | null; matchWinner: string; surfaceSeason?: string | null; tiebreaks: string; decidingSets: string; seasonWl?: string | null; titles?: string | null; /** Null when the stats read failed; the widget hides the whole head to head section. */ headToHead?: string | null; lastMeeting?: string | null; ask: string; } interface LiveMonitorTennis { header: TennisMatchHeader; p1: TennisPlayerSide; p2: TennisPlayerSide; price?: TennisWinnerPrice | null; /** 'W' | 'L', newest first. */ p1Form?: string[] | null; p2Form?: string[] | null; p1Record?: TennisPlayerRecord | null; p2Record?: TennisPlayerRecord | null; headToHead?: TennisHeadToHead | null; labels: TennisCardLabels; askPrompt: string; /** Present while live and on a final card; absent before the start. */ score?: TennisScore | null; live?: TennisLiveBlock | null; } interface TennisSetScore { setNumber: number; p1Games?: number | null; p2Games?: number | null; p1Tiebreak?: number | null; p2Tiebreak?: number | null; isComplete: boolean; } /** How a match ended when it was not played out; absent when it was. */ type TennisEndState = 'retired' | 'walkover' | 'canceled' | 'abandoned'; interface TennisScore { sets: TennisSetScore[]; p1Sets: number; p2Sets: number; /** Absent once the match is final. */ currentSet?: number | null; /** Raw feed strings "0" "15" "30" "40" "A"; only while live. */ p1Point?: string | null; p2Point?: string | null; isDeuce: boolean; isTiebreak: boolean; /** Only while live. */ server?: 1 | 2 | null; asOfUtc: string; /** Set on a final that was not played out. For walkover, canceled and abandoned the set counts mean nothing * and the row's homeScore/awayScore are null; a retirement keeps its sets, the last one unfinished. */ endState?: TennisEndState | null; } type TennisStatKind = 'pct' | 'count' | 'rating'; interface TennisStatRow { key: string; kind: TennisStatKind; p1Value?: number | null; p2Value?: number | null; label: string; shortLabel: string; } interface TennisStatTable { serve: TennisStatRow[]; return: TennisStatRow[]; } interface TennisStatSet { setNumber: number; table: TennisStatTable; } interface TennisServeReturn { match: TennisStatTable; sets: TennisStatSet[]; } interface TennisTodayRow { key: string; label: string; p1Today?: number | null; p1Season?: number | null; p2Today?: number | null; p2Season?: number | null; } interface TennisTodayVsSeason { rows: TennisTodayRow[]; } interface TennisLiveLabels { baseline?: string | null; pricesPaused: string; setsSoFar: string; sets?: string | null; setLines: string[]; serve?: string; return?: string; matchTab?: string; note?: string; todayVsSeason?: string; seasonScope?: string; /** The localized end-state marker ("Ret.", "Walkover"); only when score.endState is set. */ endState?: string | null; } interface TennisLiveBlock { elapsedSeconds?: number | null; pricesPaused: boolean; labels: TennisLiveLabels; serveReturn?: TennisServeReturn | null; todayVsSeason?: TennisTodayVsSeason | null; } interface LiveMonitorMarket { key: string; status: 'ok' | 'stale' | 'gone'; phase: MonitorPhase; homeScore?: number | null; awayScore?: number | null; minuteLabel?: string | null; /** Only on a chat live card's entry (key `live:card:{matchId}`): the match's live facts, current first. */ facts?: LiveMonitorFact[] | null; homeTeamName?: string | null; awayTeamName?: string | null; card?: MarketOddsCard | null; history?: OddsMovementCard | null; isSettled: boolean; isSuspended: boolean; asOfUtc: string; homeCrestUrl?: string | null; awayCrestUrl?: string | null; kickoffUtc?: string | null; [key: string]: unknown; } interface LiveMonitorSnapshot { matches: LiveMonitorMatch[]; markets: LiveMonitorMarket[]; serverNowUtc: string; nextPollSeconds: number; } type ScheduleSport = 'football' | 'basketball' | 'americanfootball' | 'tennis'; interface ScheduleMatch { matchId: number; /** Absent means football. */ sport?: ScheduleSport; homeTeamName: string; awayTeamName: string; homeTeamImagePath?: string | null; awayTeamImagePath?: string | null; homeTeamAbbr?: string | null; awayTeamAbbr?: string | null; kickoffUnix: number; timeTba?: boolean | null; homeCountryCode?: string | null; awayCountryCode?: string | null; round?: string | null; /** Tennis only: 'atp' | 'wta'. */ tour?: string; } interface ScheduleGroup { /** Absent means football. */ sport?: ScheduleSport; competitionId: number; competitionName: string; /** Tennis only: 'atp' | 'wta'. */ tour?: string; /** Catalog country, null for continental competitions. competitionName is not an identity — * a real Saturday returns four competitions all named "Premier League". */ competitionCountry?: string | null; competitionImagePath?: string | null; rank: number; expandedByDefault: boolean; matches: ScheduleMatch[]; isStarred: boolean; isLearned: boolean; learnedRank: number | null; category?: string | null; surface?: string | null; } interface ScheduleMatchDays { sport: ScheduleSport; /** Local dates (YYYY-MM-DD) that have at least one match for this sport. */ dates: string[]; } interface LeagueStarResult { starred: boolean; } interface SchedulePayload { localDate: string; groups: ScheduleGroup[]; matchDays: ScheduleMatchDays[]; } interface MatchState { matchId: number; /** Absent means football. Football match ids and NBA game ids share a numeric space, so key on both. */ sport?: ScheduleSport; /** Tennis only: 'atp' | 'wta'. */ tour?: string; phase: MonitorPhase; minuteLabel?: string | null; homeScore?: number | null; awayScore?: number | null; /** Paused between halves. Phase stays 'live' — still in play — but there is no minute to show: * the provider holds the clock at 45 through the break. */ isHalfTime?: boolean; /** When the sync last wrote this reading. The client ages the minute against it, because the * value was already up to one sync interval old before we polled for it. */ stateAsOfUtc?: string | null; /** Tennis only: the score, on a live row of the Live tab, on a pinned live or final card, and on a final row * that was not played out (then with endState and no localized label: rows carry only the code). */ tennis?: TennisScore | null; } interface TennisWinnerPrice { bookmaker: string; p1: OddsForms; p2: OddsForms; p1Value: number; p2Value: number; p1OddsId?: number | null; p2OddsId?: number | null; addToSlipEnabled: boolean; quotedAtUtc: string; isLive: boolean; /** The opening price, pre-match only; absent when the price never moved off it. */ p1Previous?: OddsForms | null; p2Previous?: OddsForms | null; previousAtUtc?: string | null; /** 'shortened' | 'drifted'; absent when equal to the opening. */ p1Direction?: string | null; p2Direction?: string | null; /** Live price only: which price the movement arrows compare against. */ baselineKind?: 'opening' | 'preMatch' | null; } interface TennisRowPrice { matchId: number; tour: string; price?: TennisWinnerPrice | null; } /** A tennis match is unique only within its tour. */ interface TennisMatchKey { tour: string; matchId: number; } interface StatesPayload { states: MatchState[]; /** Absent or null: no price column (odds off, persona off, or no ids sent). */ tennisPrices?: TennisRowPrice[] | null; } interface EventEnvelope { type: TType; requestId: string; timestamp: string; data: TData; } type ChatEvent = EventEnvelope<'progress', ProgressEventData> | EventEnvelope<'answer', AnswerEventData> | EventEnvelope<'entity_card', EntityCardEventData> | EventEnvelope<'action_button', ActionButtonEventData> | EventEnvelope<'intent_chip', IntentChipEventData> | EventEnvelope<'actions_loading', ActionsLoadingEventData> | EventEnvelope<'turn_complete', TurnCompleteEventData> | EventEnvelope<'betting_insight', BettingInsightEventData> | EventEnvelope<'nba_insight', NbaInsightEventData> | EventEnvelope<'nfl_insight', NflInsightEventData> | EventEnvelope<'tennis_insight', TennisInsightEventData> | EventEnvelope<'compare_card', CompareCardEventData> | EventEnvelope<'market_odds', MarketOddsEventData> | EventEnvelope<'combo_card', ComboCardEventData> | EventEnvelope<'odds_movement', OddsMovementEventData> | EventEnvelope<'error', StreamErrorEventData>; interface GameSummary { gameId: string; gameDay: string; fixtureId: number; kind: 'daily' | 'fixture'; ranked: boolean; status: 'available' | 'in_progress' | 'played' | 'locked' | 'graded' | 'voided'; score?: number | null; isCorrect?: boolean | null; lockAtUtc?: string | null; kickoffUtc?: string | null; title?: string | null; } interface GameListPayload { gameDay: string; games: GameSummary[]; } interface GameStatePayload { gameId: string; gameDay: string; configJson?: string | null; } interface SubmitPlayBody { operatorUserId: string; gameDay: string; answerJson?: string | null; fixtureId?: number; } interface SubmitPlayResult { alreadyPlayed: boolean; score: number; isCorrect: boolean; clientStateJson?: string | null; attemptsUsed: number; weeklyRank?: number | null; pointsDelta?: number | null; currentStreak?: number | null; } interface GameResultPayload { status: 'in_progress' | 'played' | 'graded' | 'pending' | 'voided'; score: number; isCorrect: boolean; clientStateJson?: string | null; attemptsUsed: number; } interface LeaderboardRow { rank: number; operatorUserId: string; handle: string; points: number; currentStreak: number; } interface AllTimeRow { rank: number; operatorUserId: string; handle: string; allTimePoints: number; } /** Winner of the previous (frozen) week, surfaced on the empty-board state for continuity. */ interface LeaderboardChampion { handle: string; points: number; } interface LeaderboardPayload { week: string; weeklyTop: LeaderboardRow[]; myWeeklyRow?: LeaderboardRow | null; allTimeTop: AllTimeRow[]; myAllTimeRow?: AllTimeRow | null; /** Prize label configured for the current week; absent/null when no prize is set. */ weeklyPrize?: string | null; /** Previous week's champion; absent/null on a club's first-ever week (cold start). */ lastWeek?: LeaderboardChampion | null; } interface ClubFixture { id: number; competitionId: number | null; competitionName: string | null; seasonName: string | null; round: string | null; matchDateTime: string | null; stadiumName: string | null; matchState: string | null; homeTeamId: number | null; homeTeamName: string | null; homeScore: number | null; awayTeamId: number | null; awayTeamName: string | null; awayScore: number | null; } interface ClubFixturesPayload { fixtures: ClubFixture[]; } interface ClubStandingRow { table: string | null; position: number; teamId: number; teamName: string; playedGames: number; wins: number; draws: number; losses: number; goalsFor: number; goalsAgainst: number; goalDifference: number; points: number; } interface ClubStandingsPayload { competitionId: number; seasonName: string; rows: ClubStandingRow[]; } interface ClubSquadPlayer { playerId: number; playerName: string; positionId: number | null; positionName: string | null; detailedPositionName: string | null; jerseyNumber: number | null; } interface ClubSquadPayload { players: ClubSquadPlayer[]; } interface ClubPlayerSeasonStats { playerId: number; playerName: string; positionName: string | null; jerseyNumber: number | null; appearances: number; goals: number; assists: number; yellowCards: number; redCards: number; minutesPlayed: number; averageRating: number | null; expectedGoals: number | null; totalShots: number | null; starts?: number; positionCode?: string | null; } interface ClubSquadStatsPayload { seasonName: string; competitionName?: string | null; clubMatchesPlayed?: number; players: ClubPlayerSeasonStats[]; } type ClubPlayerAvailabilityStatus = 'available' | 'injured' | 'suspended' | 'unavailable'; interface ClubPlayerAvailability { status: ClubPlayerAvailabilityStatus; detail?: string | null; expectedReturnUnixMs?: number | null; } interface ClubNextFixture { matchId: number; kickoffUnixMs: number; opponentName: string; isHome: boolean; } interface ClubMatchLogRow { matchId: number; kickoffUnixMs: number; opponentName: string; isHome: boolean; goalsFor: number; goalsAgainst: number; result: 'W' | 'D' | 'L'; minutes: number; goals: number; assists: number; yellowCards: number; sentOff: boolean; rating?: number | null; } interface ClubPerformanceMetric { key: string; group: 'shooting' | 'passing' | 'possession' | 'defending'; total?: number | null; per90?: number | null; totalRank?: number | null; per90Rank?: number | null; isPercent: boolean; } interface ClubPlayerPerformance { positionGroup: 'G' | 'D' | 'M' | 'F'; cohortSize: number; ranked: boolean; /** Why `ranked` is false; null when ranked. Absent from APIs older than this field. */ unrankedReason?: 'minutes' | 'cohort' | 'noLeague' | null; metrics: ClubPerformanceMetric[]; } interface ClubPlayerDetailPayload { playerId: number; playerName: string; positionName: string | null; jerseyNumber: number | null; nationality: string | null; dateOfBirthUnixMs: number | null; heightCm: number | null; foot: string | null; seasonStats: ClubPlayerSeasonStats; photoUrl?: string | null; teamName?: string | null; positionCode?: string | null; competitionName?: string | null; availability?: ClubPlayerAvailability | null; nextFixture?: ClubNextFixture | null; matchLog?: ClubMatchLogRow[]; performance?: ClubPlayerPerformance | null; } interface ClubRecordEntry { playerId: number; playerName: string; value: number; } interface ClubRecordsPayload { topScorers: ClubRecordEntry[]; mostAssists: ClubRecordEntry[]; mostAppearances: ClubRecordEntry[]; sinceSeasonName: string | null; } declare const PENDING_TTL_MS: number; declare const PENDING_MAX_EVENTS = 200; declare const PENDING_MAX_BYTES: number; interface CarryOverStore { has(): boolean; save(owner: string, batches: readonly EventBatch[], keepaliveSent: ReadonlySet, now: number): ReadonlySet; remove(batchId: string): void; take(owner: string, now: number): EventBatch[]; addDropped(count: number): void; takeDropped(): number; } /** Batches the page could not confirm, kept for the next visit. Null when localStorage is blocked. */ declare function openCarryOver(operatorId: string, storage?: () => Storage | undefined): CarryOverStore | null; type Id = string; type CatalogueEventProps = { widget_loaded: { loadMs: number; }; widget_init_failed: { reason: 'mount_failed'; }; strings_state: { state: 'loading' | 'ready' | 'fallback' | 'retrying' | 'unavailable'; attempt: number; resolvedTag?: string; }; slip_unavailable: { reason: 'no_handler'; }; storage_blocked: { store: 'local' | 'session'; }; widget_error: { errorClass: string; component: string; }; request_failed: { endpoint: string; status: number; }; visibility_change: { state: 'hidden' | 'visible'; panelOpen: boolean; }; identity_change: { kind: 'signed_in' | 'signed_out'; }; language_change: { from: string | null; to: string | null; source: 'host'; }; bubble_suppressed: { reason: 'strings_pending' | 'host_unconfirmed'; }; bubble_intro_played: { hasPopupText: boolean; }; tab_redirect: { from: string; to: string; reason: 'club' | 'no_match_pins' | 'no_market_pins' | 'unreachable'; }; tab_view: { tab: 'fixtures' | 'standings' | 'squad' | 'records'; }; tab_dot_shown: { tab: 'chat' | 'live' | 'following' | 'trends'; trigger: 'reply' | 'live_count' | 'goal_or_red' | 'price_move'; }; menu_open: Record; sheet_open: { sheet: 'settings' | 'favourites' | 'combo_tool' | 'match' | 'player'; surface: string; }; sheet_close: { sheet: 'settings' | 'favourites' | 'combo_tool' | 'match' | 'player'; method: 'button' | 'escape' | 'backdrop' | 'back' | 'send' | 'auto'; }; panel_back: { layer: 'favourites' | 'settings' | 'combo_tool' | 'player' | 'tab' | 'none'; }; layout_change: { layout: 'modal' | 'fullscreen'; }; squad_view_change: { view: 'roster' | 'stats'; }; greeting_loaded: { latencyMs: number; hook: string; }; greeting_failed: { code: string; }; greeting_section_view: { section: 'you_ribbon' | 'follow_suggestions' | 'guess' | 'invite' | 'prompt'; count: number; }; greeting_chip_click: { chip: string; }; you_ribbon_more: { more: number; }; guess_dismiss: { kind: string; id: Id; }; market_menu_open: { market: string; }; market_rechoose: { market: string; kind: 'same' | 'revert'; }; dashboard_card_expand: { card: 'live_timeline' | 'injuries'; open: boolean; }; fan_card_tap: { cardType: string; actionRef?: string; }; builder_cooloff: { sport: string; }; input_start: Record; input_blocked: { reason: 'paused' | 'limit' | 'empty' | 'disabled'; }; draft_abandoned: { length: number; }; answer_link_click: { host: string; }; chips_shown: { kind: 'starters' | 'actions'; count: number; ids: string[]; restored?: boolean; }; card_view: { type: string; index: number; restored?: boolean; turnId?: string; matchId?: string; market?: string; }; card_scope_change: { card: string; scope: number; competitionId?: string; }; cards_expand: { count: number; open: boolean; }; fact_history_expand: { matchId: string; count: number; }; monitor_section_toggle: { sport?: string; matchId?: string; section: string; value: string; }; conversation_restored: { source: 'page' | 'tab_sync' | 'language'; }; conversation_reset: { source: 'tab_sync' | 'language' | 'stale' | 'page'; }; odds_more_toggle: { matchId: string; market?: string; count: number; open: boolean; }; add_all_result: { attempted: number; added: number; stop?: 'login' | 'closed' | 'moved'; surface?: string; turnId?: string; }; add_all_blocked: { reason: 'started'; legs: number; }; pin_blocked: { target: 'match' | 'market'; reason: 'match_limit' | 'market_limit' | 'already'; matchId?: string; market?: string; }; all_markets_blocked: { reason: 'match_limit'; matchId: string; }; price_stale_shown: { matchId: string; ageS: number; }; card_closed: { matchId: string; reason: 'suspended' | 'no_live_price' | 'full_time'; }; slip_unavailable_shown: { reason: 'hold' | 'closed' | 'started'; matchId: string; }; market_accordion_toggle: { matchId: string; market: string; open: boolean; }; market_retry: { matchId: string; market: string; }; market_load_failed: { matchId: string; market: string; kind: 'error' | 'timeout'; }; market_suspended_shown: { matchId: string; market: string; }; price_update_seen: { matchId: string; market: string; direction: 'up' | 'down'; }; builder_choice: { control: 'market' | 'games' | 'widen' | 'legs' | 'total'; value: string; sport: string; }; builder_custom_total_open: { oddsFormat: string; }; builder_custom_total: { result: 'set' | 'unreadable' | 'range'; format: string; }; builder_auto_widen: { market: string; }; builder_error: { status: number; }; builder_retry: { status: number; }; builder_paused_shown: Record; builder_empty_shown: { kind: 'no_prices' | 'miss'; legs: number; widened: boolean; }; builder_swap_unavailable: { legId: string; }; builder_sport_switch: { sport: string; }; combo_change_click: { control: 'open'; total: string; legs: number; }; combo_tool_adjust: { control: 'total' | 'legs'; total: string; legs: number; }; live_filter: { kind: 'sport' | 'mine' | 'league_clear'; value: string; }; schedule_filter: { kind: 'sport' | 'day'; value: string; }; schedule_search: { length: number; results: number; }; schedule_retry: { sport: string; day: string; }; league_group_toggle: { competitionId: string; open: boolean; count: number; }; league_show_all: { competitionId: string; count: number; }; league_live_jump: { competitionId: string; }; see_all_matches_click: { day: string; }; match_sheet_open: { matchId: string; competitionId?: string; sport: string; surface: 'live' | 'matches'; live: boolean; }; followed_match_select: { matchKey: string; }; trend_select: { market: string; }; player_open: { playerId: string; from: 'roster' | 'stats'; }; player_close: { playerId: string; method: 'button' | 'back' | 'tab'; }; games_segment_change: { segment: 'play' | 'leaderboard'; }; leaderboard_segment_change: { segment: 'weekly' | 'alltime'; }; leaderboard_empty_cta: { segment: string; }; game_open: { gameId: string; variant: 'tile' | 'wide' | 'hero'; }; game_close: { gameId: string; variant?: string; }; game_start: { gameId: string; round: number; }; game_answer: { gameId: string; round: number; correct?: boolean; score?: number; }; game_hint: { gameId: string; round: number; }; game_complete: { gameId: string; round: number; correct: boolean; score: number; }; login_wall_shown: { surface: 'games'; }; favourites_sport_change: { sport: string; }; favourites_search: { kind: string; length: number; results: number; }; favourites_clear: { step: 'open' | 'cancel' | 'confirm'; count: number; ok?: boolean; }; favourites_refused: { sport: string; }; favourites_load_failed: { sport: string; }; setting_change: { setting: 'odds_format' | 'theme'; value: string; from: string; }; settings_rows_shown: { oddsOffered: boolean; themeLocked: boolean; }; widget_settings_failed: Record; limit_shown: { code: string; resetsAt?: string; }; limit_cleared: { code: string; }; toast_shown: { kind: string; source: 'add_to_slip' | 'add_all' | 'pin' | 'all_markets' | 'price_history' | 'greeting_price'; }; empty_state_shown: { surface: 'live' | 'matches' | 'following' | 'trends' | 'favourites' | 'leaderboard'; kind: string; }; monitor_poll_failed: { status: number; }; monitor_disabled: Record; props_load_failed: { matchId: string; }; }; type NoEntityFields = { [K in Exclude]?: never; }; type CatalogueEventName = keyof CatalogueEventProps; type CatalogueEventInput = { [K in CatalogueEventName]: { name: K; props: CatalogueEventProps[K]; } & NoEntityFields; }[CatalogueEventName]; interface SessionStore { readonly id: string; readonly storage: 'session' | 'memory'; touch(at: number): void; } declare const SESSION_IDLE_MS: number; /** The session id lives in sessionStorage with a last-activity time, so a reload within 30 minutes keeps it. */ declare function openSession(operatorId: string, now: number, storage?: () => Storage | undefined): SessionStore; type FetchLike = (input: string, init: RequestInit) => Promise; interface StatsWidgetClientOptions { operatorId: string; publicKey: string; baseUrl?: string; /** Advanced/testing: inject a fetch implementation. Defaults to globalThis.fetch. */ fetch?: FetchLike; /** Sent as X-SS-Client; set by widget-react. */ client?: string; /** IANA zone sent as X-SS-Time-Zone; the browser's zone when absent or not one Intl knows. */ timeZone?: string; } type OddsFormat = 'decimal' | 'american' | 'fractional'; interface WidgetSettings { oddsOffered: boolean; } interface UserContext { operatorUserId?: string; defaultLanguage?: string; anonymousUserId?: string; oddsFormat?: OddsFormat; } interface ChatGrounding { kind?: string; matchId?: number; opponentTeamId?: number; teamId?: number; competitionId?: number; season?: string; subject?: string; personaHint?: string; sport?: string; /** Tennis only: a match id is unique within its tour. */ tour?: string; } /** The page the widget sits on. Sent on greeting requests only, so the greeting can lead with that page. */ interface PageContext { sport: 'football' | 'basketball' | 'americanfootball' | 'tennis'; kind?: 'section' | 'competition' | 'match'; matchId?: string | number; competitionId?: string | number; } /** Onboarding presets stage 2 (contract §3): what a tool's Send asked for. Sent only from a tool's * Send, beside the full sentence in `message`. The server ignores it unless every value is valid. */ interface ChatPreset { kind: 'combo'; total: number; legs: number; /** The legs the builder showed, in the order shown (R12: the answer reprices exactly these). */ matchOddsIds: number[]; /** The same legs' matchId, index for index with matchOddsIds (from the grid). */ matchIds: number[]; } interface ChatInput { message: string; conversationId?: string; actionId?: string; /** Opaque predefined-action-contract ref (e.g. a club-dashboard tap). Authoritative over `message` when present. */ actionRef?: string; userContext?: UserContext; grounding?: ChatGrounding; /** Features this client can draw (e.g. "price_presets"). The server sends nothing that needs a * feature the list does not name; an absent list means today's responses. */ clientCapabilities?: string[]; /** The sport the visitor last chose on the greeting's sport switch (a server sport key such as "nba"); a hint for the default sport. */ rememberedSport?: string; /** Onboarding presets stage 2: set only by a preset tool's Send (contract §3). */ preset?: ChatPreset; page?: PageContext; } type SignalType = 'MatchPageView' | 'PlayerPageView' | 'TeamPageView' | 'MarketView' | 'SearchQuery' | 'SessionDepth' | 'TimeOnPage' | 'InsightViewed' | 'InsightMarketClicked' | 'BetPlacedFromInsight' | 'InsightScrollDepth' | 'ToolCall' | 'EntityMention' | 'Handoff' | 'FollowUpQuery' | 'RecommendationDismissed'; type SignalEntityType = 'Match' | 'Team' | 'Player' | 'Competition' | 'Market' | 'Article' | 'Session' | 'Query' | 'Conversation'; interface SignalInput { signalType: SignalType; entityType: SignalEntityType; /** Either this or entityId is required -- an operator's UI mostly knows a display name. */ entityName?: string; /** Either this or entityName is required -- a dashboard tile knows its entity by id. */ entityId?: string; operatorUserId?: string; anonymousUserId?: string; /** Greeting dashboard layout this signal came from, when it is a dashboard tap. */ dashboardLayout?: string; /** Zero-based tile position within the dashboard, when it is a dashboard tap. */ tileIndex?: number; /** Wire sport key ('nba'); absent means football. Set by the widget, never by an operator. */ sport?: string; } interface SlipSelection { matchOddsId: number; matchId: number; oddsDecimal: number; odds?: { format: OddsFormat; text: string; }; quotedAtUtc?: string; insightId?: string; conversationId?: string; sport?: SlipSport; /** Tennis only: a tennis match id is unique within its tour. */ tour?: string; /** The pick as the widget knows it, for a host that cannot look `matchOddsId` up. Display only: never price or settle from it. */ display?: SlipDisplay; } /** `market` is the feed's developer name. `selection` is the selection as the widget drew it: a feed label such as `Home` or `over`, or a label from an insight card such as `Boston Celtics -3.5` or `Over 220.5`, which can carry the team name and the line. `marketLabel` is the market as the widget showed it in its language. `player` names a player prop's player; `home`/`away` are team abbreviations on a prop. */ interface SlipDisplay { home?: string; away?: string; kickoffUtc?: string; market?: string; marketLabel?: string; selection?: string; line?: string; player?: string; } type AddToSlipRejectReason = 'suspended' | 'closed' | 'login_required' | 'not_found' | 'limit' | 'unsupported'; type AddToSlipResult = { status: 'added'; slip?: { selectionCount: number; totalOddsDecimal?: number; }; } | { status: 'duplicate'; } | { status: 'price_changed'; newOdds: string; accepted: boolean; } | { status: 'rejected'; reason: AddToSlipRejectReason; message?: string; }; type AddToSlipHandler = (selection: SlipSelection) => Promise | AddToSlipResult | void; declare function isAddToSlipResult(v: unknown): v is AddToSlipResult; type WidgetEntityEventName = 'pin_add' | 'pin_remove' | 'slip_click' | 'slip_result' | 'tile_tap' | 'slip_remove' | 'bet_placed' | 'match_view' | 'match_open' | 'combo_add' | 'fact_view' | 'fact_ask' | 'market_choose' | 'hook_view'; type WidgetPopupEventName = 'popup_shown' | 'popup_opened' | 'popup_dismissed'; type WidgetPopupAskEventName = 'popup_ask_tap'; type WidgetOpenEventName = 'widget_open'; type WidgetSportSwitchEventName = 'dashboard_sport_switch'; type WidgetGreetingEventName = 'greeting_shown' | 'greeting_cta_click' | 'greeting_card_tap' | 'greeting_ask_tap'; /** Public events that had no wire form before u676: they now ride the wire under their public names, their body in `props`. */ type WidgetPublicOnlyName = 'launcher_click' | 'bubble_click' | 'widget_close' | 'tab_change' | 'question_asked' | 'answer_received' | 'answer_failed' | 'answer_stopped' | 'new_conversation' | 'combo_variant_click' | 'combo_swap_click' | 'combo_add_click' | 'favourite_change'; /** Events whose fields all live in `props`. */ type WidgetPropsEventName = WidgetPublicOnlyName | 'host_bet_placed' | 'host_slip_removed' | 'host_match_opened' | 'host_page_change' | 'native_command' | 'widget_unavailable' | 'props_too_large' | CatalogueEventName; type WidgetEventName = WidgetEntityEventName | WidgetPopupEventName | WidgetPopupAskEventName | WidgetOpenEventName | WidgetSportSwitchEventName | WidgetGreetingEventName | WidgetPropsEventName; type WirePropValue = string | number | boolean | null | readonly WirePropValue[] | { readonly [key: string]: WirePropValue; }; type WireProps = { readonly [key: string]: WirePropValue; }; type WidgetEntityType = 'match' | 'team' | 'player' | 'competition' | 'market'; /** `totalChosen` is the visitor's total control as a string on the wire (`custom` when the visitor typed their own total); `totalActual` is the server's total for the shown combo. */ interface ComboAddMetadata { sport: string; legs: number; totalChosen: 'any' | '3' | '5' | '10' | '20' | '50' | 'custom'; totalActual: number; markets: string[]; } interface WidgetEventInput { name: Exclude; entityType: WidgetEntityType; entityId?: string; entityName?: string; marketDeveloperName?: string; outcome?: string; /** Football match id of the slip selection (slip_click / slip_result). */ matchId?: number; /** Odds row id of the slip selection, a positive integer; the server rejects the whole batch on a non-positive one. */ matchOddsId?: number; /** The raw odds label as stored ("Home", "Over", "Home/Draw"), never a joined display string. Max 64. */ selection?: string; /** The raw line ("2.5"). Max 32; omit when empty. */ line?: string; /** Decimal price shown when the selection was added. */ odds?: number; /** Wire sport key ('nba'); absent means football. */ sport?: string; /** Tennis only: 'atp' | 'wta'. */ tour?: string; /** combo_add only: what the visitor asked for and what the server returned. */ metadata?: ComboAddMetadata; /** fact_view / fact_ask: the live fact's id, as a string (the wire type is string, not number). */ factId?: string; /** fact_view / fact_ask: the live fact's rule key. */ factKey?: string; /** What led the greeting this event comes from: `fact`, `price_move`, `popular_match`, `big_change` or `none`. */ hook?: string; /** Event fields of the events that carry them in `props`. */ props?: WireProps; } /** The visitor's market pick (chooser or "Another market"): the developer name is the entity id and is required. */ type WidgetMarketChooseEventInput = { name: 'market_choose'; entityType: 'market'; entityId: string; props?: WireProps; } & { [K in Exclude]?: never; }; /** Launcher popup telemetry: counted server-side, never tied to an entity. */ type WidgetPopupEventInput = { name: WidgetPopupEventName; props?: WireProps; } & { [K in Exclude]?: never; }; /** A tap on one of the launcher bubble's asks. `outcome` carries the ask's position, "0" or "1" * (contract §5): the gateway forwards only the fields of its own event model, and outcome is its * one free-text field. */ type WidgetPopupAskEventInput = { name: WidgetPopupAskEventName; outcome: string; props?: WireProps; } & { [K in Exclude]?: never; }; /** The panel opening: entity-free, each open is added to the user's count for the day. */ type WidgetOpenEventInput = { name: WidgetOpenEventName; props?: WireProps; } & { [K in Exclude]?: never; }; /** The greeting sport switch: `outcome` is the sport switched to (a server sport key). Entity-free; the server drops an unknown outcome. */ type WidgetSportSwitchEventInput = { name: WidgetSportSwitchEventName; outcome: string; props?: WireProps; } & { [K in Exclude]?: never; }; /** `matchId` and `competitionId` are strings and `slot` a number: a wrong JSON type inside `greeting` makes the gateway reject the whole batch. */ interface GreetingEventPayload { greetingId: string; surface?: 'bubble' | 'panel'; case?: string; sport?: string; market?: string | null; marketStep?: string; matchStep?: string; matchId?: string | null; competitionId?: string | null; chooserShown?: boolean; slot?: number; } /** A greeting impression or tap: entity-free, the payload rides in `greeting`. */ type WidgetGreetingEventInput = { name: WidgetGreetingEventName; greeting: GreetingEventPayload; props?: WireProps; } & { [K in Exclude]?: never; }; /** A public-only event on the wire: the public body (minus its name) is its `props`. */ type WidgetPublicPropsEventInput = { name: WidgetPublicOnlyName; props?: WireProps; } & { [K in Exclude]?: never; }; /** The other props-only events: the host calls, native commands, availability and the oversize replacement. */ type WidgetWirePropsEventInput = { name: Exclude; props?: WireProps; } & { [K in Exclude]?: never; }; type WidgetCatalogueEventInput = CatalogueEventInput; type WidgetPropsEventInput = WidgetPublicPropsEventInput | WidgetWirePropsEventInput; type WidgetLogInput = WidgetEventInput | WidgetMarketChooseEventInput | WidgetPopupEventInput | WidgetPopupAskEventInput | WidgetOpenEventInput | WidgetSportSwitchEventInput | WidgetGreetingEventInput | WidgetPublicPropsEventInput | WidgetWirePropsEventInput | WidgetCatalogueEventInput; /** Where the widget stood when an event fired: stamped at log time, never at send time. */ interface WireEventScope { tab?: string; page?: PageContext; } /** Stable facts about the widget, read per batch so a changed theme or language reaches the next one. */ interface WireContext { widgetVersion: string; surface: 'web' | 'react' | 'mobile'; client?: 'ios' | 'android' | 'flutter' | 'react-native'; language?: string; resolvedLanguage?: string; tenant?: 'sportsbook' | 'club'; oddsFormat?: string; theme?: string; layout?: 'modal' | 'fullscreen'; viewport?: { w: number; h: number; }; storage: 'session' | 'memory'; } type WireEvent = WidgetLogInput & { eventId: string; seq: number; at: number; tab?: string; page?: PageContext; }; interface EventBatch { v: 2; /** Made once when the batch is built and kept on every resend and replay. */ batchId: string; builtAt: number; sessionId: string; conversationId?: string; operatorUserId?: string; anonymousUserId?: string; /** * Events dropped after exhausting delivery attempts during a PRIOR flush cycle — not a count of * this batch's own events. Moved in when the batch is built and never changed afterwards. */ dropped?: number; /** Failed delivery attempts from a PRIOR flush cycle — not retries of this batch's own events. */ retries?: number; /** Host calls the widget's bounded queue pushed out before the widget attached. */ hostDropped?: number; context?: WireContext; events: WireEvent[]; } interface EventLoggerOptions { /** Normal delivery (fetch). Rejecting triggers the retry/backoff loop. */ flush: (batch: EventBatch) => Promise; /** Best-effort tail flush on page hide/unload (fetch keepalive). Never awaited. */ flushKeepalive: (batch: EventBatch) => void; /** Injectable clock (tests). Defaults to Date.now. */ now?: () => number; batchIntervalMs?: number; maxBatch?: number; maxAttempts?: number; /** A batch never passes this many UTF-8 bytes, envelope included. */ maxBatchBytes?: number; session?: SessionStore; context?: () => Omit; scope?: () => WireEventScope; carryOver?: CarryOverStore | null; } interface EventLogger { log(input: WidgetLogInput): void; setIdentity(id: { operatorUserId?: string; anonymousUserId?: string; conversationId?: string; }): void; flushNow(): Promise; flushOnHide(): void; dispose(): void; /** Undoes dispose(). React StrictMode runs an effect's cleanup and then its setup again on the * same logger, so the widget's setup has to be able to bring a disposed logger back. */ resume(): void; /** The visitor opened the panel: held events leave at once. */ markOpened?(): void; /** The page is visible again: keepalive is re-armed and an unsent outbox goes out. */ markVisible?(): void; /** Host calls dropped before the widget attached; they ride the next batch as `hostDropped`. */ addHostDropped?(count: number): void; } declare function createEventLogger(opts: EventLoggerOptions): EventLogger; type PluralRow = { $count?: string; zero?: string; one?: string; two?: string; few?: string; many?: string; other: string; }; type StringTable = Record; type WidgetStrings = { tag: string; clock: '12h' | '24h'; version: string; strings?: StringTable; }; interface ResolvedConfig { operatorId: string; publicKey: string; baseUrl: string; fetch: FetchLike; client?: string; /** The visitor's IANA zone; the server writes its times and "today" in it. */ timeZone?: string; } declare function postDirectEvent(target: { operatorId: string; publicKey: string; baseUrl: string; fetch?: FetchLike; client?: string; }, event: { name: WidgetEventName; props?: WireProps; }, context: Omit): void; interface ChatCallbacks { onProgress?(data: ProgressEventData): void; onAnswer?(data: AnswerEventData): void; onEntityCard?(data: EntityCardEventData): void; onActionButton?(data: ActionButtonEventData): void; onIntentChip?(data: IntentChipEventData): void; onActionsLoading?(data: ActionsLoadingEventData): void; onError?(error: StreamErrorEventData | WidgetSdkError): void; onComplete?(data: TurnCompleteEventData): void; } interface ChatHandle extends AsyncIterable, PromiseLike { cancel(): void; } declare class Conversation { private readonly cfg; private readonly context?; conversationId?: string; constructor(cfg: ResolvedConfig, context?: UserContext | undefined); send(input: ChatInput, callbacks?: ChatCallbacks): ChatHandle; sendSignal(input: SignalInput): Promise; getWidgetSettings(): Promise; getWidgetStrings(lang?: string, v?: string): Promise; getLiveDashboard(): Promise; getLiveMonitor(pins: PinRef[], locale?: string): Promise; getMarketOdds(matchId: number, marketDeveloperName: string, sport?: SlipSport): Promise; getPlayerProps(matchId: number, sport?: 'americanfootball', locale?: string): Promise; getPricePresets(locale?: string, options?: PresetGridOptions): Promise; getBuilderGrid(locale: string | undefined, req: BuilderGridRequest): Promise; getSchedule(localDate: string, utcOffsetMinutes: number, operatorUserId?: string, anonymousUserId?: string): Promise; starLeague(competitionId: number, starred: boolean, operatorUserId?: string, anonymousUserId?: string): Promise; getFavourites(sport: string, operatorUserId?: string, anonymousUserId?: string): Promise; searchFavourites(sport: string, query: string, kind: FavouriteKind, operatorUserId?: string, anonymousUserId?: string): Promise; putFavourite(kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string): Promise; deleteFavourite(kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string): Promise; clearFavourites(sport: string, operatorUserId?: string, anonymousUserId?: string): Promise; hideFavourite(kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string): Promise; getStates(matchIds: number[], nbaGameIds?: number[], nflGameIds?: number[], locale?: string, tennisMatches?: TennisMatchKey[], tennisPriceMatches?: TennisMatchKey[]): Promise; getGames(gameDay?: string): Promise; getGameConfig(gameId: string, fixtureId?: number, gameDay?: string, locale?: string): Promise; getGameResult(gameId: string, fixtureId?: number, gameDay?: string, locale?: string): Promise; postPlay(gameId: string, answerJson: string, gameDay: string, fixtureId?: number, locale?: string): Promise; getLeaderboard(week?: string): Promise; getClubFixtures(competitionId?: number, limit?: number): Promise; getClubStandings(competitionId?: number): Promise; getClubSquad(): Promise; getClubSquadStats(): Promise; getClubPlayerDetail(playerId: number): Promise; getClubRecords(limit?: number): Promise; } /** The route a request went to, ids masked, or null for the events POST and for a URL outside the base. */ declare function endpointTemplate(url: string, cfg: { baseUrl: string; operatorId: string; }): string | null; type ResponseReport = { endpoint: string; status: number; }; declare class StatsWidgetClient { private readonly cfg; private readonly responseListeners; constructor(options: StatsWidgetClientOptions); /** Called once per request that is not the events POST: with the status of every non-2xx response the route does not answer by design (a 404 for "feature off", a refused favourite id), and with status 0 when fetch rejects for any reason but an abort. */ onResponse(listener: (r: ResponseReport) => void): () => void; chat(input: ChatInput, callbacks?: ChatCallbacks): ChatHandle; sendSignal(input: SignalInput): Promise; conversation(context?: UserContext): Conversation; sendEvents(batch: EventBatch): Promise; sendEventsKeepalive(batch: EventBatch): void; /** `transport` replaces this client's own delivery, so a logger can outlive the client it was made from. */ createEventLogger(identity?: { operatorUserId?: string; anonymousUserId?: string; conversationId?: string; }, options?: { context?: () => Omit; scope?: () => WireEventScope; transport?: { flush: (batch: EventBatch) => Promise; flushKeepalive: (batch: EventBatch) => void; }; }): EventLogger; } declare function matchKey(sport: string | undefined, id: number, tour?: string): string; declare const SIGNAL_TYPE_CODES: Record; declare const ENTITY_TYPE_CODES: Record; type UnavailableReason = 'no_user' | 'mobile_disabled' | 'widget_disabled' | 'auth_failed'; type UnavailableProblem = Exclude; /** Reports the first 401 or 403 the gateway answers, once, as the reason the widget cannot run. The response itself passes through unread. */ declare function observingFetch(base: FetchLike, onProblem: (reason: UnavailableProblem) => void): FetchLike; interface TeaserPrice { matchOddsId: number; marketLabel: string; label: string; odds: string; } interface Teaser { text: string | null; asks: ReadonlyArray<{ index: number; label: string; }>; cta?: string; price?: TeaserPrice; } interface PriceResult { matchOddsId: number; outcome: 'added' | 'gone' | 'cool_off' | 'failed'; text: string | null; } interface NdjsonParser { push(text: string): unknown[]; flush(): unknown[]; } declare function createNdjsonParser(): NdjsonParser; type DeliveryClass = 'immediate' | 'timer' | 'deferred' | 'held'; declare const DELIVERY_CLASS: Readonly>; declare function isWidgetEventName(name: string): name is WidgetEventName; /** True the first time for a key, and again once `intervalMs` has passed since the last true. */ declare function createRateLimiter(intervalMs: number, now?: () => number): (key: string) => boolean; /** A v4 uuid in the 8-4-4-4-12 form, from crypto.randomUUID, else crypto.getRandomValues, else Math.random. */ declare function newId(): string; type WidgetTrackingTab = 'chat' | 'live' | 'matches' | 'builder' | 'following' | 'trends' | 'games' | 'fixtures' | 'standings' | 'squad' | 'records'; type QuestionSource = 'typed' | 'starter' | 'action' | 'tile' | 'preset' | 'live_fact' | 'bubble_ask' | 'retry' | 'match_sheet'; /** Fields on every event. `at` is epoch ms, taken when the event happened, not when it was delivered. */ interface WidgetTrackingEnvelope { at: number; operatorId: string; widgetVersion: string; language?: string; conversationId?: string; operatorUserId?: string; anonymousUserId?: string; page?: PageContext; } /** What the slip handler resolved to: 'added' also covers an accepted price change; 'timeout' is the widget giving up waiting. */ type AddToSlipOutcome = 'added' | 'duplicate' | 'price_changed' | 'timeout' | AddToSlipRejectReason; type TabChangeSource = 'bar' | 'link' | 'auto'; type WidgetCloseMethod = 'button' | 'escape' | 'host' | 'native' | 'back'; type SlipSurface = 'chat_card' | 'greeting' | 'builder' | 'following' | 'match_sheet' | 'live_fact' | 'trends'; type FavouriteSurface = 'favourites_sheet' | 'search' | 'you_ribbon' | 'follow_suggestions' | 'guess' | 'greeting'; interface SlipClickFields { matchOddsId: number; matchId: number; odds: number; market?: string; /** Absent means football. */ sport?: SlipSport; /** Set when the add came from a live fact. */ factKey?: string; surface?: SlipSurface; turnId?: string; } type WidgetTrackingEventBody = { name: 'bubble_shown'; } | { name: 'bubble_click'; } | { name: 'bubble_ask_click'; position: number; } | { name: 'bubble_dismiss'; } | { name: 'launcher_click'; } | { name: 'widget_open'; source?: 'launcher' | 'bubble' | 'teaser' | 'host' | 'popup'; first?: boolean; } | { name: 'widget_close'; method: WidgetCloseMethod; tab: WidgetTrackingTab; answering: boolean; openMs?: number; } | { name: 'tab_change'; from: WidgetTrackingTab; to: WidgetTrackingTab; source?: TabChangeSource; } | { name: 'question_asked'; turnId: string; source: QuestionSource; length: number; text?: string; method?: 'enter' | 'button'; chipId?: string; position?: number; actionRef?: string; retryOf?: string; matchId?: string; } | { name: 'answer_received'; turnId: string; conversationId: string; latencyMs: number; cardTypes: string[]; firstByteMs?: number; } | { name: 'answer_failed'; turnId: string; code: string; } | { name: 'answer_stopped'; turnId: string; } | { name: 'pin_click'; action: 'add' | 'remove'; target: 'match' | 'market'; matchId?: number; market?: string; sport?: string; surface?: SlipSurface; turnId?: string; } | ({ name: 'add_to_slip_click'; } & SlipClickFields) | ({ name: 'add_to_slip_result'; outcome: AddToSlipOutcome; } & SlipClickFields) | { name: 'combo_add_click'; surface: 'builder' | 'chat'; sport: string; legs: number; total: string; turnId?: string; } | { name: 'combo_variant_click'; surface: 'builder'; sport: string; legs: number; total: string; variant: number; } | { name: 'combo_swap_click'; surface: 'builder'; sport: string; legs: number; total: string; } | { name: 'all_markets_click'; matchId: number; market?: string; surface: string; } | { name: 'dashboard_tile_click'; entityType: WidgetEntityType; entityId: string; } | { name: 'sport_switch'; sport: string; } | { name: 'new_conversation'; } | { name: 'favourite_change'; kind: string; id: string; outcome: string; sport?: string; surface?: FavouriteSurface; before?: boolean; }; type WidgetTrackingEvent = WidgetTrackingEventBody & WidgetTrackingEnvelope; type WidgetTrackingEventName = WidgetTrackingEvent['name']; /** The event without its envelope; the tracker adds the envelope. */ type WidgetTrackingBody = WidgetTrackingEventBody; type WidgetTrackingHandler = (event: WidgetTrackingEvent) => void | Promise; export { type ActionButtonEventData, type ActionsLoadingEventData, type AddToSlipHandler, type AddToSlipOutcome, type AddToSlipRejectReason, type AddToSlipResult, type AllTimeRow, type AnswerEventData, AuthError, type AvailableMarket, type BettingInsight, type BettingInsightEventData, type BettingInsightOdds, type BuilderGridPayload, type BuilderGridRequest, type BuilderGridStatus, type CarryOverStore, type CatalogueEventName, type CatalogueEventProps, type ChatCallbacks, type ChatEvent, type ChatGrounding, type ChatHandle, type ChatInput, type ChatPreset, type ClubFanDashboardCard, type ClubFanDashboardHeadToHead, type ClubFanDashboardPayload, type ClubFixture, type ClubFixturesPayload, type ClubMatchLogRow, type ClubNextFixture, type ClubPerformanceMetric, type ClubPlayerAvailability, type ClubPlayerAvailabilityStatus, type ClubPlayerDetailPayload, type ClubPlayerPerformance, type ClubPlayerSeasonStats, type ClubRecordEntry, type ClubRecordsPayload, type ClubSquadPayload, type ClubSquadPlayer, type ClubSquadStatsPayload, type ClubStandingRow, type ClubStandingsPayload, type ComboAddMetadata, type ComboCard, type ComboCardEventData, type ComboLeg, type ComboReplacedLeg, type CompareCard, type CompareCardEventData, type CompareCell, type CompareColumn, type CompareRow, type CongestedWeekCard, type CongestedWeekData, type CongestedWeekEntry, Conversation, type CountdownCard, type CountdownData, DELIVERY_CLASS, type DeliveryClass, ENTITY_TYPE_CODES, type EntityCard, type EntityCardEventData, type EntityCardRecord, type EntityCardScope, type EntityCardStat, type EventBatch, type EventLogger, type EventLoggerOptions, type FavouriteEntity, type FavouriteKind, type FavouriteStarResponse, type FavouriteStarResult, type FavouriteSurface, type FavouritesNoIdentity, type FavouritesPayload, type FetchLike, type FixtureCard, type FixtureCardData, ForbiddenError, type FormAndH2H, type FormMatch, type GameListPayload, type GameResultPayload, type GameStatePayload, type GameSummary, type GreetingBubble, type GreetingBubblePrice, type GreetingBuilderPreset, type GreetingChipToken, type GreetingDashboard, type GreetingDashboardLayout, type GreetingDashboardSet, type GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, type GreetingEntityChip, type GreetingEntityKind, type GreetingEventMeta, type GreetingEventPayload, type GreetingFact, type GreetingFactReference, type GreetingFactRow, type GreetingFeaturedCard, type GreetingFormResult, type GreetingGameFacts, type GreetingGamesOption, type GreetingGamesScope, type GreetingIdleTeam, type GreetingInjury, type GreetingMarketFirstSection, type GreetingMarketOption, type GreetingMarketRow, type GreetingPersonalSection, type GreetingPersonalTier, type GreetingPlayerCard, type GreetingPlayerHit, type GreetingPlayerStatus, type GreetingPriceSelection, type GreetingPriceTrail, type GreetingSetChip, type GreetingStripRow, type GreetingTeamCard, type GreetingTopBet, type GreetingTopBets, type GreetingTrailPoint, type HeadToHead, type InjuriesCard, type InjuriesCardData, type InjuryRow, type IntentChipEventData, LIMIT_CODES, type LeaderboardChampion, type LeaderboardPayload, type LeaderboardRow, type LeagueStarResult, type LimitCode, type LimitDetails, LimitError, type LinkRow, type LinksCard, type LinksData, type LiveEventLine, type LiveMonitorAmericanFootball, type LiveMonitorBasketball, type LiveMonitorEvent, type LiveMonitorFact, type LiveMonitorFactEvidence, type LiveMonitorMarket, type LiveMonitorMatch, type LiveMonitorSnapshot, type LiveMonitorStatPrice, type LiveMonitorStatRow, type LiveMonitorTennis, type LiveScoreCard, type LiveScoreData, type LiveStatRow, type LiveStatsCard, type LiveStatsData, type LiveTimelineCard, type LiveTimelineData, MAX_SWAPPED_IDS, type MarketOddsBlock, type MarketOddsCard, type MarketOddsCardInsight, type MarketOddsEventData, type MarketOddsLiveBlock, type MarketOddsRow, type MatchState, type MomentumPoint, type MonitorPhase, type MonitorSport, type NbaCoHitEvidence, type NbaCoHitLeg, type NbaFormGame, type NbaFormRest, type NbaGameValue, type NbaInjuryEvent, type NbaInsight, type NbaInsightEventData, type NbaInsightSelection, type NbaJointGame, type NbaLadderEvidence, type NbaLadderRung, type NbaLadderStat, type NbaLineLane, type NbaLineMoveEvidence, type NbaLinePoint, type NbaListedTeammate, type NbaMatchupEvidence, type NbaMatchupPosition, type NbaMatchupTeam, type NbaNextGame, type NbaPropReasonEvidence, type NbaQuarterLadderEvidence, type NbaQuarterRung, type NbaQuarterStat, type NbaSettleLine, type NbaSettlePlayer, type NbaSettleRecapEvidence, type NbaSettleSummary, type NbaSplitRow, type NbaTeamFormRest, type NbaTeammateOutEvidence, type NbaVsMeeting, type NbaVsOpponentEvidence, type NdjsonParser, NetworkError, type NflAtsGame, type NflAtsRecordEvidence, type NflForm, type NflFormGame, type NflInjuryPlayer, type NflInjuryReportEvidence, type NflInsight, type NflInsightEventData, type NflInsightKind, type NflInsightSelection, type NflLadderEvidence, type NflLadderRung, type NflLineMoveEvidence, type NflLineMoveLane, type NflMatchupEvidence, type NflPropLive, type NflPropReasonEvidence, type NflPropReasonGame, type NflSettleRecapEvidence, type NflSettleRecapLine, type NflSettleRecapPlayer, type NflSettleRecapSummary, type NflSituation, type NonFootballSport, type OddsFormat, type OddsForms, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, PENDING_MAX_BYTES, PENDING_MAX_EVENTS, PENDING_TTL_MS, type PageContext, ParseError, type PinKind, type PinRef, type PlayerPropFact, type PlayerPropGame, type PlayerPropLive, type PlayerPropPrice, type PlayerPropStat, type PlayerPropStatGame, type PlayerPropsBundle, type PluralRow, type PostMatchGoalLine, type PostMatchGoalsCard, type PostMatchGoalsData, type PostMatchNextCard, type PostMatchNextData, type PostMatchResultCard, type PostMatchResultData, type PostMatchStatRow, type PostMatchStatsCard, type PostMatchStatsData, type PostMatchTopPerformerCard, type PostMatchTopPerformerData, type PresetComboCell, type PresetGrid, type PresetGridOptions, type PresetPick, type PriceOption, type PriceResult, type ProgressEventData, type QualifiedType, type QuestionSource, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type ResponseReport, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SESSION_IDLE_MS, SIGNAL_TYPE_CODES, SPORTS, type ScheduleGroup, type ScheduleMatch, type ScheduleMatchDays, type SchedulePayload, type ScheduleSport, type SessionStore, type SignalEntityType, type SignalInput, type SignalType, type SlipDisplay, type SlipSelection, type SlipSport, type SlipSurface, type SportSpec, type StatesPayload, StatsWidgetClient, type StatsWidgetClientOptions, type StreamErrorEventData, type StringTable, type SubmitPlayBody, type SubmitPlayResult, type TabChangeSource, type Teaser, type TeaserPrice, type TennisCardLabels, type TennisEndState, type TennisFieldDot, type TennisHeadToHead, type TennisInsight, type TennisInsightEventData, type TennisInsightKind, type TennisInsightPlayer, type TennisInsightPrices, type TennisLiveBlock, type TennisLiveLabels, type TennisMarkedPlayer, type TennisMatchHeader, type TennisMatchKey, type TennisMeeting, type TennisPlayerRecord, type TennisPlayerSide, type TennisRowPrice, type TennisScore, type TennisSeasonEvent, type TennisSeasonPathEvidence, type TennisServeFormEvidence, type TennisServeFormLabels, type TennisServeFormMatch, type TennisServeReturn, type TennisServeReturnEvidence, type TennisSetScore, type TennisStatKind, type TennisStatRow, type TennisStatSet, type TennisStatTable, type TennisSurfaceLegend, type TennisTodayRow, type TennisTodayVsSeason, type TennisWinnerPrice, type TennisWl, type TransferRow, type TransfersCard, type TransfersData, type TurnCompleteEventData, type UnavailableProblem, type UnavailableReason, UpstreamError, type UserContext, type WhereToWatchCard, type WhereToWatchData, type WidgetCatalogueEventInput, type WidgetCloseMethod, type WidgetEntityEventName, type WidgetEntityType, type WidgetEventInput, type WidgetEventName, type WidgetGreetingEventInput, type WidgetGreetingEventName, type WidgetLogInput, type WidgetMarketChooseEventInput, type WidgetOpenEventInput, type WidgetOpenEventName, type WidgetPopupAskEventInput, type WidgetPopupAskEventName, type WidgetPopupEventInput, type WidgetPopupEventName, type WidgetPropsEventInput, type WidgetPropsEventName, type WidgetPublicOnlyName, type WidgetPublicPropsEventInput, WidgetSdkError, type WidgetSettings, type WidgetSportSwitchEventInput, type WidgetSportSwitchEventName, type WidgetStrings, type WidgetTrackingBody, type WidgetTrackingEnvelope, type WidgetTrackingEvent, type WidgetTrackingEventName, type WidgetTrackingHandler, type WidgetTrackingTab, type WidgetWirePropsEventInput, type WireContext, type WireEvent, type WireEventScope, type WirePropValue, type WireProps, type WireSport, createEventLogger, createNdjsonParser, createRateLimiter, endpointTemplate, fromWireSport, isAddToSlipResult, isLimitCode, isWidgetEventName, localIdOf, matchKey, mayPinOrSlip, newId, observingFetch, openCarryOver, openSession, postDirectEvent, qualifiedId, slipSportOf, sportOf, toWireSport };