@maestro_io/maestro-web-sdk 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/dist/MaestroEventDelegate.js +60 -0
  2. package/dist/components/atoms/BaseButton/BaseButton.js +11 -0
  3. package/dist/components/atoms/BaseButton/index.js +2 -0
  4. package/dist/components/atoms/Image/index.js +30 -0
  5. package/dist/components/atoms/Rive/index.d.ts +7 -8
  6. package/dist/components/atoms/Rive/index.js +52 -0
  7. package/dist/components/atoms/SvgIcon/BetGeneralIcon.js +9 -0
  8. package/dist/components/atoms/SvgIcon/BetsIcon.js +11 -0
  9. package/dist/components/atoms/SvgIcon/BetsWarningIcon.js +11 -0
  10. package/dist/components/atoms/SvgIcon/CheckmarkIcon.js +6 -0
  11. package/dist/components/atoms/SvgIcon/CollapseIcon.js +6 -0
  12. package/dist/components/atoms/SvgIcon/ExpandIcon.js +6 -0
  13. package/dist/components/atoms/SvgIcon/FantasyIcon.js +8 -0
  14. package/dist/components/atoms/SvgIcon/FlameIcon.js +11 -0
  15. package/dist/components/atoms/SvgIcon/Icon.js +42 -0
  16. package/dist/components/atoms/SvgIcon/KeyPlaysIcon.js +10 -0
  17. package/dist/components/atoms/SvgIcon/MobilePhoneIcon.js +11 -0
  18. package/dist/components/atoms/SvgIcon/PlayIcon.js +8 -0
  19. package/dist/components/atoms/SvgIcon/StatsIcon.js +12 -0
  20. package/dist/components/atoms/SvgIcon/TimesIcon.js +6 -0
  21. package/dist/components/atoms/SvgIcon/WarningIcon.js +8 -0
  22. package/dist/components/atoms/SvgIcon/index.js +2 -0
  23. package/dist/components/core/App/App.js +41 -0
  24. package/dist/components/core/App/index.js +2 -0
  25. package/dist/components/core/OverlayContainer.js +58 -0
  26. package/dist/components/core/PanelManager/PanelManager.js +80 -0
  27. package/dist/components/core/PanelManager/index.js +2 -0
  28. package/dist/components/core/ScrollableContainer/FocusableItem.js +38 -0
  29. package/dist/components/core/ScrollableContainer/ScrollableContainer.js +166 -0
  30. package/dist/components/core/ScrollableContainer/index.js +2 -0
  31. package/dist/components/molecules/ActionButton/ActionButton.js +10 -0
  32. package/dist/components/molecules/ActionButton/index.js +2 -0
  33. package/dist/components/molecules/Overlay/Overlay.d.ts +1 -2
  34. package/dist/components/molecules/Overlay/Overlay.js +139 -0
  35. package/dist/components/molecules/Overlay/index.js +2 -0
  36. package/dist/components/molecules/PanelNavButton/PanelNavButton.js +40 -0
  37. package/dist/components/molecules/PanelNavButton/index.js +2 -0
  38. package/dist/components/molecules/SegmentButton/SegmentButton.js +10 -0
  39. package/dist/components/molecules/SegmentButton/index.js +2 -0
  40. package/dist/components/molecules/WatchButton/WatchButton.js +15 -0
  41. package/dist/components/molecules/WatchButton/index.js +2 -0
  42. package/dist/components/organisms/PanelNavigation/PanelNavigation.js +72 -0
  43. package/dist/components/organisms/PanelNavigation/index.js +2 -0
  44. package/dist/components/organisms/SegmentController/SegmentController.js +69 -0
  45. package/dist/components/organisms/SegmentController/index.d.ts +1 -1
  46. package/dist/components/organisms/SegmentController/index.js +2 -0
  47. package/dist/external/AxiosNetworkClient.js +83 -0
  48. package/dist/external/LocalStorageCacheManager.js +213 -0
  49. package/dist/external/ReactRenderer.d.ts +2 -2
  50. package/dist/external/ReactRenderer.js +86 -0
  51. package/dist/external/mocks/MockExternalNetworkClient.js +161 -0
  52. package/dist/external/ports/cacheManager.js +1 -0
  53. package/dist/external/ports/networkClient.js +1 -0
  54. package/dist/external/ports/renderer.js +1 -0
  55. package/dist/external/spatial-navigation/index.d.ts +1 -1
  56. package/dist/external/spatial-navigation/index.js +4 -0
  57. package/dist/external/spatial-navigation/measureLayout.js +30 -0
  58. package/dist/external/spatial-navigation/spatialNavigation.js +875 -0
  59. package/dist/external/spatial-navigation/utils.js +6 -0
  60. package/dist/external/spatial-navigation/visualDebugger.js +76 -0
  61. package/dist/external/spatial-navigation/withFocusable.js +238 -0
  62. package/dist/helpers/Observable.js +37 -0
  63. package/dist/helpers/deliver-focus.js +12 -0
  64. package/dist/index.d.ts +4 -4
  65. package/dist/index.js +192 -0
  66. package/dist/interfaces/IMaestroEvent.js +6 -0
  67. package/dist/interfaces/IMaestroEventDelegate.js +1 -0
  68. package/dist/interfaces/IMaestroManager.js +1 -0
  69. package/dist/maestro-web-sdk.umd.js +3 -3
  70. package/dist/maestro-web-sdk.umd.js.map +1 -1
  71. package/dist/models/IModel.js +1 -0
  72. package/dist/models/IPanel.js +53 -0
  73. package/dist/models/ITheme.js +20 -0
  74. package/dist/models/IWinningBet.js +1 -0
  75. package/dist/modules/bets/interfaces/IBets.js +1 -0
  76. package/dist/modules/bets/mocks.js +572 -0
  77. package/dist/modules/bets/view/BetsView.js +116 -0
  78. package/dist/modules/bets/view/HotProps/HotPropsView.js +139 -0
  79. package/dist/modules/bets/view/SixPack/SixPackView.js +103 -0
  80. package/dist/modules/bets/view/TabLoadFailureView.js +12 -0
  81. package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +6 -0
  82. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +122 -0
  83. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +34 -0
  84. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +22 -0
  85. package/dist/modules/bets/view/UserBets/Boost/Boost.js +6 -0
  86. package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +9 -0
  87. package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +13 -0
  88. package/dist/modules/bets/view/UserBets/Straight/Straight.js +6 -0
  89. package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +13 -0
  90. package/dist/modules/bets/view/UserBets/UserBetsView.js +114 -0
  91. package/dist/modules/bets/view/components/Bet/Bet.js +32 -0
  92. package/dist/modules/bets/view/components/BetPill/BetPill.js +6 -0
  93. package/dist/modules/bets/view/components/BetsCard/BetsCard.js +15 -0
  94. package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +20 -0
  95. package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +14 -0
  96. package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +16 -0
  97. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +63 -0
  98. package/dist/modules/bets/view/components/PromoCodeBanner/index.d.ts +1 -1
  99. package/dist/modules/bets/view/components/PromoCodeBanner/index.js +1 -0
  100. package/dist/modules/bets/view-model/BetsViewModel.js +767 -0
  101. package/dist/modules/key-plays/constants.js +292 -0
  102. package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +4 -4
  103. package/dist/modules/key-plays/interfaces/IKeyPlays.js +14 -0
  104. package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +1 -0
  105. package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +13 -0
  106. package/dist/modules/key-plays/view/KeyPlayCardView.js +142 -0
  107. package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +58 -0
  108. package/dist/modules/key-plays/view/KeyPlaysView.js +167 -0
  109. package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +182 -0
  110. package/dist/modules/stats/interfaces/IStats.d.ts +163 -0
  111. package/dist/modules/stats/interfaces/IStats.js +1 -0
  112. package/dist/modules/stats/mocks.d.ts +2 -0
  113. package/dist/modules/stats/mocks.js +546 -0
  114. package/dist/modules/stats/utils.d.ts +39 -0
  115. package/dist/modules/stats/utils.js +62 -0
  116. package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +29 -0
  117. package/dist/modules/stats/view/GameLeaders/GameLeaders.js +9 -0
  118. package/dist/modules/stats/view/GameLeaders/index.d.ts +2 -0
  119. package/dist/modules/stats/view/GameLeaders/index.js +2 -0
  120. package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.d.ts +17 -0
  121. package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +55 -0
  122. package/dist/modules/stats/view/MatchPredictor/DonutChart/index.d.ts +2 -0
  123. package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +1 -0
  124. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +52 -0
  125. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +66 -0
  126. package/dist/modules/stats/view/MatchPredictor/index.d.ts +3 -0
  127. package/dist/modules/stats/view/MatchPredictor/index.js +2 -0
  128. package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +62 -0
  129. package/dist/modules/stats/view/RecentGames/RecentGames.js +22 -0
  130. package/dist/modules/stats/view/RecentGames/index.d.ts +2 -0
  131. package/dist/modules/stats/view/RecentGames/index.js +2 -0
  132. package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.d.ts +51 -0
  133. package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +38 -0
  134. package/dist/modules/stats/view/StatsQRCode/index.d.ts +2 -0
  135. package/dist/modules/stats/view/StatsQRCode/index.js +1 -0
  136. package/dist/modules/stats/view/StatsView.d.ts +20 -0
  137. package/dist/modules/stats/view/StatsView.js +87 -0
  138. package/dist/modules/stats/view/Teams/StatsCarousel.d.ts +8 -0
  139. package/dist/modules/stats/view/Teams/StatsCarousel.js +14 -0
  140. package/dist/modules/stats/view/Teams/StatsProgressBar.d.ts +7 -0
  141. package/dist/modules/stats/view/Teams/StatsProgressBar.js +14 -0
  142. package/dist/modules/stats/view/Teams/Teams.d.ts +67 -0
  143. package/dist/modules/stats/view/Teams/Teams.js +35 -0
  144. package/dist/modules/stats/view/Teams/index.d.ts +2 -0
  145. package/dist/modules/stats/view/Teams/index.js +2 -0
  146. package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +62 -0
  147. package/dist/modules/stats/view/WinProbability/WinProbability.js +27 -0
  148. package/dist/modules/stats/view/WinProbability/index.d.ts +2 -0
  149. package/dist/modules/stats/view/WinProbability/index.js +2 -0
  150. package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +51 -0
  151. package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +28 -0
  152. package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +10 -0
  153. package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +11 -0
  154. package/dist/modules/stats/view/components/AthletesStatistics/index.d.ts +2 -0
  155. package/dist/modules/stats/view/components/AthletesStatistics/index.js +2 -0
  156. package/dist/modules/stats/view/index.d.ts +1 -0
  157. package/dist/modules/stats/view/index.js +1 -0
  158. package/dist/modules/stats/view-model/StatsViewModel.d.ts +31 -0
  159. package/dist/modules/stats/view-model/StatsViewModel.js +90 -0
  160. package/dist/services/BetsService.js +102 -0
  161. package/dist/services/NetworkManager/NetworkManager.js +410 -0
  162. package/dist/services/NetworkManager/errors.js +45 -0
  163. package/dist/services/ThemeManager/constants.js +47 -0
  164. package/dist/test-polyfills.d.ts +1 -0
  165. package/dist/test-polyfills.js +15 -0
  166. package/dist/types/OverlayTypes.js +4 -0
  167. package/dist/view-models/MaestroEventViewModel.d.ts +2 -0
  168. package/dist/view-models/MaestroEventViewModel.js +156 -0
  169. package/dist/view-models/OverlayViewModel.js +222 -0
  170. package/dist/view-models/PanelManagerViewModel.js +80 -0
  171. package/dist/view-models/ViewModel.js +32 -0
  172. package/dist/view-models/index.js +59 -0
  173. package/package.json +1 -1
@@ -0,0 +1,38 @@
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;
@@ -0,0 +1,166 @@
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;
@@ -0,0 +1,2 @@
1
+ import ScrollableContainer from './ScrollableContainer';
2
+ export default ScrollableContainer;
@@ -0,0 +1,10 @@
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);
@@ -0,0 +1,2 @@
1
+ import ActionButton from './ActionButton';
2
+ export default ActionButton;
@@ -1,4 +1,3 @@
1
- import { Rive as RiveCanvas } from '@rive-app/canvas';
2
1
  import React from 'react';
3
2
  import { OverlayType, IFantasyPayload } from '@/types/OverlayTypes';
4
3
  import { IWinningBet } from '@/models/IWinningBet';
@@ -29,7 +28,7 @@ declare class Overlay extends React.Component<OverlayProps, OverlayState> {
29
28
  get overlayTitle(): string;
30
29
  get overlayMetadata(): string;
31
30
  private trackOverlayViewed;
32
- onLoadRiveInstance: (riveInstance: RiveCanvas | null) => void;
31
+ onLoadRiveInstance: (riveInstance: any | null) => void;
33
32
  render(): React.JSX.Element;
34
33
  }
35
34
  export default Overlay;
@@ -0,0 +1,139 @@
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;
@@ -0,0 +1,2 @@
1
+ import Overlay from './Overlay';
2
+ export default Overlay;
@@ -0,0 +1,40 @@
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);
@@ -0,0 +1,2 @@
1
+ import PanelNavButton from './PanelNavButton';
2
+ export default PanelNavButton;
@@ -0,0 +1,10 @@
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);
@@ -0,0 +1,2 @@
1
+ import SegmentButton from './SegmentButton';
2
+ export default SegmentButton;
@@ -0,0 +1,15 @@
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;
@@ -0,0 +1,2 @@
1
+ import WatchButton from './WatchButton';
2
+ export default WatchButton;
@@ -0,0 +1,72 @@
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;
@@ -0,0 +1,2 @@
1
+ import PanelNavigation from './PanelNavigation';
2
+ export default PanelNavigation;
@@ -0,0 +1,69 @@
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,3 +1,3 @@
1
1
  import SegmentController, { SegmentItem } from './SegmentController';
2
2
  export default SegmentController;
3
- export type { SegmentItem };
3
+ export { SegmentItem };
@@ -0,0 +1,2 @@
1
+ import SegmentController from './SegmentController';
2
+ export default SegmentController;