@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.
- package/dist/MaestroEventDelegate.d.ts +3 -0
- package/dist/components/core/PanelManager/PanelManager.d.ts +3 -0
- package/dist/components/organisms/SegmentController/SegmentController.d.ts +1 -0
- package/dist/external/AxiosNetworkClient.d.ts +1 -1
- package/dist/external/ports/networkClient.d.ts +1 -1
- package/dist/helpers/url.d.ts +1 -0
- package/dist/index.d.ts +12 -2
- package/dist/interfaces/IMaestroEvent.d.ts +13 -0
- package/dist/interfaces/IMaestroEventDelegate.d.ts +11 -0
- package/dist/interfaces/IMaestroManager.d.ts +10 -2
- package/dist/interfaces/IUserSettings.d.ts +36 -0
- package/dist/maestro-web-sdk.umd.js +3 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/modules/bets/types/BetsAnalyticsTypes.d.ts +25 -0
- package/dist/modules/bets/view/BetsView.d.ts +4 -0
- package/dist/modules/bets/view/SixPack/SixPackView.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Boost/Boost.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Straight/Straight.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/UserBetsView.d.ts +0 -1
- package/dist/modules/bets/view/components/Bet/Bet.d.ts +7 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +1 -0
- package/dist/modules/bets/view-model/BetsViewModel.d.ts +33 -0
- package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +1 -0
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.d.ts +6 -6
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +4 -1
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.d.ts +2 -0
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.d.ts +9 -1
- package/dist/modules/stats/interfaces/IStats.d.ts +1 -1
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +1 -0
- package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +1 -1
- package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +1 -1
- package/dist/modules/stats/view/DriveSummary/DriveSummary.d.ts +1 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +1 -0
- package/dist/modules/stats/view/StatsItemView.d.ts +2 -0
- package/dist/modules/stats/view/StatsView.d.ts +1 -0
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +6 -2
- package/dist/services/AnalyticsService/AnalyticsService.d.ts +65 -0
- package/dist/services/AnalyticsService/types.d.ts +65 -0
- package/dist/services/BetsService.d.ts +2 -2
- package/dist/services/InsightsService/InsightsPayloadBuilder.d.ts +278 -0
- package/dist/services/InsightsService/InsightsService.d.ts +10 -0
- package/dist/services/NetworkManager/NetworkManager.d.ts +3 -20
- package/dist/services/NetworkManager/NetworkManagerFactory.d.ts +42 -0
- package/dist/services/NetworkManager/types.d.ts +73 -0
- package/dist/services/StatsService.d.ts +2 -2
- package/dist/services/UserSettingsManager.d.ts +63 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +5 -0
- package/dist/view-models/PanelManagerViewModel.d.ts +24 -0
- package/dist/view-models/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { ICacheManager } from '@/external/ports/cacheManager';
|
|
2
|
+
import InsightsService from './InsightsService';
|
|
3
|
+
type EventData = {
|
|
4
|
+
url?: string;
|
|
5
|
+
metadata?: Record<string, unknown>;
|
|
6
|
+
ontology: {
|
|
7
|
+
kingdom: string;
|
|
8
|
+
phylum: string;
|
|
9
|
+
class: string;
|
|
10
|
+
order?: string;
|
|
11
|
+
family: string;
|
|
12
|
+
genus?: string;
|
|
13
|
+
species?: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default class InsightsPayloadBuilder {
|
|
17
|
+
currentTime: number;
|
|
18
|
+
serverOffsetTime: number;
|
|
19
|
+
insightsService: InsightsService;
|
|
20
|
+
cacheManager: ICacheManager;
|
|
21
|
+
constructor();
|
|
22
|
+
getPayload(event: EventData): Promise<{
|
|
23
|
+
/**
|
|
24
|
+
* @description Event Domain. NAMESPACE env var.
|
|
25
|
+
* @example maestro
|
|
26
|
+
*/
|
|
27
|
+
e_d: string;
|
|
28
|
+
/**
|
|
29
|
+
* @description Event stringified metadata. defaults to null.
|
|
30
|
+
* @example "{\"key\":\"value\"}"
|
|
31
|
+
*/
|
|
32
|
+
e_m: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* @description Event time accounting for offset.
|
|
35
|
+
*/
|
|
36
|
+
e_t: number;
|
|
37
|
+
/**
|
|
38
|
+
* @description Event URL. defaults to undefined.
|
|
39
|
+
*/
|
|
40
|
+
e_u: string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @description Event ontology kingdom. This is the highest level of the ontology and can be used to identify the event type.
|
|
43
|
+
* @example 'panel', 'engage', 'espn_key_plays'
|
|
44
|
+
*/
|
|
45
|
+
e0: string;
|
|
46
|
+
/**
|
|
47
|
+
* @description Event phylum.
|
|
48
|
+
* @example 'view', 'click', 'play clip'
|
|
49
|
+
*/
|
|
50
|
+
e1: string;
|
|
51
|
+
/**
|
|
52
|
+
* @description Event class.
|
|
53
|
+
* @example 'panel_type'
|
|
54
|
+
*/
|
|
55
|
+
e2: string;
|
|
56
|
+
/**
|
|
57
|
+
* @description Event order.
|
|
58
|
+
* @example 'panel_id'
|
|
59
|
+
*/
|
|
60
|
+
e3: string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* @description Event family.
|
|
63
|
+
* @example 'panel_name'
|
|
64
|
+
*/
|
|
65
|
+
e4: string;
|
|
66
|
+
/**
|
|
67
|
+
* @description Event genus. This is a more specific level of the ontology and can be used to identify the event type.
|
|
68
|
+
*/
|
|
69
|
+
e5: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* @description Event species. This is the most specific level of the ontology and can be used to identify the event type.
|
|
72
|
+
*/
|
|
73
|
+
e6: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* @description Current timestamp.
|
|
76
|
+
*/
|
|
77
|
+
t: number;
|
|
78
|
+
/**
|
|
79
|
+
* @description User avatar URL. Stored in user profile. defaults to null
|
|
80
|
+
* @example GET 'https://api.maestro.io/userprofile/v1'
|
|
81
|
+
*/
|
|
82
|
+
u_a: null;
|
|
83
|
+
/**
|
|
84
|
+
* @description User account created date in milliseconds since epoch. defaults to null
|
|
85
|
+
* @example account.created
|
|
86
|
+
*/
|
|
87
|
+
u_c: null;
|
|
88
|
+
/**
|
|
89
|
+
* @description Logged User email. defaults to null
|
|
90
|
+
* @example account.email
|
|
91
|
+
*/
|
|
92
|
+
u_e: null;
|
|
93
|
+
/**
|
|
94
|
+
* @description Logged User ID. defaults to null
|
|
95
|
+
* @example account._id
|
|
96
|
+
*/
|
|
97
|
+
u_id: null;
|
|
98
|
+
/**
|
|
99
|
+
* @description Logged User is logged in or not. defaults to false
|
|
100
|
+
*/
|
|
101
|
+
u_li: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* @description Logged User name. defaults to null
|
|
104
|
+
* @example account.name
|
|
105
|
+
*/
|
|
106
|
+
u_n: null;
|
|
107
|
+
/**
|
|
108
|
+
* @description Logged User new user or not. Usually we compare server time and account.created. If it was created less than 1 day ago it's a new user. defaults to false
|
|
109
|
+
* @example Math.abs((serverTime || Date.now()) - account.created) < msIn.day
|
|
110
|
+
*/
|
|
111
|
+
u_nu: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* @description Logged User service. defaults to null
|
|
114
|
+
* @example account.service
|
|
115
|
+
*/
|
|
116
|
+
u_s: null;
|
|
117
|
+
/**
|
|
118
|
+
* @description Logged User UID. defaults to null
|
|
119
|
+
* @example account.uid
|
|
120
|
+
*/
|
|
121
|
+
u_u: null;
|
|
122
|
+
/**
|
|
123
|
+
* @description Logged User name. defaults to null
|
|
124
|
+
* @example account.name
|
|
125
|
+
*/
|
|
126
|
+
u_un: null;
|
|
127
|
+
/**
|
|
128
|
+
* @description Site domain.
|
|
129
|
+
* @example site.settings.domain.url. 'maestro.tv/site_slug'
|
|
130
|
+
*/
|
|
131
|
+
si_d: string;
|
|
132
|
+
/**
|
|
133
|
+
* @description Site ID.
|
|
134
|
+
* @example site._id
|
|
135
|
+
*/
|
|
136
|
+
si_id: string;
|
|
137
|
+
/**
|
|
138
|
+
* @description Site package ID.
|
|
139
|
+
* @example `${site.package.id}-sapphire`
|
|
140
|
+
*/
|
|
141
|
+
si_pid: string;
|
|
142
|
+
/**
|
|
143
|
+
* @description Site package version.
|
|
144
|
+
* @example `${site.package.version}-sapphire`
|
|
145
|
+
*/
|
|
146
|
+
si_pv: string;
|
|
147
|
+
/**
|
|
148
|
+
* @description Site slug.
|
|
149
|
+
* @example site.slug
|
|
150
|
+
*/
|
|
151
|
+
si_s: string;
|
|
152
|
+
/**
|
|
153
|
+
* @description Session ID, which can be used to track the session across requests. You might wanna keep this fixed for the session you're in using a local storage or something related.
|
|
154
|
+
*/
|
|
155
|
+
se_id: string;
|
|
156
|
+
/**
|
|
157
|
+
* @description Session created timestamp. Usually set when the first event is fired
|
|
158
|
+
* @example new Date().getTime()
|
|
159
|
+
*/
|
|
160
|
+
se_s: number;
|
|
161
|
+
/**
|
|
162
|
+
* @description Referrer domain, which can be used to track the domain from which the user came. Defaults to "$direct"
|
|
163
|
+
* @example 'example.com'.
|
|
164
|
+
*/
|
|
165
|
+
r_d: string;
|
|
166
|
+
/**
|
|
167
|
+
* @description Referrer source, which can be used to track the source from which the user came (queryParam.r). Defaults to null
|
|
168
|
+
* @example const urlParams = new URLSearchParams(window.location.search);
|
|
169
|
+
* urlParams.get('r') || null
|
|
170
|
+
*/
|
|
171
|
+
r_s: null;
|
|
172
|
+
/**
|
|
173
|
+
* @description Referrer URL, which can be used to track the full URL from which the user came. Defaults to "$direct"
|
|
174
|
+
* @example document.referrer
|
|
175
|
+
*/
|
|
176
|
+
r_u: string;
|
|
177
|
+
/**
|
|
178
|
+
* @description Metadata version, used to track changes in the metadata structure.
|
|
179
|
+
* @example '1.00.0'
|
|
180
|
+
*/
|
|
181
|
+
m_iv: string;
|
|
182
|
+
/**
|
|
183
|
+
* @description Unique identifier for the insights ID. Stored in site's document.
|
|
184
|
+
* @example site.settings.services.insights_id
|
|
185
|
+
*/
|
|
186
|
+
i_id: string;
|
|
187
|
+
/**
|
|
188
|
+
* @description Device created timestamp. You might wanna keep this fixed for the device you're in using a local storage or something related
|
|
189
|
+
* @example new Date().getTime()
|
|
190
|
+
*/
|
|
191
|
+
d_ct: number;
|
|
192
|
+
/**
|
|
193
|
+
* @description New device or not. If you want to keep track of new devices, you can use a local storage or something related
|
|
194
|
+
* @example localStorage.getItem('isNewDevice') === 'true'
|
|
195
|
+
*/
|
|
196
|
+
d_nd: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* @description Navigator Platform (more Web API specific).
|
|
199
|
+
* @example 'MacIntel', 'Win32', 'Linux x86_64'
|
|
200
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform
|
|
201
|
+
*/
|
|
202
|
+
d_np: string;
|
|
203
|
+
/**
|
|
204
|
+
* @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.
|
|
205
|
+
* @example localStorage.getItem('devicePermanentId') || generateUniqueId()
|
|
206
|
+
*/
|
|
207
|
+
d_pid: any;
|
|
208
|
+
/**
|
|
209
|
+
* @description Device screen height in pixels.
|
|
210
|
+
* @example window.screen.height
|
|
211
|
+
*/
|
|
212
|
+
d_sh: number;
|
|
213
|
+
/**
|
|
214
|
+
* @description Device screen width in pixels.
|
|
215
|
+
* @example window.screen.width
|
|
216
|
+
*/
|
|
217
|
+
d_sw: number;
|
|
218
|
+
/**
|
|
219
|
+
* @description Device tab ID, which can be used to track the device across tabs.
|
|
220
|
+
*/
|
|
221
|
+
d_tid: string;
|
|
222
|
+
/**
|
|
223
|
+
* @description Device time in milliseconds since epoch.
|
|
224
|
+
*/
|
|
225
|
+
d_tim: number;
|
|
226
|
+
/**
|
|
227
|
+
* @description Device time offset in milliseconds. You might wanna keep this fixed for the device you're in using a local storage or something related.
|
|
228
|
+
*/
|
|
229
|
+
d_tof: number;
|
|
230
|
+
/**
|
|
231
|
+
* @description Device user agent string.
|
|
232
|
+
* @example navigator.userAgent ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3')
|
|
233
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
|
|
234
|
+
*/
|
|
235
|
+
d_ua: string;
|
|
236
|
+
/**
|
|
237
|
+
* @description MongoDB page collection name (e.g. 'pages')
|
|
238
|
+
* @example object.collection
|
|
239
|
+
*/
|
|
240
|
+
p_c: string;
|
|
241
|
+
/**
|
|
242
|
+
* @description MongoDB page document ID (e.g. 'pageId')
|
|
243
|
+
* @example object._id
|
|
244
|
+
*/
|
|
245
|
+
p_id: string;
|
|
246
|
+
/**
|
|
247
|
+
* @description MongoDB page name (e.g. 'Home', 'Product Page')
|
|
248
|
+
* @example object.data.name || object.seo.title
|
|
249
|
+
*/
|
|
250
|
+
p_n: string;
|
|
251
|
+
/**
|
|
252
|
+
* @description MongoDB page slug (e.g. 'home', 'product-page')
|
|
253
|
+
* @example object.slug
|
|
254
|
+
*/
|
|
255
|
+
p_s: string;
|
|
256
|
+
/**
|
|
257
|
+
* @description MongoDB page type (e.g. 'landing', 'channel')
|
|
258
|
+
* @example object.type
|
|
259
|
+
*/
|
|
260
|
+
p_t: string;
|
|
261
|
+
}>;
|
|
262
|
+
private getEventInsights;
|
|
263
|
+
private getPageInsights;
|
|
264
|
+
private getDevicePermanentID;
|
|
265
|
+
private getDeviceCreated;
|
|
266
|
+
private getTabID;
|
|
267
|
+
private getDeviceInsights;
|
|
268
|
+
private randomId;
|
|
269
|
+
private getDeviceOffset;
|
|
270
|
+
private getInsightsInsights;
|
|
271
|
+
private getMetadataInsights;
|
|
272
|
+
private getReferrerInsights;
|
|
273
|
+
private getSessionID;
|
|
274
|
+
private getSessionInsights;
|
|
275
|
+
private getSiteInsights;
|
|
276
|
+
private getUserInsights;
|
|
277
|
+
}
|
|
278
|
+
export {};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import { Environment } from '@/index';
|
|
1
2
|
import { ICacheManager } from '../../external/ports/cacheManager';
|
|
2
3
|
import { INetworkClient } from '../../external/ports/networkClient';
|
|
3
|
-
export declare const
|
|
4
|
-
readonly DEVELOPMENT: "development";
|
|
5
|
-
readonly STAGING: "staging";
|
|
6
|
-
readonly PRODUCTION: "production";
|
|
7
|
-
};
|
|
8
|
-
export type WorkingEnvironment = typeof WorkingEnvironment[keyof typeof WorkingEnvironment];
|
|
9
|
-
export declare const MAESTRO_BASE_URLS: Record<WorkingEnvironment, string>;
|
|
4
|
+
export declare const MAESTRO_BASE_URLS: Record<Environment, string>;
|
|
10
5
|
export declare const SDK_FLAVOR = "MaestroKit_Web";
|
|
11
6
|
export declare const ENDPOINTS: {
|
|
12
7
|
CAN_I_PLAY: string;
|
|
@@ -22,7 +17,6 @@ export declare const HttpMethod: {
|
|
|
22
17
|
};
|
|
23
18
|
export type HttpMethod = typeof HttpMethod[keyof typeof HttpMethod];
|
|
24
19
|
export interface NetworkManagerOptions {
|
|
25
|
-
environment?: WorkingEnvironment;
|
|
26
20
|
networkClient?: INetworkClient;
|
|
27
21
|
externalNetworkClient?: INetworkClient;
|
|
28
22
|
externalBaseURL?: string;
|
|
@@ -30,23 +24,12 @@ export interface NetworkManagerOptions {
|
|
|
30
24
|
defaultCacheDuration?: number;
|
|
31
25
|
}
|
|
32
26
|
declare class NetworkManager {
|
|
33
|
-
private static instance;
|
|
34
27
|
private cacheManager;
|
|
35
28
|
private maestroClient;
|
|
36
29
|
private externalClient;
|
|
37
|
-
private environment;
|
|
38
30
|
private pollingTasks;
|
|
39
31
|
private localStorage;
|
|
40
|
-
|
|
41
|
-
static getInstance(options?: NetworkManagerOptions, localStorageOverride?: Storage): NetworkManager;
|
|
42
|
-
/**
|
|
43
|
-
* Sets the working environment (development, staging, production)
|
|
44
|
-
*/
|
|
45
|
-
setEnvironment(environment: WorkingEnvironment): void;
|
|
46
|
-
/**
|
|
47
|
-
* Get current environment
|
|
48
|
-
*/
|
|
49
|
-
getEnvironment(): WorkingEnvironment;
|
|
32
|
+
constructor(options?: NetworkManagerOptions, localStorageOverride?: Storage);
|
|
50
33
|
/**
|
|
51
34
|
* Set authentication for Maestro APIs
|
|
52
35
|
*/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import NetworkManager, { NetworkManagerOptions } from './NetworkManager';
|
|
2
|
+
import { ServiceType, ServiceNetworkManagerConfig, IStatsNetworkManager, IBetsNetworkManager, IMaestroNetworkManager, NetworkManagerFactoryConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Service-specific NetworkManager that includes metadata about its service type
|
|
5
|
+
*/
|
|
6
|
+
declare class ServiceNetworkManager extends NetworkManager {
|
|
7
|
+
readonly serviceType: ServiceType;
|
|
8
|
+
readonly externalBaseURL: string;
|
|
9
|
+
constructor(serviceType: ServiceType, externalBaseURL: string, options?: NetworkManagerOptions, localStorageOverride?: Storage);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Factory for creating service-specific NetworkManager instances
|
|
13
|
+
* This replaces the singleton pattern with a factory pattern
|
|
14
|
+
*/
|
|
15
|
+
export declare class NetworkManagerFactory {
|
|
16
|
+
private static defaultConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Configure factory defaults
|
|
19
|
+
*/
|
|
20
|
+
static configure(config: NetworkManagerFactoryConfig): void;
|
|
21
|
+
/**
|
|
22
|
+
* Create a Stats service NetworkManager
|
|
23
|
+
*/
|
|
24
|
+
static createStatsNetworkManager(externalBaseURL: string, options?: Partial<NetworkManagerOptions>): IStatsNetworkManager;
|
|
25
|
+
/**
|
|
26
|
+
* Create a Bets service NetworkManager
|
|
27
|
+
*/
|
|
28
|
+
static createBetsNetworkManager(externalBaseURL: string, options?: Partial<NetworkManagerOptions>): IBetsNetworkManager;
|
|
29
|
+
/**
|
|
30
|
+
* Create a Maestro service NetworkManager
|
|
31
|
+
*/
|
|
32
|
+
static createMaestroNetworkManager(options?: Partial<NetworkManagerOptions>): IMaestroNetworkManager;
|
|
33
|
+
/**
|
|
34
|
+
* Create a NetworkManager for any service type
|
|
35
|
+
*/
|
|
36
|
+
static createForService(config: ServiceNetworkManagerConfig, options?: Partial<NetworkManagerOptions>): ServiceNetworkManager;
|
|
37
|
+
/**
|
|
38
|
+
* Reset factory to defaults (useful for testing)
|
|
39
|
+
*/
|
|
40
|
+
static reset(): void;
|
|
41
|
+
}
|
|
42
|
+
export default NetworkManagerFactory;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service types for different NetworkManager contexts
|
|
3
|
+
*/
|
|
4
|
+
export declare const ServiceType: {
|
|
5
|
+
readonly STATS: "stats";
|
|
6
|
+
readonly BETS: "bets";
|
|
7
|
+
readonly MAESTRO: "maestro";
|
|
8
|
+
};
|
|
9
|
+
export type ServiceType = typeof ServiceType[keyof typeof ServiceType];
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for creating service-specific NetworkManager instances
|
|
12
|
+
*/
|
|
13
|
+
export interface ServiceNetworkManagerConfig {
|
|
14
|
+
serviceType: ServiceType;
|
|
15
|
+
externalBaseURL: string;
|
|
16
|
+
defaultCacheDuration?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Base interface for all NetworkManager instances
|
|
20
|
+
*/
|
|
21
|
+
export interface IServiceNetworkManager {
|
|
22
|
+
readonly serviceType: ServiceType;
|
|
23
|
+
readonly externalBaseURL: string;
|
|
24
|
+
externalApiRequest<T = any>(options: {
|
|
25
|
+
endpoint: string;
|
|
26
|
+
method?: string;
|
|
27
|
+
params?: Record<string, any>;
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
|
+
data?: any;
|
|
30
|
+
useCache?: boolean;
|
|
31
|
+
skipResponseBodyDeserialization?: boolean;
|
|
32
|
+
}): Promise<T>;
|
|
33
|
+
pollExternalApiRequest<T = any>(options: {
|
|
34
|
+
endpoint: string;
|
|
35
|
+
interval: number;
|
|
36
|
+
method?: string;
|
|
37
|
+
params?: Record<string, any>;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
data?: any;
|
|
40
|
+
onData: (data: T) => void;
|
|
41
|
+
onError?: (error: Error) => void;
|
|
42
|
+
}): {
|
|
43
|
+
stop: () => void;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Stats service NetworkManager interface
|
|
48
|
+
*/
|
|
49
|
+
export interface IStatsNetworkManager extends IServiceNetworkManager {
|
|
50
|
+
serviceType: 'stats';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Bets service NetworkManager interface
|
|
54
|
+
*/
|
|
55
|
+
export interface IBetsNetworkManager extends IServiceNetworkManager {
|
|
56
|
+
serviceType: 'bets';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Maestro service NetworkManager interface
|
|
60
|
+
*/
|
|
61
|
+
export interface IMaestroNetworkManager extends IServiceNetworkManager {
|
|
62
|
+
serviceType: 'maestro';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Union type for all service NetworkManager types
|
|
66
|
+
*/
|
|
67
|
+
export type ServiceNetworkManager = IStatsNetworkManager | IBetsNetworkManager | IMaestroNetworkManager;
|
|
68
|
+
/**
|
|
69
|
+
* Factory configuration for different service types
|
|
70
|
+
*/
|
|
71
|
+
export interface NetworkManagerFactoryConfig {
|
|
72
|
+
defaultCacheDuration?: number;
|
|
73
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IStatsNetworkManager } from './NetworkManager/types';
|
|
2
2
|
import { StatsApiResponse } from '../modules/stats/interfaces/IStats';
|
|
3
3
|
import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
|
|
4
4
|
/**
|
|
5
5
|
* Service for handling stats-related API calls
|
|
6
6
|
*/
|
|
7
7
|
declare class StatsService {
|
|
8
|
-
networkManager:
|
|
8
|
+
networkManager: IStatsNetworkManager;
|
|
9
9
|
constructor(delegate: IMaestroEventDelegate);
|
|
10
10
|
/**
|
|
11
11
|
* Get stats for an event
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Observable } from '@/helpers/Observable';
|
|
2
|
+
import { IUserSettings, PanelSettings } from '@/interfaces/IUserSettings';
|
|
3
|
+
import { MaestroPanelType } from '@/models/IPanel';
|
|
4
|
+
/**
|
|
5
|
+
* UserSettingsManager - Singleton service for managing user settings
|
|
6
|
+
* Uses Observable pattern for reactive updates across the SDK
|
|
7
|
+
*/
|
|
8
|
+
export declare class UserSettingsManager {
|
|
9
|
+
private static instance;
|
|
10
|
+
private _settings;
|
|
11
|
+
private constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Get the singleton instance of UserSettingsManager
|
|
14
|
+
*/
|
|
15
|
+
static getInstance(): UserSettingsManager;
|
|
16
|
+
/**
|
|
17
|
+
* Get the current settings as an Observable
|
|
18
|
+
*/
|
|
19
|
+
get settings(): Observable<IUserSettings>;
|
|
20
|
+
/**
|
|
21
|
+
* Get the current settings value (snapshot)
|
|
22
|
+
*/
|
|
23
|
+
getCurrentSettings(): IUserSettings;
|
|
24
|
+
/**
|
|
25
|
+
* Update user settings with validation and merge logic
|
|
26
|
+
* @param userSettings - New settings to apply
|
|
27
|
+
*/
|
|
28
|
+
updateSettings(userSettings: IUserSettings): void;
|
|
29
|
+
/**
|
|
30
|
+
* Get settings for a specific panel type
|
|
31
|
+
* @param panelType - Panel type to get settings for
|
|
32
|
+
*/
|
|
33
|
+
getPanelSettings<T extends keyof NonNullable<IUserSettings['panels']>>(panelType: T): PanelSettings<T> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a panel should be hidden
|
|
36
|
+
* @param panelType - Panel type to check
|
|
37
|
+
*/
|
|
38
|
+
isPanelHidden(panelType: MaestroPanelType): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Check if wagers should be hidden for betting panel
|
|
41
|
+
*/
|
|
42
|
+
shouldHideWagers(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Reset settings to defaults
|
|
45
|
+
*/
|
|
46
|
+
resetToDefaults(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Validate settings structure and values
|
|
49
|
+
* @param settings - Settings to validate
|
|
50
|
+
*/
|
|
51
|
+
private validateSettings;
|
|
52
|
+
/**
|
|
53
|
+
* Merge user settings with current settings (deep merge)
|
|
54
|
+
* @param currentSettings - Current settings
|
|
55
|
+
* @param userSettings - New settings to merge
|
|
56
|
+
*/
|
|
57
|
+
private mergeSettings;
|
|
58
|
+
/**
|
|
59
|
+
* Map MaestroPanelType to settings key
|
|
60
|
+
* @param panelType - Panel type from MaestroPanelType enum
|
|
61
|
+
*/
|
|
62
|
+
private mapPanelTypeToSettingsKey;
|
|
63
|
+
}
|
|
@@ -8,19 +8,24 @@ import SpatialNavigation from '@/external/spatial-navigation/spatialNavigation';
|
|
|
8
8
|
import StatsViewModel from '../modules/stats/view-model/StatsViewModel';
|
|
9
9
|
import IMaestroKeyPlaysResponse from '../modules/key-plays/interfaces/IKeyPlaysResponse';
|
|
10
10
|
import { MaestroPanelType } from '@/models/IPanel';
|
|
11
|
+
import { IUserSettings } from '../interfaces/IUserSettings';
|
|
11
12
|
export declare class MaestroEventViewModel extends ViewModel implements IMaestroEvent {
|
|
12
13
|
private _eventId;
|
|
13
14
|
private _title;
|
|
14
15
|
private _isLive;
|
|
15
16
|
private _isShowingPanel;
|
|
17
|
+
private playerTimeCode;
|
|
16
18
|
delegate: IMaestroEventDelegate;
|
|
17
19
|
keyPlaysViewModel: KeyPlaysViewModel;
|
|
18
20
|
betsViewModel: BetsViewModel;
|
|
19
21
|
statsViewModel: StatsViewModel;
|
|
20
22
|
navigation: SpatialNavigation;
|
|
21
23
|
constructor(eventId: string | undefined, delegate: IMaestroEventDelegate);
|
|
24
|
+
updatePlayerTimeCode(timestamp: number): void;
|
|
25
|
+
getPlayerTimeCode(): number | null;
|
|
22
26
|
deinit(): void;
|
|
23
27
|
updateKeyPlaysData(data: IMaestroKeyPlaysResponse | null): Promise<void>;
|
|
28
|
+
updateUserSettings(settings: IUserSettings): Promise<void>;
|
|
24
29
|
startFocusManagement(): Promise<void>;
|
|
25
30
|
didStartPlayingClip(index: number): void;
|
|
26
31
|
didStopPlayingClip(index: number): void;
|
|
@@ -4,6 +4,30 @@ export declare class PanelManagerViewModel {
|
|
|
4
4
|
private _panels;
|
|
5
5
|
private _currentPanel;
|
|
6
6
|
private _newlyFocusedPanel;
|
|
7
|
+
private settingsManager;
|
|
8
|
+
private settingsUnsubscribe;
|
|
9
|
+
private readonly ALL_PANELS;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Initialize panels based on current settings
|
|
13
|
+
*/
|
|
14
|
+
private initializePanels;
|
|
15
|
+
/**
|
|
16
|
+
* Subscribe to settings changes to update panels dynamically
|
|
17
|
+
*/
|
|
18
|
+
private subscribeToSettingsChanges;
|
|
19
|
+
/**
|
|
20
|
+
* Filter panels based on user settings
|
|
21
|
+
*/
|
|
22
|
+
private filterPanelsBasedOnSettings;
|
|
23
|
+
/**
|
|
24
|
+
* Update panels when settings change
|
|
25
|
+
*/
|
|
26
|
+
private updatePanelsBasedOnSettings;
|
|
27
|
+
/**
|
|
28
|
+
* Cleanup subscriptions
|
|
29
|
+
*/
|
|
30
|
+
cleanup(): void;
|
|
7
31
|
get panels(): MaestroPanelType[];
|
|
8
32
|
get panelsObservable(): Observable<MaestroPanelType[]>;
|
|
9
33
|
get currentPanel(): MaestroPanelType;
|
|
@@ -12,6 +12,10 @@ export declare class MaestroViewModels {
|
|
|
12
12
|
readonly keyPlaysViewModel: KeyPlaysViewModel;
|
|
13
13
|
readonly overlayViewModel: OverlayViewModel;
|
|
14
14
|
constructor(eventViewModel: MaestroEventViewModel);
|
|
15
|
+
/**
|
|
16
|
+
* Cleanup all view models
|
|
17
|
+
*/
|
|
18
|
+
cleanup(): void;
|
|
15
19
|
/**
|
|
16
20
|
* Creates view models from an event ID
|
|
17
21
|
*/
|