@maestro_io/maestro-web-sdk 2.2.9 → 2.3.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.
@@ -170,7 +170,7 @@ export interface IPersonalizedBetsResponse extends IBetsResponse {
170
170
  live: IUserBet[];
171
171
  settled: IUserBet[];
172
172
  };
173
- promos?: {
173
+ promotion?: {
174
174
  /** "FIRST BET RESET" */
175
175
  title: string;
176
176
  /** Promo description */
@@ -179,6 +179,7 @@ export interface IPersonalizedBetsResponse extends IBetsResponse {
179
179
  logo: string;
180
180
  /** URL to QR code */
181
181
  qrCode: string;
182
+ backgroundImage: string;
182
183
  };
183
184
  disclaimers?: {
184
185
  /** Location-specific disclaimer */
@@ -1,15 +1,8 @@
1
1
  import React from 'react';
2
2
  import './PromoCodeBanner.styles.css';
3
- import { WithFocusableProps } from '@/external/spatial-navigation';
4
3
  import { Direction, Layout } from '@/external/spatial-navigation/utils';
5
- export interface PromoCodeBannerProps extends WithFocusableProps {
6
- title: string;
7
- description: string;
8
- logo: string;
9
- qrCode: string;
10
- showLogo?: boolean;
11
- }
12
- export default class FocusablePromoCodeBannerWrapper extends React.Component<PromoCodeBannerProps> {
4
+ import { IBetPromo } from '@/modules/bets/view-model/BetsViewModel';
5
+ export default class FocusablePromoCodeBannerWrapper extends React.Component<IBetPromo> {
13
6
  static contextTypes: {
14
7
  refsMap: React.Requireable<any>;
15
8
  setRef: React.Requireable<any>;
@@ -1,2 +1 @@
1
1
  export { default as BetItemPromoCode } from './PromoCodeBanner';
2
- export { PromoCodeBannerProps } from './PromoCodeBanner';
@@ -51,6 +51,7 @@ export type IBetPromo = {
51
51
  description: string;
52
52
  logo: string;
53
53
  qrCode: string;
54
+ backgroundImage: string;
54
55
  };
55
56
  export type PromoBetItem = {
56
57
  id: string;
@@ -119,7 +120,6 @@ export declare class BetsViewModel extends ViewModel {
119
120
  private settingsSubscription;
120
121
  initialized: boolean;
121
122
  constructor(eventId: string, delegate: IMaestroEventDelegate, options?: {
122
- pollingInterval?: number;
123
123
  useMockData?: boolean;
124
124
  });
125
125
  /**
@@ -147,7 +147,23 @@ export declare class BetsViewModel extends ViewModel {
147
147
  */
148
148
  refreshPolling(): void;
149
149
  /**
150
- * Poll with the correct method based on authentication status
150
+ * Get user credentials from delegate
151
+ */
152
+ private getUserCredentials;
153
+ /**
154
+ * @description Update polling interval checking either response header or panel config.
155
+ * Refresh polling if necessary.
156
+ */
157
+ private updatePollingInterval;
158
+ private getPanelConfigInterval;
159
+ private getResponseHeaderPollingIntervalValue;
160
+ /**
161
+ * Poll with the personalized endpoint for both authenticated and anonymous users
162
+ *
163
+ * SWID format is provided by the client app delegate:
164
+ * - Logged in: {6D201B58-440C-47A6-970B-0F8C78C0BAB8} (with curly braces)
165
+ * - Anonymous: 6D201B58-440C-47A6-970B-0F8C78C0BAB8 (without curly braces)
166
+ * - Failsafe: Empty string if local storage fails
151
167
  */
152
168
  private pollWithInterval;
153
169
  /**
@@ -180,10 +196,6 @@ export declare class BetsViewModel extends ViewModel {
180
196
  * Fetch personalized bet data
181
197
  */
182
198
  private fetchPersonalizedData;
183
- /**
184
- * Fetch non-personalized bet data
185
- */
186
- private fetchNonPersonalizedData;
187
199
  /**
188
200
  * Fetch mock data for testing
189
201
  */
@@ -19,6 +19,8 @@ export type HeaderTeamStatItem = {
19
19
  displayName: string;
20
20
  homeTeamValue: number;
21
21
  awayTeamValue: number;
22
+ awayTeamDisplayValue: string;
23
+ homeTeamDisplayValue: string;
22
24
  }[];
23
25
  homeTeam: Pick<Team, 'color' | 'id' | 'logo' | 'name' | 'abbreviation' | 'record'> & {
24
26
  linescores: string[];
@@ -10,6 +10,7 @@ declare class BetsService {
10
10
  /**
11
11
  * Get non-personalized bets for an event
12
12
  *
13
+ * @deprecated Use getPersonalizedBets instead. This method is kept for backward compatibility.
13
14
  * @param eventID - The ID of the event
14
15
  * @returns Promise with the bets data
15
16
  */
@@ -18,39 +19,58 @@ declare class BetsService {
18
19
  * Get personalized bets for an event
19
20
  *
20
21
  * @param eventID - The ID of the event
21
- * @param swid - The ESPN SWID parameter
22
- * @param jwt - The authorization JWT
22
+ * @param swid - The ESPN SWID parameter (format provided by client app delegate)
23
+ * @param jwt - The authorization JWT (empty string for anonymous users)
23
24
  * @returns Promise with the personalized bets data
24
25
  */
25
26
  getPersonalizedBets(eventID: string, swid: string, jwt: string): Promise<IPersonalizedBetsResponse>;
26
27
  /**
27
- * Start polling for non-personalized bets
28
+ * Get personalized bets for an event with headers
29
+ *
30
+ * @param eventID - The ID of the event
31
+ * @param swid - The ESPN SWID parameter (format provided by client app delegate)
32
+ * @param jwt - The authorization JWT (empty string for anonymous users)
33
+ * @returns Promise with the personalized bets data and headers
34
+ */
35
+ getPersonalizedBetsWithHeaders(eventID: string, swid: string, jwt: string): Promise<{
36
+ data: IPersonalizedBetsResponse;
37
+ headers: Record<string, string>;
38
+ }>;
39
+ /**
40
+ * Start polling for personalized bets
28
41
  *
29
42
  * @param eventID - The ID of the event
43
+ * @param swid - The ESPN SWID parameter
44
+ * @param jwt - The authorization JWT
30
45
  * @param interval - The polling interval in milliseconds
31
46
  * @param onData - Callback for successful data fetch
32
47
  * @param onError - Callback for errors
33
48
  * @returns Object with a stop function to stop polling
34
49
  */
35
- pollNonPersonalizedBets(eventID: string, interval: number, onData: (data: IBetsResponse) => void, onError?: (error: Error) => void): {
50
+ pollPersonalizedBets(eventID: string, swid: string, jwt: string, interval: number, onData: (data: IPersonalizedBetsResponse) => void, onError?: (error: Error) => void): {
36
51
  stop: () => void;
37
52
  };
38
53
  /**
39
- * Start polling for personalized bets
54
+ * Start polling for personalized bets and return both data and headers
40
55
  *
41
56
  * @param eventID - The ID of the event
42
57
  * @param swid - The ESPN SWID parameter
43
58
  * @param jwt - The authorization JWT
44
59
  * @param interval - The polling interval in milliseconds
45
- * @param onData - Callback for successful data fetch
60
+ * @param onData - Callback for successful data fetch with headers
46
61
  * @param onError - Callback for errors
47
62
  * @returns Object with a stop function to stop polling
48
63
  */
49
- pollPersonalizedBets(eventID: string, swid: string, jwt: string, interval: number, onData: (data: IPersonalizedBetsResponse) => void, onError?: (error: Error) => void): {
64
+ pollPersonalizedBetsWithHeaders(eventID: string, swid: string, jwt: string, interval: number, onData: (response: {
65
+ data: IPersonalizedBetsResponse;
66
+ headers: Record<string, string>;
67
+ }) => void, onError?: (error: Error) => void): {
50
68
  stop: () => void;
51
69
  };
52
70
  /**
53
71
  * Get the endpoint for non-personalized bets
72
+ *
73
+ * @deprecated This endpoint is no longer used.
54
74
  */
55
75
  nonPersonalizedBetsEndpoint(eventID: string): string;
56
76
  /**
@@ -66,6 +66,21 @@ declare class NetworkManager {
66
66
  useCache?: boolean;
67
67
  skipResponseBodyDeserialization?: boolean;
68
68
  }): Promise<T>;
69
+ /**
70
+ * Make a request to an external API and return both data and headers
71
+ */
72
+ externalApiRequestWithHeaders<T = any>({ endpoint, method, params, data, headers, useCache, skipResponseBodyDeserialization, }: {
73
+ endpoint: string;
74
+ method?: HttpMethod;
75
+ params?: Record<string, any>;
76
+ data?: any;
77
+ headers?: Record<string, string>;
78
+ useCache?: boolean;
79
+ skipResponseBodyDeserialization?: boolean;
80
+ }): Promise<{
81
+ data: T;
82
+ headers: Record<string, string>;
83
+ }>;
69
84
  /**
70
85
  * Start polling a Maestro API endpoint at specified interval
71
86
  */
@@ -102,6 +117,25 @@ declare class NetworkManager {
102
117
  }): {
103
118
  stop: () => void;
104
119
  };
120
+ /**
121
+ * Start polling an external API endpoint at specified interval and return both data and headers
122
+ */
123
+ pollExternalApiRequestWithHeaders<T = any>({ endpoint, interval, method, params, data, headers, skipResponseBodyDeserialization, onData, onError, }: {
124
+ endpoint: string;
125
+ interval: number;
126
+ method?: HttpMethod;
127
+ params?: Record<string, any>;
128
+ data?: any;
129
+ headers?: Record<string, string>;
130
+ skipResponseBodyDeserialization?: boolean;
131
+ onData: (data: {
132
+ data: T;
133
+ headers: Record<string, string>;
134
+ }) => void;
135
+ onError?: (error: Error) => void;
136
+ }): {
137
+ stop: () => void;
138
+ };
105
139
  /**
106
140
  * Stop all polling tasks
107
141
  */
@@ -30,6 +30,15 @@ export interface IServiceNetworkManager {
30
30
  useCache?: boolean;
31
31
  skipResponseBodyDeserialization?: boolean;
32
32
  }): Promise<T>;
33
+ externalApiRequestWithHeaders<T = any>(options: {
34
+ endpoint: string;
35
+ method?: string;
36
+ params?: Record<string, any>;
37
+ headers?: Record<string, string>;
38
+ data?: any;
39
+ useCache?: boolean;
40
+ skipResponseBodyDeserialization?: boolean;
41
+ }): Promise<ResponseWithHeaders<T>>;
33
42
  pollExternalApiRequest<T = any>(options: {
34
43
  endpoint: string;
35
44
  interval: number;
@@ -42,6 +51,18 @@ export interface IServiceNetworkManager {
42
51
  }): {
43
52
  stop: () => void;
44
53
  };
54
+ pollExternalApiRequestWithHeaders<T = any>(options: {
55
+ endpoint: string;
56
+ interval: number;
57
+ method?: string;
58
+ params?: Record<string, any>;
59
+ headers?: Record<string, string>;
60
+ data?: any;
61
+ onData: (data: ResponseWithHeaders<T>) => void;
62
+ onError?: (error: Error) => void;
63
+ }): {
64
+ stop: () => void;
65
+ };
45
66
  }
46
67
  /**
47
68
  * Stats service NetworkManager interface
@@ -71,3 +92,10 @@ export type ServiceNetworkManager = IStatsNetworkManager | IBetsNetworkManager |
71
92
  export interface NetworkManagerFactoryConfig {
72
93
  defaultCacheDuration?: number;
73
94
  }
95
+ /**
96
+ * Interface for responses that include both data and headers
97
+ */
98
+ export interface ResponseWithHeaders<T> {
99
+ data: T;
100
+ headers: Record<string, string>;
101
+ }
@@ -1,5 +1,5 @@
1
1
  import ITheme from '@/models/ITheme';
2
- interface PageConfigPanel<TRendererData = unknown, TBlockData = never> {
2
+ interface PageConfigPanel<TRendererData = unknown, TBlockData = any> {
3
3
  _id: string;
4
4
  slug: string;
5
5
  panel_name?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maestro_io/maestro-web-sdk",
3
3
  "private": false,
4
- "version": "2.2.9",
4
+ "version": "2.3.1",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "main": "dist/maestro-web-sdk.umd.js",