@maestro_io/maestro-web-sdk 3.0.0 → 3.1.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.
Files changed (22) hide show
  1. package/dist/maestro-web-sdk.umd.js +4 -4
  2. package/dist/maestro-web-sdk.umd.js.map +1 -1
  3. package/dist/src/helpers/strings.d.ts +1 -0
  4. package/dist/src/modules/bets/interfaces/IBets.d.ts +1 -0
  5. package/dist/src/modules/bets/view-model/BetsViewModel.d.ts +3 -3
  6. package/dist/src/modules/stats/interfaces/IStats.d.ts +35 -1
  7. package/dist/src/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +1 -0
  8. package/dist/src/modules/stats/view/Penalties/Penalties.d.ts +10 -0
  9. package/dist/src/modules/stats/view/Penalties/index.d.ts +2 -0
  10. package/dist/src/modules/stats/view/ScoringSummary/ExpandedScores/ExpandedScores.d.ts +30 -0
  11. package/dist/src/modules/stats/view/ScoringSummary/ExpandedScores/index.d.ts +2 -0
  12. package/dist/src/modules/stats/view/ScoringSummary/ScoreItem/ScoreItem.d.ts +52 -0
  13. package/dist/src/modules/stats/view/ScoringSummary/ScoreItem/index.d.ts +2 -0
  14. package/dist/src/modules/stats/view/ScoringSummary/ScoresSection/ScoresSection.d.ts +7 -0
  15. package/dist/src/modules/stats/view/ScoringSummary/ScoresSection/index.d.ts +2 -0
  16. package/dist/src/modules/stats/view/ScoringSummary/ScoringSummary.d.ts +26 -0
  17. package/dist/src/modules/stats/view/ScoringSummary/index.d.ts +2 -0
  18. package/dist/src/modules/stats/view-model/StatsViewModel.d.ts +29 -1
  19. package/dist/src/services/AnalyticsService/AnalyticsService.d.ts +10 -0
  20. package/dist/src/services/InsightsService/InsightsPayloadBuilder.d.ts +6 -6
  21. package/dist/src/view-models/MaestroEventViewModel.d.ts +2 -0
  22. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export declare const slugify: (str: string) => string;
@@ -12,6 +12,7 @@ export interface ITeam {
12
12
  color: string;
13
13
  alternateColor: string;
14
14
  favored: boolean;
15
+ favoredAtOpen?: boolean;
15
16
  }
16
17
  export interface IOddsValue {
17
18
  /** "-110", "+138", "EVEN", etc. */
@@ -24,14 +24,14 @@ type TeamOdd = {
24
24
  moneylineFirstLine: string;
25
25
  };
26
26
  export type ISixPackOdds = {
27
- awayTeamOdds: TeamOdd;
28
- homeTeamOdds: TeamOdd;
27
+ topTeamOdds: TeamOdd;
28
+ bottomTeamOdds: TeamOdd;
29
+ drawOdds?: TeamOdd;
29
30
  orderedColumns: {
30
31
  abbreviation: string;
31
32
  type: string;
32
33
  }[];
33
34
  gameState: string;
34
- sport: string;
35
35
  };
36
36
  export type IUserBets = {
37
37
  defaultTab: string;
@@ -39,7 +39,7 @@ export interface Athlete {
39
39
  shortName: string;
40
40
  jersey: string;
41
41
  headshot?: string;
42
- links: AthleteLink[];
42
+ links?: AthleteLink[];
43
43
  position?: AthletePosition;
44
44
  statistics?: {
45
45
  $key: string;
@@ -188,5 +188,39 @@ export interface StatsApiResponse {
188
188
  gameResult: string;
189
189
  }[];
190
190
  }[];
191
+ scoringSummary?: {
192
+ title: string;
193
+ sections: {
194
+ title: string;
195
+ items: {
196
+ team: {
197
+ $key: string;
198
+ };
199
+ athlete: {
200
+ $key: string;
201
+ };
202
+ clock: string;
203
+ title: string;
204
+ description: string;
205
+ }[];
206
+ }[];
207
+ };
208
+ penaltySummary?: {
209
+ title: string;
210
+ sections: {
211
+ title: string;
212
+ items: {
213
+ team: {
214
+ $key: string;
215
+ };
216
+ athlete: {
217
+ $key: string;
218
+ };
219
+ clock: string;
220
+ title: string;
221
+ description: string;
222
+ }[];
223
+ }[];
224
+ };
191
225
  }
192
226
  export {};
@@ -5,6 +5,7 @@ import { Direction } from '@/external/spatial-navigation/utils';
5
5
  type Props = {
6
6
  onArrowPress: (index: number) => (direction: Direction) => void;
7
7
  onBackPress: () => void;
8
+ parentFocusKey: string;
8
9
  } & Pick<ActiveAthletesProps, 'item' | 'onEnterPress'>;
9
10
  declare class ExpandedAthletes extends React.Component<Props> {
10
11
  refsArray: HTMLDivElement[];
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { PenaltiesItem } from '../../view-model/StatsViewModel';
3
+ import { Layout } from '@/external/spatial-navigation/utils';
4
+ type PenaltiesProps = {
5
+ item: PenaltiesItem;
6
+ onBecameFocused: (layout: Layout) => void;
7
+ onEnterPress: () => void;
8
+ };
9
+ declare const Penalties: (props: PenaltiesProps) => React.JSX.Element;
10
+ export default Penalties;
@@ -0,0 +1,2 @@
1
+ import Penalties from './Penalties';
2
+ export default Penalties;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { IScoreSection } from '@/modules/stats/view-model/StatsViewModel';
3
+ import './ExpandedScores.styles.css';
4
+ import { Direction } from '@/external/spatial-navigation/utils';
5
+ type Props = {
6
+ item: IScoreSection[];
7
+ noScoresText: string;
8
+ type: 'scoringSummary' | 'penalties';
9
+ onArrowPress: (props: {
10
+ index: number;
11
+ scoreIndex: number;
12
+ }) => (direction: Direction) => boolean;
13
+ onBackPress: () => void;
14
+ onEnterPress: () => void;
15
+ parentFocusKey: string;
16
+ };
17
+ declare class ExpandedScores extends React.Component<Props> {
18
+ refsArray: HTMLDivElement[];
19
+ titleRefsArray: HTMLDivElement[];
20
+ wrapperRef: HTMLDivElement | null;
21
+ state: {
22
+ maxHeight: string;
23
+ scrolled: boolean;
24
+ };
25
+ updateMaxHeight(sectionIndex: number, scoreFocusedIndex: number): void;
26
+ scrollToElement(focusedIndex: number): void;
27
+ onBecameFocused: (sectionIndex: number, scoreFocusedIndex: number) => () => void;
28
+ render(): React.JSX.Element;
29
+ }
30
+ export default ExpandedScores;
@@ -0,0 +1,2 @@
1
+ import ExpandedScores from './ExpandedScores';
2
+ export default ExpandedScores;
@@ -0,0 +1,52 @@
1
+ /// <reference types="prop-types" />
2
+ import React from 'react';
3
+ import { IScoreItem } from '@/modules/stats/view-model/StatsViewModel';
4
+ import { WithFocusableProps } from '@/external/spatial-navigation';
5
+ import './ScoreItem.styles.css';
6
+ type Props = {
7
+ item: IScoreItem;
8
+ };
9
+ declare const _default: {
10
+ new (props?: (Props & WithFocusableProps) | undefined, context?: any): {
11
+ state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState;
12
+ navigation: import("../../../../../external/spatial-navigation/spatialNavigation").default;
13
+ getChildContext(): {
14
+ parentFocusKey: string;
15
+ };
16
+ setFocus: (focusKey: string) => void;
17
+ navigateByDirection: (direction: import("../../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
18
+ stealFocus: () => void;
19
+ onUpdateFocus: (focused: boolean) => void;
20
+ onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
21
+ onEnterPressHandler: (details: import("../../../../../external/spatial-navigation/utils").Details) => void;
22
+ onEnterReleaseHandler: () => void;
23
+ onBackPressHandler: (details: import("../../../../../external/spatial-navigation/utils").Details) => void;
24
+ onArrowPressHandler: (direction: import("../../../../../external/spatial-navigation/utils").Direction, details: import("../../../../../external/spatial-navigation/utils").Details) => boolean | void;
25
+ onBecameFocusedHandler: (layout: import("../../../../../external/spatial-navigation/utils").Layout, details: import("../../../../../external/spatial-navigation/utils").Details) => void;
26
+ onBecameBlurredHandler: (layout: import("../../../../../external/spatial-navigation/utils").Layout, details: import("../../../../../external/spatial-navigation/utils").Details) => void;
27
+ componentDidMount(): void;
28
+ componentDidUpdate(): void;
29
+ componentWillUnmount(): void;
30
+ render(): React.ReactElement<Props & WithFocusableProps>;
31
+ 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: Props & 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;
32
+ forceUpdate(callBack?: (() => any) | undefined): void;
33
+ props: Readonly<{
34
+ children?: React.ReactNode;
35
+ }> & Readonly<Props & WithFocusableProps>;
36
+ context: any;
37
+ refs: {
38
+ [key: string]: React.ReactInstance;
39
+ };
40
+ componentWillMount?(): void;
41
+ componentWillReceiveProps?(nextProps: Readonly<Props & WithFocusableProps>, nextContext: any): void;
42
+ shouldComponentUpdate?(nextProps: Readonly<Props & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
43
+ componentWillUpdate?(nextProps: Readonly<Props & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
44
+ };
45
+ contextTypes: {
46
+ parentFocusKey: import("prop-types").Requireable<string>;
47
+ };
48
+ childContextTypes: {
49
+ parentFocusKey: import("prop-types").Requireable<string>;
50
+ };
51
+ };
52
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import ScoreItem from './ScoreItem';
2
+ export default ScoreItem;
@@ -0,0 +1,7 @@
1
+ import { IScoreSection } from '@/modules/stats/view-model/StatsViewModel';
2
+ import React from 'react';
3
+ import './ScoresSection.styles.css';
4
+ declare const ScoresSection: (props: IScoreSection & {
5
+ noScoresText: string;
6
+ }) => React.JSX.Element;
7
+ export default ScoresSection;
@@ -0,0 +1,2 @@
1
+ import ScoresSection from './ScoresSection';
2
+ export default ScoresSection;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Direction, Layout } from '@/external/spatial-navigation/utils';
3
+ import { PenaltiesItem, ScoringSummaryItem } from '../../view-model/StatsViewModel';
4
+ import './ScoringSummary.styles.css';
5
+ export type ScoringSummaryProps = {
6
+ item: ScoringSummaryItem | PenaltiesItem;
7
+ noScoresText?: string;
8
+ onBecameFocused: (layout: Layout) => void;
9
+ onEnterPress: () => void;
10
+ };
11
+ declare class ScoringSummary extends React.Component<ScoringSummaryProps, {
12
+ expanded: boolean;
13
+ }> {
14
+ constructor(props: ScoringSummaryProps);
15
+ onEnterPress(): void;
16
+ onExpandedScoreArrowPress: (props: {
17
+ index: number;
18
+ scoreIndex: number;
19
+ }) => (d: Direction) => boolean;
20
+ get cardFocusKey(): string;
21
+ onExpandedScoreBackPress: () => void;
22
+ onArrowPress: (d: Direction) => void;
23
+ renderContent(): React.JSX.Element | React.JSX.Element[];
24
+ render(): React.JSX.Element;
25
+ }
26
+ export default ScoringSummary;
@@ -0,0 +1,2 @@
1
+ import ScoringSummary from './ScoringSummary';
2
+ export default ScoringSummary;
@@ -57,6 +57,7 @@ export type WinProbabilityStatsItem = {
57
57
  };
58
58
  export type GameLeadersStatsItem = {
59
59
  type: 'gameLeaders';
60
+ displayText: string;
60
61
  items: AthletesStatisticsItem[];
61
62
  };
62
63
  export type ActiveAthletesItem = {
@@ -107,7 +108,32 @@ export type DriveSummaryItem = {
107
108
  lastPlayMarquee: string;
108
109
  plays: DrivePlay[];
109
110
  };
110
- export type StatsItem = HeaderTeamStatItem | RecentGamesStatsItem | WinProbabilityStatsItem | GameLeadersStatsItem | ActiveAthletesItem | StatsPromotionItem | StatsMatchPredictorItem | TeamStatsItem | DriveSummaryItem;
111
+ export type IScoreItem = {
112
+ teamLogo?: string;
113
+ teamName?: string;
114
+ athletePosition?: string;
115
+ athleteNumber?: string;
116
+ athleteName?: string;
117
+ athleteAssists?: string;
118
+ athleteThumbnail?: string;
119
+ description: string;
120
+ clock: string;
121
+ };
122
+ export type IScoreSection = {
123
+ title: string;
124
+ scores: IScoreItem[];
125
+ };
126
+ export type ScoringSummaryItem = {
127
+ type: 'scoringSummary';
128
+ title: string;
129
+ sections: IScoreSection[];
130
+ };
131
+ export type PenaltiesItem = {
132
+ type: 'penalties';
133
+ title: string;
134
+ sections: IScoreSection[];
135
+ };
136
+ export type StatsItem = HeaderTeamStatItem | RecentGamesStatsItem | WinProbabilityStatsItem | GameLeadersStatsItem | ActiveAthletesItem | StatsPromotionItem | StatsMatchPredictorItem | TeamStatsItem | DriveSummaryItem | ScoringSummaryItem | PenaltiesItem;
111
137
  export declare class StatsViewModel extends ViewModel {
112
138
  isDataLoading: Observable<boolean>;
113
139
  hasEverSuccessfullyLoaded: Observable<boolean>;
@@ -200,6 +226,8 @@ export declare class StatsViewModel extends ViewModel {
200
226
  private parseGameLeaders;
201
227
  private parseActiveAthletes;
202
228
  private getActiveAthletesTeamInfo;
229
+ private parseScoringSummary;
230
+ private parsePenalties;
203
231
  /**
204
232
  * Simulate a use case using mock StatsApiResponse data
205
233
  */
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import InsightsPayloadBuilder from '../InsightsService/InsightsPayloadBuilder';
2
3
  import InsightsService from '../InsightsService/InsightsService';
3
4
  import { PageConfig } from '../PageService/types';
@@ -38,6 +39,10 @@ type PanelData = {
38
39
  declare class AnalyticsService {
39
40
  insightsService: InsightsService;
40
41
  insightsPayloadBuilder: InsightsPayloadBuilder;
42
+ sessionId: string;
43
+ sessionBeaconTimeoutId: NodeJS.Timeout | null;
44
+ isSessionBeaconRunning: boolean;
45
+ isSessionActive: boolean;
41
46
  constructor();
42
47
  private trackAction;
43
48
  private trackImpression;
@@ -45,5 +50,10 @@ declare class AnalyticsService {
45
50
  panelClick({ type, metadata, name }: PanelClickPayload): Promise<void>;
46
51
  getBaseMetadataFromPageConfig(pageConfig: PageConfig | null): BaseMetadata;
47
52
  getPanelDataFromPageConfig(type: 'espnBet' | 'espnStats' | 'espnKeyPlays', pageConfig: PageConfig | null): PanelData;
53
+ sessionStart(): Promise<void>;
54
+ sessionEnd(): Promise<void>;
55
+ private scheduleNextBeacon;
56
+ private sendSessionBeacon;
57
+ private sessionBeacon;
48
58
  }
49
59
  export default AnalyticsService;
@@ -7,9 +7,9 @@ type EventData = {
7
7
  ontology: {
8
8
  kingdom: string;
9
9
  phylum: string;
10
- class: string;
10
+ class?: string;
11
11
  order?: string;
12
- family: string;
12
+ family?: string;
13
13
  genus?: string;
14
14
  species?: string;
15
15
  };
@@ -54,7 +54,7 @@ export default class InsightsPayloadBuilder {
54
54
  * @description Event class.
55
55
  * @example 'panel_type'
56
56
  */
57
- e2: string;
57
+ e2: string | undefined;
58
58
  /**
59
59
  * @description Event order.
60
60
  * @example 'panel_id'
@@ -64,7 +64,7 @@ export default class InsightsPayloadBuilder {
64
64
  * @description Event family.
65
65
  * @example 'panel_name'
66
66
  */
67
- e4: string;
67
+ e4: string | undefined;
68
68
  /**
69
69
  * @description Event genus. This is a more specific level of the ontology and can be used to identify the event type.
70
70
  */
@@ -206,7 +206,7 @@ export default class InsightsPayloadBuilder {
206
206
  * @description A unique identifier for the device, which can be used to track the device across sessions. You might wanna save this into a local storage or something related.
207
207
  * @example localStorage.getItem('devicePermanentId') || generateUniqueId()
208
208
  */
209
- d_pid: any;
209
+ d_pid: string;
210
210
  /**
211
211
  * @description Device screen height in pixels.
212
212
  * @example window.screen.height
@@ -263,7 +263,7 @@ export default class InsightsPayloadBuilder {
263
263
  }>;
264
264
  private getEventInsights;
265
265
  private getPageInsights;
266
- private getDevicePermanentID;
266
+ getDevicePermanentID(): string;
267
267
  private getDeviceCreated;
268
268
  private getTabID;
269
269
  private getDeviceInsights;
@@ -10,6 +10,7 @@ import IMaestroKeyPlaysResponse from '../modules/key-plays/interfaces/IKeyPlaysR
10
10
  import { MaestroPanelType } from '@/models/IPanel';
11
11
  import { IUserSettings } from '../interfaces/IUserSettings';
12
12
  import { PanelManagerViewModel } from './PanelManagerViewModel';
13
+ import AnalyticsService from '@/services/AnalyticsService/AnalyticsService';
13
14
  export declare class MaestroEventViewModel extends ViewModel implements IMaestroEvent {
14
15
  private _eventId;
15
16
  private _title;
@@ -22,6 +23,7 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
22
23
  statsViewModel: StatsViewModel | null;
23
24
  panelManagerViewModel: PanelManagerViewModel;
24
25
  navigation: SpatialNavigation;
26
+ analyticsService: AnalyticsService;
25
27
  constructor(eventId: string | undefined, delegate: IMaestroEventDelegate);
26
28
  setActivePanel(panelType: MaestroPanelType): void;
27
29
  updatePlayerTimeCode(timestamp: number): void;
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.0.0",
4
+ "version": "3.1.0",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "main": "dist/maestro-web-sdk.umd.js",