@maestro_io/maestro-web-sdk 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/index.d.ts +7 -6
- package/dist/maestro-web-sdk.esm.js +1 -10
- package/dist/maestro-web-sdk.esm.js.map +1 -1
- package/dist/maestro-web-sdk.umd.js +1 -10
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/package.json +32 -33
- package/dist/1.maestro-web-sdk.esm.js +0 -2
- package/dist/1.maestro-web-sdk.esm.js.map +0 -1
- package/dist/10.maestro-web-sdk.esm.js +0 -2
- package/dist/10.maestro-web-sdk.esm.js.map +0 -1
- package/dist/11.maestro-web-sdk.esm.js +0 -2
- package/dist/11.maestro-web-sdk.esm.js.map +0 -1
- package/dist/12.maestro-web-sdk.esm.js +0 -2
- package/dist/12.maestro-web-sdk.esm.js.map +0 -1
- package/dist/13.maestro-web-sdk.esm.js +0 -2
- package/dist/13.maestro-web-sdk.esm.js.map +0 -1
- package/dist/14.maestro-web-sdk.esm.js +0 -2
- package/dist/14.maestro-web-sdk.esm.js.map +0 -1
- package/dist/15.maestro-web-sdk.esm.js +0 -2
- package/dist/15.maestro-web-sdk.esm.js.map +0 -1
- package/dist/16.maestro-web-sdk.esm.js +0 -2
- package/dist/16.maestro-web-sdk.esm.js.map +0 -1
- package/dist/17.maestro-web-sdk.esm.js +0 -2
- package/dist/17.maestro-web-sdk.esm.js.map +0 -1
- package/dist/18.maestro-web-sdk.esm.js +0 -2
- package/dist/18.maestro-web-sdk.esm.js.map +0 -1
- package/dist/19.maestro-web-sdk.esm.js +0 -2
- package/dist/19.maestro-web-sdk.esm.js.map +0 -1
- package/dist/2.maestro-web-sdk.esm.js +0 -2
- package/dist/2.maestro-web-sdk.esm.js.map +0 -1
- package/dist/20.maestro-web-sdk.esm.js +0 -2
- package/dist/20.maestro-web-sdk.esm.js.map +0 -1
- package/dist/21.maestro-web-sdk.esm.js +0 -2
- package/dist/21.maestro-web-sdk.esm.js.map +0 -1
- package/dist/22.maestro-web-sdk.esm.js +0 -2
- package/dist/22.maestro-web-sdk.esm.js.map +0 -1
- package/dist/23.maestro-web-sdk.esm.js +0 -2
- package/dist/23.maestro-web-sdk.esm.js.map +0 -1
- package/dist/24.maestro-web-sdk.esm.js +0 -2
- package/dist/24.maestro-web-sdk.esm.js.map +0 -1
- package/dist/25.maestro-web-sdk.esm.js +0 -2
- package/dist/25.maestro-web-sdk.esm.js.map +0 -1
- package/dist/26.maestro-web-sdk.esm.js +0 -2
- package/dist/26.maestro-web-sdk.esm.js.map +0 -1
- package/dist/27.maestro-web-sdk.esm.js +0 -2
- package/dist/27.maestro-web-sdk.esm.js.map +0 -1
- package/dist/28.maestro-web-sdk.esm.js +0 -2
- package/dist/28.maestro-web-sdk.esm.js.map +0 -1
- package/dist/29.maestro-web-sdk.esm.js +0 -2
- package/dist/29.maestro-web-sdk.esm.js.map +0 -1
- package/dist/3.maestro-web-sdk.esm.js +0 -2
- package/dist/3.maestro-web-sdk.esm.js.map +0 -1
- package/dist/30.maestro-web-sdk.esm.js +0 -2
- package/dist/30.maestro-web-sdk.esm.js.map +0 -1
- package/dist/31.maestro-web-sdk.esm.js +0 -2
- package/dist/31.maestro-web-sdk.esm.js.map +0 -1
- package/dist/32.maestro-web-sdk.esm.js +0 -2
- package/dist/32.maestro-web-sdk.esm.js.map +0 -1
- package/dist/33.maestro-web-sdk.esm.js +0 -2
- package/dist/33.maestro-web-sdk.esm.js.map +0 -1
- package/dist/34.maestro-web-sdk.esm.js +0 -2
- package/dist/34.maestro-web-sdk.esm.js.map +0 -1
- package/dist/35.maestro-web-sdk.esm.js +0 -2
- package/dist/35.maestro-web-sdk.esm.js.map +0 -1
- package/dist/36.maestro-web-sdk.esm.js +0 -2
- package/dist/36.maestro-web-sdk.esm.js.map +0 -1
- package/dist/37.maestro-web-sdk.esm.js +0 -2
- package/dist/37.maestro-web-sdk.esm.js.map +0 -1
- package/dist/38.maestro-web-sdk.esm.js +0 -2
- package/dist/38.maestro-web-sdk.esm.js.map +0 -1
- package/dist/39.maestro-web-sdk.esm.js +0 -2
- package/dist/39.maestro-web-sdk.esm.js.map +0 -1
- package/dist/4.maestro-web-sdk.esm.js +0 -2
- package/dist/4.maestro-web-sdk.esm.js.map +0 -1
- package/dist/40.maestro-web-sdk.esm.js +0 -2
- package/dist/40.maestro-web-sdk.esm.js.map +0 -1
- package/dist/5.maestro-web-sdk.esm.js +0 -2
- package/dist/5.maestro-web-sdk.esm.js.map +0 -1
- package/dist/6.maestro-web-sdk.esm.js +0 -2
- package/dist/6.maestro-web-sdk.esm.js.map +0 -1
- package/dist/7.maestro-web-sdk.esm.js +0 -2
- package/dist/7.maestro-web-sdk.esm.js.map +0 -1
- package/dist/8.maestro-web-sdk.esm.js +0 -2
- package/dist/8.maestro-web-sdk.esm.js.map +0 -1
- package/dist/9.maestro-web-sdk.esm.js +0 -2
- package/dist/9.maestro-web-sdk.esm.js.map +0 -1
- package/dist/package.json +0 -94
- package/dist/src/components/atoms/BaseButton/BaseButton.d.ts +0 -7
- package/dist/src/components/atoms/BaseButton/BaseButton.js +0 -11
- package/dist/src/components/atoms/BaseButton/index.d.ts +0 -2
- package/dist/src/components/atoms/BaseButton/index.js +0 -2
- package/dist/src/components/atoms/Image/index.d.ts +0 -13
- package/dist/src/components/atoms/Image/index.js +0 -34
- package/dist/src/components/atoms/Rive/index.d.ts +0 -221
- package/dist/src/components/atoms/Rive/index.js +0 -53
- package/dist/src/components/atoms/SvgIcon/AddIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/AddIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/BetGeneralIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/BetGeneralIcon.js +0 -9
- package/dist/src/components/atoms/SvgIcon/BetsIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/BetsIcon.js +0 -8
- package/dist/src/components/atoms/SvgIcon/BetsWarningIcon.d.ts +0 -7
- package/dist/src/components/atoms/SvgIcon/BetsWarningIcon.js +0 -11
- package/dist/src/components/atoms/SvgIcon/BuilderIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/BuilderIcon.js +0 -8
- package/dist/src/components/atoms/SvgIcon/ChatIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/ChatIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/CheckmarkIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/CheckmarkIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/CollapseIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/CollapseIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/ExpandIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/ExpandIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/FantasyIcon.d.ts +0 -7
- package/dist/src/components/atoms/SvgIcon/FantasyIcon.js +0 -15
- package/dist/src/components/atoms/SvgIcon/FlameIcon.d.ts +0 -7
- package/dist/src/components/atoms/SvgIcon/FlameIcon.js +0 -11
- package/dist/src/components/atoms/SvgIcon/FoxKeyPlaysIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/FoxKeyPlaysIcon.js +0 -7
- package/dist/src/components/atoms/SvgIcon/FoxMultiViewIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/FoxMultiViewIcon.js +0 -10
- package/dist/src/components/atoms/SvgIcon/FoxStatsIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/FoxStatsIcon.js +0 -7
- package/dist/src/components/atoms/SvgIcon/HelloWorldIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/HelloWorldIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/Icon.d.ts +0 -15
- package/dist/src/components/atoms/SvgIcon/Icon.js +0 -70
- package/dist/src/components/atoms/SvgIcon/KeyPlaysIcon.d.ts +0 -6
- package/dist/src/components/atoms/SvgIcon/KeyPlaysIcon.js +0 -10
- package/dist/src/components/atoms/SvgIcon/MobilePhoneIcon.d.ts +0 -7
- package/dist/src/components/atoms/SvgIcon/MobilePhoneIcon.js +0 -11
- package/dist/src/components/atoms/SvgIcon/PlayIcon.d.ts +0 -6
- package/dist/src/components/atoms/SvgIcon/PlayIcon.js +0 -8
- package/dist/src/components/atoms/SvgIcon/ShopIcon.d.ts +0 -5
- package/dist/src/components/atoms/SvgIcon/ShopIcon.js +0 -7
- package/dist/src/components/atoms/SvgIcon/ShopifyIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/ShopifyIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/StatsIcon.d.ts +0 -6
- package/dist/src/components/atoms/SvgIcon/StatsIcon.js +0 -12
- package/dist/src/components/atoms/SvgIcon/TimesIcon.d.ts +0 -3
- package/dist/src/components/atoms/SvgIcon/TimesIcon.js +0 -6
- package/dist/src/components/atoms/SvgIcon/WarningIcon.d.ts +0 -6
- package/dist/src/components/atoms/SvgIcon/WarningIcon.js +0 -8
- package/dist/src/components/atoms/SvgIcon/index.d.ts +0 -2
- package/dist/src/components/atoms/SvgIcon/index.js +0 -2
- package/dist/src/components/core/App/App.d.ts +0 -11
- package/dist/src/components/core/App/App.js +0 -35
- package/dist/src/components/core/App/index.d.ts +0 -2
- package/dist/src/components/core/App/index.js +0 -2
- package/dist/src/components/core/PanelManager/PanelManager.d.ts +0 -21
- package/dist/src/components/core/PanelManager/PanelManager.js +0 -104
- package/dist/src/components/core/PanelManager/index.d.ts +0 -2
- package/dist/src/components/core/PanelManager/index.js +0 -2
- package/dist/src/components/core/ScrollableContainer/FocusableItem.d.ts +0 -11
- package/dist/src/components/core/ScrollableContainer/FocusableItem.js +0 -24
- package/dist/src/components/core/ScrollableContainer/ScrollableContainer.d.ts +0 -54
- package/dist/src/components/core/ScrollableContainer/ScrollableContainer.js +0 -111
- package/dist/src/components/core/ScrollableContainer/index.d.ts +0 -6
- package/dist/src/components/core/ScrollableContainer/index.js +0 -5
- package/dist/src/components/core/ScrollableContainer/useScrollableContainer.d.ts +0 -14
- package/dist/src/components/core/ScrollableContainer/useScrollableContainer.js +0 -22
- package/dist/src/components/molecules/ActionButton/ActionButton.d.ts +0 -96
- package/dist/src/components/molecules/ActionButton/ActionButton.js +0 -15
- package/dist/src/components/molecules/ActionButton/index.d.ts +0 -2
- package/dist/src/components/molecules/ActionButton/index.js +0 -2
- package/dist/src/components/molecules/HeadshotImage/HeadshotImage.d.ts +0 -16
- package/dist/src/components/molecules/HeadshotImage/HeadshotImage.js +0 -50
- package/dist/src/components/molecules/HeadshotImage/index.d.ts +0 -2
- package/dist/src/components/molecules/HeadshotImage/index.js +0 -2
- package/dist/src/components/molecules/NetworkDialog/NetworkDialog.d.ts +0 -11
- package/dist/src/components/molecules/NetworkDialog/NetworkDialog.js +0 -34
- package/dist/src/components/molecules/NetworkDialog/index.d.ts +0 -2
- package/dist/src/components/molecules/NetworkDialog/index.js +0 -2
- package/dist/src/components/molecules/NetworkError/NetworkError.d.ts +0 -104
- package/dist/src/components/molecules/NetworkError/NetworkError.js +0 -26
- package/dist/src/components/molecules/NetworkError/index.d.ts +0 -2
- package/dist/src/components/molecules/NetworkError/index.js +0 -2
- package/dist/src/components/molecules/PanelNavButton/PanelNavButton.d.ts +0 -107
- package/dist/src/components/molecules/PanelNavButton/PanelNavButton.js +0 -36
- package/dist/src/components/molecules/PanelNavButton/index.d.ts +0 -2
- package/dist/src/components/molecules/PanelNavButton/index.js +0 -2
- package/dist/src/components/molecules/SegmentButton/SegmentButton.d.ts +0 -9
- package/dist/src/components/molecules/SegmentButton/SegmentButton.js +0 -10
- package/dist/src/components/molecules/SegmentButton/index.d.ts +0 -2
- package/dist/src/components/molecules/SegmentButton/index.js +0 -2
- package/dist/src/components/molecules/TabLoadError/TabLoadError.d.ts +0 -96
- package/dist/src/components/molecules/TabLoadError/TabLoadError.js +0 -14
- package/dist/src/components/molecules/TabLoadError/index.d.ts +0 -2
- package/dist/src/components/molecules/TabLoadError/index.js +0 -2
- package/dist/src/components/molecules/WatchButton/WatchButton.d.ts +0 -10
- package/dist/src/components/molecules/WatchButton/WatchButton.js +0 -15
- package/dist/src/components/molecules/WatchButton/index.d.ts +0 -2
- package/dist/src/components/molecules/WatchButton/index.js +0 -2
- package/dist/src/components/organisms/PanelNavigation/PanelNavigation.d.ts +0 -17
- package/dist/src/components/organisms/PanelNavigation/PanelNavigation.js +0 -64
- package/dist/src/components/organisms/PanelNavigation/index.d.ts +0 -2
- package/dist/src/components/organisms/PanelNavigation/index.js +0 -2
- package/dist/src/components/organisms/SegmentController/SegmentController.d.ts +0 -12
- package/dist/src/components/organisms/SegmentController/SegmentController.js +0 -35
- package/dist/src/components/organisms/SegmentController/index.d.ts +0 -3
- package/dist/src/components/organisms/SegmentController/index.js +0 -2
- package/dist/src/development/MaestroEventDelegate.d.ts +0 -27
- package/dist/src/development/MaestroEventDelegate.js +0 -110
- package/dist/src/development/TimeSeek.d.ts +0 -22
- package/dist/src/development/TimeSeek.js +0 -218
- package/dist/src/development/development.d.ts +0 -1
- package/dist/src/development/development.js +0 -39
- package/dist/src/external/AxiosNetworkClient.d.ts +0 -28
- package/dist/src/external/AxiosNetworkClient.js +0 -110
- package/dist/src/external/LocalStorageCacheManager.d.ts +0 -65
- package/dist/src/external/LocalStorageCacheManager.js +0 -213
- package/dist/src/external/ReactRenderer.d.ts +0 -17
- package/dist/src/external/ReactRenderer.js +0 -66
- package/dist/src/external/mocks/MockExternalNetworkClient.d.ts +0 -104
- package/dist/src/external/mocks/MockExternalNetworkClient.js +0 -187
- package/dist/src/external/ports/cacheManager.d.ts +0 -17
- package/dist/src/external/ports/cacheManager.js +0 -1
- package/dist/src/external/ports/networkClient.d.ts +0 -19
- package/dist/src/external/ports/networkClient.js +0 -1
- package/dist/src/external/ports/renderer.d.ts +0 -4
- package/dist/src/external/ports/renderer.js +0 -1
- package/dist/src/external/spatial-navigation/__mocks__/withFocusable.d.ts +0 -8
- package/dist/src/external/spatial-navigation/__mocks__/withFocusable.js +0 -7
- package/dist/src/external/spatial-navigation/index.d.ts +0 -4
- package/dist/src/external/spatial-navigation/index.js +0 -3
- package/dist/src/external/spatial-navigation/measureLayout.d.ts +0 -2
- package/dist/src/external/spatial-navigation/measureLayout.js +0 -30
- package/dist/src/external/spatial-navigation/spatialNavigation.d.ts +0 -160
- package/dist/src/external/spatial-navigation/spatialNavigation.js +0 -944
- package/dist/src/external/spatial-navigation/utils.d.ts +0 -22
- package/dist/src/external/spatial-navigation/utils.js +0 -6
- package/dist/src/external/spatial-navigation/visualDebugger.d.ts +0 -17
- package/dist/src/external/spatial-navigation/visualDebugger.js +0 -76
- package/dist/src/external/spatial-navigation/withFocusable.d.ts +0 -131
- package/dist/src/external/spatial-navigation/withFocusable.js +0 -254
- package/dist/src/helpers/Observable.d.ts +0 -12
- package/dist/src/helpers/Observable.js +0 -37
- package/dist/src/helpers/site.d.ts +0 -1
- package/dist/src/helpers/site.js +0 -6
- package/dist/src/helpers/siteConfig.d.ts +0 -1
- package/dist/src/helpers/siteConfig.js +0 -5
- package/dist/src/helpers/strings.d.ts +0 -2
- package/dist/src/helpers/strings.js +0 -14
- package/dist/src/helpers/url.d.ts +0 -1
- package/dist/src/helpers/url.js +0 -12
- package/dist/src/hooks/useMaxHeightToBottom.d.ts +0 -11
- package/dist/src/hooks/useMaxHeightToBottom.js +0 -48
- package/dist/src/index.d.ts +0 -53
- package/dist/src/index.js +0 -197
- package/dist/src/interfaces/IMaestroEvent.d.ts +0 -108
- package/dist/src/interfaces/IMaestroEvent.js +0 -1
- package/dist/src/interfaces/IMaestroEventDelegate.d.ts +0 -81
- package/dist/src/interfaces/IMaestroEventDelegate.js +0 -1
- package/dist/src/interfaces/IMaestroManager.d.ts +0 -81
- package/dist/src/interfaces/IMaestroManager.js +0 -1
- package/dist/src/interfaces/IUserSettings.d.ts +0 -44
- package/dist/src/interfaces/IUserSettings.js +0 -20
- package/dist/src/models/IModel.d.ts +0 -7
- package/dist/src/models/IModel.js +0 -1
- package/dist/src/models/IPanel.d.ts +0 -19
- package/dist/src/models/IPanel.js +0 -12
- package/dist/src/models/ITheme.d.ts +0 -77
- package/dist/src/models/ITheme.js +0 -20
- package/dist/src/modules/espn/bets/interfaces/IBets.d.ts +0 -192
- package/dist/src/modules/espn/bets/interfaces/IBets.js +0 -1
- package/dist/src/modules/espn/bets/interfaces/IBetsViewModel.d.ts +0 -5
- package/dist/src/modules/espn/bets/interfaces/IBetsViewModel.js +0 -1
- package/dist/src/modules/espn/bets/mocks.d.ts +0 -2
- package/dist/src/modules/espn/bets/mocks.js +0 -573
- package/dist/src/modules/espn/bets/services/BetsService.d.ts +0 -81
- package/dist/src/modules/espn/bets/services/BetsService.js +0 -123
- package/dist/src/modules/espn/bets/types/BetsAnalyticsTypes.d.ts +0 -8
- package/dist/src/modules/espn/bets/types/BetsAnalyticsTypes.js +0 -1
- package/dist/src/modules/espn/bets/view/BetsView.d.ts +0 -30
- package/dist/src/modules/espn/bets/view/BetsView.js +0 -169
- package/dist/src/modules/espn/bets/view/HotProps/HotPropsView.d.ts +0 -103
- package/dist/src/modules/espn/bets/view/HotProps/HotPropsView.js +0 -133
- package/dist/src/modules/espn/bets/view/SixPack/SixPackView.d.ts +0 -9
- package/dist/src/modules/espn/bets/view/SixPack/SixPackView.js +0 -77
- package/dist/src/modules/espn/bets/view/UserBets/BetResult/BetResult.d.ts +0 -6
- package/dist/src/modules/espn/bets/view/UserBets/BetResult/BetResult.js +0 -6
- package/dist/src/modules/espn/bets/view/UserBets/BetsCard/BetsCard.d.ts +0 -104
- package/dist/src/modules/espn/bets/view/UserBets/BetsCard/BetsCard.js +0 -140
- package/dist/src/modules/espn/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +0 -16
- package/dist/src/modules/espn/bets/view/UserBets/BetsCard/BetsCardEvent.js +0 -8
- package/dist/src/modules/espn/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +0 -7
- package/dist/src/modules/espn/bets/view/UserBets/BetsCard/BetsCardFooter.js +0 -18
- package/dist/src/modules/espn/bets/view/UserBets/Boost/Boost.d.ts +0 -7
- package/dist/src/modules/espn/bets/view/UserBets/Boost/Boost.js +0 -6
- package/dist/src/modules/espn/bets/view/UserBets/OutcomeBadge/OutcomeBadge.d.ts +0 -6
- package/dist/src/modules/espn/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +0 -9
- package/dist/src/modules/espn/bets/view/UserBets/Parlay/Parlay.d.ts +0 -8
- package/dist/src/modules/espn/bets/view/UserBets/Parlay/Parlay.js +0 -13
- package/dist/src/modules/espn/bets/view/UserBets/Straight/Straight.d.ts +0 -7
- package/dist/src/modules/espn/bets/view/UserBets/Straight/Straight.js +0 -6
- package/dist/src/modules/espn/bets/view/UserBets/Teaser/Teaser.d.ts +0 -7
- package/dist/src/modules/espn/bets/view/UserBets/Teaser/Teaser.js +0 -13
- package/dist/src/modules/espn/bets/view/UserBets/UserBetsView.d.ts +0 -25
- package/dist/src/modules/espn/bets/view/UserBets/UserBetsView.js +0 -107
- package/dist/src/modules/espn/bets/view/components/Bet/Bet.d.ts +0 -10
- package/dist/src/modules/espn/bets/view/components/Bet/Bet.js +0 -41
- package/dist/src/modules/espn/bets/view/components/BetPill/BetPill.d.ts +0 -6
- package/dist/src/modules/espn/bets/view/components/BetPill/BetPill.js +0 -6
- package/dist/src/modules/espn/bets/view/components/BetsCard/BetsCard.d.ts +0 -10
- package/dist/src/modules/espn/bets/view/components/BetsCard/BetsCard.js +0 -24
- package/dist/src/modules/espn/bets/view/components/BetsCard/BetsCardHeader.d.ts +0 -16
- package/dist/src/modules/espn/bets/view/components/BetsCard/BetsCardHeader.js +0 -20
- package/dist/src/modules/espn/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.d.ts +0 -7
- package/dist/src/modules/espn/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +0 -31
- package/dist/src/modules/espn/bets/view/components/GamblingDisclaimer/index.d.ts +0 -1
- package/dist/src/modules/espn/bets/view/components/GamblingDisclaimer/index.js +0 -1
- package/dist/src/modules/espn/bets/view/components/LocationWarning/LocationWarning.d.ts +0 -10
- package/dist/src/modules/espn/bets/view/components/LocationWarning/LocationWarning.js +0 -16
- package/dist/src/modules/espn/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +0 -5
- package/dist/src/modules/espn/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +0 -45
- package/dist/src/modules/espn/bets/view/components/PromoCodeBanner/index.d.ts +0 -1
- package/dist/src/modules/espn/bets/view/components/PromoCodeBanner/index.js +0 -1
- package/dist/src/modules/espn/bets/view-model/BetsViewModel.d.ts +0 -218
- package/dist/src/modules/espn/bets/view-model/BetsViewModel.js +0 -947
- package/dist/src/modules/espn/components/TabLoadError/TabLoadError.d.ts +0 -96
- package/dist/src/modules/espn/components/TabLoadError/TabLoadError.js +0 -14
- package/dist/src/modules/espn/components/TabLoadError/index.d.ts +0 -2
- package/dist/src/modules/espn/components/TabLoadError/index.js +0 -2
- package/dist/src/modules/espn/fantasy/components/ExpandedAthleteList/ExpandedAthletesList.d.ts +0 -28
- package/dist/src/modules/espn/fantasy/components/ExpandedAthleteList/ExpandedAthletesList.js +0 -107
- package/dist/src/modules/espn/fantasy/components/ExpandedAthleteList/index.d.ts +0 -1
- package/dist/src/modules/espn/fantasy/components/ExpandedAthleteList/index.js +0 -1
- package/dist/src/modules/espn/fantasy/components/LeagueCard/LeagueCard.d.ts +0 -104
- package/dist/src/modules/espn/fantasy/components/LeagueCard/LeagueCard.js +0 -20
- package/dist/src/modules/espn/fantasy/components/LeagueCard/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/components/LeagueCard/index.js +0 -2
- package/dist/src/modules/espn/fantasy/components/TopPlayerCard/TopPlayerCard.d.ts +0 -101
- package/dist/src/modules/espn/fantasy/components/TopPlayerCard/TopPlayerCard.js +0 -29
- package/dist/src/modules/espn/fantasy/components/TopPlayerCard/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/components/TopPlayerCard/index.js +0 -2
- package/dist/src/modules/espn/fantasy/components/TournamentOverflowQR/TournamentOverflowQR.d.ts +0 -103
- package/dist/src/modules/espn/fantasy/components/TournamentOverflowQR/TournamentOverflowQR.js +0 -28
- package/dist/src/modules/espn/fantasy/components/TournamentOverflowQR/index.d.ts +0 -1
- package/dist/src/modules/espn/fantasy/components/TournamentOverflowQR/index.js +0 -1
- package/dist/src/modules/espn/fantasy/mocks.d.ts +0 -7620
- package/dist/src/modules/espn/fantasy/mocks.js +0 -3682
- package/dist/src/modules/espn/fantasy/services/FantasyService.d.ts +0 -76
- package/dist/src/modules/espn/fantasy/services/FantasyService.js +0 -124
- package/dist/src/modules/espn/fantasy/types.d.ts +0 -294
- package/dist/src/modules/espn/fantasy/types.js +0 -9
- package/dist/src/modules/espn/fantasy/view/ActiveAthletesMarquee/ActiveAthletesMarquee.d.ts +0 -21
- package/dist/src/modules/espn/fantasy/view/ActiveAthletesMarquee/ActiveAthletesMarquee.js +0 -74
- package/dist/src/modules/espn/fantasy/view/ActiveAthletesMarquee/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/ActiveAthletesMarquee/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/FantasyHeaderView.d.ts +0 -8
- package/dist/src/modules/espn/fantasy/view/FantasyHeaderView.js +0 -8
- package/dist/src/modules/espn/fantasy/view/FantasyItemView.d.ts +0 -8
- package/dist/src/modules/espn/fantasy/view/FantasyItemView.js +0 -48
- package/dist/src/modules/espn/fantasy/view/FantasyView.d.ts +0 -34
- package/dist/src/modules/espn/fantasy/view/FantasyView.js +0 -212
- package/dist/src/modules/espn/fantasy/view/InactiveLeague/DraftDateCountdown.d.ts +0 -23
- package/dist/src/modules/espn/fantasy/view/InactiveLeague/DraftDateCountdown.js +0 -95
- package/dist/src/modules/espn/fantasy/view/InactiveLeague/InactiveLeague.d.ts +0 -100
- package/dist/src/modules/espn/fantasy/view/InactiveLeague/InactiveLeague.js +0 -13
- package/dist/src/modules/espn/fantasy/view/InactiveLeague/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/InactiveLeague/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/LoginView/LoginView.d.ts +0 -96
- package/dist/src/modules/espn/fantasy/view/LoginView/LoginView.js +0 -27
- package/dist/src/modules/espn/fantasy/view/LoginView/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/LoginView/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupPair/DoubleAthleteCard/DoubleAthleteCard.d.ts +0 -97
- package/dist/src/modules/espn/fantasy/view/MatchupPair/DoubleAthleteCard/DoubleAthleteCard.js +0 -25
- package/dist/src/modules/espn/fantasy/view/MatchupPair/DoubleAthleteCard/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupPair/DoubleAthleteCard/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupPair/ExpandedDoubleAthleteCards.d.ts +0 -14
- package/dist/src/modules/espn/fantasy/view/MatchupPair/ExpandedDoubleAthleteCards.js +0 -9
- package/dist/src/modules/espn/fantasy/view/MatchupPair/MatchupPair.d.ts +0 -102
- package/dist/src/modules/espn/fantasy/view/MatchupPair/MatchupPair.js +0 -118
- package/dist/src/modules/espn/fantasy/view/MatchupPair/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupPair/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/ExpandedSingleAthleteCards.d.ts +0 -14
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/ExpandedSingleAthleteCards.js +0 -9
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/MatchupSingle.d.ts +0 -102
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/MatchupSingle.js +0 -108
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/SingleAthleteCard/SingleAthleteCard.d.ts +0 -97
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/SingleAthleteCard/SingleAthleteCard.js +0 -18
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/SingleAthleteCard/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/SingleAthleteCard/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/MatchupSingle/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/PromoView/PromoView.d.ts +0 -100
- package/dist/src/modules/espn/fantasy/view/PromoView/PromoView.js +0 -12
- package/dist/src/modules/espn/fantasy/view/PromoView/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/PromoView/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/TournamentBracketCard/TournamentBracketCard.d.ts +0 -101
- package/dist/src/modules/espn/fantasy/view/TournamentBracketCard/TournamentBracketCard.js +0 -37
- package/dist/src/modules/espn/fantasy/view/TournamentBracketCard/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/TournamentBracketCard/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view/index.d.ts +0 -2
- package/dist/src/modules/espn/fantasy/view/index.js +0 -2
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.FantasyPolling.d.ts +0 -32
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.FantasyPolling.js +0 -132
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.LeagueManagerPolling.d.ts +0 -32
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.LeagueManagerPolling.js +0 -141
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.TournamentPolling.d.ts +0 -32
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.TournamentPolling.js +0 -140
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.d.ts +0 -167
- package/dist/src/modules/espn/fantasy/view-model/FantasyViewModel.js +0 -805
- package/dist/src/modules/espn/key-plays/constants.d.ts +0 -3
- package/dist/src/modules/espn/key-plays/constants.js +0 -292
- package/dist/src/modules/espn/key-plays/interfaces/IKeyPlays.d.ts +0 -32
- package/dist/src/modules/espn/key-plays/interfaces/IKeyPlays.js +0 -14
- package/dist/src/modules/espn/key-plays/interfaces/IKeyPlaysResponse.d.ts +0 -44
- package/dist/src/modules/espn/key-plays/interfaces/IKeyPlaysResponse.js +0 -1
- package/dist/src/modules/espn/key-plays/interfaces/IKeyPlaysViewModel.d.ts +0 -17
- package/dist/src/modules/espn/key-plays/interfaces/IKeyPlaysViewModel.js +0 -1
- package/dist/src/modules/espn/key-plays/view/KeyPlayCardScoreTagView.d.ts +0 -9
- package/dist/src/modules/espn/key-plays/view/KeyPlayCardScoreTagView.js +0 -16
- package/dist/src/modules/espn/key-plays/view/KeyPlayCardView.d.ts +0 -27
- package/dist/src/modules/espn/key-plays/view/KeyPlayCardView.js +0 -115
- package/dist/src/modules/espn/key-plays/view/KeyPlayErrorStateView.d.ts +0 -13
- package/dist/src/modules/espn/key-plays/view/KeyPlayErrorStateView.js +0 -65
- package/dist/src/modules/espn/key-plays/view/KeyPlaysView.d.ts +0 -39
- package/dist/src/modules/espn/key-plays/view/KeyPlaysView.js +0 -179
- package/dist/src/modules/espn/key-plays/view-model/KeyPlaysViewModel.d.ts +0 -37
- package/dist/src/modules/espn/key-plays/view-model/KeyPlaysViewModel.js +0 -245
- package/dist/src/modules/espn/shop/mocks.d.ts +0 -22
- package/dist/src/modules/espn/shop/mocks.js +0 -391
- package/dist/src/modules/espn/shop/services/ShopService.d.ts +0 -23
- package/dist/src/modules/espn/shop/services/ShopService.js +0 -44
- package/dist/src/modules/espn/shop/types.d.ts +0 -164
- package/dist/src/modules/espn/shop/types.js +0 -7
- package/dist/src/modules/espn/shop/view/ProductDetailView/ProductDetailView.d.ts +0 -10
- package/dist/src/modules/espn/shop/view/ProductDetailView/ProductDetailView.js +0 -60
- package/dist/src/modules/espn/shop/view/ProductDetailView/index.d.ts +0 -2
- package/dist/src/modules/espn/shop/view/ProductDetailView/index.js +0 -2
- package/dist/src/modules/espn/shop/view/ShopView.d.ts +0 -38
- package/dist/src/modules/espn/shop/view/ShopView.js +0 -223
- package/dist/src/modules/espn/shop/view/components/BrowseCard/BrowseCard.d.ts +0 -103
- package/dist/src/modules/espn/shop/view/components/BrowseCard/BrowseCard.js +0 -23
- package/dist/src/modules/espn/shop/view/components/BrowseCard/index.d.ts +0 -2
- package/dist/src/modules/espn/shop/view/components/BrowseCard/index.js +0 -2
- package/dist/src/modules/espn/shop/view/components/ProductSummaryCard/ProductSummaryCard.d.ts +0 -104
- package/dist/src/modules/espn/shop/view/components/ProductSummaryCard/ProductSummaryCard.js +0 -26
- package/dist/src/modules/espn/shop/view/components/ProductSummaryCard/index.d.ts +0 -2
- package/dist/src/modules/espn/shop/view/components/ProductSummaryCard/index.js +0 -1
- package/dist/src/modules/espn/shop/view/components/ShopPromoView/ShopPromoView.d.ts +0 -8
- package/dist/src/modules/espn/shop/view/components/ShopPromoView/ShopPromoView.js +0 -19
- package/dist/src/modules/espn/shop/view/components/ShopPromoView/index.d.ts +0 -1
- package/dist/src/modules/espn/shop/view/components/ShopPromoView/index.js +0 -1
- package/dist/src/modules/espn/shop/view/components/ShopSection/ShopSection.d.ts +0 -12
- package/dist/src/modules/espn/shop/view/components/ShopSection/ShopSection.js +0 -34
- package/dist/src/modules/espn/shop/view/components/ShopSection/index.d.ts +0 -1
- package/dist/src/modules/espn/shop/view/components/ShopSection/index.js +0 -1
- package/dist/src/modules/espn/shop/view/index.d.ts +0 -2
- package/dist/src/modules/espn/shop/view/index.js +0 -2
- package/dist/src/modules/espn/shop/view-model/ShopViewModel.ShopPolling.d.ts +0 -31
- package/dist/src/modules/espn/shop/view-model/ShopViewModel.ShopPolling.js +0 -111
- package/dist/src/modules/espn/shop/view-model/ShopViewModel.d.ts +0 -73
- package/dist/src/modules/espn/shop/view-model/ShopViewModel.js +0 -323
- package/dist/src/modules/espn/stats/components/TeamStatistic.d.ts +0 -16
- package/dist/src/modules/espn/stats/components/TeamStatistic.js +0 -13
- package/dist/src/modules/espn/stats/interfaces/IStats.d.ts +0 -330
- package/dist/src/modules/espn/stats/interfaces/IStats.js +0 -46
- package/dist/src/modules/espn/stats/interfaces/IStatsViewModel.d.ts +0 -7
- package/dist/src/modules/espn/stats/interfaces/IStatsViewModel.js +0 -1
- package/dist/src/modules/espn/stats/mocks.d.ts +0 -2
- package/dist/src/modules/espn/stats/mocks.js +0 -746
- package/dist/src/modules/espn/stats/services/StatsService.d.ts +0 -54
- package/dist/src/modules/espn/stats/services/StatsService.js +0 -155
- package/dist/src/modules/espn/stats/utils/driveSummaryUtils.d.ts +0 -18
- package/dist/src/modules/espn/stats/utils/driveSummaryUtils.js +0 -48
- package/dist/src/modules/espn/stats/utils/playerStatusUtils.d.ts +0 -4
- package/dist/src/modules/espn/stats/utils/playerStatusUtils.js +0 -17
- package/dist/src/modules/espn/stats/utils.d.ts +0 -39
- package/dist/src/modules/espn/stats/utils.js +0 -62
- package/dist/src/modules/espn/stats/view/ActiveAthletes/ActiveAthletes.d.ts +0 -22
- package/dist/src/modules/espn/stats/view/ActiveAthletes/ActiveAthletes.js +0 -98
- package/dist/src/modules/espn/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +0 -4
- package/dist/src/modules/espn/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.js +0 -27
- package/dist/src/modules/espn/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +0 -22
- package/dist/src/modules/espn/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.js +0 -89
- package/dist/src/modules/espn/stats/view/ActiveAthletes/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/ActiveAthletes/index.js +0 -2
- package/dist/src/modules/espn/stats/view/CareerMatchup/CareerMatchup.d.ts +0 -101
- package/dist/src/modules/espn/stats/view/CareerMatchup/CareerMatchup.js +0 -59
- package/dist/src/modules/espn/stats/view/CareerMatchup/index.d.ts +0 -1
- package/dist/src/modules/espn/stats/view/CareerMatchup/index.js +0 -1
- package/dist/src/modules/espn/stats/view/DriveSummary/DrivePlayCard.d.ts +0 -105
- package/dist/src/modules/espn/stats/view/DriveSummary/DrivePlayCard.js +0 -32
- package/dist/src/modules/espn/stats/view/DriveSummary/DriveSummary.d.ts +0 -10
- package/dist/src/modules/espn/stats/view/DriveSummary/DriveSummary.js +0 -40
- package/dist/src/modules/espn/stats/view/DriveSummary/ExpandedItems/DriveSummaryExpanded.d.ts +0 -27
- package/dist/src/modules/espn/stats/view/DriveSummary/ExpandedItems/DriveSummaryExpanded.js +0 -129
- package/dist/src/modules/espn/stats/view/DriveSummary/Header/DriveSummaryHeader.d.ts +0 -12
- package/dist/src/modules/espn/stats/view/DriveSummary/Header/DriveSummaryHeader.js +0 -26
- package/dist/src/modules/espn/stats/view/DriveSummary/MainStat/MainStat.d.ts +0 -10
- package/dist/src/modules/espn/stats/view/DriveSummary/MainStat/MainStat.js +0 -24
- package/dist/src/modules/espn/stats/view/DriveSummary/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/DriveSummary/index.js +0 -2
- package/dist/src/modules/espn/stats/view/GameLeaders/GameLeaders.d.ts +0 -9
- package/dist/src/modules/espn/stats/view/GameLeaders/GameLeaders.js +0 -22
- package/dist/src/modules/espn/stats/view/GameLeaders/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/GameLeaders/index.js +0 -2
- package/dist/src/modules/espn/stats/view/MatchPredictor/DonutChart/DonutChart.d.ts +0 -17
- package/dist/src/modules/espn/stats/view/MatchPredictor/DonutChart/DonutChart.js +0 -55
- package/dist/src/modules/espn/stats/view/MatchPredictor/DonutChart/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/MatchPredictor/DonutChart/index.js +0 -1
- package/dist/src/modules/espn/stats/view/MatchPredictor/MatchPredictorView.d.ts +0 -100
- package/dist/src/modules/espn/stats/view/MatchPredictor/MatchPredictorView.js +0 -60
- package/dist/src/modules/espn/stats/view/MatchPredictor/index.d.ts +0 -3
- package/dist/src/modules/espn/stats/view/MatchPredictor/index.js +0 -2
- package/dist/src/modules/espn/stats/view/Penalties/Penalties.d.ts +0 -9
- package/dist/src/modules/espn/stats/view/Penalties/Penalties.js +0 -6
- package/dist/src/modules/espn/stats/view/Penalties/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/Penalties/index.js +0 -2
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/ExpandedPlayerStats.d.ts +0 -16
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/ExpandedPlayerStats.js +0 -66
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/PlayerSeasonStatsCard.d.ts +0 -99
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/PlayerSeasonStatsCard.js +0 -26
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/PlayerSeasonStatsMinified.d.ts +0 -6
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/PlayerSeasonStatsMinified.js +0 -17
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/PlayerSeasonStatsView.d.ts +0 -8
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/PlayerSeasonStatsView.js +0 -165
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/index.d.ts +0 -1
- package/dist/src/modules/espn/stats/view/PlayerSeasonStats/index.js +0 -1
- package/dist/src/modules/espn/stats/view/RecentGames/RecentGames.d.ts +0 -100
- package/dist/src/modules/espn/stats/view/RecentGames/RecentGames.js +0 -23
- package/dist/src/modules/espn/stats/view/RecentGames/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/RecentGames/index.js +0 -2
- package/dist/src/modules/espn/stats/view/ScoringSummary/ExpandedScores/ExpandedScores.d.ts +0 -30
- package/dist/src/modules/espn/stats/view/ScoringSummary/ExpandedScores/ExpandedScores.js +0 -123
- package/dist/src/modules/espn/stats/view/ScoringSummary/ExpandedScores/ExpandedSummary.d.ts +0 -100
- package/dist/src/modules/espn/stats/view/ScoringSummary/ExpandedScores/ExpandedSummary.js +0 -24
- package/dist/src/modules/espn/stats/view/ScoringSummary/ExpandedScores/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/ScoringSummary/ExpandedScores/index.js +0 -2
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoreItem/ScoreItem.d.ts +0 -100
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoreItem/ScoreItem.js +0 -62
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoreItem/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoreItem/index.js +0 -2
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoresSection/ScoresSection.d.ts +0 -6
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoresSection/ScoresSection.js +0 -23
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoresSection/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoresSection/index.js +0 -2
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoringSummary.d.ts +0 -12
- package/dist/src/modules/espn/stats/view/ScoringSummary/ScoringSummary.js +0 -167
- package/dist/src/modules/espn/stats/view/ScoringSummary/index.d.ts +0 -1
- package/dist/src/modules/espn/stats/view/ScoringSummary/index.js +0 -1
- package/dist/src/modules/espn/stats/view/StatsItemView.d.ts +0 -8
- package/dist/src/modules/espn/stats/view/StatsItemView.js +0 -66
- package/dist/src/modules/espn/stats/view/StatsQRCode/StatsQRCodeView.d.ts +0 -100
- package/dist/src/modules/espn/stats/view/StatsQRCode/StatsQRCodeView.js +0 -36
- package/dist/src/modules/espn/stats/view/StatsQRCode/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/StatsQRCode/index.js +0 -1
- package/dist/src/modules/espn/stats/view/StatsView.d.ts +0 -29
- package/dist/src/modules/espn/stats/view/StatsView.js +0 -164
- package/dist/src/modules/espn/stats/view/TeamStats/TeamStatsView.d.ts +0 -101
- package/dist/src/modules/espn/stats/view/TeamStats/TeamStatsView.js +0 -77
- package/dist/src/modules/espn/stats/view/TeamStats/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/TeamStats/index.js +0 -1
- package/dist/src/modules/espn/stats/view/Teams/StatsCarousel.d.ts +0 -25
- package/dist/src/modules/espn/stats/view/Teams/StatsCarousel.js +0 -83
- package/dist/src/modules/espn/stats/view/Teams/StatsProgressBar.d.ts +0 -6
- package/dist/src/modules/espn/stats/view/Teams/StatsProgressBar.js +0 -19
- package/dist/src/modules/espn/stats/view/Teams/Teams.d.ts +0 -100
- package/dist/src/modules/espn/stats/view/Teams/Teams.js +0 -39
- package/dist/src/modules/espn/stats/view/Teams/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/Teams/index.js +0 -2
- package/dist/src/modules/espn/stats/view/WinProbability/WinProbability.d.ts +0 -100
- package/dist/src/modules/espn/stats/view/WinProbability/WinProbability.js +0 -28
- package/dist/src/modules/espn/stats/view/WinProbability/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/WinProbability/index.js +0 -2
- package/dist/src/modules/espn/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +0 -115
- package/dist/src/modules/espn/stats/view/components/AthletesStatistics/AthletesStatistics.js +0 -89
- package/dist/src/modules/espn/stats/view/components/AthletesStatistics/StatisticTable.d.ts +0 -3
- package/dist/src/modules/espn/stats/view/components/AthletesStatistics/StatisticTable.js +0 -12
- package/dist/src/modules/espn/stats/view/components/AthletesStatistics/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/components/AthletesStatistics/index.js +0 -2
- package/dist/src/modules/espn/stats/view/index.d.ts +0 -2
- package/dist/src/modules/espn/stats/view/index.js +0 -2
- package/dist/src/modules/espn/stats/view-model/StatsViewModel.d.ts +0 -322
- package/dist/src/modules/espn/stats/view-model/StatsViewModel.js +0 -1416
- package/dist/src/modules/fox/components/TabLoadError/TabLoadError.d.ts +0 -96
- package/dist/src/modules/fox/components/TabLoadError/TabLoadError.js +0 -19
- package/dist/src/modules/fox/components/TabLoadError/index.d.ts +0 -2
- package/dist/src/modules/fox/components/TabLoadError/index.js +0 -2
- package/dist/src/modules/fox/key-plays/view/FoxKeyPlays.d.ts +0 -2
- package/dist/src/modules/fox/key-plays/view/FoxKeyPlays.js +0 -5
- package/dist/src/modules/fox/multi-view/interfaces/IMultiViewViewModel.d.ts +0 -3
- package/dist/src/modules/fox/multi-view/interfaces/IMultiViewViewModel.js +0 -1
- package/dist/src/modules/fox/multi-view/services/MultiViewService.d.ts +0 -99
- package/dist/src/modules/fox/multi-view/services/MultiViewService.js +0 -94
- package/dist/src/modules/fox/multi-view/types.d.ts +0 -48
- package/dist/src/modules/fox/multi-view/types.js +0 -86
- package/dist/src/modules/fox/multi-view/view/CuratedMultiview/CuratedMultiviews.d.ts +0 -8
- package/dist/src/modules/fox/multi-view/view/CuratedMultiview/CuratedMultiviews.js +0 -91
- package/dist/src/modules/fox/multi-view/view/CuratedMultiview/index.d.ts +0 -2
- package/dist/src/modules/fox/multi-view/view/CuratedMultiview/index.js +0 -2
- package/dist/src/modules/fox/multi-view/view/FoxMultiView.d.ts +0 -3
- package/dist/src/modules/fox/multi-view/view/FoxMultiView.js +0 -65
- package/dist/src/modules/fox/multi-view/view/components/CustomMultiviewStreamsCard/CustomMultiviewStreamsCard.d.ts +0 -122
- package/dist/src/modules/fox/multi-view/view/components/CustomMultiviewStreamsCard/CustomMultiviewStreamsCard.js +0 -51
- package/dist/src/modules/fox/multi-view/view/components/CustomMultiviewStreamsCard/index.d.ts +0 -2
- package/dist/src/modules/fox/multi-view/view/components/CustomMultiviewStreamsCard/index.js +0 -2
- package/dist/src/modules/fox/multi-view/view/components/LayoutSelector/LayoutSelector.d.ts +0 -13
- package/dist/src/modules/fox/multi-view/view/components/LayoutSelector/LayoutSelector.js +0 -40
- package/dist/src/modules/fox/multi-view/view/components/LayoutSelector/index.d.ts +0 -2
- package/dist/src/modules/fox/multi-view/view/components/LayoutSelector/index.js +0 -2
- package/dist/src/modules/fox/multi-view/view/components/curated-multiview-card/CuratedMultiviewCard.d.ts +0 -101
- package/dist/src/modules/fox/multi-view/view/components/curated-multiview-card/CuratedMultiviewCard.js +0 -21
- package/dist/src/modules/fox/multi-view/view/components/curated-multiview-card/index.d.ts +0 -2
- package/dist/src/modules/fox/multi-view/view/components/curated-multiview-card/index.js +0 -2
- package/dist/src/modules/fox/multi-view/view-model/MultiViewViewModel.d.ts +0 -63
- package/dist/src/modules/fox/multi-view/view-model/MultiViewViewModel.js +0 -328
- package/dist/src/modules/fox/multi-view/view-model/index.d.ts +0 -1
- package/dist/src/modules/fox/multi-view/view-model/index.js +0 -1
- package/dist/src/modules/fox/stats/view/FoxStatsView.d.ts +0 -2
- package/dist/src/modules/fox/stats/view/FoxStatsView.js +0 -5
- package/dist/src/modules/maestro/builder/components/BuilderSection/BuilderSection.d.ts +0 -11
- package/dist/src/modules/maestro/builder/components/BuilderSection/BuilderSection.js +0 -52
- package/dist/src/modules/maestro/builder/components/BuilderSection/index.d.ts +0 -2
- package/dist/src/modules/maestro/builder/components/BuilderSection/index.js +0 -2
- package/dist/src/modules/maestro/builder/components/ExpandableCard/ExpandableCard.d.ts +0 -110
- package/dist/src/modules/maestro/builder/components/ExpandableCard/ExpandableCard.js +0 -37
- package/dist/src/modules/maestro/builder/components/ExpandableCard/index.d.ts +0 -2
- package/dist/src/modules/maestro/builder/components/ExpandableCard/index.js +0 -2
- package/dist/src/modules/maestro/builder/components/SimpleCard/SimpleCard.d.ts +0 -104
- package/dist/src/modules/maestro/builder/components/SimpleCard/SimpleCard.js +0 -12
- package/dist/src/modules/maestro/builder/components/SimpleCard/index.d.ts +0 -2
- package/dist/src/modules/maestro/builder/components/SimpleCard/index.js +0 -2
- package/dist/src/modules/maestro/builder/index.d.ts +0 -7
- package/dist/src/modules/maestro/builder/index.js +0 -7
- package/dist/src/modules/maestro/builder/mocks/mockBuilderPanel.d.ts +0 -149
- package/dist/src/modules/maestro/builder/mocks/mockBuilderPanel.js +0 -240
- package/dist/src/modules/maestro/builder/types.d.ts +0 -52
- package/dist/src/modules/maestro/builder/types.js +0 -1
- package/dist/src/modules/maestro/builder/view/BuilderPanelView.d.ts +0 -4
- package/dist/src/modules/maestro/builder/view/BuilderPanelView.js +0 -52
- package/dist/src/modules/maestro/builder/view-model/BuilderPanelViewModel.d.ts +0 -40
- package/dist/src/modules/maestro/builder/view-model/BuilderPanelViewModel.js +0 -229
- package/dist/src/modules/maestro/builder/view-model/index.d.ts +0 -1
- package/dist/src/modules/maestro/builder/view-model/index.js +0 -1
- package/dist/src/modules/maestro/hello-world/HelloWorldImage.d.ts +0 -2
- package/dist/src/modules/maestro/hello-world/HelloWorldImage.js +0 -32
- package/dist/src/modules/maestro/hello-world/HelloWorldView.d.ts +0 -11
- package/dist/src/modules/maestro/hello-world/HelloWorldView.js +0 -40
- package/dist/src/modules/maestro/hello-world/index.d.ts +0 -2
- package/dist/src/modules/maestro/hello-world/index.js +0 -2
- package/dist/src/sentry.d.ts +0 -3
- package/dist/src/sentry.js +0 -51
- package/dist/src/services/AnalyticsService/AnalyticsService.d.ts +0 -85
- package/dist/src/services/AnalyticsService/AnalyticsService.js +0 -406
- package/dist/src/services/AnalyticsService/types.d.ts +0 -65
- package/dist/src/services/AnalyticsService/types.js +0 -1
- package/dist/src/services/InsightsService/InsightsPayloadBuilder.d.ts +0 -279
- package/dist/src/services/InsightsService/InsightsPayloadBuilder.js +0 -385
- package/dist/src/services/InsightsService/InsightsService.d.ts +0 -11
- package/dist/src/services/InsightsService/InsightsService.js +0 -74
- package/dist/src/services/NetworkManager/NetworkManager.d.ts +0 -153
- package/dist/src/services/NetworkManager/NetworkManager.js +0 -434
- package/dist/src/services/NetworkManager/errors.d.ts +0 -19
- package/dist/src/services/NetworkManager/errors.js +0 -59
- package/dist/src/services/NetworkManager/types.d.ts +0 -7
- package/dist/src/services/NetworkManager/types.js +0 -1
- package/dist/src/services/StaticService/StaticService.d.ts +0 -20
- package/dist/src/services/StaticService/StaticService.js +0 -86
- package/dist/src/services/StaticService/index.d.ts +0 -2
- package/dist/src/services/StaticService/index.js +0 -2
- package/dist/src/services/StaticService/mocks.d.ts +0 -3
- package/dist/src/services/StaticService/mocks.js +0 -119
- package/dist/src/services/StaticService/types.d.ts +0 -78
- package/dist/src/services/StaticService/types.js +0 -1
- package/dist/src/services/ThemeManager/constants.d.ts +0 -2
- package/dist/src/services/ThemeManager/constants.js +0 -47
- package/dist/src/services/UserSettingsManager.d.ts +0 -63
- package/dist/src/services/UserSettingsManager.js +0 -158
- package/dist/src/test-polyfills.d.ts +0 -1
- package/dist/src/test-polyfills.js +0 -15
- package/dist/src/view-models/MaestroEventViewModel.d.ts +0 -96
- package/dist/src/view-models/MaestroEventViewModel.js +0 -386
- package/dist/src/view-models/PanelManagerViewModel.d.ts +0 -49
- package/dist/src/view-models/PanelManagerViewModel.js +0 -195
- package/dist/src/view-models/ViewModel.d.ts +0 -12
- package/dist/src/view-models/ViewModel.js +0 -32
|
@@ -1,1416 +0,0 @@
|
|
|
1
|
-
import { Observable } from '../../../../helpers/Observable';
|
|
2
|
-
import { ViewModel } from '../../../../view-models/ViewModel';
|
|
3
|
-
import { MOCK_STATS_API_PRE_GAME_RESPONSE } from '../mocks';
|
|
4
|
-
import { isTabbedStatisticsArray, isTeamStatistic, isHockeyScoringSummary, isMlbScoringSummary, } from '../interfaces/IStats';
|
|
5
|
-
import StatsService from '../services/StatsService';
|
|
6
|
-
import { formatLastPlayMarquee, parseDriveDescription, } from '../utils/driveSummaryUtils';
|
|
7
|
-
import { setImageDimensions } from '@/helpers/url';
|
|
8
|
-
import SDK from '@/index';
|
|
9
|
-
import { captureException } from '@/sentry';
|
|
10
|
-
import { stringHashCode } from '@/helpers/strings';
|
|
11
|
-
const STATS_ERROR_STATE = {
|
|
12
|
-
NONE: 'none',
|
|
13
|
-
TAB_LOAD_FAILURE: 'tabLoadFailure',
|
|
14
|
-
};
|
|
15
|
-
// Constants for configuration
|
|
16
|
-
const DEFAULT_POLLING_INTERVAL = 10000; // 10 seconds
|
|
17
|
-
const SMART_POLLING_DELAY = 1000; // 1 second delay after smart polling immediate call
|
|
18
|
-
// The interval for polling stats data (in milliseconds)
|
|
19
|
-
const STATS_ITEM_TYPE_CARD_MAP = {
|
|
20
|
-
activeAthletes: 'activeAthletes',
|
|
21
|
-
driveSummary: 'drives',
|
|
22
|
-
gameLeaders: 'leaders',
|
|
23
|
-
headerTeam: 'header',
|
|
24
|
-
matchPredictor: 'predictor',
|
|
25
|
-
playerSeasonStats: 'playerStats',
|
|
26
|
-
promotion: 'promotion',
|
|
27
|
-
recentGames: 'previousGames',
|
|
28
|
-
scoringSummary: 'scoringSummary',
|
|
29
|
-
teamStats: 'entities',
|
|
30
|
-
winProbability: 'winProbability',
|
|
31
|
-
careerMatchup: 'careerMatchup',
|
|
32
|
-
penalties: 'penaltySummary',
|
|
33
|
-
};
|
|
34
|
-
export class StatsViewModel extends ViewModel {
|
|
35
|
-
constructor(eventId, delegate, analyticsService, options = {}) {
|
|
36
|
-
super();
|
|
37
|
-
Object.defineProperty(this, "isDataLoading", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
configurable: true,
|
|
40
|
-
writable: true,
|
|
41
|
-
value: new Observable(true)
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(this, "hasEverSuccessfullyLoaded", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
configurable: true,
|
|
46
|
-
writable: true,
|
|
47
|
-
value: new Observable(false)
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(this, "eventId", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
configurable: true,
|
|
52
|
-
writable: true,
|
|
53
|
-
value: void 0
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(this, "statsItems", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: new Observable([])
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(this, "errorState", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: new Observable('none')
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(this, "currentGameState", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: new Observable('')
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, "statsService", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value: void 0
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(this, "analyticsService", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
configurable: true,
|
|
82
|
-
writable: true,
|
|
83
|
-
value: void 0
|
|
84
|
-
});
|
|
85
|
-
// Properties
|
|
86
|
-
Object.defineProperty(this, "useMockData", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
configurable: true,
|
|
89
|
-
writable: true,
|
|
90
|
-
value: false
|
|
91
|
-
});
|
|
92
|
-
Object.defineProperty(this, "lastResponseHash", {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
configurable: true,
|
|
95
|
-
writable: true,
|
|
96
|
-
value: null
|
|
97
|
-
});
|
|
98
|
-
// Enhanced timecode-related properties
|
|
99
|
-
Object.defineProperty(this, "currentPlayerTimeCode", {
|
|
100
|
-
enumerable: true,
|
|
101
|
-
configurable: true,
|
|
102
|
-
writable: true,
|
|
103
|
-
value: null
|
|
104
|
-
});
|
|
105
|
-
Object.defineProperty(this, "timecodePollingTask", {
|
|
106
|
-
enumerable: true,
|
|
107
|
-
configurable: true,
|
|
108
|
-
writable: true,
|
|
109
|
-
value: null
|
|
110
|
-
});
|
|
111
|
-
Object.defineProperty(this, "smartPollingTimeout", {
|
|
112
|
-
enumerable: true,
|
|
113
|
-
configurable: true,
|
|
114
|
-
writable: true,
|
|
115
|
-
value: null
|
|
116
|
-
});
|
|
117
|
-
Object.defineProperty(this, "timecodePollingState", {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
configurable: true,
|
|
120
|
-
writable: true,
|
|
121
|
-
value: {
|
|
122
|
-
isActive: false,
|
|
123
|
-
currentUrl: null,
|
|
124
|
-
lastUpdateTime: 0,
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
Object.defineProperty(this, "onEngage", {
|
|
128
|
-
enumerable: true,
|
|
129
|
-
configurable: true,
|
|
130
|
-
writable: true,
|
|
131
|
-
value: (type) => {
|
|
132
|
-
this.analyticsService.panelClick({
|
|
133
|
-
type: 'espnStats',
|
|
134
|
-
name: 'stats_item_clicked',
|
|
135
|
-
metadata: {
|
|
136
|
-
card: [STATS_ITEM_TYPE_CARD_MAP[type]],
|
|
137
|
-
game_state: [this.currentGameState.value],
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
this.eventId = eventId;
|
|
143
|
-
this.useMockData = options.useMockData || false;
|
|
144
|
-
this.statsService = new StatsService(delegate);
|
|
145
|
-
this.analyticsService = analyticsService;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Sets panel-specific data configuration
|
|
149
|
-
* @param panelData - Object containing panel configuration
|
|
150
|
-
*/
|
|
151
|
-
setDataToPanel(panelData) {
|
|
152
|
-
if ('overrideUrl' in panelData) {
|
|
153
|
-
const overrideUrl = panelData.overrideUrl;
|
|
154
|
-
if (typeof overrideUrl === 'string' && overrideUrl.length > 0) {
|
|
155
|
-
console.log('[StatsViewModel] Setting overrideUrl:', overrideUrl);
|
|
156
|
-
this.statsService.overrideUrl = overrideUrl;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Initialize the ViewModel and start data fetching
|
|
162
|
-
*/
|
|
163
|
-
async init() {
|
|
164
|
-
if (this.useMockData) {
|
|
165
|
-
await this.fetchMockData();
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
// Get the current timecode from MaestroEventViewModel instead of defaulting to null
|
|
169
|
-
// This ensures we don't override the current timecode when switching tabs
|
|
170
|
-
const currentTimeCode = this.getCurrentTimeCode();
|
|
171
|
-
this.onUpdatePlayerTimeCode(currentTimeCode);
|
|
172
|
-
this.analyticsService.panelView('espnStats');
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Get the current timecode from the MaestroEventViewModel
|
|
177
|
-
* This prevents the stats panel from always defaulting to real-time data
|
|
178
|
-
*/
|
|
179
|
-
getCurrentTimeCode() {
|
|
180
|
-
try {
|
|
181
|
-
// Access the MaestroEventViewModel through the imported SDK to get current timecode
|
|
182
|
-
const maestroEventViewModel = SDK.getMaestroEventViewModel();
|
|
183
|
-
if (maestroEventViewModel &&
|
|
184
|
-
typeof maestroEventViewModel.getPlayerTimeCode === 'function') {
|
|
185
|
-
return maestroEventViewModel.getPlayerTimeCode();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
captureException(error, {
|
|
190
|
-
context: 'StatsViewModel.getCurrentTimeCode',
|
|
191
|
-
});
|
|
192
|
-
console.warn('Could not get current timecode from MaestroEventViewModel:', error);
|
|
193
|
-
}
|
|
194
|
-
// Fallback to null (real-time) if we can't get the current timecode
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Clean up resources when the ViewModel is no longer needed
|
|
199
|
-
*/
|
|
200
|
-
cleanup() {
|
|
201
|
-
this.stopTimecodePolling();
|
|
202
|
-
this.clearSmartPollingTimeout();
|
|
203
|
-
this.resetTimecodePollingState();
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Handle player timecode updates with enhanced logging and validation
|
|
207
|
-
*
|
|
208
|
-
* @param playerTimeCode - The timecode in milliseconds, or null for live
|
|
209
|
-
*/
|
|
210
|
-
onUpdatePlayerTimeCode(playerTimeCode) {
|
|
211
|
-
this.currentPlayerTimeCode = playerTimeCode;
|
|
212
|
-
if (this.useMockData) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
try {
|
|
216
|
-
this.performSmartPolling(playerTimeCode);
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
captureException(error, {
|
|
220
|
-
context: 'StatsViewModel.onUpdatePlayerTimeCode',
|
|
221
|
-
});
|
|
222
|
-
console.error('Error handling player timecode update:', error);
|
|
223
|
-
this.handleTimecodeError('Error handling player timecode update', error);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
clearTabLoadFailure() {
|
|
227
|
-
this.errorState.value = 'none';
|
|
228
|
-
const currentTimeCode = this.getCurrentTimeCode();
|
|
229
|
-
this.onUpdatePlayerTimeCode(currentTimeCode);
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Implement smart polling strategy: immediate API call + delayed polling resumption
|
|
233
|
-
*
|
|
234
|
-
* @param playerTimeCode - The timecode in milliseconds, or null
|
|
235
|
-
*/
|
|
236
|
-
async performSmartPolling(playerTimeCode) {
|
|
237
|
-
this.clearSmartPollingTimeout();
|
|
238
|
-
this.stopTimecodePolling();
|
|
239
|
-
try {
|
|
240
|
-
const immediateStats = await this.statsService.getStatsByUrl(playerTimeCode);
|
|
241
|
-
if (!immediateStats) {
|
|
242
|
-
throw new Error('API returned undefined or null response');
|
|
243
|
-
}
|
|
244
|
-
this.processPolledData(immediateStats);
|
|
245
|
-
this.smartPollingTimeout = window.setTimeout(() => {
|
|
246
|
-
this.startTimecodePolling(playerTimeCode);
|
|
247
|
-
this.smartPollingTimeout = null;
|
|
248
|
-
}, SMART_POLLING_DELAY);
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
captureException(error, {
|
|
252
|
-
context: 'StatsViewModel.performSmartPolling',
|
|
253
|
-
});
|
|
254
|
-
console.error('Error during smart polling immediate call:', error);
|
|
255
|
-
this.handleTimecodeError('Error during smart polling immediate call', error);
|
|
256
|
-
this.stopTimecodePolling();
|
|
257
|
-
this.startTimecodePolling(playerTimeCode);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Enhanced error handling for timecode-related operations
|
|
262
|
-
*
|
|
263
|
-
* @param context - Description of where the error occurred
|
|
264
|
-
* @param error - The error that occurred
|
|
265
|
-
*/
|
|
266
|
-
handleTimecodeError(context, error) {
|
|
267
|
-
const errorDetails = {
|
|
268
|
-
context,
|
|
269
|
-
errorType: error?.constructor?.name || 'Unknown',
|
|
270
|
-
errorMessage: error instanceof Error ? error.message : String(error),
|
|
271
|
-
timestamp: new Date().toISOString(),
|
|
272
|
-
currentTimecode: this.currentPlayerTimeCode,
|
|
273
|
-
hasExistingData: this.statsItems.value.length > 0,
|
|
274
|
-
lastResponseHash: this.lastResponseHash,
|
|
275
|
-
url: this.timecodePollingState.currentUrl,
|
|
276
|
-
};
|
|
277
|
-
console.error(`${context}:`, errorDetails);
|
|
278
|
-
if (!this.hasEverSuccessfullyLoaded.value) {
|
|
279
|
-
this.errorState.value = 'tabLoadFailure';
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Clear any pending smart polling timeout
|
|
284
|
-
*/
|
|
285
|
-
clearSmartPollingTimeout() {
|
|
286
|
-
if (this.smartPollingTimeout) {
|
|
287
|
-
clearTimeout(this.smartPollingTimeout);
|
|
288
|
-
this.smartPollingTimeout = null;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Reset timecode polling state
|
|
293
|
-
*/
|
|
294
|
-
resetTimecodePollingState() {
|
|
295
|
-
this.timecodePollingState = {
|
|
296
|
-
isActive: false,
|
|
297
|
-
currentUrl: null,
|
|
298
|
-
lastUpdateTime: 0,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Start timecode-based polling with enhanced logging
|
|
303
|
-
*
|
|
304
|
-
* @param playerTimeCode - The timecode in milliseconds, or null
|
|
305
|
-
*/
|
|
306
|
-
startTimecodePolling(playerTimeCode) {
|
|
307
|
-
this.stopTimecodePolling();
|
|
308
|
-
try {
|
|
309
|
-
this.timecodePollingTask = this.statsService.pollStatsByUrl(playerTimeCode, DEFAULT_POLLING_INTERVAL, (data) => {
|
|
310
|
-
this.processPolledData(data);
|
|
311
|
-
}, (error) => {
|
|
312
|
-
console.error('Timecode polling error:', error);
|
|
313
|
-
this.handleTimecodeError('Timecode polling error', error);
|
|
314
|
-
});
|
|
315
|
-
this.timecodePollingState.isActive = true;
|
|
316
|
-
}
|
|
317
|
-
catch (error) {
|
|
318
|
-
captureException(error, {
|
|
319
|
-
context: 'StatsViewModel.startTimecodePolling',
|
|
320
|
-
});
|
|
321
|
-
console.error('Error setting up timecode-based Stats polling:', error);
|
|
322
|
-
this.handleTimecodeError('Error setting up timecode-based Stats polling', error);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Stop timecode-based polling with enhanced logging
|
|
327
|
-
*/
|
|
328
|
-
stopTimecodePolling() {
|
|
329
|
-
if (this.timecodePollingTask) {
|
|
330
|
-
this.timecodePollingTask.stop();
|
|
331
|
-
this.timecodePollingTask = null;
|
|
332
|
-
}
|
|
333
|
-
this.timecodePollingState.isActive = false;
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Fetch mock data for testing
|
|
337
|
-
*/
|
|
338
|
-
async fetchMockData() {
|
|
339
|
-
this.processData(MOCK_STATS_API_PRE_GAME_RESPONSE);
|
|
340
|
-
this.hasEverSuccessfullyLoaded.value = true;
|
|
341
|
-
this.isDataLoading.value = false;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Process polled data with hash comparison to avoid unnecessary re-renders
|
|
345
|
-
* Enhanced with comprehensive logging to show data changes
|
|
346
|
-
*
|
|
347
|
-
* @param data - The stats data received from the API
|
|
348
|
-
*/
|
|
349
|
-
processPolledData(data) {
|
|
350
|
-
const responseString = JSON.stringify(data);
|
|
351
|
-
const currentHash = stringHashCode(responseString);
|
|
352
|
-
if (this.hasEverSuccessfullyLoaded.value &&
|
|
353
|
-
currentHash === this.lastResponseHash) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
this.lastResponseHash = currentHash;
|
|
357
|
-
this.hasEverSuccessfullyLoaded.value = true;
|
|
358
|
-
this.errorState.value = 'none';
|
|
359
|
-
this.processData(data);
|
|
360
|
-
if (data.gameState === 'post') {
|
|
361
|
-
this.stopTimecodePolling();
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
processData(data) {
|
|
365
|
-
const statsItems = [];
|
|
366
|
-
const headerTeam = this.parseHeaderTeams(data);
|
|
367
|
-
if (headerTeam) {
|
|
368
|
-
statsItems.push(headerTeam);
|
|
369
|
-
}
|
|
370
|
-
const matchPredictor = this.parseMatchPredictor(data);
|
|
371
|
-
if (matchPredictor) {
|
|
372
|
-
statsItems.push(matchPredictor);
|
|
373
|
-
}
|
|
374
|
-
const careerMatchup = this.parseCareerMatchup(data);
|
|
375
|
-
if (careerMatchup) {
|
|
376
|
-
statsItems.push(careerMatchup);
|
|
377
|
-
}
|
|
378
|
-
const playerSeasonStats = this.parsePlayerSeasonStats(data);
|
|
379
|
-
if (playerSeasonStats) {
|
|
380
|
-
statsItems.push(playerSeasonStats);
|
|
381
|
-
}
|
|
382
|
-
const scoringSummary = this.parseScoringSummary(data);
|
|
383
|
-
if (scoringSummary) {
|
|
384
|
-
statsItems.push(scoringSummary);
|
|
385
|
-
}
|
|
386
|
-
const winProbability = this.parseWinProbability(data);
|
|
387
|
-
if (winProbability) {
|
|
388
|
-
statsItems.push(winProbability);
|
|
389
|
-
}
|
|
390
|
-
// Team Stats (prefer season stats when available; fallback to game stats)
|
|
391
|
-
const teamStats = this.parseTeamSeasonStatistics(data) || this.parseTeamsStatistics(data);
|
|
392
|
-
if (teamStats) {
|
|
393
|
-
statsItems.push(teamStats);
|
|
394
|
-
}
|
|
395
|
-
const driveSummary = this.parseDriveSummary(data);
|
|
396
|
-
if (driveSummary.length > 0) {
|
|
397
|
-
statsItems.push(...driveSummary);
|
|
398
|
-
}
|
|
399
|
-
const penalties = this.parsePenalties(data);
|
|
400
|
-
if (penalties) {
|
|
401
|
-
statsItems.push(penalties);
|
|
402
|
-
}
|
|
403
|
-
const activeAthletes = this.parseActiveAthletes(data);
|
|
404
|
-
if (activeAthletes) {
|
|
405
|
-
statsItems.push(activeAthletes);
|
|
406
|
-
}
|
|
407
|
-
const gameLeaders = this.parseGameLeaders(data);
|
|
408
|
-
if (gameLeaders) {
|
|
409
|
-
statsItems.push(gameLeaders);
|
|
410
|
-
}
|
|
411
|
-
const recentGames = this.parseRecentGames(data);
|
|
412
|
-
if (recentGames) {
|
|
413
|
-
statsItems.push(recentGames);
|
|
414
|
-
}
|
|
415
|
-
const promotion = this.parsePromotion(data);
|
|
416
|
-
if (promotion) {
|
|
417
|
-
statsItems.push(promotion);
|
|
418
|
-
}
|
|
419
|
-
// Update the stats items observable
|
|
420
|
-
this.statsItems.value = statsItems;
|
|
421
|
-
this.currentGameState.value = data.gameState;
|
|
422
|
-
}
|
|
423
|
-
parseDriveSummary(data) {
|
|
424
|
-
const teams = data.entities?.teams;
|
|
425
|
-
const drives = data.drives;
|
|
426
|
-
if (!teams || !drives || drives.length === 0) {
|
|
427
|
-
return [];
|
|
428
|
-
}
|
|
429
|
-
const result = [];
|
|
430
|
-
for (const drive of drives) {
|
|
431
|
-
if (!drive?.team?.$key) {
|
|
432
|
-
continue;
|
|
433
|
-
}
|
|
434
|
-
const plays = [...(drive.plays || [])].reverse();
|
|
435
|
-
const lastPlay = plays[plays.length - 1] || null;
|
|
436
|
-
let lastPlayMarquee = '';
|
|
437
|
-
if (lastPlay) {
|
|
438
|
-
lastPlayMarquee = formatLastPlayMarquee(lastPlay);
|
|
439
|
-
}
|
|
440
|
-
const { plays: playsQuantity, time, yards } = parseDriveDescription(drive.description || '');
|
|
441
|
-
const team = teams[drive.team.$key];
|
|
442
|
-
if (!team) {
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
result.push({
|
|
446
|
-
id: drive.id,
|
|
447
|
-
lastPlayMarquee,
|
|
448
|
-
plays,
|
|
449
|
-
playsQuantity,
|
|
450
|
-
team,
|
|
451
|
-
time,
|
|
452
|
-
type: 'driveSummary',
|
|
453
|
-
yards,
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
return result;
|
|
457
|
-
}
|
|
458
|
-
parseTeamsStatistics(data) {
|
|
459
|
-
const teams = data.entities?.teams;
|
|
460
|
-
if (!teams) {
|
|
461
|
-
return null;
|
|
462
|
-
}
|
|
463
|
-
const awayTeam = Object.values(teams).find((team) => team.homeAway === 'away');
|
|
464
|
-
const homeTeam = Object.values(teams).find((team) => team.homeAway === 'home');
|
|
465
|
-
if (!awayTeam || !homeTeam) {
|
|
466
|
-
return null;
|
|
467
|
-
}
|
|
468
|
-
// Ensure both teams have statistics
|
|
469
|
-
if (!awayTeam.statistics || !homeTeam.statistics) {
|
|
470
|
-
return null;
|
|
471
|
-
}
|
|
472
|
-
const statistics = [];
|
|
473
|
-
for (let i = 0; i < awayTeam.statistics.length; i++) {
|
|
474
|
-
const awayStat = awayTeam.statistics[i];
|
|
475
|
-
const homeStat = homeTeam.statistics[i];
|
|
476
|
-
if (isTeamStatistic(awayStat) && isTeamStatistic(homeStat)) {
|
|
477
|
-
statistics.push({
|
|
478
|
-
awayTeamDisplayValue: awayStat?.displayValue || '0',
|
|
479
|
-
displayName: awayStat.displayName || '',
|
|
480
|
-
homeTeamDisplayValue: homeStat?.displayValue || '0',
|
|
481
|
-
awayTeamValue: awayStat?.value || 0,
|
|
482
|
-
homeTeamValue: homeStat?.value || 0,
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
if (!statistics.length) {
|
|
487
|
-
return null;
|
|
488
|
-
}
|
|
489
|
-
return {
|
|
490
|
-
type: 'teamStats',
|
|
491
|
-
title: 'Team Stats',
|
|
492
|
-
awayTeam: {
|
|
493
|
-
logo: awayTeam.logo,
|
|
494
|
-
displayName: awayTeam.displayName || '',
|
|
495
|
-
color: awayTeam.color || '',
|
|
496
|
-
abbreviation: awayTeam.abbreviation || '',
|
|
497
|
-
},
|
|
498
|
-
homeTeam: {
|
|
499
|
-
logo: homeTeam.logo,
|
|
500
|
-
displayName: homeTeam.displayName || '',
|
|
501
|
-
color: homeTeam.color || '',
|
|
502
|
-
abbreviation: homeTeam.abbreviation || '',
|
|
503
|
-
},
|
|
504
|
-
statistics,
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
parseTeamSeasonStatistics(data) {
|
|
508
|
-
const teams = data.entities?.teams || {};
|
|
509
|
-
if (!Object.keys(teams).length ||
|
|
510
|
-
!data.statTeams ||
|
|
511
|
-
!data.statTeams.title ||
|
|
512
|
-
!data.statTeams.sections?.length ||
|
|
513
|
-
!data.statTeams.teams?.length) {
|
|
514
|
-
return null;
|
|
515
|
-
}
|
|
516
|
-
const awayTeamKey = data.statTeams.teams[0]?.$key;
|
|
517
|
-
const homeTeamKey = data.statTeams.teams[1]?.$key;
|
|
518
|
-
if (!awayTeamKey || !homeTeamKey) {
|
|
519
|
-
return null;
|
|
520
|
-
}
|
|
521
|
-
const awayTeam = teams[awayTeamKey];
|
|
522
|
-
const homeTeam = teams[homeTeamKey];
|
|
523
|
-
if (!homeTeam || !awayTeam) {
|
|
524
|
-
return null;
|
|
525
|
-
}
|
|
526
|
-
const tabbedStatistics = {};
|
|
527
|
-
data.statTeams.sections.forEach((section) => {
|
|
528
|
-
if (!!section.$key && !!section.title) {
|
|
529
|
-
const sectionKeyStatistics = [];
|
|
530
|
-
if (isTabbedStatisticsArray(homeTeam.statistics) &&
|
|
531
|
-
isTabbedStatisticsArray(awayTeam.statistics)) {
|
|
532
|
-
const homeSectionStats = homeTeam.statistics.find((st) => st.$key === section.$key);
|
|
533
|
-
const awaySectionStats = awayTeam.statistics.find((st) => st.$key === section.$key);
|
|
534
|
-
if (homeSectionStats &&
|
|
535
|
-
awaySectionStats &&
|
|
536
|
-
awaySectionStats.stats?.length &&
|
|
537
|
-
homeSectionStats.stats?.length) {
|
|
538
|
-
for (let i = 0; i < awaySectionStats.stats.length; i++) {
|
|
539
|
-
const awayStat = awaySectionStats.stats[i];
|
|
540
|
-
const homeStat = homeSectionStats.stats[i];
|
|
541
|
-
sectionKeyStatistics.push({
|
|
542
|
-
awayTeamDisplayValue: awayStat?.displayValue || '0',
|
|
543
|
-
displayName: awayStat.displayName || '',
|
|
544
|
-
homeTeamDisplayValue: homeStat?.displayValue || '0',
|
|
545
|
-
awayTeamValue: awayStat?.displayValue
|
|
546
|
-
? Number(awayStat.displayValue)
|
|
547
|
-
: 0,
|
|
548
|
-
homeTeamValue: homeStat?.displayValue
|
|
549
|
-
? Number(homeStat.displayValue)
|
|
550
|
-
: 0,
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
tabbedStatistics[section.$key] = {
|
|
554
|
-
title: section.title,
|
|
555
|
-
entries: sectionKeyStatistics,
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
return {
|
|
562
|
-
type: 'teamStats',
|
|
563
|
-
title: data.statTeams.title,
|
|
564
|
-
awayTeam: {
|
|
565
|
-
abbreviation: awayTeam.abbreviation,
|
|
566
|
-
displayName: awayTeam.displayName || '',
|
|
567
|
-
color: awayTeam.color || '',
|
|
568
|
-
logo: awayTeam.logo,
|
|
569
|
-
},
|
|
570
|
-
homeTeam: {
|
|
571
|
-
abbreviation: homeTeam.abbreviation,
|
|
572
|
-
displayName: homeTeam.displayName || '',
|
|
573
|
-
color: homeTeam.color || '',
|
|
574
|
-
logo: homeTeam.logo,
|
|
575
|
-
},
|
|
576
|
-
tabbedStatistics,
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
parseMatchPredictor(data) {
|
|
580
|
-
const teams = data.entities?.teams;
|
|
581
|
-
const predictor = data.predictor;
|
|
582
|
-
if (!teams || !predictor || !predictor.homeTeam || !predictor.awayTeam) {
|
|
583
|
-
return null;
|
|
584
|
-
}
|
|
585
|
-
// Get team data
|
|
586
|
-
const homeTeam = teams[predictor.homeTeam.team.$key];
|
|
587
|
-
const awayTeam = teams[predictor.awayTeam.team.$key];
|
|
588
|
-
if (!homeTeam || !awayTeam) {
|
|
589
|
-
return null;
|
|
590
|
-
}
|
|
591
|
-
// Parse percentages
|
|
592
|
-
const homePercentage = parseFloat(predictor.homeTeam.gameProjection);
|
|
593
|
-
const awayPercentage = parseFloat(predictor.awayTeam.gameProjection);
|
|
594
|
-
return {
|
|
595
|
-
type: 'matchPredictor',
|
|
596
|
-
header: predictor.header,
|
|
597
|
-
imageUrl: predictor.imageUrl,
|
|
598
|
-
awayTeam: {
|
|
599
|
-
percentage: awayPercentage,
|
|
600
|
-
abbreviation: awayTeam.abbreviation,
|
|
601
|
-
logo: awayTeam.logo,
|
|
602
|
-
displayName: awayTeam.displayName || '',
|
|
603
|
-
},
|
|
604
|
-
homeTeam: {
|
|
605
|
-
percentage: homePercentage,
|
|
606
|
-
abbreviation: homeTeam.abbreviation,
|
|
607
|
-
logo: homeTeam.logo,
|
|
608
|
-
displayName: homeTeam.displayName || '',
|
|
609
|
-
},
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
parsePromotion(response) {
|
|
613
|
-
const promotion = response.promotion;
|
|
614
|
-
if (!promotion) {
|
|
615
|
-
return null;
|
|
616
|
-
}
|
|
617
|
-
return {
|
|
618
|
-
type: 'promotion',
|
|
619
|
-
title: promotion.title || '',
|
|
620
|
-
description: promotion.description || '',
|
|
621
|
-
logo: promotion.logo || '',
|
|
622
|
-
qrCode: promotion.qrCode || '',
|
|
623
|
-
backgroundImage: promotion.backgroundImage || '',
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
parseCareerMatchup(response) {
|
|
627
|
-
const careerMatchup = response.careerMatchup;
|
|
628
|
-
const athletes = response.entities?.athletes;
|
|
629
|
-
if (!careerMatchup || !careerMatchup.sections) {
|
|
630
|
-
return null;
|
|
631
|
-
}
|
|
632
|
-
const toText = (value) => {
|
|
633
|
-
if (typeof value === 'string')
|
|
634
|
-
return value;
|
|
635
|
-
if (value && typeof value === 'object') {
|
|
636
|
-
const maybeDisplayName = value
|
|
637
|
-
.displayName;
|
|
638
|
-
if (typeof maybeDisplayName === 'string')
|
|
639
|
-
return maybeDisplayName;
|
|
640
|
-
}
|
|
641
|
-
return '';
|
|
642
|
-
};
|
|
643
|
-
const sections = careerMatchup.sections
|
|
644
|
-
.filter((section) => !!section)
|
|
645
|
-
.map((section) => {
|
|
646
|
-
const items = (section.items || [])
|
|
647
|
-
.filter((item) => !!item)
|
|
648
|
-
.map((item) => {
|
|
649
|
-
const athleteKey = item.athlete?.$key;
|
|
650
|
-
const athlete = athletes && athleteKey ? athletes[athleteKey] : undefined;
|
|
651
|
-
// Determine if this item should be highlighted (e.g. warning color)
|
|
652
|
-
// This abstraction allows the View to be sport-agnostic.
|
|
653
|
-
// Currently only "On Deck" in MLB triggers this.
|
|
654
|
-
const statusText = toText(item.status);
|
|
655
|
-
const isHighlighted = statusText === 'On Deck';
|
|
656
|
-
return {
|
|
657
|
-
status: statusText,
|
|
658
|
-
type: toText(item.type) || '',
|
|
659
|
-
displayName: toText(item.displayName) || '',
|
|
660
|
-
athlete,
|
|
661
|
-
isHighlighted,
|
|
662
|
-
};
|
|
663
|
-
});
|
|
664
|
-
const statistics = (section.statistics || [])
|
|
665
|
-
.filter((stat) => !!stat)
|
|
666
|
-
.map((stat) => ({
|
|
667
|
-
abbreviation: stat.abbreviation || '',
|
|
668
|
-
displayValue: stat.displayValue || '',
|
|
669
|
-
}));
|
|
670
|
-
return {
|
|
671
|
-
items,
|
|
672
|
-
statistics,
|
|
673
|
-
};
|
|
674
|
-
});
|
|
675
|
-
return {
|
|
676
|
-
type: 'careerMatchup',
|
|
677
|
-
title: careerMatchup.title || '',
|
|
678
|
-
sections,
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
parseHeaderTeams(response) {
|
|
682
|
-
return (this.parseHeaderTeamsFromTeamHeader(response) ||
|
|
683
|
-
this.parseHeaderTeamsFromHeader(response));
|
|
684
|
-
}
|
|
685
|
-
parseHeaderTeamsFromHeader(response) {
|
|
686
|
-
const headerTeams = response.header?.teams ||
|
|
687
|
-
[];
|
|
688
|
-
if (headerTeams.length === 0) {
|
|
689
|
-
return null;
|
|
690
|
-
}
|
|
691
|
-
return this.buildHeaderTeamsItem({
|
|
692
|
-
response,
|
|
693
|
-
headerTeams,
|
|
694
|
-
linescoresHeader: response.header?.linescoresHeader || [],
|
|
695
|
-
linescoresRowHeader: undefined,
|
|
696
|
-
isLiveFromHeaderSource: false,
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
parseHeaderTeamsFromTeamHeader(response) {
|
|
700
|
-
const headerTeams = response.header?.teams ||
|
|
701
|
-
[];
|
|
702
|
-
const teamHeaderTeams = response.teamHeader?.teams || [];
|
|
703
|
-
if (teamHeaderTeams.length === 0) {
|
|
704
|
-
return null;
|
|
705
|
-
}
|
|
706
|
-
const teamHeaderHasLinescores = teamHeaderTeams.some((t) => Array.isArray(t.linescores) && t.linescores.length > 0);
|
|
707
|
-
const teamHeaderHasLinescoresHeader = (response.teamHeader?.linescoresHeader?.length || 0) > 0;
|
|
708
|
-
if (!teamHeaderHasLinescores &&
|
|
709
|
-
!teamHeaderHasLinescoresHeader &&
|
|
710
|
-
headerTeams.length > 0) {
|
|
711
|
-
return null;
|
|
712
|
-
}
|
|
713
|
-
const linescoresRowHeader = response.teamHeader?.style?.linescores?.rowHeader === 'teamLogo'
|
|
714
|
-
? 'teamLogo'
|
|
715
|
-
: undefined;
|
|
716
|
-
return this.buildHeaderTeamsItem({
|
|
717
|
-
response,
|
|
718
|
-
headerTeams: teamHeaderTeams,
|
|
719
|
-
linescoresHeader: response.teamHeader?.linescoresHeader || [],
|
|
720
|
-
linescoresRowHeader,
|
|
721
|
-
isLiveFromHeaderSource: teamHeaderHasLinescores || teamHeaderHasLinescoresHeader,
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
buildHeaderTeamsItem(params) {
|
|
725
|
-
const { response, headerTeams, linescoresHeader: rawLinescoresHeader, linescoresRowHeader, isLiveFromHeaderSource, } = params;
|
|
726
|
-
const teams = response.entities?.teams;
|
|
727
|
-
if (!teams || headerTeams.length === 0) {
|
|
728
|
-
return null;
|
|
729
|
-
}
|
|
730
|
-
const homeTeamHeader = headerTeams.find((t) => {
|
|
731
|
-
const team = teams[t.$key];
|
|
732
|
-
return team && team.homeAway === 'home';
|
|
733
|
-
});
|
|
734
|
-
const awayTeamHeader = headerTeams.find((t) => {
|
|
735
|
-
const team = teams[t.$key];
|
|
736
|
-
return team && team.homeAway === 'away';
|
|
737
|
-
});
|
|
738
|
-
// If home/away isn't provided, fall back to list order.
|
|
739
|
-
const fallbackAwayTeamHeader = headerTeams[0];
|
|
740
|
-
const fallbackHomeTeamHeader = headerTeams[1];
|
|
741
|
-
const resolvedHomeTeamHeader = homeTeamHeader || fallbackHomeTeamHeader;
|
|
742
|
-
const resolvedAwayTeamHeader = awayTeamHeader || fallbackAwayTeamHeader;
|
|
743
|
-
if (!resolvedHomeTeamHeader || !resolvedAwayTeamHeader) {
|
|
744
|
-
return null;
|
|
745
|
-
}
|
|
746
|
-
const homeTeam = teams[resolvedHomeTeamHeader.$key];
|
|
747
|
-
const awayTeam = teams[resolvedAwayTeamHeader.$key];
|
|
748
|
-
if (!homeTeam || !awayTeam) {
|
|
749
|
-
return null;
|
|
750
|
-
}
|
|
751
|
-
const statistics = [];
|
|
752
|
-
const statisticsSet = new Set();
|
|
753
|
-
const rawAwayStats = awayTeam.statistics || [];
|
|
754
|
-
const rawHomeStats = homeTeam.statistics || [];
|
|
755
|
-
const awayStatistics = rawAwayStats.filter(isTeamStatistic);
|
|
756
|
-
const homeStatistics = rawHomeStats.filter(isTeamStatistic);
|
|
757
|
-
[...awayStatistics, ...homeStatistics].forEach((st) => {
|
|
758
|
-
statisticsSet.add(st.$key);
|
|
759
|
-
});
|
|
760
|
-
// Ensure all statistics from both teams are included
|
|
761
|
-
statisticsSet.forEach((statKey) => {
|
|
762
|
-
const awayStat = awayStatistics.find((st) => st.$key === statKey);
|
|
763
|
-
const homeStat = homeStatistics.find((st) => st.$key === statKey);
|
|
764
|
-
if (!awayStat || !homeStat) {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
statistics.push({
|
|
768
|
-
displayName: awayStat?.displayName || homeStat?.displayName || '',
|
|
769
|
-
awayTeamValue: awayStat?.value || 0,
|
|
770
|
-
homeTeamValue: homeStat?.value || 0,
|
|
771
|
-
awayTeamDisplayValue: awayStat?.displayValue || '0',
|
|
772
|
-
homeTeamDisplayValue: homeStat?.displayValue || '0',
|
|
773
|
-
});
|
|
774
|
-
});
|
|
775
|
-
const buildLinescores = (t) => {
|
|
776
|
-
if (t.linescores && t.linescores.length > 0) {
|
|
777
|
-
return t.linescores.map((l) => l.displayValue);
|
|
778
|
-
}
|
|
779
|
-
if (typeof t.score === 'string' && t.score.length > 0) {
|
|
780
|
-
return [t.score];
|
|
781
|
-
}
|
|
782
|
-
return [];
|
|
783
|
-
};
|
|
784
|
-
const maybeDetails = (t) => {
|
|
785
|
-
if (Array.isArray(t.details) && t.details.filter(Boolean).length > 0) {
|
|
786
|
-
return t.details.filter(Boolean);
|
|
787
|
-
}
|
|
788
|
-
return undefined;
|
|
789
|
-
};
|
|
790
|
-
const awayDetails = maybeDetails(resolvedAwayTeamHeader);
|
|
791
|
-
const homeDetails = maybeDetails(resolvedHomeTeamHeader);
|
|
792
|
-
let linescoresHeader = rawLinescoresHeader;
|
|
793
|
-
let awayTeamLinescores = buildLinescores(resolvedAwayTeamHeader);
|
|
794
|
-
let homeTeamLinescores = buildLinescores(resolvedHomeTeamHeader);
|
|
795
|
-
// If more than 9 innings are present, show only the last 9 innings plus R, H, E
|
|
796
|
-
const hasLinescoresAndHeader = linescoresHeader.length > 0 &&
|
|
797
|
-
(awayTeamLinescores.length > 0 || homeTeamLinescores.length > 0);
|
|
798
|
-
if (hasLinescoresAndHeader && linescoresRowHeader === 'teamLogo') {
|
|
799
|
-
const lastThreeHeaders = linescoresHeader.slice(-3);
|
|
800
|
-
const isMlbFormat = lastThreeHeaders.includes('R') ||
|
|
801
|
-
lastThreeHeaders.includes('H') ||
|
|
802
|
-
lastThreeHeaders.includes('E');
|
|
803
|
-
if (isMlbFormat && linescoresHeader.length > 12) {
|
|
804
|
-
// More than 9 innings + 3 stats (R, H, E)
|
|
805
|
-
const statsCount = 3; // R, H, E
|
|
806
|
-
const inningsCount = linescoresHeader.length - statsCount;
|
|
807
|
-
const maxInningsToShow = 9;
|
|
808
|
-
if (inningsCount > maxInningsToShow) {
|
|
809
|
-
const inningsToRemove = inningsCount - maxInningsToShow;
|
|
810
|
-
// Slice header to keep last 9 innings + stats (R, H, E)
|
|
811
|
-
linescoresHeader = linescoresHeader.slice(inningsToRemove);
|
|
812
|
-
// Apply same slicing to team linescores
|
|
813
|
-
awayTeamLinescores = awayTeamLinescores.slice(inningsToRemove);
|
|
814
|
-
homeTeamLinescores = homeTeamLinescores.slice(inningsToRemove);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
const isLive = response.gameState === 'in' ||
|
|
819
|
-
response.gameState === 'post' ||
|
|
820
|
-
isLiveFromHeaderSource;
|
|
821
|
-
return {
|
|
822
|
-
type: 'headerTeam',
|
|
823
|
-
linescoresHeader,
|
|
824
|
-
linescoresRowHeader,
|
|
825
|
-
isLive,
|
|
826
|
-
statistics,
|
|
827
|
-
awayTeam: {
|
|
828
|
-
abbreviation: awayTeam.abbreviation,
|
|
829
|
-
color: awayTeam.color,
|
|
830
|
-
id: awayTeam.id,
|
|
831
|
-
linescores: awayTeamLinescores,
|
|
832
|
-
logo: awayTeam.logo,
|
|
833
|
-
name: awayTeam.name,
|
|
834
|
-
record: awayTeam.record,
|
|
835
|
-
...(awayDetails ? { details: awayDetails } : {}),
|
|
836
|
-
},
|
|
837
|
-
homeTeam: {
|
|
838
|
-
abbreviation: homeTeam.abbreviation,
|
|
839
|
-
color: homeTeam.color,
|
|
840
|
-
id: homeTeam.id,
|
|
841
|
-
linescores: homeTeamLinescores,
|
|
842
|
-
logo: homeTeam.logo,
|
|
843
|
-
name: homeTeam.name,
|
|
844
|
-
record: homeTeam.record,
|
|
845
|
-
...(homeDetails ? { details: homeDetails } : {}),
|
|
846
|
-
},
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
parseRecentGames(response) {
|
|
850
|
-
const teams = response.entities?.teams;
|
|
851
|
-
const previousGames = response.previousGames;
|
|
852
|
-
if (!teams || !previousGames || previousGames.length === 0) {
|
|
853
|
-
return null;
|
|
854
|
-
}
|
|
855
|
-
const awayTeamPreviousGame = previousGames.find((game) => game?.displayOrder === 1);
|
|
856
|
-
const homeTeamPreviousGame = previousGames.find((game) => game?.displayOrder === 2);
|
|
857
|
-
if (!awayTeamPreviousGame || !homeTeamPreviousGame) {
|
|
858
|
-
return null;
|
|
859
|
-
}
|
|
860
|
-
if (!awayTeamPreviousGame.events || !homeTeamPreviousGame.events) {
|
|
861
|
-
return null;
|
|
862
|
-
}
|
|
863
|
-
if (!awayTeamPreviousGame.team?.$key || !homeTeamPreviousGame.team?.$key) {
|
|
864
|
-
return null;
|
|
865
|
-
}
|
|
866
|
-
const awayTeam = teams[awayTeamPreviousGame.team.$key];
|
|
867
|
-
const homeTeam = teams[homeTeamPreviousGame.team.$key];
|
|
868
|
-
if (!awayTeam || !homeTeam) {
|
|
869
|
-
return null;
|
|
870
|
-
}
|
|
871
|
-
const previousGame = {
|
|
872
|
-
type: 'recentGames',
|
|
873
|
-
awayTeam: {
|
|
874
|
-
events: [...awayTeamPreviousGame.events]
|
|
875
|
-
.reverse()
|
|
876
|
-
.filter((event) => event?.team?.$key)
|
|
877
|
-
.map((event) => {
|
|
878
|
-
const eventTeam = teams[event.team.$key];
|
|
879
|
-
return {
|
|
880
|
-
gameResult: event.gameResult,
|
|
881
|
-
homeAway: event.team.homeAway,
|
|
882
|
-
score: event.score,
|
|
883
|
-
teamLogo: eventTeam?.logo,
|
|
884
|
-
};
|
|
885
|
-
}),
|
|
886
|
-
logo: awayTeam.logo,
|
|
887
|
-
name: awayTeam.shortDisplayName,
|
|
888
|
-
},
|
|
889
|
-
homeTeam: {
|
|
890
|
-
events: [...homeTeamPreviousGame.events]
|
|
891
|
-
.reverse()
|
|
892
|
-
.filter((event) => event?.team?.$key)
|
|
893
|
-
.map((event) => {
|
|
894
|
-
const eventTeam = teams[event.team.$key];
|
|
895
|
-
return {
|
|
896
|
-
gameResult: event.gameResult,
|
|
897
|
-
homeAway: event.team.homeAway,
|
|
898
|
-
score: event.score,
|
|
899
|
-
teamLogo: eventTeam?.logo,
|
|
900
|
-
};
|
|
901
|
-
}),
|
|
902
|
-
logo: homeTeam.logo,
|
|
903
|
-
name: homeTeam.shortDisplayName,
|
|
904
|
-
},
|
|
905
|
-
};
|
|
906
|
-
return previousGame;
|
|
907
|
-
}
|
|
908
|
-
parseWinProbability(response) {
|
|
909
|
-
const winProbability = response.winProbability;
|
|
910
|
-
if (!winProbability ||
|
|
911
|
-
!winProbability.homeTeam ||
|
|
912
|
-
!winProbability.awayTeam) {
|
|
913
|
-
return null;
|
|
914
|
-
}
|
|
915
|
-
const teams = response.entities?.teams;
|
|
916
|
-
if (!teams) {
|
|
917
|
-
return null;
|
|
918
|
-
}
|
|
919
|
-
const homeTeam = teams[winProbability.homeTeam.team.$key];
|
|
920
|
-
const awayTeam = teams[winProbability.awayTeam.team.$key];
|
|
921
|
-
if (!homeTeam || !awayTeam) {
|
|
922
|
-
return null;
|
|
923
|
-
}
|
|
924
|
-
return {
|
|
925
|
-
type: 'winProbability',
|
|
926
|
-
chartImageUrl: winProbability.imageUrl,
|
|
927
|
-
awayTeam: {
|
|
928
|
-
id: awayTeam.id,
|
|
929
|
-
abbreviation: awayTeam.abbreviation,
|
|
930
|
-
logo: awayTeam.logo,
|
|
931
|
-
winPercentage: winProbability.awayTeam.winPercentage,
|
|
932
|
-
},
|
|
933
|
-
homeTeam: {
|
|
934
|
-
id: homeTeam.id,
|
|
935
|
-
abbreviation: homeTeam.abbreviation,
|
|
936
|
-
logo: homeTeam.logo,
|
|
937
|
-
winPercentage: winProbability.homeTeam.winPercentage,
|
|
938
|
-
},
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
parseGameLeaders(response) {
|
|
942
|
-
if (!response.entities?.athletes || !response.entities?.teams) {
|
|
943
|
-
return null;
|
|
944
|
-
}
|
|
945
|
-
const leaders = response.leaders;
|
|
946
|
-
const isPre = response.gameState === 'pre';
|
|
947
|
-
if (!leaders || leaders.length === 0) {
|
|
948
|
-
return null;
|
|
949
|
-
}
|
|
950
|
-
const items = [];
|
|
951
|
-
for (const leader of leaders) {
|
|
952
|
-
if (!leader.away || !leader.home) {
|
|
953
|
-
continue;
|
|
954
|
-
}
|
|
955
|
-
if (!leader.away?.athlete?.$key || !leader.home?.athlete?.$key) {
|
|
956
|
-
continue;
|
|
957
|
-
}
|
|
958
|
-
const awayAthlete = response.entities.athletes[leader.away.athlete.$key];
|
|
959
|
-
const homeAthlete = response.entities.athletes[leader.home.athlete.$key];
|
|
960
|
-
if (!awayAthlete || !homeAthlete) {
|
|
961
|
-
continue;
|
|
962
|
-
}
|
|
963
|
-
const awayAthleteStatistics = leader.away.athlete.statistics || [];
|
|
964
|
-
const homeAthleteStatistics = leader.home.athlete.statistics || [];
|
|
965
|
-
const value = {
|
|
966
|
-
displayName: leader.displayName,
|
|
967
|
-
awayAthlete: {
|
|
968
|
-
id: awayAthlete.id,
|
|
969
|
-
displayName: awayAthlete.displayName,
|
|
970
|
-
headshot: awayAthlete.headshot
|
|
971
|
-
? setImageDimensions(awayAthlete.headshot, 256, 144)
|
|
972
|
-
: '',
|
|
973
|
-
position: awayAthlete.position?.abbreviation || '-',
|
|
974
|
-
shortName: awayAthlete.shortName,
|
|
975
|
-
jersey: awayAthlete.jersey,
|
|
976
|
-
statistics: awayAthleteStatistics,
|
|
977
|
-
},
|
|
978
|
-
homeAthlete: {
|
|
979
|
-
id: homeAthlete.id,
|
|
980
|
-
displayName: homeAthlete.displayName,
|
|
981
|
-
headshot: homeAthlete.headshot
|
|
982
|
-
? setImageDimensions(homeAthlete.headshot, 256, 144)
|
|
983
|
-
: '',
|
|
984
|
-
position: homeAthlete.position?.abbreviation || '-',
|
|
985
|
-
shortName: homeAthlete.shortName,
|
|
986
|
-
jersey: homeAthlete.jersey,
|
|
987
|
-
statistics: homeAthleteStatistics,
|
|
988
|
-
},
|
|
989
|
-
};
|
|
990
|
-
items.push(value);
|
|
991
|
-
}
|
|
992
|
-
if (!items.length) {
|
|
993
|
-
return null;
|
|
994
|
-
}
|
|
995
|
-
return {
|
|
996
|
-
type: 'gameLeaders',
|
|
997
|
-
items,
|
|
998
|
-
displayText: isPre ? 'Season Leaders' : 'Game Leaders',
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
parseActiveAthletes(response) {
|
|
1002
|
-
const activeAthletes = response.activeAthletes;
|
|
1003
|
-
const { awayTeam, homeTeam } = this.getActiveAthletesTeamInfo(response);
|
|
1004
|
-
const athletes = [];
|
|
1005
|
-
if (!response.entities?.athletes ||
|
|
1006
|
-
!activeAthletes ||
|
|
1007
|
-
awayTeam.index === -1 ||
|
|
1008
|
-
homeTeam.index === -1) {
|
|
1009
|
-
return null;
|
|
1010
|
-
}
|
|
1011
|
-
for (let i = 0; i < activeAthletes.teams[awayTeam.index].athletes.length; i++) {
|
|
1012
|
-
const awayAthlete = activeAthletes.teams[awayTeam.index].athletes[i];
|
|
1013
|
-
const homeAthlete = activeAthletes.teams[homeTeam.index].athletes[i];
|
|
1014
|
-
if (!awayAthlete?.$key || !homeAthlete?.$key) {
|
|
1015
|
-
continue;
|
|
1016
|
-
}
|
|
1017
|
-
const awayAthleteInfo = response.entities.athletes[awayAthlete.$key];
|
|
1018
|
-
const homeAthleteInfo = response.entities.athletes[homeAthlete.$key];
|
|
1019
|
-
if (!awayAthleteInfo || !homeAthleteInfo) {
|
|
1020
|
-
continue;
|
|
1021
|
-
}
|
|
1022
|
-
const awayAthleteStatistics = [];
|
|
1023
|
-
const homeAthleteStatistics = [];
|
|
1024
|
-
const awayStatLine = awayAthlete.statLine || '';
|
|
1025
|
-
const homeStatLine = homeAthlete.statLine || '';
|
|
1026
|
-
awayStatLine
|
|
1027
|
-
.trim()
|
|
1028
|
-
.split(',')
|
|
1029
|
-
.forEach((st, index) => {
|
|
1030
|
-
const [awayDisplayValue, awayAbbreviation] = st.trim().split(' ');
|
|
1031
|
-
const homeStats = homeStatLine.trim().split(',')[index];
|
|
1032
|
-
if (!homeStats) {
|
|
1033
|
-
return;
|
|
1034
|
-
}
|
|
1035
|
-
const [homeDisplayValue, homeAbbreviation] = homeStats
|
|
1036
|
-
.trim()
|
|
1037
|
-
.split(' ');
|
|
1038
|
-
awayAthleteStatistics.push({
|
|
1039
|
-
displayValue: awayDisplayValue || '0',
|
|
1040
|
-
abbreviation: awayAbbreviation || '-',
|
|
1041
|
-
value: parseFloat(awayDisplayValue) || 0,
|
|
1042
|
-
});
|
|
1043
|
-
homeAthleteStatistics.push({
|
|
1044
|
-
displayValue: homeDisplayValue || '0',
|
|
1045
|
-
abbreviation: homeAbbreviation || '-',
|
|
1046
|
-
value: parseFloat(homeDisplayValue) || 0,
|
|
1047
|
-
});
|
|
1048
|
-
});
|
|
1049
|
-
athletes.push({
|
|
1050
|
-
awayAthlete: {
|
|
1051
|
-
id: awayAthleteInfo.id,
|
|
1052
|
-
displayName: awayAthleteInfo.displayName,
|
|
1053
|
-
headshot: awayAthleteInfo.headshot
|
|
1054
|
-
? setImageDimensions(awayAthleteInfo.headshot, 256, 144)
|
|
1055
|
-
: '',
|
|
1056
|
-
position: awayAthleteInfo.position?.abbreviation || '-',
|
|
1057
|
-
shortName: awayAthleteInfo.shortName,
|
|
1058
|
-
jersey: awayAthleteInfo.jersey,
|
|
1059
|
-
statistics: awayAthleteStatistics,
|
|
1060
|
-
minifiedStatistics: awayAthlete.statLine,
|
|
1061
|
-
},
|
|
1062
|
-
homeAthlete: {
|
|
1063
|
-
id: homeAthleteInfo.id,
|
|
1064
|
-
displayName: homeAthleteInfo.displayName,
|
|
1065
|
-
headshot: homeAthleteInfo.headshot
|
|
1066
|
-
? setImageDimensions(homeAthleteInfo.headshot, 256, 144)
|
|
1067
|
-
: '',
|
|
1068
|
-
position: homeAthleteInfo.position?.abbreviation || '-',
|
|
1069
|
-
shortName: homeAthleteInfo.shortName,
|
|
1070
|
-
jersey: homeAthleteInfo.jersey,
|
|
1071
|
-
statistics: homeAthleteStatistics,
|
|
1072
|
-
minifiedStatistics: homeAthlete.statLine,
|
|
1073
|
-
},
|
|
1074
|
-
});
|
|
1075
|
-
}
|
|
1076
|
-
if (!athletes.length) {
|
|
1077
|
-
return null;
|
|
1078
|
-
}
|
|
1079
|
-
return {
|
|
1080
|
-
type: 'activeAthletes',
|
|
1081
|
-
awayTeam,
|
|
1082
|
-
homeTeam,
|
|
1083
|
-
athletes,
|
|
1084
|
-
displayText: activeAthletes.displayText,
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
getActiveAthletesTeamInfo(data) {
|
|
1088
|
-
const teams = data.activeAthletes?.teams || [];
|
|
1089
|
-
let awayTeam = {
|
|
1090
|
-
index: -1,
|
|
1091
|
-
id: '',
|
|
1092
|
-
logo: '',
|
|
1093
|
-
name: '-',
|
|
1094
|
-
};
|
|
1095
|
-
let homeTeam = {
|
|
1096
|
-
index: -1,
|
|
1097
|
-
id: '',
|
|
1098
|
-
logo: '',
|
|
1099
|
-
name: '-',
|
|
1100
|
-
};
|
|
1101
|
-
const entitiesTeams = data.entities?.teams;
|
|
1102
|
-
if (!entitiesTeams) {
|
|
1103
|
-
return { awayTeam, homeTeam };
|
|
1104
|
-
}
|
|
1105
|
-
for (let i = 0; i < teams.length; i++) {
|
|
1106
|
-
const teamInfo = teams[i];
|
|
1107
|
-
const team = entitiesTeams[teamInfo.team.$key];
|
|
1108
|
-
if (!team) {
|
|
1109
|
-
continue;
|
|
1110
|
-
}
|
|
1111
|
-
if (team.homeAway === 'away') {
|
|
1112
|
-
awayTeam = {
|
|
1113
|
-
index: i,
|
|
1114
|
-
id: team.id,
|
|
1115
|
-
logo: team.logo,
|
|
1116
|
-
name: team.name || '-',
|
|
1117
|
-
};
|
|
1118
|
-
}
|
|
1119
|
-
else if (team.homeAway === 'home') {
|
|
1120
|
-
homeTeam = {
|
|
1121
|
-
index: i,
|
|
1122
|
-
id: team.id,
|
|
1123
|
-
logo: team.logo,
|
|
1124
|
-
name: team.name || '-',
|
|
1125
|
-
};
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
return { awayTeam, homeTeam };
|
|
1129
|
-
}
|
|
1130
|
-
parseScoringSummary(data) {
|
|
1131
|
-
const scoringSummary = data.scoringSummary;
|
|
1132
|
-
if (!scoringSummary || !scoringSummary.sections) {
|
|
1133
|
-
return null;
|
|
1134
|
-
}
|
|
1135
|
-
const teams = data.entities?.teams;
|
|
1136
|
-
const athletes = data.entities?.athletes;
|
|
1137
|
-
// Handle MLB Scoring Summary
|
|
1138
|
-
if (isMlbScoringSummary(scoringSummary)) {
|
|
1139
|
-
const sections = [];
|
|
1140
|
-
for (const section of scoringSummary.sections) {
|
|
1141
|
-
if (!section.title || !section.items?.length) {
|
|
1142
|
-
continue;
|
|
1143
|
-
}
|
|
1144
|
-
const items = [];
|
|
1145
|
-
for (const item of section.items) {
|
|
1146
|
-
if (!item?.team?.$key || !item?.athlete?.$key) {
|
|
1147
|
-
continue;
|
|
1148
|
-
}
|
|
1149
|
-
const team = teams?.[item.team.$key];
|
|
1150
|
-
const athlete = athletes?.[item.athlete.$key];
|
|
1151
|
-
const athleteNumber = `#${athlete?.jersey || ''}`;
|
|
1152
|
-
const athleteName = athlete?.shortName || '';
|
|
1153
|
-
if (!team || !athlete) {
|
|
1154
|
-
continue;
|
|
1155
|
-
}
|
|
1156
|
-
const textParts = [];
|
|
1157
|
-
if (athleteNumber) {
|
|
1158
|
-
textParts.push({
|
|
1159
|
-
featured: false,
|
|
1160
|
-
title: athleteNumber,
|
|
1161
|
-
});
|
|
1162
|
-
}
|
|
1163
|
-
if (athleteName) {
|
|
1164
|
-
textParts.push({
|
|
1165
|
-
featured: true,
|
|
1166
|
-
title: athleteName,
|
|
1167
|
-
});
|
|
1168
|
-
}
|
|
1169
|
-
items.push({
|
|
1170
|
-
teamLogo: team?.logo || '',
|
|
1171
|
-
teamName: team?.abbreviation,
|
|
1172
|
-
headshot: athlete?.headshot
|
|
1173
|
-
? setImageDimensions(athlete.headshot, 200, 144)
|
|
1174
|
-
: undefined,
|
|
1175
|
-
athleteShortName: athlete?.shortName || '',
|
|
1176
|
-
athleteJersey: athlete?.jersey || '',
|
|
1177
|
-
athletePosition: athlete?.position?.abbreviation || '',
|
|
1178
|
-
text: item?.text || '',
|
|
1179
|
-
shortText: textParts,
|
|
1180
|
-
header: (item?.header || []).map((h, index) => ({
|
|
1181
|
-
featured: h.featured ?? false,
|
|
1182
|
-
title: `${h.title ?? ''}${index === 0 ? ',' : ''}`,
|
|
1183
|
-
})),
|
|
1184
|
-
});
|
|
1185
|
-
}
|
|
1186
|
-
if (items.length > 0) {
|
|
1187
|
-
sections.push({
|
|
1188
|
-
title: section.title,
|
|
1189
|
-
items,
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
if (sections.length === 0) {
|
|
1194
|
-
return null;
|
|
1195
|
-
}
|
|
1196
|
-
return {
|
|
1197
|
-
type: 'scoringSummary',
|
|
1198
|
-
tag: 'mlb',
|
|
1199
|
-
title: scoringSummary.title || 'Scoring Summary',
|
|
1200
|
-
sections,
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
|
-
// Handle Hockey Scoring Summary - transform to unified format
|
|
1204
|
-
else if (isHockeyScoringSummary(scoringSummary)) {
|
|
1205
|
-
const hockeySummary = scoringSummary;
|
|
1206
|
-
const sections = [];
|
|
1207
|
-
for (const section of hockeySummary.sections || []) {
|
|
1208
|
-
const items = [];
|
|
1209
|
-
for (const item of section.items || []) {
|
|
1210
|
-
if (!item?.team?.$key || !item?.athlete?.$key || !item?.title) {
|
|
1211
|
-
continue;
|
|
1212
|
-
}
|
|
1213
|
-
const team = item.team && item.team.$key ? teams?.[item.team.$key] : undefined;
|
|
1214
|
-
const atheleteKey = item.athlete?.$key || '';
|
|
1215
|
-
const athlete = athletes?.[atheleteKey];
|
|
1216
|
-
const itemTitle = item.title || '';
|
|
1217
|
-
const [athleteNumber, ...athleteNameWithAssists] = itemTitle.split(' ');
|
|
1218
|
-
let athleteAssists = '';
|
|
1219
|
-
let athleteName = '';
|
|
1220
|
-
if (athleteNameWithAssists.length > 0) {
|
|
1221
|
-
athleteAssists =
|
|
1222
|
-
athleteNameWithAssists[athleteNameWithAssists.length - 1];
|
|
1223
|
-
athleteName = athleteNameWithAssists.slice(0, -1).join(' ');
|
|
1224
|
-
}
|
|
1225
|
-
const header = [];
|
|
1226
|
-
if (item.clock) {
|
|
1227
|
-
header.push({ featured: true, title: item.clock });
|
|
1228
|
-
}
|
|
1229
|
-
if (team?.abbreviation) {
|
|
1230
|
-
header.push({ featured: false, title: team.abbreviation });
|
|
1231
|
-
}
|
|
1232
|
-
const textParts = [];
|
|
1233
|
-
if (athleteNumber) {
|
|
1234
|
-
textParts.push({ featured: false, title: athleteNumber });
|
|
1235
|
-
}
|
|
1236
|
-
if (athleteName) {
|
|
1237
|
-
textParts.push({ featured: true, title: athleteName });
|
|
1238
|
-
}
|
|
1239
|
-
if (athleteAssists) {
|
|
1240
|
-
textParts.push({ featured: false, title: athleteAssists });
|
|
1241
|
-
}
|
|
1242
|
-
items.push({
|
|
1243
|
-
teamLogo: team?.logo || '',
|
|
1244
|
-
teamName: team?.abbreviation || '',
|
|
1245
|
-
header,
|
|
1246
|
-
text: item?.description || '',
|
|
1247
|
-
shortText: textParts,
|
|
1248
|
-
headshot: athlete?.headshot
|
|
1249
|
-
? setImageDimensions(athlete.headshot, 200, 144)
|
|
1250
|
-
: undefined,
|
|
1251
|
-
athleteShortName: athleteName,
|
|
1252
|
-
athletePosition: athlete?.position?.abbreviation || '',
|
|
1253
|
-
athleteJersey: athleteNumber,
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
if (items.length > 0) {
|
|
1257
|
-
sections.push({
|
|
1258
|
-
title: section?.title || '',
|
|
1259
|
-
items,
|
|
1260
|
-
});
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
if (sections.length === 0) {
|
|
1264
|
-
return null;
|
|
1265
|
-
}
|
|
1266
|
-
return {
|
|
1267
|
-
type: 'scoringSummary',
|
|
1268
|
-
tag: 'hockey',
|
|
1269
|
-
title: hockeySummary.title || 'Scoring Summary',
|
|
1270
|
-
sections,
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
return null;
|
|
1274
|
-
}
|
|
1275
|
-
parsePenalties(data) {
|
|
1276
|
-
const penalties = data.penaltySummary;
|
|
1277
|
-
if (!penalties || !penalties.sections) {
|
|
1278
|
-
return null;
|
|
1279
|
-
}
|
|
1280
|
-
const teams = data.entities?.teams;
|
|
1281
|
-
const athletes = data.entities?.athletes;
|
|
1282
|
-
const sections = penalties.sections.map((section) => {
|
|
1283
|
-
const items = section.items
|
|
1284
|
-
.filter((item) => item?.team?.$key && item?.athlete?.$key)
|
|
1285
|
-
.map((item) => {
|
|
1286
|
-
const team = teams?.[item.team.$key];
|
|
1287
|
-
const athlete = athletes?.[item.athlete.$key];
|
|
1288
|
-
const [athleteNumber, ...athleteName] = item.title.split(' ');
|
|
1289
|
-
const athleteDisplayName = (athleteName ?? []).join(' ') || '';
|
|
1290
|
-
const textParts = [];
|
|
1291
|
-
if (athleteNumber) {
|
|
1292
|
-
textParts.push({
|
|
1293
|
-
featured: false,
|
|
1294
|
-
title: athleteNumber,
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
if (athleteDisplayName) {
|
|
1298
|
-
textParts.push({
|
|
1299
|
-
featured: true,
|
|
1300
|
-
title: athleteDisplayName,
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
return {
|
|
1304
|
-
teamLogo: team?.logo || '',
|
|
1305
|
-
teamName: team?.abbreviation || '',
|
|
1306
|
-
header: [{ title: item.clock || '', featured: false }],
|
|
1307
|
-
text: item.description || '',
|
|
1308
|
-
shortText: textParts,
|
|
1309
|
-
headshot: athlete?.headshot
|
|
1310
|
-
? setImageDimensions(athlete.headshot, 200, 144)
|
|
1311
|
-
: undefined,
|
|
1312
|
-
athleteShortName: athleteName.join(' '),
|
|
1313
|
-
athletePosition: athlete?.position?.abbreviation || '',
|
|
1314
|
-
athleteJersey: athleteNumber || '',
|
|
1315
|
-
};
|
|
1316
|
-
});
|
|
1317
|
-
return {
|
|
1318
|
-
title: section.title,
|
|
1319
|
-
items,
|
|
1320
|
-
};
|
|
1321
|
-
});
|
|
1322
|
-
if (!sections.length || sections.every((s) => s.items.length === 0)) {
|
|
1323
|
-
return null;
|
|
1324
|
-
}
|
|
1325
|
-
return {
|
|
1326
|
-
type: 'penalties',
|
|
1327
|
-
tag: 'penalties',
|
|
1328
|
-
title: penalties.title,
|
|
1329
|
-
sections,
|
|
1330
|
-
};
|
|
1331
|
-
}
|
|
1332
|
-
parsePlayerSeasonStats(data) {
|
|
1333
|
-
const playerStats = data.playerStats;
|
|
1334
|
-
const teams = data.entities?.teams;
|
|
1335
|
-
const athletes = data.entities?.athletes;
|
|
1336
|
-
if (!playerStats?.teams?.length || !teams) {
|
|
1337
|
-
return null;
|
|
1338
|
-
}
|
|
1339
|
-
const parsedTeams = [];
|
|
1340
|
-
for (const playerStatsTeam of playerStats.teams) {
|
|
1341
|
-
if (!playerStatsTeam.$key) {
|
|
1342
|
-
continue;
|
|
1343
|
-
}
|
|
1344
|
-
const team = teams[playerStatsTeam.$key];
|
|
1345
|
-
if (!team) {
|
|
1346
|
-
continue;
|
|
1347
|
-
}
|
|
1348
|
-
const sections = [];
|
|
1349
|
-
for (const section of playerStatsTeam.sections || []) {
|
|
1350
|
-
if (!section.title || !section.items?.length) {
|
|
1351
|
-
continue;
|
|
1352
|
-
}
|
|
1353
|
-
const items = [];
|
|
1354
|
-
for (const item of section.items) {
|
|
1355
|
-
if (!item.title) {
|
|
1356
|
-
continue;
|
|
1357
|
-
}
|
|
1358
|
-
const athleteKey = item.athlete?.$key;
|
|
1359
|
-
const athlete = athleteKey
|
|
1360
|
-
? athletes?.[athleteKey]
|
|
1361
|
-
: undefined;
|
|
1362
|
-
const statistics = item.athlete?.statistics || [];
|
|
1363
|
-
const featuredStat = statistics.find((s) => s.featured);
|
|
1364
|
-
items.push({
|
|
1365
|
-
title: item.title,
|
|
1366
|
-
headshot: athlete?.headshot
|
|
1367
|
-
? setImageDimensions(athlete.headshot, 256, 144)
|
|
1368
|
-
: '',
|
|
1369
|
-
position: athlete?.position?.abbreviation || '',
|
|
1370
|
-
jersey: athlete?.jersey || '',
|
|
1371
|
-
featuredStat: featuredStat
|
|
1372
|
-
? {
|
|
1373
|
-
displayValue: featuredStat.displayValue || '',
|
|
1374
|
-
label: featuredStat.label || '',
|
|
1375
|
-
}
|
|
1376
|
-
: null,
|
|
1377
|
-
statistics: statistics
|
|
1378
|
-
.filter((s) => !s.featured)
|
|
1379
|
-
.map((s) => ({
|
|
1380
|
-
displayValue: s.displayValue || '',
|
|
1381
|
-
label: s.label || '',
|
|
1382
|
-
})),
|
|
1383
|
-
playerStatus: item?.status
|
|
1384
|
-
? {
|
|
1385
|
-
displayName: item.status.displayName ?? '',
|
|
1386
|
-
type: item.status.type ?? '',
|
|
1387
|
-
}
|
|
1388
|
-
: null,
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
if (items.length > 0) {
|
|
1392
|
-
sections.push({
|
|
1393
|
-
title: section.title,
|
|
1394
|
-
items,
|
|
1395
|
-
});
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
if (sections.length > 0) {
|
|
1399
|
-
parsedTeams.push({
|
|
1400
|
-
teamKey: playerStatsTeam.$key,
|
|
1401
|
-
shortDisplayName: team.shortDisplayName || team.displayName || '',
|
|
1402
|
-
color: team.color || '',
|
|
1403
|
-
sections,
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
if (parsedTeams.length === 0) {
|
|
1408
|
-
return null;
|
|
1409
|
-
}
|
|
1410
|
-
return {
|
|
1411
|
-
type: 'playerSeasonStats',
|
|
1412
|
-
teams: parsedTeams,
|
|
1413
|
-
};
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
export default StatsViewModel;
|