@maestro_io/maestro-web-sdk 2.1.1 → 2.1.3

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.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 +1 -0
  6. package/dist/components/atoms/Rive/index.js +53 -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.d.ts +1 -0
  32. package/dist/components/molecules/ActionButton/ActionButton.js +10 -0
  33. package/dist/components/molecules/ActionButton/index.js +2 -0
  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.d.ts +1 -0
  37. package/dist/components/molecules/PanelNavButton/PanelNavButton.js +40 -0
  38. package/dist/components/molecules/PanelNavButton/index.js +2 -0
  39. package/dist/components/molecules/SegmentButton/SegmentButton.js +10 -0
  40. package/dist/components/molecules/SegmentButton/index.js +2 -0
  41. package/dist/components/molecules/WatchButton/WatchButton.js +15 -0
  42. package/dist/components/molecules/WatchButton/index.js +2 -0
  43. package/dist/components/organisms/PanelNavigation/PanelNavigation.js +71 -0
  44. package/dist/components/organisms/PanelNavigation/index.js +2 -0
  45. package/dist/components/organisms/SegmentController/SegmentController.d.ts +2 -2
  46. package/dist/components/organisms/SegmentController/SegmentController.js +68 -0
  47. package/dist/components/organisms/SegmentController/index.d.ts +1 -1
  48. package/dist/components/organisms/SegmentController/index.js +2 -0
  49. package/dist/external/AxiosNetworkClient.js +83 -0
  50. package/dist/external/LocalStorageCacheManager.js +213 -0
  51. package/dist/external/ReactRenderer.d.ts +2 -2
  52. package/dist/external/ReactRenderer.js +86 -0
  53. package/dist/external/mocks/MockExternalNetworkClient.js +161 -0
  54. package/dist/external/ports/cacheManager.js +1 -0
  55. package/dist/external/ports/networkClient.js +1 -0
  56. package/dist/external/ports/renderer.js +1 -0
  57. package/dist/external/spatial-navigation/index.d.ts +3 -4
  58. package/dist/external/spatial-navigation/index.js +3 -0
  59. package/dist/external/spatial-navigation/measureLayout.js +30 -0
  60. package/dist/external/spatial-navigation/spatialNavigation.d.ts +2 -4
  61. package/dist/external/spatial-navigation/spatialNavigation.js +864 -0
  62. package/dist/external/spatial-navigation/utils.js +6 -0
  63. package/dist/external/spatial-navigation/visualDebugger.js +76 -0
  64. package/dist/external/spatial-navigation/withFocusable.d.ts +1 -0
  65. package/dist/external/spatial-navigation/withFocusable.js +245 -0
  66. package/dist/helpers/Observable.js +37 -0
  67. package/dist/helpers/deliver-focus.js +12 -0
  68. package/dist/index.d.ts +4 -4
  69. package/dist/index.js +192 -0
  70. package/dist/interfaces/IMaestroEvent.js +6 -0
  71. package/dist/interfaces/IMaestroEventDelegate.js +1 -0
  72. package/dist/interfaces/IMaestroManager.js +1 -0
  73. package/dist/maestro-web-sdk.umd.js +3 -3
  74. package/dist/maestro-web-sdk.umd.js.map +1 -1
  75. package/dist/models/IModel.js +1 -0
  76. package/dist/models/IPanel.js +53 -0
  77. package/dist/models/ITheme.js +20 -0
  78. package/dist/models/IWinningBet.js +1 -0
  79. package/dist/modules/bets/interfaces/IBets.js +1 -0
  80. package/dist/modules/bets/mocks.js +572 -0
  81. package/dist/modules/bets/view/BetsView.js +116 -0
  82. package/dist/modules/bets/view/HotProps/HotPropsView.d.ts +7 -6
  83. package/dist/modules/bets/view/HotProps/HotPropsView.js +139 -0
  84. package/dist/modules/bets/view/SixPack/SixPackView.d.ts +2 -2
  85. package/dist/modules/bets/view/SixPack/SixPackView.js +103 -0
  86. package/dist/modules/bets/view/TabLoadFailureView.d.ts +1 -0
  87. package/dist/modules/bets/view/TabLoadFailureView.js +12 -0
  88. package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +6 -0
  89. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +7 -6
  90. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +122 -0
  91. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +34 -0
  92. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +22 -0
  93. package/dist/modules/bets/view/UserBets/Boost/Boost.js +6 -0
  94. package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +9 -0
  95. package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +13 -0
  96. package/dist/modules/bets/view/UserBets/Straight/Straight.js +6 -0
  97. package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +13 -0
  98. package/dist/modules/bets/view/UserBets/UserBetsView.js +114 -0
  99. package/dist/modules/bets/view/components/Bet/Bet.d.ts +1 -0
  100. package/dist/modules/bets/view/components/Bet/Bet.js +32 -0
  101. package/dist/modules/bets/view/components/BetPill/BetPill.js +6 -0
  102. package/dist/modules/bets/view/components/BetsCard/BetsCard.js +15 -0
  103. package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +20 -0
  104. package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +14 -0
  105. package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +16 -0
  106. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +2 -2
  107. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +63 -0
  108. package/dist/modules/bets/view/components/PromoCodeBanner/index.d.ts +1 -1
  109. package/dist/modules/bets/view/components/PromoCodeBanner/index.js +1 -0
  110. package/dist/modules/bets/view-model/BetsViewModel.js +767 -0
  111. package/dist/modules/key-plays/constants.js +292 -0
  112. package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +4 -4
  113. package/dist/modules/key-plays/interfaces/IKeyPlays.js +14 -0
  114. package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +1 -0
  115. package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +13 -0
  116. package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +0 -4
  117. package/dist/modules/key-plays/view/KeyPlayCardView.js +120 -0
  118. package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +58 -0
  119. package/dist/modules/key-plays/view/KeyPlaysView.js +166 -0
  120. package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +182 -0
  121. package/dist/modules/stats/interfaces/IStats.d.ts +166 -0
  122. package/dist/modules/stats/interfaces/IStats.js +1 -0
  123. package/dist/modules/stats/mocks.d.ts +82 -0
  124. package/dist/modules/stats/mocks.js +686 -0
  125. package/dist/modules/stats/utils/renderTeamStatistic.d.ts +21 -0
  126. package/dist/modules/stats/utils/renderTeamStatistic.js +16 -0
  127. package/dist/modules/stats/utils.d.ts +39 -0
  128. package/dist/modules/stats/utils.js +62 -0
  129. package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +34 -0
  130. package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.js +78 -0
  131. package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +5 -0
  132. package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.js +27 -0
  133. package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +10 -0
  134. package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.js +15 -0
  135. package/dist/modules/stats/view/ActiveAthletes/index.d.ts +2 -0
  136. package/dist/modules/stats/view/ActiveAthletes/index.js +2 -0
  137. package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +8 -0
  138. package/dist/modules/stats/view/GameLeaders/GameLeaders.js +9 -0
  139. package/dist/modules/stats/view/GameLeaders/index.d.ts +2 -0
  140. package/dist/modules/stats/view/GameLeaders/index.js +2 -0
  141. package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.d.ts +17 -0
  142. package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +55 -0
  143. package/dist/modules/stats/view/MatchPredictor/DonutChart/index.d.ts +2 -0
  144. package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +1 -0
  145. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +53 -0
  146. package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +66 -0
  147. package/dist/modules/stats/view/MatchPredictor/index.d.ts +3 -0
  148. package/dist/modules/stats/view/MatchPredictor/index.js +2 -0
  149. package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +63 -0
  150. package/dist/modules/stats/view/RecentGames/RecentGames.js +22 -0
  151. package/dist/modules/stats/view/RecentGames/index.d.ts +2 -0
  152. package/dist/modules/stats/view/RecentGames/index.js +2 -0
  153. package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.d.ts +52 -0
  154. package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +38 -0
  155. package/dist/modules/stats/view/StatsQRCode/index.d.ts +2 -0
  156. package/dist/modules/stats/view/StatsQRCode/index.js +1 -0
  157. package/dist/modules/stats/view/StatsView.d.ts +20 -0
  158. package/dist/modules/stats/view/StatsView.js +107 -0
  159. package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +54 -0
  160. package/dist/modules/stats/view/TeamStats/TeamStatsView.js +69 -0
  161. package/dist/modules/stats/view/TeamStats/index.d.ts +2 -0
  162. package/dist/modules/stats/view/TeamStats/index.js +1 -0
  163. package/dist/modules/stats/view/Teams/StatsCarousel.d.ts +8 -0
  164. package/dist/modules/stats/view/Teams/StatsCarousel.js +14 -0
  165. package/dist/modules/stats/view/Teams/StatsProgressBar.d.ts +7 -0
  166. package/dist/modules/stats/view/Teams/StatsProgressBar.js +18 -0
  167. package/dist/modules/stats/view/Teams/Teams.d.ts +68 -0
  168. package/dist/modules/stats/view/Teams/Teams.js +42 -0
  169. package/dist/modules/stats/view/Teams/index.d.ts +2 -0
  170. package/dist/modules/stats/view/Teams/index.js +2 -0
  171. package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +63 -0
  172. package/dist/modules/stats/view/WinProbability/WinProbability.js +27 -0
  173. package/dist/modules/stats/view/WinProbability/index.d.ts +2 -0
  174. package/dist/modules/stats/view/WinProbability/index.js +2 -0
  175. package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +67 -0
  176. package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +29 -0
  177. package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +4 -0
  178. package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +12 -0
  179. package/dist/modules/stats/view/components/AthletesStatistics/index.d.ts +2 -0
  180. package/dist/modules/stats/view/components/AthletesStatistics/index.js +2 -0
  181. package/dist/modules/stats/view/index.d.ts +2 -0
  182. package/dist/modules/stats/view/index.js +2 -0
  183. package/dist/modules/stats/view-model/StatsViewModel.d.ts +31 -0
  184. package/dist/modules/stats/view-model/StatsViewModel.js +90 -0
  185. package/dist/services/BetsService.js +102 -0
  186. package/dist/services/NetworkManager/NetworkManager.js +410 -0
  187. package/dist/services/NetworkManager/errors.js +45 -0
  188. package/dist/services/StatsService.d.ts +36 -0
  189. package/dist/services/StatsService.js +68 -0
  190. package/dist/services/ThemeManager/constants.js +47 -0
  191. package/dist/test-polyfills.d.ts +1 -0
  192. package/dist/test-polyfills.js +15 -0
  193. package/dist/types/OverlayTypes.js +4 -0
  194. package/dist/view-models/MaestroEventViewModel.d.ts +9 -0
  195. package/dist/view-models/MaestroEventViewModel.js +168 -0
  196. package/dist/view-models/OverlayViewModel.js +222 -0
  197. package/dist/view-models/PanelManagerViewModel.js +80 -0
  198. package/dist/view-models/ViewModel.js +32 -0
  199. package/dist/view-models/index.js +59 -0
  200. package/package.json +1 -1
@@ -0,0 +1,116 @@
1
+ import React, { Component } from 'react';
2
+ import SixPackView from './SixPack/SixPackView';
3
+ import './BetsView.styles.css';
4
+ import ScrollableContainer from '@/components/core/ScrollableContainer';
5
+ import SDK from '@/index';
6
+ import UserBetsView from './UserBets/UserBetsView';
7
+ import HotPropsView from './HotProps/HotPropsView';
8
+ import GamblingDisclaimer from './components/GamblingDisclaimer/GamblingDisclaimer';
9
+ import LocationWarning from './components/LocationWarning/LocationWarning';
10
+ import TabLoadFailureView from './TabLoadFailureView';
11
+ import { BetItemPromoCode } from './components/PromoCodeBanner';
12
+ class BetsView extends Component {
13
+ constructor(props) {
14
+ super(props);
15
+ Object.defineProperty(this, "container", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: null
20
+ });
21
+ Object.defineProperty(this, "betsItemsUnsub", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: null
26
+ });
27
+ Object.defineProperty(this, "isDataLoadingUnsub", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: null
32
+ });
33
+ Object.defineProperty(this, "errorStateUnsub", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: null
38
+ });
39
+ Object.defineProperty(this, "vm", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ Object.defineProperty(this, "renderBetItem", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: (item) => {
50
+ switch (item.type) {
51
+ case 'sixPack':
52
+ return React.createElement(SixPackView, { key: item.id, item: item });
53
+ case 'userBets':
54
+ return React.createElement(UserBetsView, { item: item, key: item.id });
55
+ case 'hotProps':
56
+ return (React.createElement(HotPropsView, { focusKey: `hot-props-view-${item.id}`, key: item.id, item: item }));
57
+ case 'gamblingMessage':
58
+ return React.createElement(GamblingDisclaimer, { text: item.data.text, key: item.id });
59
+ case 'locationDisclaimer':
60
+ return (React.createElement(LocationWarning, { key: item.id, disclaimerText: item.data.text }));
61
+ case 'promo':
62
+ return (React.createElement(BetItemPromoCode, { description: item.data.description, logo: item.data.logo, qrCode: item.data.qrCode, title: item.data.title, showLogo: !!item.data.logo, key: item.id }));
63
+ default:
64
+ console.warn(`Unknown bet item type: ${item.type}`);
65
+ return null;
66
+ }
67
+ }
68
+ });
69
+ Object.defineProperty(this, "clearTabLoadFailure", {
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true,
73
+ value: () => {
74
+ this.vm.clearTabLoadFailure();
75
+ }
76
+ });
77
+ this.vm = SDK.getMaestroEventViewModel().betsViewModel;
78
+ this.state = {
79
+ container: null,
80
+ betsItems: this.vm.betsItems.value,
81
+ isDataLoading: this.vm.isDataLoading.value,
82
+ errorState: this.vm.errorState.value,
83
+ };
84
+ }
85
+ componentDidMount() {
86
+ this.setState({
87
+ container: this.container,
88
+ });
89
+ this.betsItemsUnsub = this.vm.betsItems.subscribe((value) => {
90
+ this.setState({ betsItems: value });
91
+ });
92
+ this.isDataLoadingUnsub = this.vm.isDataLoading.subscribe((value) => {
93
+ this.setState({ isDataLoading: value });
94
+ });
95
+ this.errorStateUnsub = this.vm.errorState.subscribe((value) => {
96
+ this.setState({ errorState: value });
97
+ });
98
+ // Initialize the view model
99
+ this.vm.init();
100
+ }
101
+ componentWillUnmount() {
102
+ this.betsItemsUnsub && this.betsItemsUnsub();
103
+ this.isDataLoadingUnsub && this.isDataLoadingUnsub();
104
+ this.errorStateUnsub && this.errorStateUnsub();
105
+ // Clean up the view model
106
+ this.vm.cleanup();
107
+ }
108
+ render() {
109
+ return (React.createElement(ScrollableContainer, { scrollableContainerRef: this.state.container, containerTopOffset: 40, "data-has-error": this.state.errorState !== 'none' }, this.state.errorState === 'tabLoadFailure' ? (React.createElement("div", null,
110
+ React.createElement(TabLoadFailureView, { onEnterPress: this.clearTabLoadFailure }),
111
+ React.createElement("div", { className: "bets-bottom-padding" }))) : (React.createElement("div", { className: "bets-view", ref: (e) => (this.container = e) },
112
+ this.state.betsItems.map(this.renderBetItem),
113
+ React.createElement("div", { className: "bets-bottom-padding" })))));
114
+ }
115
+ }
116
+ export default BetsView;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="prop-types" />
2
2
  import React from 'react';
3
3
  import { WithFocusableProps } from '@/external/spatial-navigation';
4
- import { Details, Direction, Layout } from '@/external/spatial-navigation/utils';
4
+ import { Direction, Layout } from '@/external/spatial-navigation/utils';
5
5
  import './HotPropsView.css';
6
6
  import { HotPropsBetItem } from '../../view-model/BetsViewModel';
7
7
  type HotPropsViewProps = {
@@ -11,6 +11,7 @@ type HotPropsViewProps = {
11
11
  declare const _default: {
12
12
  new (props?: (HotPropsViewProps & WithFocusableProps) | undefined, context?: any): {
13
13
  state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
14
+ navigation: import("../../../../external/spatial-navigation/spatialNavigation").default;
14
15
  getChildContext(): {
15
16
  parentFocusKey: string;
16
17
  };
@@ -19,12 +20,12 @@ declare const _default: {
19
20
  stealFocus: () => void;
20
21
  onUpdateFocus: (focused: boolean) => void;
21
22
  onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
22
- onEnterPressHandler: (details: Details) => void;
23
+ onEnterPressHandler: (details: import("@/external/spatial-navigation/utils").Details) => void;
23
24
  onEnterReleaseHandler: () => void;
24
- onBackPressHandler: (details: Details) => void;
25
- onArrowPressHandler: (direction: Direction, details: Details) => boolean | void;
26
- onBecameFocusedHandler: (layout: Layout, details: Details) => void;
27
- onBecameBlurredHandler: (layout: Layout, details: Details) => void;
25
+ onBackPressHandler: (details: import("@/external/spatial-navigation/utils").Details) => void;
26
+ onArrowPressHandler: (direction: Direction, details: import("@/external/spatial-navigation/utils").Details) => boolean | void;
27
+ onBecameFocusedHandler: (layout: Layout, details: import("@/external/spatial-navigation/utils").Details) => void;
28
+ onBecameBlurredHandler: (layout: Layout, details: import("@/external/spatial-navigation/utils").Details) => void;
28
29
  componentDidMount(): void;
29
30
  componentDidUpdate(): void;
30
31
  componentWillUnmount(): void;
@@ -0,0 +1,139 @@
1
+ import React from 'react';
2
+ import { withFocusable, } from '@/external/spatial-navigation';
3
+ import Bet from '../components/Bet/Bet';
4
+ import BetsCard from '../components/BetsCard/BetsCard';
5
+ import Icon from '@/components/atoms/SvgIcon/Icon';
6
+ import { DEFAULT_SCROLLABLE_CONTAINER_CONTEXT, SCROLLABLE_CONTEXT_TYPE, } from '@/components/core/ScrollableContainer/ScrollableContainer';
7
+ import './HotPropsView.css';
8
+ import BetsCardHeader from '../components/BetsCard/BetsCardHeader';
9
+ import SDK from '@/index';
10
+ const BETS_MIN_VISIBLE = 4;
11
+ class HotPropsView extends React.Component {
12
+ constructor() {
13
+ super(...arguments);
14
+ // Helper function to focus a specific bet by index
15
+ Object.defineProperty(this, "focusBet", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: (index) => {
20
+ SDK.getMaestroEventViewModel().navigation.setFocus(this.getBetFocusKey(index));
21
+ }
22
+ });
23
+ // Helper function to focus back to the card
24
+ Object.defineProperty(this, "focusCard", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: () => {
29
+ SDK.getMaestroEventViewModel().navigation.setFocus(this.getCardFocusKey());
30
+ }
31
+ });
32
+ // Helper function to get the total number of bets
33
+ Object.defineProperty(this, "getTotalBets", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: () => {
38
+ return this.props.item.data.items.length || 0;
39
+ }
40
+ });
41
+ Object.defineProperty(this, "handleEnterPress", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: () => {
46
+ SDK.getMaestroEventViewModel().navigation.setFocus(this.getBetFocusKey(0));
47
+ }
48
+ });
49
+ Object.defineProperty(this, "context", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: DEFAULT_SCROLLABLE_CONTAINER_CONTEXT
54
+ });
55
+ Object.defineProperty(this, "onCardBecameFocused", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: (layout) => {
60
+ this.context.scrollToFocusedElement(layout);
61
+ }
62
+ });
63
+ Object.defineProperty(this, "onBetBecameFocused", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: (layout) => {
68
+ this.context.scrollToFocusedElement(layout);
69
+ }
70
+ });
71
+ Object.defineProperty(this, "onBetArrowPress", {
72
+ enumerable: true,
73
+ configurable: true,
74
+ writable: true,
75
+ value: (index) => (direction, _props) => {
76
+ if (direction === 'left') {
77
+ SDK.getMaestroEventViewModel().deliverFocus();
78
+ }
79
+ if (index === 0 && direction === 'up') {
80
+ // If the first bet is focused and up arrow is pressed, focus the card itself
81
+ this.focusCard();
82
+ return false; // Prevent further propagation
83
+ }
84
+ }
85
+ });
86
+ Object.defineProperty(this, "onCardArrowPress", {
87
+ enumerable: true,
88
+ configurable: true,
89
+ writable: true,
90
+ value: (d, _props) => {
91
+ if (d === 'left') {
92
+ SDK.getMaestroEventViewModel().deliverFocus();
93
+ }
94
+ }
95
+ });
96
+ }
97
+ getBetFocusKey(index) {
98
+ return `hotprops-bet-${this.props.item.id}-${index}`;
99
+ }
100
+ getCardFocusKey() {
101
+ return `hot-props-${this.props.item.id}`;
102
+ }
103
+ renderFlameIcon() {
104
+ return React.createElement(Icon, { iconName: "flame", width: 20, height: 20 });
105
+ }
106
+ renderHeader(props) {
107
+ return (React.createElement(BetsCardHeader, { betCardProps: props, betType: "Hot Props", cardExpanded: !!this.props.hasFocusedChild, renderIcon: this.renderFlameIcon, legCount: this.getTotalBets(), legCountThreshold: BETS_MIN_VISIBLE }));
108
+ }
109
+ renderFooter(remaining, expanded) {
110
+ return !expanded && remaining > 0 ? (React.createElement("div", { className: "hot-props-footer" },
111
+ "+",
112
+ remaining,
113
+ " More")) : null;
114
+ }
115
+ get lineItems() {
116
+ const items = this.props.item.data.items;
117
+ if (this.props.hasFocusedChild) {
118
+ return items;
119
+ }
120
+ return items.slice(0, BETS_MIN_VISIBLE);
121
+ }
122
+ render() {
123
+ const { item, focused } = this.props;
124
+ const lineItems = item.data.items;
125
+ const remaining = lineItems.length - BETS_MIN_VISIBLE;
126
+ return (React.createElement("div", { className: "hot-props-bet-card" },
127
+ React.createElement(BetsCard, { focusKey: this.getCardFocusKey(), focused: focused, header: this.renderHeader.bind(this), footer: () => this.renderFooter(remaining, !!this.props.hasFocusedChild), onEnterPress: this.handleEnterPress, onBecameFocused: this.onCardBecameFocused, onArrowPress: this.onCardArrowPress },
128
+ React.createElement("div", { className: "hot-props-list" }, this.lineItems.map((item, idx) => {
129
+ return (React.createElement(Bet, { key: item.id, focusKey: this.getBetFocusKey(idx), leg: item, focusable: this.props.hasFocusedChild, onBackPress: this.focusCard, onBecameFocused: this.onBetBecameFocused, onArrowPress: this.onBetArrowPress(idx), parentFocusKey: this.props.focusKey }));
130
+ })))));
131
+ }
132
+ }
133
+ Object.defineProperty(HotPropsView, "contextTypes", {
134
+ enumerable: true,
135
+ configurable: true,
136
+ writable: true,
137
+ value: SCROLLABLE_CONTEXT_TYPE
138
+ });
139
+ export default withFocusable({ trackChildren: true })(HotPropsView);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import './SixPackView.style.css';
3
3
  import { WithFocusableProps } from '@/external/spatial-navigation';
4
- import { Details, Direction, Layout } from '@/external/spatial-navigation/utils';
4
+ import { Direction, Layout } from '@/external/spatial-navigation/utils';
5
5
  import { SixPackBetItem } from '../../view-model/BetsViewModel';
6
6
  type Props = WithFocusableProps & {
7
7
  item: SixPackBetItem;
@@ -14,7 +14,7 @@ export default class FocusableSixPackViewWrapper extends React.Component<Props>
14
14
  };
15
15
  context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
16
16
  onBecameFocused: (layout: Layout) => void;
17
- onArrowPress: (d: Direction, _props: any, details: Details) => void;
17
+ onArrowPress: (d: Direction, _props: any) => void;
18
18
  render(): React.JSX.Element;
19
19
  }
20
20
  export {};
@@ -0,0 +1,103 @@
1
+ import React from 'react';
2
+ import './SixPackView.style.css';
3
+ import { withFocusable, } from '@/external/spatial-navigation';
4
+ import FocusableItem from '@/components/core/ScrollableContainer/FocusableItem';
5
+ import { DEFAULT_SCROLLABLE_CONTAINER_CONTEXT, SCROLLABLE_CONTEXT_TYPE, } from '@/components/core/ScrollableContainer/ScrollableContainer';
6
+ import SDK from '@/index';
7
+ class SixPackView extends React.Component {
8
+ get columnOrder() {
9
+ switch (this.props.item.data.sport) {
10
+ case 'baseball':
11
+ case 'hockey':
12
+ case 'soccer':
13
+ return ['Moneyline', 'Total', 'Spread'];
14
+ default:
15
+ return ['Spread', 'Total', 'Moneyline'];
16
+ }
17
+ }
18
+ get isSoccer() {
19
+ return this.props.item.data.sport.toLocaleLowerCase() === 'soccer';
20
+ }
21
+ /**
22
+ * Some sports render columns in a different order.
23
+ */
24
+ renderOrderedLineColumn(line) {
25
+ return this.columnOrder.map((col) => {
26
+ switch (col) {
27
+ case 'Moneyline':
28
+ return React.createElement("td", { key: col }, line.moneylineFirstLine);
29
+ case 'Spread':
30
+ return (React.createElement("td", { key: col },
31
+ line.gameSpreadFirstLine,
32
+ React.createElement("br", null),
33
+ React.createElement("span", { className: "T02" }, line.gameSpreadSecondLine)));
34
+ case 'Total':
35
+ return (React.createElement("td", { key: col },
36
+ line.totalPointsFirstLine,
37
+ React.createElement("br", null),
38
+ React.createElement("span", { className: "T02" }, line.totalPointsSecondLine)));
39
+ default:
40
+ return null;
41
+ }
42
+ });
43
+ }
44
+ render() {
45
+ const data = this.props.item.data;
46
+ const lines = this.isSoccer
47
+ ? [data.homeTeamOdds, data.awayTeamOdds]
48
+ : [data.awayTeamOdds, data.homeTeamOdds];
49
+ return (React.createElement(FocusableItem, null,
50
+ React.createElement("table", { className: "six-pack-table focus-ring T02", "data-focused": this.props.focused },
51
+ React.createElement("thead", null,
52
+ React.createElement("tr", null,
53
+ React.createElement("th", { scope: "col" }),
54
+ React.createElement("th", { scope: "col" }, this.props.item.data.gameState === 'post' ? 'Close' : 'Open'),
55
+ this.columnOrder.map((col) => (React.createElement("th", { scope: "col", key: col }, col))))),
56
+ React.createElement("tbody", null, lines.map((line, index) => (React.createElement("tr", { key: index, className: "T05_ALT" },
57
+ React.createElement("td", null, line.teamAbbreviation),
58
+ React.createElement("td", null,
59
+ line.startOfGameFirstLine,
60
+ React.createElement("br", null),
61
+ React.createElement("span", { className: "T02" }, line.startOfGameSecondLine)),
62
+ this.renderOrderedLineColumn(line))))))));
63
+ }
64
+ }
65
+ const FocusableSixPackView = withFocusable()(SixPackView);
66
+ export default class FocusableSixPackViewWrapper extends React.Component {
67
+ constructor() {
68
+ super(...arguments);
69
+ Object.defineProperty(this, "context", {
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true,
73
+ value: DEFAULT_SCROLLABLE_CONTAINER_CONTEXT
74
+ });
75
+ Object.defineProperty(this, "onBecameFocused", {
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true,
79
+ value: (layout) => {
80
+ this.context.scrollToFocusedElement(layout);
81
+ }
82
+ });
83
+ Object.defineProperty(this, "onArrowPress", {
84
+ enumerable: true,
85
+ configurable: true,
86
+ writable: true,
87
+ value: (d, _props) => {
88
+ if (d === 'left') {
89
+ SDK.getMaestroEventViewModel().deliverFocus();
90
+ }
91
+ }
92
+ });
93
+ }
94
+ render() {
95
+ return (React.createElement(FocusableSixPackView, { ...this.props, onBecameFocused: this.onBecameFocused, onArrowPress: this.onArrowPress }));
96
+ }
97
+ }
98
+ Object.defineProperty(FocusableSixPackViewWrapper, "contextTypes", {
99
+ enumerable: true,
100
+ configurable: true,
101
+ writable: true,
102
+ value: SCROLLABLE_CONTEXT_TYPE
103
+ });
@@ -4,6 +4,7 @@ import { WithFocusableProps } from '@/external/spatial-navigation';
4
4
  declare const _default: {
5
5
  new (props?: (object & WithFocusableProps) | undefined, context?: any): {
6
6
  state: import("../../../external/spatial-navigation/withFocusable").WithFocusableState;
7
+ navigation: import("../../../external/spatial-navigation/spatialNavigation").default;
7
8
  getChildContext(): {
8
9
  parentFocusKey: string;
9
10
  };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import ActionButton from '@/components/molecules/ActionButton';
3
+ import { withFocusable, } from '@/external/spatial-navigation';
4
+ class TabLoadFailureView extends React.Component {
5
+ render() {
6
+ return (React.createElement("div", { "data-focused": this.props.focused, className: "bets-error-state-tabLoadFailure focus-ring" },
7
+ React.createElement("h3", { className: "T70" }, "Let's try that again..."),
8
+ React.createElement("p", { className: "T20" }, "We're having trouble loading this."),
9
+ React.createElement(ActionButton, { "data-focused": this.props.focused, onEnterPress: this.props.onEnterPress }, "Refresh")));
10
+ }
11
+ }
12
+ export default withFocusable()(TabLoadFailureView);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './BetResult.styles.css';
3
+ const BetResult = ({ children }) => {
4
+ return React.createElement("div", { className: "bet-result" }, children);
5
+ };
6
+ export default BetResult;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="prop-types" />
2
2
  import React from 'react';
3
3
  import { WithFocusableProps } from '@/external/spatial-navigation';
4
- import { Details, Direction, Layout } from '@/external/spatial-navigation/utils';
4
+ import { Direction, Layout } from '@/external/spatial-navigation/utils';
5
5
  import { IUserBet } from '@/modules/bets/interfaces/IBets';
6
6
  export declare const EVENTS_COUNT_THRESHOLD = 3;
7
7
  export type BaseBetCardProps = {
@@ -11,6 +11,7 @@ export type BaseBetCardProps = {
11
11
  declare const _default: {
12
12
  new (props?: (BaseBetCardProps & WithFocusableProps) | undefined, context?: any): {
13
13
  state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState;
14
+ navigation: import("../../../../../external/spatial-navigation/spatialNavigation").default;
14
15
  getChildContext(): {
15
16
  parentFocusKey: string;
16
17
  };
@@ -19,12 +20,12 @@ declare const _default: {
19
20
  stealFocus: () => void;
20
21
  onUpdateFocus: (focused: boolean) => void;
21
22
  onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
22
- onEnterPressHandler: (details: Details) => void;
23
+ onEnterPressHandler: (details: import("@/external/spatial-navigation/utils").Details) => void;
23
24
  onEnterReleaseHandler: () => void;
24
- onBackPressHandler: (details: Details) => void;
25
- onArrowPressHandler: (direction: Direction, details: Details) => boolean | void;
26
- onBecameFocusedHandler: (layout: Layout, details: Details) => void;
27
- onBecameBlurredHandler: (layout: Layout, details: Details) => void;
25
+ onBackPressHandler: (details: import("@/external/spatial-navigation/utils").Details) => void;
26
+ onArrowPressHandler: (direction: Direction, details: import("@/external/spatial-navigation/utils").Details) => boolean | void;
27
+ onBecameFocusedHandler: (layout: Layout, details: import("@/external/spatial-navigation/utils").Details) => void;
28
+ onBecameBlurredHandler: (layout: Layout, details: import("@/external/spatial-navigation/utils").Details) => void;
28
29
  componentDidMount(): void;
29
30
  componentDidUpdate(): void;
30
31
  componentWillUnmount(): void;
@@ -0,0 +1,122 @@
1
+ import React from 'react';
2
+ import { withFocusable, } from '@/external/spatial-navigation';
3
+ import BetsCard from '../../components/BetsCard/BetsCard';
4
+ import BetsCardHeader from '../../components/BetsCard/BetsCardHeader';
5
+ import BetsCardFooter from './BetsCardFooter';
6
+ import BetsCardEvent from './BetsCardEvent';
7
+ import { DEFAULT_SCROLLABLE_CONTAINER_CONTEXT, SCROLLABLE_CONTEXT_TYPE, } from '@/components/core/ScrollableContainer/ScrollableContainer';
8
+ import SDK from '@/index';
9
+ export const EVENTS_COUNT_THRESHOLD = 3;
10
+ class UserBetsCard extends React.Component {
11
+ constructor() {
12
+ super(...arguments);
13
+ Object.defineProperty(this, "context", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: DEFAULT_SCROLLABLE_CONTAINER_CONTEXT
18
+ });
19
+ Object.defineProperty(this, "onEnterPress", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: () => {
24
+ if (!this.betsFocusable) {
25
+ return;
26
+ }
27
+ if (!this.props.hasFocusedChild) {
28
+ // Set focus on the first bet of the first event
29
+ SDK.getMaestroEventViewModel().navigation.setFocus(`sdk-bets-card-${this.betType}-bet-${this.props.bet.id}-0-0`);
30
+ }
31
+ }
32
+ });
33
+ Object.defineProperty(this, "focusCard", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: () => {
38
+ // Focus the card itself
39
+ SDK.getMaestroEventViewModel().navigation.setFocus(`${this.focusKeyPrefix}-${this.props.bet.id}`);
40
+ }
41
+ });
42
+ Object.defineProperty(this, "handleBetArrowPress", {
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true,
46
+ value: (eventIndex, legIndex) => (d, _props) => {
47
+ if (d === 'up' && legIndex === 0 && eventIndex === 0) {
48
+ // If the first leg of the first event is focused and up arrow is pressed,
49
+ this.focusCard();
50
+ // Return false to prevent further propagation
51
+ return false;
52
+ }
53
+ if (d === 'left') {
54
+ SDK.getMaestroEventViewModel().deliverFocus();
55
+ }
56
+ }
57
+ });
58
+ Object.defineProperty(this, "handleCardArrowPress", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: (d, _props) => {
63
+ if (d === 'left') {
64
+ SDK.getMaestroEventViewModel().deliverFocus();
65
+ }
66
+ }
67
+ });
68
+ Object.defineProperty(this, "renderHeader", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: (headerProps) => {
73
+ return (React.createElement(BetsCardHeader, { betCardProps: headerProps, betType: this.betType, iconUrl: this.props.bet.rewardInfo.icon?.dark, legCount: this.props.bet.legCount, outcome: this.props.bet.outcome, overrideOutcome: this.props.bet.overrideOutcome, cardExpanded: !!this.props.hasFocusedChild, legCountThreshold: EVENTS_COUNT_THRESHOLD }, this.props.renderHeaderContent?.(headerProps)));
74
+ }
75
+ });
76
+ Object.defineProperty(this, "renderFooter", {
77
+ enumerable: true,
78
+ configurable: true,
79
+ writable: true,
80
+ value: () => {
81
+ return React.createElement(BetsCardFooter, { bet: this.props.bet });
82
+ }
83
+ });
84
+ Object.defineProperty(this, "becameFocused", {
85
+ enumerable: true,
86
+ configurable: true,
87
+ writable: true,
88
+ value: (layout) => {
89
+ this.context.scrollToFocusedElement(layout);
90
+ }
91
+ });
92
+ }
93
+ get betsFocusable() {
94
+ return this.props.bet.events.length > EVENTS_COUNT_THRESHOLD;
95
+ }
96
+ get events() {
97
+ return this.props.hasFocusedChild
98
+ ? this.props.bet.events
99
+ : this.props.bet.events.slice(0, EVENTS_COUNT_THRESHOLD);
100
+ }
101
+ get focusKeyPrefix() {
102
+ return `sdk-${this.props.bet.type.toLowerCase()}-card`;
103
+ }
104
+ get betType() {
105
+ return this.props.bet.type.toLowerCase();
106
+ }
107
+ render() {
108
+ return (React.createElement(BetsCard, { header: this.renderHeader, footer: this.renderFooter, onEnterPress: this.onEnterPress, focusKey: `${this.focusKeyPrefix}-${this.props.bet.id}`, onArrowPress: this.handleCardArrowPress, onBecameFocused: this.becameFocused, focused: this.props.focused },
109
+ this.events.map((event, eventIndex) => (React.createElement(BetsCardEvent, { betType: this.betType, betsFocusable: this.betsFocusable, event: event, eventIndex: eventIndex, onBetArrowPress: this.handleBetArrowPress, key: event.displayName, betId: this.props.bet.id, parentFocusKey: this.props.focusKey, onBetBackPress: this.focusCard }))),
110
+ !this.props.hasFocusedChild && this.betsFocusable && (React.createElement("div", { className: "more-bets T05_ALT" },
111
+ "+",
112
+ this.props.bet.legCount - EVENTS_COUNT_THRESHOLD,
113
+ " more"))));
114
+ }
115
+ }
116
+ Object.defineProperty(UserBetsCard, "contextTypes", {
117
+ enumerable: true,
118
+ configurable: true,
119
+ writable: true,
120
+ value: SCROLLABLE_CONTEXT_TYPE
121
+ });
122
+ export default withFocusable({ trackChildren: true })(UserBetsCard);
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import Bet from '../../components/Bet/Bet';
3
+ import { DEFAULT_SCROLLABLE_CONTAINER_CONTEXT, SCROLLABLE_CONTEXT_TYPE, } from '@/components/core/ScrollableContainer/ScrollableContainer';
4
+ class BetsCardEvent extends React.Component {
5
+ constructor() {
6
+ super(...arguments);
7
+ Object.defineProperty(this, "context", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: DEFAULT_SCROLLABLE_CONTAINER_CONTEXT
12
+ });
13
+ Object.defineProperty(this, "onBecameFocused", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: (layout) => {
18
+ this.context.scrollToFocusedElement(layout);
19
+ }
20
+ });
21
+ }
22
+ render() {
23
+ return (React.createElement("div", { key: this.props.event.displayName, className: "bets-card-event T10" },
24
+ React.createElement("div", { className: "T10" }, this.props.event.displayName),
25
+ React.createElement("div", { className: "bets-card-bets" }, this.props.event.legs.map((leg, index) => (React.createElement(Bet, { key: `${this.props.betId}-${this.props.eventIndex}-${index}`, focusable: this.props.betsFocusable, focusKey: `sdk-bets-card-${this.props.betType}-bet-${this.props.betId}-${this.props.eventIndex}-${index}`, onArrowPress: this.props.onBetArrowPress(this.props.eventIndex, index), onBecameFocused: this.onBecameFocused, parentFocusKey: this.props.parentFocusKey, onBackPress: this.props.onBetBackPress, leg: leg }))))));
26
+ }
27
+ }
28
+ Object.defineProperty(BetsCardEvent, "contextTypes", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: SCROLLABLE_CONTEXT_TYPE
33
+ });
34
+ export default BetsCardEvent;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import BetPill from '../../components/BetPill/BetPill';
3
+ import BetResult from '../../UserBets/BetResult/BetResult';
4
+ const BetsCardFooter = (props) => {
5
+ const outcome = props.bet.overrideOutcome !== 'NOT_SET'
6
+ ? props.bet.overrideOutcome
7
+ : props.bet.outcome;
8
+ return (React.createElement("div", { className: "bets-card-footer T02" },
9
+ React.createElement(BetPill, null,
10
+ "$",
11
+ props.bet.betAmount,
12
+ " ",
13
+ props.bet.type.toLowerCase(),
14
+ " ",
15
+ props.bet.odds),
16
+ outcome !== 'LOSS' && (React.createElement(BetResult, null,
17
+ props.bet.betDisplayStatement,
18
+ React.createElement("span", null,
19
+ "$",
20
+ props.bet.payoutAmount)))));
21
+ };
22
+ export default BetsCardFooter;