@maestro_io/maestro-web-sdk 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/MaestroEventDelegate.d.ts +4 -0
  2. package/dist/components/atoms/BaseButton/BaseButton.d.ts +2 -4
  3. package/dist/components/atoms/Image/index.d.ts +5 -1
  4. package/dist/components/atoms/Rive/index.d.ts +89 -0
  5. package/dist/components/atoms/SvgIcon/BetGeneralIcon.d.ts +4 -0
  6. package/dist/components/atoms/SvgIcon/BetsWarningIcon.d.ts +7 -0
  7. package/dist/components/atoms/SvgIcon/CheckmarkIcon.d.ts +4 -0
  8. package/dist/components/atoms/SvgIcon/CollapseIcon.d.ts +4 -0
  9. package/dist/components/atoms/SvgIcon/ExpandIcon.d.ts +4 -0
  10. package/dist/components/atoms/SvgIcon/FlameIcon.d.ts +7 -0
  11. package/dist/components/atoms/SvgIcon/Icon.d.ts +10 -0
  12. package/dist/components/atoms/SvgIcon/MobilePhoneIcon.d.ts +7 -0
  13. package/dist/components/atoms/SvgIcon/TimesIcon.d.ts +4 -0
  14. package/dist/components/core/OverlayContainer.d.ts +3 -0
  15. package/dist/components/core/PanelManager/PanelManager.d.ts +1 -0
  16. package/dist/components/core/ScrollableContainer/FocusableItem.d.ts +6 -0
  17. package/dist/components/core/ScrollableContainer/ScrollableContainer.d.ts +75 -0
  18. package/dist/components/core/ScrollableContainer/index.d.ts +2 -0
  19. package/dist/components/molecules/ActionButton/ActionButton.d.ts +5 -8
  20. package/dist/components/molecules/Overlay/Overlay.d.ts +35 -0
  21. package/dist/components/molecules/Overlay/index.d.ts +2 -0
  22. package/dist/components/molecules/PanelNavButton/PanelNavButton.d.ts +40 -91
  23. package/dist/components/molecules/SegmentButton/SegmentButton.d.ts +6 -7
  24. package/dist/components/organisms/PanelNavigation/PanelNavigation.d.ts +7 -0
  25. package/dist/components/organisms/SegmentController/SegmentController.d.ts +19 -5
  26. package/dist/components/organisms/SegmentController/index.d.ts +2 -1
  27. package/dist/external/AxiosNetworkClient.d.ts +8 -3
  28. package/dist/external/LocalStorageCacheManager.d.ts +63 -8
  29. package/dist/external/mocks/MockExternalNetworkClient.d.ts +90 -0
  30. package/dist/external/ports/cacheManager.d.ts +3 -1
  31. package/dist/external/ports/networkClient.d.ts +1 -1
  32. package/dist/external/spatial-navigation/spatialNavigation.d.ts +13 -22
  33. package/dist/external/spatial-navigation/utils.d.ts +5 -0
  34. package/dist/external/spatial-navigation/withFocusable.d.ts +12 -17
  35. package/dist/index.d.ts +22 -11
  36. package/dist/interfaces/IMaestroEvent.d.ts +9 -0
  37. package/dist/interfaces/IMaestroEventDelegate.d.ts +17 -0
  38. package/dist/interfaces/IMaestroManager.d.ts +33 -20
  39. package/dist/maestro-web-sdk.umd.js +10 -1
  40. package/dist/maestro-web-sdk.umd.js.map +1 -1
  41. package/dist/models/IWinningBet.d.ts +7 -0
  42. package/dist/modules/bets/interfaces/IBets.d.ts +190 -0
  43. package/dist/modules/bets/mocks.d.ts +2 -0
  44. package/dist/modules/bets/view/BetsView.d.ts +23 -0
  45. package/dist/modules/bets/view/HotProps/HotPropsView.d.ts +53 -0
  46. package/dist/modules/bets/view/SixPack/SixPackView.d.ts +20 -0
  47. package/dist/modules/bets/view/TabLoadFailureView.d.ts +46 -0
  48. package/dist/modules/bets/view/UserBets/BetResult/BetResult.d.ts +6 -0
  49. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +53 -0
  50. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +24 -0
  51. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +7 -0
  52. package/dist/modules/bets/view/UserBets/Boost/Boost.d.ts +7 -0
  53. package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.d.ts +7 -0
  54. package/dist/modules/bets/view/UserBets/Parlay/Parlay.d.ts +8 -0
  55. package/dist/modules/bets/view/UserBets/Straight/Straight.d.ts +7 -0
  56. package/dist/modules/bets/view/UserBets/Teaser/Teaser.d.ts +7 -0
  57. package/dist/modules/bets/view/UserBets/UserBetsView.d.ts +26 -0
  58. package/dist/modules/bets/view/components/Bet/Bet.d.ts +62 -0
  59. package/dist/modules/bets/view/components/BetPill/BetPill.d.ts +6 -0
  60. package/dist/modules/bets/view/components/BetsCard/BetsCard.d.ts +10 -0
  61. package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.d.ts +16 -0
  62. package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.d.ts +8 -0
  63. package/dist/modules/bets/view/components/LocationWarning/LocationWarning.d.ts +10 -0
  64. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +22 -0
  65. package/dist/modules/bets/view/components/PromoCodeBanner/index.d.ts +2 -0
  66. package/dist/modules/bets/view-model/BetsViewModel.d.ts +179 -0
  67. package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +28 -102
  68. package/dist/modules/key-plays/view/KeyPlaysView.d.ts +1 -4
  69. package/dist/services/BetsService.d.ts +61 -0
  70. package/dist/services/NetworkManager/NetworkManager.d.ts +131 -0
  71. package/dist/services/NetworkManager/errors.d.ts +17 -0
  72. package/dist/types/OverlayTypes.d.ts +43 -0
  73. package/dist/view-models/MaestroEventViewModel.d.ts +5 -1
  74. package/dist/view-models/OverlayViewModel.d.ts +33 -0
  75. package/dist/view-models/index.d.ts +2 -0
  76. package/package.json +9 -18
  77. package/dist/components/molecules/ScrollableGradient/ScrollableGradient.d.ts +0 -11
  78. package/dist/components/molecules/ScrollableGradient/index.d.ts +0 -2
  79. package/dist/helpers/withRemoteControl.d.ts +0 -47
  80. package/dist/services/NetworkManager.d.ts +0 -13
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import './PromoCodeBanner.styles.css';
3
+ import { WithFocusableProps } from '@/external/spatial-navigation';
4
+ import { Details, Direction, Layout } from '@/external/spatial-navigation/utils';
5
+ export interface PromoCodeBannerProps extends WithFocusableProps {
6
+ title: string;
7
+ description: string;
8
+ logo: string;
9
+ qrCode: string;
10
+ showLogo?: boolean;
11
+ }
12
+ export default class FocusablePromoCodeBannerWrapper extends React.Component<PromoCodeBannerProps> {
13
+ static contextTypes: {
14
+ refsMap: React.Requireable<any>;
15
+ setRef: React.Requireable<any>;
16
+ scrollToFocusedElement: React.Requireable<any>;
17
+ };
18
+ context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
19
+ onBecameFocused: (layout: Layout) => void;
20
+ onArrowPress: (d: Direction, _props: any, details: Details) => void;
21
+ render(): React.JSX.Element;
22
+ }
@@ -0,0 +1,2 @@
1
+ export { default as BetItemPromoCode } from './PromoCodeBanner';
2
+ export type { PromoCodeBannerProps } from './PromoCodeBanner';
@@ -0,0 +1,179 @@
1
+ import { Observable } from '../../../helpers/Observable';
2
+ import { ITeam, IUserBet, IBetLeg } from '../interfaces/IBets';
3
+ import { ViewModel } from '../../../view-models/ViewModel';
4
+ import { TestUseCase } from '@/interfaces/IMaestroEvent';
5
+ import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
6
+ declare const BET_ITEM_TYPE: {
7
+ readonly ODDS: "odds";
8
+ readonly USER_BETS: "userBets";
9
+ readonly PROMO: "promo";
10
+ readonly HOT_PROPS: "hotProps";
11
+ readonly LOCATION_DISCLAIMER: "locationDisclaimer";
12
+ readonly GAMBLING_MESSAGE: "gamblingMessage";
13
+ };
14
+ export type BetItemType = typeof BET_ITEM_TYPE[keyof typeof BET_ITEM_TYPE];
15
+ type TeamOdd = {
16
+ teamAbbreviation: string;
17
+ startOfGameFirstLine: string;
18
+ startOfGameSecondLine: string;
19
+ gameSpreadFirstLine: string;
20
+ gameSpreadSecondLine: string;
21
+ totalPointsFirstLine: string;
22
+ totalPointsSecondLine: string;
23
+ moneylineFirstLine: string;
24
+ };
25
+ export type ISixPackOdds = {
26
+ awayTeamOdds: TeamOdd;
27
+ homeTeamOdds: TeamOdd;
28
+ gameState: string;
29
+ sport: string;
30
+ };
31
+ export type IUserBets = {
32
+ defaultTab: string;
33
+ bets: {
34
+ live: IUserBet[];
35
+ upcoming: IUserBet[];
36
+ settled: IUserBet[];
37
+ };
38
+ };
39
+ export type IHotProps = {
40
+ items: IBetLeg[];
41
+ };
42
+ export type ILocationDisclaimer = {
43
+ text: string;
44
+ };
45
+ export type IGamblingMessage = {
46
+ text: string;
47
+ };
48
+ export type IBetPromo = {
49
+ title: string;
50
+ description: string;
51
+ logo: string;
52
+ qrCode: string;
53
+ };
54
+ export type PromoBetItem = {
55
+ id: string;
56
+ type: 'promo';
57
+ data: IBetPromo;
58
+ };
59
+ export type LocationDisclaimerBetItem = {
60
+ type: 'locationDisclaimer';
61
+ id: string;
62
+ data: ILocationDisclaimer;
63
+ };
64
+ export type GamblingMessageBetItem = {
65
+ type: 'gamblingMessage';
66
+ id: string;
67
+ data: IGamblingMessage;
68
+ };
69
+ export type SixPackBetItem = {
70
+ type: 'sixPack';
71
+ data: ISixPackOdds;
72
+ teamInfo?: {
73
+ home: ITeam;
74
+ away: ITeam;
75
+ };
76
+ id: string;
77
+ };
78
+ export type UserBetsBetItem = {
79
+ type: 'userBets';
80
+ data: IUserBets;
81
+ id: string;
82
+ };
83
+ export type HotPropsBetItem = {
84
+ type: 'hotProps';
85
+ data: IHotProps;
86
+ id: string;
87
+ };
88
+ export type BetItem = SixPackBetItem | UserBetsBetItem | PromoBetItem | HotPropsBetItem | LocationDisclaimerBetItem | GamblingMessageBetItem;
89
+ declare const BET_ERROR_STATE: {
90
+ readonly NONE: "none";
91
+ readonly TAB_LOAD_FAILURE: "tabLoadFailure";
92
+ };
93
+ export type BetsErrorState = typeof BET_ERROR_STATE[keyof typeof BET_ERROR_STATE];
94
+ export interface IBetsViewModelDelegate {
95
+ userIsAuthenticated(): Promise<boolean>;
96
+ getUserSWID(): Promise<string | null>;
97
+ getUserToken(): Promise<string | null>;
98
+ }
99
+ export declare class BetsViewModel extends ViewModel {
100
+ betsItems: Observable<BetItem[]>;
101
+ isDataLoading: Observable<boolean>;
102
+ errorState: Observable<BetsErrorState>;
103
+ hasEverSuccessfullyLoaded: Observable<boolean>;
104
+ private eventId;
105
+ private delegate;
106
+ private betsService;
107
+ private pollingInterval;
108
+ private pollingTask;
109
+ private lastNonPersonalizedResponseHash;
110
+ private lastPersonalizedResponseHash;
111
+ private useMockData;
112
+ initialized: boolean;
113
+ constructor(eventId: string, delegate: IMaestroEventDelegate, options?: {
114
+ pollingInterval?: number;
115
+ useMockData?: boolean;
116
+ });
117
+ /**
118
+ * Initialize the ViewModel and start data fetching
119
+ */
120
+ init(): Promise<void>;
121
+ /**
122
+ * Clean up resources when the ViewModel is no longer needed
123
+ */
124
+ cleanup(): void;
125
+ /**
126
+ * Refresh polling for bet data
127
+ */
128
+ refreshPolling(): void;
129
+ /**
130
+ * Poll with the correct method based on authentication status
131
+ */
132
+ private pollWithInterval;
133
+ /**
134
+ * Process data received from polling
135
+ */
136
+ private processPolledData;
137
+ /**
138
+ * Process the bets data and update the betsItems
139
+ */
140
+ private processBetsData;
141
+ private processLocationDisclaimer;
142
+ private processPromoCode;
143
+ private processGamblingMessage;
144
+ private processSixPackData;
145
+ private processUserBetsData;
146
+ private processHotProps;
147
+ /**
148
+ * Handle errors that occur during polling
149
+ */
150
+ private handlePollingError;
151
+ /**
152
+ * Stop polling for bet data
153
+ */
154
+ stopPolling(): void;
155
+ /**
156
+ * Fetch new bet data immediately (one-time)
157
+ */
158
+ fetchNewData(): Promise<void>;
159
+ /**
160
+ * Fetch personalized bet data
161
+ */
162
+ private fetchPersonalizedData;
163
+ /**
164
+ * Fetch non-personalized bet data
165
+ */
166
+ private fetchNonPersonalizedData;
167
+ /**
168
+ * Fetch mock data for testing
169
+ */
170
+ private fetchMockData;
171
+ simulateUseCase<T = any>(useCase: TestUseCase, _: T): void;
172
+ clearTabLoadFailure(): void;
173
+ }
174
+ declare global {
175
+ interface String {
176
+ hashCode(): number;
177
+ }
178
+ }
179
+ export default BetsViewModel;
@@ -1,115 +1,41 @@
1
- /// <reference types="prop-types" />
2
- import IKeyPlay from '../interfaces/IKeyPlays';
1
+ import IKeyPlay, { KeyPlayLoadFailureStatus } from '../interfaces/IKeyPlays';
3
2
  import './KeyPlayCardView.styles.css';
4
3
  import React from 'react';
5
4
  import { WithFocusableProps } from '@/external/spatial-navigation';
6
- import { RemoteControlProps } from '@/helpers/withRemoteControl';
5
+ import { Direction, Layout } from '@/external/spatial-navigation/utils';
7
6
  type KeyPlayCardViewProps = IKeyPlay & {
8
7
  isPlaying: boolean;
9
8
  playbackProgress: number | null;
10
9
  isScoring: boolean;
11
- setFocus?: (focusKey: string) => void;
12
- focused?: boolean;
13
10
  setRef: (ref: HTMLDivElement | null) => void;
14
11
  };
15
- export declare class KeyPlayCard extends React.Component<KeyPlayCardViewProps & WithFocusableProps & RemoteControlProps> {
12
+ type KeyPlaysCardViewState = {
13
+ failedClip: KeyPlayLoadFailureStatus | null;
14
+ };
15
+ export declare class KeyPlayCardView extends React.Component<KeyPlayCardViewProps & WithFocusableProps, KeyPlaysCardViewState> {
16
+ private failedClipListener;
16
17
  private ref;
17
- setRef: (ref: HTMLDivElement | null) => void;
18
- handleLeftPressed: () => void;
18
+ private vm;
19
+ state: {
20
+ failedClip: null;
21
+ };
22
+ constructor(props: KeyPlayCardViewProps);
23
+ componentDidMount(): void;
24
+ componentWillUnmount(): void;
25
+ renderImage: () => React.JSX.Element;
19
26
  render(): React.JSX.Element;
20
27
  }
21
- declare const _default: {
22
- new (props?: (IKeyPlay & {
23
- isPlaying: boolean;
24
- playbackProgress: number | null;
25
- isScoring: boolean;
26
- setFocus?: ((focusKey: string) => void) | undefined;
27
- focused?: boolean | undefined;
28
- setRef: (ref: HTMLDivElement | null) => void;
29
- } & WithFocusableProps & RemoteControlProps) | undefined, context?: any): {
30
- state: import("../../../external/spatial-navigation/withFocusable").WithFocusableState;
31
- getChildContext(): {
32
- parentFocusKey: string;
33
- };
34
- setFocus: (focusKey: string) => void;
35
- navigateByDirection: (direction: import("../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
36
- stealFocus: () => void;
37
- onUpdateFocus: (focused: boolean) => void;
38
- onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
39
- onEnterPressHandler: (details: {
40
- pressedKeys: Record<string, number>;
41
- }) => void;
42
- onEnterReleaseHandler: () => void;
43
- onArrowPressHandler: (direction: import("../../../external/spatial-navigation/utils").Direction, details: {
44
- pressedKeys: Record<string, number>;
45
- }) => boolean | void;
46
- onBecameFocusedHandler: (layout: import("../../../external/spatial-navigation/utils").Layout, details: any) => void;
47
- onBecameBlurredHandler: (layout: import("../../../external/spatial-navigation/utils").Layout, details: any) => void;
48
- componentDidMount(): void;
49
- componentDidUpdate(): void;
50
- componentWillUnmount(): void;
51
- render(): React.ReactElement<IKeyPlay & {
52
- isPlaying: boolean;
53
- playbackProgress: number | null;
54
- isScoring: boolean;
55
- setFocus?: ((focusKey: string) => void) | undefined;
56
- focused?: boolean | undefined;
57
- setRef: (ref: HTMLDivElement | null) => void;
58
- } & WithFocusableProps & RemoteControlProps>;
59
- setState<K extends keyof import("../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: IKeyPlay & {
60
- isPlaying: boolean;
61
- playbackProgress: number | null;
62
- isScoring: boolean;
63
- setFocus?: ((focusKey: string) => void) | undefined;
64
- focused?: boolean | undefined;
65
- setRef: (ref: HTMLDivElement | null) => void;
66
- } & WithFocusableProps & RemoteControlProps) => import("../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
67
- forceUpdate(callBack?: (() => any) | undefined): void;
68
- props: Readonly<{
69
- children?: React.ReactNode;
70
- }> & Readonly<IKeyPlay & {
71
- isPlaying: boolean;
72
- playbackProgress: number | null;
73
- isScoring: boolean;
74
- setFocus?: ((focusKey: string) => void) | undefined;
75
- focused?: boolean | undefined;
76
- setRef: (ref: HTMLDivElement | null) => void;
77
- } & WithFocusableProps & RemoteControlProps>;
78
- context: any;
79
- refs: {
80
- [key: string]: React.ReactInstance;
81
- };
82
- componentWillMount?(): void;
83
- componentWillReceiveProps?(nextProps: Readonly<IKeyPlay & {
84
- isPlaying: boolean;
85
- playbackProgress: number | null;
86
- isScoring: boolean;
87
- setFocus?: ((focusKey: string) => void) | undefined;
88
- focused?: boolean | undefined;
89
- setRef: (ref: HTMLDivElement | null) => void;
90
- } & WithFocusableProps & RemoteControlProps>, nextContext: any): void;
91
- shouldComponentUpdate?(nextProps: Readonly<IKeyPlay & {
92
- isPlaying: boolean;
93
- playbackProgress: number | null;
94
- isScoring: boolean;
95
- setFocus?: ((focusKey: string) => void) | undefined;
96
- focused?: boolean | undefined;
97
- setRef: (ref: HTMLDivElement | null) => void;
98
- } & WithFocusableProps & RemoteControlProps>, nextState: Readonly<import("../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
99
- componentWillUpdate?(nextProps: Readonly<IKeyPlay & {
100
- isPlaying: boolean;
101
- playbackProgress: number | null;
102
- isScoring: boolean;
103
- setFocus?: ((focusKey: string) => void) | undefined;
104
- focused?: boolean | undefined;
105
- setRef: (ref: HTMLDivElement | null) => void;
106
- } & WithFocusableProps & RemoteControlProps>, nextState: Readonly<import("../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
107
- };
108
- contextTypes: {
109
- parentFocusKey: import("prop-types").Requireable<string>;
110
- };
111
- childContextTypes: {
112
- parentFocusKey: import("prop-types").Requireable<string>;
28
+ export default class KeyPlayCard extends React.Component<Omit<KeyPlayCardViewProps, 'setRef'> & WithFocusableProps> {
29
+ private ref;
30
+ context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
31
+ static contextTypes: {
32
+ refsMap: React.Requireable<any>;
33
+ setRef: React.Requireable<any>;
34
+ scrollToFocusedElement: React.Requireable<any>;
113
35
  };
114
- };
115
- export default _default;
36
+ setRef: (ref: HTMLDivElement | null) => void;
37
+ handleLeftPressed: (d: Direction) => void;
38
+ onBecameFocused: (layout: Layout) => void;
39
+ render(): React.JSX.Element;
40
+ }
41
+ export {};
@@ -18,14 +18,13 @@ interface IKeyPlaySection {
18
18
  items: IKeyPlayItem[];
19
19
  }
20
20
  interface IKeyPlaysState {
21
- scrolled: boolean;
22
21
  playbackProgress: number | null;
23
22
  playbackIndex: number | null;
24
23
  items: IKeyPlaySection[];
24
+ scrollableContainer: HTMLDivElement | null;
25
25
  }
26
26
  export declare class KeyPlays extends Component<{}, IKeyPlaysState> {
27
27
  private container;
28
- private refsMap;
29
28
  private playbackProgressUnsub;
30
29
  private playbackIndexUnsub;
31
30
  private itemsUnsub;
@@ -34,8 +33,6 @@ export declare class KeyPlays extends Component<{}, IKeyPlaysState> {
34
33
  componentDidMount(): void;
35
34
  componentWillUnmount(): void;
36
35
  private handlePlayClip;
37
- private handleItemFocus;
38
- private setRef;
39
36
  render(): React.JSX.Element;
40
37
  }
41
38
  interface KeyPlaysWithErrorStateState {
@@ -0,0 +1,61 @@
1
+ import NetworkManager from './NetworkManager/NetworkManager';
2
+ import { IBetsResponse, IPersonalizedBetsResponse } from '../modules/bets/interfaces/IBets';
3
+ import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
4
+ /**
5
+ * Service for handling bets-related API calls
6
+ */
7
+ declare class BetsService {
8
+ networkManager: NetworkManager;
9
+ constructor(delegate: IMaestroEventDelegate);
10
+ /**
11
+ * Get non-personalized bets for an event
12
+ *
13
+ * @param eventID - The ID of the event
14
+ * @returns Promise with the bets data
15
+ */
16
+ getNonPersonalizedBets(eventID: string): Promise<IBetsResponse>;
17
+ /**
18
+ * Get personalized bets for an event
19
+ *
20
+ * @param eventID - The ID of the event
21
+ * @param swid - The ESPN SWID parameter
22
+ * @param jwt - The authorization JWT
23
+ * @returns Promise with the personalized bets data
24
+ */
25
+ getPersonalizedBets(eventID: string, swid: string, jwt: string): Promise<IPersonalizedBetsResponse>;
26
+ /**
27
+ * Start polling for non-personalized bets
28
+ *
29
+ * @param eventID - The ID of the event
30
+ * @param interval - The polling interval in milliseconds
31
+ * @param onData - Callback for successful data fetch
32
+ * @param onError - Callback for errors
33
+ * @returns Object with a stop function to stop polling
34
+ */
35
+ pollNonPersonalizedBets(eventID: string, interval: number, onData: (data: IBetsResponse) => void, onError?: (error: Error) => void): {
36
+ stop: () => void;
37
+ };
38
+ /**
39
+ * Start polling for personalized bets
40
+ *
41
+ * @param eventID - The ID of the event
42
+ * @param swid - The ESPN SWID parameter
43
+ * @param jwt - The authorization JWT
44
+ * @param interval - The polling interval in milliseconds
45
+ * @param onData - Callback for successful data fetch
46
+ * @param onError - Callback for errors
47
+ * @returns Object with a stop function to stop polling
48
+ */
49
+ pollPersonalizedBets(eventID: string, swid: string, jwt: string, interval: number, onData: (data: IPersonalizedBetsResponse) => void, onError?: (error: Error) => void): {
50
+ stop: () => void;
51
+ };
52
+ /**
53
+ * Get the endpoint for non-personalized bets
54
+ */
55
+ nonPersonalizedBetsEndpoint(eventID: string): string;
56
+ /**
57
+ * Get the endpoint for personalized bets
58
+ */
59
+ personalizedBetsEndpoint(eventID: string): string;
60
+ }
61
+ export default BetsService;
@@ -0,0 +1,131 @@
1
+ import { ICacheManager } from '../../external/ports/cacheManager';
2
+ import { INetworkClient } from '../../external/ports/networkClient';
3
+ export declare const WorkingEnvironment: {
4
+ readonly DEVELOPMENT: "development";
5
+ readonly STAGING: "staging";
6
+ readonly PRODUCTION: "production";
7
+ };
8
+ export type WorkingEnvironment = typeof WorkingEnvironment[keyof typeof WorkingEnvironment];
9
+ export declare const MAESTRO_BASE_URLS: Record<WorkingEnvironment, string>;
10
+ export declare const SDK_FLAVOR = "MaestroKit_Web";
11
+ export declare const ENDPOINTS: {
12
+ CAN_I_PLAY: string;
13
+ STREAM: string;
14
+ USER_PROFILE: string;
15
+ ACTIVE_USER: string;
16
+ };
17
+ export declare const HttpMethod: {
18
+ readonly GET: "GET";
19
+ readonly POST: "POST";
20
+ readonly PUT: "PUT";
21
+ readonly DELETE: "DELETE";
22
+ };
23
+ export type HttpMethod = typeof HttpMethod[keyof typeof HttpMethod];
24
+ export interface NetworkManagerOptions {
25
+ environment?: WorkingEnvironment;
26
+ networkClient?: INetworkClient;
27
+ externalNetworkClient?: INetworkClient;
28
+ externalBaseURL?: string;
29
+ cacheManager?: ICacheManager;
30
+ defaultCacheDuration?: number;
31
+ }
32
+ declare class NetworkManager {
33
+ private static instance;
34
+ private cacheManager;
35
+ private maestroClient;
36
+ private externalClient;
37
+ private environment;
38
+ private pollingTasks;
39
+ private localStorage;
40
+ private constructor();
41
+ static getInstance(options?: NetworkManagerOptions, localStorageOverride?: Storage): NetworkManager;
42
+ /**
43
+ * Sets the working environment (development, staging, production)
44
+ */
45
+ setEnvironment(environment: WorkingEnvironment): void;
46
+ /**
47
+ * Get current environment
48
+ */
49
+ getEnvironment(): WorkingEnvironment;
50
+ /**
51
+ * Set authentication for Maestro APIs
52
+ */
53
+ setAuthentication(token: string | null, apiKey: string | null): void;
54
+ /**
55
+ * Handle errors from network requests
56
+ */
57
+ private handleError;
58
+ /**
59
+ * Make a request to the Maestro API
60
+ */
61
+ maestroApiRequest<T = any>({ endpoint, method, params, data, headers, useCache, maestroDefaultHeaders, skipResponseBodyDeserialization, }: {
62
+ endpoint: string;
63
+ method?: HttpMethod;
64
+ params?: Record<string, any>;
65
+ data?: any;
66
+ headers?: Record<string, string>;
67
+ useCache?: boolean;
68
+ maestroDefaultHeaders?: {
69
+ siteId: string;
70
+ jwt: string;
71
+ } | null;
72
+ skipResponseBodyDeserialization?: boolean;
73
+ }): Promise<T>;
74
+ /**
75
+ * Make a request to an external API
76
+ */
77
+ externalApiRequest<T = any>({ endpoint, method, params, data, headers, useCache, skipResponseBodyDeserialization, }: {
78
+ endpoint: string;
79
+ method?: HttpMethod;
80
+ params?: Record<string, any>;
81
+ data?: any;
82
+ headers?: Record<string, string>;
83
+ useCache?: boolean;
84
+ skipResponseBodyDeserialization?: boolean;
85
+ }): Promise<T>;
86
+ /**
87
+ * Start polling a Maestro API endpoint at specified interval
88
+ */
89
+ pollMaestroApiRequest<T = any>({ endpoint, interval, method, params, data, headers, maestroDefaultHeaders, skipResponseBodyDeserialization, onData, onError, }: {
90
+ endpoint: string;
91
+ interval: number;
92
+ method?: HttpMethod;
93
+ params?: Record<string, any>;
94
+ data?: any;
95
+ headers?: Record<string, string>;
96
+ maestroDefaultHeaders?: {
97
+ siteId: string;
98
+ jwt: string;
99
+ } | null;
100
+ skipResponseBodyDeserialization?: boolean;
101
+ onData: (data: T) => void;
102
+ onError?: (error: Error) => void;
103
+ }): {
104
+ stop: () => void;
105
+ };
106
+ /**
107
+ * Start polling an external API endpoint at specified interval
108
+ */
109
+ pollExternalApiRequest<T = any>({ endpoint, interval, method, params, data, headers, skipResponseBodyDeserialization, onData, onError, }: {
110
+ endpoint: string;
111
+ interval: number;
112
+ method?: HttpMethod;
113
+ params?: Record<string, any>;
114
+ data?: any;
115
+ headers?: Record<string, string>;
116
+ skipResponseBodyDeserialization?: boolean;
117
+ onData: (data: T) => void;
118
+ onError?: (error: Error) => void;
119
+ }): {
120
+ stop: () => void;
121
+ };
122
+ /**
123
+ * Stop all polling tasks
124
+ */
125
+ stopAllPolling(): void;
126
+ /**
127
+ * Clear all cached data
128
+ */
129
+ clearAllCache(): void;
130
+ }
131
+ export default NetworkManager;
@@ -0,0 +1,17 @@
1
+ export declare class NetworkError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare class AuthError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ export declare class NotFoundError extends Error {
8
+ constructor(message: string);
9
+ }
10
+ export declare class ServerError extends Error {
11
+ statusCode: number;
12
+ constructor(statusCode: number, message: string);
13
+ }
14
+ export declare class BadRequestError extends Error {
15
+ statusCode: number;
16
+ constructor(statusCode: number, message: string);
17
+ }
@@ -0,0 +1,43 @@
1
+ import { WinningBet } from '../models/IWinningBet';
2
+ export declare const OverlayType: {
3
+ readonly WinningBet: "winningBet";
4
+ readonly FantasyPlayerEvent: "fantasyPlayerEvent";
5
+ };
6
+ export type OverlayType = typeof OverlayType[keyof typeof OverlayType];
7
+ export interface IOverlayPosition {
8
+ top?: number;
9
+ left?: number;
10
+ right?: number;
11
+ bottom?: number;
12
+ }
13
+ export interface IOverlaySize {
14
+ width: number;
15
+ height: number;
16
+ }
17
+ export interface IFantasyPayload {
18
+ athleteId: string;
19
+ title: string;
20
+ metadata: string;
21
+ headline: string;
22
+ description: string;
23
+ image?: string;
24
+ sportsType: string;
25
+ }
26
+ export interface IMaestroOverlayEvent {
27
+ type: OverlayType;
28
+ size: IOverlaySize;
29
+ position: IOverlayPosition;
30
+ winningBet?: WinningBet;
31
+ fantasy?: IFantasyPayload;
32
+ }
33
+ export interface IOverlayAnalyticsEvent {
34
+ eventName: 'overlayViewed' | 'overlayClicked';
35
+ attributes: {
36
+ template: string;
37
+ templateId?: string;
38
+ instanceName: string;
39
+ instanceId: string;
40
+ fullscreen?: boolean;
41
+ overlayType: string;
42
+ };
43
+ }
@@ -1,9 +1,11 @@
1
1
  import IMaestroEventDelegate from '../interfaces/IMaestroEventDelegate';
2
- import IMaestroEvent from '../interfaces/IMaestroEvent';
2
+ import IMaestroEvent, { TestUseCase } from '../interfaces/IMaestroEvent';
3
3
  import { Observable } from '../helpers/Observable';
4
4
  import { ViewModel } from './ViewModel';
5
5
  import KeyPlaysViewModel from '../modules/key-plays/view-model/KeyPlaysViewModel';
6
+ import BetsViewModel from '../modules/bets/view-model/BetsViewModel';
6
7
  import IMaestroKeyPlaysResponse from '../modules/key-plays/interfaces/IKeyPlaysResponse';
8
+ import { MaestroPanelType } from '@/models/IPanel';
7
9
  export declare class MaestroEventViewModel extends ViewModel implements IMaestroEvent {
8
10
  private _eventId;
9
11
  private _title;
@@ -11,6 +13,7 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
11
13
  private _isShowingPanel;
12
14
  delegate: IMaestroEventDelegate;
13
15
  keyPlaysViewModel: KeyPlaysViewModel;
16
+ betsViewModel: BetsViewModel;
14
17
  constructor(eventId: string | undefined, delegate: IMaestroEventDelegate);
15
18
  deinit(): void;
16
19
  updateKeyPlaysData(data: IMaestroKeyPlaysResponse | null): Promise<void>;
@@ -34,4 +37,5 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
34
37
  get isLive(): Observable<boolean>;
35
38
  get isShowingPanel(): boolean;
36
39
  set isShowingPanel(value: boolean);
40
+ simulateUseCase<T = any>(useCase: TestUseCase, panelType: MaestroPanelType, testData?: T): void;
37
41
  }