@maestro_io/maestro-web-sdk 2.2.3 → 2.2.4
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/organisms/PanelNavigation/PanelNavigation.d.ts +0 -6
- package/dist/external/ReactRenderer.d.ts +0 -9
- package/dist/external/ports/renderer.d.ts +0 -4
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +1 -1
- package/dist/index.d.ts +2 -6
- package/dist/interfaces/IMaestroEvent.d.ts +6 -0
- package/dist/maestro-web-sdk.umd.js +3 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +54 -18
- package/dist/services/StatsService.d.ts +11 -10
- package/dist/view-models/MaestroEventViewModel.d.ts +3 -0
- package/dist/view-models/PanelManagerViewModel.d.ts +1 -3
- package/package.json +1 -1
- package/dist/view-models/index.d.ts +0 -23
|
@@ -115,12 +115,13 @@ export declare class StatsViewModel extends ViewModel {
|
|
|
115
115
|
currentGameState: Observable<string>;
|
|
116
116
|
statsService: StatsService;
|
|
117
117
|
analyticsService: AnalyticsService;
|
|
118
|
-
private pollingInterval;
|
|
119
118
|
private useMockData;
|
|
120
|
-
private pollingTask;
|
|
121
119
|
private lastResponseHash;
|
|
120
|
+
private currentPlayerTimeCode;
|
|
121
|
+
private timecodePollingTask;
|
|
122
|
+
private smartPollingTimeout;
|
|
123
|
+
private timecodePollingState;
|
|
122
124
|
constructor(eventId: string, delegate: IMaestroEventDelegate, options?: {
|
|
123
|
-
pollingInterval?: number;
|
|
124
125
|
useMockData?: boolean;
|
|
125
126
|
});
|
|
126
127
|
/**
|
|
@@ -133,27 +134,66 @@ export declare class StatsViewModel extends ViewModel {
|
|
|
133
134
|
*/
|
|
134
135
|
cleanup(): void;
|
|
135
136
|
/**
|
|
136
|
-
*
|
|
137
|
+
* Handle player timecode updates with enhanced logging and validation
|
|
138
|
+
*
|
|
139
|
+
* @param playerTimeCode - The timecode in milliseconds, or null for live
|
|
137
140
|
*/
|
|
138
|
-
|
|
141
|
+
onUpdatePlayerTimeCode(playerTimeCode: number | null): void;
|
|
139
142
|
/**
|
|
140
|
-
*
|
|
143
|
+
* Implement smart polling strategy: immediate API call + delayed polling resumption
|
|
144
|
+
*
|
|
145
|
+
* @param syncUrl - The sync URL to use for the API call
|
|
141
146
|
*/
|
|
142
|
-
private
|
|
147
|
+
private performSmartPolling;
|
|
148
|
+
/**
|
|
149
|
+
* Enhanced error handling for timecode-related operations
|
|
150
|
+
*
|
|
151
|
+
* @param context - Description of where the error occurred
|
|
152
|
+
* @param error - The error that occurred
|
|
153
|
+
*/
|
|
154
|
+
private handleTimecodeError;
|
|
155
|
+
/**
|
|
156
|
+
* Clear any pending smart polling timeout
|
|
157
|
+
*/
|
|
158
|
+
private clearSmartPollingTimeout;
|
|
159
|
+
/**
|
|
160
|
+
* Reset timecode polling state
|
|
161
|
+
*/
|
|
162
|
+
private resetTimecodePollingState;
|
|
143
163
|
/**
|
|
144
|
-
*
|
|
164
|
+
* Build sync URL for timecode-based stats fetching with enhanced logging
|
|
165
|
+
* Enhanced with comprehensive validation and fallback strategies
|
|
166
|
+
*
|
|
167
|
+
* @param timeCode - The timecode in milliseconds, or null for 'latest'
|
|
168
|
+
* @returns Complete sync URL for the fauxcast stats endpoint
|
|
169
|
+
* @throws Error if page config is not available or required fields are missing
|
|
145
170
|
*/
|
|
146
|
-
|
|
171
|
+
private buildSyncUrl;
|
|
147
172
|
/**
|
|
148
|
-
*
|
|
173
|
+
* Format timecode for API consumption
|
|
174
|
+
* @param timeCode - Timecode in milliseconds or null
|
|
175
|
+
* @returns ISO date string, "pre.json" for pre-game, or "latest" for post-game
|
|
149
176
|
*/
|
|
150
|
-
private
|
|
177
|
+
private formatTimeCodeForAPI;
|
|
151
178
|
/**
|
|
152
|
-
*
|
|
179
|
+
* Start timecode-based polling with enhanced logging
|
|
180
|
+
*
|
|
181
|
+
* @param syncUrl - The sync URL to poll
|
|
153
182
|
*/
|
|
154
|
-
private
|
|
183
|
+
private startTimecodePolling;
|
|
155
184
|
/**
|
|
156
|
-
*
|
|
185
|
+
* Stop timecode-based polling with enhanced logging
|
|
186
|
+
*/
|
|
187
|
+
private stopTimecodePolling;
|
|
188
|
+
/**
|
|
189
|
+
* Fetch mock data for testing
|
|
190
|
+
*/
|
|
191
|
+
private fetchMockData;
|
|
192
|
+
/**
|
|
193
|
+
* Process polled data with hash comparison to avoid unnecessary re-renders
|
|
194
|
+
* Enhanced with comprehensive logging to show data changes
|
|
195
|
+
*
|
|
196
|
+
* @param data - The stats data received from the API
|
|
157
197
|
*/
|
|
158
198
|
private processPolledData;
|
|
159
199
|
private processData;
|
|
@@ -171,10 +211,6 @@ export declare class StatsViewModel extends ViewModel {
|
|
|
171
211
|
* Simulate a use case using mock StatsApiResponse data
|
|
172
212
|
*/
|
|
173
213
|
simulateUseCase<T = any>(_useCase: TestUseCase, testData?: T): void;
|
|
174
|
-
/**
|
|
175
|
-
* Stop polling for bet data
|
|
176
|
-
*/
|
|
177
|
-
stopPolling(): void;
|
|
178
214
|
}
|
|
179
215
|
declare global {
|
|
180
216
|
interface String {
|
|
@@ -8,29 +8,30 @@ declare class StatsService {
|
|
|
8
8
|
networkManager: IStatsNetworkManager;
|
|
9
9
|
constructor(delegate: IMaestroEventDelegate);
|
|
10
10
|
/**
|
|
11
|
-
* Get stats for
|
|
11
|
+
* Get stats using a full sync URL (for timecode support)
|
|
12
12
|
*
|
|
13
|
-
* @param
|
|
14
|
-
* @param gameState - Optional game state filter (e.g., 'pre', 'in', 'post')
|
|
13
|
+
* @param syncUrl - Complete sync URL (e.g., https://client.espn.com/fauxcast/stats/...)
|
|
15
14
|
* @returns Promise with the stats data
|
|
16
15
|
*/
|
|
17
|
-
|
|
16
|
+
getStatsByUrl(syncUrl: string): Promise<StatsApiResponse>;
|
|
18
17
|
/**
|
|
19
|
-
* Start polling for
|
|
18
|
+
* Start polling using a full sync URL (for timecode support)
|
|
20
19
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param gameState - Optional game state filter (e.g., 'pre', 'in', 'post')
|
|
20
|
+
* @param syncUrl - Complete sync URL (e.g., https://client.espn.com/fauxcast/stats/...)
|
|
23
21
|
* @param interval - The polling interval in milliseconds
|
|
24
22
|
* @param onData - Callback for successful data fetch
|
|
25
23
|
* @param onError - Callback for errors
|
|
26
24
|
* @returns Object with a stop function to stop polling
|
|
27
25
|
*/
|
|
28
|
-
|
|
26
|
+
pollStatsByUrl(syncUrl: string, interval: number, onData: (data: StatsApiResponse) => void, onError?: (error: Error) => void): {
|
|
29
27
|
stop: () => void;
|
|
30
28
|
};
|
|
31
29
|
/**
|
|
32
|
-
*
|
|
30
|
+
* Parse a sync URL into base URL and endpoint
|
|
31
|
+
*
|
|
32
|
+
* @param syncUrl - Complete sync URL
|
|
33
|
+
* @returns Object with baseUrl and endpoint
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
|
+
private parseSyncUrl;
|
|
35
36
|
}
|
|
36
37
|
export default StatsService;
|
|
@@ -9,6 +9,7 @@ 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
11
|
import { IUserSettings } from '../interfaces/IUserSettings';
|
|
12
|
+
import { PanelManagerViewModel } from './PanelManagerViewModel';
|
|
12
13
|
export declare class MaestroEventViewModel extends ViewModel implements IMaestroEvent {
|
|
13
14
|
private _eventId;
|
|
14
15
|
private _title;
|
|
@@ -19,8 +20,10 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
|
|
|
19
20
|
keyPlaysViewModel: KeyPlaysViewModel;
|
|
20
21
|
betsViewModel: BetsViewModel;
|
|
21
22
|
statsViewModel: StatsViewModel;
|
|
23
|
+
panelManagerViewModel: PanelManagerViewModel;
|
|
22
24
|
navigation: SpatialNavigation;
|
|
23
25
|
constructor(eventId: string | undefined, delegate: IMaestroEventDelegate);
|
|
26
|
+
setActivePanel(panelType: MaestroPanelType): void;
|
|
24
27
|
updatePlayerTimeCode(timestamp: number): void;
|
|
25
28
|
getPlayerTimeCode(): number | null;
|
|
26
29
|
deinit(): void;
|
|
@@ -7,7 +7,6 @@ export type PanelInfo = {
|
|
|
7
7
|
export declare class PanelManagerViewModel {
|
|
8
8
|
private _panels;
|
|
9
9
|
private _currentPanel;
|
|
10
|
-
private _newlyFocusedPanel;
|
|
11
10
|
private settingsManager;
|
|
12
11
|
private settingsUnsubscribe;
|
|
13
12
|
private readonly ALL_PANELS;
|
|
@@ -39,8 +38,7 @@ export declare class PanelManagerViewModel {
|
|
|
39
38
|
get currentPanel(): MaestroPanelType | null;
|
|
40
39
|
set currentPanel(value: MaestroPanelType | null);
|
|
41
40
|
get currentPanelObservable(): Observable<MaestroPanelType | null>;
|
|
42
|
-
|
|
43
|
-
set newlyFocusedPanel(value: MaestroPanelType | null);
|
|
41
|
+
setActivePanel(panelType: MaestroPanelType): void;
|
|
44
42
|
getIndex(forPanelType: MaestroPanelType): number | null;
|
|
45
43
|
getPanelType(atIndex: number): MaestroPanelType | null;
|
|
46
44
|
get panelTypeToLeft(): MaestroPanelType | null;
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MaestroEventViewModel } from './MaestroEventViewModel';
|
|
2
|
-
import { PanelManagerViewModel } from './PanelManagerViewModel';
|
|
3
|
-
import { OverlayViewModel } from './OverlayViewModel';
|
|
4
|
-
import IMaestroEventDelegate from '../interfaces/IMaestroEventDelegate';
|
|
5
|
-
import KeyPlaysViewModel from '../modules/key-plays/view-model/KeyPlaysViewModel';
|
|
6
|
-
/**
|
|
7
|
-
* Aggregates all View Models
|
|
8
|
-
*/
|
|
9
|
-
export declare class MaestroViewModels {
|
|
10
|
-
readonly eventViewModel: MaestroEventViewModel;
|
|
11
|
-
readonly panelManagerViewModel: PanelManagerViewModel;
|
|
12
|
-
readonly keyPlaysViewModel: KeyPlaysViewModel;
|
|
13
|
-
readonly overlayViewModel: OverlayViewModel;
|
|
14
|
-
constructor(eventViewModel: MaestroEventViewModel);
|
|
15
|
-
/**
|
|
16
|
-
* Cleanup all view models
|
|
17
|
-
*/
|
|
18
|
-
cleanup(): void;
|
|
19
|
-
/**
|
|
20
|
-
* Creates view models from an event ID
|
|
21
|
-
*/
|
|
22
|
-
static fromEventId(eventId: string, delegate: IMaestroEventDelegate): Promise<MaestroViewModels | null>;
|
|
23
|
-
}
|