@maestro_io/maestro-web-sdk 2.2.0 → 2.2.2

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 (55) hide show
  1. package/dist/MaestroEventDelegate.d.ts +3 -0
  2. package/dist/components/core/PanelManager/PanelManager.d.ts +3 -0
  3. package/dist/components/organisms/SegmentController/SegmentController.d.ts +1 -0
  4. package/dist/external/AxiosNetworkClient.d.ts +1 -1
  5. package/dist/external/ports/networkClient.d.ts +1 -1
  6. package/dist/helpers/url.d.ts +1 -0
  7. package/dist/index.d.ts +12 -2
  8. package/dist/interfaces/IMaestroEvent.d.ts +13 -0
  9. package/dist/interfaces/IMaestroEventDelegate.d.ts +11 -0
  10. package/dist/interfaces/IMaestroManager.d.ts +10 -2
  11. package/dist/interfaces/IUserSettings.d.ts +36 -0
  12. package/dist/maestro-web-sdk.umd.js +3 -3
  13. package/dist/maestro-web-sdk.umd.js.map +1 -1
  14. package/dist/modules/bets/types/BetsAnalyticsTypes.d.ts +25 -0
  15. package/dist/modules/bets/view/BetsView.d.ts +4 -0
  16. package/dist/modules/bets/view/SixPack/SixPackView.d.ts +1 -0
  17. package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +1 -0
  18. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +1 -0
  19. package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +2 -1
  20. package/dist/modules/bets/view/UserBets/Boost/Boost.d.ts +2 -1
  21. package/dist/modules/bets/view/UserBets/Parlay/Parlay.d.ts +2 -1
  22. package/dist/modules/bets/view/UserBets/Straight/Straight.d.ts +2 -1
  23. package/dist/modules/bets/view/UserBets/Teaser/Teaser.d.ts +2 -1
  24. package/dist/modules/bets/view/UserBets/UserBetsView.d.ts +0 -1
  25. package/dist/modules/bets/view/components/Bet/Bet.d.ts +7 -0
  26. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +1 -0
  27. package/dist/modules/bets/view-model/BetsViewModel.d.ts +33 -0
  28. package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +1 -0
  29. package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.d.ts +6 -6
  30. package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +4 -1
  31. package/dist/modules/key-plays/view/KeyPlayErrorStateView.d.ts +2 -0
  32. package/dist/modules/key-plays/view-model/KeyPlaysViewModel.d.ts +9 -1
  33. package/dist/modules/stats/interfaces/IStats.d.ts +1 -1
  34. package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +1 -0
  35. package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +1 -1
  36. package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +1 -1
  37. package/dist/modules/stats/view/DriveSummary/DriveSummary.d.ts +1 -0
  38. package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +1 -0
  39. package/dist/modules/stats/view/StatsItemView.d.ts +2 -0
  40. package/dist/modules/stats/view/StatsView.d.ts +1 -0
  41. package/dist/modules/stats/view-model/StatsViewModel.d.ts +6 -2
  42. package/dist/services/AnalyticsService/AnalyticsService.d.ts +65 -0
  43. package/dist/services/AnalyticsService/types.d.ts +65 -0
  44. package/dist/services/BetsService.d.ts +2 -2
  45. package/dist/services/InsightsService/InsightsPayloadBuilder.d.ts +278 -0
  46. package/dist/services/InsightsService/InsightsService.d.ts +10 -0
  47. package/dist/services/NetworkManager/NetworkManager.d.ts +3 -20
  48. package/dist/services/NetworkManager/NetworkManagerFactory.d.ts +42 -0
  49. package/dist/services/NetworkManager/types.d.ts +73 -0
  50. package/dist/services/StatsService.d.ts +2 -2
  51. package/dist/services/UserSettingsManager.d.ts +63 -0
  52. package/dist/view-models/MaestroEventViewModel.d.ts +5 -0
  53. package/dist/view-models/PanelManagerViewModel.d.ts +24 -0
  54. package/dist/view-models/index.d.ts +4 -0
  55. package/package.json +1 -1
@@ -1,8 +1,11 @@
1
1
  import IMaestroEventDelegate from './interfaces/IMaestroEventDelegate';
2
+ import { ActionTrackEvent, ImpressionTrackEvent } from './services/AnalyticsService/types';
2
3
  /**
3
4
  * Our own implementation of the IMaestroEventDelegate interface. Useful for Development and Testing
4
5
  */
5
6
  export default class MaestroEventDelegate implements IMaestroEventDelegate {
7
+ trackImpression(impression: ImpressionTrackEvent): void;
8
+ trackAction(action: ActionTrackEvent): void;
6
9
  getStatsAPIBaseURL(): string;
7
10
  getBettingAPIBaseURL(): string;
8
11
  userRequestedNewKeyPlaysData(): Promise<void>;
@@ -3,9 +3,12 @@ import './PanelManager.styles.css';
3
3
  import { MaestroPanelType } from '@/models/IPanel';
4
4
  interface PanelManagerState {
5
5
  activePanel: MaestroPanelType;
6
+ visiblePanels: MaestroPanelType[];
6
7
  }
7
8
  declare class PanelManager extends React.Component<{}, PanelManagerState> {
8
9
  private unsubscribe;
10
+ private panelsUnsubscribe;
11
+ private viewModel;
9
12
  constructor(props: {});
10
13
  componentDidMount(): void;
11
14
  componentWillUnmount(): void;
@@ -22,6 +22,7 @@ declare class SegmentController extends React.Component<SegmentControllerProps>
22
22
  lastActiveIndex: number;
23
23
  };
24
24
  onBecameFocused: (item: SegmentItem, i: number) => (layout: Layout) => void;
25
+ onEnterPress: (item: SegmentItem) => () => void;
25
26
  handleArrowPress: (index: number) => (direction: Direction, _props: WithFocusableProps) => void;
26
27
  render(): React.JSX.Element;
27
28
  }
@@ -14,7 +14,7 @@ declare class AxiosNetworkClient implements INetworkClient {
14
14
  });
15
15
  private retry;
16
16
  get<TResponseData = any>(endpoint: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<TResponseData>;
17
- post<TRequestData = any, TResponseData = any>(endpoint: string, data: TRequestData): Promise<TResponseData>;
17
+ post<TRequestData = any, TResponseData = any>(endpoint: string, data: TRequestData, params?: Record<string, any>, headers?: Record<string, string>): Promise<TResponseData>;
18
18
  setAuthentication(token: string | null, apiKey: string | null): void;
19
19
  }
20
20
  export default AxiosNetworkClient;
@@ -1,5 +1,5 @@
1
1
  export interface INetworkClient {
2
2
  get<TResponseData = any>(endpoint: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<TResponseData>;
3
- post<TRequestData = any, TResponseData = any>(endpoint: string, data: TRequestData): Promise<TResponseData>;
3
+ post<TRequestData = any, TResponseData = any>(endpoint: string, data: TRequestData, params?: Record<string, any>, headers?: Record<string, string>): Promise<TResponseData>;
4
4
  setAuthentication(token: string | null, apiKey: string | null): void;
5
5
  }
@@ -0,0 +1 @@
1
+ export declare const setImageDimensions: (url: string, width: number, height: number) => string;
package/dist/index.d.ts CHANGED
@@ -3,11 +3,14 @@ import IMaestroManager, { SDKConfigParams } from './interfaces/IMaestroManager';
3
3
  import IMaestroEvent from './interfaces/IMaestroEvent';
4
4
  import { MaestroEventViewModel } from './view-models/MaestroEventViewModel';
5
5
  import IMaestroKeyPlaysResponse from './modules/key-plays/interfaces/IKeyPlaysResponse';
6
+ import { IUserSettings } from './interfaces/IUserSettings';
6
7
  export { default as Overlay } from './components/molecules/Overlay/Overlay';
7
8
  export { OverlayType, IMaestroOverlayEvent, IOverlaySize, IOverlayPosition, IFantasyPayload, IOverlayAnalyticsEvent, } from './types/OverlayTypes';
8
9
  export { IWinningBet } from './models/IWinningBet';
10
+ export { ActionTrackEvent, ImpressionTrackEvent, Metadata, PanelClickAction, PanelViewAction, } from './services/AnalyticsService/types';
9
11
  export { IMaestroEventDelegate, IMaestroEvent, IMaestroKeyPlaysResponse };
10
- export type Environment = 'development' | 'staging' | 'production';
12
+ export { IUserSettings, DEFAULT_USER_SETTINGS, } from './interfaces/IUserSettings';
13
+ export type Environment = 'development' | 'production';
11
14
  /**
12
15
  * Main SDK class that serves as the entry point for the Maestro TV SDK
13
16
  * Follows a singleton pattern similar to the Swift implementation
@@ -21,15 +24,22 @@ declare class MaestroWebSDK implements IMaestroManager {
21
24
  private clientAppToken?;
22
25
  private clientAppSwid?;
23
26
  private maestroEventViewModel;
27
+ private environment;
24
28
  private constructor();
25
29
  /**
26
30
  * @description Returns the MaestroWebSDK instance
27
31
  * @returns {MaestroWebSDK} - The MaestroWebSDK instance
28
32
  */
29
33
  static getInstance(): MaestroWebSDK;
30
- userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate): Promise<IMaestroEvent>;
34
+ userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate, userSettings?: IUserSettings): Promise<IMaestroEvent>;
31
35
  userDidStopWatchingEvent(_: string): void;
32
36
  configure(configParams: SDKConfigParams): void;
37
+ /**
38
+ * Sets the environment for the SDK
39
+ * @param environment The environment to set
40
+ */
41
+ setEnvironment(environment: Environment): void;
42
+ getEnvironment(): Environment;
33
43
  /**
34
44
  * Checks if this is an authorized client based on siteID
35
45
  */
@@ -1,5 +1,6 @@
1
1
  import { MaestroPanelType } from '@/models/IPanel';
2
2
  import IMaestroKeyPlaysResponse from '../modules/key-plays/interfaces/IKeyPlaysResponse';
3
+ import { IUserSettings } from './IUserSettings';
3
4
  /**
4
5
  * This is the public API that the app can use to make calls to the SDK related to the currently-loaded event.
5
6
  */
@@ -74,6 +75,18 @@ export default interface IMaestroEvent {
74
75
  * https://developers.maestro.io/sdk/web/maestro-event-interface/state/updateKeyPlaysData
75
76
  */
76
77
  updateKeyPlaysData(data: IMaestroKeyPlaysResponse | null): Promise<void>;
78
+ updateUserSettings(settings: IUserSettings): Promise<void>;
79
+ /**
80
+ * @description Updates the SDK with the current time code of the player.
81
+ * This is used to synchronize the SDK with the player's current time code.
82
+ * https://developers.maestro.io/sdk/web/maestro-event-interface/state/updatePlayerTimeCode
83
+ */
84
+ updatePlayerTimeCode(timestamp: number): void;
85
+ /**
86
+ * @description Retrieves the current player time code stored in the SDK.
87
+ * https://developers.maestro.io/sdk/web/maestro-event-interface/state/getPlayerTimeCode
88
+ */
89
+ getPlayerTimeCode(): number | null;
77
90
  simulateUseCase<T = any>(useCase: TestUseCase, panelType: MaestroPanelType, testData?: T): void;
78
91
  }
79
92
  declare const TEST_USE_CASES: {
@@ -1,3 +1,4 @@
1
+ import { ActionTrackEvent, ImpressionTrackEvent } from '@/services/AnalyticsService/types';
1
2
  /**
2
3
  * @description Interface for the client app to implement in order to handle Maestro TV SDK events.
3
4
  */
@@ -45,4 +46,14 @@ export default interface IMaestroEventDelegate {
45
46
  *
46
47
  */
47
48
  getStatsAPIBaseURL(): string;
49
+ /**
50
+ * @description Track an user's action event for analytics. (i.e. key play clicked)
51
+ * https://developers.maestro.io/sdk/web/event-delegate/trackAction
52
+ */
53
+ trackAction(action: ActionTrackEvent): void;
54
+ /**
55
+ * @description Track an impression event for analytics. (i.e. panel view)
56
+ * https://developers.maestro.io/sdk/web/event-delegate/trackImpression
57
+ */
58
+ trackImpression(impression: ImpressionTrackEvent): void;
48
59
  }
@@ -1,10 +1,12 @@
1
1
  import IMaestroEventDelegate from './IMaestroEventDelegate';
2
2
  import IMaestroEvent from './IMaestroEvent';
3
+ import { Environment } from '..';
4
+ import { IUserSettings } from './IUserSettings';
3
5
  export type SDKConfigParams = {
4
6
  /**
5
7
  * The type of environment to use. Defaults to `development`. The available options are `development`, `staging`, and `production`.
6
8
  */
7
- environment?: 'development' | 'staging' | 'production';
9
+ environment?: Environment;
8
10
  /**
9
11
  * The frequency in seconds to poll for updates. Defaults to 5.0.
10
12
  */
@@ -33,6 +35,10 @@ export type SDKConfigParams = {
33
35
  * The client app SWID for authentication.
34
36
  */
35
37
  clientAppSwid?: string;
38
+ /**
39
+ * User settings for customizing SDK behavior (panel visibility, feature toggles, etc.)
40
+ */
41
+ userSettings?: IUserSettings;
36
42
  };
37
43
  /**
38
44
  This is the MaestroKit top-level API for initializing and configuring the framework. It encompasses all functionality that is not specific to an event.
@@ -47,6 +53,7 @@ export default interface IMaestroManager {
47
53
  * @param {SDKConfigParams['siteID']} configParams.siteID - The site ID to use for the SDK.
48
54
  * @param {SDKConfigParams['jwt']} configParams.jwt - The JWT token to use for authentication.
49
55
  * @param {SDKConfigParams['userID']} configParams.userID - The user ID of the logged account.
56
+ * @param {SDKConfigParams['userSettings']} configParams.userSettings - User settings for customizing SDK behavior.
50
57
  */
51
58
  configure(configParams: SDKConfigParams): void;
52
59
  /**
@@ -54,9 +61,10 @@ export default interface IMaestroManager {
54
61
  Arguments:
55
62
  - eventID: The Event ID for the event opened in the player.
56
63
  - delegate: an instance of the app's implementation of IMaestroEventDelegate
64
+ - userSettings: Optional user settings to override the configured settings for this event
57
65
  The function returns an instance of MaestroEventViewModel, which includes an implementation of IMaestroEvent. IMaestroEvent represents the app-facing portion of the MaestroKit API related to the currently-loaded event. So after `userDidStartWatchingEvent` is called, the SDK has access to the API detailed in `MaestroEventDelegate` for making calls to the app, and the app has access to the API detailed in `IMaestroEvent` for making calls to the SDK.
58
66
  */
59
- userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate): Promise<IMaestroEvent>;
67
+ userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate, userSettings?: IUserSettings): Promise<IMaestroEvent>;
60
68
  /**
61
69
  * @description Tells the SDK the user has closed an event that was open in the app's player.
62
70
  * @param eventID
@@ -0,0 +1,36 @@
1
+ /**
2
+ * User settings interface for customizing Maestro Web SDK behavior
3
+ * Supports panel-level and feature-level customizations
4
+ */
5
+ export interface IUserSettings {
6
+ panels?: {
7
+ bets?: {
8
+ /** Hide the entire bets panel from panel selection */
9
+ hidePanel?: boolean;
10
+ /** Hide wager values (dollar amounts) in betting cards */
11
+ hideWagers?: boolean;
12
+ };
13
+ stats?: {
14
+ /** Hide the entire stats panel from panel selection */
15
+ hidePanel?: boolean;
16
+ };
17
+ keyPlays?: {
18
+ /** Hide the entire key plays panel from panel selection */
19
+ hidePanel?: boolean;
20
+ };
21
+ };
22
+ }
23
+ /**
24
+ * Default user settings - all features enabled by default
25
+ */
26
+ export declare const DEFAULT_USER_SETTINGS: IUserSettings;
27
+ /**
28
+ * Panel-specific settings type helpers
29
+ */
30
+ export type BetsSettings = NonNullable<IUserSettings['panels']>['bets'];
31
+ export type StatsSettings = NonNullable<IUserSettings['panels']>['stats'];
32
+ export type KeyPlaysSettings = NonNullable<IUserSettings['panels']>['keyPlays'];
33
+ /**
34
+ * Utility type for getting panel settings by panel type
35
+ */
36
+ export type PanelSettings<T extends keyof NonNullable<IUserSettings['panels']>> = NonNullable<IUserSettings['panels']>[T];