@maestro_io/maestro-web-sdk 2.0.2 → 2.1.1
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/MaestroEventDelegate.d.ts +4 -0
- package/dist/components/atoms/BaseButton/BaseButton.d.ts +2 -4
- package/dist/components/atoms/Image/index.d.ts +5 -1
- package/dist/components/atoms/Rive/index.d.ts +88 -0
- package/dist/components/atoms/SvgIcon/BetGeneralIcon.d.ts +4 -0
- package/dist/components/atoms/SvgIcon/BetsWarningIcon.d.ts +7 -0
- package/dist/components/atoms/SvgIcon/CheckmarkIcon.d.ts +4 -0
- package/dist/components/atoms/SvgIcon/CollapseIcon.d.ts +4 -0
- package/dist/components/atoms/SvgIcon/ExpandIcon.d.ts +4 -0
- package/dist/components/atoms/SvgIcon/FlameIcon.d.ts +7 -0
- package/dist/components/atoms/SvgIcon/Icon.d.ts +10 -0
- package/dist/components/atoms/SvgIcon/MobilePhoneIcon.d.ts +7 -0
- package/dist/components/atoms/SvgIcon/TimesIcon.d.ts +4 -0
- package/dist/components/core/OverlayContainer.d.ts +3 -0
- package/dist/components/core/PanelManager/PanelManager.d.ts +1 -0
- package/dist/components/core/ScrollableContainer/FocusableItem.d.ts +6 -0
- package/dist/components/core/ScrollableContainer/ScrollableContainer.d.ts +75 -0
- package/dist/components/core/ScrollableContainer/index.d.ts +2 -0
- package/dist/components/molecules/ActionButton/ActionButton.d.ts +5 -8
- package/dist/components/molecules/Overlay/Overlay.d.ts +34 -0
- package/dist/components/molecules/Overlay/index.d.ts +2 -0
- package/dist/components/molecules/PanelNavButton/PanelNavButton.d.ts +40 -91
- package/dist/components/molecules/SegmentButton/SegmentButton.d.ts +6 -7
- package/dist/components/organisms/PanelNavigation/PanelNavigation.d.ts +7 -0
- package/dist/components/organisms/SegmentController/SegmentController.d.ts +19 -5
- package/dist/components/organisms/SegmentController/index.d.ts +2 -1
- package/dist/external/AxiosNetworkClient.d.ts +8 -3
- package/dist/external/LocalStorageCacheManager.d.ts +63 -8
- package/dist/external/mocks/MockExternalNetworkClient.d.ts +90 -0
- package/dist/external/ports/cacheManager.d.ts +3 -1
- package/dist/external/ports/networkClient.d.ts +1 -1
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +13 -22
- package/dist/external/spatial-navigation/utils.d.ts +5 -0
- package/dist/external/spatial-navigation/withFocusable.d.ts +12 -17
- package/dist/index.d.ts +22 -11
- package/dist/interfaces/IMaestroEvent.d.ts +9 -0
- package/dist/interfaces/IMaestroEventDelegate.d.ts +17 -0
- package/dist/interfaces/IMaestroManager.d.ts +33 -20
- package/dist/maestro-web-sdk.umd.js +10 -1
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/models/IWinningBet.d.ts +7 -0
- package/dist/modules/bets/interfaces/IBets.d.ts +190 -0
- package/dist/modules/bets/mocks.d.ts +2 -0
- package/dist/modules/bets/view/BetsView.d.ts +23 -0
- package/dist/modules/bets/view/HotProps/HotPropsView.d.ts +53 -0
- package/dist/modules/bets/view/SixPack/SixPackView.d.ts +20 -0
- package/dist/modules/bets/view/TabLoadFailureView.d.ts +46 -0
- package/dist/modules/bets/view/UserBets/BetResult/BetResult.d.ts +6 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +53 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +24 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +7 -0
- package/dist/modules/bets/view/UserBets/Boost/Boost.d.ts +7 -0
- package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.d.ts +7 -0
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.d.ts +8 -0
- package/dist/modules/bets/view/UserBets/Straight/Straight.d.ts +7 -0
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.d.ts +7 -0
- package/dist/modules/bets/view/UserBets/UserBetsView.d.ts +26 -0
- package/dist/modules/bets/view/components/Bet/Bet.d.ts +62 -0
- package/dist/modules/bets/view/components/BetPill/BetPill.d.ts +6 -0
- package/dist/modules/bets/view/components/BetsCard/BetsCard.d.ts +10 -0
- package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.d.ts +16 -0
- package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.d.ts +8 -0
- package/dist/modules/bets/view/components/LocationWarning/LocationWarning.d.ts +10 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +22 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/index.d.ts +2 -0
- package/dist/modules/bets/view-model/BetsViewModel.d.ts +179 -0
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +28 -102
- package/dist/modules/key-plays/view/KeyPlaysView.d.ts +1 -4
- package/dist/services/BetsService.d.ts +61 -0
- package/dist/services/NetworkManager/NetworkManager.d.ts +131 -0
- package/dist/services/NetworkManager/errors.d.ts +17 -0
- package/dist/types/OverlayTypes.d.ts +43 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +5 -1
- package/dist/view-models/OverlayViewModel.d.ts +33 -0
- package/dist/view-models/index.d.ts +2 -0
- package/package.json +5 -4
- package/dist/components/molecules/ScrollableGradient/ScrollableGradient.d.ts +0 -11
- package/dist/components/molecules/ScrollableGradient/index.d.ts +0 -2
- package/dist/helpers/withRemoteControl.d.ts +0 -47
- package/dist/services/NetworkManager.d.ts +0 -13
|
@@ -1,10 +1,65 @@
|
|
|
1
|
-
import { ICacheManager
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ICacheManager } from './ports/cacheManager';
|
|
2
|
+
/**
|
|
3
|
+
* Manages caching using localStorage with support for TTL, size limits, and versioning.
|
|
4
|
+
* This class implements the ICacheManager interface and provides methods for setting, getting,
|
|
5
|
+
* and clearing cache entries.
|
|
6
|
+
*/
|
|
7
|
+
export default class LocalStorageCacheManager implements ICacheManager {
|
|
8
|
+
private readonly prefix;
|
|
9
|
+
private readonly cacheDuration;
|
|
10
|
+
private readonly maxSize;
|
|
11
|
+
private readonly version;
|
|
12
|
+
private readonly accessLog;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new LocalStorageCacheManager instance.
|
|
15
|
+
* @param cacheDuration - The time-to-live (TTL) for cache entries in milliseconds.
|
|
16
|
+
* @param maxSize - The maximum size of the cache in bytes.
|
|
17
|
+
* @param version - The version of the cache. Used to invalidate cache entries when the version changes.
|
|
18
|
+
*/
|
|
19
|
+
constructor(cacheDuration?: number, maxSize?: number, version?: string);
|
|
20
|
+
/**
|
|
21
|
+
* Produces a cache key by combining the prefix, version, and the provided key.
|
|
22
|
+
* @param key - The key to be used in the cache.
|
|
23
|
+
* @returns The generated cache key.
|
|
24
|
+
*/
|
|
25
|
+
produceCacheKey(key: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the current size of the cache in bytes.
|
|
28
|
+
* @returns The total size of the cache in bytes.
|
|
29
|
+
*/
|
|
30
|
+
private getCurrentSize;
|
|
31
|
+
/**
|
|
32
|
+
* Cleans up old cache entries based on their TTL.
|
|
33
|
+
*/
|
|
34
|
+
private cleanupOldEntries;
|
|
35
|
+
/**
|
|
36
|
+
* Cleans up least recently used cache entries when the cache is full.
|
|
37
|
+
*/
|
|
38
|
+
private cleanupLRUEntries;
|
|
39
|
+
/**
|
|
40
|
+
* Sets a value in the cache with the specified key.
|
|
41
|
+
* @param key - The key to store the value under.
|
|
42
|
+
* @param data - The value to be stored in the cache.
|
|
43
|
+
*/
|
|
44
|
+
setCache(key: string, data: any): void;
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves a value from the cache by its key.
|
|
47
|
+
* @param key - The key to retrieve the value for.
|
|
48
|
+
* @returns The cached value, or null if the key is not found or the entry has expired.
|
|
49
|
+
*/
|
|
50
|
+
getCache(key: string): any;
|
|
51
|
+
/**
|
|
52
|
+
* Clears a specific cache entry by its key.
|
|
53
|
+
* @param key - The key of the cache entry to clear.
|
|
54
|
+
*/
|
|
8
55
|
clearCache(key: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Clears all cache entries that match the specified pattern.
|
|
58
|
+
* @param pattern - The pattern to match against cache keys.
|
|
59
|
+
*/
|
|
60
|
+
clearCacheByPattern(pattern: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Clears all cache entries.
|
|
63
|
+
*/
|
|
64
|
+
clearAllCache(): void;
|
|
9
65
|
}
|
|
10
|
-
export default LocalStorageCacheManager;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { INetworkClient } from '../ports/networkClient';
|
|
2
|
+
/**
|
|
3
|
+
* A mock implementation of the INetworkClient interface for testing
|
|
4
|
+
* and development purposes.
|
|
5
|
+
*/
|
|
6
|
+
declare class MockNetworkClient implements INetworkClient {
|
|
7
|
+
private mockResponses;
|
|
8
|
+
private mockErrors;
|
|
9
|
+
private defaultResponse;
|
|
10
|
+
private defaultError;
|
|
11
|
+
private latestRequest;
|
|
12
|
+
private delay;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor for MockNetworkClient
|
|
15
|
+
*
|
|
16
|
+
* @param mockResponses - Optional initial mock responses mapping
|
|
17
|
+
* @param mockErrors - Optional initial mock errors mapping
|
|
18
|
+
* @param defaultResponse - Default response for unmocked endpoints
|
|
19
|
+
* @param delay - Simulated network delay in milliseconds
|
|
20
|
+
*/
|
|
21
|
+
constructor({ mockResponses, mockErrors, defaultResponse, delay, }?: {
|
|
22
|
+
mockResponses?: Record<string, any>;
|
|
23
|
+
mockErrors?: Record<string, Error>;
|
|
24
|
+
defaultResponse?: any;
|
|
25
|
+
delay?: number;
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Get the latest request made to this mock client
|
|
29
|
+
*/
|
|
30
|
+
getLatestRequest(): {
|
|
31
|
+
method: string;
|
|
32
|
+
endpoint: string;
|
|
33
|
+
data?: any;
|
|
34
|
+
params?: any;
|
|
35
|
+
headers?: Record<string, string> | undefined;
|
|
36
|
+
} | null;
|
|
37
|
+
/**
|
|
38
|
+
* Set a mock response for a specific endpoint
|
|
39
|
+
*
|
|
40
|
+
* @param endpoint - The API endpoint
|
|
41
|
+
* @param response - The mock response data
|
|
42
|
+
*/
|
|
43
|
+
setMockResponse(endpoint: string, response: any): void;
|
|
44
|
+
/**
|
|
45
|
+
* Set a mock error for a specific endpoint
|
|
46
|
+
*
|
|
47
|
+
* @param endpoint - The API endpoint
|
|
48
|
+
* @param error - The error to throw
|
|
49
|
+
*/
|
|
50
|
+
setMockError(endpoint: string, error: Error): void;
|
|
51
|
+
/**
|
|
52
|
+
* Set a default mock response for all unmocked endpoints
|
|
53
|
+
*
|
|
54
|
+
* @param response - The default response data
|
|
55
|
+
*/
|
|
56
|
+
setDefaultResponse(response: any): void;
|
|
57
|
+
/**
|
|
58
|
+
* Set a default error for all endpoints not configured with specific errors
|
|
59
|
+
*
|
|
60
|
+
* @param error - The default error
|
|
61
|
+
*/
|
|
62
|
+
setDefaultError(error: Error | null): void;
|
|
63
|
+
/**
|
|
64
|
+
* Set the simulated network delay
|
|
65
|
+
*
|
|
66
|
+
* @param delayMs - Delay in milliseconds
|
|
67
|
+
*/
|
|
68
|
+
setDelay(delayMs: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* Clear all mock responses and errors
|
|
71
|
+
*/
|
|
72
|
+
reset(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Helper method to handle the common response/error/delay logic
|
|
75
|
+
*/
|
|
76
|
+
private handleRequest;
|
|
77
|
+
/**
|
|
78
|
+
* Mock implementation of the get method
|
|
79
|
+
*/
|
|
80
|
+
get<TResponseData = any>(endpoint: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<TResponseData>;
|
|
81
|
+
/**
|
|
82
|
+
* Mock implementation of the post method
|
|
83
|
+
*/
|
|
84
|
+
post<TRequestData = any, TResponseData = any>(endpoint: string, data: TRequestData): Promise<TResponseData>;
|
|
85
|
+
/**
|
|
86
|
+
* Mock implementation of setAuthentication
|
|
87
|
+
*/
|
|
88
|
+
setAuthentication(token: string | null, apiKey: string | null): void;
|
|
89
|
+
}
|
|
90
|
+
export default MockNetworkClient;
|
|
@@ -10,6 +10,8 @@ export interface ProduceCacheKeyParams {
|
|
|
10
10
|
export interface ICacheManager {
|
|
11
11
|
setCache(key: string, data: unknown): void;
|
|
12
12
|
getCache<T = any>(key: string): T | null;
|
|
13
|
-
produceCacheKey(params: ProduceCacheKeyParams): string;
|
|
14
13
|
clearCache(key: string): void;
|
|
14
|
+
clearAllCache(): void;
|
|
15
|
+
clearCacheByPattern(pattern: string): void;
|
|
16
|
+
produceCacheKey(key: string): string;
|
|
15
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface INetworkClient {
|
|
2
|
-
get<TResponseData = any>(endpoint: string, params?: any): Promise<TResponseData>;
|
|
2
|
+
get<TResponseData = any>(endpoint: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<TResponseData>;
|
|
3
3
|
post<TRequestData = any, TResponseData = any>(endpoint: string, data: TRequestData): Promise<TResponseData>;
|
|
4
4
|
setAuthentication(token: string | null, apiKey: string | null): void;
|
|
5
5
|
}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { Direction, Layout } from './utils';
|
|
1
|
+
import { Details, Direction, KEY_BACK, Layout } from './utils';
|
|
2
2
|
import { KEY_ENTER } from './utils';
|
|
3
3
|
export declare const ROOT_FOCUS_KEY = "SN:ROOT";
|
|
4
|
-
export type KeyType = Direction | typeof KEY_ENTER;
|
|
4
|
+
export type KeyType = Direction | typeof KEY_ENTER | typeof KEY_BACK;
|
|
5
5
|
export interface KeyMap {
|
|
6
|
-
[key: string]: number;
|
|
6
|
+
[key: string]: number[];
|
|
7
7
|
}
|
|
8
8
|
interface FocusableComponent {
|
|
9
9
|
focusKey: string;
|
|
10
10
|
node: HTMLElement;
|
|
11
11
|
parentFocusKey: string | null;
|
|
12
|
-
onEnterPressHandler?: (details:
|
|
13
|
-
|
|
14
|
-
}) => void;
|
|
12
|
+
onEnterPressHandler?: (details: Details) => void;
|
|
13
|
+
onBackPressHandler?: (details: Details) => void;
|
|
15
14
|
onEnterReleaseHandler?: () => void;
|
|
16
|
-
onArrowPressHandler?: (direction: Direction, details:
|
|
17
|
-
pressedKeys: Record<string, number>;
|
|
18
|
-
}) => boolean | void;
|
|
15
|
+
onArrowPressHandler?: (direction: Direction, details: Details) => boolean | void;
|
|
19
16
|
onBecameFocusedHandler?: (layout: Layout, details: any) => void;
|
|
20
17
|
onBecameBlurredHandler?: (layout: Layout, details: any) => void;
|
|
21
18
|
onUpdateFocus?: (isFocused: boolean) => void;
|
|
@@ -49,13 +46,10 @@ interface AddFocusableOptions {
|
|
|
49
46
|
focusKey: string;
|
|
50
47
|
node: HTMLElement;
|
|
51
48
|
parentFocusKey: string | null;
|
|
52
|
-
onEnterPressHandler?: (details:
|
|
53
|
-
pressedKeys: Record<string, number>;
|
|
54
|
-
}) => void;
|
|
49
|
+
onEnterPressHandler?: (details: Details) => void;
|
|
55
50
|
onEnterReleaseHandler?: () => void;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}) => boolean | void;
|
|
51
|
+
onBackPressHandler?: (details: Details) => void;
|
|
52
|
+
onArrowPressHandler?: (direction: Direction, details: Details) => boolean | void;
|
|
59
53
|
onBecameFocusedHandler?: (layout: Layout, details: any) => void;
|
|
60
54
|
onBecameBlurredHandler?: (layout: Layout, details: any) => void;
|
|
61
55
|
forgetLastFocusedChild?: boolean;
|
|
@@ -118,20 +112,17 @@ declare class SpatialNavigation {
|
|
|
118
112
|
getEventType(keyCode: number): KeyType | undefined;
|
|
119
113
|
bindEventHandlers(): void;
|
|
120
114
|
unbindEventHandlers(): void;
|
|
121
|
-
onEnterPress(details:
|
|
122
|
-
|
|
123
|
-
}): void;
|
|
115
|
+
onEnterPress(details: Details): void;
|
|
116
|
+
onBackPress(details: Details): void;
|
|
124
117
|
onEnterRelease(): void;
|
|
125
|
-
onArrowPress(direction: Direction, details:
|
|
126
|
-
pressedKeys: Record<string, number>;
|
|
127
|
-
}): boolean | void;
|
|
118
|
+
onArrowPress(direction: Direction, details: Details): boolean | void;
|
|
128
119
|
navigateByDirection(direction: Direction, details?: Record<string, any>): void;
|
|
129
120
|
onKeyEvent(event: KeyboardEvent): void;
|
|
130
121
|
smartNavigate(direction: Direction, fromParentFocusKey: string | null, details: Record<string, any>): void;
|
|
131
122
|
saveLastFocusedChildKey(component: FocusableComponent | undefined, focusKey: string): void;
|
|
132
123
|
log(functionName: string, debugString: string, ...rest: any[]): void;
|
|
133
124
|
getNextFocusKey(targetFocusKey: string): string;
|
|
134
|
-
addFocusable({ focusKey, node, parentFocusKey, onEnterPressHandler, onEnterReleaseHandler, onArrowPressHandler, onBecameFocusedHandler, onBecameBlurredHandler, forgetLastFocusedChild, trackChildren, onUpdateFocus, onUpdateHasFocusedChild, preferredChildFocusKey, autoRestoreFocus, focusable, blockNavigationOut, }: AddFocusableOptions): void;
|
|
125
|
+
addFocusable({ focusKey, node, parentFocusKey, onEnterPressHandler, onEnterReleaseHandler, onBackPressHandler, onArrowPressHandler, onBecameFocusedHandler, onBecameBlurredHandler, forgetLastFocusedChild, trackChildren, onUpdateFocus, onUpdateHasFocusedChild, preferredChildFocusKey, autoRestoreFocus, focusable, blockNavigationOut, }: AddFocusableOptions): void;
|
|
135
126
|
removeFocusable({ focusKey }: {
|
|
136
127
|
focusKey: string;
|
|
137
128
|
}): void;
|
|
@@ -3,6 +3,7 @@ export declare const DIRECTION_RIGHT = "right";
|
|
|
3
3
|
export declare const DIRECTION_UP = "up";
|
|
4
4
|
export declare const DIRECTION_DOWN = "down";
|
|
5
5
|
export declare const KEY_ENTER = "enter";
|
|
6
|
+
export declare const KEY_BACK = "back";
|
|
6
7
|
export type Direction = typeof DIRECTION_LEFT | typeof DIRECTION_RIGHT | typeof DIRECTION_UP | typeof DIRECTION_DOWN;
|
|
7
8
|
export interface Layout {
|
|
8
9
|
x: number;
|
|
@@ -13,3 +14,7 @@ export interface Layout {
|
|
|
13
14
|
top: number;
|
|
14
15
|
node: HTMLElement;
|
|
15
16
|
}
|
|
17
|
+
export interface Details {
|
|
18
|
+
pressedKeys: Record<string, number>;
|
|
19
|
+
layout?: Layout;
|
|
20
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Direction, Layout } from './utils';
|
|
3
|
+
import { Details, Direction, Layout } from './utils';
|
|
4
4
|
interface WithFocusableConfig {
|
|
5
5
|
forgetLastFocusedChild?: boolean;
|
|
6
6
|
trackChildren?: boolean;
|
|
@@ -16,16 +16,14 @@ export interface WithFocusableProps {
|
|
|
16
16
|
trackChildren?: boolean;
|
|
17
17
|
autoRestoreFocus?: boolean;
|
|
18
18
|
blockNavigationOut?: boolean;
|
|
19
|
+
hasFocusedChild?: boolean;
|
|
19
20
|
focusable?: boolean;
|
|
20
|
-
onEnterPress?: (props: any, details:
|
|
21
|
-
pressedKeys: Record<string, number>;
|
|
22
|
-
}) => void;
|
|
21
|
+
onEnterPress?: (props: any, details: Details) => void;
|
|
23
22
|
onEnterRelease?: (props: any) => void;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onBecameBlurred?: (layout: Layout, props: any, details: any) => void;
|
|
23
|
+
onBackPress?: (props: any, details: Details) => void;
|
|
24
|
+
onArrowPress?: (direction: Direction, props: any, details: Details) => boolean | void;
|
|
25
|
+
onBecameFocused?: (layout: Layout, props: any, details: Details) => void;
|
|
26
|
+
onBecameBlurred?: (layout: Layout, props: any, details: Details) => void;
|
|
29
27
|
}
|
|
30
28
|
export interface WithFocusableState {
|
|
31
29
|
realFocusKey: string;
|
|
@@ -44,15 +42,12 @@ declare const withFocusable: <P extends object>({ forgetLastFocusedChild: config
|
|
|
44
42
|
stealFocus: () => void;
|
|
45
43
|
onUpdateFocus: (focused: boolean) => void;
|
|
46
44
|
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
47
|
-
onEnterPressHandler: (details:
|
|
48
|
-
pressedKeys: Record<string, number>;
|
|
49
|
-
}) => void;
|
|
45
|
+
onEnterPressHandler: (details: Details) => void;
|
|
50
46
|
onEnterReleaseHandler: () => void;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
onBecameBlurredHandler: (layout: Layout, details: any) => void;
|
|
47
|
+
onBackPressHandler: (details: Details) => void;
|
|
48
|
+
onArrowPressHandler: (direction: Direction, details: Details) => boolean | void;
|
|
49
|
+
onBecameFocusedHandler: (layout: Layout, details: Details) => void;
|
|
50
|
+
onBecameBlurredHandler: (layout: Layout, details: Details) => void;
|
|
56
51
|
componentDidMount(): void;
|
|
57
52
|
componentDidUpdate(): void;
|
|
58
53
|
componentWillUnmount(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import IMaestroManager, { SDKConfigParams } from './interfaces/IMaestroManager';
|
|
|
3
3
|
import IMaestroEvent from './interfaces/IMaestroEvent';
|
|
4
4
|
import { MaestroEventViewModel } from './view-models/MaestroEventViewModel';
|
|
5
5
|
import type IMaestroKeyPlaysResponse from './modules/key-plays/interfaces/IKeyPlaysResponse';
|
|
6
|
+
export { default as Overlay } from './components/molecules/Overlay/Overlay';
|
|
7
|
+
export { OverlayType, type IMaestroOverlayEvent, type IOverlaySize, type IOverlayPosition, type IFantasyPayload, type IOverlayAnalyticsEvent } from './types/OverlayTypes';
|
|
8
|
+
export { type IWinningBet } from './models/IWinningBet';
|
|
6
9
|
export { type IMaestroEventDelegate, type IMaestroEvent, type IMaestroKeyPlaysResponse, };
|
|
7
10
|
export type Environment = 'development' | 'staging' | 'production';
|
|
8
11
|
/**
|
|
@@ -13,19 +16,19 @@ declare class MaestroWebSDK implements IMaestroManager {
|
|
|
13
16
|
private static instance;
|
|
14
17
|
private renderer;
|
|
15
18
|
private siteID?;
|
|
16
|
-
private jwt?;
|
|
17
19
|
private userID?;
|
|
20
|
+
private maestroJwt?;
|
|
21
|
+
private clientAppToken?;
|
|
22
|
+
private clientAppSwid?;
|
|
18
23
|
private maestroEventViewModel;
|
|
19
24
|
private constructor();
|
|
20
|
-
userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate): Promise<IMaestroEvent>;
|
|
21
|
-
userDidStopWatchingEvent(eventId: string): void;
|
|
22
|
-
authenticateUser(_: string, __: string): Promise<void>;
|
|
23
|
-
deauthenticateUser(): Promise<void>;
|
|
24
25
|
/**
|
|
25
26
|
* @description Returns the MaestroWebSDK instance
|
|
26
27
|
* @returns {MaestroWebSDK} - The MaestroWebSDK instance
|
|
27
28
|
*/
|
|
28
29
|
static getInstance(): MaestroWebSDK;
|
|
30
|
+
userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate): Promise<IMaestroEvent>;
|
|
31
|
+
userDidStopWatchingEvent(_: string): void;
|
|
29
32
|
configure(configParams: SDKConfigParams): void;
|
|
30
33
|
/**
|
|
31
34
|
* Checks if this is an authorized client based on siteID
|
|
@@ -37,12 +40,6 @@ declare class MaestroWebSDK implements IMaestroManager {
|
|
|
37
40
|
*/
|
|
38
41
|
setSiteID(siteID?: string): void;
|
|
39
42
|
getSiteID(): string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Sets the JWT token for authentication
|
|
42
|
-
* @param jwt The JWT token to set
|
|
43
|
-
*/
|
|
44
|
-
setJwt(jwt: string): void;
|
|
45
|
-
getJwt(): string | undefined;
|
|
46
43
|
/**
|
|
47
44
|
* Sets the user ID for the SDK
|
|
48
45
|
* @param userID The user ID to set
|
|
@@ -54,7 +51,21 @@ declare class MaestroWebSDK implements IMaestroManager {
|
|
|
54
51
|
* @returns The current event view model
|
|
55
52
|
*/
|
|
56
53
|
getMaestroEventViewModel(): MaestroEventViewModel;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the view models container
|
|
56
|
+
* @returns The current view models
|
|
57
|
+
*/
|
|
58
|
+
getMaestroViewModels(): import("./view-models").MaestroViewModels | null;
|
|
57
59
|
renderPanel(id: string): Promise<() => void>;
|
|
60
|
+
setMaestroJwt(jwt: string | undefined): void;
|
|
61
|
+
setClientAppSwid(swid: string | undefined): void;
|
|
62
|
+
setClientAppToken(jwt: string | undefined): void;
|
|
63
|
+
authenticateUser(swid: string, token: string): Promise<void>;
|
|
64
|
+
deauthenticateUser(): Promise<void>;
|
|
65
|
+
getCurrentMaestroJwt(): string | undefined;
|
|
66
|
+
getClientAppToken(): string | undefined;
|
|
67
|
+
getCurrentUserID(): string | undefined;
|
|
68
|
+
getClientAppSwid(): string | undefined;
|
|
58
69
|
}
|
|
59
70
|
declare const SDK: MaestroWebSDK;
|
|
60
71
|
export default SDK;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MaestroPanelType } from '@/models/IPanel';
|
|
1
2
|
import IMaestroKeyPlaysResponse from '../modules/key-plays/interfaces/IKeyPlaysResponse';
|
|
2
3
|
/**
|
|
3
4
|
* This is the public API that the app can use to make calls to the SDK related to the currently-loaded event.
|
|
@@ -59,4 +60,12 @@ export default interface IMaestroEvent {
|
|
|
59
60
|
* @description Feeds the SDK new key plays data. A null value indicates a failure to retrieve the data.
|
|
60
61
|
*/
|
|
61
62
|
updateKeyPlaysData(data: IMaestroKeyPlaysResponse | null): Promise<void>;
|
|
63
|
+
simulateUseCase<T = any>(useCase: TestUseCase, panelType: MaestroPanelType, testData?: T): void;
|
|
62
64
|
}
|
|
65
|
+
declare const TEST_USE_CASES: {
|
|
66
|
+
readonly betsTabLoadFailure: "betsTabLoadFailure";
|
|
67
|
+
readonly betsMockData: "betsMockData";
|
|
68
|
+
readonly betsLiveData: "betsLiveData";
|
|
69
|
+
};
|
|
70
|
+
export type TestUseCase = typeof TEST_USE_CASES[keyof typeof TEST_USE_CASES];
|
|
71
|
+
export {};
|
|
@@ -15,4 +15,21 @@ export default interface IMaestroEventDelegate {
|
|
|
15
15
|
* @description SDK can notify the client app when its time to handle the focus management
|
|
16
16
|
*/
|
|
17
17
|
startFocusManagement(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* @description Check if the user is authenticated for betting
|
|
20
|
+
*/
|
|
21
|
+
userIsAuthenticated(): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* @description Get the user's SWID for authenticated betting requests
|
|
24
|
+
*/
|
|
25
|
+
getUserSWID(): Promise<string | null>;
|
|
26
|
+
/**
|
|
27
|
+
* @description Get the user's Cookie token for authenticated betting requests
|
|
28
|
+
*/
|
|
29
|
+
getUserToken(): Promise<string | null>;
|
|
30
|
+
/**
|
|
31
|
+
* @description Get the API endpoint for betting-related requests.
|
|
32
|
+
* This endpoint is used to fetch betting data, such as odds and betting lines.
|
|
33
|
+
*/
|
|
34
|
+
getBettingAPIBaseURL(): string;
|
|
18
35
|
}
|
|
@@ -17,14 +17,22 @@ export type SDKConfigParams = {
|
|
|
17
17
|
* The site ID to use for the SDK.
|
|
18
18
|
*/
|
|
19
19
|
siteID?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The JWT token to use for authentication.
|
|
22
|
-
*/
|
|
23
|
-
jwt?: string;
|
|
24
20
|
/**
|
|
25
21
|
* The user ID of the logged account.
|
|
26
22
|
*/
|
|
27
23
|
userID?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The Maestro JWT token for authentication.
|
|
26
|
+
*/
|
|
27
|
+
maestroJwt?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The client app Cookie Token for authentication.
|
|
30
|
+
*/
|
|
31
|
+
clientAppToken?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The client app SWID for authentication.
|
|
34
|
+
*/
|
|
35
|
+
clientAppSwid?: string;
|
|
28
36
|
};
|
|
29
37
|
/**
|
|
30
38
|
This is the MaestroKit top-level API for initializing and configuring the framework. It encompasses all functionality that is not specific to an event.
|
|
@@ -42,12 +50,12 @@ export default interface IMaestroManager {
|
|
|
42
50
|
*/
|
|
43
51
|
configure(configParams: SDKConfigParams): void;
|
|
44
52
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
Tells the SDK the user has opened an event in the app's player.
|
|
54
|
+
Arguments:
|
|
55
|
+
- eventID: The Event ID for the event opened in the player.
|
|
56
|
+
- delegate: an instance of the app's implementation of IMaestroEventDelegate
|
|
57
|
+
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
|
+
*/
|
|
51
59
|
userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate): Promise<IMaestroEvent>;
|
|
52
60
|
/**
|
|
53
61
|
* @description Tells the SDK the user has closed an event that was open in the app's player.
|
|
@@ -55,11 +63,11 @@ export default interface IMaestroManager {
|
|
|
55
63
|
*/
|
|
56
64
|
userDidStopWatchingEvent(eventID: string): void;
|
|
57
65
|
/**
|
|
58
|
-
* @description Authenticates user.
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
66
|
+
* @description Authenticates user with SWID and Token.
|
|
67
|
+
* @param swid - The user's SWID.
|
|
68
|
+
* @param token - The user's Cookie Token.
|
|
61
69
|
*/
|
|
62
|
-
authenticateUser(
|
|
70
|
+
authenticateUser(swid: string, token: string): Promise<void>;
|
|
63
71
|
/**
|
|
64
72
|
* Logs out currently-authenticated user.
|
|
65
73
|
*/
|
|
@@ -70,13 +78,18 @@ export default interface IMaestroManager {
|
|
|
70
78
|
*/
|
|
71
79
|
getSiteID(): string | undefined;
|
|
72
80
|
/**
|
|
73
|
-
* Gets the JWT token
|
|
74
|
-
* @returns The JWT token
|
|
81
|
+
* Gets the current JWT token used in conjunction with the user's SWID.
|
|
82
|
+
* @returns The current JWT token
|
|
83
|
+
*/
|
|
84
|
+
getClientAppToken(): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the current user ID.
|
|
87
|
+
* @returns The current user ID
|
|
75
88
|
*/
|
|
76
|
-
|
|
89
|
+
getCurrentUserID(): string | undefined;
|
|
77
90
|
/**
|
|
78
|
-
* Gets the
|
|
79
|
-
* @returns The
|
|
91
|
+
* Gets the current SWID.
|
|
92
|
+
* @returns The current SWID
|
|
80
93
|
*/
|
|
81
|
-
|
|
94
|
+
getClientAppSwid(): string | undefined;
|
|
82
95
|
}
|