be-components 2.1.4 → 2.1.6

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 (69) hide show
  1. package/lib/commonjs/Components/Icons.js +29 -0
  2. package/lib/commonjs/Components/Icons.js.map +1 -1
  3. package/lib/commonjs/SocialComponents/PlayerProfile/components/PostsList.js +10 -2
  4. package/lib/commonjs/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -1
  5. package/lib/commonjs/SocialComponents/PlayerProfile/index.js +110 -27
  6. package/lib/commonjs/SocialComponents/PlayerProfile/index.js.map +1 -1
  7. package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js +51 -0
  8. package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js.map +1 -0
  9. package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js +2 -1
  10. package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js.map +1 -1
  11. package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js +29 -3
  12. package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -1
  13. package/lib/commonjs/SocialComponents/PostCard/index.js +130 -19
  14. package/lib/commonjs/SocialComponents/PostCard/index.js.map +1 -1
  15. package/lib/commonjs/SocialComponents/SocialOrderCard.js +139 -29
  16. package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -1
  17. package/lib/commonjs/SocialComponents/SocialOrdersList.js +11 -3
  18. package/lib/commonjs/SocialComponents/SocialOrdersList.js.map +1 -1
  19. package/lib/commonjs/SocialComponents/api/index.js +88 -0
  20. package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
  21. package/lib/module/Components/Icons.js +29 -0
  22. package/lib/module/Components/Icons.js.map +1 -1
  23. package/lib/module/SocialComponents/PlayerProfile/components/PostsList.js +10 -2
  24. package/lib/module/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -1
  25. package/lib/module/SocialComponents/PlayerProfile/index.js +110 -27
  26. package/lib/module/SocialComponents/PlayerProfile/index.js.map +1 -1
  27. package/lib/module/SocialComponents/PostCard/components/ImageList.js +44 -0
  28. package/lib/module/SocialComponents/PostCard/components/ImageList.js.map +1 -0
  29. package/lib/module/SocialComponents/PostCard/components/PostHeader.js +2 -1
  30. package/lib/module/SocialComponents/PostCard/components/PostHeader.js.map +1 -1
  31. package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js +30 -4
  32. package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -1
  33. package/lib/module/SocialComponents/PostCard/index.js +130 -19
  34. package/lib/module/SocialComponents/PostCard/index.js.map +1 -1
  35. package/lib/module/SocialComponents/SocialOrderCard.js +138 -30
  36. package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -1
  37. package/lib/module/SocialComponents/SocialOrdersList.js +11 -3
  38. package/lib/module/SocialComponents/SocialOrdersList.js.map +1 -1
  39. package/lib/module/SocialComponents/api/index.js +88 -0
  40. package/lib/module/SocialComponents/api/index.js.map +1 -1
  41. package/lib/typescript/src/Components/Icons.d.ts +1 -0
  42. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  43. package/lib/typescript/src/SocialComponents/PlayerProfile/components/PostsList.d.ts +6 -2
  44. package/lib/typescript/src/SocialComponents/PlayerProfile/components/PostsList.d.ts.map +1 -1
  45. package/lib/typescript/src/SocialComponents/PlayerProfile/index.d.ts +12 -1
  46. package/lib/typescript/src/SocialComponents/PlayerProfile/index.d.ts.map +1 -1
  47. package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts +9 -0
  48. package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -0
  49. package/lib/typescript/src/SocialComponents/PostCard/components/PostReactionBar.d.ts +4 -2
  50. package/lib/typescript/src/SocialComponents/PostCard/components/PostReactionBar.d.ts.map +1 -1
  51. package/lib/typescript/src/SocialComponents/PostCard/index.d.ts +5 -1
  52. package/lib/typescript/src/SocialComponents/PostCard/index.d.ts.map +1 -1
  53. package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +6 -2
  54. package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -1
  55. package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts +6 -2
  56. package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts.map +1 -1
  57. package/lib/typescript/src/SocialComponents/api/index.d.ts +9 -1
  58. package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
  59. package/package.json +1 -1
  60. package/src/Components/Icons.tsx +17 -0
  61. package/src/SocialComponents/PlayerProfile/components/PostsList.tsx +10 -2
  62. package/src/SocialComponents/PlayerProfile/index.tsx +69 -29
  63. package/src/SocialComponents/PostCard/components/ImageList.tsx +46 -0
  64. package/src/SocialComponents/PostCard/components/PostHeader.tsx +1 -1
  65. package/src/SocialComponents/PostCard/components/PostReactionBar.tsx +23 -5
  66. package/src/SocialComponents/PostCard/index.tsx +84 -14
  67. package/src/SocialComponents/SocialOrderCard.tsx +90 -19
  68. package/src/SocialComponents/SocialOrdersList.tsx +12 -4
  69. package/src/SocialComponents/api/index.ts +53 -1
@@ -1,14 +1,18 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { View, FlatList } from 'react-native';
3
- import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, TeamProps, TournamentProps } from '../types';
3
+ import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PublicPlayerProps, TeamProps, TournamentProps } from '../types';
4
4
  import SocialOrderCard from './SocialOrderCard';
5
5
  import { SocialComponentApi, SocialOrderHelpers } from './api';
6
6
 
7
7
  type SocialOrdersListProps = {
8
+ players:PublicPlayerProps[],
9
+ show_player?:boolean,
8
10
  orders:OrderProps[],
9
- direction: 'vertical'|'horizontal'
11
+ direction: 'vertical'|'horizontal',
12
+ onCopyOrder?:(order:OrderProps) => void,
13
+ onFadeOrder?:(order:OrderProps) => void
10
14
  }
11
- const SocialOrdersList = ({ orders, direction }:SocialOrdersListProps) => {
15
+ const SocialOrdersList = ({ players, show_player, orders, direction, onCopyOrder, onFadeOrder }:SocialOrdersListProps) => {
12
16
  const [list_data, setListData] = useState<{
13
17
  loading:boolean,
14
18
  leagues:LeagueProps[],
@@ -40,7 +44,6 @@ const SocialOrdersList = ({ orders, direction }:SocialOrdersListProps) => {
40
44
  setListData({ ...list_data, loading:true });
41
45
  //Get event_ids
42
46
  const { event_ids, tournament_ids, match_ids, athlete_ids, team_ids } = SocialOrderHelpers.getIdsFromOrders(orders);
43
- console.log(team_ids)
44
47
  let l = await SocialComponentApi.getLeagues();
45
48
  let e = await SocialComponentApi.getEventsByEventIds(event_ids);
46
49
  let t = await SocialComponentApi.getTournamentsByTournamentIds(tournament_ids);
@@ -64,15 +67,20 @@ const SocialOrdersList = ({ orders, direction }:SocialOrdersListProps) => {
64
67
 
65
68
  const renderOrders = (data:{item:OrderProps, index:number}) => {
66
69
  let { title, time, league, team, athlete } = SocialOrderHelpers.getContestDetails(data.item, events, tournaments, matches, athletes, teams, leagues);
70
+ let player = players.find(p => p.player_id == data.item.player_id)
67
71
  return (
68
72
  <View>
69
73
  <SocialOrderCard
74
+ show_player={show_player}
75
+ player={player}
70
76
  league={league}
71
77
  team={team}
72
78
  athlete={athlete}
73
79
  contest_title={title}
74
80
  contest_time={time}
75
81
  order={data.item}
82
+ onFadeOrder={onFadeOrder}
83
+ onCopyOrder={onCopyOrder}
76
84
  />
77
85
  </View>
78
86
  )
@@ -1,11 +1,12 @@
1
1
  import axios from "axios";
2
2
  import { APIOverrides } from "../../ApiOverrides";
3
- import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PlayerFollowerProps, TeamProps, TournamentProps } from "../../types";
3
+ import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PlayerFollowerProps, PostReactionProps, TeamProps, TournamentProps } from "../../types";
4
4
  import Colors from "../../constants/colors";
5
5
  import moment from "moment-mini";
6
6
 
7
7
  let SOCIAL_SVC_API = '';
8
8
  let EVENT_SVC_API = '';
9
+ let MK_SVC_API = '';
9
10
 
10
11
  export { SocialComponentApi, SocialOrderHelpers }
11
12
 
@@ -14,6 +15,8 @@ const SocialComponentApi = {
14
15
  const endpoints = APIOverrides.getEndpoints();
15
16
  SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
16
17
  EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
18
+ MK_SVC_API = endpoints['MK_SVC_API'] as string;
19
+
17
20
  },
18
21
  getLeagues: async():Promise<LeagueProps[]> => {
19
22
  try {
@@ -23,6 +26,14 @@ const SocialComponentApi = {
23
26
  return []
24
27
  }
25
28
  },
29
+ reverseOrder: async(order:OrderProps):Promise<OrderProps | undefined> => {
30
+ try {
31
+ const resp = await axios.post(`${MK_SVC_API}/v1/orders/order/reverse`, { order })
32
+ return resp.data.order
33
+ } catch (e) {
34
+ return undefined
35
+ }
36
+ },
26
37
  getBulkPlayerfollowers: async(player_ids:string[]) => {
27
38
  const resp = await axios.post(`${SOCIAL_SVC_API}/v1/followers/bulk/get`, { player_ids })
28
39
  return resp.data.player_followers
@@ -76,6 +87,24 @@ const SocialComponentApi = {
76
87
  return []
77
88
  }
78
89
  },
90
+ createPostReaction: async(post_reaction:PostReactionProps):Promise<PostReactionProps|undefined> => {
91
+ try {
92
+ const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/reaction/create`, { post_reaction });
93
+ return resp.data.post_reaction
94
+ } catch (e) {
95
+ console.log(e);
96
+ return undefined
97
+ }
98
+ },
99
+ updatePostReaction : async(post_reaction:PostReactionProps):Promise<PostReactionProps|undefined> => {
100
+ try {
101
+ const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/reaction/update`, { post_reaction })
102
+ return resp.data.post_reaction
103
+ } catch (e) {
104
+ console.log(e)
105
+ return undefined
106
+ }
107
+ },
79
108
  }
80
109
 
81
110
 
@@ -92,6 +121,29 @@ const SocialOrderHelpers = {
92
121
  return Colors.shades.black
93
122
  }
94
123
  },
124
+ getResultDetails: (order:OrderProps) => {
125
+ if(order.resolution_status == 'inprogress'){ return { result_label: '', color:Colors.brand.midnight } }
126
+ if(order.resolution_status == 'closed' && !order.positions[0]){ return { result_label: 'CANCELLED', color:Colors.brand.slate } }
127
+ let position = order.positions[0]
128
+ if(!position || position.status == 'inprogress'){ return { result_label: '', color:Colors.brand.midnight } }
129
+ switch(position.result_ind){
130
+ case 'win': return { result_label: 'WIN', color:Colors.utility.success }
131
+ case 'lose': return { result_label: 'LOSE', color:Colors.utility.error }
132
+ case 'draw': return { result_label: 'DRAW', color:Colors.brand.midnight }
133
+ default: return { result_label: '', color:Colors.brand.midnight }
134
+ }
135
+ },
136
+ calcPotentialWinnings :(odds:number, amt:number) => {
137
+ let potential_winnings;
138
+ if (odds > 0) {
139
+ var earningsMultiplyer = (odds/100) + 1;
140
+ potential_winnings = Math.round(earningsMultiplyer * amt * 100) / 100;
141
+ } else {
142
+ var earningsMultiplyer = (100/(Math.abs(odds))) + 1;
143
+ potential_winnings = Math.round(earningsMultiplyer * amt * 100) / 100;
144
+ }
145
+ return potential_winnings
146
+ },
95
147
  getIdsFromOrders: (orders:OrderProps[]) => {
96
148
  let event_ids:string[] = [], tournament_ids:string[] = [], match_ids:string[] = [], athlete_ids:string[] = [], team_ids:string[] = []
97
149
  orders.map(o => {