@maestro_io/maestro-web-sdk 3.1.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maestro-web-sdk.esm.js +5 -5
- package/dist/maestro-web-sdk.esm.js.map +1 -1
- package/dist/maestro-web-sdk.umd.js +5 -5
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/src/components/atoms/SvgIcon/FantasyIcon.d.ts +7 -0
- package/dist/src/components/atoms/SvgIcon/Icon.d.ts +2 -0
- package/dist/src/components/molecules/HeadshotImage/HeadshotImage.d.ts +16 -0
- package/dist/src/components/molecules/HeadshotImage/index.d.ts +2 -0
- package/dist/src/development/MaestroEventDelegate.d.ts +2 -1
- package/dist/src/helpers/strings.d.ts +1 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/interfaces/IMaestroEventDelegate.d.ts +15 -0
- package/dist/src/interfaces/IUserSettings.d.ts +4 -0
- package/dist/src/models/IPanel.d.ts +1 -6
- package/dist/src/modules/bets/view-model/BetsViewModel.d.ts +0 -5
- package/dist/src/modules/fantasy/components/ExpandedAthleteList/ExpandedAthletesList.d.ts +28 -0
- package/dist/src/modules/fantasy/components/ExpandedAthleteList/index.d.ts +1 -0
- package/dist/src/modules/fantasy/components/LeagueCard/LeagueCard.d.ts +56 -0
- package/dist/src/modules/fantasy/components/LeagueCard/index.d.ts +2 -0
- package/dist/src/modules/fantasy/components/TopPlayerCard/TopPlayerCard.d.ts +53 -0
- package/dist/src/modules/fantasy/components/TopPlayerCard/index.d.ts +2 -0
- package/dist/src/modules/fantasy/types.d.ts +176 -0
- package/dist/src/modules/fantasy/view/ActiveAthletesMarquee/ActiveAthletesMarquee.d.ts +21 -0
- package/dist/src/modules/fantasy/view/ActiveAthletesMarquee/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/FantasyItemView.d.ts +21 -0
- package/dist/src/modules/fantasy/view/FantasyView.d.ts +27 -0
- package/dist/src/modules/fantasy/view/InactiveLeague/DraftDateCountdown.d.ts +23 -0
- package/dist/src/modules/fantasy/view/InactiveLeague/InactiveLeague.d.ts +52 -0
- package/dist/src/modules/fantasy/view/InactiveLeague/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/LoginView/LoginView.d.ts +48 -0
- package/dist/src/modules/fantasy/view/LoginView/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/MatchupPair/DoubleAthleteCard/DoubleAthleteCard.d.ts +49 -0
- package/dist/src/modules/fantasy/view/MatchupPair/DoubleAthleteCard/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/MatchupPair/ExpandedDoubleAthleteCards.d.ts +14 -0
- package/dist/src/modules/fantasy/view/MatchupPair/MatchupPair.d.ts +54 -0
- package/dist/src/modules/fantasy/view/MatchupPair/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/MatchupSingle/ExpandedSingleAthleteCards.d.ts +14 -0
- package/dist/src/modules/fantasy/view/MatchupSingle/MatchupSingle.d.ts +54 -0
- package/dist/src/modules/fantasy/view/MatchupSingle/SingleAthleteCard/SingleAthleteCard.d.ts +49 -0
- package/dist/src/modules/fantasy/view/MatchupSingle/SingleAthleteCard/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/MatchupSingle/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/PromoView/PromoView.d.ts +52 -0
- package/dist/src/modules/fantasy/view/PromoView/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view/index.d.ts +2 -0
- package/dist/src/modules/fantasy/view-model/FantasyViewModel.FantasyPolling.d.ts +34 -0
- package/dist/src/modules/fantasy/view-model/FantasyViewModel.LeagueManagerPolling.d.ts +32 -0
- package/dist/src/modules/fantasy/view-model/FantasyViewModel.d.ts +146 -0
- package/dist/src/modules/stats/view-model/StatsViewModel.d.ts +0 -5
- package/dist/src/services/AnalyticsService/AnalyticsService.d.ts +10 -3
- package/dist/src/services/FantasyService.d.ts +54 -0
- package/dist/src/services/NetworkManager/types.d.ts +1 -0
- package/dist/src/view-models/MaestroEventViewModel.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Observable } from '@/helpers/Observable';
|
|
2
|
+
import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
|
|
3
|
+
type NotLoggedInFantasyItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
type: 'notLoggedIn';
|
|
6
|
+
};
|
|
7
|
+
export type PromoFantasyItem = {
|
|
8
|
+
id: string;
|
|
9
|
+
type: 'promo';
|
|
10
|
+
background: string;
|
|
11
|
+
logo: string;
|
|
12
|
+
title: string;
|
|
13
|
+
qrCode: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
export type InactiveLeague = {
|
|
17
|
+
id: string;
|
|
18
|
+
type: 'inactiveLeague';
|
|
19
|
+
leagueName: string;
|
|
20
|
+
draftDate?: number;
|
|
21
|
+
leagueLogo: string;
|
|
22
|
+
leagueColor: string;
|
|
23
|
+
};
|
|
24
|
+
type MatchupSingleTeam = {
|
|
25
|
+
points: number;
|
|
26
|
+
logo: string;
|
|
27
|
+
scoringType: string;
|
|
28
|
+
};
|
|
29
|
+
export type MatchupSingleRoster = {
|
|
30
|
+
athleteHeadshot: string;
|
|
31
|
+
athleteAbbrevName: string;
|
|
32
|
+
athletesSlot: string;
|
|
33
|
+
teamTriCode: string;
|
|
34
|
+
proGameStatusLines: string[];
|
|
35
|
+
};
|
|
36
|
+
export type MatchupActiveAthlete = {
|
|
37
|
+
abbrevName: string;
|
|
38
|
+
points: string;
|
|
39
|
+
};
|
|
40
|
+
export type MatchupSingleItem = {
|
|
41
|
+
id: string;
|
|
42
|
+
type: 'matchup-single';
|
|
43
|
+
league: {
|
|
44
|
+
title: string;
|
|
45
|
+
subtitle: string | undefined;
|
|
46
|
+
color: string;
|
|
47
|
+
logo: string;
|
|
48
|
+
};
|
|
49
|
+
team: MatchupSingleTeam;
|
|
50
|
+
roster: MatchupSingleRoster[];
|
|
51
|
+
activeAthletes: MatchupActiveAthlete[];
|
|
52
|
+
topPlayers: TopPlayer[];
|
|
53
|
+
};
|
|
54
|
+
export type TopPlayer = {
|
|
55
|
+
abbrevName: string;
|
|
56
|
+
headshot: string;
|
|
57
|
+
position: string;
|
|
58
|
+
teamTriCode: string;
|
|
59
|
+
points: number;
|
|
60
|
+
rosteredBy: string;
|
|
61
|
+
};
|
|
62
|
+
type MatchupPairTeam = {
|
|
63
|
+
name: string | undefined;
|
|
64
|
+
record: string | undefined;
|
|
65
|
+
points: string | undefined;
|
|
66
|
+
projectedPoints: string | undefined;
|
|
67
|
+
logo: string | undefined;
|
|
68
|
+
winProbability: number | undefined;
|
|
69
|
+
};
|
|
70
|
+
type MatchupPairRosterData = {
|
|
71
|
+
headshot: string;
|
|
72
|
+
abbrevName: string;
|
|
73
|
+
slot: string;
|
|
74
|
+
triCode: string;
|
|
75
|
+
points?: number;
|
|
76
|
+
projectedPoints?: number;
|
|
77
|
+
stats: string[];
|
|
78
|
+
};
|
|
79
|
+
export type MatchupPairRoster = {
|
|
80
|
+
away: MatchupPairRosterData;
|
|
81
|
+
home: MatchupPairRosterData;
|
|
82
|
+
};
|
|
83
|
+
export type MatchupPairItem = {
|
|
84
|
+
id: string;
|
|
85
|
+
type: 'matchup-pair';
|
|
86
|
+
league: {
|
|
87
|
+
title: string | undefined;
|
|
88
|
+
subtitle: string | undefined;
|
|
89
|
+
color: string;
|
|
90
|
+
logo: string;
|
|
91
|
+
};
|
|
92
|
+
awayTeam: MatchupPairTeam;
|
|
93
|
+
homeTeam: MatchupPairTeam;
|
|
94
|
+
roster: MatchupPairRoster[];
|
|
95
|
+
activeAthletes: MatchupActiveAthlete[];
|
|
96
|
+
topPlayers: TopPlayer[];
|
|
97
|
+
};
|
|
98
|
+
export type FantasyItem = NotLoggedInFantasyItem | MatchupPairItem | MatchupSingleItem | InactiveLeague | PromoFantasyItem;
|
|
99
|
+
declare const FANTASY_ERROR_STATE: {
|
|
100
|
+
readonly NONE: "none";
|
|
101
|
+
readonly TAB_LOAD_FAILURE: "tabLoadFailure";
|
|
102
|
+
};
|
|
103
|
+
export type FantasyErrorState = typeof FANTASY_ERROR_STATE[keyof typeof FANTASY_ERROR_STATE];
|
|
104
|
+
export declare class FantasyViewModel {
|
|
105
|
+
fantasyItems: Observable<FantasyItem[]>;
|
|
106
|
+
isDataLoading: Observable<boolean>;
|
|
107
|
+
hasEverSuccessfullyLoaded: Observable<boolean>;
|
|
108
|
+
private eventId;
|
|
109
|
+
private delegate;
|
|
110
|
+
private analyticsService;
|
|
111
|
+
private fantasyService;
|
|
112
|
+
private useMockData;
|
|
113
|
+
private fantasyPolling;
|
|
114
|
+
private leagueManagerPolling;
|
|
115
|
+
errorState: Observable<FantasyErrorState>;
|
|
116
|
+
constructor(eventId: string, delegate: IMaestroEventDelegate, options?: {
|
|
117
|
+
useMockData?: boolean;
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Initialize the ViewModel and start data fetching
|
|
121
|
+
*/
|
|
122
|
+
init(): Promise<void>;
|
|
123
|
+
private fetchData;
|
|
124
|
+
onEngage(type: FantasyItem['type']): void;
|
|
125
|
+
onAskLogin(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Clean up resources when the ViewModel is no longer needed
|
|
128
|
+
*/
|
|
129
|
+
cleanup(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Track panel view event
|
|
132
|
+
*/
|
|
133
|
+
private trackPanelView;
|
|
134
|
+
private processFantasy;
|
|
135
|
+
private parseRoto;
|
|
136
|
+
append(item: FantasyItem | null): void;
|
|
137
|
+
private parseHeadToHead;
|
|
138
|
+
private parseTopPlayers;
|
|
139
|
+
private parseInactiveLeague;
|
|
140
|
+
/**
|
|
141
|
+
* Fetch mock data for testing
|
|
142
|
+
*/
|
|
143
|
+
private fetchMockData;
|
|
144
|
+
clearTabLoadFailure(): void;
|
|
145
|
+
}
|
|
146
|
+
export default FantasyViewModel;
|
|
@@ -233,9 +233,4 @@ export declare class StatsViewModel extends ViewModel {
|
|
|
233
233
|
*/
|
|
234
234
|
simulateUseCase<T = any>(_useCase: TestUseCase, testData?: T): void;
|
|
235
235
|
}
|
|
236
|
-
declare global {
|
|
237
|
-
interface String {
|
|
238
|
-
hashCode(): number;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
236
|
export default StatsViewModel;
|
|
@@ -30,7 +30,14 @@ type StatsItemClickedAction = {
|
|
|
30
30
|
game_state: string[];
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
type
|
|
33
|
+
type FantasyItemClickedAction = {
|
|
34
|
+
type: 'espnFantasy';
|
|
35
|
+
name: 'fantasy_item_clicked';
|
|
36
|
+
metadata: {
|
|
37
|
+
card: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
type PanelClickPayload = KeyPlaysClickedAction | BetsItemClickedAction | StatsItemClickedAction | FantasyItemClickedAction;
|
|
34
41
|
type PanelData = {
|
|
35
42
|
panel_type: string;
|
|
36
43
|
panel_id: string;
|
|
@@ -46,10 +53,10 @@ declare class AnalyticsService {
|
|
|
46
53
|
constructor();
|
|
47
54
|
private trackAction;
|
|
48
55
|
private trackImpression;
|
|
49
|
-
panelView(panelType: 'espnStats' | 'espnKeyPlays' | 'espnBet', metadata?: Record<string, any>): Promise<void>;
|
|
56
|
+
panelView(panelType: 'espnStats' | 'espnKeyPlays' | 'espnBet' | 'espnFantasy', metadata?: Record<string, any>): Promise<void>;
|
|
50
57
|
panelClick({ type, metadata, name }: PanelClickPayload): Promise<void>;
|
|
51
58
|
getBaseMetadataFromPageConfig(pageConfig: PageConfig | null): BaseMetadata;
|
|
52
|
-
getPanelDataFromPageConfig(type: 'espnBet' | 'espnStats' | 'espnKeyPlays', pageConfig: PageConfig | null): PanelData;
|
|
59
|
+
getPanelDataFromPageConfig(type: 'espnBet' | 'espnStats' | 'espnKeyPlays' | 'espnFantasy', pageConfig: PageConfig | null): PanelData;
|
|
53
60
|
sessionStart(): Promise<void>;
|
|
54
61
|
sessionEnd(): Promise<void>;
|
|
55
62
|
private scheduleNextBeacon;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import NetworkManager from './NetworkManager/NetworkManager';
|
|
2
|
+
import { IFantasyResponse, ILeagueManagerResponse, IPromoResponse } from '@/modules/fantasy/types';
|
|
3
|
+
export type LeagueManagerPollingParams = {
|
|
4
|
+
/**
|
|
5
|
+
* NBA, NFL, etc.
|
|
6
|
+
*/
|
|
7
|
+
game: string;
|
|
8
|
+
/**
|
|
9
|
+
* 2025
|
|
10
|
+
*/
|
|
11
|
+
seasonId: number;
|
|
12
|
+
/**
|
|
13
|
+
* The league ID
|
|
14
|
+
*/
|
|
15
|
+
leagueId: number;
|
|
16
|
+
token: string;
|
|
17
|
+
proGameId: string;
|
|
18
|
+
teamId: number;
|
|
19
|
+
};
|
|
20
|
+
export type FantasyPollingParams = {
|
|
21
|
+
swid: string;
|
|
22
|
+
jwt: string;
|
|
23
|
+
eventId: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Service for handling fantasy API calls
|
|
27
|
+
*/
|
|
28
|
+
declare class FantasyService {
|
|
29
|
+
fantasyClient: NetworkManager;
|
|
30
|
+
leagueManagerClient: NetworkManager;
|
|
31
|
+
promoClient: NetworkManager;
|
|
32
|
+
constructor();
|
|
33
|
+
/**
|
|
34
|
+
* Polls the fantasy API at regular intervals
|
|
35
|
+
* @param swid - The SWID of the user
|
|
36
|
+
* @param interval - Polling interval in milliseconds
|
|
37
|
+
* @param onData - Callback invoked with the data on each successful poll
|
|
38
|
+
* @param onError - Optional callback invoked on error
|
|
39
|
+
*/
|
|
40
|
+
pollFantasy({ eventId, jwt, swid }: FantasyPollingParams, interval: number, onData: (data: {
|
|
41
|
+
data: IFantasyResponse;
|
|
42
|
+
headers: Record<string, string>;
|
|
43
|
+
}) => void, onError?: (error: Error) => void): {
|
|
44
|
+
stop: () => void;
|
|
45
|
+
};
|
|
46
|
+
pollLeagueManager({ game, leagueId, seasonId, token, proGameId, teamId, }: LeagueManagerPollingParams, interval: number, onData: (data: {
|
|
47
|
+
data: ILeagueManagerResponse;
|
|
48
|
+
headers: Record<string, string>;
|
|
49
|
+
}) => void, onError?: (error: Error) => void): {
|
|
50
|
+
stop: () => void;
|
|
51
|
+
};
|
|
52
|
+
getPromo(): Promise<IPromoResponse>;
|
|
53
|
+
}
|
|
54
|
+
export default FantasyService;
|
|
@@ -11,6 +11,7 @@ import { MaestroPanelType } from '@/models/IPanel';
|
|
|
11
11
|
import { IUserSettings } from '../interfaces/IUserSettings';
|
|
12
12
|
import { PanelManagerViewModel } from './PanelManagerViewModel';
|
|
13
13
|
import AnalyticsService from '@/services/AnalyticsService/AnalyticsService';
|
|
14
|
+
import FantasyViewModel from '@/modules/fantasy/view-model/FantasyViewModel';
|
|
14
15
|
export declare class MaestroEventViewModel extends ViewModel implements IMaestroEvent {
|
|
15
16
|
private _eventId;
|
|
16
17
|
private _title;
|
|
@@ -19,6 +20,7 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
|
|
|
19
20
|
private playerTimeCode;
|
|
20
21
|
delegate: IMaestroEventDelegate;
|
|
21
22
|
keyPlaysViewModel: KeyPlaysViewModel | null;
|
|
23
|
+
fantasyViewModel: FantasyViewModel | null;
|
|
22
24
|
betsViewModel: BetsViewModel | null;
|
|
23
25
|
statsViewModel: StatsViewModel | null;
|
|
24
26
|
panelManagerViewModel: PanelManagerViewModel;
|