@maestro_io/maestro-web-sdk 3.1.3 → 3.3.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 +4 -0
- package/dist/src/components/atoms/SvgIcon/ShopIcon.d.ts +5 -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/IMaestroEvent.d.ts +4 -0
- package/dist/src/interfaces/IMaestroEventDelegate.d.ts +15 -0
- package/dist/src/interfaces/IUserSettings.d.ts +8 -0
- package/dist/src/models/IPanel.d.ts +2 -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/mocks.d.ts +7620 -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 +32 -0
- package/dist/src/modules/fantasy/view-model/FantasyViewModel.LeagueManagerPolling.d.ts +32 -0
- package/dist/src/modules/fantasy/view-model/FantasyViewModel.d.ts +148 -0
- package/dist/src/modules/shop/mocks.d.ts +22 -0
- package/dist/src/modules/shop/types.d.ts +161 -0
- package/dist/src/modules/shop/view/ProductDetailView/ProductDetailView.d.ts +10 -0
- package/dist/src/modules/shop/view/ProductDetailView/index.d.ts +2 -0
- package/dist/src/modules/shop/view/ShopView.d.ts +35 -0
- package/dist/src/modules/shop/view/components/BrowseCard/BrowseCard.d.ts +55 -0
- package/dist/src/modules/shop/view/components/BrowseCard/index.d.ts +2 -0
- package/dist/src/modules/shop/view/components/ProductSummaryCard/ProductSummaryCard.d.ts +56 -0
- package/dist/src/modules/shop/view/components/ProductSummaryCard/index.d.ts +2 -0
- package/dist/src/modules/shop/view/components/ShopPromoView/ShopPromoView.d.ts +9 -0
- package/dist/src/modules/shop/view/components/ShopPromoView/index.d.ts +1 -0
- package/dist/src/modules/shop/view/components/ShopSection/ShopSection.d.ts +21 -0
- package/dist/src/modules/shop/view/components/ShopSection/index.d.ts +1 -0
- package/dist/src/modules/shop/view/index.d.ts +2 -0
- package/dist/src/modules/shop/view-model/ShopViewModel.ShopPolling.d.ts +31 -0
- package/dist/src/modules/shop/view-model/ShopViewModel.d.ts +77 -0
- package/dist/src/modules/stats/view-model/StatsViewModel.d.ts +0 -5
- package/dist/src/services/AnalyticsService/AnalyticsService.d.ts +23 -3
- package/dist/src/services/FantasyService.d.ts +53 -0
- package/dist/src/services/NetworkManager/types.d.ts +2 -0
- package/dist/src/services/ShopService.d.ts +23 -0
- package/dist/src/view-models/MaestroEventViewModel.d.ts +4 -0
- package/package.json +1 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './ShopSection.styles.css';
|
|
3
|
+
import { IShopBrowseCard, IShopProduct, IShopSection } from '../../../types';
|
|
4
|
+
import { Direction, Layout } from '@/external/spatial-navigation/utils';
|
|
5
|
+
export type ShopSectionProps = {
|
|
6
|
+
section: IShopSection;
|
|
7
|
+
onArrowPress: (direction: Direction) => void;
|
|
8
|
+
onItemClick: (item: IShopProduct | IShopBrowseCard, section: IShopSection, focusKey: string) => void;
|
|
9
|
+
};
|
|
10
|
+
declare class ShopSection extends React.Component<ShopSectionProps> {
|
|
11
|
+
static contextTypes: {
|
|
12
|
+
refsMap: React.Requireable<any>;
|
|
13
|
+
setRef: React.Requireable<any>;
|
|
14
|
+
scrollToFocusedElement: React.Requireable<any>;
|
|
15
|
+
};
|
|
16
|
+
context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
|
|
17
|
+
onBecameFocused: (layout: Layout) => void;
|
|
18
|
+
onEnterPress: (item: IShopProduct | IShopBrowseCard, section: IShopSection, focusKey: string) => () => void;
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default ShopSection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ShopSection';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import ShopService from '@/services/ShopService';
|
|
2
|
+
import { IShopResponse } from '../types';
|
|
3
|
+
export default class ShopPolling {
|
|
4
|
+
private polling;
|
|
5
|
+
private shopService;
|
|
6
|
+
constructor(service: ShopService);
|
|
7
|
+
/**
|
|
8
|
+
* Refresh polling for shop data
|
|
9
|
+
*/
|
|
10
|
+
refresh(callback: (data: IShopResponse) => void): void;
|
|
11
|
+
/**
|
|
12
|
+
* Stop polling for shop data
|
|
13
|
+
*/
|
|
14
|
+
stop(): void;
|
|
15
|
+
removeLastResponseHash(): void;
|
|
16
|
+
private start;
|
|
17
|
+
/**
|
|
18
|
+
* @description Update polling interval checking either response header or panel config.
|
|
19
|
+
* Refresh polling if necessary.
|
|
20
|
+
*/
|
|
21
|
+
private updateInterval;
|
|
22
|
+
private getResponseHeaderPollingIntervalValue;
|
|
23
|
+
/**
|
|
24
|
+
* Process data received from polling
|
|
25
|
+
*/
|
|
26
|
+
private processPolledData;
|
|
27
|
+
/**
|
|
28
|
+
* Handle errors that occur during shop polling
|
|
29
|
+
*/
|
|
30
|
+
private handlePollingError;
|
|
31
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Observable } from '../../../helpers/Observable';
|
|
2
|
+
import { ViewModel } from '../../../view-models/ViewModel';
|
|
3
|
+
import { IShopSection, IShopProduct, IShopBrowseCard, IShopDefaultItem } from '../types';
|
|
4
|
+
import { TestUseCase } from '@/interfaces/IMaestroEvent';
|
|
5
|
+
declare const SHOP_ERROR_STATE: {
|
|
6
|
+
readonly NONE: "none";
|
|
7
|
+
readonly TAB_LOAD_FAILURE: "tabLoadFailure";
|
|
8
|
+
readonly EMPTY_SHOP: "emptyShop";
|
|
9
|
+
};
|
|
10
|
+
export type ShopErrorState = typeof SHOP_ERROR_STATE[keyof typeof SHOP_ERROR_STATE];
|
|
11
|
+
/**
|
|
12
|
+
* ViewModel for Shop panel
|
|
13
|
+
* Manages shop data fetching, polling, and state
|
|
14
|
+
*/
|
|
15
|
+
export declare class ShopViewModel extends ViewModel {
|
|
16
|
+
sections: Observable<IShopSection[]>;
|
|
17
|
+
isDataLoading: Observable<boolean>;
|
|
18
|
+
errorState: Observable<ShopErrorState>;
|
|
19
|
+
hasEverSuccessfullyLoaded: Observable<boolean>;
|
|
20
|
+
promoData: Observable<IShopDefaultItem | null>;
|
|
21
|
+
private shopService;
|
|
22
|
+
private analyticsService;
|
|
23
|
+
private shopPolling;
|
|
24
|
+
private useMockData;
|
|
25
|
+
private mockDataType;
|
|
26
|
+
initialized: boolean;
|
|
27
|
+
constructor(eventId: string, options?: {
|
|
28
|
+
useMockData?: boolean;
|
|
29
|
+
mockDataType?: 'nfl' | 'nba' | 'ncf' | 'empty' | 'single';
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the ViewModel and start data fetching
|
|
33
|
+
*/
|
|
34
|
+
init(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Clean up resources when the ViewModel is no longer needed
|
|
37
|
+
*/
|
|
38
|
+
cleanup(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Track panel view event
|
|
41
|
+
*/
|
|
42
|
+
private trackPanelView;
|
|
43
|
+
/**
|
|
44
|
+
* Parse price string to number, handling currency formats
|
|
45
|
+
*/
|
|
46
|
+
private parsePriceToNumber;
|
|
47
|
+
/**
|
|
48
|
+
* Track shop item card click event
|
|
49
|
+
*/
|
|
50
|
+
trackItemClick(card: 'product_summary' | 'want more' | 'product_detail' | 'fallback', item: IShopProduct | IShopBrowseCard | null, section: IShopSection | null): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Refresh polling for shop data
|
|
53
|
+
*/
|
|
54
|
+
refreshPolling(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Process the shop data and update the sections
|
|
57
|
+
*/
|
|
58
|
+
private processShopData;
|
|
59
|
+
setTabLoadFailure(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Fetch new shop data immediately (one-time)
|
|
62
|
+
*/
|
|
63
|
+
fetchNewData(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Fetch mock data for testing
|
|
66
|
+
*/
|
|
67
|
+
private fetchMockData;
|
|
68
|
+
/**
|
|
69
|
+
* Simulate different use cases for testing
|
|
70
|
+
*/
|
|
71
|
+
simulateUseCase<T = any>(useCase: TestUseCase, data: T): void;
|
|
72
|
+
/**
|
|
73
|
+
* Clear tab load failure and retry
|
|
74
|
+
*/
|
|
75
|
+
clearTabLoadFailure(): void;
|
|
76
|
+
}
|
|
77
|
+
export default ShopViewModel;
|
|
@@ -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,27 @@ 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 ShopItemClickedAction = {
|
|
41
|
+
type: 'espnShop';
|
|
42
|
+
name: 'shop_item_clicked';
|
|
43
|
+
metadata: {
|
|
44
|
+
card: string[];
|
|
45
|
+
game_state: string[];
|
|
46
|
+
product: string | null;
|
|
47
|
+
entity_type: string[];
|
|
48
|
+
entity_name: string[];
|
|
49
|
+
price: string | null;
|
|
50
|
+
sale: string[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
type PanelClickPayload = KeyPlaysClickedAction | BetsItemClickedAction | StatsItemClickedAction | FantasyItemClickedAction | ShopItemClickedAction;
|
|
34
54
|
type PanelData = {
|
|
35
55
|
panel_type: string;
|
|
36
56
|
panel_id: string;
|
|
@@ -46,10 +66,10 @@ declare class AnalyticsService {
|
|
|
46
66
|
constructor();
|
|
47
67
|
private trackAction;
|
|
48
68
|
private trackImpression;
|
|
49
|
-
panelView(panelType: 'espnStats' | 'espnKeyPlays' | 'espnBet', metadata?: Record<string, any>): Promise<void>;
|
|
69
|
+
panelView(panelType: 'espnStats' | 'espnKeyPlays' | 'espnBet' | 'espnFantasy' | 'espnShop', metadata?: Record<string, any>): Promise<void>;
|
|
50
70
|
panelClick({ type, metadata, name }: PanelClickPayload): Promise<void>;
|
|
51
71
|
getBaseMetadataFromPageConfig(pageConfig: PageConfig | null): BaseMetadata;
|
|
52
|
-
getPanelDataFromPageConfig(type: 'espnBet' | 'espnStats' | 'espnKeyPlays', pageConfig: PageConfig | null): PanelData;
|
|
72
|
+
getPanelDataFromPageConfig(type: 'espnBet' | 'espnStats' | 'espnKeyPlays' | 'espnFantasy' | 'espnShop', pageConfig: PageConfig | null): PanelData;
|
|
53
73
|
sessionStart(): Promise<void>;
|
|
54
74
|
sessionEnd(): Promise<void>;
|
|
55
75
|
private scheduleNextBeacon;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IFantasyResponse, ILeagueManagerResponse, IPromoResponse } from '@/modules/fantasy/types';
|
|
2
|
+
export type LeagueManagerPollingParams = {
|
|
3
|
+
/**
|
|
4
|
+
* NBA, NFL, etc.
|
|
5
|
+
*/
|
|
6
|
+
game: string;
|
|
7
|
+
/**
|
|
8
|
+
* 2025
|
|
9
|
+
*/
|
|
10
|
+
seasonId: number;
|
|
11
|
+
/**
|
|
12
|
+
* The league ID
|
|
13
|
+
*/
|
|
14
|
+
leagueId: number;
|
|
15
|
+
token: string;
|
|
16
|
+
proGameId: string;
|
|
17
|
+
teamId: number;
|
|
18
|
+
};
|
|
19
|
+
export type FantasyPollingParams = {
|
|
20
|
+
swid: string;
|
|
21
|
+
jwt: string;
|
|
22
|
+
eventId: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Service for handling fantasy API calls
|
|
26
|
+
*/
|
|
27
|
+
declare class FantasyService {
|
|
28
|
+
private fantasyClient;
|
|
29
|
+
private leagueManagerClient;
|
|
30
|
+
private promoClient;
|
|
31
|
+
constructor();
|
|
32
|
+
/**
|
|
33
|
+
* Polls the fantasy API at regular intervals
|
|
34
|
+
* @param swid - The SWID of the user
|
|
35
|
+
* @param interval - Polling interval in milliseconds
|
|
36
|
+
* @param onData - Callback invoked with the data on each successful poll
|
|
37
|
+
* @param onError - Optional callback invoked on error
|
|
38
|
+
*/
|
|
39
|
+
pollFantasy({ eventId, jwt, swid }: FantasyPollingParams, interval: number, onData: (data: {
|
|
40
|
+
data: IFantasyResponse;
|
|
41
|
+
headers: Record<string, string>;
|
|
42
|
+
}) => void, onError?: (error: Error) => void): {
|
|
43
|
+
stop: () => void;
|
|
44
|
+
};
|
|
45
|
+
pollLeagueManager({ game, leagueId, seasonId, token, proGameId, teamId, }: LeagueManagerPollingParams, interval: number, onData: (data: {
|
|
46
|
+
data: ILeagueManagerResponse;
|
|
47
|
+
headers: Record<string, string>;
|
|
48
|
+
}) => void, onError?: (error: Error) => void): {
|
|
49
|
+
stop: () => void;
|
|
50
|
+
};
|
|
51
|
+
getPromo(): Promise<IPromoResponse>;
|
|
52
|
+
}
|
|
53
|
+
export default FantasyService;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import NetworkManager from './NetworkManager/NetworkManager';
|
|
2
|
+
import { IShopResponse } from '../modules/shop/types';
|
|
3
|
+
import { ResponseWithHeaders } from './NetworkManager/types';
|
|
4
|
+
/**
|
|
5
|
+
* Service for handling shop-related API calls
|
|
6
|
+
*/
|
|
7
|
+
declare class ShopService {
|
|
8
|
+
networkManager: NetworkManager;
|
|
9
|
+
private eventId;
|
|
10
|
+
constructor(eventId: string);
|
|
11
|
+
/**
|
|
12
|
+
* Start polling shop data
|
|
13
|
+
*
|
|
14
|
+
* @param interval - The polling interval in milliseconds
|
|
15
|
+
* @param onData - Callback for successful data fetch with headers
|
|
16
|
+
* @param onError - Callback for errors
|
|
17
|
+
* @returns Object with a stop function to stop polling
|
|
18
|
+
*/
|
|
19
|
+
pollShopData(interval: number, onData: (data: ResponseWithHeaders<IShopResponse>) => void, onError?: (error: Error) => void): {
|
|
20
|
+
stop: () => void;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export default ShopService;
|
|
@@ -11,6 +11,8 @@ 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';
|
|
15
|
+
import ShopViewModel from '@/modules/shop/view-model/ShopViewModel';
|
|
14
16
|
export declare class MaestroEventViewModel extends ViewModel implements IMaestroEvent {
|
|
15
17
|
private _eventId;
|
|
16
18
|
private _title;
|
|
@@ -19,8 +21,10 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
|
|
|
19
21
|
private playerTimeCode;
|
|
20
22
|
delegate: IMaestroEventDelegate;
|
|
21
23
|
keyPlaysViewModel: KeyPlaysViewModel | null;
|
|
24
|
+
fantasyViewModel: FantasyViewModel | null;
|
|
22
25
|
betsViewModel: BetsViewModel | null;
|
|
23
26
|
statsViewModel: StatsViewModel | null;
|
|
27
|
+
shopViewModel: ShopViewModel | null;
|
|
24
28
|
panelManagerViewModel: PanelManagerViewModel;
|
|
25
29
|
navigation: SpatialNavigation;
|
|
26
30
|
analyticsService: AnalyticsService;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maestro_io/maestro-web-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/maestro-web-sdk.umd.js",
|
|
@@ -62,8 +62,6 @@
|
|
|
62
62
|
"jest": "26.6.3",
|
|
63
63
|
"nodemon": "^3.1.9",
|
|
64
64
|
"prettier": "2.0.5",
|
|
65
|
-
"react": "15",
|
|
66
|
-
"react-dom": "15",
|
|
67
65
|
"react-test-renderer": "15",
|
|
68
66
|
"style-loader": "2",
|
|
69
67
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|