@maestro_io/maestro-web-sdk 2.2.6 → 2.2.8

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.
@@ -1,20 +1,25 @@
1
1
  import React, { Component } from 'react';
2
2
  import './StatsView.styles.css';
3
- import { StatsItem } from '../view-model/StatsViewModel';
3
+ import { StatsErrorState, StatsItem } from '../view-model/StatsViewModel';
4
+ import { Direction } from '@/external/spatial-navigation/utils';
4
5
  interface StatsViewState {
5
6
  container: HTMLDivElement | null;
6
7
  statsItems: StatsItem[];
7
8
  isDataLoading: boolean;
9
+ errorState: StatsErrorState;
8
10
  }
9
11
  declare class StatsView extends Component<{}, StatsViewState> {
10
12
  private container;
11
13
  private statsDataUnsub;
12
14
  private isDataLoadingUnsub;
15
+ private errorStateListener;
13
16
  private vm;
14
17
  constructor(props: {});
15
18
  componentDidMount(): void;
16
19
  componentWillUnmount(): void;
17
- renderItems: () => React.JSX.Element[] | null;
20
+ clearTabLoadFailure: () => void;
21
+ onArrowPress: (d: Direction) => void;
22
+ renderItems: () => React.JSX.Element | React.JSX.Element[] | null;
18
23
  onEnterPress: (item: StatsItem) => void;
19
24
  render(): React.JSX.Element;
20
25
  }
@@ -10,7 +10,7 @@ declare const STATS_ERROR_STATE: {
10
10
  readonly NONE: "none";
11
11
  readonly TAB_LOAD_FAILURE: "tabLoadFailure";
12
12
  };
13
- export type BetsErrorState = typeof STATS_ERROR_STATE[keyof typeof STATS_ERROR_STATE];
13
+ export type StatsErrorState = typeof STATS_ERROR_STATE[keyof typeof STATS_ERROR_STATE];
14
14
  export type HeaderTeamStatItem = {
15
15
  type: 'headerTeam';
16
16
  isLive: boolean;
@@ -111,7 +111,7 @@ export declare class StatsViewModel extends ViewModel {
111
111
  hasEverSuccessfullyLoaded: Observable<boolean>;
112
112
  eventId: string;
113
113
  statsItems: Observable<StatsItem[]>;
114
- errorState: Observable<BetsErrorState>;
114
+ errorState: Observable<StatsErrorState>;
115
115
  currentGameState: Observable<string>;
116
116
  statsService: StatsService;
117
117
  analyticsService: AnalyticsService;
@@ -144,10 +144,11 @@ export declare class StatsViewModel extends ViewModel {
144
144
  * @param playerTimeCode - The timecode in milliseconds, or null for live
145
145
  */
146
146
  onUpdatePlayerTimeCode(playerTimeCode: number | null): void;
147
+ clearTabLoadFailure(): void;
147
148
  /**
148
149
  * Implement smart polling strategy: immediate API call + delayed polling resumption
149
150
  *
150
- * @param syncUrl - The sync URL to use for the API call
151
+ * @param playerTimeCode - The timecode in milliseconds, or null
151
152
  */
152
153
  private performSmartPolling;
153
154
  /**
@@ -165,25 +166,10 @@ export declare class StatsViewModel extends ViewModel {
165
166
  * Reset timecode polling state
166
167
  */
167
168
  private resetTimecodePollingState;
168
- /**
169
- * Build sync URL for timecode-based stats fetching with enhanced logging
170
- * Enhanced with comprehensive validation and fallback strategies
171
- *
172
- * @param timeCode - The timecode in milliseconds, or null for 'latest'
173
- * @returns Complete sync URL for the fauxcast stats endpoint
174
- * @throws Error if page config is not available or required fields are missing
175
- */
176
- private buildSyncUrl;
177
- /**
178
- * Format timecode for API consumption
179
- * @param timeCode - Timecode in milliseconds or null
180
- * @returns ISO date string, "pre.json" for pre-game, or "latest" for post-game
181
- */
182
- private formatTimeCodeForAPI;
183
169
  /**
184
170
  * Start timecode-based polling with enhanced logging
185
171
  *
186
- * @param syncUrl - The sync URL to poll
172
+ * @param playerTimeCode - The timecode in milliseconds, or null
187
173
  */
188
174
  private startTimecodePolling;
189
175
  /**
@@ -1,10 +1,23 @@
1
1
  import ITheme from '@/models/ITheme';
2
- interface PageConfigPanel {
2
+ interface PageConfigPanel<TRendererData = unknown, TBlockData = never> {
3
3
  _id: string;
4
4
  slug: string;
5
5
  panel_name?: string;
6
6
  panel_type?: string;
7
7
  icon_name?: string;
8
+ renderer?: {
9
+ block_data?: TBlockData;
10
+ icon_name?: string;
11
+ id?: string;
12
+ panel_name?: string;
13
+ panel_type?: string;
14
+ supported_platforms?: {
15
+ android?: boolean;
16
+ bbd?: boolean;
17
+ roku?: boolean;
18
+ tvos?: boolean;
19
+ } & TRendererData;
20
+ };
8
21
  }
9
22
  export type PageMetadata = {
10
23
  /**
@@ -10,28 +10,36 @@ declare class StatsService {
10
10
  /**
11
11
  * Get stats using a full sync URL (for timecode support)
12
12
  *
13
- * @param syncUrl - Complete sync URL (e.g., https://client.espn.com/fauxcast/stats/...)
13
+ * @param timeCode - The timecode in milliseconds, or null for 'latest'
14
14
  * @returns Promise with the stats data
15
15
  */
16
- getStatsByUrl(syncUrl: string): Promise<StatsApiResponse>;
16
+ getStatsByUrl(timeCode: number | null): Promise<StatsApiResponse>;
17
17
  /**
18
18
  * Start polling using a full sync URL (for timecode support)
19
19
  *
20
- * @param syncUrl - Complete sync URL (e.g., https://client.espn.com/fauxcast/stats/...)
20
+ * @param timeCode - The timecode in milliseconds, or null for 'latest'
21
21
  * @param interval - The polling interval in milliseconds
22
22
  * @param onData - Callback for successful data fetch
23
23
  * @param onError - Callback for errors
24
24
  * @returns Object with a stop function to stop polling
25
25
  */
26
- pollStatsByUrl(syncUrl: string, interval: number, onData: (data: StatsApiResponse) => void, onError?: (error: Error) => void): {
26
+ pollStatsByUrl(timeCode: number | null, interval: number, onData: (data: StatsApiResponse) => void, onError?: (error: Error) => void): {
27
27
  stop: () => void;
28
28
  };
29
29
  /**
30
- * Parse a sync URL into base URL and endpoint
30
+ * Build sync URL for timecode-based stats fetching with enhanced logging
31
+ * Enhanced with comprehensive validation and fallback strategies
31
32
  *
32
- * @param syncUrl - Complete sync URL
33
- * @returns Object with baseUrl and endpoint
33
+ * @param timeCode - The timecode in milliseconds, or null for 'latest'
34
+ * @returns Complete sync URL for the fauxcast stats endpoint
35
+ * @throws Error if page config is not available or required fields are missing
34
36
  */
35
- private parseSyncUrl;
37
+ private getSyncEndpoint;
38
+ /**
39
+ * Format timecode for API consumption
40
+ * @param timeCode - Timecode in milliseconds or null
41
+ * @returns ISO date string, "pre.json" for pre-game, or "latest" for post-game
42
+ */
43
+ private formatTimeCodeForAPI;
36
44
  }
37
45
  export default StatsService;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maestro_io/maestro-web-sdk",
3
3
  "private": false,
4
- "version": "2.2.6",
4
+ "version": "2.2.8",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "main": "dist/maestro-web-sdk.umd.js",