@maestro_io/maestro-web-sdk 3.2.0 → 3.3.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 (36) hide show
  1. package/dist/maestro-web-sdk.esm.js +5 -5
  2. package/dist/maestro-web-sdk.esm.js.map +1 -1
  3. package/dist/maestro-web-sdk.umd.js +5 -5
  4. package/dist/maestro-web-sdk.umd.js.map +1 -1
  5. package/dist/src/components/atoms/SvgIcon/Icon.d.ts +2 -0
  6. package/dist/src/components/atoms/SvgIcon/ShopIcon.d.ts +5 -0
  7. package/dist/src/interfaces/IMaestroEvent.d.ts +4 -0
  8. package/dist/src/interfaces/IUserSettings.d.ts +4 -0
  9. package/dist/src/models/IPanel.d.ts +1 -0
  10. package/dist/src/modules/fantasy/mocks.d.ts +7620 -0
  11. package/dist/src/modules/fantasy/types.d.ts +1 -1
  12. package/dist/src/modules/fantasy/view-model/FantasyViewModel.FantasyPolling.d.ts +2 -4
  13. package/dist/src/modules/fantasy/view-model/FantasyViewModel.LeagueManagerPolling.d.ts +2 -2
  14. package/dist/src/modules/fantasy/view-model/FantasyViewModel.d.ts +4 -2
  15. package/dist/src/modules/shop/mocks.d.ts +22 -0
  16. package/dist/src/modules/shop/types.d.ts +161 -0
  17. package/dist/src/modules/shop/view/ProductDetailView/ProductDetailView.d.ts +10 -0
  18. package/dist/src/modules/shop/view/ProductDetailView/index.d.ts +2 -0
  19. package/dist/src/modules/shop/view/ShopView.d.ts +35 -0
  20. package/dist/src/modules/shop/view/components/BrowseCard/BrowseCard.d.ts +55 -0
  21. package/dist/src/modules/shop/view/components/BrowseCard/index.d.ts +2 -0
  22. package/dist/src/modules/shop/view/components/ProductSummaryCard/ProductSummaryCard.d.ts +56 -0
  23. package/dist/src/modules/shop/view/components/ProductSummaryCard/index.d.ts +2 -0
  24. package/dist/src/modules/shop/view/components/ShopPromoView/ShopPromoView.d.ts +9 -0
  25. package/dist/src/modules/shop/view/components/ShopPromoView/index.d.ts +1 -0
  26. package/dist/src/modules/shop/view/components/ShopSection/ShopSection.d.ts +21 -0
  27. package/dist/src/modules/shop/view/components/ShopSection/index.d.ts +1 -0
  28. package/dist/src/modules/shop/view/index.d.ts +2 -0
  29. package/dist/src/modules/shop/view-model/ShopViewModel.ShopPolling.d.ts +31 -0
  30. package/dist/src/modules/shop/view-model/ShopViewModel.d.ts +77 -0
  31. package/dist/src/services/AnalyticsService/AnalyticsService.d.ts +16 -3
  32. package/dist/src/services/FantasyService.d.ts +3 -4
  33. package/dist/src/services/NetworkManager/types.d.ts +1 -0
  34. package/dist/src/services/ShopService.d.ts +23 -0
  35. package/dist/src/view-models/MaestroEventViewModel.d.ts +2 -0
  36. package/package.json +1 -3
@@ -40,7 +40,7 @@ export interface Preference {
40
40
  groupSize?: number;
41
41
  groupName?: string;
42
42
  groupManager?: boolean;
43
- draftDate?: number;
43
+ draftDate?: number | string | null;
44
44
  draftType?: number;
45
45
  draftStatus?: number;
46
46
  leagueStatus?: number;
@@ -1,11 +1,9 @@
1
- import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
2
- import { FantasyPollingParams } from '@/services/FantasyService';
1
+ import FantasyService, { FantasyPollingParams } from '@/services/FantasyService';
3
2
  import { IFantasyResponse } from '../types';
4
3
  export default class FantasyPolling {
5
4
  private polling;
6
- private delegate;
7
5
  private fantasyService;
8
- constructor(delegate: IMaestroEventDelegate);
6
+ constructor(service: FantasyService);
9
7
  /**
10
8
  * Refresh polling for fantasy data
11
9
  */
@@ -1,9 +1,9 @@
1
- import { LeagueManagerPollingParams } from '@/services/FantasyService';
1
+ import FantasyService, { LeagueManagerPollingParams } from '@/services/FantasyService';
2
2
  import { ILeagueManagerResponse, ILeagueManagerRotoResponse } from '../types';
3
3
  export default class LeagueManagerPolling {
4
4
  private polling;
5
5
  private fantasyService;
6
- constructor();
6
+ constructor(service: FantasyService);
7
7
  /**
8
8
  * Refresh polling for league manager data
9
9
  */
@@ -109,10 +109,12 @@ export declare class FantasyViewModel {
109
109
  private delegate;
110
110
  private analyticsService;
111
111
  private fantasyService;
112
- private useMockData;
113
112
  private fantasyPolling;
114
113
  private leagueManagerPolling;
115
114
  errorState: Observable<FantasyErrorState>;
115
+ private leagueSortOrder;
116
+ private itemToLeagueKey;
117
+ private useMockData;
116
118
  constructor(eventId: string, delegate: IMaestroEventDelegate, options?: {
117
119
  useMockData?: boolean;
118
120
  });
@@ -133,7 +135,7 @@ export declare class FantasyViewModel {
133
135
  private trackPanelView;
134
136
  private processFantasy;
135
137
  private parseRoto;
136
- append(item: FantasyItem | null): void;
138
+ append(item: FantasyItem | null, leagueKey?: string): void;
137
139
  private parseHeadToHead;
138
140
  private parseTopPlayers;
139
141
  private parseInactiveLeague;
@@ -0,0 +1,22 @@
1
+ import { IShopResponse } from './types';
2
+ /**
3
+ * Mock shop data for NFL game with multiple sections
4
+ * Covers: regular products, sale products, and browse card
5
+ */
6
+ export declare const MOCK_SHOP_NFL_RESPONSE: IShopResponse;
7
+ /**
8
+ * Mock shop data for NBA game
9
+ */
10
+ export declare const MOCK_SHOP_NBA_RESPONSE: IShopResponse;
11
+ /**
12
+ * Mock shop data for NCAA Football
13
+ */
14
+ export declare const MOCK_SHOP_NCF_RESPONSE: IShopResponse;
15
+ /**
16
+ * Mock shop data with empty sections
17
+ */
18
+ export declare const MOCK_SHOP_EMPTY_RESPONSE: IShopResponse;
19
+ /**
20
+ * Mock shop data with single section
21
+ */
22
+ export declare const MOCK_SHOP_SINGLE_SECTION_RESPONSE: IShopResponse;
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Shop module type definitions
3
+ * Based on ESPN Shop API structure
4
+ */
5
+ /**
6
+ * Image reference
7
+ */
8
+ export interface IShopImage {
9
+ /** Image URL */
10
+ href?: string;
11
+ /** Image width */
12
+ width?: number;
13
+ /** Image height */
14
+ height?: number;
15
+ }
16
+ /**
17
+ * Logo reference (same structure as image)
18
+ */
19
+ export interface IShopLogo {
20
+ /** Logo URL */
21
+ href?: string;
22
+ /** Logo width */
23
+ width?: number;
24
+ /** Logo height */
25
+ height?: number;
26
+ }
27
+ /**
28
+ * Link reference
29
+ */
30
+ export interface IShopLink {
31
+ /** Link URL */
32
+ href?: string;
33
+ /** Link text */
34
+ text?: string;
35
+ /** Link relations (e.g., ["ictv", "fanatics", "index", "team"]) */
36
+ rel?: string[];
37
+ }
38
+ /**
39
+ * Price information for a product
40
+ */
41
+ export interface IShopPrice {
42
+ /** Retail price display string (e.g., "$29.99") */
43
+ displayRetail?: string;
44
+ /** Sale price display string (e.g., "$19.99") - optional */
45
+ displaySale?: string;
46
+ /** Clearance price display string (e.g., "$14.99") - optional */
47
+ displayClearance?: string;
48
+ }
49
+ /**
50
+ * Product detail information shown in detail view
51
+ */
52
+ export interface IShopDetail {
53
+ /** Title for the detail view */
54
+ title?: string;
55
+ /** Description (optional, used for browse cards) */
56
+ description?: string;
57
+ /** Link information */
58
+ link?: IShopLink;
59
+ /** Background image URL */
60
+ backgroundImage?: string;
61
+ /** QR code image URL */
62
+ qrCode?: string;
63
+ /** Disclaimer text */
64
+ disclaimer?: string;
65
+ }
66
+ /**
67
+ * Product item in a shop section
68
+ */
69
+ export interface IShopProduct {
70
+ /** Item type discriminator */
71
+ type?: 'product';
72
+ /** Product name */
73
+ name?: string;
74
+ /** Product image */
75
+ image?: IShopImage;
76
+ /** Price information */
77
+ price?: IShopPrice;
78
+ /** Detail view information */
79
+ detail?: IShopDetail;
80
+ }
81
+ /**
82
+ * Browse card item (Want More?) in a shop section
83
+ */
84
+ export interface IShopBrowseCard {
85
+ /** Item type discriminator */
86
+ type?: 'browse';
87
+ /** Browse card name */
88
+ name?: string;
89
+ /** Caption text (e.g., "Browse all Canadiens merch") */
90
+ caption?: string;
91
+ /** Team/League/Event logo */
92
+ image?: IShopImage;
93
+ /** Detail view information */
94
+ detail?: IShopDetail;
95
+ }
96
+ /**
97
+ * Union type for all shop items
98
+ */
99
+ export type IShopItem = IShopProduct | IShopBrowseCard;
100
+ /**
101
+ * Section product information (team/league info)
102
+ */
103
+ export interface IShopSectionProduct {
104
+ /** Product/Team ID */
105
+ id?: string;
106
+ /** Short display name (e.g., "Canadiens") */
107
+ shortDisplayName?: string;
108
+ /** Logo reference */
109
+ logo?: IShopLogo;
110
+ /** Type (e.g., "team") */
111
+ type?: string;
112
+ /** Link information */
113
+ link?: IShopLink;
114
+ /** Background image URL */
115
+ backgroundImage?: string;
116
+ }
117
+ /**
118
+ * Shop section containing a title and list of items
119
+ */
120
+ export interface IShopSection {
121
+ /** Section title (e.g., "Shop Canadiens Merch") */
122
+ title?: string;
123
+ /** Section product/team information */
124
+ product?: IShopSectionProduct;
125
+ /** Array of products or browse cards */
126
+ items?: IShopItem[];
127
+ }
128
+ export type IShopDefaultItem = {
129
+ image?: {
130
+ href?: string;
131
+ width?: number;
132
+ height?: number;
133
+ };
134
+ type?: string;
135
+ detail?: {
136
+ title?: string;
137
+ link?: {
138
+ href?: string;
139
+ text?: string;
140
+ };
141
+ backgroundImage?: string;
142
+ qrCode?: string;
143
+ disclaimer?: string;
144
+ };
145
+ };
146
+ /**
147
+ * Shop container with sections
148
+ */
149
+ export interface IShopContainer {
150
+ /** Array of shop sections */
151
+ sections?: IShopSection[];
152
+ defaultItem?: IShopDefaultItem;
153
+ }
154
+ /**
155
+ * Main shop API response
156
+ */
157
+ export interface IShopResponse {
158
+ /** Array of shop containers (typically one) */
159
+ shop?: IShopContainer[];
160
+ }
161
+ export declare const isShopProduct: (item: IShopItem) => item is IShopProduct;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './ProductDetailView.styles.css';
3
+ import { IShopBrowseCard, IShopProduct } from '../../types';
4
+ import { WithFocusableProps } from '@/external/spatial-navigation';
5
+ export type ProductDetailViewProps = {
6
+ product: IShopProduct | IShopBrowseCard;
7
+ focusKey: string;
8
+ };
9
+ declare const ProductDetailView: (props: ProductDetailViewProps & WithFocusableProps) => React.JSX.Element;
10
+ export default ProductDetailView;
@@ -0,0 +1,2 @@
1
+ export { default } from './ProductDetailView';
2
+ export * from './ProductDetailView';
@@ -0,0 +1,35 @@
1
+ import React, { Component } from 'react';
2
+ import './ShopView.styles.css';
3
+ import { Direction } from '@/external/spatial-navigation/utils';
4
+ import ShopViewModel, { ShopErrorState } from '../view-model/ShopViewModel';
5
+ import { IShopProduct, IShopSection, IShopBrowseCard, IShopDefaultItem } from '../types';
6
+ interface State {
7
+ container: HTMLDivElement | null;
8
+ sections: IShopSection[];
9
+ isDataLoading: boolean;
10
+ errorState: ShopErrorState;
11
+ selectedItem: IShopProduct | IShopBrowseCard | null;
12
+ selectedShopSection: IShopSection | null;
13
+ selectedItemFocusKey: string;
14
+ promoData: IShopDefaultItem | null;
15
+ }
16
+ declare class ShopView extends Component<{}, State> {
17
+ private container;
18
+ private sectionsListener;
19
+ private isDataLoadingListener;
20
+ private errorStateListener;
21
+ private promoDataListener;
22
+ private vm;
23
+ constructor(props: {});
24
+ get viewModel(): ShopViewModel;
25
+ componentDidMount(): void;
26
+ componentWillUnmount(): void;
27
+ clearTabLoadFailure: () => void;
28
+ onArrowPress: (d: Direction) => void;
29
+ openItemDetail: (selectedItem: IShopProduct | IShopBrowseCard, selectedShopSection: IShopSection, selectedItemFocusKey: string) => void;
30
+ closeProductDetail: () => void;
31
+ trackPromoEnterPress: () => void;
32
+ renderContent: () => React.JSX.Element | React.JSX.Element[];
33
+ render(): React.JSX.Element;
34
+ }
35
+ export default ShopView;
@@ -0,0 +1,55 @@
1
+ /// <reference types="prop-types" />
2
+ import React from 'react';
3
+ import './BrowseCard.styles.css';
4
+ import { WithFocusableProps } from '@/external/spatial-navigation';
5
+ import { IShopBrowseCard } from '../../../types';
6
+ export type BrowseCardProps = {
7
+ browseCard: IShopBrowseCard;
8
+ };
9
+ export declare class BrowseCardView extends React.Component<BrowseCardProps & WithFocusableProps> {
10
+ render(): React.JSX.Element;
11
+ }
12
+ declare const _default: {
13
+ new (props?: (BrowseCardProps & WithFocusableProps) | undefined, context?: any): {
14
+ state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState;
15
+ navigation: import("../../../../../external/spatial-navigation/spatialNavigation").default;
16
+ getChildContext(): {
17
+ parentFocusKey: string;
18
+ };
19
+ setFocus: (focusKey: string) => void;
20
+ navigateByDirection: (direction: import("../../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
21
+ stealFocus: () => void;
22
+ onUpdateFocus: (focused: boolean) => void;
23
+ onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
24
+ onEnterPressHandler: (details: import("../../../../../external/spatial-navigation/utils").Details) => void;
25
+ onEnterReleaseHandler: () => void;
26
+ onBackPressHandler: (details: import("../../../../../external/spatial-navigation/utils").Details) => void;
27
+ onArrowPressHandler: (direction: import("../../../../../external/spatial-navigation/utils").Direction, details: import("../../../../../external/spatial-navigation/utils").Details) => boolean | void;
28
+ onBecameFocusedHandler: (layout: import("../../../../../external/spatial-navigation/utils").Layout, details: import("../../../../../external/spatial-navigation/utils").Details) => void;
29
+ onBecameBlurredHandler: (layout: import("../../../../../external/spatial-navigation/utils").Layout, details: import("../../../../../external/spatial-navigation/utils").Details) => void;
30
+ componentDidMount(): void;
31
+ componentDidUpdate(): void;
32
+ componentWillUnmount(): void;
33
+ render(): React.ReactElement<BrowseCardProps & WithFocusableProps>;
34
+ 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: BrowseCardProps & 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;
35
+ forceUpdate(callBack?: (() => any) | undefined): void;
36
+ props: Readonly<{
37
+ children?: React.ReactNode;
38
+ }> & Readonly<BrowseCardProps & WithFocusableProps>;
39
+ context: any;
40
+ refs: {
41
+ [key: string]: React.ReactInstance;
42
+ };
43
+ componentWillMount?(): void;
44
+ componentWillReceiveProps?(nextProps: Readonly<BrowseCardProps & WithFocusableProps>, nextContext: any): void;
45
+ shouldComponentUpdate?(nextProps: Readonly<BrowseCardProps & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
46
+ componentWillUpdate?(nextProps: Readonly<BrowseCardProps & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
47
+ };
48
+ contextTypes: {
49
+ parentFocusKey: import("prop-types").Requireable<string>;
50
+ };
51
+ childContextTypes: {
52
+ parentFocusKey: import("prop-types").Requireable<string>;
53
+ };
54
+ };
55
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default } from './BrowseCard';
2
+ export * from './BrowseCard';
@@ -0,0 +1,56 @@
1
+ /// <reference types="prop-types" />
2
+ import React from 'react';
3
+ import './ProductSummaryCard.styles.css';
4
+ import { WithFocusableProps } from '@/external/spatial-navigation';
5
+ import { Direction, Layout } from '@/external/spatial-navigation/utils';
6
+ import { IShopProduct } from '../../../types';
7
+ export type ProductSummaryCardProps = {
8
+ product: IShopProduct;
9
+ onEnterPress?: () => void;
10
+ onArrowPress?: (direction: Direction) => void;
11
+ onBecameFocused?: (layout: Layout) => void;
12
+ };
13
+ declare const _default: {
14
+ new (props?: (ProductSummaryCardProps & WithFocusableProps) | undefined, context?: any): {
15
+ state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState;
16
+ navigation: import("../../../../../external/spatial-navigation/spatialNavigation").default;
17
+ getChildContext(): {
18
+ parentFocusKey: string;
19
+ };
20
+ setFocus: (focusKey: string) => void;
21
+ navigateByDirection: (direction: Direction, details?: Record<string, any>) => void;
22
+ stealFocus: () => void;
23
+ onUpdateFocus: (focused: boolean) => void;
24
+ onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
25
+ onEnterPressHandler: (details: import("@/external/spatial-navigation/utils").Details) => void;
26
+ onEnterReleaseHandler: () => void;
27
+ onBackPressHandler: (details: import("@/external/spatial-navigation/utils").Details) => void;
28
+ onArrowPressHandler: (direction: Direction, details: import("@/external/spatial-navigation/utils").Details) => boolean | void;
29
+ onBecameFocusedHandler: (layout: Layout, details: import("@/external/spatial-navigation/utils").Details) => void;
30
+ onBecameBlurredHandler: (layout: Layout, details: import("@/external/spatial-navigation/utils").Details) => void;
31
+ componentDidMount(): void;
32
+ componentDidUpdate(): void;
33
+ componentWillUnmount(): void;
34
+ render(): React.ReactElement<ProductSummaryCardProps & WithFocusableProps>;
35
+ 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: ProductSummaryCardProps & 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;
36
+ forceUpdate(callBack?: (() => any) | undefined): void;
37
+ props: Readonly<{
38
+ children?: React.ReactNode;
39
+ }> & Readonly<ProductSummaryCardProps & WithFocusableProps>;
40
+ context: any;
41
+ refs: {
42
+ [key: string]: React.ReactInstance;
43
+ };
44
+ componentWillMount?(): void;
45
+ componentWillReceiveProps?(nextProps: Readonly<ProductSummaryCardProps & WithFocusableProps>, nextContext: any): void;
46
+ shouldComponentUpdate?(nextProps: Readonly<ProductSummaryCardProps & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
47
+ componentWillUpdate?(nextProps: Readonly<ProductSummaryCardProps & WithFocusableProps>, nextState: Readonly<import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
48
+ };
49
+ contextTypes: {
50
+ parentFocusKey: import("prop-types").Requireable<string>;
51
+ };
52
+ childContextTypes: {
53
+ parentFocusKey: import("prop-types").Requireable<string>;
54
+ };
55
+ };
56
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default } from './ProductSummaryCard';
2
+ export type { ProductSummaryCardProps } from './ProductSummaryCard';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { WithFocusableProps } from '@/external/spatial-navigation';
3
+ import './ShopPromoView.styles.css';
4
+ import { IShopDefaultItem } from '../../../types';
5
+ type Props = {
6
+ promoData: IShopDefaultItem;
7
+ };
8
+ declare const ShopPromoViewWrapper: (props: Props & WithFocusableProps) => React.JSX.Element;
9
+ export default ShopPromoViewWrapper;
@@ -0,0 +1 @@
1
+ export { default } from './ShopPromoView';
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import './ShopSection.styles.css';
3
+ import { IShopBrowseCard, IShopProduct, IShopSection } from '../../../types';
4
+ import { Direction, Layout } from '@/external/spatial-navigation/utils';
5
+ export type ShopSectionProps = {
6
+ section: IShopSection;
7
+ onArrowPress: (direction: Direction) => void;
8
+ onItemClick: (item: IShopProduct | IShopBrowseCard, section: IShopSection, focusKey: string) => void;
9
+ };
10
+ declare class ShopSection extends React.Component<ShopSectionProps> {
11
+ static contextTypes: {
12
+ refsMap: React.Requireable<any>;
13
+ setRef: React.Requireable<any>;
14
+ scrollToFocusedElement: React.Requireable<any>;
15
+ };
16
+ context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
17
+ onBecameFocused: (layout: Layout) => void;
18
+ onEnterPress: (item: IShopProduct | IShopBrowseCard, section: IShopSection, focusKey: string) => () => void;
19
+ render(): React.JSX.Element;
20
+ }
21
+ export default ShopSection;
@@ -0,0 +1 @@
1
+ export { default } from './ShopSection';
@@ -0,0 +1,2 @@
1
+ import ShopView from './ShopView';
2
+ export default ShopView;
@@ -0,0 +1,31 @@
1
+ import ShopService from '@/services/ShopService';
2
+ import { IShopResponse } from '../types';
3
+ export default class ShopPolling {
4
+ private polling;
5
+ private shopService;
6
+ constructor(service: ShopService);
7
+ /**
8
+ * Refresh polling for shop data
9
+ */
10
+ refresh(callback: (data: IShopResponse) => void): void;
11
+ /**
12
+ * Stop polling for shop data
13
+ */
14
+ stop(): void;
15
+ removeLastResponseHash(): void;
16
+ private start;
17
+ /**
18
+ * @description Update polling interval checking either response header or panel config.
19
+ * Refresh polling if necessary.
20
+ */
21
+ private updateInterval;
22
+ private getResponseHeaderPollingIntervalValue;
23
+ /**
24
+ * Process data received from polling
25
+ */
26
+ private processPolledData;
27
+ /**
28
+ * Handle errors that occur during shop polling
29
+ */
30
+ private handlePollingError;
31
+ }
@@ -0,0 +1,77 @@
1
+ import { Observable } from '../../../helpers/Observable';
2
+ import { ViewModel } from '../../../view-models/ViewModel';
3
+ import { IShopSection, IShopProduct, IShopBrowseCard, IShopDefaultItem } from '../types';
4
+ import { TestUseCase } from '@/interfaces/IMaestroEvent';
5
+ declare const SHOP_ERROR_STATE: {
6
+ readonly NONE: "none";
7
+ readonly TAB_LOAD_FAILURE: "tabLoadFailure";
8
+ readonly EMPTY_SHOP: "emptyShop";
9
+ };
10
+ export type ShopErrorState = typeof SHOP_ERROR_STATE[keyof typeof SHOP_ERROR_STATE];
11
+ /**
12
+ * ViewModel for Shop panel
13
+ * Manages shop data fetching, polling, and state
14
+ */
15
+ export declare class ShopViewModel extends ViewModel {
16
+ sections: Observable<IShopSection[]>;
17
+ isDataLoading: Observable<boolean>;
18
+ errorState: Observable<ShopErrorState>;
19
+ hasEverSuccessfullyLoaded: Observable<boolean>;
20
+ promoData: Observable<IShopDefaultItem | null>;
21
+ private shopService;
22
+ private analyticsService;
23
+ private shopPolling;
24
+ private useMockData;
25
+ private mockDataType;
26
+ initialized: boolean;
27
+ constructor(eventId: string, options?: {
28
+ useMockData?: boolean;
29
+ mockDataType?: 'nfl' | 'nba' | 'ncf' | 'empty' | 'single';
30
+ });
31
+ /**
32
+ * Initialize the ViewModel and start data fetching
33
+ */
34
+ init(): void;
35
+ /**
36
+ * Clean up resources when the ViewModel is no longer needed
37
+ */
38
+ cleanup(): void;
39
+ /**
40
+ * Track panel view event
41
+ */
42
+ private trackPanelView;
43
+ /**
44
+ * Parse price string to number, handling currency formats
45
+ */
46
+ private parsePriceToNumber;
47
+ /**
48
+ * Track shop item card click event
49
+ */
50
+ trackItemClick(card: 'product_summary' | 'want more' | 'product_detail' | 'fallback', item: IShopProduct | IShopBrowseCard | null, section: IShopSection | null): Promise<void>;
51
+ /**
52
+ * Refresh polling for shop data
53
+ */
54
+ refreshPolling(): void;
55
+ /**
56
+ * Process the shop data and update the sections
57
+ */
58
+ private processShopData;
59
+ setTabLoadFailure(): void;
60
+ /**
61
+ * Fetch new shop data immediately (one-time)
62
+ */
63
+ fetchNewData(): void;
64
+ /**
65
+ * Fetch mock data for testing
66
+ */
67
+ private fetchMockData;
68
+ /**
69
+ * Simulate different use cases for testing
70
+ */
71
+ simulateUseCase<T = any>(useCase: TestUseCase, data: T): void;
72
+ /**
73
+ * Clear tab load failure and retry
74
+ */
75
+ clearTabLoadFailure(): void;
76
+ }
77
+ export default ShopViewModel;
@@ -37,7 +37,20 @@ type FantasyItemClickedAction = {
37
37
  card: string;
38
38
  };
39
39
  };
40
- type PanelClickPayload = KeyPlaysClickedAction | BetsItemClickedAction | StatsItemClickedAction | FantasyItemClickedAction;
40
+ type ShopItemClickedAction = {
41
+ type: 'espnShop';
42
+ name: 'shop_item_clicked';
43
+ metadata: {
44
+ card: string[];
45
+ game_state: string[];
46
+ product: string | null;
47
+ entity_type: string[];
48
+ entity_name: string[];
49
+ price: string | null;
50
+ sale: string[];
51
+ };
52
+ };
53
+ type PanelClickPayload = KeyPlaysClickedAction | BetsItemClickedAction | StatsItemClickedAction | FantasyItemClickedAction | ShopItemClickedAction;
41
54
  type PanelData = {
42
55
  panel_type: string;
43
56
  panel_id: string;
@@ -53,10 +66,10 @@ declare class AnalyticsService {
53
66
  constructor();
54
67
  private trackAction;
55
68
  private trackImpression;
56
- panelView(panelType: 'espnStats' | 'espnKeyPlays' | 'espnBet' | 'espnFantasy', metadata?: Record<string, any>): Promise<void>;
69
+ panelView(panelType: 'espnStats' | 'espnKeyPlays' | 'espnBet' | 'espnFantasy' | 'espnShop', metadata?: Record<string, any>): Promise<void>;
57
70
  panelClick({ type, metadata, name }: PanelClickPayload): Promise<void>;
58
71
  getBaseMetadataFromPageConfig(pageConfig: PageConfig | null): BaseMetadata;
59
- getPanelDataFromPageConfig(type: 'espnBet' | 'espnStats' | 'espnKeyPlays' | 'espnFantasy', pageConfig: PageConfig | null): PanelData;
72
+ getPanelDataFromPageConfig(type: 'espnBet' | 'espnStats' | 'espnKeyPlays' | 'espnFantasy' | 'espnShop', pageConfig: PageConfig | null): PanelData;
60
73
  sessionStart(): Promise<void>;
61
74
  sessionEnd(): Promise<void>;
62
75
  private scheduleNextBeacon;
@@ -1,4 +1,3 @@
1
- import NetworkManager from './NetworkManager/NetworkManager';
2
1
  import { IFantasyResponse, ILeagueManagerResponse, IPromoResponse } from '@/modules/fantasy/types';
3
2
  export type LeagueManagerPollingParams = {
4
3
  /**
@@ -26,9 +25,9 @@ export type FantasyPollingParams = {
26
25
  * Service for handling fantasy API calls
27
26
  */
28
27
  declare class FantasyService {
29
- fantasyClient: NetworkManager;
30
- leagueManagerClient: NetworkManager;
31
- promoClient: NetworkManager;
28
+ private fantasyClient;
29
+ private leagueManagerClient;
30
+ private promoClient;
32
31
  constructor();
33
32
  /**
34
33
  * Polls the fantasy API at regular intervals
@@ -6,6 +6,7 @@ export declare const ServiceType: {
6
6
  readonly BETS: "bets";
7
7
  readonly MAESTRO: "maestro";
8
8
  readonly FANTASY: "fantasy";
9
+ readonly SHOP: "shop";
9
10
  };
10
11
  export type ServiceType = typeof ServiceType[keyof typeof ServiceType];
11
12
  /**
@@ -0,0 +1,23 @@
1
+ import NetworkManager from './NetworkManager/NetworkManager';
2
+ import { IShopResponse } from '../modules/shop/types';
3
+ import { ResponseWithHeaders } from './NetworkManager/types';
4
+ /**
5
+ * Service for handling shop-related API calls
6
+ */
7
+ declare class ShopService {
8
+ networkManager: NetworkManager;
9
+ private eventId;
10
+ constructor(eventId: string);
11
+ /**
12
+ * Start polling shop data
13
+ *
14
+ * @param interval - The polling interval in milliseconds
15
+ * @param onData - Callback for successful data fetch with headers
16
+ * @param onError - Callback for errors
17
+ * @returns Object with a stop function to stop polling
18
+ */
19
+ pollShopData(interval: number, onData: (data: ResponseWithHeaders<IShopResponse>) => void, onError?: (error: Error) => void): {
20
+ stop: () => void;
21
+ };
22
+ }
23
+ export default ShopService;