fansunited-data-layer 0.0.13 → 0.0.14
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-DbaLZvqQ.cjs");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-DbaLZvqQ.cjs");function T(e){return{id:e.id,name:e.name,shortName:e.short_name??void 0,threeLetterCode:e.three_letter_code,slug:e.slug,type:e.type==="placeholder"?"club":e.type,gender:e.gender,country:e.country?{id:e.country.id,name:e.country.name,code:e.country.code??void 0,flag:e.country.assets?.flag?.url,providerRef:e.country.uuid}:void 0,assets:e.assets?{logo:e.assets.logo?.url,homeKit:e.assets.home_kit?.url,awayKit:e.assets.away_kit?.url,squadImage:e.assets.squad_image?.url}:void 0,providerRef:e.uuid}}async function y(e,n={}){const{sportal365Sports:l}=a.getConfig(),s=await a.footballHttp.get({path:`/v2/teams/${e}`,params:{language_code:n.languageCode??l?.languageCode??"en",optional_data:"form"},next:n.next});return T(s)}function M(e){return!e.seasons||e.seasons.length===0?void 0:e.seasons.find(l=>l.active)??e.seasons[0]}function w(e,n){const l=new Date,s=n.filter(o=>{const i=o.competitorOne.id===e||o.competitorTwo.id===e,c=o.status.type==="NOT_STARTED"||o.status.type==="LIVE",g=new Date(o.timing.kickoffTime)>=l||o.status.type==="LIVE";return i&&c&&g});return s.sort((o,i)=>new Date(o.timing.kickoffTime).getTime()-new Date(i.timing.kickoffTime).getTime()),s[0]}function D(e,n){const l=new Date,s=n.filter(o=>{const i=o.competitorOne.id===e||o.competitorTwo.id===e,c=o.status.type==="FINISHED",g=new Date(o.timing.kickoffTime)<=l;return i&&c&&g});return s.sort((o,i)=>new Date(i.timing.kickoffTime).getTime()-new Date(o.timing.kickoffTime).getTime()),s[0]}const v={championsLeague:"bg-blue-600",europaLeague:"bg-orange-600",conferenceLeague:"bg-green-600",promotion:"bg-green-500",playoff:"bg-yellow-500",relegation:"bg-red-600"};function C(e,n){const{columns:l,zoneColors:s=v,teamDecorator:o}=n??{},i={rank:{key:"rank",header:"#",align:"center",width:"xs"},team:{key:"team",header:"Team",align:"left",width:"flex"},played:{key:"played",header:"P",align:"center",width:"sm"},won:{key:"won",header:"W",align:"center",width:"sm"},drawn:{key:"drawn",header:"D",align:"center",width:"sm"},lost:{key:"lost",header:"L",align:"center",width:"sm"},goalsFor:{key:"goalsFor",header:"GF",align:"center",width:"sm"},goalsAgainst:{key:"goalsAgainst",header:"GA",align:"center",width:"sm"},goalDifference:{key:"goalDifference",header:"GD",align:"center",width:"sm"},points:{key:"points",header:"Pts",align:"center",width:"md",className:"font-bold"},form:{key:"form",header:"Form",align:"center",width:"lg"}},g=l??["rank","team","played","won","drawn","lost","goalsFor","goalsAgainst","goalDifference","points"],p=g.map(t=>i[t]),b=e.entries.map(t=>{let u;if(t.rules&&t.rules.length>0){const r=t.rules[0],h=e.metadata.legend.find(k=>k.key===r);h&&(u={color:s[r]??"bg-gray-500",label:h.name})}let d={name:t.competitor.name,logo:t.competitor.logo};o&&(d=o(d,t));const F={rank:t.rank,team:d,played:t.stats.played??"-",won:t.stats.won??"-",drawn:t.stats.drawn??"-",lost:t.stats.lost??"-",goalsFor:t.stats.goalsFor??"-",goalsAgainst:t.stats.goalsAgainst??"-",goalDifference:t.stats.goalDifference??"-",points:t.stats.points??"-",form:t.form??void 0},f={id:t.competitor.id,zone:u};for(const r of g)f[r]=F[r];return f}),m=e.metadata.legend.map(t=>({color:s[t.key]??"bg-gray-500",label:t.name}));return{columns:p,rows:b,legend:m.length>0?m:void 0}}exports.getConfig=a.getConfig;exports.getFootballCompetition=a.getFootballCompetition;exports.getFootballMatch=a.getFootballMatch;exports.getFootballMatchCommentary=a.getFootballMatchCommentary;exports.getFootballMatchEvents=a.getFootballMatchEvents;exports.getFootballMatchLineups=a.getFootballMatchLineups;exports.getFootballMatchOdds=a.getFootballMatchOdds;exports.getFootballMatchStatistics=a.getFootballMatchStatistics;exports.getFootballMatches=a.getFootballMatches;exports.getFootballSeasonDetails=a.getFootballSeasonDetails;exports.getFootballStandings=a.getFootballStandings;exports.isConfigured=a.isConfigured;exports.setConfig=a.setConfig;exports.getActiveSeason=M;exports.getFootballTeam=y;exports.getTeamNextMatch=w;exports.getTeamPreviousMatch=D;exports.standingsToStatsTable=C;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as y, f as
|
|
1
|
+
import { g as y, f as T } from "./index-D1EJvAqY.js";
|
|
2
2
|
import { k as x, a as E, h as O, b as N, c as R, d as I, e as K, j as P, l as G, m as U, i as q, s as z } from "./index-D1EJvAqY.js";
|
|
3
3
|
function w(e) {
|
|
4
4
|
return {
|
|
@@ -26,7 +26,7 @@ function w(e) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
async function v(e, s = {}) {
|
|
29
|
-
const { sportal365Sports: n } = y(), a = await
|
|
29
|
+
const { sportal365Sports: n } = y(), a = await T.get({
|
|
30
30
|
path: `/v2/teams/${e}`,
|
|
31
31
|
params: {
|
|
32
32
|
language_code: s.languageCode ?? n?.languageCode ?? "en",
|
|
@@ -53,16 +53,16 @@ function S(e, s) {
|
|
|
53
53
|
});
|
|
54
54
|
return a.sort((o, i) => new Date(i.timing.kickoffTime).getTime() - new Date(o.timing.kickoffTime).getTime()), a[0];
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
championsLeague: "
|
|
58
|
-
europaLeague: "
|
|
59
|
-
conferenceLeague: "
|
|
60
|
-
promotion: "
|
|
61
|
-
playoff: "
|
|
62
|
-
relegation: "
|
|
56
|
+
const F = {
|
|
57
|
+
championsLeague: "bg-blue-600",
|
|
58
|
+
europaLeague: "bg-orange-600",
|
|
59
|
+
conferenceLeague: "bg-green-600",
|
|
60
|
+
promotion: "bg-green-500",
|
|
61
|
+
playoff: "bg-yellow-500",
|
|
62
|
+
relegation: "bg-red-600"
|
|
63
63
|
};
|
|
64
64
|
function _(e, s) {
|
|
65
|
-
const { columns: n, zoneColors: a =
|
|
65
|
+
const { columns: n, zoneColors: a = F, teamDecorator: o } = s ?? {}, i = {
|
|
66
66
|
rank: { key: "rank", header: "#", align: "center", width: "xs" },
|
|
67
67
|
team: { key: "team", header: "Team", align: "left", width: "flex" },
|
|
68
68
|
played: { key: "played", header: "P", align: "center", width: "sm" },
|
|
@@ -88,20 +88,20 @@ function _(e, s) {
|
|
|
88
88
|
], p = l.map((t) => i[t]), h = e.entries.map((t) => {
|
|
89
89
|
let m;
|
|
90
90
|
if (t.rules && t.rules.length > 0) {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
color: a[
|
|
94
|
-
label:
|
|
91
|
+
const g = t.rules[0], f = e.metadata.legend.find((b) => b.key === g);
|
|
92
|
+
f && (m = {
|
|
93
|
+
color: a[g] ?? "bg-gray-500",
|
|
94
|
+
label: f.name
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
let
|
|
97
|
+
let c = {
|
|
98
98
|
name: t.competitor.name,
|
|
99
99
|
logo: t.competitor.logo
|
|
100
100
|
};
|
|
101
|
-
o && (
|
|
101
|
+
o && (c = o(c, t));
|
|
102
102
|
const k = {
|
|
103
103
|
rank: t.rank,
|
|
104
|
-
team:
|
|
104
|
+
team: c,
|
|
105
105
|
played: t.stats.played ?? "-",
|
|
106
106
|
won: t.stats.won ?? "-",
|
|
107
107
|
drawn: t.stats.drawn ?? "-",
|
|
@@ -111,15 +111,15 @@ function _(e, s) {
|
|
|
111
111
|
goalDifference: t.stats.goalDifference ?? "-",
|
|
112
112
|
points: t.stats.points ?? "-",
|
|
113
113
|
form: t.form ?? void 0
|
|
114
|
-
},
|
|
114
|
+
}, u = {
|
|
115
115
|
id: t.competitor.id,
|
|
116
116
|
zone: m
|
|
117
117
|
};
|
|
118
|
-
for (const
|
|
119
|
-
|
|
120
|
-
return
|
|
118
|
+
for (const g of l)
|
|
119
|
+
u[g] = k[g];
|
|
120
|
+
return u;
|
|
121
121
|
}), d = e.metadata.legend.map((t) => ({
|
|
122
|
-
color: a[t.key] ?? "
|
|
122
|
+
color: a[t.key] ?? "bg-gray-500",
|
|
123
123
|
label: t.name
|
|
124
124
|
}));
|
|
125
125
|
return {
|