@maestro_io/maestro-web-sdk 2.1.3 → 2.2.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/dist/MaestroEventDelegate.d.ts +1 -0
- package/dist/components/atoms/SvgIcon/Icon.d.ts +0 -2
- package/dist/components/core/ScrollableContainer/ScrollableContainer.d.ts +3 -1
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +1 -1
- package/dist/interfaces/IMaestroEvent.d.ts +14 -0
- package/dist/interfaces/IMaestroEventDelegate.d.ts +19 -6
- package/dist/maestro-web-sdk.umd.js +3 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/models/IPanel.d.ts +1 -2
- package/dist/modules/stats/interfaces/IStats.d.ts +38 -12
- package/dist/modules/stats/mocks.d.ts +0 -80
- package/dist/modules/stats/utils/driveSummaryUtils.d.ts +18 -0
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +6 -19
- package/dist/modules/stats/view/DriveSummary/DrivePlayCard.d.ts +26 -0
- package/dist/modules/stats/view/DriveSummary/DriveSummary.d.ts +24 -0
- package/dist/modules/stats/view/DriveSummary/index.d.ts +2 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +15 -4
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +13 -48
- package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +10 -21
- package/dist/modules/stats/view/StatsItemView.d.ts +19 -0
- package/dist/modules/stats/view/StatsView.d.ts +3 -3
- package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +2 -4
- package/dist/modules/stats/view/Teams/Teams.d.ts +10 -26
- package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +10 -21
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +149 -5
- package/package.json +1 -1
- package/dist/MaestroEventDelegate.js +0 -60
- package/dist/components/atoms/BaseButton/BaseButton.js +0 -11
- package/dist/components/atoms/BaseButton/index.js +0 -2
- package/dist/components/atoms/Image/index.js +0 -30
- package/dist/components/atoms/Rive/index.js +0 -53
- package/dist/components/atoms/SvgIcon/BetGeneralIcon.js +0 -9
- package/dist/components/atoms/SvgIcon/BetsIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/BetsWarningIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/CheckmarkIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/CollapseIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/ExpandIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/FantasyIcon.d.ts +0 -6
- package/dist/components/atoms/SvgIcon/FantasyIcon.js +0 -8
- package/dist/components/atoms/SvgIcon/FlameIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/Icon.js +0 -42
- package/dist/components/atoms/SvgIcon/KeyPlaysIcon.js +0 -10
- package/dist/components/atoms/SvgIcon/MobilePhoneIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/PlayIcon.js +0 -8
- package/dist/components/atoms/SvgIcon/StatsIcon.js +0 -12
- package/dist/components/atoms/SvgIcon/TimesIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/WarningIcon.js +0 -8
- package/dist/components/atoms/SvgIcon/index.js +0 -2
- package/dist/components/core/App/App.js +0 -41
- package/dist/components/core/App/index.js +0 -2
- package/dist/components/core/OverlayContainer.js +0 -58
- package/dist/components/core/PanelManager/PanelManager.js +0 -80
- package/dist/components/core/PanelManager/index.js +0 -2
- package/dist/components/core/ScrollableContainer/FocusableItem.js +0 -38
- package/dist/components/core/ScrollableContainer/ScrollableContainer.js +0 -166
- package/dist/components/core/ScrollableContainer/index.js +0 -2
- package/dist/components/molecules/ActionButton/ActionButton.js +0 -10
- package/dist/components/molecules/ActionButton/index.js +0 -2
- package/dist/components/molecules/Overlay/Overlay.js +0 -139
- package/dist/components/molecules/Overlay/index.js +0 -2
- package/dist/components/molecules/PanelNavButton/PanelNavButton.js +0 -40
- package/dist/components/molecules/PanelNavButton/index.js +0 -2
- package/dist/components/molecules/SegmentButton/SegmentButton.js +0 -10
- package/dist/components/molecules/SegmentButton/index.js +0 -2
- package/dist/components/molecules/WatchButton/WatchButton.js +0 -15
- package/dist/components/molecules/WatchButton/index.js +0 -2
- package/dist/components/organisms/PanelNavigation/PanelNavigation.js +0 -71
- package/dist/components/organisms/PanelNavigation/index.js +0 -2
- package/dist/components/organisms/SegmentController/SegmentController.js +0 -68
- package/dist/components/organisms/SegmentController/index.js +0 -2
- package/dist/external/AxiosNetworkClient.js +0 -83
- package/dist/external/LocalStorageCacheManager.js +0 -213
- package/dist/external/ReactRenderer.js +0 -86
- package/dist/external/mocks/MockExternalNetworkClient.js +0 -161
- package/dist/external/ports/cacheManager.js +0 -1
- package/dist/external/ports/networkClient.js +0 -1
- package/dist/external/ports/renderer.js +0 -1
- package/dist/external/spatial-navigation/index.js +0 -3
- package/dist/external/spatial-navigation/measureLayout.js +0 -30
- package/dist/external/spatial-navigation/spatialNavigation.js +0 -864
- package/dist/external/spatial-navigation/utils.js +0 -6
- package/dist/external/spatial-navigation/visualDebugger.js +0 -76
- package/dist/external/spatial-navigation/withFocusable.js +0 -245
- package/dist/helpers/Observable.js +0 -37
- package/dist/helpers/deliver-focus.d.ts +0 -5
- package/dist/helpers/deliver-focus.js +0 -12
- package/dist/index.js +0 -192
- package/dist/interfaces/IMaestroEvent.js +0 -6
- package/dist/interfaces/IMaestroEventDelegate.js +0 -1
- package/dist/interfaces/IMaestroManager.js +0 -1
- package/dist/models/IModel.js +0 -1
- package/dist/models/IPanel.js +0 -53
- package/dist/models/ITheme.js +0 -20
- package/dist/models/IWinningBet.js +0 -1
- package/dist/modules/bets/interfaces/IBets.js +0 -1
- package/dist/modules/bets/mocks.js +0 -572
- package/dist/modules/bets/view/BetsView.js +0 -116
- package/dist/modules/bets/view/HotProps/HotPropsView.js +0 -139
- package/dist/modules/bets/view/SixPack/SixPackView.js +0 -103
- package/dist/modules/bets/view/TabLoadFailureView.js +0 -12
- package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +0 -6
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +0 -122
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +0 -34
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +0 -22
- package/dist/modules/bets/view/UserBets/Boost/Boost.js +0 -6
- package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +0 -9
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +0 -13
- package/dist/modules/bets/view/UserBets/Straight/Straight.js +0 -6
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +0 -13
- package/dist/modules/bets/view/UserBets/UserBetsView.js +0 -114
- package/dist/modules/bets/view/components/Bet/Bet.js +0 -32
- package/dist/modules/bets/view/components/BetPill/BetPill.js +0 -6
- package/dist/modules/bets/view/components/BetsCard/BetsCard.js +0 -15
- package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +0 -20
- package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +0 -14
- package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +0 -16
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +0 -63
- package/dist/modules/bets/view/components/PromoCodeBanner/index.js +0 -1
- package/dist/modules/bets/view-model/BetsViewModel.js +0 -767
- package/dist/modules/key-plays/constants.js +0 -292
- package/dist/modules/key-plays/interfaces/IKeyPlays.js +0 -14
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +0 -1
- package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +0 -13
- package/dist/modules/key-plays/view/KeyPlayCardView.js +0 -120
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +0 -58
- package/dist/modules/key-plays/view/KeyPlaysView.js +0 -166
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +0 -182
- package/dist/modules/stats/interfaces/IStats.js +0 -1
- package/dist/modules/stats/mocks.js +0 -686
- package/dist/modules/stats/utils/renderTeamStatistic.js +0 -16
- package/dist/modules/stats/utils.js +0 -62
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.js +0 -78
- package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.js +0 -27
- package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.js +0 -15
- package/dist/modules/stats/view/ActiveAthletes/index.js +0 -2
- package/dist/modules/stats/view/GameLeaders/GameLeaders.js +0 -9
- package/dist/modules/stats/view/GameLeaders/index.js +0 -2
- package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +0 -55
- package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +0 -1
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +0 -66
- package/dist/modules/stats/view/MatchPredictor/index.js +0 -2
- package/dist/modules/stats/view/RecentGames/RecentGames.js +0 -22
- package/dist/modules/stats/view/RecentGames/index.js +0 -2
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +0 -38
- package/dist/modules/stats/view/StatsQRCode/index.js +0 -1
- package/dist/modules/stats/view/StatsView.js +0 -107
- package/dist/modules/stats/view/TeamStats/TeamStatsView.js +0 -69
- package/dist/modules/stats/view/TeamStats/index.js +0 -1
- package/dist/modules/stats/view/Teams/StatsCarousel.js +0 -14
- package/dist/modules/stats/view/Teams/StatsProgressBar.js +0 -18
- package/dist/modules/stats/view/Teams/Teams.js +0 -42
- package/dist/modules/stats/view/Teams/index.js +0 -2
- package/dist/modules/stats/view/WinProbability/WinProbability.js +0 -27
- package/dist/modules/stats/view/WinProbability/index.js +0 -2
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +0 -29
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +0 -12
- package/dist/modules/stats/view/components/AthletesStatistics/index.js +0 -2
- package/dist/modules/stats/view/index.js +0 -2
- package/dist/modules/stats/view-model/StatsViewModel.js +0 -90
- package/dist/services/BetsService.js +0 -102
- package/dist/services/NetworkManager/NetworkManager.js +0 -410
- package/dist/services/NetworkManager/errors.js +0 -45
- package/dist/services/StatsService.js +0 -68
- package/dist/services/ThemeManager/constants.js +0 -47
- package/dist/test-polyfills.js +0 -15
- package/dist/types/OverlayTypes.js +0 -4
- package/dist/view-models/MaestroEventViewModel.js +0 -168
- package/dist/view-models/OverlayViewModel.js +0 -222
- package/dist/view-models/PanelManagerViewModel.js +0 -80
- package/dist/view-models/ViewModel.js +0 -32
- package/dist/view-models/index.js +0 -59
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const OverlayContainer = React.createClass({
|
|
3
|
-
propTypes: {
|
|
4
|
-
viewModels: React.PropTypes.object,
|
|
5
|
-
},
|
|
6
|
-
getInitialState() {
|
|
7
|
-
return {
|
|
8
|
-
isVisible: false,
|
|
9
|
-
currentOverlay: null,
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
componentDidMount() {
|
|
13
|
-
if (!this.props.viewModels?.overlayViewModel)
|
|
14
|
-
return;
|
|
15
|
-
const overlayVM = this.props.viewModels.overlayViewModel;
|
|
16
|
-
// Subscribe to overlay visibility changes
|
|
17
|
-
this.unsubscribeVisible = overlayVM.isVisible.subscribe((visible) => {
|
|
18
|
-
this.setState({ isVisible: visible });
|
|
19
|
-
});
|
|
20
|
-
// Subscribe to current overlay changes
|
|
21
|
-
this.unsubscribeOverlay = overlayVM.currentOverlay.subscribe((overlay) => {
|
|
22
|
-
this.setState({ currentOverlay: overlay });
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
componentWillUnmount() {
|
|
26
|
-
if (this.unsubscribeVisible)
|
|
27
|
-
this.unsubscribeVisible();
|
|
28
|
-
if (this.unsubscribeOverlay)
|
|
29
|
-
this.unsubscribeOverlay();
|
|
30
|
-
},
|
|
31
|
-
render() {
|
|
32
|
-
if (!this.state.isVisible || !this.state.currentOverlay) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const overlay = this.state.currentOverlay;
|
|
36
|
-
const Overlay = require('../molecules/Overlay').default;
|
|
37
|
-
return React.createElement(Overlay, {
|
|
38
|
-
key: `overlay-${overlay.type}-${Date.now()}`,
|
|
39
|
-
id: 'sdk-managed-rive-overlay',
|
|
40
|
-
overlayType: overlay.type,
|
|
41
|
-
position: overlay.position,
|
|
42
|
-
winningBet: overlay.winningBet,
|
|
43
|
-
fantasy: overlay.fantasy,
|
|
44
|
-
onOverlayViewed: (overlayType) => {
|
|
45
|
-
if (this.props.viewModels?.overlayViewModel) {
|
|
46
|
-
this.props.viewModels.overlayViewModel.handleOverlayViewed(overlayType);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
onOverlayAction: (overlayType) => {
|
|
50
|
-
if (this.props.viewModels?.overlayViewModel) {
|
|
51
|
-
this.props.viewModels.overlayViewModel.handleOverlayAction(overlayType);
|
|
52
|
-
this.props.viewModels.overlayViewModel.hideOverlay();
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
export default OverlayContainer;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PanelManagerViewModel } from '@/view-models/PanelManagerViewModel';
|
|
3
|
-
import './PanelManager.styles.css';
|
|
4
|
-
import PanelNavigation from '@/components/organisms/PanelNavigation';
|
|
5
|
-
import KeyPlaysView from '@/modules/key-plays/view/KeyPlaysView';
|
|
6
|
-
import BetsView from '@/modules/bets/view/BetsView';
|
|
7
|
-
const panelManagerViewModel = new PanelManagerViewModel();
|
|
8
|
-
const PANELS_MAP = {
|
|
9
|
-
keyPlays: React.createElement(KeyPlaysView, null),
|
|
10
|
-
bets: React.createElement(BetsView, null),
|
|
11
|
-
stats: React.createElement("div", { className: "panel-coming-soon T02" }, "Stats - Coming Soon"),
|
|
12
|
-
fantasy: React.createElement("div", { className: "panel-coming-soon T02" }, "Fantasy - Coming Soon"),
|
|
13
|
-
};
|
|
14
|
-
class PanelManager extends React.Component {
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
Object.defineProperty(this, "unsubscribe", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: null
|
|
22
|
-
});
|
|
23
|
-
this.state = {
|
|
24
|
-
activePanel: panelManagerViewModel.currentPanel,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
componentDidMount() {
|
|
28
|
-
// Subscribe to changes in the view model
|
|
29
|
-
this.unsubscribe = panelManagerViewModel.currentPanelObservable.subscribe(() => {
|
|
30
|
-
this.setState({ activePanel: panelManagerViewModel.currentPanel });
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
componentWillUnmount() {
|
|
34
|
-
if (this.unsubscribe) {
|
|
35
|
-
this.unsubscribe();
|
|
36
|
-
this.unsubscribe = null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
goToPanel(panel) {
|
|
40
|
-
return () => {
|
|
41
|
-
if (panelManagerViewModel.currentPanel === panel) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
panelManagerViewModel.currentPanel = panel;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
render() {
|
|
48
|
-
const { activePanel } = this.state;
|
|
49
|
-
const PANEL_ITEMS = [
|
|
50
|
-
{
|
|
51
|
-
iconName: 'keyPlays',
|
|
52
|
-
onEnter: this.goToPanel('keyPlays'),
|
|
53
|
-
title: 'KEY PLAYS',
|
|
54
|
-
active: activePanel === 'keyPlays',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
iconName: 'bets',
|
|
58
|
-
onEnter: this.goToPanel('bets'),
|
|
59
|
-
title: 'BETS',
|
|
60
|
-
active: activePanel === 'bets',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
iconName: 'stats',
|
|
64
|
-
onEnter: this.goToPanel('stats'),
|
|
65
|
-
title: 'STATS',
|
|
66
|
-
active: activePanel === 'stats',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
iconName: 'fantasy',
|
|
70
|
-
onEnter: this.goToPanel('fantasy'),
|
|
71
|
-
title: 'FANTASY',
|
|
72
|
-
active: activePanel === 'fantasy',
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
|
-
return (React.createElement("div", { className: "sdk--panel-manager" },
|
|
76
|
-
React.createElement(PanelNavigation, { items: PANEL_ITEMS }),
|
|
77
|
-
React.createElement("div", { className: "sdk--panel-wrapper" }, PANELS_MAP[activePanel])));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export default PanelManager;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DEFAULT_SCROLLABLE_CONTAINER_CONTEXT, SCROLLABLE_CONTEXT_TYPE, } from './ScrollableContainer';
|
|
3
|
-
/**
|
|
4
|
-
* Component to be used as a child of `ScrollableContainer`.
|
|
5
|
-
* Wraps the focusable item and registers it in the context
|
|
6
|
-
*/
|
|
7
|
-
class FocusableItem extends React.Component {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
Object.defineProperty(this, "ref", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: null
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "context", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: DEFAULT_SCROLLABLE_CONTAINER_CONTEXT
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
componentDidMount() {
|
|
24
|
-
if (this.ref && this.context.setRef) {
|
|
25
|
-
this.context.setRef(this.ref);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
render() {
|
|
29
|
-
return (React.createElement("div", { className: "focusable-item", ref: (e) => (this.ref = e) }, this.props.children));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
Object.defineProperty(FocusableItem, "contextTypes", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: SCROLLABLE_CONTEXT_TYPE
|
|
37
|
-
});
|
|
38
|
-
export default FocusableItem;
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './ScrollableContainer.styles.css';
|
|
3
|
-
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
|
-
/**
|
|
5
|
-
* ScrollableContainer component provides a context for focusable items
|
|
6
|
-
* that allows them to register themselves and handle scrolling
|
|
7
|
-
* when they become focused.
|
|
8
|
-
* @example
|
|
9
|
-
* ```jsx
|
|
10
|
-
* <ScrollableContainer scrollableContainerRef={scrollableContainerRef}>
|
|
11
|
-
* <FocusableItem>Item 1</FocusableItem>
|
|
12
|
-
* <FocusableItem>Item 2</FocusableItem>
|
|
13
|
-
* <FocusableItem>Item 3</FocusableItem>
|
|
14
|
-
* </ScrollableContainer>
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
class ScrollableContainer extends React.Component {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
Object.defineProperty(this, "refsMap", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: []
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "hash", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: ''
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(this, "lastHash", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: ''
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(this, "state", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: {
|
|
43
|
-
scrolled: false,
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(this, "setRef", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
writable: true,
|
|
50
|
-
value: (ref) => {
|
|
51
|
-
this.refsMap.push(ref);
|
|
52
|
-
this.hash = Math.random().toString(36).substring(2, 15);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(this, "getOrderedRefs", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: () => {
|
|
60
|
-
if (this.hash === this.lastHash) {
|
|
61
|
-
return this.refsMap;
|
|
62
|
-
}
|
|
63
|
-
this.refsMap = this.refsMap.sort((a, b) => {
|
|
64
|
-
if (!this.props.scrollableContainerRef)
|
|
65
|
-
return 0;
|
|
66
|
-
const containerRect = this.props.scrollableContainerRef.getBoundingClientRect();
|
|
67
|
-
const aRect = a ? a.getBoundingClientRect() : { top: 0, bottom: 0 };
|
|
68
|
-
const bRect = b ? b.getBoundingClientRect() : { top: 0, bottom: 0 };
|
|
69
|
-
// Calculate the actual distance from container top (positive means below, negative means above)
|
|
70
|
-
const aDistance = aRect.top - containerRect.top;
|
|
71
|
-
const bDistance = bRect.top - containerRect.top;
|
|
72
|
-
return aDistance - bDistance;
|
|
73
|
-
});
|
|
74
|
-
this.lastHash = this.hash;
|
|
75
|
-
return this.refsMap;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
/**
|
|
79
|
-
* @description - Scrolls the container to the focused element if necessary
|
|
80
|
-
*/
|
|
81
|
-
Object.defineProperty(this, "scrollToFocusedElement", {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
configurable: true,
|
|
84
|
-
writable: true,
|
|
85
|
-
value: async (layout) => {
|
|
86
|
-
if (!this.props.scrollableContainerRef || !layout.node)
|
|
87
|
-
return;
|
|
88
|
-
const refs = this.getOrderedRefs();
|
|
89
|
-
// Wait for the next frame to ensure the layout is updated
|
|
90
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
91
|
-
await wait(0);
|
|
92
|
-
}
|
|
93
|
-
const containerRect = this.props.scrollableContainerRef.getBoundingClientRect();
|
|
94
|
-
const nodeRect = layout.node.getBoundingClientRect();
|
|
95
|
-
let index = -1;
|
|
96
|
-
for (let i = refs.length - 1; i >= 0; i--) {
|
|
97
|
-
if (refs[i].contains(layout.node)) {
|
|
98
|
-
index = i;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (index === -1) {
|
|
103
|
-
console.warn('Element not found in refsMap to focus to. Register the element wrapping it with <FocusableItem />');
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
let hasOutside = false;
|
|
107
|
-
refs.slice(index).forEach((el) => {
|
|
108
|
-
const rect = el.getBoundingClientRect();
|
|
109
|
-
if (rect.bottom > containerRect.bottom || rect.top < containerRect.top) {
|
|
110
|
-
hasOutside = true;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
if (!hasOutside)
|
|
114
|
-
return;
|
|
115
|
-
const target = index === 0
|
|
116
|
-
? 0
|
|
117
|
-
: this.props.scrollableContainerRef.scrollTop +
|
|
118
|
-
(nodeRect.top -
|
|
119
|
-
containerRect.top -
|
|
120
|
-
(this.props.containerTopOffset || 0));
|
|
121
|
-
this.props.scrollableContainerRef.scrollTop = target;
|
|
122
|
-
const newScrolled = target > 0;
|
|
123
|
-
if (this.state.scrolled !== newScrolled) {
|
|
124
|
-
this.setState({ scrolled: newScrolled });
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
getChildContext() {
|
|
130
|
-
return {
|
|
131
|
-
refsMap: this.refsMap,
|
|
132
|
-
setRef: this.setRef,
|
|
133
|
-
scrollToFocusedElement: this.scrollToFocusedElement,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
componentWillUnmount() {
|
|
137
|
-
this.refsMap = [];
|
|
138
|
-
this.hash = '';
|
|
139
|
-
this.lastHash = '';
|
|
140
|
-
}
|
|
141
|
-
render() {
|
|
142
|
-
const { scrollableContainerRef: _, containerTopOffset: __, ...rest } = this.props;
|
|
143
|
-
return (React.createElement("div", { className: "scrollable-container", "data-scrolled": this.state.scrolled, ...rest }, this.props.children));
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
Object.defineProperty(ScrollableContainer, "childContextTypes", {
|
|
147
|
-
enumerable: true,
|
|
148
|
-
configurable: true,
|
|
149
|
-
writable: true,
|
|
150
|
-
value: {
|
|
151
|
-
refsMap: React.PropTypes.arrayOf(React.PropTypes.instanceOf(HTMLElement)),
|
|
152
|
-
setRef: React.PropTypes.func,
|
|
153
|
-
scrollToFocusedElement: React.PropTypes.func,
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
export const DEFAULT_SCROLLABLE_CONTAINER_CONTEXT = {
|
|
157
|
-
setRef: (_) => { },
|
|
158
|
-
scrollToFocusedElement: () => { },
|
|
159
|
-
refsMap: [],
|
|
160
|
-
};
|
|
161
|
-
export const SCROLLABLE_CONTEXT_TYPE = {
|
|
162
|
-
refsMap: React.PropTypes.arrayOf(React.PropTypes.instanceOf(HTMLElement)),
|
|
163
|
-
setRef: React.PropTypes.func,
|
|
164
|
-
scrollToFocusedElement: React.PropTypes.func,
|
|
165
|
-
};
|
|
166
|
-
export default ScrollableContainer;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import BaseButton from '@/components/atoms/BaseButton';
|
|
2
|
-
import './ActionButton.styles.css';
|
|
3
|
-
import { withFocusable, } from '@/external/spatial-navigation';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
class ActionButton extends React.Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (React.createElement(BaseButton, { className: "action-button T05_ALT", ...this.props }, this.props.children));
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export default withFocusable()(ActionButton);
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// import { Rive as RiveCanvas } from '@rive-app/canvas';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { OverlayType } from '@/types/OverlayTypes';
|
|
4
|
-
import Rive from '../../atoms/Rive';
|
|
5
|
-
export const WINNING_BET_RIVE_FILE_URL = 'https://static.gcp.maestro.io/media/664b9c57d59a7a431542d814/67db106027ddcdcd2ecb97d4.riv';
|
|
6
|
-
const AUTO_DISMISS_TIMEOUT = 10400;
|
|
7
|
-
class Overlay extends React.Component {
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props);
|
|
10
|
-
Object.defineProperty(this, "autoDismissTimeout", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: null
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "handleOverlayAction", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: () => {
|
|
21
|
-
const { overlayType, onOverlayAction } = this.props;
|
|
22
|
-
this.setState({ autoDismiss: false });
|
|
23
|
-
switch (overlayType) {
|
|
24
|
-
case OverlayType.WinningBet:
|
|
25
|
-
break;
|
|
26
|
-
case OverlayType.FantasyPlayerEvent:
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
// Call custom action handler if provided
|
|
30
|
-
if (onOverlayAction) {
|
|
31
|
-
onOverlayAction(overlayType);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "trackOverlayViewed", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: () => {
|
|
40
|
-
if (this.state.hasTrackedView)
|
|
41
|
-
return;
|
|
42
|
-
this.setState({ hasTrackedView: true });
|
|
43
|
-
if (this.props.onOverlayViewed) {
|
|
44
|
-
this.props.onOverlayViewed(this.props.overlayType);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(this, "onLoadRiveInstance", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true,
|
|
52
|
-
value: (riveInstance) => {
|
|
53
|
-
if (!riveInstance)
|
|
54
|
-
return;
|
|
55
|
-
// Ensure the drawing surface matches the canvas size and device pixel ratio
|
|
56
|
-
riveInstance.resizeDrawingSurfaceToCanvas();
|
|
57
|
-
// Set text values after the file is loaded
|
|
58
|
-
try {
|
|
59
|
-
riveInstance.setTextRunValueAtPath('Title', this.overlayTitle, 'compNotification');
|
|
60
|
-
riveInstance.setTextRunValueAtPath('Metadata', this.overlayMetadata, 'compNotification');
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error('Error setting text values:', error);
|
|
64
|
-
}
|
|
65
|
-
// Get state machine inputs and trigger the play input specifically
|
|
66
|
-
try {
|
|
67
|
-
const inputs = riveInstance.stateMachineInputs('stateMachine');
|
|
68
|
-
const triggerPlayInput = inputs.find((input) => input.name === 'triggerPlay');
|
|
69
|
-
if (triggerPlayInput) {
|
|
70
|
-
triggerPlayInput.fire();
|
|
71
|
-
}
|
|
72
|
-
else if (inputs.length > 0) {
|
|
73
|
-
inputs[0].fire();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
console.error('Error with state machine inputs:', error);
|
|
78
|
-
}
|
|
79
|
-
this.trackOverlayViewed();
|
|
80
|
-
this.autoDismissTimeout = setTimeout(() => {
|
|
81
|
-
if (this.state.autoDismiss) {
|
|
82
|
-
this.handleOverlayAction();
|
|
83
|
-
}
|
|
84
|
-
}, AUTO_DISMISS_TIMEOUT);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
this.state = {
|
|
88
|
-
autoDismiss: true,
|
|
89
|
-
hasTrackedView: false,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
componentWillUnmount() {
|
|
93
|
-
if (this.autoDismissTimeout) {
|
|
94
|
-
clearTimeout(this.autoDismissTimeout);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
get overlayTitle() {
|
|
98
|
-
const { overlayType, fantasy } = this.props;
|
|
99
|
-
switch (overlayType) {
|
|
100
|
-
case OverlayType.WinningBet:
|
|
101
|
-
return 'You won your bet!';
|
|
102
|
-
case OverlayType.FantasyPlayerEvent:
|
|
103
|
-
return fantasy?.title ?? 'Fantasy Update';
|
|
104
|
-
default:
|
|
105
|
-
return '';
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
get overlayMetadata() {
|
|
109
|
-
const { overlayType, winningBet, fantasy } = this.props;
|
|
110
|
-
switch (overlayType) {
|
|
111
|
-
case OverlayType.WinningBet:
|
|
112
|
-
return (winningBet?.notificationText ?? 'Click OK to view your winning bets.');
|
|
113
|
-
case OverlayType.FantasyPlayerEvent:
|
|
114
|
-
return fantasy?.metadata ?? 'New Player Activity';
|
|
115
|
-
default:
|
|
116
|
-
return '';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
render() {
|
|
120
|
-
const style = {
|
|
121
|
-
position: 'fixed',
|
|
122
|
-
zIndex: 999999,
|
|
123
|
-
left: this.props.position?.left !== undefined
|
|
124
|
-
? `${this.props.position.left}px`
|
|
125
|
-
: undefined,
|
|
126
|
-
right: this.props.position?.right !== undefined
|
|
127
|
-
? `${this.props.position.right}px`
|
|
128
|
-
: undefined,
|
|
129
|
-
top: this.props.position?.top !== undefined
|
|
130
|
-
? `${this.props.position.top}px`
|
|
131
|
-
: undefined,
|
|
132
|
-
bottom: this.props.position?.bottom !== undefined
|
|
133
|
-
? `${this.props.position.bottom}px`
|
|
134
|
-
: undefined,
|
|
135
|
-
};
|
|
136
|
-
return (React.createElement(Rive, { id: this.props.id, onEnterPress: this.handleOverlayAction, focusKey: "maestro-overlay", autoFocus: true, autoPlay: true, onLoadRiveInstance: this.onLoadRiveInstance, src: WINNING_BET_RIVE_FILE_URL, style: style }));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
export default Overlay;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import BaseButton from '@/components/atoms/BaseButton/BaseButton';
|
|
2
|
-
import Icon from '@/components/atoms/SvgIcon/Icon';
|
|
3
|
-
import './PanelNavButton.styles.css';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { withFocusable } from '@/external/spatial-navigation';
|
|
7
|
-
class PanelNavButton extends React.Component {
|
|
8
|
-
render() {
|
|
9
|
-
const { iconName, active, children, focused } = this.props;
|
|
10
|
-
return (React.createElement("div", { className: [
|
|
11
|
-
'panel-nav-button-container',
|
|
12
|
-
'T02',
|
|
13
|
-
active ? 'panel-nav-button-active' : '',
|
|
14
|
-
].join(' '), "data-focused": focused },
|
|
15
|
-
React.createElement(BaseButton, null,
|
|
16
|
-
React.createElement(Icon, { iconName: iconName, height: 36, width: 36 })),
|
|
17
|
-
children));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
Object.defineProperty(PanelNavButton, "displayName", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: 'PanelNavButton'
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(PanelNavButton, "propTypes", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: {
|
|
31
|
-
iconName: PropTypes.string.isRequired,
|
|
32
|
-
index: PropTypes.number.isRequired,
|
|
33
|
-
active: PropTypes.bool.isRequired,
|
|
34
|
-
children: PropTypes.node,
|
|
35
|
-
focused: PropTypes.bool,
|
|
36
|
-
onBecameFocused: PropTypes.func,
|
|
37
|
-
buttonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
export default withFocusable()(PanelNavButton);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import BaseButton from '@/components/atoms/BaseButton/BaseButton';
|
|
2
|
-
import './SegmentButton.styles.css';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { withFocusable, } from '@/external/spatial-navigation';
|
|
5
|
-
class SegmentButton extends React.Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (React.createElement(BaseButton, { className: "segment-button T05_ALT", "data-focused": this.props.focused, "data-active": this.props.active }, this.props.children));
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export default withFocusable()(SegmentButton);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import BaseButton from '@/components/atoms/BaseButton/BaseButton';
|
|
2
|
-
import Icon from '@/components/atoms/SvgIcon';
|
|
3
|
-
import './WatchButton.styles.css';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
class WatchButton extends React.Component {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super(props);
|
|
8
|
-
}
|
|
9
|
-
render() {
|
|
10
|
-
return (React.createElement(BaseButton, { className: "watch-button T05_ALT", ...this.props },
|
|
11
|
-
React.createElement(Icon, { iconName: "play", height: 20, width: 19 }),
|
|
12
|
-
this.props.children));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export default WatchButton;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import PanelNavButton from '@/components/molecules/PanelNavButton';
|
|
2
|
-
import './PanelNavigation.styles.css';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import SDK from '@/index';
|
|
5
|
-
class PanelNavigationButton extends React.Component {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
Object.defineProperty(this, "handleArrowPress", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value: (d, _props) => {
|
|
13
|
-
if (d === 'left' && this.props.itemFocused === 0) {
|
|
14
|
-
SDK.getMaestroEventViewModel().deliverFocus();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (this.props.onArrowPress) {
|
|
18
|
-
this.props.onArrowPress(d);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
const { item, index } = this.props;
|
|
25
|
-
return (React.createElement(PanelNavButton, { iconName: item.iconName, key: item.title, index: index, onBecameFocused: this.props.onBecameFocused(index), active: item.active, focusKey: `PANEL_NAV_BUTTON_${index}`, onArrowPress: this.handleArrowPress }, item.title));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
class PanelNavigation extends React.Component {
|
|
29
|
-
constructor() {
|
|
30
|
-
super(...arguments);
|
|
31
|
-
Object.defineProperty(this, "state", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: true,
|
|
34
|
-
writable: true,
|
|
35
|
-
value: {
|
|
36
|
-
itemFocused: null,
|
|
37
|
-
lastFocused: null,
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(this, "handleBecameFocused", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true,
|
|
44
|
-
value: (index) => () => {
|
|
45
|
-
if (this.state.lastFocused !== index && this.state.lastFocused) {
|
|
46
|
-
SDK.getMaestroEventViewModel().navigation.setFocus(`PANEL_NAV_BUTTON_${this.state.lastFocused}`);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this.setState({ itemFocused: index, lastFocused: null }, () => {
|
|
50
|
-
if (this.props.items[index]) {
|
|
51
|
-
this.props.items[index].onEnter();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(this, "handleArrowPress", {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
configurable: true,
|
|
59
|
-
writable: true,
|
|
60
|
-
value: (direction) => {
|
|
61
|
-
if (direction === 'down') {
|
|
62
|
-
this.setState({ lastFocused: this.state.itemFocused });
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
render() {
|
|
68
|
-
return (React.createElement("div", { className: "panel-navigation" }, this.props.items.map((item, index) => (React.createElement(PanelNavigationButton, { itemFocused: this.state.itemFocused, onBecameFocused: this.handleBecameFocused, onArrowPress: this.handleArrowPress, key: item.title, item: item, index: index })))));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export default PanelNavigation;
|