@sensiblestats/widget-sdk 0.58.0 → 0.60.0
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/CHANGELOG.md +13 -0
- package/dist/index.cjs +27 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +155 -2
- package/dist/index.d.ts +155 -2
- package/dist/index.js +27 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -472,6 +472,154 @@ interface BettingInsight {
|
|
|
472
472
|
interface BettingInsightEventData {
|
|
473
473
|
insight: BettingInsight;
|
|
474
474
|
}
|
|
475
|
+
interface NbaInsightSelection {
|
|
476
|
+
key: string;
|
|
477
|
+
marketDeveloperName: string;
|
|
478
|
+
selectionLabel: string;
|
|
479
|
+
side?: string | null;
|
|
480
|
+
line?: string | null;
|
|
481
|
+
price: number;
|
|
482
|
+
quotedAtUtc: string;
|
|
483
|
+
matchOddsId?: number | null;
|
|
484
|
+
}
|
|
485
|
+
interface NbaGameValue {
|
|
486
|
+
date: string;
|
|
487
|
+
opponent?: string | null;
|
|
488
|
+
value: number;
|
|
489
|
+
minutes: number;
|
|
490
|
+
}
|
|
491
|
+
interface NbaListedTeammate {
|
|
492
|
+
name: string;
|
|
493
|
+
status: string;
|
|
494
|
+
}
|
|
495
|
+
interface NbaPropReasonEvidence {
|
|
496
|
+
playerId: number;
|
|
497
|
+
playerName: string;
|
|
498
|
+
stat: string;
|
|
499
|
+
line: string;
|
|
500
|
+
side: string;
|
|
501
|
+
hits: number;
|
|
502
|
+
n: number;
|
|
503
|
+
pushes: number;
|
|
504
|
+
average: number;
|
|
505
|
+
averageMinutes: number;
|
|
506
|
+
games: NbaGameValue[];
|
|
507
|
+
openingLine?: string | null;
|
|
508
|
+
teammates: NbaListedTeammate[];
|
|
509
|
+
leftOut: string[];
|
|
510
|
+
}
|
|
511
|
+
interface NbaLinePoint {
|
|
512
|
+
atUtc: string;
|
|
513
|
+
line: string;
|
|
514
|
+
price: number;
|
|
515
|
+
text: string;
|
|
516
|
+
}
|
|
517
|
+
interface NbaLineLane {
|
|
518
|
+
points: NbaLinePoint[];
|
|
519
|
+
selectionKey?: string | null;
|
|
520
|
+
}
|
|
521
|
+
interface NbaInjuryEvent {
|
|
522
|
+
atUtc: string;
|
|
523
|
+
teamName: string;
|
|
524
|
+
text: string;
|
|
525
|
+
}
|
|
526
|
+
interface NbaLineMoveEvidence {
|
|
527
|
+
dateLabel: string;
|
|
528
|
+
spread?: NbaLineLane | null;
|
|
529
|
+
total?: NbaLineLane | null;
|
|
530
|
+
injuries: NbaInjuryEvent[];
|
|
531
|
+
}
|
|
532
|
+
interface NbaSplitRow {
|
|
533
|
+
playerId: number;
|
|
534
|
+
playerName: string;
|
|
535
|
+
stat: string;
|
|
536
|
+
line: string;
|
|
537
|
+
withoutHits: number;
|
|
538
|
+
withoutN: number;
|
|
539
|
+
withHits: number;
|
|
540
|
+
withN: number;
|
|
541
|
+
selectionKey: string;
|
|
542
|
+
}
|
|
543
|
+
interface NbaTeammateOutEvidence {
|
|
544
|
+
outPlayerId: number;
|
|
545
|
+
outPlayerName: string;
|
|
546
|
+
teamName: string;
|
|
547
|
+
status: string;
|
|
548
|
+
seenAtUtc?: string | null;
|
|
549
|
+
missedGames: number;
|
|
550
|
+
rows: NbaSplitRow[];
|
|
551
|
+
}
|
|
552
|
+
interface NbaCoHitLeg {
|
|
553
|
+
playerId: number;
|
|
554
|
+
playerName: string;
|
|
555
|
+
stat: string;
|
|
556
|
+
rung: string;
|
|
557
|
+
hits: number;
|
|
558
|
+
n: number;
|
|
559
|
+
selectionKey: string;
|
|
560
|
+
}
|
|
561
|
+
interface NbaJointGame {
|
|
562
|
+
date: string;
|
|
563
|
+
valueA: number;
|
|
564
|
+
valueB: number;
|
|
565
|
+
both: boolean;
|
|
566
|
+
}
|
|
567
|
+
interface NbaCoHitEvidence {
|
|
568
|
+
legs: NbaCoHitLeg[];
|
|
569
|
+
games: NbaJointGame[];
|
|
570
|
+
bothHits: number;
|
|
571
|
+
n: number;
|
|
572
|
+
combinedPrice: number;
|
|
573
|
+
}
|
|
574
|
+
interface NbaLadderRung {
|
|
575
|
+
at: string;
|
|
576
|
+
l5Hits: number;
|
|
577
|
+
l5N: number;
|
|
578
|
+
l8Hits: number;
|
|
579
|
+
l8N: number;
|
|
580
|
+
selectionKey: string;
|
|
581
|
+
}
|
|
582
|
+
interface NbaLadderStat {
|
|
583
|
+
stat: string;
|
|
584
|
+
mainLine?: string | null;
|
|
585
|
+
overPrice?: number | null;
|
|
586
|
+
underPrice?: number | null;
|
|
587
|
+
rungs: NbaLadderRung[];
|
|
588
|
+
}
|
|
589
|
+
interface NbaLadderEvidence {
|
|
590
|
+
playerId: number;
|
|
591
|
+
playerName: string;
|
|
592
|
+
stats: NbaLadderStat[];
|
|
593
|
+
}
|
|
594
|
+
interface NbaInsight {
|
|
595
|
+
insightId: string;
|
|
596
|
+
matchId: number;
|
|
597
|
+
kind: string;
|
|
598
|
+
ruleId: string;
|
|
599
|
+
text: string;
|
|
600
|
+
title: string;
|
|
601
|
+
marketDeveloperName: string;
|
|
602
|
+
marketLabel: string;
|
|
603
|
+
selections: NbaInsightSelection[];
|
|
604
|
+
notes: string[];
|
|
605
|
+
disclaimer?: string | null;
|
|
606
|
+
homeTeamName?: string | null;
|
|
607
|
+
awayTeamName?: string | null;
|
|
608
|
+
competitionName?: string | null;
|
|
609
|
+
addToSlipEnabled: boolean;
|
|
610
|
+
kickoffUtc?: string | null;
|
|
611
|
+
pinEnabled: boolean;
|
|
612
|
+
kickoffLabel?: string | null;
|
|
613
|
+
quotedAtUtc: string;
|
|
614
|
+
propReason?: NbaPropReasonEvidence | null;
|
|
615
|
+
lineMove?: NbaLineMoveEvidence | null;
|
|
616
|
+
teammateOut?: NbaTeammateOutEvidence | null;
|
|
617
|
+
coHit?: NbaCoHitEvidence | null;
|
|
618
|
+
ladder?: NbaLadderEvidence | null;
|
|
619
|
+
}
|
|
620
|
+
interface NbaInsightEventData {
|
|
621
|
+
insight: NbaInsight;
|
|
622
|
+
}
|
|
475
623
|
interface MarketOddsRow {
|
|
476
624
|
selectionLabel: string;
|
|
477
625
|
side?: string | null;
|
|
@@ -860,7 +1008,7 @@ interface EventEnvelope<TType extends string, TData> {
|
|
|
860
1008
|
timestamp: string;
|
|
861
1009
|
data: TData;
|
|
862
1010
|
}
|
|
863
|
-
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<'market_odds', MarketOddsEventData> | EventEnvelope<'combo_card', ComboCardEventData> | EventEnvelope<'odds_movement', OddsMovementEventData> | EventEnvelope<'error', StreamErrorEventData>;
|
|
1011
|
+
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<'market_odds', MarketOddsEventData> | EventEnvelope<'combo_card', ComboCardEventData> | EventEnvelope<'odds_movement', OddsMovementEventData> | EventEnvelope<'error', StreamErrorEventData>;
|
|
864
1012
|
interface GameSummary {
|
|
865
1013
|
gameId: string;
|
|
866
1014
|
gameDay: string;
|
|
@@ -1089,6 +1237,8 @@ interface StatsWidgetClientOptions {
|
|
|
1089
1237
|
baseUrl?: string;
|
|
1090
1238
|
/** Advanced/testing: inject a fetch implementation. Defaults to globalThis.fetch. */
|
|
1091
1239
|
fetch?: FetchLike;
|
|
1240
|
+
/** Sent as X-SS-Client; set by widget-react. */
|
|
1241
|
+
client?: string;
|
|
1092
1242
|
}
|
|
1093
1243
|
interface UserContext {
|
|
1094
1244
|
operatorUserId?: string;
|
|
@@ -1154,6 +1304,7 @@ interface SignalInput {
|
|
|
1154
1304
|
/** Zero-based tile position within the dashboard, when it is a dashboard tap. */
|
|
1155
1305
|
tileIndex?: number;
|
|
1156
1306
|
}
|
|
1307
|
+
type SlipSport = 'basketball';
|
|
1157
1308
|
interface SlipSelection {
|
|
1158
1309
|
matchOddsId: number;
|
|
1159
1310
|
matchId: number;
|
|
@@ -1161,6 +1312,7 @@ interface SlipSelection {
|
|
|
1161
1312
|
quotedAtUtc?: string;
|
|
1162
1313
|
insightId?: string;
|
|
1163
1314
|
conversationId?: string;
|
|
1315
|
+
sport?: SlipSport;
|
|
1164
1316
|
}
|
|
1165
1317
|
type AddToSlipRejectReason = 'suspended' | 'closed' | 'login_required' | 'not_found' | 'limit' | 'unsupported';
|
|
1166
1318
|
type AddToSlipResult = {
|
|
@@ -1188,6 +1340,7 @@ interface ResolvedConfig {
|
|
|
1188
1340
|
publicKey: string;
|
|
1189
1341
|
baseUrl: string;
|
|
1190
1342
|
fetch: FetchLike;
|
|
1343
|
+
client?: string;
|
|
1191
1344
|
}
|
|
1192
1345
|
|
|
1193
1346
|
interface ChatCallbacks {
|
|
@@ -1348,4 +1501,4 @@ interface NdjsonParser {
|
|
|
1348
1501
|
}
|
|
1349
1502
|
declare function createNdjsonParser(): NdjsonParser;
|
|
1350
1503
|
|
|
1351
|
-
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 GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, 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 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 NdjsonParser, NetworkError, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, ParseError, type PinKind, type PinRef, 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, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, 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 WireEvent, createEventLogger, createNdjsonParser, isAddToSlipResult, isLimitCode };
|
|
1504
|
+
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 GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, 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 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 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 NbaPropReasonEvidence, type NbaSplitRow, type NbaTeammateOutEvidence, type NdjsonParser, NetworkError, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, ParseError, type PinKind, type PinRef, 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, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, type SlipSport, 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 WireEvent, createEventLogger, createNdjsonParser, isAddToSlipResult, isLimitCode };
|
package/dist/index.d.ts
CHANGED
|
@@ -472,6 +472,154 @@ interface BettingInsight {
|
|
|
472
472
|
interface BettingInsightEventData {
|
|
473
473
|
insight: BettingInsight;
|
|
474
474
|
}
|
|
475
|
+
interface NbaInsightSelection {
|
|
476
|
+
key: string;
|
|
477
|
+
marketDeveloperName: string;
|
|
478
|
+
selectionLabel: string;
|
|
479
|
+
side?: string | null;
|
|
480
|
+
line?: string | null;
|
|
481
|
+
price: number;
|
|
482
|
+
quotedAtUtc: string;
|
|
483
|
+
matchOddsId?: number | null;
|
|
484
|
+
}
|
|
485
|
+
interface NbaGameValue {
|
|
486
|
+
date: string;
|
|
487
|
+
opponent?: string | null;
|
|
488
|
+
value: number;
|
|
489
|
+
minutes: number;
|
|
490
|
+
}
|
|
491
|
+
interface NbaListedTeammate {
|
|
492
|
+
name: string;
|
|
493
|
+
status: string;
|
|
494
|
+
}
|
|
495
|
+
interface NbaPropReasonEvidence {
|
|
496
|
+
playerId: number;
|
|
497
|
+
playerName: string;
|
|
498
|
+
stat: string;
|
|
499
|
+
line: string;
|
|
500
|
+
side: string;
|
|
501
|
+
hits: number;
|
|
502
|
+
n: number;
|
|
503
|
+
pushes: number;
|
|
504
|
+
average: number;
|
|
505
|
+
averageMinutes: number;
|
|
506
|
+
games: NbaGameValue[];
|
|
507
|
+
openingLine?: string | null;
|
|
508
|
+
teammates: NbaListedTeammate[];
|
|
509
|
+
leftOut: string[];
|
|
510
|
+
}
|
|
511
|
+
interface NbaLinePoint {
|
|
512
|
+
atUtc: string;
|
|
513
|
+
line: string;
|
|
514
|
+
price: number;
|
|
515
|
+
text: string;
|
|
516
|
+
}
|
|
517
|
+
interface NbaLineLane {
|
|
518
|
+
points: NbaLinePoint[];
|
|
519
|
+
selectionKey?: string | null;
|
|
520
|
+
}
|
|
521
|
+
interface NbaInjuryEvent {
|
|
522
|
+
atUtc: string;
|
|
523
|
+
teamName: string;
|
|
524
|
+
text: string;
|
|
525
|
+
}
|
|
526
|
+
interface NbaLineMoveEvidence {
|
|
527
|
+
dateLabel: string;
|
|
528
|
+
spread?: NbaLineLane | null;
|
|
529
|
+
total?: NbaLineLane | null;
|
|
530
|
+
injuries: NbaInjuryEvent[];
|
|
531
|
+
}
|
|
532
|
+
interface NbaSplitRow {
|
|
533
|
+
playerId: number;
|
|
534
|
+
playerName: string;
|
|
535
|
+
stat: string;
|
|
536
|
+
line: string;
|
|
537
|
+
withoutHits: number;
|
|
538
|
+
withoutN: number;
|
|
539
|
+
withHits: number;
|
|
540
|
+
withN: number;
|
|
541
|
+
selectionKey: string;
|
|
542
|
+
}
|
|
543
|
+
interface NbaTeammateOutEvidence {
|
|
544
|
+
outPlayerId: number;
|
|
545
|
+
outPlayerName: string;
|
|
546
|
+
teamName: string;
|
|
547
|
+
status: string;
|
|
548
|
+
seenAtUtc?: string | null;
|
|
549
|
+
missedGames: number;
|
|
550
|
+
rows: NbaSplitRow[];
|
|
551
|
+
}
|
|
552
|
+
interface NbaCoHitLeg {
|
|
553
|
+
playerId: number;
|
|
554
|
+
playerName: string;
|
|
555
|
+
stat: string;
|
|
556
|
+
rung: string;
|
|
557
|
+
hits: number;
|
|
558
|
+
n: number;
|
|
559
|
+
selectionKey: string;
|
|
560
|
+
}
|
|
561
|
+
interface NbaJointGame {
|
|
562
|
+
date: string;
|
|
563
|
+
valueA: number;
|
|
564
|
+
valueB: number;
|
|
565
|
+
both: boolean;
|
|
566
|
+
}
|
|
567
|
+
interface NbaCoHitEvidence {
|
|
568
|
+
legs: NbaCoHitLeg[];
|
|
569
|
+
games: NbaJointGame[];
|
|
570
|
+
bothHits: number;
|
|
571
|
+
n: number;
|
|
572
|
+
combinedPrice: number;
|
|
573
|
+
}
|
|
574
|
+
interface NbaLadderRung {
|
|
575
|
+
at: string;
|
|
576
|
+
l5Hits: number;
|
|
577
|
+
l5N: number;
|
|
578
|
+
l8Hits: number;
|
|
579
|
+
l8N: number;
|
|
580
|
+
selectionKey: string;
|
|
581
|
+
}
|
|
582
|
+
interface NbaLadderStat {
|
|
583
|
+
stat: string;
|
|
584
|
+
mainLine?: string | null;
|
|
585
|
+
overPrice?: number | null;
|
|
586
|
+
underPrice?: number | null;
|
|
587
|
+
rungs: NbaLadderRung[];
|
|
588
|
+
}
|
|
589
|
+
interface NbaLadderEvidence {
|
|
590
|
+
playerId: number;
|
|
591
|
+
playerName: string;
|
|
592
|
+
stats: NbaLadderStat[];
|
|
593
|
+
}
|
|
594
|
+
interface NbaInsight {
|
|
595
|
+
insightId: string;
|
|
596
|
+
matchId: number;
|
|
597
|
+
kind: string;
|
|
598
|
+
ruleId: string;
|
|
599
|
+
text: string;
|
|
600
|
+
title: string;
|
|
601
|
+
marketDeveloperName: string;
|
|
602
|
+
marketLabel: string;
|
|
603
|
+
selections: NbaInsightSelection[];
|
|
604
|
+
notes: string[];
|
|
605
|
+
disclaimer?: string | null;
|
|
606
|
+
homeTeamName?: string | null;
|
|
607
|
+
awayTeamName?: string | null;
|
|
608
|
+
competitionName?: string | null;
|
|
609
|
+
addToSlipEnabled: boolean;
|
|
610
|
+
kickoffUtc?: string | null;
|
|
611
|
+
pinEnabled: boolean;
|
|
612
|
+
kickoffLabel?: string | null;
|
|
613
|
+
quotedAtUtc: string;
|
|
614
|
+
propReason?: NbaPropReasonEvidence | null;
|
|
615
|
+
lineMove?: NbaLineMoveEvidence | null;
|
|
616
|
+
teammateOut?: NbaTeammateOutEvidence | null;
|
|
617
|
+
coHit?: NbaCoHitEvidence | null;
|
|
618
|
+
ladder?: NbaLadderEvidence | null;
|
|
619
|
+
}
|
|
620
|
+
interface NbaInsightEventData {
|
|
621
|
+
insight: NbaInsight;
|
|
622
|
+
}
|
|
475
623
|
interface MarketOddsRow {
|
|
476
624
|
selectionLabel: string;
|
|
477
625
|
side?: string | null;
|
|
@@ -860,7 +1008,7 @@ interface EventEnvelope<TType extends string, TData> {
|
|
|
860
1008
|
timestamp: string;
|
|
861
1009
|
data: TData;
|
|
862
1010
|
}
|
|
863
|
-
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<'market_odds', MarketOddsEventData> | EventEnvelope<'combo_card', ComboCardEventData> | EventEnvelope<'odds_movement', OddsMovementEventData> | EventEnvelope<'error', StreamErrorEventData>;
|
|
1011
|
+
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<'market_odds', MarketOddsEventData> | EventEnvelope<'combo_card', ComboCardEventData> | EventEnvelope<'odds_movement', OddsMovementEventData> | EventEnvelope<'error', StreamErrorEventData>;
|
|
864
1012
|
interface GameSummary {
|
|
865
1013
|
gameId: string;
|
|
866
1014
|
gameDay: string;
|
|
@@ -1089,6 +1237,8 @@ interface StatsWidgetClientOptions {
|
|
|
1089
1237
|
baseUrl?: string;
|
|
1090
1238
|
/** Advanced/testing: inject a fetch implementation. Defaults to globalThis.fetch. */
|
|
1091
1239
|
fetch?: FetchLike;
|
|
1240
|
+
/** Sent as X-SS-Client; set by widget-react. */
|
|
1241
|
+
client?: string;
|
|
1092
1242
|
}
|
|
1093
1243
|
interface UserContext {
|
|
1094
1244
|
operatorUserId?: string;
|
|
@@ -1154,6 +1304,7 @@ interface SignalInput {
|
|
|
1154
1304
|
/** Zero-based tile position within the dashboard, when it is a dashboard tap. */
|
|
1155
1305
|
tileIndex?: number;
|
|
1156
1306
|
}
|
|
1307
|
+
type SlipSport = 'basketball';
|
|
1157
1308
|
interface SlipSelection {
|
|
1158
1309
|
matchOddsId: number;
|
|
1159
1310
|
matchId: number;
|
|
@@ -1161,6 +1312,7 @@ interface SlipSelection {
|
|
|
1161
1312
|
quotedAtUtc?: string;
|
|
1162
1313
|
insightId?: string;
|
|
1163
1314
|
conversationId?: string;
|
|
1315
|
+
sport?: SlipSport;
|
|
1164
1316
|
}
|
|
1165
1317
|
type AddToSlipRejectReason = 'suspended' | 'closed' | 'login_required' | 'not_found' | 'limit' | 'unsupported';
|
|
1166
1318
|
type AddToSlipResult = {
|
|
@@ -1188,6 +1340,7 @@ interface ResolvedConfig {
|
|
|
1188
1340
|
publicKey: string;
|
|
1189
1341
|
baseUrl: string;
|
|
1190
1342
|
fetch: FetchLike;
|
|
1343
|
+
client?: string;
|
|
1191
1344
|
}
|
|
1192
1345
|
|
|
1193
1346
|
interface ChatCallbacks {
|
|
@@ -1348,4 +1501,4 @@ interface NdjsonParser {
|
|
|
1348
1501
|
}
|
|
1349
1502
|
declare function createNdjsonParser(): NdjsonParser;
|
|
1350
1503
|
|
|
1351
|
-
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 GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, 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 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 NdjsonParser, NetworkError, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, ParseError, type PinKind, type PinRef, 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, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, 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 WireEvent, createEventLogger, createNdjsonParser, isAddToSlipResult, isLimitCode };
|
|
1504
|
+
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 GreetingDashboardSignalRef, type GreetingDashboardSpan, type GreetingDashboardTile, type GreetingDashboardTileEmphasis, 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 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 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 NbaPropReasonEvidence, type NbaSplitRow, type NbaTeammateOutEvidence, type NdjsonParser, NetworkError, type OddsMovementCard, type OddsMovementEventData, type OddsMovementPoint, ParseError, type PinKind, type PinRef, 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, RateLimitError, type ReasonToBetCard, type ReasonToBetData, type RestingFormCard, type RestingFormData, type RestingNextCard, type RestingNextData, type RestingSeasonCard, type RestingSeasonData, type RestingStandingsCard, type RestingStandingsData, SIGNAL_TYPE_CODES, type ScheduleGroup, type ScheduleMatch, type SchedulePayload, type SignalEntityType, type SignalInput, type SignalType, type SlipSelection, type SlipSport, 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 WireEvent, createEventLogger, createNdjsonParser, isAddToSlipResult, isLimitCode };
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,11 @@ var ParseError = class extends WidgetSdkError {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
// src/http.ts
|
|
58
|
+
function headersFor(cfg, json) {
|
|
59
|
+
const h = json ? { "Content-Type": "application/json", "X-SS-Public-Key": cfg.publicKey } : { "X-SS-Public-Key": cfg.publicKey };
|
|
60
|
+
if (cfg.client) h["X-SS-Client"] = cfg.client;
|
|
61
|
+
return h;
|
|
62
|
+
}
|
|
58
63
|
function endpoint(cfg, path) {
|
|
59
64
|
return `${cfg.baseUrl.replace(/\/+$/, "")}/v1/${encodeURIComponent(cfg.operatorId)}/${path}`;
|
|
60
65
|
}
|
|
@@ -100,7 +105,7 @@ async function send(cfg, path, body, signal) {
|
|
|
100
105
|
try {
|
|
101
106
|
return await cfg.fetch(endpoint(cfg, path), {
|
|
102
107
|
method: "POST",
|
|
103
|
-
headers:
|
|
108
|
+
headers: headersFor(cfg, true),
|
|
104
109
|
body: JSON.stringify(body),
|
|
105
110
|
signal
|
|
106
111
|
});
|
|
@@ -126,7 +131,7 @@ function postEventsKeepalive(cfg, batch) {
|
|
|
126
131
|
try {
|
|
127
132
|
void cfg.fetch(endpoint(cfg, "events"), {
|
|
128
133
|
method: "POST",
|
|
129
|
-
headers:
|
|
134
|
+
headers: headersFor(cfg, true),
|
|
130
135
|
body: JSON.stringify(batch),
|
|
131
136
|
keepalive: true
|
|
132
137
|
}).catch(() => {
|
|
@@ -135,7 +140,7 @@ function postEventsKeepalive(cfg, batch) {
|
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
async function getLiveDashboard(cfg) {
|
|
138
|
-
const res = await cfg.fetch(endpoint(cfg, "live-dashboard"), { method: "GET", headers:
|
|
143
|
+
const res = await cfg.fetch(endpoint(cfg, "live-dashboard"), { method: "GET", headers: headersFor(cfg, false) });
|
|
139
144
|
if (res.status === 204) return null;
|
|
140
145
|
if (!res.ok) throw new Error(`live-dashboard ${res.status}`);
|
|
141
146
|
return await res.json();
|
|
@@ -145,7 +150,7 @@ async function postLiveMonitor(cfg, pins, locale) {
|
|
|
145
150
|
if (locale) body.locale = locale;
|
|
146
151
|
const res = await cfg.fetch(endpoint(cfg, "live-monitor"), {
|
|
147
152
|
method: "POST",
|
|
148
|
-
headers:
|
|
153
|
+
headers: headersFor(cfg, true),
|
|
149
154
|
body: JSON.stringify(body)
|
|
150
155
|
});
|
|
151
156
|
if (res.status === 404) return null;
|
|
@@ -155,7 +160,7 @@ async function postLiveMonitor(cfg, pins, locale) {
|
|
|
155
160
|
async function postMarketOdds(cfg, matchId, marketDeveloperName) {
|
|
156
161
|
const res = await cfg.fetch(endpoint(cfg, "live-monitor/market"), {
|
|
157
162
|
method: "POST",
|
|
158
|
-
headers:
|
|
163
|
+
headers: headersFor(cfg, true),
|
|
159
164
|
body: JSON.stringify({ matchId, marketDeveloperName })
|
|
160
165
|
});
|
|
161
166
|
if (res.status === 404) return null;
|
|
@@ -165,7 +170,7 @@ async function postMarketOdds(cfg, matchId, marketDeveloperName) {
|
|
|
165
170
|
async function postSchedule(cfg, localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) {
|
|
166
171
|
const res = await cfg.fetch(endpoint(cfg, "live-monitor/schedule"), {
|
|
167
172
|
method: "POST",
|
|
168
|
-
headers:
|
|
173
|
+
headers: headersFor(cfg, true),
|
|
169
174
|
body: JSON.stringify({ localDate, utcOffsetMinutes, operatorUserId, anonymousUserId })
|
|
170
175
|
});
|
|
171
176
|
if (res.status === 404) return null;
|
|
@@ -175,7 +180,7 @@ async function postSchedule(cfg, localDate, utcOffsetMinutes, operatorUserId, an
|
|
|
175
180
|
async function postLeagueStar(cfg, competitionId, starred, operatorUserId, anonymousUserId) {
|
|
176
181
|
const res = await cfg.fetch(endpoint(cfg, `leagues/${competitionId}/star`), {
|
|
177
182
|
method: "POST",
|
|
178
|
-
headers:
|
|
183
|
+
headers: headersFor(cfg, true),
|
|
179
184
|
body: JSON.stringify({ starred, operatorUserId, anonymousUserId })
|
|
180
185
|
});
|
|
181
186
|
if (res.status === 404) return null;
|
|
@@ -185,7 +190,7 @@ async function postLeagueStar(cfg, competitionId, starred, operatorUserId, anony
|
|
|
185
190
|
async function postStates(cfg, matchIds) {
|
|
186
191
|
const res = await cfg.fetch(endpoint(cfg, "live-monitor/states"), {
|
|
187
192
|
method: "POST",
|
|
188
|
-
headers:
|
|
193
|
+
headers: headersFor(cfg, true),
|
|
189
194
|
body: JSON.stringify({ matchIds })
|
|
190
195
|
});
|
|
191
196
|
if (res.status === 404) return null;
|
|
@@ -197,19 +202,19 @@ function q(parts) {
|
|
|
197
202
|
return kept.length ? `?${kept.join("&")}` : "";
|
|
198
203
|
}
|
|
199
204
|
async function getGames(cfg, operatorUserId, gameDay) {
|
|
200
|
-
const res = await cfg.fetch(endpoint(cfg, "games" + q({ operatorUserId, gameDay })), { method: "GET", headers:
|
|
205
|
+
const res = await cfg.fetch(endpoint(cfg, "games" + q({ operatorUserId, gameDay })), { method: "GET", headers: headersFor(cfg, false) });
|
|
201
206
|
if (res.status === 404) return null;
|
|
202
207
|
if (!res.ok) throw new Error(`games ${res.status}`);
|
|
203
208
|
return await res.json();
|
|
204
209
|
}
|
|
205
210
|
async function getGameConfig(cfg, gameId, fixtureId, gameDay, locale) {
|
|
206
|
-
const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}` + q({ fixtureId, gameDay, locale })), { method: "GET", headers:
|
|
211
|
+
const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}` + q({ fixtureId, gameDay, locale })), { method: "GET", headers: headersFor(cfg, false) });
|
|
207
212
|
if (res.status === 404) return null;
|
|
208
213
|
if (!res.ok) throw new Error(`game-config ${res.status}`);
|
|
209
214
|
return await res.json();
|
|
210
215
|
}
|
|
211
216
|
async function getGameResult(cfg, gameId, operatorUserId, fixtureId, gameDay, locale) {
|
|
212
|
-
const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}/result` + q({ operatorUserId, fixtureId, gameDay, locale })), { method: "GET", headers:
|
|
217
|
+
const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}/result` + q({ operatorUserId, fixtureId, gameDay, locale })), { method: "GET", headers: headersFor(cfg, false) });
|
|
213
218
|
if (res.status === 404) return null;
|
|
214
219
|
if (!res.ok) throw new Error(`game-result ${res.status}`);
|
|
215
220
|
return await res.json();
|
|
@@ -217,7 +222,7 @@ async function getGameResult(cfg, gameId, operatorUserId, fixtureId, gameDay, lo
|
|
|
217
222
|
async function postPlay(cfg, gameId, body, locale) {
|
|
218
223
|
const res = await cfg.fetch(endpoint(cfg, `games/${encodeURIComponent(gameId)}/plays` + q({ locale })), {
|
|
219
224
|
method: "POST",
|
|
220
|
-
headers:
|
|
225
|
+
headers: headersFor(cfg, true),
|
|
221
226
|
body: JSON.stringify(body)
|
|
222
227
|
});
|
|
223
228
|
if (res.status === 404) return null;
|
|
@@ -225,49 +230,49 @@ async function postPlay(cfg, gameId, body, locale) {
|
|
|
225
230
|
return await res.json();
|
|
226
231
|
}
|
|
227
232
|
async function getLeaderboard(cfg, operatorUserId, week) {
|
|
228
|
-
const res = await cfg.fetch(endpoint(cfg, "games/leaderboard" + q({ operatorUserId, week })), { method: "GET", headers:
|
|
233
|
+
const res = await cfg.fetch(endpoint(cfg, "games/leaderboard" + q({ operatorUserId, week })), { method: "GET", headers: headersFor(cfg, false) });
|
|
229
234
|
if (res.status === 404) return null;
|
|
230
235
|
if (!res.ok) throw new Error(`leaderboard ${res.status}`);
|
|
231
236
|
return await res.json();
|
|
232
237
|
}
|
|
233
238
|
async function getClubFixtures(cfg, competitionId, limit) {
|
|
234
|
-
const res = await cfg.fetch(endpoint(cfg, "club/fixtures" + q({ competitionId, limit })), { method: "GET", headers:
|
|
239
|
+
const res = await cfg.fetch(endpoint(cfg, "club/fixtures" + q({ competitionId, limit })), { method: "GET", headers: headersFor(cfg, false) });
|
|
235
240
|
if (res.status === 404) return null;
|
|
236
241
|
if (!res.ok) throw new Error(`club-fixtures ${res.status}`);
|
|
237
242
|
return await res.json();
|
|
238
243
|
}
|
|
239
244
|
async function getClubStandings(cfg, competitionId) {
|
|
240
|
-
const res = await cfg.fetch(endpoint(cfg, "club/standings" + q({ competitionId })), { method: "GET", headers:
|
|
245
|
+
const res = await cfg.fetch(endpoint(cfg, "club/standings" + q({ competitionId })), { method: "GET", headers: headersFor(cfg, false) });
|
|
241
246
|
if (res.status === 404) return null;
|
|
242
247
|
if (!res.ok) throw new Error(`club-standings ${res.status}`);
|
|
243
248
|
return await res.json();
|
|
244
249
|
}
|
|
245
250
|
async function getClubSquad(cfg) {
|
|
246
|
-
const res = await cfg.fetch(endpoint(cfg, "club/squad"), { method: "GET", headers:
|
|
251
|
+
const res = await cfg.fetch(endpoint(cfg, "club/squad"), { method: "GET", headers: headersFor(cfg, false) });
|
|
247
252
|
if (res.status === 404) return null;
|
|
248
253
|
if (!res.ok) throw new Error(`club-squad ${res.status}`);
|
|
249
254
|
return await res.json();
|
|
250
255
|
}
|
|
251
256
|
async function getClubSquadStats(cfg) {
|
|
252
|
-
const res = await cfg.fetch(endpoint(cfg, "club/squad/stats"), { method: "GET", headers:
|
|
257
|
+
const res = await cfg.fetch(endpoint(cfg, "club/squad/stats"), { method: "GET", headers: headersFor(cfg, false) });
|
|
253
258
|
if (res.status === 404) return null;
|
|
254
259
|
if (!res.ok) throw new Error(`club-squad-stats ${res.status}`);
|
|
255
260
|
return await res.json();
|
|
256
261
|
}
|
|
257
262
|
async function getClubPlayerDetail(cfg, playerId) {
|
|
258
|
-
const res = await cfg.fetch(endpoint(cfg, `club/player/${encodeURIComponent(String(playerId))}`), { method: "GET", headers:
|
|
263
|
+
const res = await cfg.fetch(endpoint(cfg, `club/player/${encodeURIComponent(String(playerId))}`), { method: "GET", headers: headersFor(cfg, false) });
|
|
259
264
|
if (res.status === 404) return null;
|
|
260
265
|
if (!res.ok) throw new Error(`club-player ${res.status}`);
|
|
261
266
|
return await res.json();
|
|
262
267
|
}
|
|
263
268
|
async function getClubRecords(cfg, limit) {
|
|
264
|
-
const res = await cfg.fetch(endpoint(cfg, "club/records" + q({ limit })), { method: "GET", headers:
|
|
269
|
+
const res = await cfg.fetch(endpoint(cfg, "club/records" + q({ limit })), { method: "GET", headers: headersFor(cfg, false) });
|
|
265
270
|
if (res.status === 404) return null;
|
|
266
271
|
if (!res.ok) throw new Error(`club-records ${res.status}`);
|
|
267
272
|
return await res.json();
|
|
268
273
|
}
|
|
269
274
|
async function getPricePresets(cfg, locale, operatorUserId, options) {
|
|
270
|
-
const res = await cfg.fetch(endpoint(cfg, "price-presets" + q({ locale, operatorUserId, pool: options?.pool })), { method: "GET", headers:
|
|
275
|
+
const res = await cfg.fetch(endpoint(cfg, "price-presets" + q({ locale, operatorUserId, pool: options?.pool })), { method: "GET", headers: headersFor(cfg, false) });
|
|
271
276
|
if (res.status === 404) return null;
|
|
272
277
|
if (!res.ok) throw new Error(`price-presets ${res.status}`);
|
|
273
278
|
return await res.json();
|
|
@@ -677,7 +682,8 @@ var StatsWidgetClient = class {
|
|
|
677
682
|
operatorId: options.operatorId,
|
|
678
683
|
publicKey: options.publicKey,
|
|
679
684
|
baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
|
|
680
|
-
fetch: fetchImpl
|
|
685
|
+
fetch: fetchImpl,
|
|
686
|
+
client: options.client
|
|
681
687
|
};
|
|
682
688
|
}
|
|
683
689
|
chat(input, callbacks) {
|