fansunited-data-layer 0.0.2 → 0.0.4
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/README.md +70 -2
- package/dist/api/sportal365-sports/constants.d.ts +14 -0
- package/dist/api/sportal365-sports/constants.d.ts.map +1 -0
- package/dist/api/sportal365-sports/football/http.d.ts +8 -0
- package/dist/api/sportal365-sports/football/http.d.ts.map +1 -0
- package/dist/api/sportal365-sports/football/index.d.ts +2 -2
- package/dist/api/sportal365-sports/football/index.d.ts.map +1 -1
- package/dist/api/sportal365-sports/football/matches/index.d.ts +36 -2
- package/dist/api/sportal365-sports/football/matches/index.d.ts.map +1 -1
- package/dist/api/sportal365-sports/football/matches/types/index.d.ts +1 -1
- package/dist/api/sportal365-sports/football/matches/types/index.d.ts.map +1 -1
- package/dist/api/sportal365-sports/football/matches/types/option.types.d.ts +61 -0
- package/dist/api/sportal365-sports/football/matches/types/option.types.d.ts.map +1 -1
- package/dist/api/sportal365-sports/http.d.ts +29 -11
- package/dist/api/sportal365-sports/http.d.ts.map +1 -1
- package/dist/api/sportal365-sports/index.d.ts +2 -2
- package/dist/api/sportal365-sports/index.d.ts.map +1 -1
- package/dist/config/types.d.ts +0 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/fansunited-data-layer.js +1619 -363
- package/dist/fansunited-data-layer.umd.cjs +6 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/use-cases/index.d.ts +13 -0
- package/dist/use-cases/index.d.ts.map +1 -0
- package/dist/use-cases/mappers/index.d.ts +7 -0
- package/dist/use-cases/mappers/index.d.ts.map +1 -0
- package/dist/use-cases/mappers/matchMappers.d.ts +45 -0
- package/dist/use-cases/mappers/matchMappers.d.ts.map +1 -0
- package/dist/use-cases/match/index.d.ts +14 -0
- package/dist/use-cases/match/index.d.ts.map +1 -0
- package/dist/use-cases/match/prepareMatchList.server.d.ts +53 -0
- package/dist/use-cases/match/prepareMatchList.server.d.ts.map +1 -0
- package/dist/use-cases/match/prepareMatchScore.server.d.ts +33 -0
- package/dist/use-cases/match/prepareMatchScore.server.d.ts.map +1 -0
- package/dist/use-cases/match/usePrepareMatchList.d.ts +20 -0
- package/dist/use-cases/match/usePrepareMatchList.d.ts.map +1 -0
- package/dist/use-cases/match/usePrepareMatchScore.d.ts +31 -0
- package/dist/use-cases/match/usePrepareMatchScore.d.ts.map +1 -0
- package/dist/use-cases/team/index.d.ts +10 -0
- package/dist/use-cases/team/index.d.ts.map +1 -0
- package/dist/use-cases/team/prepareTeamMatches.server.d.ts +56 -0
- package/dist/use-cases/team/prepareTeamMatches.server.d.ts.map +1 -0
- package/dist/use-cases/team/usePrepareTeamMatches.d.ts +26 -0
- package/dist/use-cases/team/usePrepareTeamMatches.d.ts.map +1 -0
- package/dist/use-cases/types.d.ts +8 -0
- package/dist/use-cases/types.d.ts.map +1 -0
- package/package.json +5 -1
|
@@ -1 +1,6 @@
|
|
|
1
|
-
(function(s,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(s=typeof globalThis<"u"?globalThis:s||self,d(s.FansUnitedDataLayer={}))})(this,(function(s){"use strict";let d=null;function h(t){d=t}function a(){if(!d)throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");return d}function y(){return d!==null}function E(){const{sportal365Sports:t}=a();if(!t)throw new Error("Sportal365 Sports API configuration is missing");const e=`${t.username}:${t.password}`;return`Basic ${btoa(e)}`}function T(t){const{sportal365Sports:e}=a();if(!e)throw new Error("Sportal365 Sports API configuration is missing");return`${e.domain.replace(/\/$/,"")}${t}`}async function c(t){const{sportal365Sports:e}=a();if(!e)throw new Error("Sportal365 Sports API configuration is missing");const o=new URL(T(t.path));if(t.params)for(const[r,u]of Object.entries(t.params))u!==void 0&&(Array.isArray(u)?u.length>0&&o.searchParams.set(r,u.join(",")):o.searchParams.set(r,u));const n=await fetch(o.toString(),{method:"GET",headers:{Authorization:E(),"Content-Type":"application/json","X-Project-Id":e.projectId},signal:e.timeout?AbortSignal.timeout(e.timeout):void 0});if(!n.ok)throw new Error(`Sportal365 API error: ${n.status} ${n.statusText}`);return n.json()}function m(t){if(t)return{id:t.id,name:t.name,slug:t.slug,position:t.position,gender:t.gender,assets:t.assets?{photo:t.assets.thumb?.url,photoTransparent:t.assets.thumb_transparent_background?.url}:void 0}}const S={GOAL:"GOAL",PENALTY_GOAL:"PENALTY_GOAL",OWN_GOAL:"OWN_GOAL",DISALLOWED_GOAL:"DISALLOWED_GOAL",PENALTY_SHOOTOUT_SCORED:"PENALTY_SHOOTOUT_SCORED",PENALTY_SHOOTOUT_MISSED:"PENALTY_SHOOTOUT_MISSED",YELLOW_CARD:"YELLOW_CARD",RED_CARD:"RED_CARD",YELLOW_RED_CARD:"YELLOW_RED_CARD",SUBSTITUTION:"SUBSTITUTION",KICKOFF:"KICKOFF",HALFTIME:"HALFTIME",START_SECOND_HALF:"START_SECOND_HALF",FINISHED:"FINISHED",INJURY_TIME:"INJURY_TIME",PENALTY_AWARDED:"PENALTY_AWARDED",PENALTY_MISSED:"PENALTY_MISSED",PENALTY_SAVED:"PENALTY_SAVED"};function l(t){const e=S[t.type_code];return e?{id:t.id,type:e,competitorPosition:t.team_position==="HOME"?"ONE":"TWO",minute:t.minute,injuryMinute:t.injury_minute,primaryPlayer:m(t.primary_player),secondaryPlayer:m(t.secondary_player),score:t.score?{competitorOne:String(t.score.home),competitorTwo:String(t.score.away)}:void 0}:(console.warn(`Unknown event type: ${t.type_code}`),null)}function v(t){return{code:{FINISHED:"finished",NOT_STARTED:"not_started",LIVE:"live",INTERRUPTED:"interrupted",CANCELLED:"cancelled",POSTPONED:"postponed",UNKNOWN:"not_started",ABANDONED:"abandoned"}[t.type]??"not_started",name:t.name,shortName:t.short_name,type:t.type}}function p(t){return{id:t.id,name:t.name,shortName:t.short_name??void 0,threeLetterCode:t.three_letter_code,slug:t.slug,type:t.type??"club",gender:t.gender,assets:t.assets?{logo:t.assets.logo?.url,homeKit:t.assets.home_kit?.url,awayKit:t.assets.away_kit?.url,squadImage:t.assets.squad_image?.url}:void 0,metadata:t.shirt_color?{shirtColor:t.shirt_color}:void 0}}function O(t){return{kickoffTime:new Date(t.kickoff_time),currentMinute:t.minute?.regular_time,phaseStartedAt:t.phase_started_at?new Date(t.phase_started_at):void 0,finishedAt:t.finished_at?new Date(t.finished_at):void 0,firstHalfStartedAt:t.first_half_started_at?new Date(t.first_half_started_at):void 0,secondHalfStartedAt:t.second_half_started_at?new Date(t.second_half_started_at):void 0,extraTimeFirstHalfStartedAt:t.extra_time_first_half_started_at?new Date(t.extra_time_first_half_started_at):void 0,extraTimeSecondHalfStartedAt:t.extra_time_second_half_started_at?new Date(t.extra_time_second_half_started_at):void 0}}function A(t){if(!t)return;const e=n=>n?{competitorOne:String(n.home),competitorTwo:String(n.away)}:void 0,o=t.total??t.regular_time;return{competitorOne:o?.home!=null?String(o.home):null,competitorTwo:o?.away!=null?String(o.away):null,breakdown:{total:e(t.total),halfTime:e(t.half_time),regularTime:e(t.regular_time),extraTime:e(t.extra_time),penaltyShootout:e(t.penalty_shootout),aggregate:e(t.aggregate)}}}function b(t){if(t)return{id:t.id,name:t.name,slug:t.slug,assets:t.assets?.image?.url?{image:t.assets.image.url}:void 0}}function k(t){if(t?.length)return t.map(e=>({id:e.id,name:e.name,slug:e.slug,role:e.role??"REFEREE",gender:e.gender}))}function C(t){if(!t.season?.tournament)return;const{tournament:e,...o}=t.season;return{id:e.id,name:e.name,slug:e.slug,type:e.type,region:e.region,country:e.country?{id:e.country.id,name:e.country.name,code:e.country.code??void 0,flag:e.country.assets?.flag?.url}:void 0,season:{id:o.id,name:o.name,status:o.status},stage:t.stage?{id:t.stage.id,name:t.stage.name,type:t.stage.type}:void 0,assets:e.assets?.logo?.url?{logo:e.assets.logo.url}:void 0}}function L(t){if(!t.winner?.match?.id)return;const e={"Regular Time":"REGULAR_TIME","Extra Time":"EXTRA_TIME",Penalties:"PENALTIES"};return{competitorId:t.winner.match.id,reason:t.winner.match.reason?.name?e[t.winner.match.reason.name]:void 0,aggregate:!!t.winner.aggregate}}function D(t){return{id:t.id,slug:t.slug,status:v(t.status),timing:O(t),competitorOne:p(t.home_team),competitorTwo:p(t.away_team),competition:C(t),round:t.round?{id:t.round.id??t.round.key,key:t.round.key,name:t.round.name,type:t.round.type??"REGULAR"}:void 0,group:t.group?{id:t.group.id,name:t.group.name}:void 0,venue:b(t.venue),officials:k(t.referees),spectators:t.spectators??void 0,score:A(t.score),mainEvents:t.main_events?.map(l).filter(e=>e!==null),penaltyShootoutEvents:t.penalty_shootout_events?.map(l).filter(e=>e!==null),winner:L(t),coverage:t.coverage==="NOT_LIVE"?"UNKNOWN":t.coverage,lineupStatus:t.lineup_status==="UNCONFIRMED"?"EXPECTED":t.lineup_status}}function N(t){const e=t.player;return{id:e.id,name:e.name,slug:e.slug,position:e.position,shirtNumber:t.shirt_number,positionX:t.position_x??void 0,positionY:t.position_y??void 0,country:e.country?{id:e.country.id,name:e.country.name,code:e.country.code}:void 0,birthdate:e.birthdate,profile:e.profile?{height:e.profile.height,weight:e.profile.weight}:void 0,events:t.events?.map(l).filter(o=>o!==null)}}function g(t){const e=[],o=[];for(const n of t.players){const r=N(n);n.type.category==="start"?e.push(r):n.type.category==="sub"&&o.push(r)}return{competitorId:t.team_id,formation:t.formation,coach:t.coach?{id:t.coach.id,name:t.coach.name,slug:t.coach.slug,country:t.coach.country?{id:t.coach.country.id,name:t.coach.country.name,code:t.coach.country.code}:void 0,birthdate:t.coach.birthdate}:void 0,starters:e,substitutes:o}}function I(t){return{matchId:t.match_id,confirmed:t.status==="CONFIRMED",competitorOne:g(t.home_team),competitorTwo:g(t.away_team)}}function i(t,e,o,n){return e==null?null:{key:t,value:String(e),label:o,unit:n}}function _(t,e){const o=(e.shots_on??0)+(e.shots_off??0)+(e.shots_blocked??0),n=[i("possession",e.possession,"Possession","%"),i("shots_total",o,"Shots"),i("shots_on_target",e.shots_on,"Shots on Target"),i("shots_off_target",e.shots_off,"Shots off Target"),i("shots_blocked",e.shots_blocked,"Shots Blocked"),i("corners",e.corners,"Corner Kicks"),i("goal_kicks",e.goal_kicks,"Goal Kicks"),i("throw_ins",e.throw_in,"Throw Ins"),i("offsides",e.offside,"Offsides"),i("fouls",e.fouls_committed,"Fouls"),i("yellow_cards",e.yellow_cards,"Yellow Cards"),i("passes",e.pass,"Passes"),i("crosses",e.crosses,"Crosses")];return{competitorId:t,statistics:n.filter(r=>r!==null)}}function M(t){const e=t.find(n=>n.home_team),o=t.find(n=>!n.home_team);if(!e||!o)throw new Error("Missing competitor statistics");return{competitorOne:_(String(e.team.id),e.statistics),competitorTwo:_(String(o.team.id),o.statistics)}}function P(t){const e=t.urls?.find(o=>o.app_type==="desktop")?.url;return{id:t.id,name:t.name,code:t.code,value:t.value??void 0,odds:t.odds,oddsOld:t.odds_old,movement:t.movement==="STABLE"?"NONE":t.movement,url:e}}function F(t){return{type:{id:t.type.id,code:t.type.code,name:t.type.name},period:{id:t.scope.id,type:t.scope.type,name:t.scope.name},selections:t.selections.map(P)}}function R(t){return{operator:{id:t.bookmaker.id,name:t.bookmaker.name,url:t.bookmaker.url,branding:t.bookmaker.branding?{backgroundColor:t.bookmaker.branding.background_color,textColor:t.bookmaker.branding.text_color,logo:t.bookmaker.assets?.[0]?.logo}:void 0},type:t.type,markets:t.markets.map(F)}}function U(t,e){return{matchId:t,operators:e.map(R)}}function f(t){if(t==null||t==="")return;const e=typeof t=="number"?t:parseInt(t,10);return isNaN(e)?void 0:e}function Y(t){return{externalId:t.external_id,minute:f(t.elapsed),addedTime:f(t.elapsed_plus),text:t.auto_text,details:t.details,meta:{type:t.type,commentaryType:t.commentary_type,subtype1:t.subtype_1,subtype2:t.subtype_2,timestamp:t.incident_timestamp}}}async function H(t,e={}){const{sportal365Sports:o}=a(),n=await c({path:`/v2/matches/${t}`,params:{language_code:e.languageCode??o?.languageCode??"en",odd_client:e.oddClient,odd_type:e.oddType,scope_type:e.scopeType,odd_format:e.oddFormat,market_types:e.marketTypes,bookmaker_ids:e.bookmakerIds,optional_data:e.optionalData}});return D(n)}async function $(t,e={}){const{sportal365Sports:o}=a();return(await c({path:`/v2/matches/${t}/events`,params:{language_code:e.languageCode??o?.languageCode??"en"}})).events.map(l).filter(r=>r!==null)}async function W(t,e={}){const{sportal365Sports:o}=a(),n=await c({path:`/v2/matches/${t}/lineups`,params:{language_code:e.languageCode??o?.languageCode??"en"}});return I(n)}async function G(t,e={}){const{sportal365Sports:o}=a(),n=await c({path:`/v2/matches/${t}`,params:{language_code:e.languageCode??o?.languageCode??"en",odd_client:e.oddClient??o?.oddClient,odd_type:e.oddType,scope_type:e.scopeType??"ALL",odd_format:e.oddFormat??"DECIMAL",market_types:e.marketTypes,bookmaker_ids:e.bookmakerIds}});return U(t,n.odds??[])}async function K(t,e={}){const{sportal365Sports:o}=a(),n=await c({path:`/events/${t}/teamstats`,params:{language_code:e.languageCode??o?.languageCode??"en"}});return M(n)}async function j(t,e={}){const{sportal365Sports:o}=a();return(await c({path:`/matches/${t}/commentary`,params:{language_code:e.languageCode??o?.languageCode??"en"}})).map(Y)}function x(t){return{id:t.id,name:t.name,shortName:t.short_name??void 0,threeLetterCode:t.three_letter_code,slug:t.slug,type:t.type==="placeholder"?"club":t.type,gender:t.gender,country:t.country?{id:t.country.id,name:t.country.name,code:t.country.code??void 0,flag:t.country.assets?.flag?.url}:void 0,assets:t.assets?{logo:t.assets.logo?.url,homeKit:t.assets.home_kit?.url,awayKit:t.assets.away_kit?.url,squadImage:t.assets.squad_image?.url}:void 0}}async function B(t,e={}){const{sportal365Sports:o}=a(),n=await c({path:`/v2/teams/${t}`,params:{language_code:e.languageCode??o?.languageCode??"en",optional_data:"form"}});return x(n)}const V="0.0.2";s.getConfig=a,s.getFootballMatch=H,s.getFootballMatchCommentary=j,s.getFootballMatchEvents=$,s.getFootballMatchLineups=W,s.getFootballMatchOdds=G,s.getFootballMatchStatistics=K,s.getFootballTeam=B,s.isConfigured=y,s.setConfig=h,s.version=V,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(f,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],N):(f=typeof globalThis<"u"?globalThis:f||self,N(f.FansUnitedDataLayer={},f.React))})(this,(function(f,N){"use strict";function Be(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const E=Be(N);let H=null;function Qe(e){H=e}function O(){if(!H)throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");return H}function He(){return H!==null}function We(e){const t=e.replace(/\/$/,"");function r(){const{sportal365Sports:a}=O();if(!a)throw new Error("Sportal365 Sports API configuration is missing");const u=`${a.username}:${a.password}`;return`Basic ${btoa(u)}`}function s(a){return`${t}${a}`}return{async get(a){const{sportal365Sports:u}=O();if(!u)throw new Error("Sportal365 Sports API configuration is missing");const o=new URL(s(a.path));if(a.params)for(const[l,m]of Object.entries(a.params))m!==void 0&&(Array.isArray(m)?m.length>0&&o.searchParams.set(l,m.join(",")):o.searchParams.set(l,m));const i=await fetch(o.toString(),{method:"GET",headers:{Authorization:r(),"Content-Type":"application/json","X-Project-Id":u.projectId},signal:u.timeout?AbortSignal.timeout(u.timeout):void 0});if(!i.ok)throw new Error(`Sportal365 API error: ${i.status} ${i.statusText}`);return i.json()}}}const C=We("https://football.api.sportal365.com");function oe(e){if(e)return{id:e.id,name:e.name,slug:e.slug,position:e.position,gender:e.gender,assets:e.assets?{photo:e.assets.thumb?.url,photoTransparent:e.assets.thumb_transparent_background?.url}:void 0}}const Ve={GOAL:"GOAL",PENALTY_GOAL:"PENALTY_GOAL",OWN_GOAL:"OWN_GOAL",DISALLOWED_GOAL:"DISALLOWED_GOAL",PENALTY_SHOOTOUT_SCORED:"PENALTY_SHOOTOUT_SCORED",PENALTY_SHOOTOUT_MISSED:"PENALTY_SHOOTOUT_MISSED",YELLOW_CARD:"YELLOW_CARD",RED_CARD:"RED_CARD",YELLOW_RED_CARD:"YELLOW_RED_CARD",SUBSTITUTION:"SUBSTITUTION",KICKOFF:"KICKOFF",HALFTIME:"HALFTIME",START_SECOND_HALF:"START_SECOND_HALF",FINISHED:"FINISHED",INJURY_TIME:"INJURY_TIME",PENALTY_AWARDED:"PENALTY_AWARDED",PENALTY_MISSED:"PENALTY_MISSED",PENALTY_SAVED:"PENALTY_SAVED"};function W(e){const t=Ve[e.type_code];return t?{id:e.id,type:t,competitorPosition:e.team_position==="HOME"?"ONE":"TWO",minute:e.minute,injuryMinute:e.injury_minute,primaryPlayer:oe(e.primary_player),secondaryPlayer:oe(e.secondary_player),score:e.score?{competitorOne:String(e.score.home),competitorTwo:String(e.score.away)}:void 0}:(console.warn(`Unknown event type: ${e.type_code}`),null)}function we(e){return{code:{FINISHED:"finished",NOT_STARTED:"not_started",LIVE:"live",INTERRUPTED:"interrupted",CANCELLED:"cancelled",POSTPONED:"postponed",UNKNOWN:"not_started",ABANDONED:"abandoned"}[e.type]??"not_started",name:e.name,shortName:e.short_name,type:e.type}}function ue(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??"club",gender:e.gender,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,metadata:e.shirt_color?{shirtColor:e.shirt_color}:void 0}}function Ge(e){return{kickoffTime:new Date(e.kickoff_time),currentMinute:e.minute?.regular_time,phaseStartedAt:e.phase_started_at?new Date(e.phase_started_at):void 0,finishedAt:e.finished_at?new Date(e.finished_at):void 0,firstHalfStartedAt:e.first_half_started_at?new Date(e.first_half_started_at):void 0,secondHalfStartedAt:e.second_half_started_at?new Date(e.second_half_started_at):void 0,extraTimeFirstHalfStartedAt:e.extra_time_first_half_started_at?new Date(e.extra_time_first_half_started_at):void 0,extraTimeSecondHalfStartedAt:e.extra_time_second_half_started_at?new Date(e.extra_time_second_half_started_at):void 0}}function Ke(e){if(!e)return;const t=s=>s?{competitorOne:String(s.home),competitorTwo:String(s.away)}:void 0,r=e.total??e.regular_time;return{competitorOne:r?.home!=null?String(r.home):null,competitorTwo:r?.away!=null?String(r.away):null,breakdown:{total:t(e.total),halfTime:t(e.half_time),regularTime:t(e.regular_time),extraTime:t(e.extra_time),penaltyShootout:t(e.penalty_shootout),aggregate:t(e.aggregate)}}}function ze(e){if(e)return{id:e.id,name:e.name,slug:e.slug,assets:e.assets?.image?.url?{image:e.assets.image.url}:void 0}}function Je(e){if(e?.length)return e.map(t=>({id:t.id,name:t.name,slug:t.slug,role:t.role??"REFEREE",gender:t.gender}))}function Xe(e){if(!e.season?.tournament)return;const{tournament:t,...r}=e.season;return{id:t.id,name:t.name,slug:t.slug,type:t.type,region:t.region,country:t.country?{id:t.country.id,name:t.country.name,code:t.country.code??void 0,flag:t.country.assets?.flag?.url}:void 0,season:{id:r.id,name:r.name,status:r.status},stage:e.stage?{id:e.stage.id,name:e.stage.name,type:e.stage.type}:void 0,assets:t.assets?.logo?.url?{logo:t.assets.logo.url}:void 0}}function Ze(e){if(!e.winner?.match?.id)return;const t={"Regular Time":"REGULAR_TIME","Extra Time":"EXTRA_TIME",Penalties:"PENALTIES"};return{competitorId:e.winner.match.id,reason:e.winner.match.reason?.name?t[e.winner.match.reason.name]:void 0,aggregate:!!e.winner.aggregate}}function ce(e){return{id:e.id,slug:e.slug,status:we(e.status),timing:Ge(e),competitorOne:ue(e.home_team),competitorTwo:ue(e.away_team),competition:Xe(e),round:e.round?{id:e.round.id??e.round.key,key:e.round.key,name:e.round.name,type:e.round.type??"REGULAR"}:void 0,group:e.group?{id:e.group.id,name:e.group.name}:void 0,venue:ze(e.venue),officials:Je(e.referees),spectators:e.spectators??void 0,score:Ke(e.score),mainEvents:e.main_events?.map(W).filter(t=>t!==null),penaltyShootoutEvents:e.penalty_shootout_events?.map(W).filter(t=>t!==null),winner:Ze(e),coverage:e.coverage==="NOT_LIVE"?"UNKNOWN":e.coverage,lineupStatus:e.lineup_status==="UNCONFIRMED"?"EXPECTED":e.lineup_status}}function et(e){const t=e.player;return{id:t.id,name:t.name,slug:t.slug,position:t.position,shirtNumber:e.shirt_number,positionX:e.position_x??void 0,positionY:e.position_y??void 0,country:t.country?{id:t.country.id,name:t.country.name,code:t.country.code}:void 0,birthdate:t.birthdate,profile:t.profile?{height:t.profile.height,weight:t.profile.weight}:void 0,events:e.events?.map(W).filter(r=>r!==null)}}function le(e){const t=[],r=[];for(const s of e.players){const a=et(s);s.type.category==="start"?t.push(a):s.type.category==="sub"&&r.push(a)}return{competitorId:e.team_id,formation:e.formation,coach:e.coach?{id:e.coach.id,name:e.coach.name,slug:e.coach.slug,country:e.coach.country?{id:e.coach.country.id,name:e.coach.country.name,code:e.coach.country.code}:void 0,birthdate:e.coach.birthdate}:void 0,starters:t,substitutes:r}}function tt(e){return{matchId:e.match_id,confirmed:e.status==="CONFIRMED",competitorOne:le(e.home_team),competitorTwo:le(e.away_team)}}function b(e,t,r,s){return t==null?null:{key:e,value:String(t),label:r,unit:s}}function de(e,t){const r=(t.shots_on??0)+(t.shots_off??0)+(t.shots_blocked??0),s=[b("possession",t.possession,"Possession","%"),b("shots_total",r,"Shots"),b("shots_on_target",t.shots_on,"Shots on Target"),b("shots_off_target",t.shots_off,"Shots off Target"),b("shots_blocked",t.shots_blocked,"Shots Blocked"),b("corners",t.corners,"Corner Kicks"),b("goal_kicks",t.goal_kicks,"Goal Kicks"),b("throw_ins",t.throw_in,"Throw Ins"),b("offsides",t.offside,"Offsides"),b("fouls",t.fouls_committed,"Fouls"),b("yellow_cards",t.yellow_cards,"Yellow Cards"),b("passes",t.pass,"Passes"),b("crosses",t.crosses,"Crosses")];return{competitorId:e,statistics:s.filter(a=>a!==null)}}function rt(e){const t=e.find(s=>s.home_team),r=e.find(s=>!s.home_team);if(!t||!r)throw new Error("Missing competitor statistics");return{competitorOne:de(String(t.team.id),t.statistics),competitorTwo:de(String(r.team.id),r.statistics)}}function nt(e){const t=e.urls?.find(r=>r.app_type==="desktop")?.url;return{id:e.id,name:e.name,code:e.code,value:e.value??void 0,odds:e.odds,oddsOld:e.odds_old,movement:e.movement==="STABLE"?"NONE":e.movement,url:t}}function st(e){return{type:{id:e.type.id,code:e.type.code,name:e.type.name},period:{id:e.scope.id,type:e.scope.type,name:e.scope.name},selections:e.selections.map(nt)}}function at(e){return{operator:{id:e.bookmaker.id,name:e.bookmaker.name,url:e.bookmaker.url,branding:e.bookmaker.branding?{backgroundColor:e.bookmaker.branding.background_color,textColor:e.bookmaker.branding.text_color,logo:e.bookmaker.assets?.[0]?.logo}:void 0},type:e.type,markets:e.markets.map(st)}}function it(e,t){return{matchId:e,operators:t.map(at)}}function fe(e){if(e==null||e==="")return;const t=typeof e=="number"?e:parseInt(e,10);return isNaN(t)?void 0:t}function ot(e){return{externalId:e.external_id,minute:fe(e.elapsed),addedTime:fe(e.elapsed_plus),text:e.auto_text,details:e.details,meta:{type:e.type,commentaryType:e.commentary_type,subtype1:e.subtype_1,subtype2:e.subtype_2,timestamp:e.incident_timestamp}}}async function he(e,t={}){const{sportal365Sports:r}=O(),s=await C.get({path:`/v2/matches/${e}`,params:{language_code:t.languageCode??r?.languageCode??"en",odd_client:t.oddClient,odd_type:t.oddType,scope_type:t.scopeType,odd_format:t.oddFormat,market_types:t.marketTypes,bookmaker_ids:t.bookmakerIds,optional_data:t.optionalData}});return ce(s)}async function ut(e,t={}){const{sportal365Sports:r}=O();return(await C.get({path:`/v2/matches/${e}/events`,params:{language_code:t.languageCode??r?.languageCode??"en"}})).events.map(W).filter(a=>a!==null)}async function ct(e,t={}){const{sportal365Sports:r}=O(),s=await C.get({path:`/v2/matches/${e}/lineups`,params:{language_code:t.languageCode??r?.languageCode??"en"}});return tt(s)}async function lt(e,t={}){const{sportal365Sports:r}=O(),s=await C.get({path:`/v2/matches/${e}`,params:{language_code:t.languageCode??r?.languageCode??"en",odd_client:t.oddClient??r?.oddClient,odd_type:t.oddType,scope_type:t.scopeType??"ALL",odd_format:t.oddFormat??"DECIMAL",market_types:t.marketTypes,bookmaker_ids:t.bookmakerIds}});return it(e,s.odds??[])}async function dt(e,t={}){const{sportal365Sports:r}=O(),s=await C.get({path:`/events/${e}/teamstats`,params:{language_code:t.languageCode??r?.languageCode??"en"}});return rt(s)}async function ft(e,t={}){const{sportal365Sports:r}=O();return(await C.get({path:`/matches/${e}/commentary`,params:{language_code:t.languageCode??r?.languageCode??"en"}})).map(ot)}async function me(e){const{sportal365Sports:t}=O();return(await C.get({path:"/v2/matches",params:{language_code:e.languageCode??t?.languageCode??"en",limit:e.limit.toString(),offset:e.offset.toString(),tournament_ids:e.tournamentIds,season_ids:e.seasonIds,stage_ids:e.stageIds,group_ids:e.groupIds,round_ids:e.roundIds,round_filter:e.roundFilter,from_kickoff_time:e.fromKickoffTime,to_kickoff_time:e.toKickoffTime,team_ids:e.teamIds,team_ids_operator:e.teamIdsOperator,referee_id:e.refereeId,venue_id:e.venueId,player_id:e.playerId,status_types:e.statusTypes,status_codes:e.statusCodes,odd_client:e.oddClient??t?.oddClient,odd_type:e.oddType,scope_type:e.scopeType,odd_format:e.oddFormat,market_types:e.marketTypes,bookmaker_ids:e.bookmakerIds,sort_direction:e.sortDirection,optional_data:e.optionalData}})).matches.map(ce)}function ht(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}: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}}async function mt(e,t={}){const{sportal365Sports:r}=O(),s=await C.get({path:`/v2/teams/${e}`,params:{language_code:t.languageCode??r?.languageCode??"en",optional_data:"form"}});return ht(s)}function pe(e,t){return{id:e.id,name:e.name,shortName:e.shortName,logo:e.assets?.logo?{url:e.assets.logo,alt:e.name}:void 0,score:t!=null?pt(t):void 0}}function pt(e){return{main:e}}function gt(e){switch(e.type){case"LIVE":return"live";case"FINISHED":return"final";case"POSTPONED":return"postponed";case"CANCELLED":return"cancelled";case"INTERRUPTED":case"ABANDONED":return"suspended";case"NOT_STARTED":default:return"scheduled"}}function yt(e,t){if(t.type==="LIVE")return{current:e.currentPeriod,label:e.currentMinute?`${e.currentMinute}'`:void 0}}function _t(e){if(e.type==="LIVE")return{color:"#ef4444"}}function ge(e){return{id:e.id,sport:"football",competitorOne:pe(e.competitorOne,e.score?.competitorOne),competitorTwo:pe(e.competitorTwo,e.score?.competitorTwo),status:gt(e.status),period:yt(e.timing,e.status),liveIndicator:_t(e.status),metadata:{venue:e.venue?.name,date:e.timing.kickoffTime.toISOString().split("T")[0],time:e.timing.kickoffTime.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),competition:e.competition?.name,round:e.round?.name,winner:e.winner?.competitorId===e.competitorOne.id?"competitorOne":e.winner?.competitorId===e.competitorTwo.id?"competitorTwo":void 0},link:e.slug?`/match/${e.slug}`:`/match/${e.id}`}}function vt(e){return e.toISOString().split("T")[0]}async function ye(e,t){const r=await he(e,{languageCode:t?.languageCode});return ge(r)}function bt(e){return{match:ge(e),dateGroup:vt(e.timing.kickoffTime),competitionGroup:e.competition?.name,competitionLogo:e.competition?.assets?.logo,competitionSubtitle:e.competition?.country?.name,roundGroup:e.round?.name}}function Tt(e){const t={limit:e.limit??50,offset:e.offset??0,languageCode:e.languageCode};return e.fromDate&&(t.fromKickoffTime=e.fromDate),e.toDate&&(t.toKickoffTime=e.toDate),e.tournamentIds&&(t.tournamentIds=e.tournamentIds),e.teamId&&(t.teamIds=[e.teamId]),e.roundIds&&(t.roundIds=e.roundIds),e.seasonIds&&(t.seasonIds=e.seasonIds),e.statusTypes&&(t.statusTypes=e.statusTypes),e.variant==="teamResults"||e.variant==="teamResultsByCompetition"?t.sortDirection="desc":(e.variant==="teamFixtures"||e.variant==="teamFixturesByCompetition")&&(t.sortDirection="asc"),t}async function F(e){const t=Tt(e);return{items:(await me(t)).map(a=>bt(a)),variant:e.variant}}var J=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Et={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ot=class{#t=Et;#e=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#e&&e!==this.#t&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#t,provider:e}),this.#t=e,process.env.NODE_ENV!=="production"&&(this.#e=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#e=!0),this.#t.setTimeout(e,t)}clearTimeout(e){this.#t.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#e=!0),this.#t.setInterval(e,t)}clearInterval(e){this.#t.clearInterval(e)}},V=new Ot;function St(e){setTimeout(e,0)}var M=typeof window>"u"||"Deno"in globalThis;function X(){}function _e(e){return typeof e=="number"&&e>=0&&e!==1/0}function It(e,t){return Math.max(e+(t||0)-Date.now(),0)}function j(e,t){return typeof e=="function"?e(t):e}function S(e,t){return typeof e=="function"?e(t):e}var Rt=Object.prototype.hasOwnProperty;function Z(e,t){if(e===t)return e;const r=ve(e)&&ve(t);if(!r&&!(be(e)&&be(t)))return t;const a=(r?e:Object.keys(e)).length,u=r?t:Object.keys(t),o=u.length,i=r?new Array(o):{};let l=0;for(let m=0;m<o;m++){const d=r?m:u[m],_=e[d],h=t[d];if(_===h){i[d]=_,(r?m<a:Rt.call(e,d))&&l++;continue}if(_===null||h===null||typeof _!="object"||typeof h!="object"){i[d]=h;continue}const I=Z(_,h);i[d]=I,I===_&&l++}return a===o&&l===a?e:i}function ee(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function ve(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function be(e){if(!Te(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Te(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Te(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ee(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Z(e,t)}catch(s){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${s}`),s}return Z(e,t)}return t}function Ct(e,t){return typeof e=="function"?e(...t):!!e}var kt=class extends J{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!M&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},At=new kt;function Oe(){let e,t;const r=new Promise((a,u)=>{e=a,t=u});r.status="pending",r.catch(()=>{});function s(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{s({status:"fulfilled",value:a}),e(a)},r.reject=a=>{s({status:"rejected",reason:a}),t(a)},r}var Nt=St;function Pt(){let e=[],t=0,r=i=>{i()},s=i=>{i()},a=Nt;const u=i=>{t?e.push(i):a(()=>{r(i)})},o=()=>{const i=e;e=[],i.length&&a(()=>{s(()=>{i.forEach(l=>{r(l)})})})};return{batch:i=>{let l;t++;try{l=i()}finally{t--,t||o()}return l},batchCalls:i=>(...l)=>{u(()=>{i(...l)})},schedule:u,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{a=i}}}var Se=Pt(),Dt=class extends J{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!M&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},Lt=new Dt;function Ft(e){return(e??"online")==="online"?Lt.isOnline():!0}function Mt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ft(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var jt=class extends J{constructor(e,t){super(),this.options=t,this.#t=e,this.#a=null,this.#s=Oe(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#o;#d;#s;#a;#p;#f;#h;#u;#c;#i;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Ie(this.#e,this.options)?this.#l():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return te(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return te(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#T(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,r=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof S(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#E(),this.#e.setOptions(this.options),t._defaulted&&!ee(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const s=this.hasListeners();s&&Re(this.#e,r,this.options,t)&&this.#l(),this.updateResult(),s&&(this.#e!==r||S(this.options.enabled,this.#e)!==S(t.enabled,this.#e)||j(this.options.staleTime,this.#e)!==j(t.staleTime,this.#e))&&this.#g();const a=this.#y();s&&(this.#e!==r||S(this.options.enabled,this.#e)!==S(t.enabled,this.#e)||a!==this.#i)&&this.#_(a)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return Ut(this,r)&&(this.#r=r,this.#d=this.options,this.#o=this.#e.state),r}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),t?.(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#l({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#l(e){this.#E();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(X)),t}#g(){this.#b();const e=j(this.options.staleTime,this.#e);if(M||this.#r.isStale||!_e(e))return;const r=It(this.#r.dataUpdatedAt,e)+1;this.#u=V.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#_(e){this.#T(),this.#i=e,!(M||S(this.options.enabled,this.#e)===!1||!_e(this.#i)||this.#i===0)&&(this.#c=V.setInterval(()=>{(this.options.refetchIntervalInBackground||At.isFocused())&&this.#l()},this.#i))}#v(){this.#g(),this.#_(this.#y())}#b(){this.#u&&(V.clearTimeout(this.#u),this.#u=void 0)}#T(){this.#c&&(V.clearInterval(this.#c),this.#c=void 0)}createResult(e,t){const r=this.#e,s=this.options,a=this.#r,u=this.#o,o=this.#d,l=e!==r?e.state:this.#n,{state:m}=e;let d={...m},_=!1,h;if(t._optimisticResults){const v=this.hasListeners(),k=!v&&Ie(e,t),A=v&&Re(e,r,t,s);(k||A)&&(d={...d,...Mt(m.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:I,errorUpdatedAt:$,status:R}=d;h=d.data;let P=!1;if(t.placeholderData!==void 0&&h===void 0&&R==="pending"){let v;a?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(v=a.data,P=!0):v=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,v!==void 0&&(R="success",h=Ee(a?.data,v,t),_=!0)}if(t.select&&h!==void 0&&!P)if(a&&h===u?.data&&t.select===this.#p)h=this.#f;else try{this.#p=t.select,h=t.select(h),h=Ee(a?.data,h,t),this.#f=h,this.#a=null}catch(v){this.#a=v}this.#a&&(I=this.#a,h=this.#f,$=Date.now(),R="error");const q=d.fetchStatus==="fetching",B=R==="pending",Q=R==="error",G=B&&q,K=h!==void 0,T={status:R,fetchStatus:d.fetchStatus,isPending:B,isSuccess:R==="success",isError:Q,isInitialLoading:G,isLoading:G,data:h,dataUpdatedAt:d.dataUpdatedAt,error:I,errorUpdatedAt:$,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:q,isRefetching:q&&!B,isLoadingError:Q&&!K,isPaused:d.fetchStatus==="paused",isPlaceholderData:_,isRefetchError:Q&&K,isStale:re(e,t),refetch:this.refetch,promise:this.#s,isEnabled:S(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const v=D=>{T.status==="error"?D.reject(T.error):T.data!==void 0&&D.resolve(T.data)},k=()=>{const D=this.#s=T.promise=Oe();v(D)},A=this.#s;switch(A.status){case"pending":e.queryHash===r.queryHash&&v(A);break;case"fulfilled":(T.status==="error"||T.data!==A.value)&&k();break;case"rejected":(T.status!=="error"||T.error!==A.reason)&&k();break}}return T}updateResult(){const e=this.#r,t=this.createResult(this.#e,this.options);if(this.#o=this.#e.state,this.#d=this.options,this.#o.data!==void 0&&(this.#h=this.#e),ee(t,e))return;this.#r=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!this.#m.size)return!0;const u=new Set(a??this.#m);return this.options.throwOnError&&u.add("error"),Object.keys(this.#r).some(o=>{const i=o;return this.#r[i]!==e[i]&&u.has(i)})};this.#O({listeners:r()})}#E(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#O(e){Se.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function xt(e,t){return S(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ie(e,t){return xt(e,t)||e.state.data!==void 0&&te(e,t,t.refetchOnMount)}function te(e,t,r){if(S(t.enabled,e)!==!1&&j(t.staleTime,e)!=="static"){const s=typeof r=="function"?r(e):r;return s==="always"||s!==!1&&re(e,t)}return!1}function Re(e,t,r,s){return(e!==t||S(s.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&re(e,r)}function re(e,t){return S(t.enabled,e)!==!1&&e.isStaleByTime(j(t.staleTime,e))}function Ut(e,t){return!ee(e.getCurrentResult(),t)}var w={exports:{}},x={};var Ce;function Yt(){if(Ce)return x;Ce=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,a,u){var o=null;if(u!==void 0&&(o=""+u),a.key!==void 0&&(o=""+a.key),"key"in a){u={};for(var i in a)i!=="key"&&(u[i]=a[i])}else u=a;return a=u.ref,{$$typeof:e,type:s,key:o,ref:a!==void 0?a:null,props:u}}return x.Fragment=t,x.jsx=r,x.jsxs=r,x}var U={};var ke;function $t(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&(function(){function e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===D?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case P:return"Fragment";case B:return"Profiler";case q:return"StrictMode";case Me:return"Suspense";case T:return"SuspenseList";case A:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case R:return"Portal";case G:return n.displayName||"Context";case Q:return(n._context.displayName||"Context")+".Consumer";case K:var c=n.render;return n=n.displayName,n||(n=c.displayName||c.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case v:return c=n.displayName||null,c!==null?c:e(n.type)||"Memo";case k:c=n._payload,n=n._init;try{return e(n(c))}catch{}}return null}function t(n){return""+n}function r(n){try{t(n);var c=!1}catch{c=!0}if(c){c=console;var p=c.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return p.call(c,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),t(n)}}function s(n){if(n===P)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===k)return"<...>";try{var c=e(n);return c?"<"+c+">":"<...>"}catch{return"<...>"}}function a(){var n=ne.A;return n===null?null:n.getOwner()}function u(){return Error("react-stack-top-frame")}function o(n){if(je.call(n,"key")){var c=Object.getOwnPropertyDescriptor(n,"key").get;if(c&&c.isReactWarning)return!1}return n.key!==void 0}function i(n,c){function p(){xe||(xe=!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)",c))}p.isReactWarning=!0,Object.defineProperty(n,"key",{get:p,configurable:!0})}function l(){var n=e(this.type);return Ue[n]||(Ue[n]=!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.")),n=this.props.ref,n!==void 0?n:null}function m(n,c,p,g,z,ae){var y=p.ref;return n={$$typeof:$,type:n,key:c,props:p,_owner:g},(y!==void 0?y:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:l}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ae}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function d(n,c,p,g,z,ae){var y=c.children;if(y!==void 0)if(g)if(ir(y)){for(g=0;g<y.length;g++)_(y[g]);Object.freeze&&Object.freeze(y)}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 _(y);if(je.call(c,"key")){y=e(n);var L=Object.keys(c).filter(function(or){return or!=="key"});g=0<L.length?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}",qe[y+g]||(L=0<L.length?"{"+L.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,g,y,L,y),qe[y+g]=!0)}if(y=null,p!==void 0&&(r(p),y=""+p),o(c)&&(r(c.key),y=""+c.key),"key"in c){p={};for(var ie in c)ie!=="key"&&(p[ie]=c[ie])}else p=c;return y&&i(p,typeof n=="function"?n.displayName||n.name||"Unknown":n),m(n,y,p,a(),z,ae)}function _(n){h(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===k&&(n._payload.status==="fulfilled"?h(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function h(n){return typeof n=="object"&&n!==null&&n.$$typeof===$}var I=N,$=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),G=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),Me=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),ne=I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,je=Object.prototype.hasOwnProperty,ir=Array.isArray,se=console.createTask?console.createTask:function(){return null};I={react_stack_bottom_frame:function(n){return n()}};var xe,Ue={},Ye=I.react_stack_bottom_frame.bind(I,u)(),$e=se(s(u)),qe={};U.Fragment=P,U.jsx=function(n,c,p){var g=1e4>ne.recentlyCreatedOwnerStacks++;return d(n,c,p,!1,g?Error("react-stack-top-frame"):Ye,g?se(s(n)):$e)},U.jsxs=function(n,c,p){var g=1e4>ne.recentlyCreatedOwnerStacks++;return d(n,c,p,!0,g?Error("react-stack-top-frame"):Ye,g?se(s(n)):$e)}})()),U}var Ae;function qt(){return Ae||(Ae=1,process.env.NODE_ENV==="production"?w.exports=Yt():w.exports=$t()),w.exports}qt();var Bt=E.createContext(void 0),Qt=e=>{const t=E.useContext(Bt);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ne=E.createContext(!1),Ht=()=>E.useContext(Ne);Ne.Provider;function Wt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Vt=E.createContext(Wt()),wt=()=>E.useContext(Vt),Gt=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Kt=e=>{E.useEffect(()=>{e.clearReset()},[e])},zt=({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(a&&e.data===void 0||Ct(r,[e.error,s])),Jt=e=>{if(e.suspense){const r=a=>a==="static"?a:Math.max(a??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...a)=>r(s(...a)):r(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Xt=(e,t)=>e.isLoading&&e.isFetching&&!t,Zt=(e,t)=>e?.suspense&&t.isPending,Pe=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function er(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const s=Ht(),a=wt(),u=Qt(),o=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=s?"isRestoring":"optimistic",Jt(o),Gt(o,a),Kt(a);const i=!u.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(u,o)),m=l.getOptimisticResult(o),d=!s&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(_=>{const h=d?l.subscribe(Se.batchCalls(_)):X;return l.updateResult(),h},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),Zt(o,m))throw Pe(o,l,a);if(zt({result:m,errorResetBoundary:a,throwOnError:o.throwOnError,query:u.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw m.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(o,m),o.experimental_prefetchInRender&&!M&&Xt(m,s)&&(i?Pe(o,l,a):u.getQueryCache().get(o.queryHash)?.promise)?.catch(X).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?m:l.trackResult(m)}function Y(e,t){return er(e,jt)}function tr(e,t){return Y({queryKey:["match-score",e,{lang:t?.languageCode}],queryFn:()=>ye(e,{languageCode:t?.languageCode}),initialData:t?.initialData,enabled:t?.enabled??!0,refetchInterval:t?.refetchInterval??!1,refetchIntervalInBackground:!1,staleTime:3e4})}function rr(e){const t=["match-list",e.variant,{fromDate:e.fromDate,toDate:e.toDate,tournamentIds:e.tournamentIds,teamId:e.teamId,roundIds:e.roundIds,seasonIds:e.seasonIds,statusTypes:e.statusTypes,limit:e.limit,offset:e.offset,lang:e.languageCode}];return Y({queryKey:t,queryFn:()=>F(e),initialData:e.initialData,enabled:e.enabled??!0,refetchInterval:e.refetchInterval??!1,refetchIntervalInBackground:!1,staleTime:6e4})}async function De(e,t){const r=t?.groupByCompetition?"teamResultsByCompetition":"teamResults";return F({variant:r,teamId:e,statusTypes:["FINISHED"],languageCode:t?.languageCode,seasonIds:t?.seasonId?[t.seasonId]:void 0,tournamentIds:t?.tournamentIds,limit:t?.limit??20,offset:t?.offset??0})}async function Le(e,t){const r=t?.groupByCompetition?"teamFixturesByCompetition":"teamFixtures";return F({variant:r,teamId:e,statusTypes:["NOT_STARTED"],languageCode:t?.languageCode,seasonIds:t?.seasonId?[t.seasonId]:void 0,tournamentIds:t?.tournamentIds,limit:t?.limit??20,offset:t?.offset??0})}async function Fe(e,t){const r=t?.groupByCompetition?"teamMatchesByCompetition":"teamMatches";return F({variant:r,teamId:e,languageCode:t?.languageCode,seasonIds:t?.seasonId?[t.seasonId]:void 0,tournamentIds:t?.tournamentIds,limit:t?.limit??20,offset:t?.offset??0})}function nr(e,t){const r=t?.groupByCompetition?"teamResultsByCompetition":"teamResults";return Y({queryKey:["team-results",e,r,{seasonId:t?.seasonId,tournamentIds:t?.tournamentIds,limit:t?.limit,offset:t?.offset,lang:t?.languageCode}],queryFn:()=>De(e,t),initialData:t?.initialData,enabled:t?.enabled??!0,refetchInterval:t?.refetchInterval??!1,staleTime:6e4})}function sr(e,t){const r=t?.groupByCompetition?"teamFixturesByCompetition":"teamFixtures";return Y({queryKey:["team-fixtures",e,r,{seasonId:t?.seasonId,tournamentIds:t?.tournamentIds,limit:t?.limit,offset:t?.offset,lang:t?.languageCode}],queryFn:()=>Le(e,t),initialData:t?.initialData,enabled:t?.enabled??!0,refetchInterval:t?.refetchInterval??!1,staleTime:6e4})}function ar(e,t){const r=t?.groupByCompetition?"teamMatchesByCompetition":"teamMatches";return Y({queryKey:["team-matches",e,r,{seasonId:t?.seasonId,tournamentIds:t?.tournamentIds,limit:t?.limit,offset:t?.offset,lang:t?.languageCode}],queryFn:()=>Fe(e,t),initialData:t?.initialData,enabled:t?.enabled??!0,refetchInterval:t?.refetchInterval??!1,staleTime:6e4})}f.getConfig=O,f.getFootballMatch=he,f.getFootballMatchCommentary=ft,f.getFootballMatchEvents=ut,f.getFootballMatchLineups=ct,f.getFootballMatchOdds=lt,f.getFootballMatchStatistics=dt,f.getFootballMatches=me,f.getFootballTeam=mt,f.isConfigured=He,f.prepareMatchList=F,f.prepareMatchScore=ye,f.prepareTeamFixtures=Le,f.prepareTeamMatches=Fe,f.prepareTeamResults=De,f.setConfig=Qe,f.usePrepareMatchList=rr,f.usePrepareMatchScore=tr,f.usePrepareTeamFixtures=sr,f.usePrepareTeamMatches=ar,f.usePrepareTeamResults=nr,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
* username: 'your-username',
|
|
16
16
|
* password: 'your-password',
|
|
17
17
|
* projectId: 'your-project-id',
|
|
18
|
-
* domain: 'https://api.sportal365.com'
|
|
19
18
|
* }
|
|
20
19
|
* });
|
|
21
20
|
*
|
|
@@ -24,9 +23,10 @@
|
|
|
24
23
|
* console.log(match.competitorOne.name); // Team name
|
|
25
24
|
* ```
|
|
26
25
|
*/
|
|
27
|
-
export declare const version = "0.0.2";
|
|
28
26
|
export { setConfig, getConfig, isConfigured, type DataLayerConfig, type Sportal365SportsConfig, type FansUnitedSportsApiConfig, type PayloadConfig, } from "./config";
|
|
29
|
-
export { getFootballMatch, getFootballMatchEvents, getFootballMatchLineups, getFootballMatchOdds, getFootballMatchStatistics, getFootballMatchCommentary, getFootballTeam, } from "./api/sportal365-sports";
|
|
30
|
-
export type { GetFootballMatchOptions, GetFootballMatchEventsOptions, GetFootballMatchLineupsOptions, GetFootballMatchOddsOptions, GetFootballMatchStatisticsOptions, GetFootballMatchCommentaryOptions, GetFootballTeamOptions, OddType, ScopeType, OddFormat, MarketType, OptionalMatchData, } from "./api/sportal365-sports";
|
|
27
|
+
export { getFootballMatch, getFootballMatchEvents, getFootballMatchLineups, getFootballMatchOdds, getFootballMatchStatistics, getFootballMatchCommentary, getFootballMatches, getFootballTeam, } from "./api/sportal365-sports";
|
|
28
|
+
export type { GetFootballMatchOptions, GetFootballMatchEventsOptions, GetFootballMatchLineupsOptions, GetFootballMatchOddsOptions, GetFootballMatchStatisticsOptions, GetFootballMatchCommentaryOptions, GetFootballMatchesOptions, GetFootballTeamOptions, OddType, ScopeType, OddFormat, MarketType, OptionalMatchData, MatchStatusType, SortDirection, } from "./api/sportal365-sports";
|
|
31
29
|
export type { FUSportsCountry, FUSportsCompetitor, FUSportsCompetition, FUSportsVenue, FUSportsOfficial, FUSportsPlayer, FUSportsMatchPlayer, FUSportsCoach, FUSportsMatchScore, FUSportsMatchStatus, FUSportsMatchTiming, FUSportsMatchWinner, FUSportsMatch, FUSportsMatchSimple, FUSportsFootballEventType, FUSportsOtherEventType, FUSportsMatchEvent, FUSportsLineupPlayer, FUSportsCompetitorLineup, FUSportsMatchLineups, FUSportsStatisticEntry, FUSportsCompetitorStatistics, FUSportsMatchStatistics, FUSportsBettingOperatorBranding, FUSportsBettingOperator, FUSportsOddSelection, FUSportsMarketPeriod, FUSportsMarketType, FUSportsOddMarket, FUSportsBettingOperatorOdds, FUSportsMatchOdds, FUSportsCommentaryDetail, FUSportsCommentaryMeta, FUSportsCommentaryItem, FUSportsStandingEntry, FUSportsCompetitorForm, } from "./types/canonical";
|
|
30
|
+
export { prepareMatchScore, usePrepareMatchScore, prepareMatchList, usePrepareMatchList, prepareTeamResults, usePrepareTeamResults, prepareTeamFixtures, usePrepareTeamFixtures, prepareTeamMatches, usePrepareTeamMatches, } from "./use-cases";
|
|
31
|
+
export type { PrepareMatchScoreOptions, PrepareMatchScoreResult, PrepareMatchListOptions, PrepareMatchListResult, MatchListVariant, PrepareTeamMatchesBaseOptions, PrepareTeamResultsOptions, PrepareTeamFixturesOptions, PrepareTeamMatchesOptions, UseTeamMatchesHookOptions, } from "./use-cases";
|
|
32
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EACH,SAAS,EACT,SAAS,EACT,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,aAAa,GACrB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAClB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACR,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,iCAAiC,EACjC,iCAAiC,EACjC,yBAAyB,EACzB,sBAAsB,EACtB,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,GAChB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAER,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,aAAa,EAEb,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EAEnB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAElB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EAEpB,sBAAsB,EACtB,4BAA4B,EAC5B,uBAAuB,EAEvB,+BAA+B,EAC/B,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EAEjB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EAEtB,qBAAqB,EACrB,sBAAsB,GACzB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEH,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EAEnB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GACxB,MAAM,aAAa,CAAC;AAErB,YAAY,EAER,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAEhB,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,GAC5B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use-Cases
|
|
3
|
+
*
|
|
4
|
+
* Bridge between the data layer and UI components from fansunited-sports-ui.
|
|
5
|
+
* Each use-case provides:
|
|
6
|
+
* - Server function (prepareX) for SSR/SSG
|
|
7
|
+
* - Client hook (usePrepareX) for client-side with React Query
|
|
8
|
+
*/
|
|
9
|
+
export { prepareMatchScore, usePrepareMatchScore, prepareMatchList, usePrepareMatchList } from "./match";
|
|
10
|
+
export { prepareTeamResults, usePrepareTeamResults, prepareTeamFixtures, usePrepareTeamFixtures, prepareTeamMatches, usePrepareTeamMatches, } from "./team";
|
|
11
|
+
export type { PrepareMatchScoreOptions, PrepareMatchScoreResult, UsePrepareMatchScoreOptions, PrepareMatchListOptions, PrepareMatchListResult, MatchListVariant, UsePrepareMatchListOptions, } from "./match";
|
|
12
|
+
export type { PrepareTeamMatchesBaseOptions, PrepareTeamResultsOptions, PrepareTeamFixturesOptions, PrepareTeamMatchesOptions, UseTeamMatchesHookOptions, } from "./team";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/use-cases/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGzG,OAAO,EACH,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GACxB,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACR,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,GAC7B,MAAM,SAAS,CAAC;AAGjB,YAAY,EACR,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,GAC5B,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mappers
|
|
3
|
+
*
|
|
4
|
+
* Internal utilities for transforming canonical types to UI props.
|
|
5
|
+
*/
|
|
6
|
+
export { mapCompetitor, mapScore, mapStatusCode, isLiveStatus, mapPeriod, createLiveIndicator, mapMatchToScoreContent, formatDateGroup, formatDateDisplay, } from "./matchMappers";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/mappers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,aAAa,EACb,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,GACpB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Match Mappers
|
|
3
|
+
*
|
|
4
|
+
* Transform canonical FUSports types to UI component props.
|
|
5
|
+
* These are internal utilities used by use-case functions.
|
|
6
|
+
*/
|
|
7
|
+
import type { FUSportsMatch, FUSportsCompetitor, FUSportsMatchStatus } from "../../types/canonical";
|
|
8
|
+
import type { MatchScoreContent, MatchCompetitor, CompetitorScore, MatchPeriod, LiveIndicator, MatchStatus } from "../types";
|
|
9
|
+
/**
|
|
10
|
+
* Map FUSportsCompetitor to UI MatchCompetitor
|
|
11
|
+
*/
|
|
12
|
+
export declare function mapCompetitor(competitor: FUSportsCompetitor, score?: string | null): MatchCompetitor;
|
|
13
|
+
/**
|
|
14
|
+
* Map score string to CompetitorScore
|
|
15
|
+
*/
|
|
16
|
+
export declare function mapScore(scoreValue: string | null): CompetitorScore;
|
|
17
|
+
/**
|
|
18
|
+
* Map FUSportsMatchStatus to UI MatchStatus type
|
|
19
|
+
*/
|
|
20
|
+
export declare function mapStatusCode(status: FUSportsMatchStatus): MatchStatus;
|
|
21
|
+
/**
|
|
22
|
+
* Check if status indicates a live match
|
|
23
|
+
*/
|
|
24
|
+
export declare function isLiveStatus(status: FUSportsMatchStatus): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Map match timing to period info
|
|
27
|
+
*/
|
|
28
|
+
export declare function mapPeriod(timing: FUSportsMatch["timing"], status: FUSportsMatchStatus): MatchPeriod | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Create live indicator for live matches
|
|
31
|
+
*/
|
|
32
|
+
export declare function createLiveIndicator(status: FUSportsMatchStatus): LiveIndicator | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Map full FUSportsMatch to MatchScoreContent for UI
|
|
35
|
+
*/
|
|
36
|
+
export declare function mapMatchToScoreContent(match: FUSportsMatch): MatchScoreContent;
|
|
37
|
+
/**
|
|
38
|
+
* Format date for grouping
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatDateGroup(date: Date): string;
|
|
41
|
+
/**
|
|
42
|
+
* Format date for display
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatDateDisplay(date: Date): string;
|
|
45
|
+
//# sourceMappingURL=matchMappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matchMappers.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/mappers/matchMappers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,KAAK,EACR,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACd,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,kBAAkB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CAQpG;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CAInE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,WAAW,CAkBtE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAEjE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,mBAAmB,GAAG,WAAW,GAAG,SAAS,CAO/G;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,aAAa,GAAG,SAAS,CAG1F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,iBAAiB,CA4B9E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAMpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Match Use-Cases
|
|
3
|
+
*
|
|
4
|
+
* Prepare match data for UI components.
|
|
5
|
+
*/
|
|
6
|
+
export { prepareMatchScore } from "./prepareMatchScore.server";
|
|
7
|
+
export type { PrepareMatchScoreOptions, PrepareMatchScoreResult } from "./prepareMatchScore.server";
|
|
8
|
+
export { prepareMatchList } from "./prepareMatchList.server";
|
|
9
|
+
export type { PrepareMatchListOptions, PrepareMatchListResult, MatchListVariant } from "./prepareMatchList.server";
|
|
10
|
+
export { usePrepareMatchScore } from "./usePrepareMatchScore";
|
|
11
|
+
export type { UsePrepareMatchScoreOptions } from "./usePrepareMatchScore";
|
|
12
|
+
export { usePrepareMatchList } from "./usePrepareMatchList";
|
|
13
|
+
export type { UsePrepareMatchListOptions } from "./usePrepareMatchList";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/match/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prepareMatchList Server Function
|
|
3
|
+
*
|
|
4
|
+
* Prepares match list data for the MatchListBlock UI component.
|
|
5
|
+
* Supports multiple variants: daily, round, competition, teamResults, etc.
|
|
6
|
+
*/
|
|
7
|
+
import type { MatchListItem, MatchListBlockVariant } from "../types";
|
|
8
|
+
/**
|
|
9
|
+
* Match list variant - determines grouping and display
|
|
10
|
+
*/
|
|
11
|
+
export type MatchListVariant = MatchListBlockVariant;
|
|
12
|
+
/**
|
|
13
|
+
* Options for prepareMatchList
|
|
14
|
+
*/
|
|
15
|
+
export interface PrepareMatchListOptions {
|
|
16
|
+
/** Variant determines how matches are grouped */
|
|
17
|
+
variant: MatchListVariant;
|
|
18
|
+
/** Language code for translations */
|
|
19
|
+
languageCode?: string;
|
|
20
|
+
/** Filter matches from this date */
|
|
21
|
+
fromDate?: string;
|
|
22
|
+
/** Filter matches until this date */
|
|
23
|
+
toDate?: string;
|
|
24
|
+
/** Filter by tournament IDs */
|
|
25
|
+
tournamentIds?: string[];
|
|
26
|
+
/** Filter by team ID (for team variants) */
|
|
27
|
+
teamId?: string;
|
|
28
|
+
/** Filter by round IDs */
|
|
29
|
+
roundIds?: string[];
|
|
30
|
+
/** Filter by season IDs */
|
|
31
|
+
seasonIds?: string[];
|
|
32
|
+
/** Filter by match status types */
|
|
33
|
+
statusTypes?: ("NOT_STARTED" | "LIVE" | "FINISHED")[];
|
|
34
|
+
/** Number of matches to fetch */
|
|
35
|
+
limit?: number;
|
|
36
|
+
/** Offset for pagination */
|
|
37
|
+
offset?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Result type for prepareMatchList
|
|
41
|
+
*/
|
|
42
|
+
export interface PrepareMatchListResult {
|
|
43
|
+
items: MatchListItem[];
|
|
44
|
+
variant: MatchListVariant;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Server function: Prepare match list for MatchListBlock component
|
|
48
|
+
*
|
|
49
|
+
* @param options - Filter and variant options
|
|
50
|
+
* @returns PrepareMatchListResult ready for the MatchListBlock component
|
|
51
|
+
*/
|
|
52
|
+
export declare function prepareMatchList(options: PrepareMatchListOptions): Promise<PrepareMatchListResult>;
|
|
53
|
+
//# sourceMappingURL=prepareMatchList.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareMatchList.server.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/match/prepareMatchList.server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIrE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,iDAAiD;IACjD,OAAO,EAAE,gBAAgB,CAAC;IAC1B,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAGrB,mCAAmC;IACnC,WAAW,CAAC,EAAE,CAAC,aAAa,GAAG,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC;IAGtD,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,OAAO,EAAE,gBAAgB,CAAC;CAC7B;AAmDD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAUxG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prepareMatchScore Server Function
|
|
3
|
+
*
|
|
4
|
+
* Prepares match data for the MatchScore UI component.
|
|
5
|
+
* Use in Server Components for SSR/SSG.
|
|
6
|
+
*/
|
|
7
|
+
import type { MatchScoreContent } from "../types";
|
|
8
|
+
/**
|
|
9
|
+
* Options for prepareMatchScore
|
|
10
|
+
*/
|
|
11
|
+
export interface PrepareMatchScoreOptions {
|
|
12
|
+
/** Language code for translations */
|
|
13
|
+
languageCode?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Result type for prepareMatchScore
|
|
17
|
+
*/
|
|
18
|
+
export type PrepareMatchScoreResult = MatchScoreContent;
|
|
19
|
+
/**
|
|
20
|
+
* Server function: Prepare match data for MatchScore component
|
|
21
|
+
*
|
|
22
|
+
* Use this in Server Components for SSR/SSG:
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const matchData = await prepareMatchScore('123');
|
|
25
|
+
* return <MatchScore match={matchData} />;
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @param matchId - The match ID, UUID, or slug
|
|
29
|
+
* @param options - Optional parameters
|
|
30
|
+
* @returns MatchScoreContent ready for the MatchScore component
|
|
31
|
+
*/
|
|
32
|
+
export declare function prepareMatchScore(matchId: string, options?: PrepareMatchScoreOptions): Promise<PrepareMatchScoreResult>;
|
|
33
|
+
//# sourceMappingURL=prepareMatchScore.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareMatchScore.server.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/match/prepareMatchScore.server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,wBAAwB,GACnC,OAAO,CAAC,uBAAuB,CAAC,CAMlC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type PrepareMatchListOptions, type PrepareMatchListResult } from "./prepareMatchList.server";
|
|
2
|
+
/**
|
|
3
|
+
* Hook options for usePrepareMatchList
|
|
4
|
+
*/
|
|
5
|
+
export interface UsePrepareMatchListOptions extends PrepareMatchListOptions {
|
|
6
|
+
/** Initial data from server (for hydration) */
|
|
7
|
+
initialData?: PrepareMatchListResult;
|
|
8
|
+
/** Whether to enable the query */
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
/** Refetch interval in milliseconds (false to disable) */
|
|
11
|
+
refetchInterval?: number | false;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Client hook: Prepare match list with React Query
|
|
15
|
+
*
|
|
16
|
+
* @param options - Query options including filters and variant
|
|
17
|
+
* @returns React Query result with PrepareMatchListResult
|
|
18
|
+
*/
|
|
19
|
+
export declare function usePrepareMatchList(options: UsePrepareMatchListOptions): import("@tanstack/react-query").UseQueryResult<PrepareMatchListResult, Error>;
|
|
20
|
+
//# sourceMappingURL=usePrepareMatchList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrepareMatchList.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/match/usePrepareMatchList.ts"],"names":[],"mappings":"AAUA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAExH;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACvE,+CAA+C;IAC/C,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACpC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,iFA2BtE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type PrepareMatchScoreOptions, type PrepareMatchScoreResult } from "./prepareMatchScore.server";
|
|
2
|
+
/**
|
|
3
|
+
* Hook options for usePrepareMatchScore
|
|
4
|
+
*/
|
|
5
|
+
export interface UsePrepareMatchScoreOptions extends PrepareMatchScoreOptions {
|
|
6
|
+
/** Initial data from server (for hydration) */
|
|
7
|
+
initialData?: PrepareMatchScoreResult;
|
|
8
|
+
/** Whether to enable the query */
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
/** Refetch interval in milliseconds (false to disable) */
|
|
11
|
+
refetchInterval?: number | false;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Client hook: Prepare match data with React Query
|
|
15
|
+
*
|
|
16
|
+
* Use this in Client Components for live updates:
|
|
17
|
+
* ```tsx
|
|
18
|
+
* 'use client'
|
|
19
|
+
* const { data, isLoading } = usePrepareMatchScore('123', {
|
|
20
|
+
* initialData,
|
|
21
|
+
* refetchInterval: 30000 // Poll every 30s for live matches
|
|
22
|
+
* });
|
|
23
|
+
* return <MatchScore match={data} />;
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param matchId - The match ID, UUID, or slug
|
|
27
|
+
* @param options - Query options including initial data and refetch interval
|
|
28
|
+
* @returns React Query result with MatchScoreContent
|
|
29
|
+
*/
|
|
30
|
+
export declare function usePrepareMatchScore(matchId: string, options?: UsePrepareMatchScoreOptions): import("@tanstack/react-query").UseQueryResult<import("fansunited-sports-ui").MatchScoreContent, Error>;
|
|
31
|
+
//# sourceMappingURL=usePrepareMatchScore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrepareMatchScore.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/match/usePrepareMatchScore.ts"],"names":[],"mappings":"AAUA,OAAO,EAAqB,KAAK,wBAAwB,EAAE,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE5H;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,wBAAwB;IACzE,+CAA+C;IAC/C,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,2GAa1F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team Use-Cases
|
|
3
|
+
*
|
|
4
|
+
* Prepare team-related data for UI components.
|
|
5
|
+
*/
|
|
6
|
+
export { prepareTeamResults, prepareTeamFixtures, prepareTeamMatches } from "./prepareTeamMatches.server";
|
|
7
|
+
export type { PrepareTeamMatchesBaseOptions, PrepareTeamResultsOptions, PrepareTeamFixturesOptions, PrepareTeamMatchesOptions, } from "./prepareTeamMatches.server";
|
|
8
|
+
export { usePrepareTeamResults, usePrepareTeamFixtures, usePrepareTeamMatches } from "./usePrepareTeamMatches";
|
|
9
|
+
export type { UseTeamMatchesHookOptions } from "./usePrepareTeamMatches";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/team/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC1G,YAAY,EACR,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,GAC5B,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC/G,YAAY,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team Matches Server Functions
|
|
3
|
+
*
|
|
4
|
+
* Convenience wrappers around prepareMatchList for team-specific queries.
|
|
5
|
+
* Provides semantic API for team results, fixtures, and combined matches.
|
|
6
|
+
*/
|
|
7
|
+
import { type PrepareMatchListResult } from "../match/prepareMatchList.server";
|
|
8
|
+
/**
|
|
9
|
+
* Common options for team match queries
|
|
10
|
+
*/
|
|
11
|
+
export interface PrepareTeamMatchesBaseOptions {
|
|
12
|
+
/** Language code for translations */
|
|
13
|
+
languageCode?: string;
|
|
14
|
+
/** Filter by season ID */
|
|
15
|
+
seasonId?: string;
|
|
16
|
+
/** Filter by tournament IDs */
|
|
17
|
+
tournamentIds?: string[];
|
|
18
|
+
/** Number of matches to fetch */
|
|
19
|
+
limit?: number;
|
|
20
|
+
/** Offset for pagination */
|
|
21
|
+
offset?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options for prepareTeamResults
|
|
25
|
+
*/
|
|
26
|
+
export interface PrepareTeamResultsOptions extends PrepareTeamMatchesBaseOptions {
|
|
27
|
+
/** Whether to group by competition */
|
|
28
|
+
groupByCompetition?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Options for prepareTeamFixtures
|
|
32
|
+
*/
|
|
33
|
+
export interface PrepareTeamFixturesOptions extends PrepareTeamMatchesBaseOptions {
|
|
34
|
+
/** Whether to group by competition */
|
|
35
|
+
groupByCompetition?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Options for prepareTeamMatches (combined results + fixtures)
|
|
39
|
+
*/
|
|
40
|
+
export interface PrepareTeamMatchesOptions extends PrepareTeamMatchesBaseOptions {
|
|
41
|
+
/** Whether to group by competition */
|
|
42
|
+
groupByCompetition?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Server function: Get past matches (results) for a team
|
|
46
|
+
*/
|
|
47
|
+
export declare function prepareTeamResults(teamId: string, options?: PrepareTeamResultsOptions): Promise<PrepareMatchListResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Server function: Get upcoming matches (fixtures) for a team
|
|
50
|
+
*/
|
|
51
|
+
export declare function prepareTeamFixtures(teamId: string, options?: PrepareTeamFixturesOptions): Promise<PrepareMatchListResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Server function: Get all matches (results + fixtures) for a team
|
|
54
|
+
*/
|
|
55
|
+
export declare function prepareTeamMatches(teamId: string, options?: PrepareTeamMatchesOptions): Promise<PrepareMatchListResult>;
|
|
56
|
+
//# sourceMappingURL=prepareTeamMatches.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareTeamMatches.server.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/team/prepareTeamMatches.server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEH,KAAK,sBAAsB,EAE9B,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC1C,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,6BAA6B;IAC5E,sCAAsC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,6BAA6B;IAC7E,sCAAsC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,6BAA6B;IAC5E,sCAAsC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,yBAAyB,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAajC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,0BAA0B,GACrC,OAAO,CAAC,sBAAsB,CAAC,CAajC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,yBAAyB,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAYjC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PrepareMatchListResult } from "../match/prepareMatchList.server";
|
|
2
|
+
import { type PrepareTeamResultsOptions, type PrepareTeamFixturesOptions, type PrepareTeamMatchesOptions } from "./prepareTeamMatches.server";
|
|
3
|
+
/**
|
|
4
|
+
* Hook options for team match hooks
|
|
5
|
+
*/
|
|
6
|
+
export interface UseTeamMatchesHookOptions {
|
|
7
|
+
/** Initial data from server (for hydration) */
|
|
8
|
+
initialData?: PrepareMatchListResult;
|
|
9
|
+
/** Whether to enable the query */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Refetch interval in milliseconds (false to disable) */
|
|
12
|
+
refetchInterval?: number | false;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Client hook: Get past matches (results) for a team
|
|
16
|
+
*/
|
|
17
|
+
export declare function usePrepareTeamResults(teamId: string, options?: PrepareTeamResultsOptions & UseTeamMatchesHookOptions): import("@tanstack/react-query").UseQueryResult<PrepareMatchListResult, Error>;
|
|
18
|
+
/**
|
|
19
|
+
* Client hook: Get upcoming matches (fixtures) for a team
|
|
20
|
+
*/
|
|
21
|
+
export declare function usePrepareTeamFixtures(teamId: string, options?: PrepareTeamFixturesOptions & UseTeamMatchesHookOptions): import("@tanstack/react-query").UseQueryResult<PrepareMatchListResult, Error>;
|
|
22
|
+
/**
|
|
23
|
+
* Client hook: Get all matches (results + fixtures) for a team
|
|
24
|
+
*/
|
|
25
|
+
export declare function usePrepareTeamMatches(teamId: string, options?: PrepareTeamMatchesOptions & UseTeamMatchesHookOptions): import("@tanstack/react-query").UseQueryResult<PrepareMatchListResult, Error>;
|
|
26
|
+
//# sourceMappingURL=usePrepareTeamMatches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrepareTeamMatches.d.ts","sourceRoot":"","sources":["../../../src/lib/use-cases/team/usePrepareTeamMatches.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAIH,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EACjC,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,yBAAyB,iFAsBpH;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,0BAA0B,GAAG,yBAAyB,iFAuBnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,yBAAyB,iFAsBpH"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use-Case Types
|
|
3
|
+
*
|
|
4
|
+
* Re-exports UI component prop types from fansunited-sports-ui
|
|
5
|
+
* for use in use-case functions.
|
|
6
|
+
*/
|
|
7
|
+
export type { MatchScoreContent, MatchScoreProps, MatchCompetitor, CompetitorScore, MatchPeriod, LiveIndicator, MatchBettingOdds, MatchListBlockProps, MatchListBlockVariant, MatchListItem, MatchListBlockStyles, MatchScoreStyles, MatchStatus, } from "fansunited-sports-ui";
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/use-cases/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACR,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,GACd,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fansunited-data-layer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -24,11 +24,14 @@
|
|
|
24
24
|
"preview": "vite preview"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
+
"@tanstack/react-query": "^5.90.11",
|
|
28
|
+
"fansunited-sports-ui": "^0.0.1",
|
|
27
29
|
"react": "^18.0.0 || ^19.0.0",
|
|
28
30
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@eslint/js": "^9.39.1",
|
|
34
|
+
"@tanstack/react-query": "^5.90.11",
|
|
32
35
|
"@types/node": "^24.10.1",
|
|
33
36
|
"@types/react": "^19.2.5",
|
|
34
37
|
"@types/react-dom": "^19.2.3",
|
|
@@ -36,6 +39,7 @@
|
|
|
36
39
|
"eslint": "^9.39.1",
|
|
37
40
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
38
41
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
42
|
+
"fansunited-sports-ui": "^0.0.1",
|
|
39
43
|
"globals": "^16.5.0",
|
|
40
44
|
"prettier": "^3.7.3",
|
|
41
45
|
"react": "^19.2.0",
|