@sensiblestats/widget-sdk 0.73.0 → 0.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1127,14 +1127,50 @@ interface PlayerPropPrice {
1127
1127
  line: number | null;
1128
1128
  price: number;
1129
1129
  quotedAtUtc: string;
1130
+ /** Games in the sample that cleared this price. NFL only. */
1131
+ hits?: number | null;
1132
+ }
1133
+ interface PlayerPropStatGame {
1134
+ opponent: string;
1135
+ isHome: boolean;
1136
+ value: number;
1130
1137
  }
1131
1138
  interface PlayerPropStat {
1132
- stat: 'points' | 'rebounds' | 'assists' | 'threes';
1139
+ /** `points`, `rebounds`, `assists` or `threes` for NBA; an NFL stat key otherwise. */
1140
+ stat: string;
1133
1141
  marketDeveloperName: string;
1134
1142
  line: number | null;
1135
1143
  over: PlayerPropPrice | null;
1136
1144
  under: PlayerPropPrice | null;
1137
1145
  ladder: PlayerPropPrice[];
1146
+ /** Newest first. NFL only; `hits` on the prices in this stat count within these games. */
1147
+ games?: PlayerPropStatGame[] | null;
1148
+ }
1149
+ interface PlayerPropFact {
1150
+ playerId: number;
1151
+ playerName: string;
1152
+ side: 'home' | 'away';
1153
+ stat: string;
1154
+ marketDeveloperName: string;
1155
+ at: number;
1156
+ hits: number;
1157
+ games: number;
1158
+ window: 'last' | 'home' | 'away';
1159
+ price: PlayerPropPrice;
1160
+ }
1161
+ interface NflFormGame {
1162
+ opponent: string;
1163
+ isHome: boolean;
1164
+ teamScore: number;
1165
+ opponentScore: number;
1166
+ openingSpread: number | null;
1167
+ ats: 'covered' | 'missed' | 'push' | null;
1168
+ year: number;
1169
+ }
1170
+ interface NflForm {
1171
+ home: NflFormGame[];
1172
+ away: NflFormGame[];
1173
+ headToHead: NflFormGame[];
1138
1174
  }
1139
1175
  interface PlayerPropGame {
1140
1176
  pts: number;
@@ -1160,6 +1196,10 @@ interface PlayerPropsBundle {
1160
1196
  last5: PlayerPropGame[];
1161
1197
  stats: PlayerPropStat[];
1162
1198
  }>;
1199
+ /** NFL only. */
1200
+ facts?: PlayerPropFact[] | null;
1201
+ /** NFL only. */
1202
+ form?: NflForm | null;
1163
1203
  }
1164
1204
  interface OddsMovementPoint {
1165
1205
  atUtc?: string | null;
@@ -1773,7 +1813,7 @@ declare class Conversation {
1773
1813
  getLiveDashboard(): Promise<ClubFanDashboardPayload | null>;
1774
1814
  getLiveMonitor(pins: PinRef[], locale?: string): Promise<LiveMonitorSnapshot | null>;
1775
1815
  getMarketOdds(matchId: number, marketDeveloperName: string, sport?: SlipSport): Promise<MarketOddsBlock | null>;
1776
- getPlayerProps(matchId: number): Promise<PlayerPropsBundle | null>;
1816
+ getPlayerProps(matchId: number, sport?: 'americanfootball'): Promise<PlayerPropsBundle | null>;
1777
1817
  getPricePresets(locale: string, options?: PresetGridOptions): Promise<PresetGrid | null>;
1778
1818
  getSchedule(localDate: string, utcOffsetMinutes: number, operatorUserId?: string, anonymousUserId?: string): Promise<SchedulePayload | null>;
1779
1819
  starLeague(competitionId: number, starred: boolean, operatorUserId?: string, anonymousUserId?: string): Promise<LeagueStarResult | null>;
@@ -1920,4 +1960,4 @@ interface NdjsonParser {
1920
1960
  }
1921
1961
  declare function createNdjsonParser(): NdjsonParser;
1922
1962
 
1923
- export { type ActionButtonEventData, type ActionsLoadingEventData, type AddToSlipHandler, type AddToSlipRejectReason, type AddToSlipResult, type AllTimeRow, type AnswerEventData, AuthError, type AvailableMarket, type BettingInsight, type BettingInsightEventData, type BettingInsightOdds, 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 ComboCard, type ComboCardEventData, type ComboLeg, type ComboReplacedLeg, type CongestedWeekCard, type CongestedWeekData, type CongestedWeekEntry, Conversation, type CountdownCard, type CountdownData, ENTITY_TYPE_CODES, type EntityCard, type EntityCardEventData, type EntityCardScope, type EntityCardStat, type EventBatch, type EventLogger, type EventLoggerOptions, type FetchLike, type FixtureCard, type FixtureCardData, ForbiddenError, type FormAndH2H, type FormMatch, type GameListPayload, type GameResultPayload, type GameStatePayload, type GameSummary, type GreetingDashboard, type GreetingDashboardLayout, type GreetingDashboardSet, type GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, type GreetingSetChip, 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 LiveMonitorMarket, type LiveMonitorMatch, type LiveMonitorSnapshot, type LiveMonitorStatPrice, type LiveMonitorStatRow, type LiveScoreCard, type LiveScoreData, type LiveStatRow, type LiveStatsCard, type LiveStatsData, type LiveTimelineCard, type LiveTimelineData, 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 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 NbaPropReasonEvidence, type NbaQuarterLadderEvidence, type NbaQuarterRung, type NbaQuarterStat, type NbaSettleLine, type NbaSettlePlayer, type NbaSettleRecapEvidence, type NbaSettleSummary, type NbaSplitRow, type NbaTeammateOutEvidence, type NdjsonParser, NetworkError, type NflAtsGame, type NflAtsRecordEvidence, type NflInjuryPlayer, type NflInjuryReportEvidence, type NflInsight, type NflInsightEventData, type NflInsightKind, type NflInsightSelection, type NflLadderEvidence, type NflLadderRung, type NflLineMoveEvidence, type NflLineMoveLane, type NflMatchupEvidence, type NflPropReasonEvidence, type NflPropReasonGame, type NflSettleRecapEvidence, type NflSettleRecapLine, type NflSettleRecapPlayer, type NflSettleRecapSummary, type NonFootballSport, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, type PageContext, ParseError, type PinKind, type PinRef, type PlayerPropGame, type PlayerPropPrice, type PlayerPropStat, type PlayerPropsBundle, 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 PresetMarketCell, type PresetPick, type PresetSinglesCell, type ProgressEventData, type QualifiedType, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, SPORTS, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type ScheduleSport, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, type SlipSport, type SportSpec, type StatesPayload, StatsWidgetClient, type StatsWidgetClientOptions, type StreamErrorEventData, type SubmitPlayBody, type SubmitPlayResult, type TransferRow, type TransfersCard, type TransfersData, type TurnCompleteEventData, UpstreamError, type UserContext, type WhereToWatchCard, type WhereToWatchData, type WidgetEntityEventName, type WidgetEntityType, type WidgetEventInput, type WidgetEventName, type WidgetLogInput, type WidgetOpenEventInput, type WidgetOpenEventName, type WidgetPopupAskEventInput, type WidgetPopupAskEventName, type WidgetPopupEventInput, type WidgetPopupEventName, WidgetSdkError, type WidgetSportSwitchEventInput, type WidgetSportSwitchEventName, type WireEvent, type WireSport, createEventLogger, createNdjsonParser, fromWireSport, isAddToSlipResult, isLimitCode, matchKey, mayPinOrSlip, qualifiedId, slipSportOf, sportOf, toWireSport };
1963
+ export { type ActionButtonEventData, type ActionsLoadingEventData, type AddToSlipHandler, type AddToSlipRejectReason, type AddToSlipResult, type AllTimeRow, type AnswerEventData, AuthError, type AvailableMarket, type BettingInsight, type BettingInsightEventData, type BettingInsightOdds, 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 ComboCard, type ComboCardEventData, type ComboLeg, type ComboReplacedLeg, type CongestedWeekCard, type CongestedWeekData, type CongestedWeekEntry, Conversation, type CountdownCard, type CountdownData, ENTITY_TYPE_CODES, type EntityCard, type EntityCardEventData, type EntityCardScope, type EntityCardStat, type EventBatch, type EventLogger, type EventLoggerOptions, type FetchLike, type FixtureCard, type FixtureCardData, ForbiddenError, type FormAndH2H, type FormMatch, type GameListPayload, type GameResultPayload, type GameStatePayload, type GameSummary, type GreetingDashboard, type GreetingDashboardLayout, type GreetingDashboardSet, type GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, type GreetingSetChip, 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 LiveMonitorMarket, type LiveMonitorMatch, type LiveMonitorSnapshot, type LiveMonitorStatPrice, type LiveMonitorStatRow, type LiveScoreCard, type LiveScoreData, type LiveStatRow, type LiveStatsCard, type LiveStatsData, type LiveTimelineCard, type LiveTimelineData, 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 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 NbaPropReasonEvidence, type NbaQuarterLadderEvidence, type NbaQuarterRung, type NbaQuarterStat, type NbaSettleLine, type NbaSettlePlayer, type NbaSettleRecapEvidence, type NbaSettleSummary, type NbaSplitRow, type NbaTeammateOutEvidence, 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 NflPropReasonEvidence, type NflPropReasonGame, type NflSettleRecapEvidence, type NflSettleRecapLine, type NflSettleRecapPlayer, type NflSettleRecapSummary, type NonFootballSport, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, type PageContext, ParseError, type PinKind, type PinRef, type PlayerPropFact, type PlayerPropGame, type PlayerPropPrice, type PlayerPropStat, type PlayerPropStatGame, type PlayerPropsBundle, 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 PresetMarketCell, type PresetPick, type PresetSinglesCell, type ProgressEventData, type QualifiedType, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, SPORTS, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type ScheduleSport, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, type SlipSport, type SportSpec, type StatesPayload, StatsWidgetClient, type StatsWidgetClientOptions, type StreamErrorEventData, type SubmitPlayBody, type SubmitPlayResult, type TransferRow, type TransfersCard, type TransfersData, type TurnCompleteEventData, UpstreamError, type UserContext, type WhereToWatchCard, type WhereToWatchData, type WidgetEntityEventName, type WidgetEntityType, type WidgetEventInput, type WidgetEventName, type WidgetLogInput, type WidgetOpenEventInput, type WidgetOpenEventName, type WidgetPopupAskEventInput, type WidgetPopupAskEventName, type WidgetPopupEventInput, type WidgetPopupEventName, WidgetSdkError, type WidgetSportSwitchEventInput, type WidgetSportSwitchEventName, type WireEvent, type WireSport, createEventLogger, createNdjsonParser, fromWireSport, isAddToSlipResult, isLimitCode, matchKey, mayPinOrSlip, qualifiedId, slipSportOf, sportOf, toWireSport };
package/dist/index.d.ts CHANGED
@@ -1127,14 +1127,50 @@ interface PlayerPropPrice {
1127
1127
  line: number | null;
1128
1128
  price: number;
1129
1129
  quotedAtUtc: string;
1130
+ /** Games in the sample that cleared this price. NFL only. */
1131
+ hits?: number | null;
1132
+ }
1133
+ interface PlayerPropStatGame {
1134
+ opponent: string;
1135
+ isHome: boolean;
1136
+ value: number;
1130
1137
  }
1131
1138
  interface PlayerPropStat {
1132
- stat: 'points' | 'rebounds' | 'assists' | 'threes';
1139
+ /** `points`, `rebounds`, `assists` or `threes` for NBA; an NFL stat key otherwise. */
1140
+ stat: string;
1133
1141
  marketDeveloperName: string;
1134
1142
  line: number | null;
1135
1143
  over: PlayerPropPrice | null;
1136
1144
  under: PlayerPropPrice | null;
1137
1145
  ladder: PlayerPropPrice[];
1146
+ /** Newest first. NFL only; `hits` on the prices in this stat count within these games. */
1147
+ games?: PlayerPropStatGame[] | null;
1148
+ }
1149
+ interface PlayerPropFact {
1150
+ playerId: number;
1151
+ playerName: string;
1152
+ side: 'home' | 'away';
1153
+ stat: string;
1154
+ marketDeveloperName: string;
1155
+ at: number;
1156
+ hits: number;
1157
+ games: number;
1158
+ window: 'last' | 'home' | 'away';
1159
+ price: PlayerPropPrice;
1160
+ }
1161
+ interface NflFormGame {
1162
+ opponent: string;
1163
+ isHome: boolean;
1164
+ teamScore: number;
1165
+ opponentScore: number;
1166
+ openingSpread: number | null;
1167
+ ats: 'covered' | 'missed' | 'push' | null;
1168
+ year: number;
1169
+ }
1170
+ interface NflForm {
1171
+ home: NflFormGame[];
1172
+ away: NflFormGame[];
1173
+ headToHead: NflFormGame[];
1138
1174
  }
1139
1175
  interface PlayerPropGame {
1140
1176
  pts: number;
@@ -1160,6 +1196,10 @@ interface PlayerPropsBundle {
1160
1196
  last5: PlayerPropGame[];
1161
1197
  stats: PlayerPropStat[];
1162
1198
  }>;
1199
+ /** NFL only. */
1200
+ facts?: PlayerPropFact[] | null;
1201
+ /** NFL only. */
1202
+ form?: NflForm | null;
1163
1203
  }
1164
1204
  interface OddsMovementPoint {
1165
1205
  atUtc?: string | null;
@@ -1773,7 +1813,7 @@ declare class Conversation {
1773
1813
  getLiveDashboard(): Promise<ClubFanDashboardPayload | null>;
1774
1814
  getLiveMonitor(pins: PinRef[], locale?: string): Promise<LiveMonitorSnapshot | null>;
1775
1815
  getMarketOdds(matchId: number, marketDeveloperName: string, sport?: SlipSport): Promise<MarketOddsBlock | null>;
1776
- getPlayerProps(matchId: number): Promise<PlayerPropsBundle | null>;
1816
+ getPlayerProps(matchId: number, sport?: 'americanfootball'): Promise<PlayerPropsBundle | null>;
1777
1817
  getPricePresets(locale: string, options?: PresetGridOptions): Promise<PresetGrid | null>;
1778
1818
  getSchedule(localDate: string, utcOffsetMinutes: number, operatorUserId?: string, anonymousUserId?: string): Promise<SchedulePayload | null>;
1779
1819
  starLeague(competitionId: number, starred: boolean, operatorUserId?: string, anonymousUserId?: string): Promise<LeagueStarResult | null>;
@@ -1920,4 +1960,4 @@ interface NdjsonParser {
1920
1960
  }
1921
1961
  declare function createNdjsonParser(): NdjsonParser;
1922
1962
 
1923
- export { type ActionButtonEventData, type ActionsLoadingEventData, type AddToSlipHandler, type AddToSlipRejectReason, type AddToSlipResult, type AllTimeRow, type AnswerEventData, AuthError, type AvailableMarket, type BettingInsight, type BettingInsightEventData, type BettingInsightOdds, 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 ComboCard, type ComboCardEventData, type ComboLeg, type ComboReplacedLeg, type CongestedWeekCard, type CongestedWeekData, type CongestedWeekEntry, Conversation, type CountdownCard, type CountdownData, ENTITY_TYPE_CODES, type EntityCard, type EntityCardEventData, type EntityCardScope, type EntityCardStat, type EventBatch, type EventLogger, type EventLoggerOptions, type FetchLike, type FixtureCard, type FixtureCardData, ForbiddenError, type FormAndH2H, type FormMatch, type GameListPayload, type GameResultPayload, type GameStatePayload, type GameSummary, type GreetingDashboard, type GreetingDashboardLayout, type GreetingDashboardSet, type GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, type GreetingSetChip, 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 LiveMonitorMarket, type LiveMonitorMatch, type LiveMonitorSnapshot, type LiveMonitorStatPrice, type LiveMonitorStatRow, type LiveScoreCard, type LiveScoreData, type LiveStatRow, type LiveStatsCard, type LiveStatsData, type LiveTimelineCard, type LiveTimelineData, 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 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 NbaPropReasonEvidence, type NbaQuarterLadderEvidence, type NbaQuarterRung, type NbaQuarterStat, type NbaSettleLine, type NbaSettlePlayer, type NbaSettleRecapEvidence, type NbaSettleSummary, type NbaSplitRow, type NbaTeammateOutEvidence, type NdjsonParser, NetworkError, type NflAtsGame, type NflAtsRecordEvidence, type NflInjuryPlayer, type NflInjuryReportEvidence, type NflInsight, type NflInsightEventData, type NflInsightKind, type NflInsightSelection, type NflLadderEvidence, type NflLadderRung, type NflLineMoveEvidence, type NflLineMoveLane, type NflMatchupEvidence, type NflPropReasonEvidence, type NflPropReasonGame, type NflSettleRecapEvidence, type NflSettleRecapLine, type NflSettleRecapPlayer, type NflSettleRecapSummary, type NonFootballSport, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, type PageContext, ParseError, type PinKind, type PinRef, type PlayerPropGame, type PlayerPropPrice, type PlayerPropStat, type PlayerPropsBundle, 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 PresetMarketCell, type PresetPick, type PresetSinglesCell, type ProgressEventData, type QualifiedType, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, SPORTS, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type ScheduleSport, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, type SlipSport, type SportSpec, type StatesPayload, StatsWidgetClient, type StatsWidgetClientOptions, type StreamErrorEventData, type SubmitPlayBody, type SubmitPlayResult, type TransferRow, type TransfersCard, type TransfersData, type TurnCompleteEventData, UpstreamError, type UserContext, type WhereToWatchCard, type WhereToWatchData, type WidgetEntityEventName, type WidgetEntityType, type WidgetEventInput, type WidgetEventName, type WidgetLogInput, type WidgetOpenEventInput, type WidgetOpenEventName, type WidgetPopupAskEventInput, type WidgetPopupAskEventName, type WidgetPopupEventInput, type WidgetPopupEventName, WidgetSdkError, type WidgetSportSwitchEventInput, type WidgetSportSwitchEventName, type WireEvent, type WireSport, createEventLogger, createNdjsonParser, fromWireSport, isAddToSlipResult, isLimitCode, matchKey, mayPinOrSlip, qualifiedId, slipSportOf, sportOf, toWireSport };
1963
+ export { type ActionButtonEventData, type ActionsLoadingEventData, type AddToSlipHandler, type AddToSlipRejectReason, type AddToSlipResult, type AllTimeRow, type AnswerEventData, AuthError, type AvailableMarket, type BettingInsight, type BettingInsightEventData, type BettingInsightOdds, 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 ComboCard, type ComboCardEventData, type ComboLeg, type ComboReplacedLeg, type CongestedWeekCard, type CongestedWeekData, type CongestedWeekEntry, Conversation, type CountdownCard, type CountdownData, ENTITY_TYPE_CODES, type EntityCard, type EntityCardEventData, type EntityCardScope, type EntityCardStat, type EventBatch, type EventLogger, type EventLoggerOptions, type FetchLike, type FixtureCard, type FixtureCardData, ForbiddenError, type FormAndH2H, type FormMatch, type GameListPayload, type GameResultPayload, type GameStatePayload, type GameSummary, type GreetingDashboard, type GreetingDashboardLayout, type GreetingDashboardSet, type GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, type GreetingSetChip, 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 LiveMonitorMarket, type LiveMonitorMatch, type LiveMonitorSnapshot, type LiveMonitorStatPrice, type LiveMonitorStatRow, type LiveScoreCard, type LiveScoreData, type LiveStatRow, type LiveStatsCard, type LiveStatsData, type LiveTimelineCard, type LiveTimelineData, 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 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 NbaPropReasonEvidence, type NbaQuarterLadderEvidence, type NbaQuarterRung, type NbaQuarterStat, type NbaSettleLine, type NbaSettlePlayer, type NbaSettleRecapEvidence, type NbaSettleSummary, type NbaSplitRow, type NbaTeammateOutEvidence, 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 NflPropReasonEvidence, type NflPropReasonGame, type NflSettleRecapEvidence, type NflSettleRecapLine, type NflSettleRecapPlayer, type NflSettleRecapSummary, type NonFootballSport, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, type PageContext, ParseError, type PinKind, type PinRef, type PlayerPropFact, type PlayerPropGame, type PlayerPropPrice, type PlayerPropStat, type PlayerPropStatGame, type PlayerPropsBundle, 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 PresetMarketCell, type PresetPick, type PresetSinglesCell, type ProgressEventData, type QualifiedType, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, SPORTS, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type ScheduleSport, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, type SlipSport, type SportSpec, type StatesPayload, StatsWidgetClient, type StatsWidgetClientOptions, type StreamErrorEventData, type SubmitPlayBody, type SubmitPlayResult, type TransferRow, type TransfersCard, type TransfersData, type TurnCompleteEventData, UpstreamError, type UserContext, type WhereToWatchCard, type WhereToWatchData, type WidgetEntityEventName, type WidgetEntityType, type WidgetEventInput, type WidgetEventName, type WidgetLogInput, type WidgetOpenEventInput, type WidgetOpenEventName, type WidgetPopupAskEventInput, type WidgetPopupAskEventName, type WidgetPopupEventInput, type WidgetPopupEventName, WidgetSdkError, type WidgetSportSwitchEventInput, type WidgetSportSwitchEventName, type WireEvent, type WireSport, createEventLogger, createNdjsonParser, fromWireSport, isAddToSlipResult, isLimitCode, matchKey, mayPinOrSlip, qualifiedId, slipSportOf, sportOf, toWireSport };
package/dist/index.js CHANGED
@@ -60,6 +60,23 @@ function headersFor(cfg, json) {
60
60
  if (cfg.client) h["X-SS-Client"] = cfg.client;
61
61
  return h;
62
62
  }
63
+ var OPERATOR_USER_ID_HEADER = "X-SS-Operator-User-Id";
64
+ var ANONYMOUS_USER_ID_HEADER = "X-SS-Anonymous-User-Id";
65
+ var SENDABLE_ID = /^[\x20-\x7E]{1,128}$/;
66
+ function isSendableId(id) {
67
+ const v = id?.trim();
68
+ return !!v && SENDABLE_ID.test(v);
69
+ }
70
+ function identityHeaders(operatorUserId, anonymousUserId) {
71
+ const h = {};
72
+ if (isSendableId(operatorUserId)) h[OPERATOR_USER_ID_HEADER] = operatorUserId.trim();
73
+ if (isSendableId(anonymousUserId)) h[ANONYMOUS_USER_ID_HEADER] = anonymousUserId.trim();
74
+ return h;
75
+ }
76
+ function splitIdentity(body) {
77
+ const { operatorUserId, anonymousUserId, ...rest } = body;
78
+ return { identity: identityHeaders(operatorUserId, anonymousUserId), rest };
79
+ }
63
80
  function endpoint(cfg, path) {
64
81
  return `${cfg.baseUrl.replace(/\/+$/, "")}/v1/${encodeURIComponent(cfg.operatorId)}/${path}`;
65
82
  }
@@ -101,11 +118,11 @@ async function chatError(res) {
101
118
  function isAbort(error) {
102
119
  return error instanceof Error && error.name === "AbortError";
103
120
  }
104
- async function send(cfg, path, body, signal) {
121
+ async function send(cfg, path, body, signal, identity = {}) {
105
122
  try {
106
123
  return await cfg.fetch(endpoint(cfg, path), {
107
124
  method: "POST",
108
- headers: headersFor(cfg, true),
125
+ headers: { ...headersFor(cfg, true), ...identity },
109
126
  body: JSON.stringify(body),
110
127
  signal
111
128
  });
@@ -115,24 +132,35 @@ async function send(cfg, path, body, signal) {
115
132
  }
116
133
  }
117
134
  async function postChat(cfg, input, signal) {
118
- const res = await send(cfg, "chat", input, signal);
135
+ const { userContext, ...rest } = input;
136
+ let body = rest;
137
+ let identity = {};
138
+ if (userContext) {
139
+ const split = splitIdentity(userContext);
140
+ identity = split.identity;
141
+ body = Object.keys(split.rest).length > 0 ? { ...rest, userContext: split.rest } : rest;
142
+ }
143
+ const res = await send(cfg, "chat", body, signal, identity);
119
144
  if (!res.ok || res.body == null) throw await chatError(res);
120
145
  return res;
121
146
  }
122
147
  async function postSignal(cfg, wireBody, signal) {
123
- const res = await send(cfg, "signals", wireBody, signal);
148
+ const { identity, rest } = splitIdentity(wireBody);
149
+ const res = await send(cfg, "signals", rest, signal, identity);
124
150
  if (!res.ok) throw toWidgetError(res.status, res.headers.get("Retry-After"));
125
151
  }
126
152
  async function postEvents(cfg, batch) {
127
- const res = await send(cfg, "events", batch);
153
+ const { identity, rest } = splitIdentity(batch);
154
+ const res = await send(cfg, "events", rest, void 0, identity);
128
155
  if (!res.ok) throw toWidgetError(res.status, res.headers.get("Retry-After"));
129
156
  }
130
157
  function postEventsKeepalive(cfg, batch) {
131
158
  try {
159
+ const { identity, rest } = splitIdentity(batch);
132
160
  void cfg.fetch(endpoint(cfg, "events"), {
133
161
  method: "POST",
134
- headers: headersFor(cfg, true),
135
- body: JSON.stringify(batch),
162
+ headers: { ...headersFor(cfg, true), ...identity },
163
+ body: JSON.stringify(rest),
136
164
  keepalive: true
137
165
  }).catch(() => {
138
166
  });
@@ -169,11 +197,11 @@ async function postMarketOdds(cfg, matchId, marketDeveloperName, sport) {
169
197
  if (!res.ok) throw new Error(`live-monitor/market ${res.status}`);
170
198
  return await res.json();
171
199
  }
172
- async function postPlayerProps(cfg, matchId) {
200
+ async function postPlayerProps(cfg, matchId, sport) {
173
201
  const res = await cfg.fetch(endpoint(cfg, "live-monitor/props"), {
174
202
  method: "POST",
175
203
  headers: headersFor(cfg, true),
176
- body: JSON.stringify({ matchId })
204
+ body: JSON.stringify(sport ? { matchId, sport } : { matchId })
177
205
  });
178
206
  if (res.status === 404) return null;
179
207
  if (!res.ok) throw new Error(`live-monitor/props ${res.status}`);
@@ -182,8 +210,8 @@ async function postPlayerProps(cfg, matchId) {
182
210
  async function postSchedule(cfg, localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) {
183
211
  const res = await cfg.fetch(endpoint(cfg, "live-monitor/schedule"), {
184
212
  method: "POST",
185
- headers: headersFor(cfg, true),
186
- body: JSON.stringify({ localDate, utcOffsetMinutes, sports: ["basketball", "americanfootball"], operatorUserId, anonymousUserId })
213
+ headers: { ...headersFor(cfg, true), ...identityHeaders(operatorUserId, anonymousUserId) },
214
+ body: JSON.stringify({ localDate, utcOffsetMinutes, sports: ["basketball", "americanfootball"] })
187
215
  });
188
216
  if (res.status === 404) return null;
189
217
  if (!res.ok) throw new Error(`live-monitor/schedule ${res.status}`);
@@ -192,8 +220,8 @@ async function postSchedule(cfg, localDate, utcOffsetMinutes, operatorUserId, an
192
220
  async function postLeagueStar(cfg, competitionId, starred, operatorUserId, anonymousUserId) {
193
221
  const res = await cfg.fetch(endpoint(cfg, `leagues/${competitionId}/star`), {
194
222
  method: "POST",
195
- headers: headersFor(cfg, true),
196
- body: JSON.stringify({ starred, operatorUserId, anonymousUserId })
223
+ headers: { ...headersFor(cfg, true), ...identityHeaders(operatorUserId, anonymousUserId) },
224
+ body: JSON.stringify({ starred })
197
225
  });
198
226
  if (res.status === 404) return null;
199
227
  if (!res.ok) throw new Error(`leagues/star ${res.status}`);
@@ -218,7 +246,7 @@ function q(parts) {
218
246
  return kept.length ? `?${kept.join("&")}` : "";
219
247
  }
220
248
  async function getGames(cfg, operatorUserId, gameDay) {
221
- const res = await cfg.fetch(endpoint(cfg, "games" + q({ operatorUserId, gameDay })), { method: "GET", headers: headersFor(cfg, false) });
249
+ const res = await cfg.fetch(endpoint(cfg, "games" + q({ gameDay })), { method: "GET", headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId) } });
222
250
  if (res.status === 404) return null;
223
251
  if (!res.ok) throw new Error(`games ${res.status}`);
224
252
  return await res.json();
@@ -230,23 +258,24 @@ async function getGameConfig(cfg, gameId, fixtureId, gameDay, locale) {
230
258
  return await res.json();
231
259
  }
232
260
  async function getGameResult(cfg, gameId, operatorUserId, fixtureId, gameDay, locale) {
233
- const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}/result` + q({ operatorUserId, fixtureId, gameDay, locale })), { method: "GET", headers: headersFor(cfg, false) });
261
+ const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}/result` + q({ fixtureId, gameDay, locale })), { method: "GET", headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId) } });
234
262
  if (res.status === 404) return null;
235
263
  if (!res.ok) throw new Error(`game-result ${res.status}`);
236
264
  return await res.json();
237
265
  }
238
266
  async function postPlay(cfg, gameId, body, locale) {
267
+ const { identity, rest } = splitIdentity(body);
239
268
  const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}/plays` + q({ locale })), {
240
269
  method: "POST",
241
- headers: headersFor(cfg, true),
242
- body: JSON.stringify(body)
270
+ headers: { ...headersFor(cfg, true), ...identity },
271
+ body: JSON.stringify(rest)
243
272
  });
244
273
  if (res.status === 404) return null;
245
274
  if (!res.ok) throw new Error(`play ${res.status}`);
246
275
  return await res.json();
247
276
  }
248
277
  async function getLeaderboard(cfg, operatorUserId, week) {
249
- const res = await cfg.fetch(endpoint(cfg, "games/leaderboard" + q({ operatorUserId, week })), { method: "GET", headers: headersFor(cfg, false) });
278
+ const res = await cfg.fetch(endpoint(cfg, "games/leaderboard" + q({ week })), { method: "GET", headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId) } });
250
279
  if (res.status === 404) return null;
251
280
  if (!res.ok) throw new Error(`leaderboard ${res.status}`);
252
281
  return await res.json();
@@ -288,7 +317,7 @@ async function getClubRecords(cfg, limit) {
288
317
  return await res.json();
289
318
  }
290
319
  async function getPricePresets(cfg, locale, operatorUserId, options) {
291
- const res = await cfg.fetch(endpoint(cfg, "price-presets" + q({ locale, operatorUserId, pool: options?.pool })), { method: "GET", headers: headersFor(cfg, false) });
320
+ const res = await cfg.fetch(endpoint(cfg, "price-presets" + q({ locale, pool: options?.pool })), { method: "GET", headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId) } });
292
321
  if (res.status === 404) return null;
293
322
  if (!res.ok) throw new Error(`price-presets ${res.status}`);
294
323
  return await res.json();
@@ -488,7 +517,7 @@ var Conversation = class {
488
517
  }
489
518
  sendSignal(input) {
490
519
  const operatorUserId = input.operatorUserId ?? this.context?.operatorUserId;
491
- const anonymousUserId = operatorUserId ? void 0 : input.anonymousUserId ?? this.context?.anonymousUserId;
520
+ const anonymousUserId = isSendableId(operatorUserId) ? void 0 : input.anonymousUserId ?? this.context?.anonymousUserId;
492
521
  if (!operatorUserId && !anonymousUserId) {
493
522
  throw new Error("operatorUserId or anonymousUserId is required (set it on conversation() or pass it to sendSignal)");
494
523
  }
@@ -506,8 +535,8 @@ var Conversation = class {
506
535
  getMarketOdds(matchId, marketDeveloperName, sport) {
507
536
  return postMarketOdds(this.cfg, matchId, marketDeveloperName, sport);
508
537
  }
509
- getPlayerProps(matchId) {
510
- return postPlayerProps(this.cfg, matchId);
538
+ getPlayerProps(matchId, sport) {
539
+ return postPlayerProps(this.cfg, matchId, sport);
511
540
  }
512
541
  getPricePresets(locale, options) {
513
542
  return getPricePresets(this.cfg, locale, this.context?.operatorUserId, options);