fansunited-data-layer 0.0.10 → 0.0.11
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/dist/api/sportal365-sports/football/competitions/utils.d.ts.map +1 -1
- package/dist/api/sportal365-sports/football/matches/transformers/lineup.d.ts.map +1 -1
- package/dist/api/sportal365-sports/football/matches/transformers/match.d.ts.map +1 -1
- package/dist/api/sportal365-sports/football/standings/index.d.ts.map +1 -1
- package/dist/api/sportal365-sports/football/teams/utils.d.ts.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/fansunited-data-layer.cjs +1 -1
- package/dist/fansunited-data-layer.js +134 -58
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/standings.helpers.d.ts +70 -0
- package/dist/helpers/standings.helpers.d.ts.map +1 -0
- package/dist/index-BKakLA9I.js +825 -0
- package/dist/index-BUOIeK50.cjs +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/types/canonical/base.types.d.ts +9 -0
- package/dist/types/canonical/base.types.d.ts.map +1 -1
- package/dist/types/canonical/match.types.d.ts +3 -0
- package/dist/types/canonical/match.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-4gbkCyy3.cjs +0 -1
- package/dist/index-C8byrMrI.js +0 -806
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/competitions/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACR,mBAAmB,EACnB,qBAAqB,EAGxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACR,qBAAqB,EACrB,wBAAwB,EAE3B,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/competitions/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACR,mBAAmB,EACnB,qBAAqB,EAGxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACR,qBAAqB,EACrB,wBAAwB,EAE3B,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,mBAAmB,CA4BpF;AAiCD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,wBAAwB,GAAG,qBAAqB,CAoC3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineup.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/api/sportal365-sports/football/matches/transformers/lineup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACR,oBAAoB,EAIvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAuC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"lineup.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/api/sportal365-sports/football/matches/transformers/lineup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACR,oBAAoB,EAIvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAuC,MAAM,UAAU,CAAC;AA+ErF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB,CAO3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/api/sportal365-sports/football/matches/transformers/match.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACR,aAAa,EAUhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/api/sportal365-sports/football/matches/transformers/match.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACR,aAAa,EAUhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAC;AA0L1D;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa,CA+C3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/standings/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,KAAK,EAAwB,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAI1F,YAAY,EACR,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/standings/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,KAAK,EAAwB,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAI1F,YAAY,EACR,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA2B3G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/teams/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/teams/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,kBAAkB,CA4BrE"}
|
package/dist/client.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),N=require("./index-
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),N=require("./index-BUOIeK50.cjs");var G={exports:{}},D={};var Q;function re(){if(Q)return D;Q=1;var l=Symbol.for("react.transitional.element"),b=Symbol.for("react.fragment");function E(v,u,f){var k=null;if(f!==void 0&&(k=""+f),u.key!==void 0&&(k=""+u.key),"key"in u){f={};for(var d in u)d!=="key"&&(f[d]=u[d])}else f=u;return u=f.ref,{$$typeof:l,type:v,key:k,ref:u!==void 0?u:null,props:f}}return D.Fragment=b,D.jsx=E,D.jsxs=E,D}var M={};var K;function ne(){return K||(K=1,process.env.NODE_ENV!=="production"&&(function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===z?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c:return"Fragment";case g:return"Profiler";case U:return"StrictMode";case V:return"Suspense";case X:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case L:return"Portal";case q:return e.displayName||"Context";case W:return(e._context.displayName||"Context")+".Consumer";case I:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case h:return n=e.displayName||null,n!==null?n:l(e.type)||"Memo";case C:n=e._payload,e=e._init;try{return l(e(n))}catch{}}return null}function b(e){return""+e}function E(e){try{b(e);var n=!1}catch{n=!0}if(n){n=console;var s=n.error,t=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),b(e)}}function v(e){if(e===c)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var n=l(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function u(){var e=S.A;return e===null?null:e.getOwner()}function f(){return Error("react-stack-top-frame")}function k(e){if(O.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function d(e,n){function s(){R||(R=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}function F(){var e=l(this.type);return y[e]||(y[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Y(e,n,s,t,r,i){var a=s.ref;return e={$$typeof:m,type:e,key:n,props:s,_owner:t},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:F}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:r}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function w(e,n,s,t,r,i){var a=n.children;if(a!==void 0)if(t)if(B(a)){for(t=0;t<a.length;t++)$(a[t]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else $(a);if(O.call(n,"key")){a=l(e);var T=Object.keys(n).filter(function(te){return te!=="key"});t=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",j[a+t]||(T=0<T.length?"{"+T.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import oe, { createContext as ae, useContext as se, useState as S, useEffect as y, useCallback as u, useMemo as ie } from "react";
|
|
3
|
-
import { j as ce, m as le, k as ue, l as Q } from "./index-
|
|
3
|
+
import { j as ce, m as le, k as ue, l as Q } from "./index-BKakLA9I.js";
|
|
4
4
|
var X = { exports: {} }, M = {};
|
|
5
5
|
var K;
|
|
6
6
|
function fe() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-BUOIeK50.cjs");function b(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:i}=a.getConfig(),s=await a.footballHttp.get({path:`/v2/teams/${e}`,params:{language_code:n.languageCode??i?.languageCode??"en",optional_data:"form"},next:n.next});return b(s)}function M(e){return!e.seasons||e.seasons.length===0?void 0:e.seasons.find(i=>i.active)??e.seasons[0]}function D(e,n){const i=new Date,s=n.filter(o=>{const l=o.competitorOne.id===e||o.competitorTwo.id===e,r=o.status.type==="NOT_STARTED"||o.status.type==="LIVE",g=new Date(o.timing.kickoffTime)>=i||o.status.type==="LIVE";return l&&r&&g});return s.sort((o,l)=>new Date(o.timing.kickoffTime).getTime()-new Date(l.timing.kickoffTime).getTime()),s[0]}function w(e,n){const i=new Date,s=n.filter(o=>{const l=o.competitorOne.id===e||o.competitorTwo.id===e,r=o.status.type==="FINISHED",g=new Date(o.timing.kickoffTime)<=i;return l&&r&&g});return s.sort((o,l)=>new Date(l.timing.kickoffTime).getTime()-new Date(o.timing.kickoffTime).getTime()),s[0]}const C={championsLeague:"#0066cc",europaLeague:"#ff6600",conferenceLeague:"#009933",promotion:"#00cc66",playoff:"#ffcc00",relegation:"#cc0000"};function v(e,n){const{columns:i,zoneColors:s=C,teamDecorator:o}=n??{},l={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=i??["rank","team","played","won","drawn","lost","goalsFor","goalsAgainst","goalDifference","points"],p=g.map(t=>l[t]),F=e.entries.map(t=>{let u;if(t.rules&&t.rules.length>0){const c=t.rules[0],h=e.metadata.legend.find(T=>T.key===c);h&&(u={color:s[c]??"#999999",label:h.name})}let d={name:t.competitor.name,logo:t.competitor.logo};o&&(d=o(d,t));const k={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?.formString??"-"},f={id:t.competitor.id,zone:u};for(const c of g)f[c]=k[c];return f}),m=e.metadata.legend.map(t=>({color:s[t.key]??"#999999",label:t.name}));return{columns:p,rows:F,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=D;exports.getTeamPreviousMatch=w;exports.standingsToStatsTable=v;
|
|
@@ -1,74 +1,150 @@
|
|
|
1
|
-
import { g, f as
|
|
2
|
-
import { k, a as
|
|
3
|
-
function
|
|
1
|
+
import { g as y, f as F } from "./index-BKakLA9I.js";
|
|
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-BKakLA9I.js";
|
|
3
|
+
function w(e) {
|
|
4
4
|
return {
|
|
5
|
-
id:
|
|
6
|
-
name:
|
|
7
|
-
shortName:
|
|
8
|
-
threeLetterCode:
|
|
9
|
-
slug:
|
|
10
|
-
type:
|
|
11
|
-
gender:
|
|
12
|
-
country:
|
|
13
|
-
id:
|
|
14
|
-
name:
|
|
15
|
-
code:
|
|
16
|
-
flag:
|
|
5
|
+
id: e.id,
|
|
6
|
+
name: e.name,
|
|
7
|
+
shortName: e.short_name ?? void 0,
|
|
8
|
+
threeLetterCode: e.three_letter_code,
|
|
9
|
+
slug: e.slug,
|
|
10
|
+
type: e.type === "placeholder" ? "club" : e.type,
|
|
11
|
+
gender: e.gender,
|
|
12
|
+
country: e.country ? {
|
|
13
|
+
id: e.country.id,
|
|
14
|
+
name: e.country.name,
|
|
15
|
+
code: e.country.code ?? void 0,
|
|
16
|
+
flag: e.country.assets?.flag?.url,
|
|
17
|
+
providerRef: e.country.uuid
|
|
17
18
|
} : void 0,
|
|
18
|
-
assets:
|
|
19
|
-
logo:
|
|
20
|
-
homeKit:
|
|
21
|
-
awayKit:
|
|
22
|
-
squadImage:
|
|
23
|
-
} : void 0
|
|
19
|
+
assets: e.assets ? {
|
|
20
|
+
logo: e.assets.logo?.url,
|
|
21
|
+
homeKit: e.assets.home_kit?.url,
|
|
22
|
+
awayKit: e.assets.away_kit?.url,
|
|
23
|
+
squadImage: e.assets.squad_image?.url
|
|
24
|
+
} : void 0,
|
|
25
|
+
providerRef: e.uuid
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
async function
|
|
27
|
-
const { sportal365Sports:
|
|
28
|
-
path: `/v2/teams/${
|
|
28
|
+
async function v(e, s = {}) {
|
|
29
|
+
const { sportal365Sports: n } = y(), a = await F.get({
|
|
30
|
+
path: `/v2/teams/${e}`,
|
|
29
31
|
params: {
|
|
30
|
-
language_code:
|
|
32
|
+
language_code: s.languageCode ?? n?.languageCode ?? "en",
|
|
31
33
|
optional_data: "form"
|
|
32
34
|
},
|
|
33
|
-
next:
|
|
35
|
+
next: s.next
|
|
34
36
|
});
|
|
35
|
-
return
|
|
37
|
+
return w(a);
|
|
36
38
|
}
|
|
37
|
-
function
|
|
38
|
-
return !
|
|
39
|
+
function C(e) {
|
|
40
|
+
return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((n) => n.active) ?? e.seasons[0];
|
|
39
41
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
return
|
|
42
|
+
function M(e, s) {
|
|
43
|
+
const n = /* @__PURE__ */ new Date(), a = s.filter((o) => {
|
|
44
|
+
const i = o.competitorOne.id === e || o.competitorTwo.id === e, r = o.status.type === "NOT_STARTED" || o.status.type === "LIVE", l = new Date(o.timing.kickoffTime) >= n || o.status.type === "LIVE";
|
|
45
|
+
return i && r && l;
|
|
44
46
|
});
|
|
45
|
-
return
|
|
47
|
+
return a.sort((o, i) => new Date(o.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), a[0];
|
|
46
48
|
}
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
return
|
|
49
|
+
function S(e, s) {
|
|
50
|
+
const n = /* @__PURE__ */ new Date(), a = s.filter((o) => {
|
|
51
|
+
const i = o.competitorOne.id === e || o.competitorTwo.id === e, r = o.status.type === "FINISHED", l = new Date(o.timing.kickoffTime) <= n;
|
|
52
|
+
return i && r && l;
|
|
51
53
|
});
|
|
52
|
-
return
|
|
54
|
+
return a.sort((o, i) => new Date(i.timing.kickoffTime).getTime() - new Date(o.timing.kickoffTime).getTime()), a[0];
|
|
55
|
+
}
|
|
56
|
+
const D = {
|
|
57
|
+
championsLeague: "#0066cc",
|
|
58
|
+
europaLeague: "#ff6600",
|
|
59
|
+
conferenceLeague: "#009933",
|
|
60
|
+
promotion: "#00cc66",
|
|
61
|
+
playoff: "#ffcc00",
|
|
62
|
+
relegation: "#cc0000"
|
|
63
|
+
};
|
|
64
|
+
function _(e, s) {
|
|
65
|
+
const { columns: n, zoneColors: a = D, teamDecorator: o } = s ?? {}, i = {
|
|
66
|
+
rank: { key: "rank", header: "#", align: "center", width: "xs" },
|
|
67
|
+
team: { key: "team", header: "Team", align: "left", width: "flex" },
|
|
68
|
+
played: { key: "played", header: "P", align: "center", width: "sm" },
|
|
69
|
+
won: { key: "won", header: "W", align: "center", width: "sm" },
|
|
70
|
+
drawn: { key: "drawn", header: "D", align: "center", width: "sm" },
|
|
71
|
+
lost: { key: "lost", header: "L", align: "center", width: "sm" },
|
|
72
|
+
goalsFor: { key: "goalsFor", header: "GF", align: "center", width: "sm" },
|
|
73
|
+
goalsAgainst: { key: "goalsAgainst", header: "GA", align: "center", width: "sm" },
|
|
74
|
+
goalDifference: { key: "goalDifference", header: "GD", align: "center", width: "sm" },
|
|
75
|
+
points: { key: "points", header: "Pts", align: "center", width: "md", className: "font-bold" },
|
|
76
|
+
form: { key: "form", header: "Form", align: "center", width: "lg" }
|
|
77
|
+
}, l = n ?? [
|
|
78
|
+
"rank",
|
|
79
|
+
"team",
|
|
80
|
+
"played",
|
|
81
|
+
"won",
|
|
82
|
+
"drawn",
|
|
83
|
+
"lost",
|
|
84
|
+
"goalsFor",
|
|
85
|
+
"goalsAgainst",
|
|
86
|
+
"goalDifference",
|
|
87
|
+
"points"
|
|
88
|
+
], p = l.map((t) => i[t]), h = e.entries.map((t) => {
|
|
89
|
+
let m;
|
|
90
|
+
if (t.rules && t.rules.length > 0) {
|
|
91
|
+
const c = t.rules[0], u = e.metadata.legend.find((T) => T.key === c);
|
|
92
|
+
u && (m = {
|
|
93
|
+
color: a[c] ?? "#999999",
|
|
94
|
+
label: u.name
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
let g = {
|
|
98
|
+
name: t.competitor.name,
|
|
99
|
+
logo: t.competitor.logo
|
|
100
|
+
};
|
|
101
|
+
o && (g = o(g, t));
|
|
102
|
+
const k = {
|
|
103
|
+
rank: t.rank,
|
|
104
|
+
team: g,
|
|
105
|
+
played: t.stats.played ?? "-",
|
|
106
|
+
won: t.stats.won ?? "-",
|
|
107
|
+
drawn: t.stats.drawn ?? "-",
|
|
108
|
+
lost: t.stats.lost ?? "-",
|
|
109
|
+
goalsFor: t.stats.goalsFor ?? "-",
|
|
110
|
+
goalsAgainst: t.stats.goalsAgainst ?? "-",
|
|
111
|
+
goalDifference: t.stats.goalDifference ?? "-",
|
|
112
|
+
points: t.stats.points ?? "-",
|
|
113
|
+
form: t.form?.formString ?? "-"
|
|
114
|
+
}, f = {
|
|
115
|
+
id: t.competitor.id,
|
|
116
|
+
zone: m
|
|
117
|
+
};
|
|
118
|
+
for (const c of l)
|
|
119
|
+
f[c] = k[c];
|
|
120
|
+
return f;
|
|
121
|
+
}), d = e.metadata.legend.map((t) => ({
|
|
122
|
+
color: a[t.key] ?? "#999999",
|
|
123
|
+
label: t.name
|
|
124
|
+
}));
|
|
125
|
+
return {
|
|
126
|
+
columns: p,
|
|
127
|
+
rows: h,
|
|
128
|
+
legend: d.length > 0 ? d : void 0
|
|
129
|
+
};
|
|
53
130
|
}
|
|
54
|
-
const T = "0.0.2";
|
|
55
131
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
132
|
+
C as getActiveSeason,
|
|
133
|
+
y as getConfig,
|
|
134
|
+
x as getFootballCompetition,
|
|
135
|
+
E as getFootballMatch,
|
|
136
|
+
O as getFootballMatchCommentary,
|
|
137
|
+
N as getFootballMatchEvents,
|
|
138
|
+
R as getFootballMatchLineups,
|
|
139
|
+
I as getFootballMatchOdds,
|
|
140
|
+
K as getFootballMatchStatistics,
|
|
141
|
+
P as getFootballMatches,
|
|
142
|
+
G as getFootballSeasonDetails,
|
|
143
|
+
U as getFootballStandings,
|
|
144
|
+
v as getFootballTeam,
|
|
145
|
+
M as getTeamNextMatch,
|
|
146
|
+
S as getTeamPreviousMatch,
|
|
147
|
+
q as isConfigured,
|
|
148
|
+
z as setConfig,
|
|
149
|
+
_ as standingsToStatsTable
|
|
74
150
|
};
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { getActiveSeason } from "./competition.helpers";
|
|
5
5
|
export { getTeamNextMatch, getTeamPreviousMatch } from "./team.helpers";
|
|
6
|
+
export { standingsToStatsTable, type StatsTableData, type StandingsColumnKey, type StatsTableTeam, } from "./standings.helpers";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/helpers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/helpers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EACH,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACtB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standings helper functions
|
|
3
|
+
*/
|
|
4
|
+
import type { FUSportsStandings, FUSportsStandingEntry } from "../types/canonical";
|
|
5
|
+
import type { StatsTableColumn, StatsTableRow, StatsTableLegendItem } from "fansunited-sports-ui";
|
|
6
|
+
/**
|
|
7
|
+
* Stats table data structure (subset of StatsTableProps from fansunited-sports-ui)
|
|
8
|
+
*/
|
|
9
|
+
export interface StatsTableData {
|
|
10
|
+
columns: StatsTableColumn[];
|
|
11
|
+
rows: StatsTableRow[];
|
|
12
|
+
legend?: StatsTableLegendItem[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Available column keys for standings table
|
|
16
|
+
*/
|
|
17
|
+
export type StandingsColumnKey = "rank" | "team" | "played" | "won" | "drawn" | "lost" | "goalsFor" | "goalsAgainst" | "goalDifference" | "points" | "form";
|
|
18
|
+
/**
|
|
19
|
+
* Team data structure in table rows
|
|
20
|
+
*/
|
|
21
|
+
export interface StatsTableTeam {
|
|
22
|
+
name: string;
|
|
23
|
+
logo?: string;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Transform FUSportsStandings to StatsTable data structure
|
|
28
|
+
*
|
|
29
|
+
* Converts canonical standings data into a format ready for the StatsTable component
|
|
30
|
+
* from fansunited-sports-ui. Includes columns, rows, and legend data.
|
|
31
|
+
*
|
|
32
|
+
* @param standings - The canonical standings data
|
|
33
|
+
* @param options - Optional configuration for the transformation
|
|
34
|
+
* @returns StatsTableData ready to be passed to the StatsTable component
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Full table (all columns)
|
|
39
|
+
* const standings = await getFootballStandings({ stageId: '123' });
|
|
40
|
+
* const tableData = standingsToStatsTable(standings);
|
|
41
|
+
*
|
|
42
|
+
* // Compact table (selected columns only)
|
|
43
|
+
* const compactData = standingsToStatsTable(standings, {
|
|
44
|
+
* columns: ['rank', 'team', 'points']
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // With form column
|
|
48
|
+
* const withForm = standingsToStatsTable(standings, {
|
|
49
|
+
* columns: ['rank', 'team', 'played', 'won', 'points', 'form']
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // With team decorator (add custom fields)
|
|
53
|
+
* const decorated = standingsToStatsTable(standings, {
|
|
54
|
+
* teamDecorator: (team, entry) => ({
|
|
55
|
+
* ...team,
|
|
56
|
+
* customLogo: `/logos/${entry.competitor.id}.png`,
|
|
57
|
+
* isHighlighted: entry.rank <= 4
|
|
58
|
+
* })
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function standingsToStatsTable(standings: FUSportsStandings, options?: {
|
|
63
|
+
/** Array of column keys to include (defaults to all columns) */
|
|
64
|
+
columns?: StandingsColumnKey[];
|
|
65
|
+
/** Custom zone colors (overrides defaults) */
|
|
66
|
+
zoneColors?: Record<string, string>;
|
|
67
|
+
/** Function to decorate/transform team data */
|
|
68
|
+
teamDecorator?: (team: StatsTableTeam, entry: FUSportsStandingEntry) => StatsTableTeam;
|
|
69
|
+
}): StatsTableData;
|
|
70
|
+
//# sourceMappingURL=standings.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standings.helpers.d.ts","sourceRoot":"","sources":["../../src/lib/helpers/standings.helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GACxB,MAAM,GACN,MAAM,GACN,QAAQ,GACR,KAAK,GACL,OAAO,GACP,MAAM,GACN,UAAU,GACV,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,MAAM,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,iBAAiB,EAC5B,OAAO,CAAC,EAAE;IACN,gEAAgE;IAChE,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,+CAA+C;IAC/C,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,qBAAqB,KAAK,cAAc,CAAC;CAC1F,GACF,cAAc,CAsGhB"}
|