@maestro_io/maestro-web-sdk 2.1.3 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/MaestroEventDelegate.d.ts +1 -0
  2. package/dist/components/atoms/SvgIcon/Icon.d.ts +0 -2
  3. package/dist/components/core/PanelManager/PanelManager.d.ts +3 -0
  4. package/dist/components/core/ScrollableContainer/ScrollableContainer.d.ts +3 -1
  5. package/dist/external/spatial-navigation/spatialNavigation.d.ts +1 -1
  6. package/dist/helpers/url.d.ts +1 -0
  7. package/dist/index.d.ts +3 -1
  8. package/dist/interfaces/IMaestroEvent.d.ts +27 -0
  9. package/dist/interfaces/IMaestroEventDelegate.d.ts +19 -6
  10. package/dist/interfaces/IMaestroManager.d.ts +8 -1
  11. package/dist/interfaces/IUserSettings.d.ts +36 -0
  12. package/dist/maestro-web-sdk.umd.js +3 -3
  13. package/dist/maestro-web-sdk.umd.js.map +1 -1
  14. package/dist/models/IPanel.d.ts +1 -2
  15. package/dist/modules/bets/view/BetsView.d.ts +4 -0
  16. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +1 -0
  17. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +1 -0
  18. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +2 -1
  19. package/dist/modules/bets/view/UserBets/Boost/Boost.d.ts +2 -1
  20. package/dist/modules/bets/view/UserBets/Parlay/Parlay.d.ts +2 -1
  21. package/dist/modules/bets/view/UserBets/Straight/Straight.d.ts +2 -1
  22. package/dist/modules/bets/view/UserBets/Teaser/Teaser.d.ts +2 -1
  23. package/dist/modules/bets/view/components/Bet/Bet.d.ts +7 -0
  24. package/dist/modules/bets/view-model/BetsViewModel.d.ts +15 -0
  25. package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +1 -0
  26. package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.d.ts +6 -6
  27. package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +4 -1
  28. package/dist/modules/key-plays/view/KeyPlayErrorStateView.d.ts +2 -0
  29. package/dist/modules/key-plays/view-model/KeyPlaysViewModel.d.ts +5 -1
  30. package/dist/modules/stats/interfaces/IStats.d.ts +38 -12
  31. package/dist/modules/stats/mocks.d.ts +0 -80
  32. package/dist/modules/stats/utils/driveSummaryUtils.d.ts +18 -0
  33. package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +6 -19
  34. package/dist/modules/stats/view/DriveSummary/DrivePlayCard.d.ts +26 -0
  35. package/dist/modules/stats/view/DriveSummary/DriveSummary.d.ts +24 -0
  36. package/dist/modules/stats/view/DriveSummary/index.d.ts +2 -0
  37. package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +15 -4
  38. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +13 -48
  39. package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +10 -21
  40. package/dist/modules/stats/view/StatsItemView.d.ts +19 -0
  41. package/dist/modules/stats/view/StatsView.d.ts +3 -3
  42. package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +2 -4
  43. package/dist/modules/stats/view/Teams/Teams.d.ts +10 -26
  44. package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +10 -21
  45. package/dist/modules/stats/view-model/StatsViewModel.d.ts +149 -5
  46. package/dist/services/BetsService.d.ts +2 -2
  47. package/dist/services/NetworkManager/NetworkManager.d.ts +1 -3
  48. package/dist/services/NetworkManager/NetworkManagerFactory.d.ts +42 -0
  49. package/dist/services/NetworkManager/types.d.ts +77 -0
  50. package/dist/services/StatsService.d.ts +2 -2
  51. package/dist/services/UserSettingsManager.d.ts +63 -0
  52. package/dist/view-models/MaestroEventViewModel.d.ts +5 -0
  53. package/dist/view-models/PanelManagerViewModel.d.ts +24 -0
  54. package/dist/view-models/index.d.ts +4 -0
  55. package/package.json +1 -1
  56. package/dist/MaestroEventDelegate.js +0 -60
  57. package/dist/components/atoms/BaseButton/BaseButton.js +0 -11
  58. package/dist/components/atoms/BaseButton/index.js +0 -2
  59. package/dist/components/atoms/Image/index.js +0 -30
  60. package/dist/components/atoms/Rive/index.js +0 -53
  61. package/dist/components/atoms/SvgIcon/BetGeneralIcon.js +0 -9
  62. package/dist/components/atoms/SvgIcon/BetsIcon.js +0 -11
  63. package/dist/components/atoms/SvgIcon/BetsWarningIcon.js +0 -11
  64. package/dist/components/atoms/SvgIcon/CheckmarkIcon.js +0 -6
  65. package/dist/components/atoms/SvgIcon/CollapseIcon.js +0 -6
  66. package/dist/components/atoms/SvgIcon/ExpandIcon.js +0 -6
  67. package/dist/components/atoms/SvgIcon/FantasyIcon.d.ts +0 -6
  68. package/dist/components/atoms/SvgIcon/FantasyIcon.js +0 -8
  69. package/dist/components/atoms/SvgIcon/FlameIcon.js +0 -11
  70. package/dist/components/atoms/SvgIcon/Icon.js +0 -42
  71. package/dist/components/atoms/SvgIcon/KeyPlaysIcon.js +0 -10
  72. package/dist/components/atoms/SvgIcon/MobilePhoneIcon.js +0 -11
  73. package/dist/components/atoms/SvgIcon/PlayIcon.js +0 -8
  74. package/dist/components/atoms/SvgIcon/StatsIcon.js +0 -12
  75. package/dist/components/atoms/SvgIcon/TimesIcon.js +0 -6
  76. package/dist/components/atoms/SvgIcon/WarningIcon.js +0 -8
  77. package/dist/components/atoms/SvgIcon/index.js +0 -2
  78. package/dist/components/core/App/App.js +0 -41
  79. package/dist/components/core/App/index.js +0 -2
  80. package/dist/components/core/OverlayContainer.js +0 -58
  81. package/dist/components/core/PanelManager/PanelManager.js +0 -80
  82. package/dist/components/core/PanelManager/index.js +0 -2
  83. package/dist/components/core/ScrollableContainer/FocusableItem.js +0 -38
  84. package/dist/components/core/ScrollableContainer/ScrollableContainer.js +0 -166
  85. package/dist/components/core/ScrollableContainer/index.js +0 -2
  86. package/dist/components/molecules/ActionButton/ActionButton.js +0 -10
  87. package/dist/components/molecules/ActionButton/index.js +0 -2
  88. package/dist/components/molecules/Overlay/Overlay.js +0 -139
  89. package/dist/components/molecules/Overlay/index.js +0 -2
  90. package/dist/components/molecules/PanelNavButton/PanelNavButton.js +0 -40
  91. package/dist/components/molecules/PanelNavButton/index.js +0 -2
  92. package/dist/components/molecules/SegmentButton/SegmentButton.js +0 -10
  93. package/dist/components/molecules/SegmentButton/index.js +0 -2
  94. package/dist/components/molecules/WatchButton/WatchButton.js +0 -15
  95. package/dist/components/molecules/WatchButton/index.js +0 -2
  96. package/dist/components/organisms/PanelNavigation/PanelNavigation.js +0 -71
  97. package/dist/components/organisms/PanelNavigation/index.js +0 -2
  98. package/dist/components/organisms/SegmentController/SegmentController.js +0 -68
  99. package/dist/components/organisms/SegmentController/index.js +0 -2
  100. package/dist/external/AxiosNetworkClient.js +0 -83
  101. package/dist/external/LocalStorageCacheManager.js +0 -213
  102. package/dist/external/ReactRenderer.js +0 -86
  103. package/dist/external/mocks/MockExternalNetworkClient.js +0 -161
  104. package/dist/external/ports/cacheManager.js +0 -1
  105. package/dist/external/ports/networkClient.js +0 -1
  106. package/dist/external/ports/renderer.js +0 -1
  107. package/dist/external/spatial-navigation/index.js +0 -3
  108. package/dist/external/spatial-navigation/measureLayout.js +0 -30
  109. package/dist/external/spatial-navigation/spatialNavigation.js +0 -864
  110. package/dist/external/spatial-navigation/utils.js +0 -6
  111. package/dist/external/spatial-navigation/visualDebugger.js +0 -76
  112. package/dist/external/spatial-navigation/withFocusable.js +0 -245
  113. package/dist/helpers/Observable.js +0 -37
  114. package/dist/helpers/deliver-focus.d.ts +0 -5
  115. package/dist/helpers/deliver-focus.js +0 -12
  116. package/dist/index.js +0 -192
  117. package/dist/interfaces/IMaestroEvent.js +0 -6
  118. package/dist/interfaces/IMaestroEventDelegate.js +0 -1
  119. package/dist/interfaces/IMaestroManager.js +0 -1
  120. package/dist/models/IModel.js +0 -1
  121. package/dist/models/IPanel.js +0 -53
  122. package/dist/models/ITheme.js +0 -20
  123. package/dist/models/IWinningBet.js +0 -1
  124. package/dist/modules/bets/interfaces/IBets.js +0 -1
  125. package/dist/modules/bets/mocks.js +0 -572
  126. package/dist/modules/bets/view/BetsView.js +0 -116
  127. package/dist/modules/bets/view/HotProps/HotPropsView.js +0 -139
  128. package/dist/modules/bets/view/SixPack/SixPackView.js +0 -103
  129. package/dist/modules/bets/view/TabLoadFailureView.js +0 -12
  130. package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +0 -6
  131. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +0 -122
  132. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +0 -34
  133. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +0 -22
  134. package/dist/modules/bets/view/UserBets/Boost/Boost.js +0 -6
  135. package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +0 -9
  136. package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +0 -13
  137. package/dist/modules/bets/view/UserBets/Straight/Straight.js +0 -6
  138. package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +0 -13
  139. package/dist/modules/bets/view/UserBets/UserBetsView.js +0 -114
  140. package/dist/modules/bets/view/components/Bet/Bet.js +0 -32
  141. package/dist/modules/bets/view/components/BetPill/BetPill.js +0 -6
  142. package/dist/modules/bets/view/components/BetsCard/BetsCard.js +0 -15
  143. package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +0 -20
  144. package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +0 -14
  145. package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +0 -16
  146. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +0 -63
  147. package/dist/modules/bets/view/components/PromoCodeBanner/index.js +0 -1
  148. package/dist/modules/bets/view-model/BetsViewModel.js +0 -767
  149. package/dist/modules/key-plays/constants.js +0 -292
  150. package/dist/modules/key-plays/interfaces/IKeyPlays.js +0 -14
  151. package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +0 -1
  152. package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +0 -13
  153. package/dist/modules/key-plays/view/KeyPlayCardView.js +0 -120
  154. package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +0 -58
  155. package/dist/modules/key-plays/view/KeyPlaysView.js +0 -166
  156. package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +0 -182
  157. package/dist/modules/stats/interfaces/IStats.js +0 -1
  158. package/dist/modules/stats/mocks.js +0 -686
  159. package/dist/modules/stats/utils/renderTeamStatistic.js +0 -16
  160. package/dist/modules/stats/utils.js +0 -62
  161. package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.js +0 -78
  162. package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.js +0 -27
  163. package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.js +0 -15
  164. package/dist/modules/stats/view/ActiveAthletes/index.js +0 -2
  165. package/dist/modules/stats/view/GameLeaders/GameLeaders.js +0 -9
  166. package/dist/modules/stats/view/GameLeaders/index.js +0 -2
  167. package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +0 -55
  168. package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +0 -1
  169. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +0 -66
  170. package/dist/modules/stats/view/MatchPredictor/index.js +0 -2
  171. package/dist/modules/stats/view/RecentGames/RecentGames.js +0 -22
  172. package/dist/modules/stats/view/RecentGames/index.js +0 -2
  173. package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +0 -38
  174. package/dist/modules/stats/view/StatsQRCode/index.js +0 -1
  175. package/dist/modules/stats/view/StatsView.js +0 -107
  176. package/dist/modules/stats/view/TeamStats/TeamStatsView.js +0 -69
  177. package/dist/modules/stats/view/TeamStats/index.js +0 -1
  178. package/dist/modules/stats/view/Teams/StatsCarousel.js +0 -14
  179. package/dist/modules/stats/view/Teams/StatsProgressBar.js +0 -18
  180. package/dist/modules/stats/view/Teams/Teams.js +0 -42
  181. package/dist/modules/stats/view/Teams/index.js +0 -2
  182. package/dist/modules/stats/view/WinProbability/WinProbability.js +0 -27
  183. package/dist/modules/stats/view/WinProbability/index.js +0 -2
  184. package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +0 -29
  185. package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +0 -12
  186. package/dist/modules/stats/view/components/AthletesStatistics/index.js +0 -2
  187. package/dist/modules/stats/view/index.js +0 -2
  188. package/dist/modules/stats/view-model/StatsViewModel.js +0 -90
  189. package/dist/services/BetsService.js +0 -102
  190. package/dist/services/NetworkManager/NetworkManager.js +0 -410
  191. package/dist/services/NetworkManager/errors.js +0 -45
  192. package/dist/services/StatsService.js +0 -68
  193. package/dist/services/ThemeManager/constants.js +0 -47
  194. package/dist/test-polyfills.js +0 -15
  195. package/dist/types/OverlayTypes.js +0 -4
  196. package/dist/view-models/MaestroEventViewModel.js +0 -168
  197. package/dist/view-models/OverlayViewModel.js +0 -222
  198. package/dist/view-models/PanelManagerViewModel.js +0 -80
  199. package/dist/view-models/ViewModel.js +0 -32
  200. package/dist/view-models/index.js +0 -59
@@ -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,2 +0,0 @@
1
- import PanelManager from './PanelManager';
2
- 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,2 +0,0 @@
1
- import ScrollableContainer from './ScrollableContainer';
2
- 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,2 +0,0 @@
1
- import ActionButton from './ActionButton';
2
- export default 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,2 +0,0 @@
1
- import Overlay from './Overlay';
2
- 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,2 +0,0 @@
1
- import PanelNavButton from './PanelNavButton';
2
- export default 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,2 +0,0 @@
1
- import SegmentButton from './SegmentButton';
2
- export default 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,2 +0,0 @@
1
- import WatchButton from './WatchButton';
2
- 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;
@@ -1,2 +0,0 @@
1
- import PanelNavigation from './PanelNavigation';
2
- export default PanelNavigation;
@@ -1,68 +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 SDK from '@/index';
6
- class SegmentController extends React.Component {
7
- constructor() {
8
- super(...arguments);
9
- Object.defineProperty(this, "context", {
10
- enumerable: true,
11
- configurable: true,
12
- writable: true,
13
- value: DEFAULT_SCROLLABLE_CONTAINER_CONTEXT
14
- });
15
- Object.defineProperty(this, "state", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: {
20
- activeIndex: 0,
21
- lastActiveIndex: 0,
22
- }
23
- });
24
- Object.defineProperty(this, "onBecameFocused", {
25
- enumerable: true,
26
- configurable: true,
27
- writable: true,
28
- value: (item, i) => (layout) => {
29
- if (this.state.lastActiveIndex !== i &&
30
- this.state.lastActiveIndex !== null) {
31
- SDK.getMaestroEventViewModel().navigation.setFocus(`segment-controller-${this.state.lastActiveIndex}`);
32
- return;
33
- }
34
- this.setState({
35
- activeIndex: i,
36
- lastActiveIndex: null,
37
- });
38
- item.onEnter();
39
- this.context.scrollToFocusedElement(layout);
40
- }
41
- });
42
- Object.defineProperty(this, "handleArrowPress", {
43
- enumerable: true,
44
- configurable: true,
45
- writable: true,
46
- value: (index) => (direction, _props) => {
47
- if (direction === 'down' || direction === 'up') {
48
- this.setState({ lastActiveIndex: this.state.activeIndex });
49
- }
50
- if (direction === 'left' && index === 0) {
51
- SDK.getMaestroEventViewModel().deliverFocus();
52
- }
53
- }
54
- });
55
- }
56
- render() {
57
- return (React.createElement("div", { className: "segment-controller", style: {
58
- backgroundColor: this.props.backgroundColor,
59
- } }, 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)))));
60
- }
61
- }
62
- Object.defineProperty(SegmentController, "contextTypes", {
63
- enumerable: true,
64
- configurable: true,
65
- writable: true,
66
- value: SCROLLABLE_CONTEXT_TYPE
67
- });
68
- export default SegmentController;