@times-components/ts-components 1.174.0 → 1.175.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 (27) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/opta/football/opta-match-stats/momentum/OptaMatchStatsMomentum.d.ts +1 -1
  3. package/dist/components/opta/football/opta-match-stats/momentum/OptaMatchStatsMomentum.js +3 -3
  4. package/dist/components/opta/football/opta-match-stats/momentum/OptaMatchStatsMomentum.stories.js +3 -3
  5. package/dist/components/opta/football/opta-match-stats/momentum/__tests__/OptaMatchStatsMomentum.test.js +5 -5
  6. package/dist/components/opta/football/opta-match-stats/win-probability/OptaMatchStatsWinProbability.d.ts +1 -1
  7. package/dist/components/opta/football/opta-match-stats/win-probability/OptaMatchStatsWinProbability.js +4 -4
  8. package/dist/components/opta/football/opta-match-stats/win-probability/OptaMatchStatsWinProbability.stories.js +4 -4
  9. package/dist/components/opta/football/opta-match-stats/win-probability/__tests__/OptaMatchStatsWinProbability.test.js +3 -3
  10. package/dist/components/opta/football/opta-match-stats/xG/OptaMatchStatsXG.d.ts +1 -1
  11. package/dist/components/opta/football/opta-match-stats/xG/OptaMatchStatsXG.js +4 -4
  12. package/dist/components/opta/football/opta-match-stats/xG/OptaMatchStatsXG.stories.js +2 -2
  13. package/dist/components/opta/football/opta-match-stats/xG/OptaMatchStatsXGGroup.d.ts +1 -1
  14. package/dist/components/opta/football/opta-match-stats/xG/OptaMatchStatsXGGroup.js +4 -4
  15. package/dist/components/opta/football/opta-match-stats/xG/__tests__/OptaMatchStatsXGGroup.test.js +3 -3
  16. package/package.json +3 -3
  17. package/rnw.js +1 -1
  18. package/src/components/opta/football/opta-match-stats/momentum/OptaMatchStatsMomentum.stories.tsx +2 -2
  19. package/src/components/opta/football/opta-match-stats/momentum/OptaMatchStatsMomentum.tsx +3 -3
  20. package/src/components/opta/football/opta-match-stats/momentum/__tests__/OptaMatchStatsMomentum.test.tsx +4 -4
  21. package/src/components/opta/football/opta-match-stats/win-probability/OptaMatchStatsWinProbability.stories.tsx +3 -3
  22. package/src/components/opta/football/opta-match-stats/win-probability/OptaMatchStatsWinProbability.tsx +4 -4
  23. package/src/components/opta/football/opta-match-stats/win-probability/__tests__/OptaMatchStatsWinProbability.test.tsx +2 -2
  24. package/src/components/opta/football/opta-match-stats/xG/OptaMatchStatsXG.stories.tsx +1 -1
  25. package/src/components/opta/football/opta-match-stats/xG/OptaMatchStatsXG.tsx +4 -4
  26. package/src/components/opta/football/opta-match-stats/xG/OptaMatchStatsXGGroup.tsx +4 -4
  27. package/src/components/opta/football/opta-match-stats/xG/__tests__/OptaMatchStatsXGGroup.test.tsx +2 -2
@@ -17,7 +17,7 @@ storiesOf(
17
17
  ))
18
18
  .add('Momentum (error state with teams)', () => (
19
19
  <OptaMatchStatsMomentum
20
- matchId="invalid-match"
20
+ match="invalid-match"
21
21
  apiBaseUrl="https://invalid.example.com"
22
22
  isApp={true}
23
23
  homeTeam="Arsenal"
@@ -27,7 +27,7 @@ storiesOf(
27
27
  ))
28
28
  .add('Momentum (error state without teams)', () => (
29
29
  <OptaMatchStatsMomentum
30
- matchId="invalid-match"
30
+ match="invalid-match"
31
31
  apiBaseUrl="https://invalid.example.com"
32
32
  isApp={true}
33
33
  hasBorder={true}
@@ -21,7 +21,7 @@ import { MomentumPlaceholderSvg } from './MomentumPlaceholderSvg';
21
21
 
22
22
  export const OptaMatchStatsMomentum: React.FC<{
23
23
  feed?: MatchMomentumFeed;
24
- matchId?: string;
24
+ match?: string;
25
25
  apiBaseUrl?: string;
26
26
  isApp?: boolean;
27
27
  hasBorder?: boolean;
@@ -30,7 +30,7 @@ export const OptaMatchStatsMomentum: React.FC<{
30
30
  }> = React.memo(
31
31
  ({
32
32
  feed,
33
- matchId,
33
+ match,
34
34
  apiBaseUrl,
35
35
  isApp = false,
36
36
  hasBorder = false,
@@ -38,7 +38,7 @@ export const OptaMatchStatsMomentum: React.FC<{
38
38
  awayTeam
39
39
  }) => {
40
40
  const fetchUrl =
41
- matchId && apiBaseUrl ? buildMomentumUrl(apiBaseUrl, matchId) : undefined;
41
+ match && apiBaseUrl ? buildMomentumUrl(apiBaseUrl, match) : undefined;
42
42
 
43
43
  // First fetch without polling to determine match status
44
44
  const { data: fetchedFeed, loading, error } = useFetchFeed<
@@ -328,7 +328,7 @@ describe('OptaMatchStatsMomentum – error state', () => {
328
328
 
329
329
  it('renders error message when fetch fails', () => {
330
330
  const { getByTestId } = render(
331
- <OptaMatchStatsMomentum matchId="123" apiBaseUrl="/api" />
331
+ <OptaMatchStatsMomentum match="123" apiBaseUrl="/api" />
332
332
  );
333
333
  expect(getByTestId('error-message')).toHaveTextContent(
334
334
  'Momentum data will be available once the match kicks off'
@@ -341,7 +341,7 @@ describe('OptaMatchStatsMomentum – error state', () => {
341
341
  it('renders team names when provided', () => {
342
342
  const { getByTestId } = render(
343
343
  <OptaMatchStatsMomentum
344
- matchId="123"
344
+ match="123"
345
345
  apiBaseUrl="/api"
346
346
  homeTeam="Arsenal"
347
347
  awayTeam="Chelsea"
@@ -354,14 +354,14 @@ describe('OptaMatchStatsMomentum – error state', () => {
354
354
 
355
355
  it('does not render team names when not provided', () => {
356
356
  const { queryByTestId } = render(
357
- <OptaMatchStatsMomentum matchId="123" apiBaseUrl="/api" />
357
+ <OptaMatchStatsMomentum match="123" apiBaseUrl="/api" />
358
358
  );
359
359
  expect(queryByTestId('error-teams')).toBeNull();
360
360
  });
361
361
 
362
362
  it('renders the placeholder SVG', () => {
363
363
  const { container } = render(
364
- <OptaMatchStatsMomentum matchId="123" apiBaseUrl="/api" />
364
+ <OptaMatchStatsMomentum match="123" apiBaseUrl="/api" />
365
365
  );
366
366
  expect(
367
367
  container.querySelector('.momentum-placeholder-svg')
@@ -107,15 +107,15 @@ storiesOf(
107
107
  </div>
108
108
  );
109
109
  })
110
- .add('Fetch by matchId', () => {
111
- const matchId = text('Match ID', DEFAULT_MATCH_ID);
110
+ .add('Fetch by match', () => {
111
+ const match = text('Match ID', DEFAULT_MATCH_ID);
112
112
  const apiBaseUrl = text('API Base URL', DEFAULT_API_BASE_URL);
113
113
  const isApp = boolean('isApp', true);
114
114
 
115
115
  return (
116
116
  <div style={{ maxWidth: 600, margin: '0 auto' }}>
117
117
  <OptaMatchStatsWinProbability
118
- matchId={matchId}
118
+ match={match}
119
119
  apiBaseUrl={apiBaseUrl}
120
120
  isApp={isApp}
121
121
  />
@@ -122,7 +122,7 @@ export const OptaMatchStatsWinProbability: React.FC<{
122
122
  /** Pass a pre-fetched feed directly (e.g. for testing / SSR). */
123
123
  feed?: WinProbabilityFeed;
124
124
  /** Match / fixture ID used to build the API URL. */
125
- matchId?: string;
125
+ match?: string;
126
126
  /** Base URL for the API (without trailing slash). */
127
127
  apiBaseUrl?: string;
128
128
  /** Override home team colour. */
@@ -134,15 +134,15 @@ export const OptaMatchStatsWinProbability: React.FC<{
134
134
  }> = React.memo(
135
135
  ({
136
136
  feed,
137
- matchId,
137
+ match,
138
138
  apiBaseUrl,
139
139
  homeColor = defaultHomeColor,
140
140
  awayColor = defaultAwayColor,
141
141
  isApp = false
142
142
  }) => {
143
143
  const fetchUrl =
144
- matchId && apiBaseUrl
145
- ? buildWinProbabilityUrl(apiBaseUrl, matchId)
144
+ match && apiBaseUrl
145
+ ? buildWinProbabilityUrl(apiBaseUrl, match)
146
146
  : undefined;
147
147
 
148
148
  // Initial fetch (no polling) to determine match status
@@ -107,7 +107,7 @@ describe('OptaMatchStatsWinProbability', () => {
107
107
  error: undefined
108
108
  });
109
109
  const { getByTestId } = render(
110
- <OptaMatchStatsWinProbability matchId="123" apiBaseUrl="/api" />
110
+ <OptaMatchStatsWinProbability match="123" apiBaseUrl="/api" />
111
111
  );
112
112
  expect(getByTestId('wp-loading')).toBeInTheDocument();
113
113
  expect(getByTestId('wp-placeholder')).toBeInTheDocument();
@@ -120,7 +120,7 @@ describe('OptaMatchStatsWinProbability', () => {
120
120
  error: 'Network error'
121
121
  });
122
122
  const { getByTestId } = render(
123
- <OptaMatchStatsWinProbability matchId="123" apiBaseUrl="/api" />
123
+ <OptaMatchStatsWinProbability match="123" apiBaseUrl="/api" />
124
124
  );
125
125
  expect(getByTestId('wp-error')).toHaveTextContent('No data found.');
126
126
  });
@@ -22,7 +22,7 @@ storiesOf(
22
22
  })
23
23
  .add('xG Group (error state – zero bars)', () => (
24
24
  <OptaMatchStatsXGGroup
25
- matchId="invalid-match"
25
+ match="invalid-match"
26
26
  apiBaseUrl="https://invalid.example.com"
27
27
  isApp={true}
28
28
  />
@@ -94,7 +94,7 @@ const formatValue = (value: number, isInteger: boolean): string =>
94
94
 
95
95
  export const OptaMatchStatsXG: React.FC<{
96
96
  feed?: MatchExpectedGoalsFeed;
97
- matchId?: string;
97
+ match?: string;
98
98
  apiBaseUrl?: string;
99
99
  title?: string;
100
100
  statKey?: string;
@@ -104,7 +104,7 @@ export const OptaMatchStatsXG: React.FC<{
104
104
  }> = React.memo(
105
105
  ({
106
106
  feed,
107
- matchId,
107
+ match,
108
108
  apiBaseUrl,
109
109
  title,
110
110
  statKey = 'expectedGoals',
@@ -113,8 +113,8 @@ export const OptaMatchStatsXG: React.FC<{
113
113
  isApp = false
114
114
  }) => {
115
115
  const fetchUrl =
116
- matchId && apiBaseUrl
117
- ? buildExpectedGoalsUrl(apiBaseUrl, matchId)
116
+ match && apiBaseUrl
117
+ ? buildExpectedGoalsUrl(apiBaseUrl, match)
118
118
  : undefined;
119
119
 
120
120
  // First fetch without polling to determine match status
@@ -31,7 +31,7 @@ const DEFAULT_XG_STATS: XGStatConfig[] = [
31
31
 
32
32
  export const OptaMatchStatsXGGroup: React.FC<{
33
33
  feed?: MatchExpectedGoalsFeed;
34
- matchId?: string;
34
+ match?: string;
35
35
  apiBaseUrl?: string;
36
36
  stats?: XGStatConfig[];
37
37
  homeColor?: TeamColor;
@@ -41,7 +41,7 @@ export const OptaMatchStatsXGGroup: React.FC<{
41
41
  }> = React.memo(
42
42
  ({
43
43
  feed,
44
- matchId,
44
+ match,
45
45
  apiBaseUrl,
46
46
  stats = DEFAULT_XG_STATS,
47
47
  homeColor = defaultHomeColor,
@@ -50,8 +50,8 @@ export const OptaMatchStatsXGGroup: React.FC<{
50
50
  hasBorder = false
51
51
  }) => {
52
52
  const fetchUrl =
53
- matchId && apiBaseUrl
54
- ? buildExpectedGoalsUrl(apiBaseUrl, matchId)
53
+ match && apiBaseUrl
54
+ ? buildExpectedGoalsUrl(apiBaseUrl, match)
55
55
  : undefined;
56
56
 
57
57
  const { data: fetchedFeed, loading, error } = useFetchFeed<
@@ -96,7 +96,7 @@ describe('OptaMatchStatsXGGroup – error state', () => {
96
96
 
97
97
  it('renders zero-value bars on error', () => {
98
98
  const { getAllByText } = render(
99
- <OptaMatchStatsXGGroup matchId="123" apiBaseUrl="/api" isApp />
99
+ <OptaMatchStatsXGGroup match="123" apiBaseUrl="/api" isApp />
100
100
  );
101
101
  const zeros = getAllByText('0');
102
102
  expect(zeros.length).toBeGreaterThanOrEqual(2);
@@ -104,7 +104,7 @@ describe('OptaMatchStatsXGGroup – error state', () => {
104
104
 
105
105
  it('renders all stat titles on error', () => {
106
106
  const { getByText } = render(
107
- <OptaMatchStatsXGGroup matchId="123" apiBaseUrl="/api" />
107
+ <OptaMatchStatsXGGroup match="123" apiBaseUrl="/api" />
108
108
  );
109
109
  expect(getByText('xG')).toBeInTheDocument();
110
110
  expect(getByText('xG from open play')).toBeInTheDocument();