be-components 6.5.0 → 6.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +4 -4
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -1
  3. package/lib/commonjs/Authenticator/Components/StrategyForm.js +2 -0
  4. package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -1
  5. package/lib/commonjs/Authenticator/index.js +1 -0
  6. package/lib/commonjs/Authenticator/index.js.map +1 -1
  7. package/lib/commonjs/Clarity/SmartEvents.js +19 -0
  8. package/lib/commonjs/Clarity/SmartEvents.js.map +1 -0
  9. package/lib/commonjs/Components/AutoPageFlatList.js +92 -0
  10. package/lib/commonjs/Components/AutoPageFlatList.js.map +1 -0
  11. package/lib/commonjs/Components/AutoScrollFlatList.js.map +1 -1
  12. package/lib/commonjs/Components/CircularFadeOut.js +34 -0
  13. package/lib/commonjs/Components/CircularFadeOut.js.map +1 -0
  14. package/lib/commonjs/Components/Jerseys.js +5 -2
  15. package/lib/commonjs/Components/Jerseys.js.map +1 -1
  16. package/lib/commonjs/Components/LinearDiagnal.js +3 -1
  17. package/lib/commonjs/Components/LinearDiagnal.js.map +1 -1
  18. package/lib/commonjs/Components/Pagination.js +4 -4
  19. package/lib/commonjs/Components/Pagination.js.map +1 -1
  20. package/lib/commonjs/Components/Themed.js +4 -1
  21. package/lib/commonjs/Components/Themed.js.map +1 -1
  22. package/lib/commonjs/Components/index.js +14 -0
  23. package/lib/commonjs/Components/index.js.map +1 -1
  24. package/lib/commonjs/EventComponents/TeamProfile/index.js.map +1 -1
  25. package/lib/commonjs/GuideView/index.js +216 -0
  26. package/lib/commonjs/GuideView/index.js.map +1 -0
  27. package/lib/commonjs/MarketComponents/api/index.js +25 -0
  28. package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
  29. package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js +2 -2
  30. package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js.map +1 -1
  31. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +19 -6
  32. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  33. package/lib/commonjs/MarketComponents/components/TeamTournamentMarket/index.js +2 -1
  34. package/lib/commonjs/MarketComponents/components/TeamTournamentMarket/index.js.map +1 -1
  35. package/lib/commonjs/RankingsCard/api/index.js +88 -0
  36. package/lib/commonjs/RankingsCard/api/index.js.map +1 -0
  37. package/lib/commonjs/RankingsCard/index.js +663 -0
  38. package/lib/commonjs/RankingsCard/index.js.map +1 -0
  39. package/lib/commonjs/index.js +21 -0
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/types.d.js +1 -0
  42. package/lib/commonjs/types.d.js.map +1 -1
  43. package/lib/module/ApiOverrides/index.js +4 -4
  44. package/lib/module/ApiOverrides/index.js.map +1 -1
  45. package/lib/module/Authenticator/Components/StrategyForm.js +2 -0
  46. package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -1
  47. package/lib/module/Authenticator/index.js +1 -0
  48. package/lib/module/Authenticator/index.js.map +1 -1
  49. package/lib/module/Clarity/SmartEvents.js +13 -0
  50. package/lib/module/Clarity/SmartEvents.js.map +1 -0
  51. package/lib/module/Components/AutoPageFlatList.js +84 -0
  52. package/lib/module/Components/AutoPageFlatList.js.map +1 -0
  53. package/lib/module/Components/AutoScrollFlatList.js.map +1 -1
  54. package/lib/module/Components/CircularFadeOut.js +27 -0
  55. package/lib/module/Components/CircularFadeOut.js.map +1 -0
  56. package/lib/module/Components/Jerseys.js +5 -2
  57. package/lib/module/Components/Jerseys.js.map +1 -1
  58. package/lib/module/Components/LinearDiagnal.js +3 -1
  59. package/lib/module/Components/LinearDiagnal.js.map +1 -1
  60. package/lib/module/Components/Pagination.js +4 -4
  61. package/lib/module/Components/Pagination.js.map +1 -1
  62. package/lib/module/Components/Themed.js +4 -1
  63. package/lib/module/Components/Themed.js.map +1 -1
  64. package/lib/module/Components/index.js +3 -1
  65. package/lib/module/Components/index.js.map +1 -1
  66. package/lib/module/EventComponents/TeamProfile/index.js.map +1 -1
  67. package/lib/module/GuideView/index.js +209 -0
  68. package/lib/module/GuideView/index.js.map +1 -0
  69. package/lib/module/MarketComponents/api/index.js +25 -0
  70. package/lib/module/MarketComponents/api/index.js.map +1 -1
  71. package/lib/module/MarketComponents/components/AthleteMarket/index.js +2 -2
  72. package/lib/module/MarketComponents/components/AthleteMarket/index.js.map +1 -1
  73. package/lib/module/MarketComponents/components/TeamEventMarket/index.js +19 -6
  74. package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  75. package/lib/module/MarketComponents/components/TeamTournamentMarket/index.js +2 -1
  76. package/lib/module/MarketComponents/components/TeamTournamentMarket/index.js.map +1 -1
  77. package/lib/module/RankingsCard/api/index.js +82 -0
  78. package/lib/module/RankingsCard/api/index.js.map +1 -0
  79. package/lib/module/RankingsCard/index.js +655 -0
  80. package/lib/module/RankingsCard/index.js.map +1 -0
  81. package/lib/module/index.js +4 -1
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/types.d.js +1 -0
  84. package/lib/module/types.d.js.map +1 -1
  85. package/lib/typescript/lib/commonjs/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  86. package/lib/typescript/lib/commonjs/Authenticator/index.d.ts.map +1 -1
  87. package/lib/typescript/lib/commonjs/Clarity/SmartEvents.d.ts +14 -0
  88. package/lib/typescript/lib/commonjs/Clarity/SmartEvents.d.ts.map +1 -0
  89. package/lib/typescript/lib/commonjs/Components/AutoPageFlatList.d.ts +12 -0
  90. package/lib/typescript/lib/commonjs/Components/AutoPageFlatList.d.ts.map +1 -0
  91. package/lib/typescript/lib/commonjs/Components/CircularFadeOut.d.ts +9 -0
  92. package/lib/typescript/lib/commonjs/Components/CircularFadeOut.d.ts.map +1 -0
  93. package/lib/typescript/lib/commonjs/Components/Jerseys.d.ts +3 -1
  94. package/lib/typescript/lib/commonjs/Components/Jerseys.d.ts.map +1 -1
  95. package/lib/typescript/lib/commonjs/Components/LinearDiagnal.d.ts +2 -1
  96. package/lib/typescript/lib/commonjs/Components/LinearDiagnal.d.ts.map +1 -1
  97. package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
  98. package/lib/typescript/lib/commonjs/Components/index.d.ts +2 -0
  99. package/lib/typescript/lib/commonjs/GuideView/index.d.ts +7 -0
  100. package/lib/typescript/lib/commonjs/GuideView/index.d.ts.map +1 -0
  101. package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +3 -0
  102. package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
  103. package/lib/typescript/lib/commonjs/RankingsCard/api/index.d.ts +14 -0
  104. package/lib/typescript/lib/commonjs/RankingsCard/api/index.d.ts.map +1 -0
  105. package/lib/typescript/lib/commonjs/RankingsCard/index.d.ts +7 -0
  106. package/lib/typescript/lib/commonjs/RankingsCard/index.d.ts.map +1 -0
  107. package/lib/typescript/lib/commonjs/index.d.ts +3 -0
  108. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  109. package/lib/typescript/lib/module/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  110. package/lib/typescript/lib/module/Authenticator/index.d.ts.map +1 -1
  111. package/lib/typescript/lib/module/Clarity/SmartEvents.d.ts +13 -0
  112. package/lib/typescript/lib/module/Clarity/SmartEvents.d.ts.map +1 -0
  113. package/lib/typescript/lib/module/Components/AutoPageFlatList.d.ts +12 -0
  114. package/lib/typescript/lib/module/Components/AutoPageFlatList.d.ts.map +1 -0
  115. package/lib/typescript/lib/module/Components/CircularFadeOut.d.ts +9 -0
  116. package/lib/typescript/lib/module/Components/CircularFadeOut.d.ts.map +1 -0
  117. package/lib/typescript/lib/module/Components/Jerseys.d.ts +3 -1
  118. package/lib/typescript/lib/module/Components/Jerseys.d.ts.map +1 -1
  119. package/lib/typescript/lib/module/Components/LinearDiagnal.d.ts +2 -1
  120. package/lib/typescript/lib/module/Components/LinearDiagnal.d.ts.map +1 -1
  121. package/lib/typescript/lib/module/Components/Spring.d.ts +1 -1
  122. package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
  123. package/lib/typescript/lib/module/Components/index.d.ts +3 -1
  124. package/lib/typescript/lib/module/Components/index.d.ts.map +1 -1
  125. package/lib/typescript/lib/module/GuideView/index.d.ts +8 -0
  126. package/lib/typescript/lib/module/GuideView/index.d.ts.map +1 -0
  127. package/lib/typescript/lib/module/LocationTracker/api/index.d.ts +2 -2
  128. package/lib/typescript/lib/module/LocationTracker/api/index.d.ts.map +1 -1
  129. package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +3 -0
  130. package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
  131. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts +2 -1
  132. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  133. package/lib/typescript/lib/module/MarketComponents/components/TeamTournamentMarket/index.d.ts +2 -1
  134. package/lib/typescript/lib/module/MarketComponents/components/TeamTournamentMarket/index.d.ts.map +1 -1
  135. package/lib/typescript/lib/module/RankingsCard/api/index.d.ts +13 -0
  136. package/lib/typescript/lib/module/RankingsCard/api/index.d.ts.map +1 -0
  137. package/lib/typescript/lib/module/RankingsCard/index.d.ts +9 -0
  138. package/lib/typescript/lib/module/RankingsCard/index.d.ts.map +1 -0
  139. package/lib/typescript/lib/module/index.d.ts +4 -1
  140. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  141. package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  142. package/lib/typescript/src/Authenticator/index.d.ts.map +1 -1
  143. package/lib/typescript/src/Clarity/SmartEvents.d.ts +13 -0
  144. package/lib/typescript/src/Clarity/SmartEvents.d.ts.map +1 -0
  145. package/lib/typescript/src/Components/AutoPageFlatList.d.ts +15 -0
  146. package/lib/typescript/src/Components/AutoPageFlatList.d.ts.map +1 -0
  147. package/lib/typescript/src/Components/AutoScrollFlatList.d.ts.map +1 -1
  148. package/lib/typescript/src/Components/CircularFadeOut.d.ts +10 -0
  149. package/lib/typescript/src/Components/CircularFadeOut.d.ts.map +1 -0
  150. package/lib/typescript/src/Components/Jerseys.d.ts +3 -1
  151. package/lib/typescript/src/Components/Jerseys.d.ts.map +1 -1
  152. package/lib/typescript/src/Components/LinearDiagnal.d.ts +3 -1
  153. package/lib/typescript/src/Components/LinearDiagnal.d.ts.map +1 -1
  154. package/lib/typescript/src/Components/Pagination.d.ts +2 -2
  155. package/lib/typescript/src/Components/Pagination.d.ts.map +1 -1
  156. package/lib/typescript/src/Components/Themed.d.ts +1 -0
  157. package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
  158. package/lib/typescript/src/Components/index.d.ts +3 -1
  159. package/lib/typescript/src/Components/index.d.ts.map +1 -1
  160. package/lib/typescript/src/EventComponents/TeamProfile/index.d.ts.map +1 -1
  161. package/lib/typescript/src/GuideView/index.d.ts +8 -0
  162. package/lib/typescript/src/GuideView/index.d.ts.map +1 -0
  163. package/lib/typescript/src/MarketComponents/api/index.d.ts +9 -1
  164. package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
  165. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +3 -2
  166. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  167. package/lib/typescript/src/MarketComponents/components/TeamTournamentMarket/index.d.ts +2 -1
  168. package/lib/typescript/src/MarketComponents/components/TeamTournamentMarket/index.d.ts.map +1 -1
  169. package/lib/typescript/src/MarketComponents/index.d.ts +4 -2
  170. package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
  171. package/lib/typescript/src/RankingsCard/api/index.d.ts +20 -0
  172. package/lib/typescript/src/RankingsCard/api/index.d.ts.map +1 -0
  173. package/lib/typescript/src/RankingsCard/index.d.ts +8 -0
  174. package/lib/typescript/src/RankingsCard/index.d.ts.map +1 -0
  175. package/lib/typescript/src/index.d.ts +4 -1
  176. package/lib/typescript/src/index.d.ts.map +1 -1
  177. package/package.json +1 -1
  178. package/src/ApiOverrides/index.ts +4 -4
  179. package/src/Authenticator/Components/StrategyForm.tsx +2 -0
  180. package/src/Authenticator/index.tsx +2 -0
  181. package/src/Clarity/SmartEvents.ts +13 -0
  182. package/src/Components/AutoPageFlatList.tsx +99 -0
  183. package/src/Components/AutoScrollFlatList.tsx +0 -1
  184. package/src/Components/CircularFadeOut.tsx +36 -0
  185. package/src/Components/Jerseys.tsx +5 -3
  186. package/src/Components/LinearDiagnal.tsx +4 -3
  187. package/src/Components/Pagination.tsx +6 -4
  188. package/src/Components/Themed.tsx +6 -4
  189. package/src/Components/index.tsx +4 -0
  190. package/src/EventComponents/TeamProfile/index.tsx +0 -1
  191. package/src/GuideView/index.tsx +176 -0
  192. package/src/MarketComponents/api/index.ts +26 -1
  193. package/src/MarketComponents/components/AthleteMarket/index.tsx +2 -2
  194. package/src/MarketComponents/components/TeamEventMarket/index.tsx +17 -6
  195. package/src/MarketComponents/components/TeamTournamentMarket/index.tsx +3 -2
  196. package/src/RankingsCard/api/index.ts +80 -0
  197. package/src/RankingsCard/index.tsx +398 -0
  198. package/src/index.tsx +6 -2
  199. package/src/types.d.ts +53 -2
@@ -13,6 +13,7 @@ type TeamTournamentMarketProps = {
13
13
  tournament:TournamentProps,
14
14
  event_type:'team'|'tournament'|'match',
15
15
  team:TeamProps,
16
+ image_size?:number,
16
17
  hide_stat_banner?:boolean,
17
18
  width?:number,
18
19
  float?:boolean,
@@ -32,7 +33,7 @@ type TeamTournamentMarketProps = {
32
33
  onTradeLongPress:(trade:TradeProps) => void
33
34
  }
34
35
 
35
- const TeamTournamentMarket = ({ tournament, disabled_markets, float, direction, show_event, hide_liquidity, hide_stat_banner, style, team, market, event_order_stats, default_price_view, latest_trades, show_grades, best_available_orders, onOrder, onView, onTradeLongPress }:TeamTournamentMarketProps) => {
36
+ const TeamTournamentMarket = ({ tournament, image_size, disabled_markets, float, direction, show_event, hide_liquidity, hide_stat_banner, style, team, market, event_order_stats, default_price_view, latest_trades, show_grades, best_available_orders, onOrder, onView, onTradeLongPress }:TeamTournamentMarketProps) => {
36
37
  const C = useColors();
37
38
  const { liquidity, open_order_count } = MarketComponentHelpers.getLiqudity(event_order_stats);
38
39
  const is_locked = useMemo(() => MarketComponentHelpers.isTournamentMarketLocked(tournament, market.market_id),[JSON.stringify(tournament.supported_markets)])
@@ -87,7 +88,7 @@ const TeamTournamentMarket = ({ tournament, disabled_markets, float, direction,
87
88
  <View transparent style={{ ...view_styles.section_body, flexDirection:direction == 'horizontal' ? 'row' : 'column', flexGrow:2, padding:0, justifyContent:'center', alignItems:'center' }}>
88
89
  <TeamImage
89
90
  team={team}
90
- size={24}
91
+ size={image_size ?? 24}
91
92
  />
92
93
  <View transparent style={{ padding:10, paddingBottom:0 }}>
93
94
  <Text theme='h2' textAlign='center'>{team.market_name} {team.name}</Text>
@@ -0,0 +1,80 @@
1
+ import axios from 'axios';
2
+ import { APIOverrides } from "../../ApiOverrides"
3
+ import type { LeagueProps, TeamProps, TeamRankingProps, TeamRecordProps } from '../../types';
4
+
5
+
6
+ let EVENT_SVC_API = ''
7
+ //let AUTH_SVC_API = ''
8
+ //let MK_SVC_API = ''
9
+ //let SOCIAL_SVC_API = ''
10
+
11
+ export { RankingsApi, RankingsHelpers }
12
+
13
+ const RankingsApi = {
14
+ setEnvironment: () => {
15
+ const endpoints = APIOverrides.getEndpoints();
16
+ EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
17
+ //MK_SVC_API = endpoints['MK_SVC_API'] as string;
18
+ //AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
19
+ //SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
20
+ },
21
+ getLeagues: async():Promise<LeagueProps[]> => {
22
+ try {
23
+ const resp = await axios.get(`${EVENT_SVC_API}/v1/leagues/all`);
24
+ return resp.data.leagues
25
+ } catch (e) {
26
+ return []
27
+ }
28
+ },
29
+ getStandingsByLeague: async(league_id:string, year:number):Promise<undefined|{ teams:TeamProps[], league:LeagueProps, team_rankings:TeamRankingProps[], team_records:TeamRecordProps[] }> => {
30
+ try {
31
+ const resp = await axios.get(`${EVENT_SVC_API}/v1/teams/standings/league/${league_id}/${year}`);
32
+ return resp.data
33
+ } catch (e) {
34
+ return undefined
35
+ }
36
+ },
37
+ getTeamsByLeagueId:async(league_id:string):Promise<TeamProps[]> => {
38
+ try {
39
+ console.log('here')
40
+ const resp = await axios.get(`${EVENT_SVC_API}/v1/teams/league/${league_id}`);
41
+ console.log(resp.data)
42
+ return resp.data.teams
43
+ } catch (e) {
44
+ console.log(e)
45
+ return []
46
+ }
47
+ },
48
+ }
49
+
50
+
51
+
52
+ const RankingsHelpers = {
53
+ getWinPct: (wins:number, losses:number, draws:number) => {
54
+ const total = wins + losses + draws;
55
+ if (total === 0) return 0; // avoid divide by zero
56
+ return (wins + 0.5 * draws) / total;
57
+ },
58
+ getRankingTypeDescriptor: (ranking_type:string) => {
59
+ switch(ranking_type){
60
+ case 'PRE': return 'Preseason'
61
+ case 'REG': return 'Regular Season'
62
+ case 'PST': return 'Post Season'
63
+ default: return ranking_type
64
+ }
65
+ },
66
+ sortDivisions: (league_id:string, divisions:string[]) => {
67
+ switch(league_id){
68
+ case '2':
69
+ return ['I-A', 'I-AA', 'Division II', 'Division III']
70
+ default: return divisions.sort((a,b) => a.localeCompare(b))
71
+ }
72
+ },
73
+ getDivisionLabel: (division:string) => {
74
+ switch(division){
75
+ case 'I-A': return 'FBS (Division I-A)'
76
+ case 'I-AA': return 'FCS (Division I-AA)'
77
+ default: return division
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,398 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Button, Text, View } from "../Components/Themed"
3
+ import { RankingsApi, RankingsHelpers } from './api';
4
+ import type { LeagueProps, TeamProps, TeamRankingProps, TeamRecordProps } from '../types';
5
+ import { ActivityIndicator, FlatList, Image } from 'react-native';
6
+ import moment from 'moment-mini';
7
+ import { useColors } from '../constants/useColors';
8
+ import { Icons } from '../Components';
9
+ import { TeamImage } from '../Components/Jerseys';
10
+
11
+ type RankingsCardProps = {
12
+ league_id:string,
13
+ team_id?:string
14
+ }
15
+
16
+ type RankingsStateProps = {
17
+ loading:boolean,
18
+ ranking_type:string,
19
+ ranking_types:string[],
20
+ years:number[],
21
+ active_division?:string,
22
+ active_sub_division?:string,
23
+ year:number,
24
+ league?:LeagueProps,
25
+ teams:TeamProps[],
26
+ sub_type:string,
27
+ team?:TeamProps,
28
+ team_ranking?:TeamRankingProps,
29
+ team_record?:TeamRecordProps,
30
+ leagues: LeagueProps[],
31
+ divisions:string[],
32
+ sub_divisions:string[],
33
+ team_records:TeamRecordProps[],
34
+ team_rankings: TeamRankingProps[]
35
+ }
36
+
37
+ const RankingsCard = ({ league_id, team_id }:RankingsCardProps) => {
38
+ const Colors = useColors();
39
+ const [ show_types, setShowTypes ] = useState(false);
40
+ const [ show_years, setShowYears ] = useState(false);
41
+ const [ show_sub_divisions, setShowSubDivisions ] = useState(false);
42
+ const [ rankings_state, setRankingsState ] = useState<RankingsStateProps>({
43
+ loading:false,
44
+ teams:[],
45
+ ranking_type: 'PRE',
46
+ active_division: '',
47
+ years: [2025,2024,2023],
48
+ year: 2025,
49
+ ranking_types: [],
50
+ sub_type:'sub_division',
51
+ leagues: [],
52
+ team_rankings: [],
53
+ team_records: [],
54
+ divisions: [],
55
+ sub_divisions:[],
56
+ });
57
+ const { loading, team, ranking_type, active_sub_division, active_division, years, year, ranking_types, league, sub_type, teams, team_rankings, team_records, divisions } = rankings_state;
58
+
59
+ const division_teams = teams.filter(t => t.division == active_division);
60
+ let available_sub_divisions = [ ...new Set(division_teams.map(t => t.sub_division ?? 'NA')) ].filter(sd => sd && sd != 'NA')
61
+ let visible_sub_divisions = [ ...available_sub_divisions ];
62
+ if(active_sub_division){
63
+ visible_sub_divisions = available_sub_divisions.filter(sd => sd == active_sub_division)
64
+ }
65
+
66
+ useEffect(() => {
67
+ getRankings(league_id)
68
+ },[league_id, team_id]);
69
+
70
+ const getRankings = async(id:string, local_year?:number) => {
71
+ RankingsApi.setEnvironment();
72
+ setRankingsState({ ...rankings_state, loading:true });
73
+ const api_leagues = await RankingsApi.getLeagues();
74
+ let api_league = api_leagues.find(l => l.league_id == id);
75
+ const st = await RankingsApi.getStandingsByLeague(league_id, local_year ?? api_league?.active_year ?? moment().year());
76
+ if(!st){ return alert('Unable to load standings at this time') }
77
+ const api_ranking_types = [ ...new Set(st.team_rankings.map(r => r.ranking_type))];
78
+ const api_ranking_type = st.league.active_season_type ?? 'REG'
79
+ let api_divisions = [ ...new Set(st.teams.map(t => t.division ?? 'NA')) ].filter(sd => sd && sd != 'NA');
80
+ let api_active_sub_division:string|undefined = undefined
81
+ let api_active_division:string|undefined = st.teams.find(t => t.team_id == team_id)?.division
82
+ if(!api_active_division && api_divisions.length > 2){
83
+ api_active_division = RankingsHelpers.sortDivisions(id, api_divisions)[0]
84
+ }
85
+ let api_sub_divisions = [ ...new Set(st.teams.map(t => t.sub_division ?? 'NA')) ].filter(sd => sd && sd != 'NA')
86
+ if(team_id){ api_active_sub_division = st.teams.find(T => T.team_id == team_id)?.sub_division }
87
+ let api_team = st.teams.find(t => t.team_id == team_id)
88
+ let api_team_record = st.team_records.find(r => r.team_id == team_id && r.record_type == api_ranking_type && r.sub_type == 'overall')
89
+ let api_team_ranking = st.team_rankings.find(r => r.team_id == team_id && r.ranking_type == api_ranking_type);
90
+ setRankingsState({
91
+ ...rankings_state,
92
+ loading:false,
93
+ ranking_type: api_ranking_type,
94
+ league: st.league,
95
+ team: api_team,
96
+ active_division: api_active_division,
97
+ active_sub_division: api_active_sub_division,
98
+ year: local_year ?? st.league.active_year ?? moment().year(),
99
+ team_records: st.team_records,
100
+ ranking_types: api_ranking_types,
101
+ team_rankings: st.team_rankings,
102
+ team_ranking: api_team_ranking,
103
+ team_record: api_team_record,
104
+ leagues: api_leagues,
105
+ teams:st.teams,
106
+ divisions: api_divisions,
107
+ sub_divisions: api_sub_divisions
108
+ });
109
+ }
110
+
111
+ const renderSubDivisionOptions = (data:{ item:string, index:number }) => {
112
+ return (
113
+ <Button style={{ borderRadius:0, padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexDirection:'row', alignItems:'center' }} onPress={() => {
114
+ setRankingsState({ ...rankings_state, active_sub_division: data.item });
115
+ setShowSubDivisions(false);
116
+ }}>
117
+ <Text theme='h2' textAlign='center'>{RankingsHelpers.getRankingTypeDescriptor(data.item)}</Text>
118
+ </Button>
119
+ )
120
+ }
121
+
122
+ const renderTypes = (data:{ item:string, index:number }) => {
123
+ return (
124
+ <Button style={{ borderRadius:0, padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexDirection:'row', alignItems:'center' }} onPress={() => {
125
+ setRankingsState({ ...rankings_state, ranking_type: data.item });
126
+ setShowTypes(false)
127
+ }}>
128
+ <Text theme='h2' textAlign='center'>{RankingsHelpers.getRankingTypeDescriptor(data.item)}</Text>
129
+ </Button>
130
+ )
131
+ }
132
+
133
+ const renderYears = (data:{ item:number, index:number }) => {
134
+ return (
135
+ <Button style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexDirection:'row', alignItems:'center' }} onPress={() => {
136
+ getRankings(league_id, data.item)
137
+ setShowYears(false)
138
+ }}>
139
+ <Text theme='h1'>{data.item.toString()}</Text>
140
+ </Button>
141
+ )
142
+ }
143
+
144
+ const renderDivisionOptions = (data:{ item:string, index:number }) => {
145
+ const active = active_division == data.item ? true : false
146
+ return (
147
+ <Button transparent style={{ borderRadius:0, flex:1, padding:10, alignItems:'center', justifyContent:'flex-end', borderBottomWidth:1, borderColor:active?Colors.text.success:Colors.borders.light }} onPress={() => setRankingsState({ ...rankings_state, active_division: data.item, active_sub_division: undefined })}>
148
+ <Text textAlign='center' color={active ? Colors.text.success: Colors.text.h1} theme={active ? 'h2' : 'description'}>{RankingsHelpers.getDivisionLabel(data.item)}</Text>
149
+ </Button>
150
+ )
151
+ }
152
+
153
+ const renderTeams = (data: { item:TeamRankingProps, index:number }) => {
154
+ const team = teams.find(t => t.team_id == data.item.team_id)
155
+ if(!team){ return <></> }
156
+ const team_record = team_records.find(tr => tr.record_type == ranking_type && tr.sub_type == 'overall' && tr.team_id == team.team_id);
157
+ const win_pct = RankingsHelpers.getWinPct(team_record?.wins ?? 0, team_record?.losses ?? 0, team_record?.draws ?? 0);
158
+ const active = data.item.team_id == team_id ? true : false
159
+ return (
160
+ <View type='row' style={{ borderBottomWidth:1, borderColor:Colors.borders.light, padding:5 }}>
161
+ <View transparent style={{ flex:1, padding:10 }}>
162
+ <View transparent style={{ flexDirection:'row', alignItems:'center' }}>
163
+ <TeamImage
164
+ team={team}
165
+ padding={2}
166
+ size={14}
167
+ />
168
+ {team.rank ?
169
+ <Text theme='h2' color={Colors.text.action} style={{ marginLeft:5 }}>{team.rank}</Text>
170
+ :<></>}
171
+ <Text theme='h1' size={12} style={{ marginLeft:5 }} color={active?Colors.text.success : Colors.text.h1}>{team.market_name} {team.name}</Text>
172
+ </View>
173
+ </View>
174
+ {team_record ?
175
+ <View style={{ flex:1, flexDirection:'row', alignItems:'center' }}>
176
+ <View style={{ flex:1 }}>
177
+ <Text theme='h2' textAlign='center'>{team_record.wins}</Text>
178
+ </View>
179
+ <View style={{ flex:1 }}>
180
+ <Text theme='h2' textAlign='center'>{team_record.losses}</Text>
181
+ </View>
182
+ <View style={{ flex:1 }}>
183
+ <Text theme='h2' textAlign='center'>{team_record.draws}</Text>
184
+ </View>
185
+ <View style={{ flex:1 }}>
186
+ <Text theme='h2' textAlign='center'>{(win_pct*100).toFixed(2)}%</Text>
187
+ </View>
188
+ </View>
189
+ :<></>}
190
+ </View>
191
+ )
192
+ }
193
+
194
+ const renderSubDivisions = (data:{ item:string, index:number, teams:TeamProps[] }) => {
195
+ const sub_division_teams = data.teams.filter(t => t.sub_division == data.item);
196
+ const sub_division_rankings = team_rankings.filter(tr => sub_division_teams.map(dt => dt.team_id).includes(tr.team_id) && tr.ranking_type == ranking_type && tr.sub_type == sub_type);
197
+ if(sub_division_teams.length == 0){ return <></> }
198
+ if(sub_division_rankings.length == 0){ return <></> }
199
+ return (
200
+ <View>
201
+ <View type='header' style={{ flexDirection:'row', alignItems:'center' }}>
202
+ <View transparent style={{ flex:1, padding:10 }}>
203
+ <Text theme='h1'>{data.item}</Text>
204
+ </View>
205
+ <View transparent style={{ flex:1, flexDirection:'row', alignItems:'center' }}>
206
+ <View transparent style={{ flex:1 }}>
207
+ <Text theme='h2' textAlign='center'>W</Text>
208
+ </View>
209
+ <View transparent style={{ flex:1 }}>
210
+ <Text theme='h2' textAlign='center'>L</Text>
211
+ </View>
212
+ <View transparent style={{ flex:1 }}>
213
+ <Text theme='h2' textAlign='center'>D</Text>
214
+ </View>
215
+ <View transparent style={{ flex:1 }}>
216
+ <Text theme='h2' textAlign='center'>PCT</Text>
217
+ </View>
218
+ </View>
219
+ </View>
220
+ <FlatList
221
+ data={sub_division_rankings.sort((a,b) => a.rank - b.rank)}
222
+ key={'sub_division_teams'}
223
+ keyExtractor={item => item.team_ranking_id.toString()}
224
+ renderItem={renderTeams}
225
+ />
226
+ </View>
227
+ )
228
+ }
229
+
230
+ const renderDivisions = (data:{ item:string, index:number }) => {
231
+ let division_teams = teams.filter(t => t.division == data.item);
232
+ let division_sub_divisions = [ ...new Set(division_teams.map(t => t.sub_division ?? 'NA')) ].filter(sd => sd && sd != 'NA')
233
+ return (
234
+ <View>
235
+ <View type='header' style={{ padding:10 }}>
236
+ <Text>{data.item}</Text>
237
+ </View>
238
+ {division_sub_divisions.length > 0 ?
239
+ <FlatList
240
+ key={'sub_division_list'}
241
+ keyExtractor={item => item}
242
+ renderItem={({ item, index }) => renderSubDivisions({ item, index, teams:division_teams })}
243
+ data={division_sub_divisions}
244
+ />
245
+ :
246
+ <></>
247
+ }
248
+ </View>
249
+ )
250
+ }
251
+ if(!league){ return <></> }
252
+ return (
253
+ <View>
254
+ {team ?
255
+ <View style={{ flexDirection:'row' }}>
256
+ <TeamImage
257
+ team={team}
258
+ size={20}
259
+ />
260
+ </View>
261
+ :<></>}
262
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
263
+ <Image
264
+ source={{ uri: league.league_image }}
265
+ style={{ height:35, width:35 }}
266
+ resizeMode='contain'
267
+ />
268
+ <View transparent style={{ flex:1, marginLeft:10 }}>
269
+ <Text theme='h1'>{league.league_name} {RankingsHelpers.getRankingTypeDescriptor(ranking_type)} {league.active_year ?? moment().year()}</Text>
270
+ </View>
271
+ <Button float style={{ padding:10, flexDirection:'row', alignItems:'center' }} onPress={() => setShowYears(true)}>
272
+ <Text theme='h2' style={{ marginRight:10 }}>{year}</Text>
273
+ <Icons.ChevronIcon direction='down' size={6} color={Colors.text.h1} />
274
+ </Button>
275
+ {active_division ?
276
+ <Button float style={{ padding:10, flexDirection:'row', alignItems:'center' }} onPress={() => setShowSubDivisions(true)}>
277
+ <Text theme='h2' style={{ marginRight:10 }}>{active_sub_division ?? 'All Conferences'}</Text>
278
+ <Icons.ChevronIcon direction='down' size={6} color={Colors.text.h1} />
279
+ </Button>
280
+ :
281
+ <Button float style={{ padding:10, flexDirection:'row', alignItems:'center' }} onPress={() => setShowTypes(true)}>
282
+ <Text theme='h2' style={{ marginRight:10 }}>{RankingsHelpers.getRankingTypeDescriptor(ranking_type)}</Text>
283
+ <Icons.ChevronIcon direction='down' size={6} color={Colors.text.h1} />
284
+ </Button>
285
+ }
286
+ </View>
287
+ <View type='body'>
288
+ {active_division ?
289
+ <View style={{ flexDirection:'row' }}>
290
+ {RankingsHelpers.sortDivisions(league_id,divisions).map((d,i) => {
291
+ return renderDivisionOptions({ item:d, index:i })
292
+ })}
293
+ </View>
294
+ :<></>}
295
+ {active_division ?
296
+ <FlatList
297
+ data={visible_sub_divisions.sort((a,b) => a.localeCompare(b))}
298
+ renderItem={({ item, index }) => renderSubDivisions({ item, index, teams:division_teams })}
299
+ key={'division_list'}
300
+ keyExtractor={item => item}
301
+ />
302
+ :
303
+ <FlatList
304
+ data={divisions.sort((a,b) => a.localeCompare(b))}
305
+ renderItem={renderDivisions}
306
+ key={'division_list'}
307
+ keyExtractor={item => item}
308
+ />
309
+ }
310
+ </View>
311
+ {show_types ?
312
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, paddingTop:20, alignItems:'center' }}>
313
+ <View float style={{ height:400, width:400 }}>
314
+ <View type='header' style={{ padding:10, flexDirection:'row', borderTopRightRadius:8, borderTopLeftRadius:8 }}>
315
+ <View transparent style={{ flex:1 }}>
316
+ <Text theme='h1'>Select Type</Text>
317
+ </View>
318
+ </View>
319
+ <View transparent type='body' style={{ flex:1 }}>
320
+ <FlatList
321
+ data={ranking_types}
322
+ key={'ranking_types'}
323
+ keyExtractor={item => item}
324
+ renderItem={renderTypes}
325
+ />
326
+ </View>
327
+ <View type='footer' style={{ borderBottomRightRadius:8, borderBottomLeftRadius:8, padding:10 }}>
328
+ <Button
329
+ title='CLOSE'
330
+ type='close'
331
+ onPress={() => setShowTypes(false)}
332
+ />
333
+ </View>
334
+ </View>
335
+ </View>
336
+ :<></>}
337
+ {show_sub_divisions ?
338
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, paddingTop:20, alignItems:'center' }}>
339
+ <View float style={{ height:400, width:400 }}>
340
+ <View type='header' style={{ padding:10, flexDirection:'row', borderTopRightRadius:8, borderTopLeftRadius:8 }}>
341
+ <View transparent style={{ flex:1 }}>
342
+ <Text theme='h1'>Select Conference</Text>
343
+ </View>
344
+ </View>
345
+ <View transparent type='body' style={{ flex:1 }}>
346
+ <FlatList
347
+ data={available_sub_divisions}
348
+ key={'sub_division_options'}
349
+ keyExtractor={item => item}
350
+ renderItem={renderSubDivisionOptions}
351
+ />
352
+ </View>
353
+ <View type='footer' style={{ borderBottomRightRadius:8, borderBottomLeftRadius:8, padding:10 }}>
354
+ <Button
355
+ title='CLOSE'
356
+ type='close'
357
+ onPress={() => setShowTypes(false)}
358
+ />
359
+ </View>
360
+ </View>
361
+ </View>
362
+ :<></>}
363
+ {show_years ?
364
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, paddingTop:20, alignItems:'center' }}>
365
+ <View float style={{ height:400, width:400 }}>
366
+ <View type='header' style={{ padding:10, flexDirection:'row', borderTopRightRadius:8, borderTopLeftRadius:8 }}>
367
+ <View transparent style={{ flex:1 }}>
368
+ <Text theme='h1'>Select Year</Text>
369
+ </View>
370
+ </View>
371
+ <View transparent type='body' style={{ flex:1 }}>
372
+ <FlatList
373
+ data={years}
374
+ key={'years_list'}
375
+ keyExtractor={item => item.toString()}
376
+ renderItem={renderYears}
377
+ />
378
+ </View>
379
+ <View type='footer' style={{ borderBottomRightRadius:8, borderBottomLeftRadius:8, padding:10 }}>
380
+ <Button
381
+ title='CLOSE'
382
+ type='close'
383
+ onPress={() => setShowYears(false)}
384
+ />
385
+ </View>
386
+ </View>
387
+ </View>
388
+ :<></>}
389
+ {loading ?
390
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, paddingTop:20, alignItems:'center' }}>
391
+ <ActivityIndicator style={{ marginTop:50 }} size={30} color={Colors.text.h1} />
392
+ </View>
393
+ :<></>}
394
+ </View>
395
+ )
396
+ }
397
+
398
+ export default RankingsCard
package/src/index.tsx CHANGED
@@ -54,14 +54,17 @@ import BEClarity from './Clarity';
54
54
  import BetMatch from './BetMatch';
55
55
  import Premium from './Premium';
56
56
  import ManageFilter from './BetMatch/components/ManageFilter';
57
-
58
-
57
+ import ClaritySmartEvents from './Clarity/SmartEvents';
58
+ import RankingsCard from './RankingsCard';
59
+ import GuideView from './GuideView';
59
60
 
60
61
  export {
61
62
  Authenticator,
62
63
  Observer,
63
64
  BEEventApi,
65
+ RankingsCard,
64
66
  BELinkApi,
67
+ GuideView,
65
68
  BetMatch,
66
69
  ManageFilter,
67
70
  Ticker,
@@ -80,6 +83,7 @@ export {
80
83
  NotificationModule,
81
84
  FlashHolder,
82
85
  useNotifications,
86
+ ClaritySmartEvents,
83
87
  ProfileManager,
84
88
  CompetitionManager,
85
89
  Components,
package/src/types.d.ts CHANGED
@@ -7,6 +7,21 @@ export interface ErrorProps {
7
7
  message: string
8
8
  }
9
9
 
10
+ export interface GuideWrapProps {
11
+ tour?:TourStepProps[],
12
+ onComplete?:(state:'cancelled'|'complete') => void,
13
+ active?:boolean
14
+ }
15
+ export interface TourStepProps {
16
+ nativeID: string;
17
+ title?: string;
18
+ body?: string;
19
+ clickable?: boolean;
20
+ position?: "top" | "bottom" | "left" | "right";
21
+ image?: string;
22
+ priority?: number; // lower = higher priority
23
+ };
24
+
10
25
  export interface ClarityProps {
11
26
  consent: () => void;
12
27
  identify: (
@@ -403,6 +418,8 @@ export interface LeagueProps {
403
418
  league_name:string,
404
419
  sport:string,
405
420
  league_image:string,
421
+ active_year?:number,
422
+ active_season_type?:string,
406
423
  priority:number,
407
424
  status:string,
408
425
  external_id?:string,
@@ -432,6 +449,7 @@ export interface EventProps {
432
449
  league_id:string,
433
450
  season_type: string,
434
451
  league_name?:string,
452
+ promoted?:number,
435
453
  time_detail?:string,
436
454
  last_play?:string,
437
455
  home_athlete_stats?: AthleteStatProps[]
@@ -488,7 +506,7 @@ export interface AthleteProps {
488
506
  height:number
489
507
  },
490
508
  create_datetime?: any,
491
- last_update_datetime?: any
509
+ last_update_datetime?: any
492
510
  }
493
511
 
494
512
  export interface TeamProps {
@@ -509,6 +527,39 @@ export interface TeamProps {
509
527
  athletes?:AthleteProps[]
510
528
  }
511
529
 
530
+ export interface TeamRecordProps {
531
+ team_record_id:string,
532
+ team_id:string,
533
+ year: number,
534
+ record_type:string,
535
+ league_id:string,
536
+ wins:number,
537
+ losses:number,
538
+ draws:number,
539
+ strength_of_schedule:number,
540
+ points_for:number,
541
+ points_against:number,
542
+ strength_of_record:number,
543
+ streak_type:string,
544
+ streak_length: number,
545
+ sub_type:string,
546
+ create_datetime:any,
547
+ last_update_datetime:any
548
+ }
549
+
550
+ export interface TeamRankingProps {
551
+ team_ranking_id:string,
552
+ team_id:string,
553
+ year:number,
554
+ league_id:string,
555
+ ranking_type:string,
556
+ sub_type:string,
557
+ rank:number,
558
+ clinched?:'wildcard'|'division'|'sub_division'|'eliminated',
559
+ create_datetime:any,
560
+ last_update_datetime:any
561
+ }
562
+
512
563
  export interface EventInfoProps { team_event_id: string, weather:WeatherType | undefined, venue: VenueType| undefined, broadcast:BroadcastType| undefined }
513
564
 
514
565
  export interface StatProps {
@@ -2929,7 +2980,7 @@ export interface CompanyEmbedProps {
2929
2980
  identifier:string,
2930
2981
  status:'pending'|'active'|'inactive'|'archived',
2931
2982
  embed_id:string,
2932
- properties: { [key:string]:string }
2983
+ properties: { [key:string]:any }
2933
2984
  generated_by:string,
2934
2985
  create_datetime:any,
2935
2986
  last_update_datetime:any