@maestro_io/maestro-web-sdk 2.1.2 → 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/Rive/index.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/components/molecules/ActionButton/ActionButton.d.ts +1 -0
- package/dist/components/molecules/PanelNavButton/PanelNavButton.d.ts +1 -0
- package/dist/components/organisms/SegmentController/SegmentController.d.ts +2 -2
- package/dist/external/spatial-navigation/index.d.ts +2 -3
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +3 -5
- package/dist/external/spatial-navigation/withFocusable.d.ts +1 -0
- 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/bets/view/HotProps/HotPropsView.d.ts +7 -6
- package/dist/modules/bets/view/SixPack/SixPackView.d.ts +2 -2
- package/dist/modules/bets/view/TabLoadFailureView.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +7 -6
- package/dist/modules/bets/view/components/Bet/Bet.d.ts +1 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +2 -2
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +0 -4
- package/dist/modules/stats/interfaces/IStats.d.ts +44 -15
- package/dist/modules/stats/utils/driveSummaryUtils.d.ts +18 -0
- package/dist/modules/stats/utils/renderTeamStatistic.d.ts +21 -0
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +21 -0
- package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +5 -0
- package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +10 -0
- package/dist/modules/stats/view/ActiveAthletes/index.d.ts +2 -0
- 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 -25
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +13 -47
- package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +11 -21
- package/dist/modules/stats/view/StatsItemView.d.ts +19 -0
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.d.ts +1 -0
- package/dist/modules/stats/view/StatsView.d.ts +3 -3
- package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +52 -0
- package/dist/modules/stats/view/TeamStats/index.d.ts +2 -0
- package/dist/modules/stats/view/Teams/Teams.d.ts +11 -26
- package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +11 -21
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +19 -3
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +2 -8
- package/dist/modules/stats/view/index.d.ts +1 -0
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +149 -5
- package/dist/services/StatsService.d.ts +36 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +7 -0
- 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 -52
- 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 -72
- package/dist/components/organisms/PanelNavigation/index.js +0 -2
- package/dist/components/organisms/SegmentController/SegmentController.js +0 -69
- 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 -4
- package/dist/external/spatial-navigation/measureLayout.js +0 -30
- package/dist/external/spatial-navigation/spatialNavigation.js +0 -875
- 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 -238
- 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 -142
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +0 -58
- package/dist/modules/key-plays/view/KeyPlaysView.js +0 -167
- 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 -546
- package/dist/modules/stats/utils.js +0 -62
- 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 -87
- package/dist/modules/stats/view/Teams/StatsCarousel.js +0 -14
- package/dist/modules/stats/view/Teams/StatsProgressBar.js +0 -14
- package/dist/modules/stats/view/Teams/Teams.js +0 -35
- 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 -28
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +0 -11
- package/dist/modules/stats/view/components/AthletesStatistics/index.js +0 -2
- package/dist/modules/stats/view/index.js +0 -1
- 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/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 -156
- 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,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,72 +0,0 @@
|
|
|
1
|
-
import PanelNavButton from '@/components/molecules/PanelNavButton';
|
|
2
|
-
import './PanelNavigation.styles.css';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import deliverFocus from '@/helpers/deliver-focus';
|
|
5
|
-
import { setFocus } from '@/external/spatial-navigation';
|
|
6
|
-
class PanelNavigationButton extends React.Component {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
Object.defineProperty(this, "handleArrowPress", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: (d, _props, details) => {
|
|
14
|
-
if (d === 'left' && this.props.itemFocused === 0 && details.layout) {
|
|
15
|
-
deliverFocus(details.layout.node);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (this.props.onArrowPress) {
|
|
19
|
-
this.props.onArrowPress(d);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
const { item, index } = this.props;
|
|
26
|
-
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));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
class PanelNavigation extends React.Component {
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
Object.defineProperty(this, "state", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: {
|
|
37
|
-
itemFocused: null,
|
|
38
|
-
lastFocused: null,
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(this, "handleBecameFocused", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: (index) => () => {
|
|
46
|
-
if (this.state.lastFocused !== index && this.state.lastFocused) {
|
|
47
|
-
setFocus(`PANEL_NAV_BUTTON_${this.state.lastFocused}`);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
this.setState({ itemFocused: index, lastFocused: null }, () => {
|
|
51
|
-
if (this.props.items[index]) {
|
|
52
|
-
this.props.items[index].onEnter();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
Object.defineProperty(this, "handleArrowPress", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
configurable: true,
|
|
60
|
-
writable: true,
|
|
61
|
-
value: (direction) => {
|
|
62
|
-
if (direction === 'down') {
|
|
63
|
-
this.setState({ lastFocused: this.state.itemFocused });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
render() {
|
|
69
|
-
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 })))));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export default PanelNavigation;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import SegmentButton from '@/components/molecules/SegmentButton';
|
|
3
|
-
import './SegmentController.styles.css';
|
|
4
|
-
import { DEFAULT_SCROLLABLE_CONTAINER_CONTEXT, SCROLLABLE_CONTEXT_TYPE, } from '@/components/core/ScrollableContainer/ScrollableContainer';
|
|
5
|
-
import { setFocus } from '@/external/spatial-navigation';
|
|
6
|
-
import deliverFocus from '@/helpers/deliver-focus';
|
|
7
|
-
class SegmentController extends React.Component {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
Object.defineProperty(this, "context", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: DEFAULT_SCROLLABLE_CONTAINER_CONTEXT
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "state", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: {
|
|
21
|
-
activeIndex: 0,
|
|
22
|
-
lastActiveIndex: 0,
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(this, "onBecameFocused", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: (item, i) => (layout) => {
|
|
30
|
-
if (this.state.lastActiveIndex !== i &&
|
|
31
|
-
this.state.lastActiveIndex !== null) {
|
|
32
|
-
setFocus(`segment-controller-${this.state.lastActiveIndex}`);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this.setState({
|
|
36
|
-
activeIndex: i,
|
|
37
|
-
lastActiveIndex: null,
|
|
38
|
-
});
|
|
39
|
-
item.onEnter();
|
|
40
|
-
this.context.scrollToFocusedElement(layout);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(this, "handleArrowPress", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
configurable: true,
|
|
46
|
-
writable: true,
|
|
47
|
-
value: (index) => (direction, _props, details) => {
|
|
48
|
-
if (direction === 'down' || direction === 'up') {
|
|
49
|
-
this.setState({ lastActiveIndex: this.state.activeIndex });
|
|
50
|
-
}
|
|
51
|
-
if (direction === 'left' && index === 0 && details.layout) {
|
|
52
|
-
deliverFocus(details.layout.node.firstElementChild);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
return (React.createElement("div", { className: "segment-controller", style: {
|
|
59
|
-
backgroundColor: this.props.backgroundColor,
|
|
60
|
-
} }, this.props.items.map((item, index) => (React.createElement(SegmentButton, { focusKey: `segment-controller-${index}`, key: item.title, onBecameFocused: this.onBecameFocused(item, index), onArrowPress: this.handleArrowPress(index), active: this.state.activeIndex === index }, item.title)))));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
Object.defineProperty(SegmentController, "contextTypes", {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
configurable: true,
|
|
66
|
-
writable: true,
|
|
67
|
-
value: SCROLLABLE_CONTEXT_TYPE
|
|
68
|
-
});
|
|
69
|
-
export default SegmentController;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
const REQUEST_TIMEOUT = 5000;
|
|
3
|
-
class AxiosNetworkClient {
|
|
4
|
-
constructor({ baseURL, retries, delay, backoff, axiosInstance, }) {
|
|
5
|
-
Object.defineProperty(this, "client", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: void 0
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(this, "retries", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: void 0
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(this, "delay", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(this, "backoff", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true,
|
|
27
|
-
value: void 0
|
|
28
|
-
});
|
|
29
|
-
this.retries = retries;
|
|
30
|
-
this.delay = delay;
|
|
31
|
-
this.backoff = backoff;
|
|
32
|
-
this.client =
|
|
33
|
-
axiosInstance ||
|
|
34
|
-
axios.create({
|
|
35
|
-
baseURL,
|
|
36
|
-
headers: {
|
|
37
|
-
'Content-Type': 'application/json',
|
|
38
|
-
},
|
|
39
|
-
timeout: REQUEST_TIMEOUT,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async retry(operation, attempt = 0) {
|
|
43
|
-
try {
|
|
44
|
-
return await operation();
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
const axiosError = error;
|
|
48
|
-
// Check if we should retry
|
|
49
|
-
const shouldRetry = attempt < this.retries &&
|
|
50
|
-
((axiosError.response && axiosError.response.status === 429) ||
|
|
51
|
-
axiosError.code === 'ECONNABORTED');
|
|
52
|
-
if (shouldRetry) {
|
|
53
|
-
const delayTime = this.delay * Math.pow(this.backoff, attempt);
|
|
54
|
-
console.log(`Retrying request in ${delayTime}ms due to: ${axiosError.message}`);
|
|
55
|
-
await new Promise((resolve) => setTimeout(resolve, delayTime));
|
|
56
|
-
return this.retry(operation, attempt + 1);
|
|
57
|
-
}
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async get(endpoint, params, headers) {
|
|
62
|
-
return this.retry(async () => {
|
|
63
|
-
const response = await this.client.get(endpoint, {
|
|
64
|
-
params,
|
|
65
|
-
headers,
|
|
66
|
-
});
|
|
67
|
-
return response.data;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
async post(endpoint, data) {
|
|
71
|
-
return this.retry(async () => {
|
|
72
|
-
const response = await this.client.post(endpoint, data);
|
|
73
|
-
return response.data;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
setAuthentication(token, apiKey) {
|
|
77
|
-
this.client.defaults.headers.common['Authorization'] = token
|
|
78
|
-
? `Bearer ${token}`
|
|
79
|
-
: '';
|
|
80
|
-
this.client.defaults.headers.common['x-maestro-api-key'] = apiKey || '';
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
export default AxiosNetworkClient;
|