@maestro_io/maestro-web-sdk 2.2.0 → 2.2.1
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/dist/components/core/PanelManager/PanelManager.d.ts +3 -0
- package/dist/helpers/url.d.ts +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/interfaces/IMaestroEvent.d.ts +13 -0
- package/dist/interfaces/IMaestroManager.d.ts +8 -1
- package/dist/interfaces/IUserSettings.d.ts +36 -0
- package/dist/maestro-web-sdk.umd.js +3 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/modules/bets/view/BetsView.d.ts +4 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Boost/Boost.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Straight/Straight.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.d.ts +2 -1
- package/dist/modules/bets/view/components/Bet/Bet.d.ts +7 -0
- package/dist/modules/bets/view-model/BetsViewModel.d.ts +15 -0
- package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +1 -0
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.d.ts +6 -6
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +4 -1
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.d.ts +2 -0
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.d.ts +5 -1
- package/dist/services/BetsService.d.ts +2 -2
- package/dist/services/NetworkManager/NetworkManager.d.ts +1 -3
- package/dist/services/NetworkManager/NetworkManagerFactory.d.ts +42 -0
- package/dist/services/NetworkManager/types.d.ts +77 -0
- package/dist/services/StatsService.d.ts +2 -2
- package/dist/services/UserSettingsManager.d.ts +63 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +5 -0
- package/dist/view-models/PanelManagerViewModel.d.ts +24 -0
- package/dist/view-models/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import './BetsView.styles.css';
|
|
3
3
|
import { BetItem, BetsErrorState } from '../view-model/BetsViewModel';
|
|
4
|
+
import { Direction } from '@/external/spatial-navigation/utils';
|
|
4
5
|
interface BetsViewState {
|
|
5
6
|
container: HTMLDivElement | null;
|
|
6
7
|
betsItems: BetItem[];
|
|
7
8
|
isDataLoading: boolean;
|
|
8
9
|
errorState: BetsErrorState;
|
|
10
|
+
hideWagers: boolean;
|
|
9
11
|
}
|
|
10
12
|
declare class BetsView extends Component<{}, BetsViewState> {
|
|
11
13
|
private container;
|
|
12
14
|
private betsItemsUnsub;
|
|
13
15
|
private isDataLoadingUnsub;
|
|
14
16
|
private errorStateUnsub;
|
|
17
|
+
private hideWagersUnsub;
|
|
15
18
|
private vm;
|
|
16
19
|
constructor(props: {});
|
|
17
20
|
componentDidMount(): void;
|
|
18
21
|
componentWillUnmount(): void;
|
|
19
22
|
renderBetItem: (item: BetItem) => React.JSX.Element | null;
|
|
20
23
|
clearTabLoadFailure: () => void;
|
|
24
|
+
onArrowPress: (d: Direction) => void;
|
|
21
25
|
render(): React.JSX.Element;
|
|
22
26
|
}
|
|
23
27
|
export default BetsView;
|
|
@@ -7,6 +7,7 @@ export declare const EVENTS_COUNT_THRESHOLD = 3;
|
|
|
7
7
|
export type BaseBetCardProps = {
|
|
8
8
|
bet: IUserBet;
|
|
9
9
|
renderHeaderContent?: (props: WithFocusableProps) => React.ReactNode;
|
|
10
|
+
hideWagers?: boolean;
|
|
10
11
|
};
|
|
11
12
|
declare const _default: {
|
|
12
13
|
new (props?: (BaseBetCardProps & WithFocusableProps) | undefined, context?: any): {
|
|
@@ -10,6 +10,7 @@ type BetsCardEventProps = {
|
|
|
10
10
|
betType: string;
|
|
11
11
|
onBetArrowPress: (eventIndex: number, legIndex: number) => (direction: Direction, props: any, details: Details) => void;
|
|
12
12
|
onBetBackPress: () => void;
|
|
13
|
+
hideWagers?: boolean;
|
|
13
14
|
};
|
|
14
15
|
declare class BetsCardEvent extends React.Component<BetsCardEventProps> {
|
|
15
16
|
static contextTypes: {
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { IUserBet } from '@/modules/bets/interfaces/IBets';
|
|
3
3
|
type BetsCardFooterProps = {
|
|
4
4
|
bet: IUserBet;
|
|
5
|
+
hideWagers?: boolean;
|
|
5
6
|
};
|
|
6
|
-
declare const BetsCardFooter: (props: BetsCardFooterProps) => React.JSX.Element;
|
|
7
|
+
declare const BetsCardFooter: (props: BetsCardFooterProps) => React.JSX.Element | null;
|
|
7
8
|
export default BetsCardFooter;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { IUserBet } from '@/modules/bets/interfaces/IBets';
|
|
3
3
|
type BoostProps = {
|
|
4
4
|
bet: IUserBet;
|
|
5
|
+
hideWagers?: boolean;
|
|
5
6
|
};
|
|
6
|
-
declare const Boost: ({ bet }: BoostProps) => React.JSX.Element;
|
|
7
|
+
declare const Boost: ({ bet, hideWagers }: BoostProps) => React.JSX.Element;
|
|
7
8
|
export default Boost;
|
|
@@ -3,6 +3,7 @@ import './Parlay.styles.css';
|
|
|
3
3
|
import { IUserBet } from '@/modules/bets/interfaces/IBets';
|
|
4
4
|
type ParlayProps = {
|
|
5
5
|
bet: IUserBet;
|
|
6
|
+
hideWagers?: boolean;
|
|
6
7
|
};
|
|
7
|
-
declare const Parlay: ({ bet }: ParlayProps) => React.JSX.Element;
|
|
8
|
+
declare const Parlay: ({ bet, hideWagers }: ParlayProps) => React.JSX.Element;
|
|
8
9
|
export default Parlay;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { IUserBet } from '@/modules/bets/interfaces/IBets';
|
|
3
3
|
type StraightProps = {
|
|
4
4
|
bet: IUserBet;
|
|
5
|
+
hideWagers?: boolean;
|
|
5
6
|
};
|
|
6
|
-
declare const Straight: ({ bet }: StraightProps) => React.JSX.Element;
|
|
7
|
+
declare const Straight: ({ bet, hideWagers }: StraightProps) => React.JSX.Element;
|
|
7
8
|
export default Straight;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { IUserBet } from '@/modules/bets/interfaces/IBets';
|
|
3
3
|
type TeaserProps = {
|
|
4
4
|
bet: IUserBet;
|
|
5
|
+
hideWagers?: boolean;
|
|
5
6
|
};
|
|
6
|
-
declare const Teaser: ({ bet }: TeaserProps) => React.JSX.Element;
|
|
7
|
+
declare const Teaser: ({ bet, hideWagers }: TeaserProps) => React.JSX.Element;
|
|
7
8
|
export default Teaser;
|
|
@@ -6,6 +6,7 @@ import { IBetLeg } from '@/modules/bets/interfaces/IBets';
|
|
|
6
6
|
declare const _default: {
|
|
7
7
|
new (props?: ({
|
|
8
8
|
leg: IBetLeg;
|
|
9
|
+
hideWagers?: boolean | undefined;
|
|
9
10
|
} & WithFocusableProps) | undefined, context?: any): {
|
|
10
11
|
state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
11
12
|
navigation: import("../../../../../external/spatial-navigation/spatialNavigation").default;
|
|
@@ -28,15 +29,18 @@ declare const _default: {
|
|
|
28
29
|
componentWillUnmount(): void;
|
|
29
30
|
render(): React.ReactElement<{
|
|
30
31
|
leg: IBetLeg;
|
|
32
|
+
hideWagers?: boolean | undefined;
|
|
31
33
|
} & WithFocusableProps>;
|
|
32
34
|
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: {
|
|
33
35
|
leg: IBetLeg;
|
|
36
|
+
hideWagers?: boolean | undefined;
|
|
34
37
|
} & WithFocusableProps) => 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;
|
|
35
38
|
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
36
39
|
props: Readonly<{
|
|
37
40
|
children?: React.ReactNode;
|
|
38
41
|
}> & Readonly<{
|
|
39
42
|
leg: IBetLeg;
|
|
43
|
+
hideWagers?: boolean | undefined;
|
|
40
44
|
} & WithFocusableProps>;
|
|
41
45
|
context: any;
|
|
42
46
|
refs: {
|
|
@@ -45,12 +49,15 @@ declare const _default: {
|
|
|
45
49
|
componentWillMount?(): void;
|
|
46
50
|
componentWillReceiveProps?(nextProps: Readonly<{
|
|
47
51
|
leg: IBetLeg;
|
|
52
|
+
hideWagers?: boolean | undefined;
|
|
48
53
|
} & WithFocusableProps>, nextContext: any): void;
|
|
49
54
|
shouldComponentUpdate?(nextProps: Readonly<{
|
|
50
55
|
leg: IBetLeg;
|
|
56
|
+
hideWagers?: boolean | undefined;
|
|
51
57
|
} & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
52
58
|
componentWillUpdate?(nextProps: Readonly<{
|
|
53
59
|
leg: IBetLeg;
|
|
60
|
+
hideWagers?: boolean | undefined;
|
|
54
61
|
} & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
55
62
|
};
|
|
56
63
|
contextTypes: {
|
|
@@ -74,16 +74,19 @@ export type SixPackBetItem = {
|
|
|
74
74
|
away: ITeam;
|
|
75
75
|
};
|
|
76
76
|
id: string;
|
|
77
|
+
hideWagers: boolean;
|
|
77
78
|
};
|
|
78
79
|
export type UserBetsBetItem = {
|
|
79
80
|
type: 'userBets';
|
|
80
81
|
data: IUserBets;
|
|
81
82
|
id: string;
|
|
83
|
+
hideWagers: boolean;
|
|
82
84
|
};
|
|
83
85
|
export type HotPropsBetItem = {
|
|
84
86
|
type: 'hotProps';
|
|
85
87
|
data: IHotProps;
|
|
86
88
|
id: string;
|
|
89
|
+
hideWagers: boolean;
|
|
87
90
|
};
|
|
88
91
|
export type BetItem = SixPackBetItem | UserBetsBetItem | PromoBetItem | HotPropsBetItem | LocationDisclaimerBetItem | GamblingMessageBetItem;
|
|
89
92
|
declare const BET_ERROR_STATE: {
|
|
@@ -101,6 +104,7 @@ export declare class BetsViewModel extends ViewModel {
|
|
|
101
104
|
isDataLoading: Observable<boolean>;
|
|
102
105
|
errorState: Observable<BetsErrorState>;
|
|
103
106
|
hasEverSuccessfullyLoaded: Observable<boolean>;
|
|
107
|
+
hideWagers: Observable<boolean>;
|
|
104
108
|
private eventId;
|
|
105
109
|
private delegate;
|
|
106
110
|
private betsService;
|
|
@@ -109,6 +113,8 @@ export declare class BetsViewModel extends ViewModel {
|
|
|
109
113
|
private lastNonPersonalizedResponseHash;
|
|
110
114
|
private lastPersonalizedResponseHash;
|
|
111
115
|
private useMockData;
|
|
116
|
+
private userSettingsManager;
|
|
117
|
+
private settingsSubscription;
|
|
112
118
|
initialized: boolean;
|
|
113
119
|
constructor(eventId: string, delegate: IMaestroEventDelegate, options?: {
|
|
114
120
|
pollingInterval?: number;
|
|
@@ -170,6 +176,15 @@ export declare class BetsViewModel extends ViewModel {
|
|
|
170
176
|
private fetchMockData;
|
|
171
177
|
simulateUseCase<T = any>(useCase: TestUseCase, _: T): void;
|
|
172
178
|
clearTabLoadFailure(): void;
|
|
179
|
+
/**
|
|
180
|
+
* Check if wagers should be hidden based on user settings
|
|
181
|
+
*/
|
|
182
|
+
shouldHideWagers(): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Update hideWagers Observable from current settings (reactive approach)
|
|
185
|
+
*/
|
|
186
|
+
private updateHideWagersFromSettings;
|
|
187
|
+
private refreshBetItemsWithNewSettings;
|
|
173
188
|
}
|
|
174
189
|
declare global {
|
|
175
190
|
interface String {
|
|
@@ -29,12 +29,12 @@ interface MaestroKeyPlaysSection {
|
|
|
29
29
|
}
|
|
30
30
|
interface MaestroKeyPlay {
|
|
31
31
|
description: string;
|
|
32
|
-
team
|
|
33
|
-
wallClock
|
|
34
|
-
displayClock
|
|
35
|
-
shortPeriod
|
|
36
|
-
scoringPlay
|
|
37
|
-
athlete
|
|
32
|
+
team?: string;
|
|
33
|
+
wallClock?: string;
|
|
34
|
+
displayClock?: string;
|
|
35
|
+
shortPeriod?: string;
|
|
36
|
+
scoringPlay?: boolean;
|
|
37
|
+
athlete?: string;
|
|
38
38
|
thumbnail: string;
|
|
39
39
|
thumbnailType: string;
|
|
40
40
|
clipID: string;
|
|
@@ -10,17 +10,20 @@ type KeyPlayCardViewProps = IKeyPlay & {
|
|
|
10
10
|
};
|
|
11
11
|
type KeyPlaysCardViewState = {
|
|
12
12
|
failedClip: KeyPlayLoadFailureStatus | null;
|
|
13
|
+
imageLoaded: boolean;
|
|
13
14
|
};
|
|
14
15
|
export declare class KeyPlayCardView extends React.Component<KeyPlayCardViewProps & WithFocusableProps, KeyPlaysCardViewState> {
|
|
15
16
|
private failedClipListener;
|
|
16
17
|
private vm;
|
|
17
18
|
state: {
|
|
18
19
|
failedClip: null;
|
|
20
|
+
imageLoaded: boolean;
|
|
19
21
|
};
|
|
20
22
|
constructor(props: KeyPlayCardViewProps);
|
|
21
23
|
componentDidMount(): void;
|
|
22
24
|
componentWillUnmount(): void;
|
|
23
|
-
|
|
25
|
+
onLoad: () => void;
|
|
26
|
+
renderImage: () => React.JSX.Element | null;
|
|
24
27
|
render(): React.JSX.Element;
|
|
25
28
|
}
|
|
26
29
|
export default class KeyPlayCard extends React.Component<Omit<KeyPlayCardViewProps, 'setRef'> & WithFocusableProps> {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { KeyPlaysErrorState } from '../interfaces/IKeyPlays';
|
|
2
2
|
import './KeyPlayErrorStateView.styles.css';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { Direction } from '@/external/spatial-navigation/utils';
|
|
4
5
|
type Props = {
|
|
5
6
|
errorState: KeyPlaysErrorState;
|
|
6
7
|
onRetry: () => void;
|
|
7
8
|
};
|
|
8
9
|
declare class KeyPlayErrorStateView extends React.Component<Props, {}> {
|
|
10
|
+
onArrowPress: (d: Direction) => void;
|
|
9
11
|
render(): React.JSX.Element | null;
|
|
10
12
|
}
|
|
11
13
|
export default KeyPlayErrorStateView;
|
|
@@ -14,8 +14,12 @@ declare class KeyPlaysViewModel {
|
|
|
14
14
|
[key: string]: KeyPlayLoadFailureStatus;
|
|
15
15
|
}>;
|
|
16
16
|
items: Observable<KeyPlayItem[]>;
|
|
17
|
+
filteredItems: Observable<KeyPlayItem[]>;
|
|
18
|
+
onUpdatePlayerTimeCode(playerTimeCode: number | null): void;
|
|
19
|
+
private filterItemsByPlayerTimeCode;
|
|
20
|
+
private shouldShowKeyPlay;
|
|
17
21
|
isCurrentlyPlaying(index: number): boolean;
|
|
18
|
-
setKeyPlays(items: IMaestroKeyPlaysResponse | null): Promise<void>;
|
|
22
|
+
setKeyPlays(items: IMaestroKeyPlaysResponse | null, playerTimeCode: number | null): Promise<void>;
|
|
19
23
|
private cleanErrors;
|
|
20
24
|
playKeyPlay(atIndex: number): Promise<void>;
|
|
21
25
|
parseNetworkResponse(response: IMaestroKeyPlaysResponse): KeyPlayItem[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IBetsNetworkManager } from './NetworkManager/types';
|
|
2
2
|
import { IBetsResponse, IPersonalizedBetsResponse } from '../modules/bets/interfaces/IBets';
|
|
3
3
|
import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
|
|
4
4
|
/**
|
|
5
5
|
* Service for handling bets-related API calls
|
|
6
6
|
*/
|
|
7
7
|
declare class BetsService {
|
|
8
|
-
networkManager:
|
|
8
|
+
networkManager: IBetsNetworkManager;
|
|
9
9
|
constructor(delegate: IMaestroEventDelegate);
|
|
10
10
|
/**
|
|
11
11
|
* Get non-personalized bets for an event
|
|
@@ -30,15 +30,13 @@ export interface NetworkManagerOptions {
|
|
|
30
30
|
defaultCacheDuration?: number;
|
|
31
31
|
}
|
|
32
32
|
declare class NetworkManager {
|
|
33
|
-
private static instance;
|
|
34
33
|
private cacheManager;
|
|
35
34
|
private maestroClient;
|
|
36
35
|
private externalClient;
|
|
37
36
|
private environment;
|
|
38
37
|
private pollingTasks;
|
|
39
38
|
private localStorage;
|
|
40
|
-
|
|
41
|
-
static getInstance(options?: NetworkManagerOptions, localStorageOverride?: Storage): NetworkManager;
|
|
39
|
+
constructor(options?: NetworkManagerOptions, localStorageOverride?: Storage);
|
|
42
40
|
/**
|
|
43
41
|
* Sets the working environment (development, staging, production)
|
|
44
42
|
*/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import NetworkManager, { NetworkManagerOptions } from './NetworkManager';
|
|
2
|
+
import { ServiceType, ServiceNetworkManagerConfig, IStatsNetworkManager, IBetsNetworkManager, IMaestroNetworkManager, NetworkManagerFactoryConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Service-specific NetworkManager that includes metadata about its service type
|
|
5
|
+
*/
|
|
6
|
+
declare class ServiceNetworkManager extends NetworkManager {
|
|
7
|
+
readonly serviceType: ServiceType;
|
|
8
|
+
readonly externalBaseURL: string;
|
|
9
|
+
constructor(serviceType: ServiceType, externalBaseURL: string, options?: NetworkManagerOptions, localStorageOverride?: Storage);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Factory for creating service-specific NetworkManager instances
|
|
13
|
+
* This replaces the singleton pattern with a factory pattern
|
|
14
|
+
*/
|
|
15
|
+
export declare class NetworkManagerFactory {
|
|
16
|
+
private static defaultConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Configure factory defaults
|
|
19
|
+
*/
|
|
20
|
+
static configure(config: NetworkManagerFactoryConfig): void;
|
|
21
|
+
/**
|
|
22
|
+
* Create a Stats service NetworkManager
|
|
23
|
+
*/
|
|
24
|
+
static createStatsNetworkManager(externalBaseURL: string, options?: Partial<NetworkManagerOptions>): IStatsNetworkManager;
|
|
25
|
+
/**
|
|
26
|
+
* Create a Bets service NetworkManager
|
|
27
|
+
*/
|
|
28
|
+
static createBetsNetworkManager(externalBaseURL: string, options?: Partial<NetworkManagerOptions>): IBetsNetworkManager;
|
|
29
|
+
/**
|
|
30
|
+
* Create a Maestro service NetworkManager
|
|
31
|
+
*/
|
|
32
|
+
static createMaestroNetworkManager(options?: Partial<NetworkManagerOptions>): IMaestroNetworkManager;
|
|
33
|
+
/**
|
|
34
|
+
* Create a NetworkManager for any service type
|
|
35
|
+
*/
|
|
36
|
+
static createForService(config: ServiceNetworkManagerConfig, options?: Partial<NetworkManagerOptions>): ServiceNetworkManager;
|
|
37
|
+
/**
|
|
38
|
+
* Reset factory to defaults (useful for testing)
|
|
39
|
+
*/
|
|
40
|
+
static reset(): void;
|
|
41
|
+
}
|
|
42
|
+
export default NetworkManagerFactory;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { WorkingEnvironment } from './NetworkManager';
|
|
2
|
+
/**
|
|
3
|
+
* Service types for different NetworkManager contexts
|
|
4
|
+
*/
|
|
5
|
+
export declare const ServiceType: {
|
|
6
|
+
readonly STATS: "stats";
|
|
7
|
+
readonly BETS: "bets";
|
|
8
|
+
readonly MAESTRO: "maestro";
|
|
9
|
+
};
|
|
10
|
+
export type ServiceType = typeof ServiceType[keyof typeof ServiceType];
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for creating service-specific NetworkManager instances
|
|
13
|
+
*/
|
|
14
|
+
export interface ServiceNetworkManagerConfig {
|
|
15
|
+
serviceType: ServiceType;
|
|
16
|
+
externalBaseURL: string;
|
|
17
|
+
environment?: WorkingEnvironment;
|
|
18
|
+
defaultCacheDuration?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base interface for all NetworkManager instances
|
|
22
|
+
*/
|
|
23
|
+
export interface IServiceNetworkManager {
|
|
24
|
+
readonly serviceType: ServiceType;
|
|
25
|
+
readonly externalBaseURL: string;
|
|
26
|
+
getEnvironment(): WorkingEnvironment;
|
|
27
|
+
externalApiRequest<T = any>(options: {
|
|
28
|
+
endpoint: string;
|
|
29
|
+
method?: string;
|
|
30
|
+
params?: Record<string, any>;
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
data?: any;
|
|
33
|
+
useCache?: boolean;
|
|
34
|
+
skipResponseBodyDeserialization?: boolean;
|
|
35
|
+
}): Promise<T>;
|
|
36
|
+
pollExternalApiRequest<T = any>(options: {
|
|
37
|
+
endpoint: string;
|
|
38
|
+
interval: number;
|
|
39
|
+
method?: string;
|
|
40
|
+
params?: Record<string, any>;
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
data?: any;
|
|
43
|
+
onData: (data: T) => void;
|
|
44
|
+
onError?: (error: Error) => void;
|
|
45
|
+
}): {
|
|
46
|
+
stop: () => void;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Stats service NetworkManager interface
|
|
51
|
+
*/
|
|
52
|
+
export interface IStatsNetworkManager extends IServiceNetworkManager {
|
|
53
|
+
serviceType: 'stats';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Bets service NetworkManager interface
|
|
57
|
+
*/
|
|
58
|
+
export interface IBetsNetworkManager extends IServiceNetworkManager {
|
|
59
|
+
serviceType: 'bets';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Maestro service NetworkManager interface
|
|
63
|
+
*/
|
|
64
|
+
export interface IMaestroNetworkManager extends IServiceNetworkManager {
|
|
65
|
+
serviceType: 'maestro';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Union type for all service NetworkManager types
|
|
69
|
+
*/
|
|
70
|
+
export type ServiceNetworkManager = IStatsNetworkManager | IBetsNetworkManager | IMaestroNetworkManager;
|
|
71
|
+
/**
|
|
72
|
+
* Factory configuration for different service types
|
|
73
|
+
*/
|
|
74
|
+
export interface NetworkManagerFactoryConfig {
|
|
75
|
+
environment?: WorkingEnvironment;
|
|
76
|
+
defaultCacheDuration?: number;
|
|
77
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IStatsNetworkManager } from './NetworkManager/types';
|
|
2
2
|
import { StatsApiResponse } from '../modules/stats/interfaces/IStats';
|
|
3
3
|
import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
|
|
4
4
|
/**
|
|
5
5
|
* Service for handling stats-related API calls
|
|
6
6
|
*/
|
|
7
7
|
declare class StatsService {
|
|
8
|
-
networkManager:
|
|
8
|
+
networkManager: IStatsNetworkManager;
|
|
9
9
|
constructor(delegate: IMaestroEventDelegate);
|
|
10
10
|
/**
|
|
11
11
|
* Get stats for an event
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Observable } from '@/helpers/Observable';
|
|
2
|
+
import { IUserSettings, PanelSettings } from '@/interfaces/IUserSettings';
|
|
3
|
+
import { MaestroPanelType } from '@/models/IPanel';
|
|
4
|
+
/**
|
|
5
|
+
* UserSettingsManager - Singleton service for managing user settings
|
|
6
|
+
* Uses Observable pattern for reactive updates across the SDK
|
|
7
|
+
*/
|
|
8
|
+
export declare class UserSettingsManager {
|
|
9
|
+
private static instance;
|
|
10
|
+
private _settings;
|
|
11
|
+
private constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Get the singleton instance of UserSettingsManager
|
|
14
|
+
*/
|
|
15
|
+
static getInstance(): UserSettingsManager;
|
|
16
|
+
/**
|
|
17
|
+
* Get the current settings as an Observable
|
|
18
|
+
*/
|
|
19
|
+
get settings(): Observable<IUserSettings>;
|
|
20
|
+
/**
|
|
21
|
+
* Get the current settings value (snapshot)
|
|
22
|
+
*/
|
|
23
|
+
getCurrentSettings(): IUserSettings;
|
|
24
|
+
/**
|
|
25
|
+
* Update user settings with validation and merge logic
|
|
26
|
+
* @param userSettings - New settings to apply
|
|
27
|
+
*/
|
|
28
|
+
updateSettings(userSettings: IUserSettings): void;
|
|
29
|
+
/**
|
|
30
|
+
* Get settings for a specific panel type
|
|
31
|
+
* @param panelType - Panel type to get settings for
|
|
32
|
+
*/
|
|
33
|
+
getPanelSettings<T extends keyof NonNullable<IUserSettings['panels']>>(panelType: T): PanelSettings<T> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a panel should be hidden
|
|
36
|
+
* @param panelType - Panel type to check
|
|
37
|
+
*/
|
|
38
|
+
isPanelHidden(panelType: MaestroPanelType): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Check if wagers should be hidden for betting panel
|
|
41
|
+
*/
|
|
42
|
+
shouldHideWagers(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Reset settings to defaults
|
|
45
|
+
*/
|
|
46
|
+
resetToDefaults(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Validate settings structure and values
|
|
49
|
+
* @param settings - Settings to validate
|
|
50
|
+
*/
|
|
51
|
+
private validateSettings;
|
|
52
|
+
/**
|
|
53
|
+
* Merge user settings with current settings (deep merge)
|
|
54
|
+
* @param currentSettings - Current settings
|
|
55
|
+
* @param userSettings - New settings to merge
|
|
56
|
+
*/
|
|
57
|
+
private mergeSettings;
|
|
58
|
+
/**
|
|
59
|
+
* Map MaestroPanelType to settings key
|
|
60
|
+
* @param panelType - Panel type from MaestroPanelType enum
|
|
61
|
+
*/
|
|
62
|
+
private mapPanelTypeToSettingsKey;
|
|
63
|
+
}
|
|
@@ -8,19 +8,24 @@ import SpatialNavigation from '@/external/spatial-navigation/spatialNavigation';
|
|
|
8
8
|
import StatsViewModel from '../modules/stats/view-model/StatsViewModel';
|
|
9
9
|
import IMaestroKeyPlaysResponse from '../modules/key-plays/interfaces/IKeyPlaysResponse';
|
|
10
10
|
import { MaestroPanelType } from '@/models/IPanel';
|
|
11
|
+
import { IUserSettings } from '../interfaces/IUserSettings';
|
|
11
12
|
export declare class MaestroEventViewModel extends ViewModel implements IMaestroEvent {
|
|
12
13
|
private _eventId;
|
|
13
14
|
private _title;
|
|
14
15
|
private _isLive;
|
|
15
16
|
private _isShowingPanel;
|
|
17
|
+
private playerTimeCode;
|
|
16
18
|
delegate: IMaestroEventDelegate;
|
|
17
19
|
keyPlaysViewModel: KeyPlaysViewModel;
|
|
18
20
|
betsViewModel: BetsViewModel;
|
|
19
21
|
statsViewModel: StatsViewModel;
|
|
20
22
|
navigation: SpatialNavigation;
|
|
21
23
|
constructor(eventId: string | undefined, delegate: IMaestroEventDelegate);
|
|
24
|
+
updatePlayerTimeCode(timestamp: number): void;
|
|
25
|
+
getPlayerTimeCode(): number | null;
|
|
22
26
|
deinit(): void;
|
|
23
27
|
updateKeyPlaysData(data: IMaestroKeyPlaysResponse | null): Promise<void>;
|
|
28
|
+
updateUserSettings(settings: IUserSettings): Promise<void>;
|
|
24
29
|
startFocusManagement(): Promise<void>;
|
|
25
30
|
didStartPlayingClip(index: number): void;
|
|
26
31
|
didStopPlayingClip(index: number): void;
|
|
@@ -4,6 +4,30 @@ export declare class PanelManagerViewModel {
|
|
|
4
4
|
private _panels;
|
|
5
5
|
private _currentPanel;
|
|
6
6
|
private _newlyFocusedPanel;
|
|
7
|
+
private settingsManager;
|
|
8
|
+
private settingsUnsubscribe;
|
|
9
|
+
private readonly ALL_PANELS;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Initialize panels based on current settings
|
|
13
|
+
*/
|
|
14
|
+
private initializePanels;
|
|
15
|
+
/**
|
|
16
|
+
* Subscribe to settings changes to update panels dynamically
|
|
17
|
+
*/
|
|
18
|
+
private subscribeToSettingsChanges;
|
|
19
|
+
/**
|
|
20
|
+
* Filter panels based on user settings
|
|
21
|
+
*/
|
|
22
|
+
private filterPanelsBasedOnSettings;
|
|
23
|
+
/**
|
|
24
|
+
* Update panels when settings change
|
|
25
|
+
*/
|
|
26
|
+
private updatePanelsBasedOnSettings;
|
|
27
|
+
/**
|
|
28
|
+
* Cleanup subscriptions
|
|
29
|
+
*/
|
|
30
|
+
cleanup(): void;
|
|
7
31
|
get panels(): MaestroPanelType[];
|
|
8
32
|
get panelsObservable(): Observable<MaestroPanelType[]>;
|
|
9
33
|
get currentPanel(): MaestroPanelType;
|
|
@@ -12,6 +12,10 @@ export declare class MaestroViewModels {
|
|
|
12
12
|
readonly keyPlaysViewModel: KeyPlaysViewModel;
|
|
13
13
|
readonly overlayViewModel: OverlayViewModel;
|
|
14
14
|
constructor(eventViewModel: MaestroEventViewModel);
|
|
15
|
+
/**
|
|
16
|
+
* Cleanup all view models
|
|
17
|
+
*/
|
|
18
|
+
cleanup(): void;
|
|
15
19
|
/**
|
|
16
20
|
* Creates view models from an event ID
|
|
17
21
|
*/
|