@maestro_io/maestro-web-sdk 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MaestroEventDelegate.js +60 -0
- package/dist/components/atoms/BaseButton/BaseButton.js +11 -0
- package/dist/components/atoms/BaseButton/index.js +2 -0
- package/dist/components/atoms/Image/index.js +30 -0
- package/dist/components/atoms/Rive/index.d.ts +7 -8
- package/dist/components/atoms/Rive/index.js +52 -0
- package/dist/components/atoms/SvgIcon/BetGeneralIcon.js +9 -0
- package/dist/components/atoms/SvgIcon/BetsIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/BetsWarningIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/CheckmarkIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/CollapseIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/ExpandIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/FantasyIcon.js +8 -0
- package/dist/components/atoms/SvgIcon/FlameIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/Icon.js +42 -0
- package/dist/components/atoms/SvgIcon/KeyPlaysIcon.js +10 -0
- package/dist/components/atoms/SvgIcon/MobilePhoneIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/PlayIcon.js +8 -0
- package/dist/components/atoms/SvgIcon/StatsIcon.js +12 -0
- package/dist/components/atoms/SvgIcon/TimesIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/WarningIcon.js +8 -0
- package/dist/components/atoms/SvgIcon/index.js +2 -0
- package/dist/components/core/App/App.js +41 -0
- package/dist/components/core/App/index.js +2 -0
- package/dist/components/core/OverlayContainer.js +58 -0
- package/dist/components/core/PanelManager/PanelManager.js +80 -0
- package/dist/components/core/PanelManager/index.js +2 -0
- package/dist/components/core/ScrollableContainer/FocusableItem.js +38 -0
- package/dist/components/core/ScrollableContainer/ScrollableContainer.js +166 -0
- package/dist/components/core/ScrollableContainer/index.js +2 -0
- package/dist/components/molecules/ActionButton/ActionButton.js +10 -0
- package/dist/components/molecules/ActionButton/index.js +2 -0
- package/dist/components/molecules/Overlay/Overlay.d.ts +1 -2
- package/dist/components/molecules/Overlay/Overlay.js +139 -0
- package/dist/components/molecules/Overlay/index.js +2 -0
- package/dist/components/molecules/PanelNavButton/PanelNavButton.js +40 -0
- package/dist/components/molecules/PanelNavButton/index.js +2 -0
- package/dist/components/molecules/SegmentButton/SegmentButton.js +10 -0
- package/dist/components/molecules/SegmentButton/index.js +2 -0
- package/dist/components/molecules/WatchButton/WatchButton.js +15 -0
- package/dist/components/molecules/WatchButton/index.js +2 -0
- package/dist/components/organisms/PanelNavigation/PanelNavigation.js +72 -0
- package/dist/components/organisms/PanelNavigation/index.js +2 -0
- package/dist/components/organisms/SegmentController/SegmentController.js +69 -0
- package/dist/components/organisms/SegmentController/index.d.ts +1 -1
- package/dist/components/organisms/SegmentController/index.js +2 -0
- package/dist/external/AxiosNetworkClient.js +83 -0
- package/dist/external/LocalStorageCacheManager.js +213 -0
- package/dist/external/ReactRenderer.d.ts +2 -2
- package/dist/external/ReactRenderer.js +86 -0
- package/dist/external/mocks/MockExternalNetworkClient.js +161 -0
- package/dist/external/ports/cacheManager.js +1 -0
- package/dist/external/ports/networkClient.js +1 -0
- package/dist/external/ports/renderer.js +1 -0
- package/dist/external/spatial-navigation/index.d.ts +1 -1
- package/dist/external/spatial-navigation/index.js +4 -0
- package/dist/external/spatial-navigation/measureLayout.js +30 -0
- package/dist/external/spatial-navigation/spatialNavigation.js +875 -0
- package/dist/external/spatial-navigation/utils.js +6 -0
- package/dist/external/spatial-navigation/visualDebugger.js +76 -0
- package/dist/external/spatial-navigation/withFocusable.js +238 -0
- package/dist/helpers/Observable.js +37 -0
- package/dist/helpers/deliver-focus.js +12 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +192 -0
- package/dist/interfaces/IMaestroEvent.js +6 -0
- package/dist/interfaces/IMaestroEventDelegate.js +1 -0
- package/dist/interfaces/IMaestroManager.js +1 -0
- package/dist/maestro-web-sdk.umd.js +3 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/models/IModel.js +1 -0
- package/dist/models/IPanel.js +53 -0
- package/dist/models/ITheme.js +20 -0
- package/dist/models/IWinningBet.js +1 -0
- package/dist/modules/bets/interfaces/IBets.js +1 -0
- package/dist/modules/bets/mocks.js +572 -0
- package/dist/modules/bets/view/BetsView.js +116 -0
- package/dist/modules/bets/view/HotProps/HotPropsView.js +139 -0
- package/dist/modules/bets/view/SixPack/SixPackView.js +103 -0
- package/dist/modules/bets/view/TabLoadFailureView.js +12 -0
- package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +6 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +122 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +34 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +22 -0
- package/dist/modules/bets/view/UserBets/Boost/Boost.js +6 -0
- package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +9 -0
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +13 -0
- package/dist/modules/bets/view/UserBets/Straight/Straight.js +6 -0
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +13 -0
- package/dist/modules/bets/view/UserBets/UserBetsView.js +114 -0
- package/dist/modules/bets/view/components/Bet/Bet.js +32 -0
- package/dist/modules/bets/view/components/BetPill/BetPill.js +6 -0
- package/dist/modules/bets/view/components/BetsCard/BetsCard.js +15 -0
- package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +20 -0
- package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +14 -0
- package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +16 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +63 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/index.d.ts +1 -1
- package/dist/modules/bets/view/components/PromoCodeBanner/index.js +1 -0
- package/dist/modules/bets/view-model/BetsViewModel.js +767 -0
- package/dist/modules/key-plays/constants.js +292 -0
- package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +4 -4
- package/dist/modules/key-plays/interfaces/IKeyPlays.js +14 -0
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +1 -0
- package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +13 -0
- package/dist/modules/key-plays/view/KeyPlayCardView.js +142 -0
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +58 -0
- package/dist/modules/key-plays/view/KeyPlaysView.js +167 -0
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +182 -0
- package/dist/modules/stats/interfaces/IStats.d.ts +163 -0
- package/dist/modules/stats/interfaces/IStats.js +1 -0
- package/dist/modules/stats/mocks.d.ts +2 -0
- package/dist/modules/stats/mocks.js +546 -0
- package/dist/modules/stats/utils.d.ts +39 -0
- package/dist/modules/stats/utils.js +62 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +29 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.js +9 -0
- package/dist/modules/stats/view/GameLeaders/index.d.ts +2 -0
- package/dist/modules/stats/view/GameLeaders/index.js +2 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.d.ts +17 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +55 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/index.d.ts +2 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +1 -0
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +52 -0
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +66 -0
- package/dist/modules/stats/view/MatchPredictor/index.d.ts +3 -0
- package/dist/modules/stats/view/MatchPredictor/index.js +2 -0
- package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +62 -0
- package/dist/modules/stats/view/RecentGames/RecentGames.js +22 -0
- package/dist/modules/stats/view/RecentGames/index.d.ts +2 -0
- package/dist/modules/stats/view/RecentGames/index.js +2 -0
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.d.ts +51 -0
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +38 -0
- package/dist/modules/stats/view/StatsQRCode/index.d.ts +2 -0
- package/dist/modules/stats/view/StatsQRCode/index.js +1 -0
- package/dist/modules/stats/view/StatsView.d.ts +20 -0
- package/dist/modules/stats/view/StatsView.js +87 -0
- package/dist/modules/stats/view/Teams/StatsCarousel.d.ts +8 -0
- package/dist/modules/stats/view/Teams/StatsCarousel.js +14 -0
- package/dist/modules/stats/view/Teams/StatsProgressBar.d.ts +7 -0
- package/dist/modules/stats/view/Teams/StatsProgressBar.js +14 -0
- package/dist/modules/stats/view/Teams/Teams.d.ts +67 -0
- package/dist/modules/stats/view/Teams/Teams.js +35 -0
- package/dist/modules/stats/view/Teams/index.d.ts +2 -0
- package/dist/modules/stats/view/Teams/index.js +2 -0
- package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +62 -0
- package/dist/modules/stats/view/WinProbability/WinProbability.js +27 -0
- package/dist/modules/stats/view/WinProbability/index.d.ts +2 -0
- package/dist/modules/stats/view/WinProbability/index.js +2 -0
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +51 -0
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +28 -0
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +10 -0
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +11 -0
- package/dist/modules/stats/view/components/AthletesStatistics/index.d.ts +2 -0
- package/dist/modules/stats/view/components/AthletesStatistics/index.js +2 -0
- package/dist/modules/stats/view/index.d.ts +1 -0
- package/dist/modules/stats/view/index.js +1 -0
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +31 -0
- package/dist/modules/stats/view-model/StatsViewModel.js +90 -0
- package/dist/services/BetsService.js +102 -0
- package/dist/services/NetworkManager/NetworkManager.js +410 -0
- package/dist/services/NetworkManager/errors.js +45 -0
- package/dist/services/ThemeManager/constants.js +47 -0
- package/dist/test-polyfills.d.ts +1 -0
- package/dist/test-polyfills.js +15 -0
- package/dist/types/OverlayTypes.js +4 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +2 -0
- package/dist/view-models/MaestroEventViewModel.js +156 -0
- package/dist/view-models/OverlayViewModel.js +222 -0
- package/dist/view-models/PanelManagerViewModel.js +80 -0
- package/dist/view-models/ViewModel.js +32 -0
- package/dist/view-models/index.js +59 -0
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './TeamsView.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
type Team = {
|
|
6
|
+
color?: string;
|
|
7
|
+
id: string;
|
|
8
|
+
logo: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
abbreviation: string;
|
|
11
|
+
record?: string;
|
|
12
|
+
linescores: string[];
|
|
13
|
+
};
|
|
14
|
+
export type HeaderTeamStatItem = {
|
|
15
|
+
isLive: boolean;
|
|
16
|
+
linescoresHeader: string[];
|
|
17
|
+
statistics?: {
|
|
18
|
+
displayName: string;
|
|
19
|
+
homeTeamValue: number;
|
|
20
|
+
awayTeamValue: number;
|
|
21
|
+
}[];
|
|
22
|
+
homeTeam: Team;
|
|
23
|
+
awayTeam: Team;
|
|
24
|
+
};
|
|
25
|
+
declare const _default: {
|
|
26
|
+
new (props?: (HeaderTeamStatItem & WithFocusableProps) | undefined, context?: any): {
|
|
27
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
28
|
+
getChildContext(): {
|
|
29
|
+
parentFocusKey: string;
|
|
30
|
+
};
|
|
31
|
+
setFocus: (focusKey: string) => void;
|
|
32
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
33
|
+
stealFocus: () => void;
|
|
34
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
35
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
36
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
37
|
+
onEnterReleaseHandler: () => void;
|
|
38
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
39
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
40
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
41
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
42
|
+
componentDidMount(): void;
|
|
43
|
+
componentDidUpdate(): void;
|
|
44
|
+
componentWillUnmount(): void;
|
|
45
|
+
render(): React.ReactElement<HeaderTeamStatItem & WithFocusableProps>;
|
|
46
|
+
setState<K extends keyof import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: HeaderTeamStatItem & WithFocusableProps) => import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
47
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
48
|
+
props: Readonly<{
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}> & Readonly<HeaderTeamStatItem & WithFocusableProps>;
|
|
51
|
+
context: any;
|
|
52
|
+
refs: {
|
|
53
|
+
[key: string]: React.ReactInstance;
|
|
54
|
+
};
|
|
55
|
+
componentWillMount?(): void;
|
|
56
|
+
componentWillReceiveProps?(nextProps: Readonly<HeaderTeamStatItem & WithFocusableProps>, nextContext: any): void;
|
|
57
|
+
shouldComponentUpdate?(nextProps: Readonly<HeaderTeamStatItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
58
|
+
componentWillUpdate?(nextProps: Readonly<HeaderTeamStatItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
59
|
+
};
|
|
60
|
+
contextTypes: {
|
|
61
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
62
|
+
};
|
|
63
|
+
childContextTypes: {
|
|
64
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './TeamsView.styles.css';
|
|
3
|
+
import Image from '@/components/atoms/Image';
|
|
4
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
5
|
+
import { CarouselSlider, StatsCarousel } from './StatsCarousel';
|
|
6
|
+
import StatsProgressBar from './StatsProgressBar';
|
|
7
|
+
const Teams = (props) => {
|
|
8
|
+
const teams = [props.homeTeam, props.awayTeam];
|
|
9
|
+
return (React.createElement("section", { className: "stats-teams-view focus-ring", "data-focused": props.focused, style: {
|
|
10
|
+
'--home-team': `#${props.homeTeam.color}`,
|
|
11
|
+
'--away-team': `#${props.awayTeam.color}`,
|
|
12
|
+
}, "data-live": props.isLive },
|
|
13
|
+
React.createElement("div", { className: "stats-teams-view-header" }, teams.map((team) => (React.createElement("div", { key: team.id, className: "stats-team" },
|
|
14
|
+
React.createElement(Image, { src: team.logo, alt: team.name, crossOrigin: "anonymous" }),
|
|
15
|
+
React.createElement("div", null,
|
|
16
|
+
React.createElement("span", { className: props.isLive ? 'T05_ALT' : 'T30' }, team.abbreviation),
|
|
17
|
+
React.createElement("p", { className: "T02" }, team.record)))))),
|
|
18
|
+
props.isLive && (React.createElement("div", { className: "statistics" },
|
|
19
|
+
React.createElement("table", { className: "statistics-table" },
|
|
20
|
+
React.createElement("thead", null,
|
|
21
|
+
React.createElement("tr", null,
|
|
22
|
+
React.createElement("th", { className: "T10" }),
|
|
23
|
+
props.linescoresHeader.map((header) => (React.createElement("th", { key: header, className: "T10" }, header))))),
|
|
24
|
+
React.createElement("tbody", null, teams.map((team) => (React.createElement("tr", { key: team.id },
|
|
25
|
+
React.createElement("td", { className: "T30" }, team.name),
|
|
26
|
+
team.linescores.map((lineScore, index) => (React.createElement("td", { key: `${lineScore}-${index}`, className: "T10" }, lineScore)))))))),
|
|
27
|
+
props.statistics && props.statistics.length > 0 && (React.createElement(StatsCarousel, { itemsLength: props.statistics.length }, props.statistics.map((statistic) => (React.createElement(CarouselSlider, { itemsLength: props.statistics.length, key: statistic.displayName },
|
|
28
|
+
React.createElement("div", { className: "score-statistics" },
|
|
29
|
+
React.createElement("div", { className: "score-statistics-header" },
|
|
30
|
+
React.createElement("span", { className: "T30" }, statistic.homeTeamValue),
|
|
31
|
+
React.createElement("span", { className: "statistic-name T02" }, statistic.displayName),
|
|
32
|
+
React.createElement("span", { className: "T30" }, statistic.awayTeamValue)),
|
|
33
|
+
React.createElement(StatsProgressBar, { awayTeamValue: statistic.awayTeamValue, homeTeamValue: statistic.homeTeamValue })))))))))));
|
|
34
|
+
};
|
|
35
|
+
export default withFocusable()(Teams);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './WinProbability.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
export type WinProbabilityStatsItem = {
|
|
6
|
+
chartImageUrl: string;
|
|
7
|
+
awayTeam: {
|
|
8
|
+
id: string;
|
|
9
|
+
abbreviation: string;
|
|
10
|
+
logo: string;
|
|
11
|
+
winPercentage: string;
|
|
12
|
+
};
|
|
13
|
+
homeTeam: {
|
|
14
|
+
id: string;
|
|
15
|
+
abbreviation: string;
|
|
16
|
+
logo: string;
|
|
17
|
+
winPercentage: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const _default: {
|
|
21
|
+
new (props?: (WinProbabilityStatsItem & WithFocusableProps) | undefined, context?: any): {
|
|
22
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
23
|
+
getChildContext(): {
|
|
24
|
+
parentFocusKey: string;
|
|
25
|
+
};
|
|
26
|
+
setFocus: (focusKey: string) => void;
|
|
27
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
28
|
+
stealFocus: () => void;
|
|
29
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
30
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
31
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
32
|
+
onEnterReleaseHandler: () => void;
|
|
33
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
34
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
35
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
36
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
37
|
+
componentDidMount(): void;
|
|
38
|
+
componentDidUpdate(): void;
|
|
39
|
+
componentWillUnmount(): void;
|
|
40
|
+
render(): React.ReactElement<WinProbabilityStatsItem & WithFocusableProps>;
|
|
41
|
+
setState<K extends keyof import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: WinProbabilityStatsItem & WithFocusableProps) => import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
42
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
43
|
+
props: Readonly<{
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
}> & Readonly<WinProbabilityStatsItem & WithFocusableProps>;
|
|
46
|
+
context: any;
|
|
47
|
+
refs: {
|
|
48
|
+
[key: string]: React.ReactInstance;
|
|
49
|
+
};
|
|
50
|
+
componentWillMount?(): void;
|
|
51
|
+
componentWillReceiveProps?(nextProps: Readonly<WinProbabilityStatsItem & WithFocusableProps>, nextContext: any): void;
|
|
52
|
+
shouldComponentUpdate?(nextProps: Readonly<WinProbabilityStatsItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
53
|
+
componentWillUpdate?(nextProps: Readonly<WinProbabilityStatsItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
54
|
+
};
|
|
55
|
+
contextTypes: {
|
|
56
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
57
|
+
};
|
|
58
|
+
childContextTypes: {
|
|
59
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './WinProbability.styles.css';
|
|
3
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
4
|
+
import Image from '@/components/atoms/Image';
|
|
5
|
+
const WinProbability = (props) => {
|
|
6
|
+
return (React.createElement("section", { className: "win-probability focus-ring", "data-focused": props.focused },
|
|
7
|
+
React.createElement("h5", { className: "T05_ALT" }, "Win Probability"),
|
|
8
|
+
React.createElement("div", { className: "win-probability-card" }, [props.awayTeam, props.homeTeam].map((team, index) => {
|
|
9
|
+
return (React.createElement("div", { className: "team", key: team.id },
|
|
10
|
+
React.createElement(Image, { src: team.logo, alt: `${team.abbreviation} logo`, crossOrigin: "anonymous" }),
|
|
11
|
+
React.createElement("div", { className: "info" },
|
|
12
|
+
React.createElement("span", { className: "T60" }, team.winPercentage ? `${team.winPercentage}%` : '–'),
|
|
13
|
+
React.createElement("div", { className: "name T01" },
|
|
14
|
+
index === 0 ? React.createElement(AwayTeamChartLine, null) : React.createElement(HomeTeamChartLine, null),
|
|
15
|
+
React.createElement("span", null, team.abbreviation)))));
|
|
16
|
+
})),
|
|
17
|
+
React.createElement(Image, { src: props.chartImageUrl, alt: "Win Probability Chart", crossOrigin: "anonymous" })));
|
|
18
|
+
};
|
|
19
|
+
const AwayTeamChartLine = () => {
|
|
20
|
+
return (React.createElement("svg", { width: "25", height: "4", viewBox: "0 0 25 4", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
21
|
+
React.createElement("path", { d: "M2.33337 2H22.3334", stroke: "white", strokeWidth: "4", strokeLinecap: "round" })));
|
|
22
|
+
};
|
|
23
|
+
const HomeTeamChartLine = () => {
|
|
24
|
+
return (React.createElement("svg", { width: "25", height: "4", viewBox: "0 0 25 4", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
25
|
+
React.createElement("path", { d: "M2.66992 2H22.6699", stroke: "white", strokeWidth: "4", strokeLinecap: "round", strokeDasharray: "2 7" })));
|
|
26
|
+
};
|
|
27
|
+
export default withFocusable()(WinProbability);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
4
|
+
import { LeaderStatsItem } from '../../GameLeaders/GameLeaders';
|
|
5
|
+
import './AthleteStatistics.styles.css';
|
|
6
|
+
type AthletesStatisticsProps = {
|
|
7
|
+
item: LeaderStatsItem;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: {
|
|
10
|
+
new (props?: (AthletesStatisticsProps & WithFocusableProps) | undefined, context?: any): {
|
|
11
|
+
state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
12
|
+
getChildContext(): {
|
|
13
|
+
parentFocusKey: string;
|
|
14
|
+
};
|
|
15
|
+
setFocus: (focusKey: string) => void;
|
|
16
|
+
navigateByDirection: (direction: import("../../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
17
|
+
stealFocus: () => void;
|
|
18
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
19
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
20
|
+
onEnterPressHandler: (details: import("../../../../../external/spatial-navigation/utils").Details) => void;
|
|
21
|
+
onEnterReleaseHandler: () => void;
|
|
22
|
+
onBackPressHandler: (details: import("../../../../../external/spatial-navigation/utils").Details) => void;
|
|
23
|
+
onArrowPressHandler: (direction: import("../../../../../external/spatial-navigation/utils").Direction, details: import("../../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
24
|
+
onBecameFocusedHandler: (layout: import("../../../../../external/spatial-navigation/utils").Layout, details: import("../../../../../external/spatial-navigation/utils").Details) => void;
|
|
25
|
+
onBecameBlurredHandler: (layout: import("../../../../../external/spatial-navigation/utils").Layout, details: import("../../../../../external/spatial-navigation/utils").Details) => void;
|
|
26
|
+
componentDidMount(): void;
|
|
27
|
+
componentDidUpdate(): void;
|
|
28
|
+
componentWillUnmount(): void;
|
|
29
|
+
render(): React.ReactElement<AthletesStatisticsProps & WithFocusableProps>;
|
|
30
|
+
setState<K extends keyof import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: AthletesStatisticsProps & WithFocusableProps) => import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
31
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
32
|
+
props: Readonly<{
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}> & Readonly<AthletesStatisticsProps & WithFocusableProps>;
|
|
35
|
+
context: any;
|
|
36
|
+
refs: {
|
|
37
|
+
[key: string]: React.ReactInstance;
|
|
38
|
+
};
|
|
39
|
+
componentWillMount?(): void;
|
|
40
|
+
componentWillReceiveProps?(nextProps: Readonly<AthletesStatisticsProps & WithFocusableProps>, nextContext: any): void;
|
|
41
|
+
shouldComponentUpdate?(nextProps: Readonly<AthletesStatisticsProps & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
42
|
+
componentWillUpdate?(nextProps: Readonly<AthletesStatisticsProps & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
43
|
+
};
|
|
44
|
+
contextTypes: {
|
|
45
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
46
|
+
};
|
|
47
|
+
childContextTypes: {
|
|
48
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import StatisticsTable from './StatisticTable';
|
|
3
|
+
import Image from '@/components/atoms/Image';
|
|
4
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
5
|
+
import './AthleteStatistics.styles.css';
|
|
6
|
+
const AthletesStatistics = (props) => {
|
|
7
|
+
const item = props.item;
|
|
8
|
+
return (React.createElement("div", { className: "athletes-statistics focus-ring", key: item.displayName, "data-focused": props.focused },
|
|
9
|
+
React.createElement("span", { className: "T05_ALT" }, item.displayName),
|
|
10
|
+
React.createElement("div", { className: "leaders-wrapper" }, [item.awayAthlete, item.homeAthlete].map((athlete) => {
|
|
11
|
+
return (React.createElement("div", { className: "leader", key: athlete.id + item.displayName },
|
|
12
|
+
React.createElement("div", { className: "image-wrapper T02", "data-position": athlete.position },
|
|
13
|
+
React.createElement(Image, { src: athlete.headshot, alt: `${item.displayName} ${athlete.displayName} Headshot Image` })),
|
|
14
|
+
React.createElement("div", { className: "leader-info" },
|
|
15
|
+
React.createElement("div", { className: "main-statistic T05_ALT" },
|
|
16
|
+
athlete.shortName,
|
|
17
|
+
' ',
|
|
18
|
+
React.createElement("span", { className: "athlete-number T02" },
|
|
19
|
+
"#",
|
|
20
|
+
athlete.jersey)),
|
|
21
|
+
athlete.mainStatistic && (React.createElement("div", { className: "main-statistic T30" },
|
|
22
|
+
athlete.mainStatistic.displayValue,
|
|
23
|
+
' ',
|
|
24
|
+
React.createElement("span", { className: "athlete-points T02" }, athlete.mainStatistic.abbreviation))))));
|
|
25
|
+
})),
|
|
26
|
+
React.createElement(StatisticsTable, { statistics: item.statistics || [] })));
|
|
27
|
+
};
|
|
28
|
+
export default withFocusable()(AthletesStatistics);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type LeadersStatisticTableProps = {
|
|
3
|
+
statistics: {
|
|
4
|
+
awayAthleteValue: string;
|
|
5
|
+
abbreviation: string;
|
|
6
|
+
homeAthleteValue: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
declare const StatisticsTable: (props: LeadersStatisticTableProps) => React.JSX.Element;
|
|
10
|
+
export default StatisticsTable;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const StatisticsTable = (props) => {
|
|
3
|
+
return (React.createElement("table", { className: "athletes-statistics-table T10" },
|
|
4
|
+
React.createElement("tbody", null, props.statistics.map((statistic) => {
|
|
5
|
+
return (React.createElement("tr", { key: statistic.abbreviation },
|
|
6
|
+
React.createElement("td", null, statistic.awayAthleteValue),
|
|
7
|
+
React.createElement("td", null, statistic.abbreviation),
|
|
8
|
+
React.createElement("td", null, statistic.homeAthleteValue)));
|
|
9
|
+
}))));
|
|
10
|
+
};
|
|
11
|
+
export default StatisticsTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './StatsView';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './StatsView';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Observable } from '../../../helpers/Observable';
|
|
2
|
+
import { ViewModel } from '../../../view-models/ViewModel';
|
|
3
|
+
import { StatsApiResponse } from '../interfaces/IStats';
|
|
4
|
+
export declare class StatsViewModel extends ViewModel {
|
|
5
|
+
statsData: Observable<StatsApiResponse | null>;
|
|
6
|
+
isDataLoading: Observable<boolean>;
|
|
7
|
+
hasEverSuccessfullyLoaded: Observable<boolean>;
|
|
8
|
+
private useMockData;
|
|
9
|
+
initialized: boolean;
|
|
10
|
+
constructor(_eventId: string, // TODO: Will be used when implementing real API calls
|
|
11
|
+
options?: {
|
|
12
|
+
useMockData?: boolean;
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Initialize the ViewModel and start data fetching
|
|
16
|
+
*/
|
|
17
|
+
init(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Clean up resources when the ViewModel is no longer needed
|
|
20
|
+
*/
|
|
21
|
+
cleanup(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch new stats data immediately (one-time)
|
|
24
|
+
*/
|
|
25
|
+
fetchNewData(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch mock data for testing
|
|
28
|
+
*/
|
|
29
|
+
private fetchMockData;
|
|
30
|
+
}
|
|
31
|
+
export default StatsViewModel;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Observable } from '../../../helpers/Observable';
|
|
2
|
+
import { ViewModel } from '../../../view-models/ViewModel';
|
|
3
|
+
import { MOCK_STATS_API_PRE_GAME_RESPONSE } from '../mocks';
|
|
4
|
+
// TODO: Implement actual ViewModel
|
|
5
|
+
export class StatsViewModel extends ViewModel {
|
|
6
|
+
constructor(_eventId, // TODO: Will be used when implementing real API calls
|
|
7
|
+
options = {}) {
|
|
8
|
+
super();
|
|
9
|
+
// Observable properties
|
|
10
|
+
Object.defineProperty(this, "statsData", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: new Observable(null)
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "isDataLoading", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: new Observable(true)
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "hasEverSuccessfullyLoaded", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: new Observable(false)
|
|
27
|
+
});
|
|
28
|
+
// Properties
|
|
29
|
+
Object.defineProperty(this, "useMockData", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: false
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(this, "initialized", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: false
|
|
40
|
+
});
|
|
41
|
+
// TODO: Store eventId when implementing real API calls
|
|
42
|
+
// this.eventId = _eventId;
|
|
43
|
+
this.useMockData = options.useMockData || false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Initialize the ViewModel and start data fetching
|
|
47
|
+
*/
|
|
48
|
+
async init() {
|
|
49
|
+
await this.fetchNewData();
|
|
50
|
+
this.initialized = true;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Clean up resources when the ViewModel is no longer needed
|
|
54
|
+
*/
|
|
55
|
+
cleanup() {
|
|
56
|
+
this.initialized = false;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Fetch new stats data immediately (one-time)
|
|
60
|
+
*/
|
|
61
|
+
async fetchNewData() {
|
|
62
|
+
this.isDataLoading.value = true;
|
|
63
|
+
try {
|
|
64
|
+
// Handle mock data if enabled
|
|
65
|
+
if (this.useMockData) {
|
|
66
|
+
await this.fetchMockData();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// TODO: Implement real API call when stats service is available
|
|
70
|
+
// For now, fall back to mock data
|
|
71
|
+
await this.fetchMockData();
|
|
72
|
+
this.isDataLoading.value = false;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Error fetching stats data:', error);
|
|
76
|
+
this.isDataLoading.value = false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fetch mock data for testing
|
|
81
|
+
*/
|
|
82
|
+
async fetchMockData() {
|
|
83
|
+
// Simulate network delay
|
|
84
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
85
|
+
this.statsData.value = MOCK_STATS_API_PRE_GAME_RESPONSE;
|
|
86
|
+
this.hasEverSuccessfullyLoaded.value = true;
|
|
87
|
+
this.isDataLoading.value = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export default StatsViewModel;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import NetworkManager, { HttpMethod } from './NetworkManager/NetworkManager';
|
|
2
|
+
/**
|
|
3
|
+
* Service for handling bets-related API calls
|
|
4
|
+
*/
|
|
5
|
+
class BetsService {
|
|
6
|
+
constructor(delegate) {
|
|
7
|
+
Object.defineProperty(this, "networkManager", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: void 0
|
|
12
|
+
});
|
|
13
|
+
this.networkManager = NetworkManager.getInstance({
|
|
14
|
+
externalBaseURL: delegate.getBettingAPIBaseURL(),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get non-personalized bets for an event
|
|
19
|
+
*
|
|
20
|
+
* @param eventID - The ID of the event
|
|
21
|
+
* @returns Promise with the bets data
|
|
22
|
+
*/
|
|
23
|
+
async getNonPersonalizedBets(eventID) {
|
|
24
|
+
return this.networkManager.externalApiRequest({
|
|
25
|
+
endpoint: this.nonPersonalizedBetsEndpoint(eventID),
|
|
26
|
+
method: HttpMethod.GET,
|
|
27
|
+
params: {},
|
|
28
|
+
headers: {},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get personalized bets for an event
|
|
33
|
+
*
|
|
34
|
+
* @param eventID - The ID of the event
|
|
35
|
+
* @param swid - The ESPN SWID parameter
|
|
36
|
+
* @param jwt - The authorization JWT
|
|
37
|
+
* @returns Promise with the personalized bets data
|
|
38
|
+
*/
|
|
39
|
+
async getPersonalizedBets(eventID, swid, jwt) {
|
|
40
|
+
return this.networkManager.externalApiRequest({
|
|
41
|
+
endpoint: this.personalizedBetsEndpoint(eventID),
|
|
42
|
+
method: HttpMethod.GET,
|
|
43
|
+
params: { swid },
|
|
44
|
+
headers: { 'x-p13n-auth': jwt },
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Start polling for non-personalized bets
|
|
49
|
+
*
|
|
50
|
+
* @param eventID - The ID of the event
|
|
51
|
+
* @param interval - The polling interval in milliseconds
|
|
52
|
+
* @param onData - Callback for successful data fetch
|
|
53
|
+
* @param onError - Callback for errors
|
|
54
|
+
* @returns Object with a stop function to stop polling
|
|
55
|
+
*/
|
|
56
|
+
pollNonPersonalizedBets(eventID, interval, onData, onError) {
|
|
57
|
+
return this.networkManager.pollExternalApiRequest({
|
|
58
|
+
endpoint: this.nonPersonalizedBetsEndpoint(eventID),
|
|
59
|
+
interval,
|
|
60
|
+
method: HttpMethod.GET,
|
|
61
|
+
params: {},
|
|
62
|
+
headers: {},
|
|
63
|
+
onData,
|
|
64
|
+
onError,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Start polling for personalized bets
|
|
69
|
+
*
|
|
70
|
+
* @param eventID - The ID of the event
|
|
71
|
+
* @param swid - The ESPN SWID parameter
|
|
72
|
+
* @param jwt - The authorization JWT
|
|
73
|
+
* @param interval - The polling interval in milliseconds
|
|
74
|
+
* @param onData - Callback for successful data fetch
|
|
75
|
+
* @param onError - Callback for errors
|
|
76
|
+
* @returns Object with a stop function to stop polling
|
|
77
|
+
*/
|
|
78
|
+
pollPersonalizedBets(eventID, swid, jwt, interval, onData, onError) {
|
|
79
|
+
return this.networkManager.pollExternalApiRequest({
|
|
80
|
+
endpoint: this.personalizedBetsEndpoint(eventID),
|
|
81
|
+
interval,
|
|
82
|
+
method: HttpMethod.GET,
|
|
83
|
+
params: { swid },
|
|
84
|
+
headers: { 'x-p13n-auth': jwt },
|
|
85
|
+
onData,
|
|
86
|
+
onError,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the endpoint for non-personalized bets
|
|
91
|
+
*/
|
|
92
|
+
nonPersonalizedBetsEndpoint(eventID) {
|
|
93
|
+
return `/site/v2/events/${eventID}/odds`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the endpoint for personalized bets
|
|
97
|
+
*/
|
|
98
|
+
personalizedBetsEndpoint(eventID) {
|
|
99
|
+
return `/personalized/site/v2/events/${eventID}/odds`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export default BetsService;
|