@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.
Files changed (186) hide show
  1. package/dist/MaestroEventDelegate.d.ts +1 -0
  2. package/dist/components/atoms/Rive/index.d.ts +1 -0
  3. package/dist/components/atoms/SvgIcon/Icon.d.ts +0 -2
  4. package/dist/components/core/ScrollableContainer/ScrollableContainer.d.ts +3 -1
  5. package/dist/components/molecules/ActionButton/ActionButton.d.ts +1 -0
  6. package/dist/components/molecules/PanelNavButton/PanelNavButton.d.ts +1 -0
  7. package/dist/components/organisms/SegmentController/SegmentController.d.ts +2 -2
  8. package/dist/external/spatial-navigation/index.d.ts +2 -3
  9. package/dist/external/spatial-navigation/spatialNavigation.d.ts +3 -5
  10. package/dist/external/spatial-navigation/withFocusable.d.ts +1 -0
  11. package/dist/interfaces/IMaestroEvent.d.ts +14 -0
  12. package/dist/interfaces/IMaestroEventDelegate.d.ts +19 -6
  13. package/dist/maestro-web-sdk.umd.js +3 -3
  14. package/dist/maestro-web-sdk.umd.js.map +1 -1
  15. package/dist/models/IPanel.d.ts +1 -2
  16. package/dist/modules/bets/view/HotProps/HotPropsView.d.ts +7 -6
  17. package/dist/modules/bets/view/SixPack/SixPackView.d.ts +2 -2
  18. package/dist/modules/bets/view/TabLoadFailureView.d.ts +1 -0
  19. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +7 -6
  20. package/dist/modules/bets/view/components/Bet/Bet.d.ts +1 -0
  21. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +2 -2
  22. package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +0 -4
  23. package/dist/modules/stats/interfaces/IStats.d.ts +44 -15
  24. package/dist/modules/stats/utils/driveSummaryUtils.d.ts +18 -0
  25. package/dist/modules/stats/utils/renderTeamStatistic.d.ts +21 -0
  26. package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +21 -0
  27. package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +5 -0
  28. package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +10 -0
  29. package/dist/modules/stats/view/ActiveAthletes/index.d.ts +2 -0
  30. package/dist/modules/stats/view/DriveSummary/DrivePlayCard.d.ts +26 -0
  31. package/dist/modules/stats/view/DriveSummary/DriveSummary.d.ts +24 -0
  32. package/dist/modules/stats/view/DriveSummary/index.d.ts +2 -0
  33. package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +15 -25
  34. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +13 -47
  35. package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +11 -21
  36. package/dist/modules/stats/view/StatsItemView.d.ts +19 -0
  37. package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.d.ts +1 -0
  38. package/dist/modules/stats/view/StatsView.d.ts +3 -3
  39. package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +52 -0
  40. package/dist/modules/stats/view/TeamStats/index.d.ts +2 -0
  41. package/dist/modules/stats/view/Teams/Teams.d.ts +11 -26
  42. package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +11 -21
  43. package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +19 -3
  44. package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +2 -8
  45. package/dist/modules/stats/view/index.d.ts +1 -0
  46. package/dist/modules/stats/view-model/StatsViewModel.d.ts +149 -5
  47. package/dist/services/StatsService.d.ts +36 -0
  48. package/dist/view-models/MaestroEventViewModel.d.ts +7 -0
  49. package/package.json +1 -1
  50. package/dist/MaestroEventDelegate.js +0 -60
  51. package/dist/components/atoms/BaseButton/BaseButton.js +0 -11
  52. package/dist/components/atoms/BaseButton/index.js +0 -2
  53. package/dist/components/atoms/Image/index.js +0 -30
  54. package/dist/components/atoms/Rive/index.js +0 -52
  55. package/dist/components/atoms/SvgIcon/BetGeneralIcon.js +0 -9
  56. package/dist/components/atoms/SvgIcon/BetsIcon.js +0 -11
  57. package/dist/components/atoms/SvgIcon/BetsWarningIcon.js +0 -11
  58. package/dist/components/atoms/SvgIcon/CheckmarkIcon.js +0 -6
  59. package/dist/components/atoms/SvgIcon/CollapseIcon.js +0 -6
  60. package/dist/components/atoms/SvgIcon/ExpandIcon.js +0 -6
  61. package/dist/components/atoms/SvgIcon/FantasyIcon.d.ts +0 -6
  62. package/dist/components/atoms/SvgIcon/FantasyIcon.js +0 -8
  63. package/dist/components/atoms/SvgIcon/FlameIcon.js +0 -11
  64. package/dist/components/atoms/SvgIcon/Icon.js +0 -42
  65. package/dist/components/atoms/SvgIcon/KeyPlaysIcon.js +0 -10
  66. package/dist/components/atoms/SvgIcon/MobilePhoneIcon.js +0 -11
  67. package/dist/components/atoms/SvgIcon/PlayIcon.js +0 -8
  68. package/dist/components/atoms/SvgIcon/StatsIcon.js +0 -12
  69. package/dist/components/atoms/SvgIcon/TimesIcon.js +0 -6
  70. package/dist/components/atoms/SvgIcon/WarningIcon.js +0 -8
  71. package/dist/components/atoms/SvgIcon/index.js +0 -2
  72. package/dist/components/core/App/App.js +0 -41
  73. package/dist/components/core/App/index.js +0 -2
  74. package/dist/components/core/OverlayContainer.js +0 -58
  75. package/dist/components/core/PanelManager/PanelManager.js +0 -80
  76. package/dist/components/core/PanelManager/index.js +0 -2
  77. package/dist/components/core/ScrollableContainer/FocusableItem.js +0 -38
  78. package/dist/components/core/ScrollableContainer/ScrollableContainer.js +0 -166
  79. package/dist/components/core/ScrollableContainer/index.js +0 -2
  80. package/dist/components/molecules/ActionButton/ActionButton.js +0 -10
  81. package/dist/components/molecules/ActionButton/index.js +0 -2
  82. package/dist/components/molecules/Overlay/Overlay.js +0 -139
  83. package/dist/components/molecules/Overlay/index.js +0 -2
  84. package/dist/components/molecules/PanelNavButton/PanelNavButton.js +0 -40
  85. package/dist/components/molecules/PanelNavButton/index.js +0 -2
  86. package/dist/components/molecules/SegmentButton/SegmentButton.js +0 -10
  87. package/dist/components/molecules/SegmentButton/index.js +0 -2
  88. package/dist/components/molecules/WatchButton/WatchButton.js +0 -15
  89. package/dist/components/molecules/WatchButton/index.js +0 -2
  90. package/dist/components/organisms/PanelNavigation/PanelNavigation.js +0 -72
  91. package/dist/components/organisms/PanelNavigation/index.js +0 -2
  92. package/dist/components/organisms/SegmentController/SegmentController.js +0 -69
  93. package/dist/components/organisms/SegmentController/index.js +0 -2
  94. package/dist/external/AxiosNetworkClient.js +0 -83
  95. package/dist/external/LocalStorageCacheManager.js +0 -213
  96. package/dist/external/ReactRenderer.js +0 -86
  97. package/dist/external/mocks/MockExternalNetworkClient.js +0 -161
  98. package/dist/external/ports/cacheManager.js +0 -1
  99. package/dist/external/ports/networkClient.js +0 -1
  100. package/dist/external/ports/renderer.js +0 -1
  101. package/dist/external/spatial-navigation/index.js +0 -4
  102. package/dist/external/spatial-navigation/measureLayout.js +0 -30
  103. package/dist/external/spatial-navigation/spatialNavigation.js +0 -875
  104. package/dist/external/spatial-navigation/utils.js +0 -6
  105. package/dist/external/spatial-navigation/visualDebugger.js +0 -76
  106. package/dist/external/spatial-navigation/withFocusable.js +0 -238
  107. package/dist/helpers/Observable.js +0 -37
  108. package/dist/helpers/deliver-focus.d.ts +0 -5
  109. package/dist/helpers/deliver-focus.js +0 -12
  110. package/dist/index.js +0 -192
  111. package/dist/interfaces/IMaestroEvent.js +0 -6
  112. package/dist/interfaces/IMaestroEventDelegate.js +0 -1
  113. package/dist/interfaces/IMaestroManager.js +0 -1
  114. package/dist/models/IModel.js +0 -1
  115. package/dist/models/IPanel.js +0 -53
  116. package/dist/models/ITheme.js +0 -20
  117. package/dist/models/IWinningBet.js +0 -1
  118. package/dist/modules/bets/interfaces/IBets.js +0 -1
  119. package/dist/modules/bets/mocks.js +0 -572
  120. package/dist/modules/bets/view/BetsView.js +0 -116
  121. package/dist/modules/bets/view/HotProps/HotPropsView.js +0 -139
  122. package/dist/modules/bets/view/SixPack/SixPackView.js +0 -103
  123. package/dist/modules/bets/view/TabLoadFailureView.js +0 -12
  124. package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +0 -6
  125. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +0 -122
  126. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +0 -34
  127. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +0 -22
  128. package/dist/modules/bets/view/UserBets/Boost/Boost.js +0 -6
  129. package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +0 -9
  130. package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +0 -13
  131. package/dist/modules/bets/view/UserBets/Straight/Straight.js +0 -6
  132. package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +0 -13
  133. package/dist/modules/bets/view/UserBets/UserBetsView.js +0 -114
  134. package/dist/modules/bets/view/components/Bet/Bet.js +0 -32
  135. package/dist/modules/bets/view/components/BetPill/BetPill.js +0 -6
  136. package/dist/modules/bets/view/components/BetsCard/BetsCard.js +0 -15
  137. package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +0 -20
  138. package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +0 -14
  139. package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +0 -16
  140. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +0 -63
  141. package/dist/modules/bets/view/components/PromoCodeBanner/index.js +0 -1
  142. package/dist/modules/bets/view-model/BetsViewModel.js +0 -767
  143. package/dist/modules/key-plays/constants.js +0 -292
  144. package/dist/modules/key-plays/interfaces/IKeyPlays.js +0 -14
  145. package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +0 -1
  146. package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +0 -13
  147. package/dist/modules/key-plays/view/KeyPlayCardView.js +0 -142
  148. package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +0 -58
  149. package/dist/modules/key-plays/view/KeyPlaysView.js +0 -167
  150. package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +0 -182
  151. package/dist/modules/stats/interfaces/IStats.js +0 -1
  152. package/dist/modules/stats/mocks.js +0 -546
  153. package/dist/modules/stats/utils.js +0 -62
  154. package/dist/modules/stats/view/GameLeaders/GameLeaders.js +0 -9
  155. package/dist/modules/stats/view/GameLeaders/index.js +0 -2
  156. package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +0 -55
  157. package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +0 -1
  158. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +0 -66
  159. package/dist/modules/stats/view/MatchPredictor/index.js +0 -2
  160. package/dist/modules/stats/view/RecentGames/RecentGames.js +0 -22
  161. package/dist/modules/stats/view/RecentGames/index.js +0 -2
  162. package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +0 -38
  163. package/dist/modules/stats/view/StatsQRCode/index.js +0 -1
  164. package/dist/modules/stats/view/StatsView.js +0 -87
  165. package/dist/modules/stats/view/Teams/StatsCarousel.js +0 -14
  166. package/dist/modules/stats/view/Teams/StatsProgressBar.js +0 -14
  167. package/dist/modules/stats/view/Teams/Teams.js +0 -35
  168. package/dist/modules/stats/view/Teams/index.js +0 -2
  169. package/dist/modules/stats/view/WinProbability/WinProbability.js +0 -27
  170. package/dist/modules/stats/view/WinProbability/index.js +0 -2
  171. package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +0 -28
  172. package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +0 -11
  173. package/dist/modules/stats/view/components/AthletesStatistics/index.js +0 -2
  174. package/dist/modules/stats/view/index.js +0 -1
  175. package/dist/modules/stats/view-model/StatsViewModel.js +0 -90
  176. package/dist/services/BetsService.js +0 -102
  177. package/dist/services/NetworkManager/NetworkManager.js +0 -410
  178. package/dist/services/NetworkManager/errors.js +0 -45
  179. package/dist/services/ThemeManager/constants.js +0 -47
  180. package/dist/test-polyfills.js +0 -15
  181. package/dist/types/OverlayTypes.js +0 -4
  182. package/dist/view-models/MaestroEventViewModel.js +0 -156
  183. package/dist/view-models/OverlayViewModel.js +0 -222
  184. package/dist/view-models/PanelManagerViewModel.js +0 -80
  185. package/dist/view-models/ViewModel.js +0 -32
  186. package/dist/view-models/index.js +0 -59
@@ -1,6 +0,0 @@
1
- export const DIRECTION_LEFT = 'left';
2
- export const DIRECTION_RIGHT = 'right';
3
- export const DIRECTION_UP = 'up';
4
- export const DIRECTION_DOWN = 'down';
5
- export const KEY_ENTER = 'enter';
6
- export const KEY_BACK = 'back';
@@ -1,76 +0,0 @@
1
- // We'll make VisualDebugger no-op for any environments lacking a DOM (e.g. SSR and React Native non-web platforms).
2
- const hasDOM = typeof window !== 'undefined' && window.document;
3
- const WIDTH = hasDOM ? window.innerWidth : 0;
4
- const HEIGHT = hasDOM ? window.innerHeight : 0;
5
- class VisualDebugger {
6
- constructor() {
7
- Object.defineProperty(this, "debugCtx", {
8
- enumerable: true,
9
- configurable: true,
10
- writable: true,
11
- value: void 0
12
- });
13
- Object.defineProperty(this, "layoutsCtx", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: void 0
18
- });
19
- if (hasDOM) {
20
- this.debugCtx = VisualDebugger.createCanvas('sn-debug', 1010);
21
- this.layoutsCtx = VisualDebugger.createCanvas('sn-layouts', 1000);
22
- }
23
- else {
24
- this.debugCtx = null;
25
- this.layoutsCtx = null;
26
- }
27
- }
28
- static createCanvas(id, zIndex) {
29
- const canvas = (document.querySelector(`#${id}`) ||
30
- document.createElement('canvas'));
31
- canvas.setAttribute('id', id);
32
- const ctx = canvas.getContext('2d');
33
- if (!ctx) {
34
- throw new Error('Could not get 2d context from canvas');
35
- }
36
- canvas.style.cssText = `position: fixed; top: 0; left: 0; z-index: ${zIndex}`;
37
- document.body.appendChild(canvas);
38
- canvas.width = WIDTH;
39
- canvas.height = HEIGHT;
40
- return ctx;
41
- }
42
- clear() {
43
- if (!hasDOM || !this.debugCtx) {
44
- return;
45
- }
46
- this.debugCtx.clearRect(0, 0, WIDTH, HEIGHT);
47
- }
48
- clearLayouts() {
49
- if (!hasDOM || !this.layoutsCtx) {
50
- return;
51
- }
52
- this.layoutsCtx.clearRect(0, 0, WIDTH, HEIGHT);
53
- }
54
- drawLayout(layout, focusKey, parentFocusKey) {
55
- if (!hasDOM || !this.layoutsCtx) {
56
- return;
57
- }
58
- this.layoutsCtx.strokeStyle = 'green';
59
- this.layoutsCtx.strokeRect(layout.left, layout.top, layout.width, layout.height);
60
- this.layoutsCtx.font = '8px monospace';
61
- this.layoutsCtx.fillStyle = 'red';
62
- this.layoutsCtx.fillText(focusKey, layout.left, layout.top + 10);
63
- this.layoutsCtx.fillText(parentFocusKey, layout.left, layout.top + 25);
64
- this.layoutsCtx.fillText(`left: ${layout.left}`, layout.left, layout.top + 40);
65
- this.layoutsCtx.fillText(`top: ${layout.top}`, layout.left, layout.top + 55);
66
- }
67
- drawPoint(x, y, color = 'blue', size = 10) {
68
- if (!hasDOM || !this.debugCtx) {
69
- return;
70
- }
71
- this.debugCtx.strokeStyle = color;
72
- this.debugCtx.lineWidth = 3;
73
- this.debugCtx.strokeRect(x - size / 2, y - size / 2, size, size);
74
- }
75
- }
76
- export default VisualDebugger;
@@ -1,238 +0,0 @@
1
- /* eslint-disable react/no-find-dom-node */
2
- import { findDOMNode } from 'react-dom';
3
- import PropTypes from 'prop-types';
4
- import { Component, createElement } from 'react';
5
- import SpatialNavigation, { ROOT_FOCUS_KEY } from './spatialNavigation';
6
- // Helper functions to replace lodash and recompose
7
- const uniqueId = (prefix) => `${prefix}${Math.random().toString(36).substr(2, 9)}`;
8
- const noop = () => { };
9
- const omit = (obj, keys) => {
10
- const result = { ...obj };
11
- keys.forEach((key) => delete result[key]);
12
- return result;
13
- };
14
- const withFocusable = ({ forgetLastFocusedChild: configForgetLastFocusedChild = false, trackChildren: configTrackChildren = false, autoRestoreFocus: configAutoRestoreFocus, blockNavigationOut: configBlockNavigationOut = false, } = {}) => {
15
- return (WrappedComponent) => {
16
- var _a;
17
- return _a = class WithFocusable extends Component {
18
- constructor() {
19
- super(...arguments);
20
- Object.defineProperty(this, "state", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: {
25
- realFocusKey: this.props.focusKey || uniqueId('sn:focusable-item-'),
26
- focused: false,
27
- hasFocusedChild: false,
28
- parentFocusKey: this.props.parentFocusKey || ROOT_FOCUS_KEY,
29
- }
30
- });
31
- Object.defineProperty(this, "setFocus", {
32
- enumerable: true,
33
- configurable: true,
34
- writable: true,
35
- value: (focusKey) => {
36
- if (!SpatialNavigation.isNativeMode()) {
37
- SpatialNavigation.setFocus(focusKey);
38
- }
39
- }
40
- });
41
- Object.defineProperty(this, "navigateByDirection", {
42
- enumerable: true,
43
- configurable: true,
44
- writable: true,
45
- value: SpatialNavigation.navigateByDirection
46
- });
47
- Object.defineProperty(this, "stealFocus", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: () => {
52
- SpatialNavigation.setFocus(this.state.realFocusKey, {
53
- focusKey: this.state.realFocusKey,
54
- });
55
- }
56
- });
57
- Object.defineProperty(this, "onUpdateFocus", {
58
- enumerable: true,
59
- configurable: true,
60
- writable: true,
61
- value: (focused) => {
62
- this.setState({ focused });
63
- }
64
- });
65
- Object.defineProperty(this, "onUpdateHasFocusedChild", {
66
- enumerable: true,
67
- configurable: true,
68
- writable: true,
69
- value: (hasFocusedChild) => {
70
- this.setState({ hasFocusedChild });
71
- }
72
- });
73
- Object.defineProperty(this, "onEnterPressHandler", {
74
- enumerable: true,
75
- configurable: true,
76
- writable: true,
77
- value: (details) => {
78
- const { onEnterPress = noop, ...rest } = this.props;
79
- onEnterPress(rest, details);
80
- }
81
- });
82
- Object.defineProperty(this, "onEnterReleaseHandler", {
83
- enumerable: true,
84
- configurable: true,
85
- writable: true,
86
- value: () => {
87
- const { onEnterRelease = noop, ...rest } = this.props;
88
- onEnterRelease(rest);
89
- }
90
- });
91
- Object.defineProperty(this, "onBackPressHandler", {
92
- enumerable: true,
93
- configurable: true,
94
- writable: true,
95
- value: (details) => {
96
- const { onBackPress = noop, ...rest } = this.props;
97
- onBackPress(rest, details);
98
- }
99
- });
100
- Object.defineProperty(this, "onArrowPressHandler", {
101
- enumerable: true,
102
- configurable: true,
103
- writable: true,
104
- value: (direction, details) => {
105
- const { onArrowPress = noop, ...rest } = this.props;
106
- return onArrowPress(direction, rest, details);
107
- }
108
- });
109
- Object.defineProperty(this, "onBecameFocusedHandler", {
110
- enumerable: true,
111
- configurable: true,
112
- writable: true,
113
- value: (layout, details) => {
114
- const { onBecameFocused = noop, ...rest } = this.props;
115
- onBecameFocused(layout, rest, details);
116
- }
117
- });
118
- Object.defineProperty(this, "onBecameBlurredHandler", {
119
- enumerable: true,
120
- configurable: true,
121
- writable: true,
122
- value: (layout, details) => {
123
- const { onBecameBlurred = noop, ...rest } = this.props;
124
- onBecameBlurred(layout, rest, details);
125
- }
126
- });
127
- }
128
- getChildContext() {
129
- return {
130
- parentFocusKey: this.state.realFocusKey,
131
- };
132
- }
133
- componentDidMount() {
134
- const { realFocusKey: focusKey, parentFocusKey } = this.state;
135
- const { preferredChildFocusKey, forgetLastFocusedChild = false, trackChildren, focusable = true, autoRestoreFocus = true, blockNavigationOut = false, } = this.props;
136
- let node;
137
- if (SpatialNavigation.isNativeMode()) {
138
- node = document.createElement('div');
139
- }
140
- else {
141
- const domNode = findDOMNode(this);
142
- if (!domNode) {
143
- throw new Error('Could not find DOM node');
144
- }
145
- node = domNode;
146
- }
147
- SpatialNavigation.addFocusable({
148
- focusKey,
149
- node,
150
- parentFocusKey,
151
- preferredChildFocusKey,
152
- onEnterPressHandler: this.onEnterPressHandler,
153
- onEnterReleaseHandler: this.onEnterReleaseHandler,
154
- onBackPressHandler: this.onBackPressHandler,
155
- onArrowPressHandler: this.onArrowPressHandler,
156
- onBecameFocusedHandler: this.onBecameFocusedHandler,
157
- onBecameBlurredHandler: this.onBecameBlurredHandler,
158
- onUpdateFocus: this.onUpdateFocus,
159
- onUpdateHasFocusedChild: this.onUpdateHasFocusedChild,
160
- forgetLastFocusedChild: configForgetLastFocusedChild || forgetLastFocusedChild,
161
- trackChildren: configTrackChildren || trackChildren,
162
- blockNavigationOut: configBlockNavigationOut || blockNavigationOut,
163
- autoRestoreFocus: configAutoRestoreFocus !== undefined
164
- ? configAutoRestoreFocus
165
- : autoRestoreFocus,
166
- focusable,
167
- });
168
- }
169
- componentDidUpdate() {
170
- const { realFocusKey: focusKey } = this.state;
171
- const { preferredChildFocusKey, focusable = true, blockNavigationOut = false, } = this.props;
172
- let node;
173
- if (SpatialNavigation.isNativeMode()) {
174
- node = document.createElement('div');
175
- }
176
- else {
177
- const domNode = findDOMNode(this);
178
- if (!domNode) {
179
- throw new Error('Could not find DOM node');
180
- }
181
- node = domNode;
182
- }
183
- SpatialNavigation.updateFocusable(focusKey, {
184
- node,
185
- preferredChildFocusKey,
186
- focusable,
187
- blockNavigationOut: configBlockNavigationOut || blockNavigationOut,
188
- });
189
- }
190
- componentWillUnmount() {
191
- const { realFocusKey: focusKey } = this.state;
192
- SpatialNavigation.removeFocusable({ focusKey });
193
- }
194
- render() {
195
- const props = {
196
- ...this.props,
197
- ...this.state,
198
- setFocus: this.setFocus,
199
- navigateByDirection: this.navigateByDirection,
200
- stealFocus: this.stealFocus,
201
- onUpdateFocus: this.onUpdateFocus,
202
- onUpdateHasFocusedChild: this.onUpdateHasFocusedChild,
203
- };
204
- const filteredProps = omit(props, [
205
- 'onBecameFocusedHandler',
206
- 'onBecameBlurredHandler',
207
- 'onEnterPressHandler',
208
- 'onEnterReleaseHandler',
209
- 'onArrowPressHandler',
210
- 'onUpdateFocus',
211
- 'onUpdateHasFocusedChild',
212
- 'forgetLastFocusedChild',
213
- 'trackChildren',
214
- 'autoRestoreFocus',
215
- ]);
216
- return createElement(WrappedComponent, filteredProps);
217
- }
218
- },
219
- Object.defineProperty(_a, "contextTypes", {
220
- enumerable: true,
221
- configurable: true,
222
- writable: true,
223
- value: {
224
- parentFocusKey: PropTypes.string,
225
- }
226
- }),
227
- Object.defineProperty(_a, "childContextTypes", {
228
- enumerable: true,
229
- configurable: true,
230
- writable: true,
231
- value: {
232
- parentFocusKey: PropTypes.string,
233
- }
234
- }),
235
- _a;
236
- };
237
- };
238
- export default withFocusable;
@@ -1,37 +0,0 @@
1
- /**
2
- * Basic observable implementation for view models
3
- */
4
- export class Observable {
5
- constructor(initialValue) {
6
- Object.defineProperty(this, "listeners", {
7
- enumerable: true,
8
- configurable: true,
9
- writable: true,
10
- value: []
11
- });
12
- Object.defineProperty(this, "_value", {
13
- enumerable: true,
14
- configurable: true,
15
- writable: true,
16
- value: void 0
17
- });
18
- this._value = initialValue;
19
- }
20
- get value() {
21
- return this._value;
22
- }
23
- set value(newValue) {
24
- this._value = newValue;
25
- this.notify();
26
- }
27
- subscribe(listener) {
28
- this.listeners.push(listener);
29
- // Return unsubscribe function
30
- return () => {
31
- this.listeners = this.listeners.filter((l) => l !== listener);
32
- };
33
- }
34
- notify() {
35
- this.listeners.forEach((listener) => listener(this._value));
36
- }
37
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * @description Useful when you want to lose the focus of the SDK and delegate it to the Client App.
3
- */
4
- declare const deliverFocus: (e: HTMLElement) => void;
5
- export default deliverFocus;
@@ -1,12 +0,0 @@
1
- import { pause } from '@/external/spatial-navigation';
2
- import SDK from '..';
3
- /**
4
- * @description Useful when you want to lose the focus of the SDK and delegate it to the Client App.
5
- */
6
- const deliverFocus = (e) => {
7
- const eventVm = SDK.getMaestroEventViewModel();
8
- e.dataset['focused'] = 'false';
9
- pause();
10
- eventVm.delegate.startFocusManagement();
11
- };
12
- export default deliverFocus;
package/dist/index.js DELETED
@@ -1,192 +0,0 @@
1
- import ReactRenderer from './external/ReactRenderer';
2
- import { MaestroEventViewModel } from './view-models/MaestroEventViewModel';
3
- // Export overlay components and types for client apps
4
- export { default as Overlay } from './components/molecules/Overlay/Overlay';
5
- export { OverlayType, } from './types/OverlayTypes';
6
- const AUTHORIZED_CLIENTS = ['664b9c57d59a7a431542d814'];
7
- /**
8
- * Main SDK class that serves as the entry point for the Maestro TV SDK
9
- * Follows a singleton pattern similar to the Swift implementation
10
- */
11
- class MaestroWebSDK {
12
- constructor(renderer) {
13
- Object.defineProperty(this, "renderer", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: void 0
18
- });
19
- Object.defineProperty(this, "siteID", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: void 0
24
- });
25
- Object.defineProperty(this, "userID", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: void 0
30
- });
31
- Object.defineProperty(this, "maestroJwt", {
32
- enumerable: true,
33
- configurable: true,
34
- writable: true,
35
- value: void 0
36
- });
37
- Object.defineProperty(this, "clientAppToken", {
38
- enumerable: true,
39
- configurable: true,
40
- writable: true,
41
- value: void 0
42
- });
43
- Object.defineProperty(this, "clientAppSwid", {
44
- enumerable: true,
45
- configurable: true,
46
- writable: true,
47
- value: void 0
48
- });
49
- Object.defineProperty(this, "maestroEventViewModel", {
50
- enumerable: true,
51
- configurable: true,
52
- writable: true,
53
- value: null
54
- });
55
- this.renderer = renderer;
56
- }
57
- /**
58
- * @description Returns the MaestroWebSDK instance
59
- * @returns {MaestroWebSDK} - The MaestroWebSDK instance
60
- */
61
- static getInstance() {
62
- if (!MaestroWebSDK.instance) {
63
- const renderer = new ReactRenderer();
64
- MaestroWebSDK.instance = new MaestroWebSDK(renderer);
65
- }
66
- return MaestroWebSDK.instance;
67
- }
68
- async userDidStartWatchingEvent(eventID, delegate) {
69
- if (!this.isAuthorizedClient) {
70
- throw new Error('Unauthorized use of SDK');
71
- }
72
- this.maestroEventViewModel = new MaestroEventViewModel(eventID, delegate);
73
- return this.maestroEventViewModel;
74
- }
75
- userDidStopWatchingEvent(_) {
76
- if (this.maestroEventViewModel) {
77
- this.maestroEventViewModel.deinit();
78
- this.maestroEventViewModel = null;
79
- }
80
- }
81
- configure(configParams) {
82
- if (configParams.siteID) {
83
- this.setSiteID(configParams.siteID);
84
- }
85
- if (configParams.maestroJwt) {
86
- this.setMaestroJwt(configParams.maestroJwt);
87
- }
88
- if (configParams.clientAppToken) {
89
- this.setClientAppToken(configParams.clientAppToken);
90
- }
91
- if (configParams.clientAppSwid) {
92
- this.setClientAppSwid(configParams.clientAppSwid);
93
- }
94
- console.info('MaestroWebSDK configured', configParams);
95
- }
96
- /**
97
- * Checks if this is an authorized client based on siteID
98
- */
99
- get isAuthorizedClient() {
100
- const siteID = this.getSiteID();
101
- return Boolean(siteID && AUTHORIZED_CLIENTS.includes(siteID));
102
- }
103
- /**
104
- * Sets the site ID for the SDK
105
- * @param siteID The site ID to set
106
- */
107
- setSiteID(siteID) {
108
- this.siteID = siteID;
109
- }
110
- getSiteID() {
111
- return this.siteID;
112
- }
113
- /**
114
- * Sets the user ID for the SDK
115
- * @param userID The user ID to set
116
- */
117
- setUserID(userID) {
118
- this.userID = userID;
119
- }
120
- getUserID() {
121
- return this.userID;
122
- }
123
- /**
124
- * Gets the event view model
125
- * @returns The current event view model
126
- */
127
- getMaestroEventViewModel() {
128
- if (!this.maestroEventViewModel) {
129
- throw new Error('No Maestro Event View Model set');
130
- }
131
- return this.maestroEventViewModel;
132
- }
133
- /**
134
- * Gets the view models container
135
- * @returns The current view models
136
- */
137
- getMaestroViewModels() {
138
- return this.renderer.viewModels;
139
- }
140
- async renderPanel(id) {
141
- if (!this.renderer.viewModels) {
142
- if (!this.maestroEventViewModel) {
143
- throw new Error('No Maestro Event View Model set.');
144
- }
145
- let eventId = 'default-event-id';
146
- if (id) {
147
- eventId = id;
148
- }
149
- await this.renderer.setViewModels(eventId, this.maestroEventViewModel.delegate);
150
- }
151
- return this.renderer.renderPanel(id);
152
- }
153
- setMaestroJwt(jwt) {
154
- this.maestroJwt = jwt;
155
- }
156
- setClientAppSwid(swid) {
157
- this.clientAppSwid = swid;
158
- }
159
- setClientAppToken(jwt) {
160
- this.clientAppToken = jwt;
161
- }
162
- async authenticateUser(swid, token) {
163
- this.setClientAppSwid(swid);
164
- this.setClientAppToken(token);
165
- if (this.getMaestroEventViewModel().betsViewModel.initialized) {
166
- // Stop polling bets if the user is deauthenticated
167
- this.getMaestroEventViewModel().betsViewModel.refreshPolling();
168
- }
169
- }
170
- async deauthenticateUser() {
171
- this.setClientAppSwid(undefined);
172
- this.setClientAppToken(undefined);
173
- if (this.getMaestroEventViewModel().betsViewModel.initialized) {
174
- // Stop polling bets if the user is deauthenticated
175
- this.getMaestroEventViewModel().betsViewModel.refreshPolling();
176
- }
177
- }
178
- getCurrentMaestroJwt() {
179
- return this.maestroJwt;
180
- }
181
- getClientAppToken() {
182
- return this.clientAppToken;
183
- }
184
- getCurrentUserID() {
185
- return this.userID;
186
- }
187
- getClientAppSwid() {
188
- return this.clientAppSwid;
189
- }
190
- }
191
- const SDK = MaestroWebSDK.getInstance();
192
- export default SDK;
@@ -1,6 +0,0 @@
1
- const TEST_USE_CASES = {
2
- betsTabLoadFailure: 'betsTabLoadFailure',
3
- betsMockData: 'betsMockData',
4
- betsLiveData: 'betsLiveData',
5
- };
6
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,53 +0,0 @@
1
- export const MaestroPanelType = {
2
- KEY_PLAYS: 'keyPlays',
3
- STATS: 'stats',
4
- FANTASY: 'fantasy',
5
- BETS: 'bets',
6
- };
7
- // The mapping information for each panel type
8
- export const PANEL_TYPE_INFO = {
9
- [MaestroPanelType.KEY_PLAYS]: {
10
- id: MaestroPanelType.KEY_PLAYS,
11
- name: 'Key Plays',
12
- imageNamePrefix: 'Key-Plays',
13
- usesSectionHeaders: true,
14
- iconName: 'keyPlays',
15
- },
16
- [MaestroPanelType.STATS]: {
17
- id: MaestroPanelType.STATS,
18
- name: 'Stats',
19
- imageNamePrefix: 'Stats',
20
- usesSectionHeaders: false,
21
- iconName: 'stats',
22
- },
23
- [MaestroPanelType.FANTASY]: {
24
- id: MaestroPanelType.FANTASY,
25
- name: 'Fantasy',
26
- imageNamePrefix: 'Fantasy',
27
- usesSectionHeaders: false,
28
- iconName: 'fantasy',
29
- },
30
- [MaestroPanelType.BETS]: {
31
- id: MaestroPanelType.BETS,
32
- name: 'Bets',
33
- imageNamePrefix: 'Bets',
34
- usesSectionHeaders: false,
35
- iconName: 'bets',
36
- },
37
- };
38
- // Helper methods similar to Swift extension methods
39
- export const getPanelName = (panelType) => {
40
- return PANEL_TYPE_INFO[panelType].name;
41
- };
42
- export const getImageNamePrefix = (panelType) => {
43
- return PANEL_TYPE_INFO[panelType].imageNamePrefix;
44
- };
45
- export const usesSectionHeaders = (panelType) => {
46
- return PANEL_TYPE_INFO[panelType].usesSectionHeaders;
47
- };
48
- export const getIconName = (panelType) => {
49
- return PANEL_TYPE_INFO[panelType].iconName;
50
- };
51
- export const getAllPanelTypes = () => {
52
- return Object.values(MaestroPanelType);
53
- };
@@ -1,20 +0,0 @@
1
- export const BORDER_RADIUS = {
2
- rounded: 'rounded',
3
- square: 'square',
4
- pill: 'pill',
5
- };
6
- export const TEXT_CAPITALIZATION = {
7
- lowercase: 'lowercase',
8
- original: 'original',
9
- uppercase: 'uppercase',
10
- };
11
- export const THEME_TYPES = {
12
- ADMIN: 'admin',
13
- ADVANCED: 'advanced',
14
- CLASSIC: 'classic',
15
- CUSTOM: 'custom',
16
- };
17
- export const THEME_MODES = {
18
- DARK: 'dark',
19
- LIGHT: 'light',
20
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};