@vixoniccom/footbal-score 1.4.0 → 1.4.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/build.zip CHANGED
Binary file
@@ -13,7 +13,7 @@ export const dataInputs = [
13
13
  { label: 'Euro Copa', value: '4' },
14
14
  { label: 'Copa Oro (Concacaf)', value: '22' },
15
15
  { label: 'Mundial de clubes', value: '15' },
16
- { label: 'Primera división Chile', value: '265' },
16
+ { label: 'Primera división Chile', value: '1220' },
17
17
  { label: 'Liga profesional Argentina', value: '128' },
18
18
  ],
19
19
  defaultValue: '9',
@@ -36,7 +36,7 @@
36
36
  },
37
37
  {
38
38
  "label": "Primera división Chile",
39
- "value": "265"
39
+ "value": "1220"
40
40
  },
41
41
  {
42
42
  "label": "Liga profesional Argentina",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixoniccom/footbal-score",
3
3
  "alias": "Resultados Deportivos",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "description": "Muestra resultados en vivo de fútbol.",
6
6
  "main": "main.js",
7
7
  "author": "",
package/src/App.tsx CHANGED
@@ -25,8 +25,13 @@ export const App: React.FunctionComponent<Props> = ({ data, start }) => {
25
25
  const timeNow = moment(timeNowFormat, 'h:mma')
26
26
  const startTime = moment(parameters.timeStart, 'h:mma')
27
27
  const endTime = moment(parameters.timeEnd, 'h:mma')
28
+ // When the end time is earlier than the start time the window crosses midnight,
29
+ // e.g. 10am-1am means [10am, midnight) plus [midnight, 1am)
30
+ const isWithinSchedule = endTime.isAfter(startTime)
31
+ ? timeNow.isBetween(startTime, endTime)
32
+ : timeNow.isSameOrAfter(startTime) || timeNow.isBefore(endTime)
28
33
 
29
- if (momentLocalStorage == undefined || (timeNow.isBetween(startTime, endTime) && momentLocalStorage > updateTime!)) {
34
+ if (momentLocalStorage == undefined || (isWithinSchedule && momentLocalStorage > updateTime!)) {
30
35
  const dataRequest = await getFixture(league, parameters.matchesYesterday, parameters.matchesTomorrow)
31
36
  setDataLocal(dataRequest)
32
37
  setDataFixture(dataRequest)
@@ -1,5 +1,6 @@
1
1
  import moment from 'moment'
2
2
  import axios from 'axios'
3
+ import { mockFixtures } from './mockFixtures'
3
4
 
4
5
  if (!process.env.FOOTBALL_API_KEY || !process.env.FOOTBALL_API_HOST || !process.env.FOOTBALL_API_URL)
5
6
  console.warn('Missing API credentials')
@@ -8,7 +9,11 @@ const FOOTBALL_API_HOST = process.env.FOOTBALL_API_HOST
8
9
  const FOOTBALL_API_URL = process.env.FOOTBALL_API_URL
9
10
  const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000
10
11
 
12
+ const USE_MOCK = false
13
+
11
14
  export const getFixture = async (league: string, yesterday?: boolean, tomorrow?: boolean) => {
15
+ if (USE_MOCK) return mockFixtures
16
+
12
17
  const today = moment().format('YYYY-MM-DD')
13
18
  const year = moment().format('YYYY')
14
19
  const from = yesterday ? moment(Date.now() - MILLISECONDS_PER_DAY).format('YYYY-MM-DD') : today
@@ -0,0 +1,74 @@
1
+ export const mockFixtures = [
2
+ {
3
+ fixture: { id: 979139, timestamp: 1671375600, status: { short: 'PEN' } },
4
+ teams: {
5
+ home: { name: 'Argentina', logo: 'https://media.api-sports.io/football/teams/26.png' },
6
+ away: { name: 'France', logo: 'https://media.api-sports.io/football/teams/2.png' },
7
+ },
8
+ goals: { home: 3, away: 3 },
9
+ score: { penalty: { home: 4, away: 2 } },
10
+ },
11
+ {
12
+ fixture: { id: 855737, timestamp: 1669111200, status: { short: 'FT' } },
13
+ teams: {
14
+ home: { name: 'Argentina', logo: 'https://media.api-sports.io/football/teams/26.png' },
15
+ away: { name: 'Saudi Arabia', logo: 'https://media.api-sports.io/football/teams/23.png' },
16
+ },
17
+ goals: { home: 1, away: 2 },
18
+ score: { penalty: { home: null, away: null } },
19
+ },
20
+ {
21
+ fixture: { id: 871850, timestamp: 1669143600, status: { short: 'FT' } },
22
+ teams: {
23
+ home: { name: 'France', logo: 'https://media.api-sports.io/football/teams/2.png' },
24
+ away: { name: 'Australia', logo: 'https://media.api-sports.io/football/teams/20.png' },
25
+ },
26
+ goals: { home: 4, away: 1 },
27
+ score: { penalty: { home: null, away: null } },
28
+ },
29
+ {
30
+ fixture: { id: 855741, timestamp: 1669208400, status: { short: 'FT' } },
31
+ teams: {
32
+ home: { name: 'Germany', logo: 'https://media.api-sports.io/football/teams/25.png' },
33
+ away: { name: 'Japan', logo: 'https://media.api-sports.io/football/teams/12.png' },
34
+ },
35
+ goals: { home: 1, away: 2 },
36
+ score: { penalty: { home: null, away: null } },
37
+ },
38
+ {
39
+ fixture: { id: 871851, timestamp: 1669219200, status: { short: 'FT' } },
40
+ teams: {
41
+ home: { name: 'Spain', logo: 'https://media.api-sports.io/football/teams/9.png' },
42
+ away: { name: 'Costa Rica', logo: 'https://media.api-sports.io/football/teams/29.png' },
43
+ },
44
+ goals: { home: 7, away: 0 },
45
+ score: { penalty: { home: null, away: null } },
46
+ },
47
+ {
48
+ fixture: { id: 855746, timestamp: 1669316400, status: { short: 'FT' } },
49
+ teams: {
50
+ home: { name: 'Brazil', logo: 'https://media.api-sports.io/football/teams/6.png' },
51
+ away: { name: 'Serbia', logo: 'https://media.api-sports.io/football/teams/14.png' },
52
+ },
53
+ goals: { home: 2, away: 0 },
54
+ score: { penalty: { home: null, away: null } },
55
+ },
56
+ {
57
+ fixture: { id: 855735, timestamp: 1669035600, status: { short: 'FT' } },
58
+ teams: {
59
+ home: { name: 'England', logo: 'https://media.api-sports.io/football/teams/10.png' },
60
+ away: { name: 'Iran', logo: 'https://media.api-sports.io/football/teams/22.png' },
61
+ },
62
+ goals: { home: 6, away: 2 },
63
+ score: { penalty: { home: null, away: null } },
64
+ },
65
+ {
66
+ fixture: { id: 855745, timestamp: 1669305600, status: { short: 'FT' } },
67
+ teams: {
68
+ home: { name: 'Portugal', logo: 'https://media.api-sports.io/football/teams/27.png' },
69
+ away: { name: 'Ghana', logo: 'https://media.api-sports.io/football/teams/1504.png' },
70
+ },
71
+ goals: { home: 3, away: 2 },
72
+ score: { penalty: { home: null, away: null } },
73
+ },
74
+ ]
@@ -1,115 +1,9 @@
1
1
  declare type VixonicData = {
2
2
  downloadsPath: string
3
- services: { [key: string]: { data?: any; updatedAt?: number } }
3
+ services: { [key: string]: { data?: any, updatedAt?: number } }
4
4
  parameters: VixonicParameters
5
5
  }
6
6
 
7
7
  declare type VixonicParameters = Partial<{
8
- league: '1' | '9' | '4' | '22' | '15' | '265' | '128'
9
- matchesYesterday: boolean
10
- matchesTomorrow: boolean
11
- timeStart:
12
- | '12m'
13
- | '1m'
14
- | '2m'
15
- | '3m'
16
- | '4m'
17
- | '5m'
18
- | '6m'
19
- | '7m'
20
- | '8m'
21
- | '9m'
22
- | '10m'
23
- | '11m'
24
- | '12pm'
25
- | '1pm'
26
- | '2pm'
27
- | '3pm'
28
- | '4pm'
29
- | '5pm'
30
- | '6pm'
31
- | '7pm'
32
- | '8pm'
33
- | '9pm'
34
- | '10pm'
35
- | '11pm'
36
- timeEnd:
37
- | '12m'
38
- | '1m'
39
- | '2m'
40
- | '3m'
41
- | '4m'
42
- | '5m'
43
- | '6m'
44
- | '7m'
45
- | '8m'
46
- | '9m'
47
- | '10m'
48
- | '11m'
49
- | '12pm'
50
- | '1pm'
51
- | '2pm'
52
- | '3pm'
53
- | '4pm'
54
- | '5pm'
55
- | '6pm'
56
- | '7pm'
57
- | '8pm'
58
- | '9pm'
59
- | '10pm'
60
- | '11pm'
61
- updateTime: 300000 | 600000 | 1800000 | 3600000 | 21600000 | 43200000 | 86400000
62
- titleEnabled: boolean
63
- title0: string
64
- titleFormat: {
65
- fontSize?: number
66
- fontColor?: string
67
- alignment?: { horizontal?: 'left' | 'right' | 'center' }
68
- font?: { filename: string; id: string; __isAsset: true }
69
- }
70
- msj0: string
71
- formatMjs: {
72
- fontSize?: number
73
- fontColor?: string
74
- alignment?: { horizontal?: 'left' | 'right' | 'center' }
75
- font?: { filename: string; id: string; __isAsset: true }
76
- }
77
- alignVerticalMsj: 'flex-start' | 'center' | 'flex-end'
78
- itemsPerPage: number
79
- durationPerPage: number
80
- backgroundImage: { id?: string; filename?: string; extension?: string }
81
- padding: string
82
- columnGap: string
83
- rowGap: string
84
- timeFormat: {
85
- fontSize?: number
86
- fontColor?: string
87
- alignment?: { horizontal?: 'left' | 'right' | 'center' }
88
- font?: { filename: string; id: string; __isAsset: true }
89
- }
90
- widthTime: string
91
- statusFormat: {
92
- fontSize?: number
93
- fontColor?: string
94
- alignment?: { horizontal?: 'left' | 'right' | 'center' }
95
- font?: { filename: string; id: string; __isAsset: true }
96
- }
97
- widthStatus: string
98
- goalsFormat: {
99
- fontSize?: number
100
- fontColor?: string
101
- alignment?: { horizontal?: 'left' | 'right' | 'center' }
102
- font?: { filename: string; id: string; __isAsset: true }
103
- }
104
- widthScore: string
105
- descriptionEnabled: boolean
106
- descriptionFormat: {
107
- fontSize?: number
108
- fontColor?: string
109
- alignment?: { horizontal?: 'left' | 'right' | 'center' }
110
- font?: { filename: string; id: string; __isAsset: true }
111
- }
112
- widthDescription: string
113
- imageSize: number
114
- widthImage: string
115
- }>
8
+ league: '1' | '9' | '4' | '22' | '15' | '1220' | '128' | '265', matchesYesterday: boolean, matchesTomorrow: boolean, timeStart: '12m' | '1m' | '2m' | '3m' | '4m' | '5m' | '6m' | '7m' | '8m' | '9m' | '10m' | '11m' | '12pm' | '1pm' | '2pm' | '3pm' | '4pm' | '5pm' | '6pm' | '7pm' | '8pm' | '9pm' | '10pm' | '11pm', timeEnd: '12m' | '1m' | '2m' | '3m' | '4m' | '5m' | '6m' | '7m' | '8m' | '9m' | '10m' | '11m' | '12pm' | '1pm' | '2pm' | '3pm' | '4pm' | '5pm' | '6pm' | '7pm' | '8pm' | '9pm' | '10pm' | '11pm', updateTime: 300000 | 600000 | 1800000 | 3600000 | 21600000 | 43200000 | 86400000, titleEnabled: boolean, title0: string, titleFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, msj0: string, formatMjs: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, alignVerticalMsj: 'flex-start' | 'center' | 'flex-end', itemsPerPage: number, durationPerPage: number, backgroundImage: {id?: string, filename?: string, extension?: string}, padding: string, columnGap: string, rowGap: string, timeFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, widthTime: string, statusFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, widthStatus: string, goalsFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, widthScore: string, descriptionEnabled: boolean, descriptionFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, widthDescription: string, imageSize: number, widthImage: string
9
+ }>