be-components 5.0.8 → 5.0.9
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/lib/commonjs/Bracket/components/BracketPlay/index.js +9 -2
- package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/commonjs/Bracket/index.js +10 -0
- package/lib/commonjs/Bracket/index.js.map +1 -1
- package/lib/commonjs/Campaign/api/index.js +105 -0
- package/lib/commonjs/Campaign/api/index.js.map +1 -0
- package/lib/commonjs/Campaign/components/ActionList.js +96 -0
- package/lib/commonjs/Campaign/components/ActionList.js.map +1 -0
- package/lib/commonjs/Campaign/components/AnalyticsCard.js +42 -0
- package/lib/commonjs/Campaign/components/AnalyticsCard.js.map +1 -0
- package/lib/commonjs/Campaign/components/AutoManager.js +101 -0
- package/lib/commonjs/Campaign/components/AutoManager.js.map +1 -0
- package/lib/commonjs/Campaign/components/BetAlert.js +176 -0
- package/lib/commonjs/Campaign/components/BetAlert.js.map +1 -0
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js +51 -0
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js.map +1 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js +135 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js.map +1 -0
- package/lib/commonjs/Campaign/components/ParticipantsList.js +117 -0
- package/lib/commonjs/Campaign/components/ParticipantsList.js.map +1 -0
- package/lib/commonjs/Campaign/components/ProgressTimer.js +50 -0
- package/lib/commonjs/Campaign/components/ProgressTimer.js.map +1 -0
- package/lib/commonjs/Campaign/index.js +440 -0
- package/lib/commonjs/Campaign/index.js.map +1 -0
- package/lib/commonjs/Components/ConfirmationModal.js +32 -3
- package/lib/commonjs/Components/ConfirmationModal.js.map +1 -1
- package/lib/commonjs/Components/Icons.js +49 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/ProgressBar.js +94 -0
- package/lib/commonjs/Components/ProgressBar.js.map +1 -0
- package/lib/commonjs/Components/index.js +7 -0
- package/lib/commonjs/Components/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/api/index.js +17 -0
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/api/index.js +3 -0
- package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
- package/lib/commonjs/Ticker/components/TradeText.js +82 -0
- package/lib/commonjs/Ticker/components/TradeText.js.map +1 -0
- package/lib/commonjs/Ticker/index.js +254 -0
- package/lib/commonjs/Ticker/index.js.map +1 -0
- package/lib/commonjs/constants/useColors.js +2 -2
- package/lib/commonjs/constants/useColors.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/index.js +9 -2
- package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/module/Bracket/index.js +10 -0
- package/lib/module/Bracket/index.js.map +1 -1
- package/lib/module/Campaign/api/index.js +99 -0
- package/lib/module/Campaign/api/index.js.map +1 -0
- package/lib/module/Campaign/components/ActionList.js +89 -0
- package/lib/module/Campaign/components/ActionList.js.map +1 -0
- package/lib/module/Campaign/components/AnalyticsCard.js +35 -0
- package/lib/module/Campaign/components/AnalyticsCard.js.map +1 -0
- package/lib/module/Campaign/components/AutoManager.js +92 -0
- package/lib/module/Campaign/components/AutoManager.js.map +1 -0
- package/lib/module/Campaign/components/BetAlert.js +169 -0
- package/lib/module/Campaign/components/BetAlert.js.map +1 -0
- package/lib/module/Campaign/components/CampaignAnalytics.js +42 -0
- package/lib/module/Campaign/components/CampaignAnalytics.js.map +1 -0
- package/lib/module/Campaign/components/ParticipantCard.js +128 -0
- package/lib/module/Campaign/components/ParticipantCard.js.map +1 -0
- package/lib/module/Campaign/components/ParticipantsList.js +108 -0
- package/lib/module/Campaign/components/ParticipantsList.js.map +1 -0
- package/lib/module/Campaign/components/ProgressTimer.js +43 -0
- package/lib/module/Campaign/components/ProgressTimer.js.map +1 -0
- package/lib/module/Campaign/index.js +431 -0
- package/lib/module/Campaign/index.js.map +1 -0
- package/lib/module/Components/ConfirmationModal.js +31 -4
- package/lib/module/Components/ConfirmationModal.js.map +1 -1
- package/lib/module/Components/Icons.js +49 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/ProgressBar.js +86 -0
- package/lib/module/Components/ProgressBar.js.map +1 -0
- package/lib/module/Components/index.js +2 -1
- package/lib/module/Components/index.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +17 -0
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/SocialComponents/api/index.js +2 -0
- package/lib/module/SocialComponents/api/index.js.map +1 -1
- package/lib/module/Ticker/components/TradeText.js +74 -0
- package/lib/module/Ticker/components/TradeText.js.map +1 -0
- package/lib/module/Ticker/index.js +245 -0
- package/lib/module/Ticker/index.js.map +1 -0
- package/lib/module/constants/useColors.js +2 -2
- package/lib/module/constants/useColors.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts +30 -0
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts +8 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AnalyticsCard.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AnalyticsCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AutoManager.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AutoManager.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts +12 -0
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts +6 -0
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantsList.d.ts +11 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantsList.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ProgressTimer.d.ts +8 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ProgressTimer.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/index.d.ts +14 -0
- package/lib/typescript/lib/commonjs/Campaign/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/ConfirmationModal.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Components/ConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/ProgressBar.d.ts +15 -0
- package/lib/typescript/lib/commonjs/Components/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Ticker/components/TradeText.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Ticker/components/TradeText.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Ticker/index.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Ticker/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/constants/useColors.d.ts +1 -1
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts +2 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/api/index.d.ts +29 -0
- package/lib/typescript/lib/module/Campaign/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts +8 -0
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/AnalyticsCard.d.ts +9 -0
- package/lib/typescript/lib/module/Campaign/components/AnalyticsCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/AutoManager.d.ts +12 -0
- package/lib/typescript/lib/module/Campaign/components/AutoManager.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts +22 -0
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts +6 -0
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts +10 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantsList.d.ts +11 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantsList.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ProgressTimer.d.ts +10 -0
- package/lib/typescript/lib/module/Campaign/components/ProgressTimer.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/index.d.ts +14 -0
- package/lib/typescript/lib/module/Campaign/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/ConfirmationModal.d.ts +2 -1
- package/lib/typescript/lib/module/Components/ConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/ProgressBar.d.ts +16 -0
- package/lib/typescript/lib/module/Components/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/index.d.ts +2 -1
- package/lib/typescript/lib/module/Components/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/LocationTracker/api/index.d.ts +2 -2
- package/lib/typescript/lib/module/LocationTracker/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Ticker/components/TradeText.d.ts +10 -0
- package/lib/typescript/lib/module/Ticker/components/TradeText.d.ts.map +1 -0
- package/lib/typescript/lib/module/Ticker/index.d.ts +9 -0
- package/lib/typescript/lib/module/Ticker/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/constants/useColors.d.ts +1 -1
- package/lib/typescript/lib/module/index.d.ts +3 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/index.d.ts +3 -2
- package/lib/typescript/src/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/api/index.d.ts +24 -0
- package/lib/typescript/src/Campaign/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ActionList.d.ts +10 -0
- package/lib/typescript/src/Campaign/components/ActionList.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/AnalyticsCard.d.ts +10 -0
- package/lib/typescript/src/Campaign/components/AnalyticsCard.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/AutoManager.d.ts +16 -0
- package/lib/typescript/src/Campaign/components/AutoManager.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts +14 -0
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts +7 -0
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts +12 -0
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ParticipantsList.d.ts +13 -0
- package/lib/typescript/src/Campaign/components/ParticipantsList.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ProgressTimer.d.ts +10 -0
- package/lib/typescript/src/Campaign/components/ProgressTimer.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/index.d.ts +24 -0
- package/lib/typescript/src/Campaign/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/ConfirmationModal.d.ts +2 -1
- package/lib/typescript/src/Components/ConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +1 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/ProgressBar.d.ts +19 -0
- package/lib/typescript/src/Components/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/src/Components/index.d.ts +2 -1
- package/lib/typescript/src/Components/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Ticker/components/TradeText.d.ts +11 -0
- package/lib/typescript/src/Ticker/components/TradeText.d.ts.map +1 -0
- package/lib/typescript/src/Ticker/index.d.ts +11 -0
- package/lib/typescript/src/Ticker/index.d.ts.map +1 -0
- package/lib/typescript/src/constants/useColors.d.ts +5 -1
- package/lib/typescript/src/constants/useColors.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/Bracket/components/BracketPlay/index.tsx +10 -1
- package/src/Bracket/index.tsx +12 -3
- package/src/Campaign/api/index.ts +92 -0
- package/src/Campaign/components/ActionList.tsx +64 -0
- package/src/Campaign/components/AnalyticsCard.tsx +29 -0
- package/src/Campaign/components/AutoManager.tsx +88 -0
- package/src/Campaign/components/BetAlert.tsx +111 -0
- package/src/Campaign/components/CampaignAnalytics.tsx +54 -0
- package/src/Campaign/components/ParticipantCard.tsx +78 -0
- package/src/Campaign/components/ParticipantsList.tsx +69 -0
- package/src/Campaign/components/ProgressTimer.tsx +47 -0
- package/src/Campaign/index.tsx +377 -0
- package/src/Components/ConfirmationModal.tsx +22 -5
- package/src/Components/Icons.tsx +19 -0
- package/src/Components/ProgressBar.tsx +54 -0
- package/src/Components/index.tsx +2 -1
- package/src/MarketComponents/api/index.ts +17 -0
- package/src/SocialComponents/api/index.ts +2 -1
- package/src/Ticker/components/TradeText.tsx +55 -0
- package/src/Ticker/index.tsx +202 -0
- package/src/constants/useColors.tsx +5 -3
- package/src/index.tsx +5 -0
- package/src/types.d.ts +60 -0
|
@@ -27,6 +27,23 @@ const MarketComponentApi = {
|
|
|
27
27
|
return []
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
getOrderById: async(order_id:string):Promise<OrderProps | undefined> => {
|
|
31
|
+
try {
|
|
32
|
+
const resp = await axios.get(`${MK_SVC_API}/v1/orders/order/${order_id}`);
|
|
33
|
+
return resp.data.order
|
|
34
|
+
} catch (e) {
|
|
35
|
+
return undefined
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
getActiveEvents: async(league_id?:string):Promise<EventProps[]> => {
|
|
39
|
+
try {
|
|
40
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/events/active?expanded=true&league_id=${league_id}`);
|
|
41
|
+
return resp.data.events
|
|
42
|
+
} catch (e) {
|
|
43
|
+
console.log(e);
|
|
44
|
+
return []
|
|
45
|
+
}
|
|
46
|
+
},
|
|
30
47
|
getLatestTradesByEvents: async(event_type: string, event_ids:string[]):Promise<TradeProps[]> => {
|
|
31
48
|
try {
|
|
32
49
|
if(event_ids.length == 0){ return [] }
|
|
@@ -7,7 +7,7 @@ import moment from "moment-mini";
|
|
|
7
7
|
let SOCIAL_SVC_API = '';
|
|
8
8
|
let EVENT_SVC_API = '';
|
|
9
9
|
let MK_SVC_API = '';
|
|
10
|
-
|
|
10
|
+
//let AUTH_SVC_API = '';
|
|
11
11
|
export { SocialComponentApi, SocialOrderHelpers, SocialPodcastHelpers }
|
|
12
12
|
|
|
13
13
|
const SocialComponentApi = {
|
|
@@ -16,6 +16,7 @@ const SocialComponentApi = {
|
|
|
16
16
|
SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
|
|
17
17
|
EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
|
|
18
18
|
MK_SVC_API = endpoints['MK_SVC_API'] as string;
|
|
19
|
+
//AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
19
20
|
|
|
20
21
|
},
|
|
21
22
|
getLeagues: async():Promise<LeagueProps[]> => {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Text } from '../../../src/Components/Themed';
|
|
4
|
+
import type { MarketProps, TradeProps } from '../../../src/types';
|
|
5
|
+
import { useColors } from '../../../src/constants/useColors';
|
|
6
|
+
import { MarketComponentHelpers } from '../../../src/MarketComponents/api';
|
|
7
|
+
|
|
8
|
+
type TradeTextProps = {
|
|
9
|
+
trade:TradeProps,
|
|
10
|
+
width:number,
|
|
11
|
+
market:MarketProps,
|
|
12
|
+
animate:boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const TradeText = ({ trade, width, market, animate }:TradeTextProps) => {
|
|
16
|
+
const Colors = useColors();
|
|
17
|
+
const [ local_trade, setLocalTrade ] = useState(trade);
|
|
18
|
+
const [ trade_style, setTradeStyle ] = useState({
|
|
19
|
+
color:Colors.text.h1,
|
|
20
|
+
theme: 'h2',
|
|
21
|
+
borderColor:'transparent',
|
|
22
|
+
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
createEffect(trade);
|
|
27
|
+
},[trade]);
|
|
28
|
+
|
|
29
|
+
const createEffect = (new_trade:TradeProps) => {
|
|
30
|
+
if(!animate){ return }
|
|
31
|
+
setTradeStyle({ color: Colors.text.action, theme:'h1', borderColor:Colors.text.action })
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
setTradeStyle({ color: Colors.text.h1, theme:'h2', borderColor:'transparent' })
|
|
34
|
+
}, (500));
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
setTradeStyle({ color: Colors.text.action, theme:'h1', borderColor:Colors.text.action })
|
|
37
|
+
}, 1000);
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
setTradeStyle({ color: Colors.text.h1, theme:'h2', borderColor:'transparent' });
|
|
40
|
+
setLocalTrade(new_trade)
|
|
41
|
+
}, (1500));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View key={trade.trade_id.toString()} style={{ width, padding:5, borderWidth:1, borderColor:trade_style.borderColor, borderRadius:4 }}>
|
|
46
|
+
{market.var_1_required ?
|
|
47
|
+
<Text theme={trade_style.theme as any} textAlign='center' color={trade_style.color}>{MarketComponentHelpers.getVar1Label(market, local_trade.var_1)}</Text>
|
|
48
|
+
:
|
|
49
|
+
<Text theme={trade_style.theme as any} textAlign='center' color={trade_style.color}>{MarketComponentHelpers.getOddsLabel(local_trade.odds)}</Text>
|
|
50
|
+
}
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default TradeText
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Text, View } from "../../src/Components/Themed"
|
|
3
|
+
import type { EventProps, ExternalPriceProps, LeagueProps, MarketProps, OrderProps, TradeProps } from '../../src/types';
|
|
4
|
+
import { MarketComponentApi } from '../../src/MarketComponents/api';
|
|
5
|
+
import { SocketManager } from 'be-components';
|
|
6
|
+
import { Image } from 'react-native';
|
|
7
|
+
import moment from 'moment-mini';
|
|
8
|
+
import { useColors } from '../../src/constants/useColors';
|
|
9
|
+
import { FINALIZED_STATUSES } from '../../src/Competition/api';
|
|
10
|
+
import TradeText from './components/TradeText';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
type TickerProps = {
|
|
14
|
+
league_ids:string[],
|
|
15
|
+
color_mode?:'light'|'dark',
|
|
16
|
+
distinct_id?:string,
|
|
17
|
+
onOrders?:(orders:OrderProps[]) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const MIN_SIZE = 350
|
|
21
|
+
const MARGIN = 6
|
|
22
|
+
|
|
23
|
+
const Ticker = ({ league_ids, color_mode, distinct_id, onOrders }:TickerProps) => {
|
|
24
|
+
const Colors = useColors({ mode: color_mode });
|
|
25
|
+
const [ embed_size, setEmbedSize ] = useState({ height:0, width:0 });
|
|
26
|
+
const [ needs_reload, setNeedsReload ] = useState(false);
|
|
27
|
+
const [ socket_event, setSocketEvent ] = useState<EventProps | undefined>(undefined);
|
|
28
|
+
const [ socket_trade, setSocketTrade ] = useState<TradeProps[]>([])
|
|
29
|
+
const [ ticker_data, setTickerData ] = useState<{
|
|
30
|
+
loading:boolean,
|
|
31
|
+
markets:MarketProps[],
|
|
32
|
+
league_ids:string[],
|
|
33
|
+
events:EventProps[],
|
|
34
|
+
leagues:LeagueProps[],
|
|
35
|
+
trades:TradeProps[],
|
|
36
|
+
animate:boolean,
|
|
37
|
+
external_prices:ExternalPriceProps[],
|
|
38
|
+
}>({
|
|
39
|
+
loading:false,
|
|
40
|
+
league_ids:league_ids,
|
|
41
|
+
events: [],
|
|
42
|
+
markets:[],
|
|
43
|
+
animate: false,
|
|
44
|
+
trades: [],
|
|
45
|
+
leagues: [],
|
|
46
|
+
external_prices: []
|
|
47
|
+
});
|
|
48
|
+
const { trades, leagues, events, animate, markets } = ticker_data;
|
|
49
|
+
let sorted_events = events.sort((a,b) => {
|
|
50
|
+
return moment(a.scheduled_datetime).unix() - moment(b.scheduled_datetime).unix() || parseInt(a.event_id) - parseInt(b.event_id)
|
|
51
|
+
});
|
|
52
|
+
const primary_markets = markets.filter(m => m.primary_market && m.event_type == 'team');
|
|
53
|
+
|
|
54
|
+
const calcWidth = (width:number, min_size:number, margin:number) => {
|
|
55
|
+
//Check how many we can do min size
|
|
56
|
+
let number_to_render = Math.floor(width / min_size)
|
|
57
|
+
let width_no_margin = width / number_to_render
|
|
58
|
+
return width_no_margin - (margin*2)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const tick_width = calcWidth(embed_size.width, MIN_SIZE, MARGIN);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
startUp();
|
|
64
|
+
},[]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if(!socket_event){ return }
|
|
68
|
+
let exists = events.find(e => e.event_id == socket_event.event_id)
|
|
69
|
+
if(!exists){ return }
|
|
70
|
+
setTickerData({
|
|
71
|
+
...ticker_data,
|
|
72
|
+
events: events.filter(e => e.event_id != socket_event.event_id).concat(socket_event)
|
|
73
|
+
})
|
|
74
|
+
setSocketEvent(undefined)
|
|
75
|
+
},[socket_event])
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if(socket_trade.length == 0){ return }
|
|
79
|
+
let market = markets.find(m => m.market_id == socket_trade[0]?.market_id)
|
|
80
|
+
if(!market){ return }//
|
|
81
|
+
|
|
82
|
+
let nt = socket_trade.find(t => t.side == market.trade_side && t.market_type == 'FOR_MONEY');
|
|
83
|
+
if(!nt){ return }
|
|
84
|
+
let matching_trade = trades.find(t => t.event_type == nt.event_type && t.event_id == nt.event_id && t.market_id == nt.market_id && t.side == nt.side && t.side_id == nt.side_id);
|
|
85
|
+
setTickerData({
|
|
86
|
+
...ticker_data,
|
|
87
|
+
trades: trades.filter(t => t.trade_id != matching_trade?.trade_id).concat(nt),
|
|
88
|
+
animate: true,
|
|
89
|
+
})
|
|
90
|
+
setSocketTrade([]);
|
|
91
|
+
},[socket_trade])
|
|
92
|
+
|
|
93
|
+
const startUp = async() => {
|
|
94
|
+
|
|
95
|
+
MarketComponentApi.setEnvironment();
|
|
96
|
+
getData(league_ids);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const getData = async(league_ids:string[]) => {
|
|
100
|
+
const lgs = await MarketComponentApi.getLeagues();
|
|
101
|
+
const mks = await MarketComponentApi.getMarkets();
|
|
102
|
+
let evs = await MarketComponentApi.getActiveEvents();
|
|
103
|
+
if(league_ids.length > 0){
|
|
104
|
+
evs = evs.filter(e => league_ids.map(id => id.toString()).includes(e.league_id.toString()));
|
|
105
|
+
}
|
|
106
|
+
const lts = await MarketComponentApi.getLatestTradesByEvents('team', evs.map(e => e.event_id));
|
|
107
|
+
setTickerData({
|
|
108
|
+
...ticker_data,
|
|
109
|
+
events: evs,
|
|
110
|
+
animate:false,
|
|
111
|
+
markets: mks,
|
|
112
|
+
trades: lts.filter(t => t.market_type == 'FOR_MONEY'),
|
|
113
|
+
leagues: lgs
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const renderTrades = (data: { item:MarketProps, index:number, event:EventProps, is_live:boolean }) => {
|
|
119
|
+
const ev_trades = trades.filter(t => t.event_type == 'team' && t.event_id == data.event.event_id && t.market_id == data.item.market_id);
|
|
120
|
+
const trade_side_trade = ev_trades.find(t => t.side == data.item.trade_side);
|
|
121
|
+
if(!trade_side_trade){ return <></> }
|
|
122
|
+
return (
|
|
123
|
+
<TradeText
|
|
124
|
+
market={data.item}
|
|
125
|
+
trade={trade_side_trade}
|
|
126
|
+
width={tick_width / 2.5 / 3}
|
|
127
|
+
animate={animate}
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const renderEvents = (data: { item:EventProps, index:number }) => {
|
|
133
|
+
const league = leagues.find(l => l.league_id == data.item.league_id);
|
|
134
|
+
let sup_markets = data.item.supported_markets ?? []
|
|
135
|
+
const supported_markets = primary_markets.filter(pm => sup_markets.map(sm => sm.market_id.toString()).includes(pm.market_id.toString())).sort((a,b) => parseInt(a.market_id) - parseInt(b.market_id));
|
|
136
|
+
const is_live = moment().isAfter(moment(data.item.scheduled_datetime)) ? true : false
|
|
137
|
+
const is_closed = FINALIZED_STATUSES.includes(data.item.status) ? true : false
|
|
138
|
+
return (
|
|
139
|
+
<View style={{ width:tick_width, margin:5, padding:8, borderBottomWidth:1, borderColor:is_closed?Colors.text.error:is_live?Colors.text.success:Colors.borders.light }}>
|
|
140
|
+
<View key={data.item.event_id.toString()} style={{ flexDirection:'row', alignItems:'center' }}>
|
|
141
|
+
<Image
|
|
142
|
+
source={{ uri: league?.league_image }}
|
|
143
|
+
style={{ height:30, width:30 }}
|
|
144
|
+
resizeMode='cover'
|
|
145
|
+
/>
|
|
146
|
+
<View style={{ flex:1, marginLeft:10, marginRight:10 }}>
|
|
147
|
+
<Text theme='h2'>{data.item.event_title}</Text>
|
|
148
|
+
<Text theme='description' style={{ marginTop:3 }}>{data.item.time_detail == 'scheduled'?`${moment(data.item.scheduled_datetime).format('MMM DD hh:mm a')}`:data.item.time_detail}</Text>
|
|
149
|
+
</View>
|
|
150
|
+
<View style={{ flexDirection:'row' }}>
|
|
151
|
+
{supported_markets.map((sm, i) => {
|
|
152
|
+
return renderTrades({ item: sm, index:i, event:data.item, is_live })
|
|
153
|
+
})}
|
|
154
|
+
</View>
|
|
155
|
+
</View>
|
|
156
|
+
{data.item.last_play ?
|
|
157
|
+
<Text theme='description' style={{ marginTop:3 }}>{data.item.last_play}</Text>
|
|
158
|
+
:<></>}
|
|
159
|
+
</View>
|
|
160
|
+
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<View style={{ flex:1, flexDirection:'row' }} >
|
|
166
|
+
<View style={{ flex:1 }} onLayout={(ev) => {
|
|
167
|
+
const { width, height } = ev.nativeEvent.layout;
|
|
168
|
+
setEmbedSize({ width, height });
|
|
169
|
+
}}>
|
|
170
|
+
<View style={{ flexDirection:'row', flexWrap:'wrap', overflow:'scroll' }}>
|
|
171
|
+
{sorted_events.map((e,i) => {
|
|
172
|
+
return renderEvents({ item:e, index:i })
|
|
173
|
+
})}
|
|
174
|
+
</View>
|
|
175
|
+
</View>
|
|
176
|
+
{distinct_id ?
|
|
177
|
+
<SocketManager
|
|
178
|
+
distinct_id={distinct_id}
|
|
179
|
+
subscribed_events={['V1_UPDATE_LATEST_TRADE','V1_UPDATE_EVENT', 'V1_UPDATE_ORDERS']}
|
|
180
|
+
onConnect={() => {
|
|
181
|
+
if(needs_reload){ getData(league_ids) }
|
|
182
|
+
}}
|
|
183
|
+
onDisconnect={() => setNeedsReload(true)}
|
|
184
|
+
onSocketEvent={(ev) => {
|
|
185
|
+
switch(ev.type){
|
|
186
|
+
case 'V1_UPDATE_LATEST_TRADE':
|
|
187
|
+
return setSocketTrade(ev.data)
|
|
188
|
+
case 'V1_UPDATE_EVENT':
|
|
189
|
+
return setSocketEvent(ev.data)
|
|
190
|
+
case 'V1_UPDATE_ORDERS':
|
|
191
|
+
if(!onOrders){ return }
|
|
192
|
+
return onOrders(ev.data)
|
|
193
|
+
default:return
|
|
194
|
+
}
|
|
195
|
+
}}
|
|
196
|
+
/>
|
|
197
|
+
:<></>}
|
|
198
|
+
</View>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export default Ticker
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useColorScheme } from "react-native"
|
|
2
2
|
import Colors from "./colors"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type UseColorProps = {
|
|
5
|
+
mode?:'dark'|'light'
|
|
6
|
+
}
|
|
7
|
+
export const useColors = (props?:UseColorProps) => {
|
|
8
|
+
let color_scheme = props?.mode ?? useColorScheme()
|
|
7
9
|
let absolutes = Colors
|
|
8
10
|
|
|
9
11
|
let light_theme = {
|
package/src/index.tsx
CHANGED
|
@@ -39,12 +39,17 @@ import SeasonCard from './Engage/components/SeasonCard';
|
|
|
39
39
|
import NotificationModule from './Notifications';
|
|
40
40
|
import { useNotifications } from './Notifications/useNotifications';
|
|
41
41
|
import ManageBracketCompetitionForm from './Bracket/components/ManageBracketCompetitionForm';
|
|
42
|
+
import Campaign from './Campaign';
|
|
43
|
+
import Ticker from './Ticker';
|
|
44
|
+
|
|
42
45
|
export {
|
|
43
46
|
Authenticator,
|
|
44
47
|
Observer,
|
|
45
48
|
BEEventApi,
|
|
46
49
|
BELinkApi,
|
|
50
|
+
Ticker,
|
|
47
51
|
LocationTracker,
|
|
52
|
+
Campaign,
|
|
48
53
|
ManageBracketCompetitionForm,
|
|
49
54
|
NotificationModule,
|
|
50
55
|
useNotifications,
|
package/src/types.d.ts
CHANGED
|
@@ -502,6 +502,35 @@ export interface PlayerFollowerStatsProps {
|
|
|
502
502
|
|
|
503
503
|
|
|
504
504
|
|
|
505
|
+
export interface CampaignProps {
|
|
506
|
+
campaign_id:string,
|
|
507
|
+
campaign_name:string,
|
|
508
|
+
description?:string,
|
|
509
|
+
status:'active'|'inactive',
|
|
510
|
+
sponsors?:bigint[],
|
|
511
|
+
prize_description?:string,
|
|
512
|
+
raffle_options?:string[],
|
|
513
|
+
raffle_type?:string,
|
|
514
|
+
ads?:{
|
|
515
|
+
ad_type:string,
|
|
516
|
+
url:string
|
|
517
|
+
}[],
|
|
518
|
+
league_ids?:string[],
|
|
519
|
+
campaign_image?:any,
|
|
520
|
+
admin_id:string,
|
|
521
|
+
create_datetime:any,
|
|
522
|
+
last_update_datetime:any
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export interface CampaignParticipantProps {
|
|
526
|
+
campaign_participant_id:string,
|
|
527
|
+
campaign_id:string,
|
|
528
|
+
player_id:string,
|
|
529
|
+
status:'invited'|'active'|'inactive',
|
|
530
|
+
payload:any,
|
|
531
|
+
create_datetime:any,
|
|
532
|
+
last_update_datetime:any
|
|
533
|
+
}
|
|
505
534
|
|
|
506
535
|
|
|
507
536
|
//POLL TYPES
|
|
@@ -1977,6 +2006,7 @@ export interface OrderProps {
|
|
|
1977
2006
|
side_type: 'athlete' | 'team' | 'side';
|
|
1978
2007
|
reversed?:boolean,
|
|
1979
2008
|
draft_liquidity?:number,
|
|
2009
|
+
campaign_id?:string,
|
|
1980
2010
|
fund_id?:string,
|
|
1981
2011
|
reference_order_id?:string,
|
|
1982
2012
|
be_type: 'market' | 'prop' | 'ind'; //The old be-type of order so we can compare to historical orders
|
|
@@ -2033,6 +2063,36 @@ export interface OrderProps {
|
|
|
2033
2063
|
no_bet_reason?:string
|
|
2034
2064
|
}
|
|
2035
2065
|
|
|
2066
|
+
export interface OverallOrderAnalyticsProps {
|
|
2067
|
+
player_id:string,
|
|
2068
|
+
fulfilled_positions:number,
|
|
2069
|
+
original_stake:number,
|
|
2070
|
+
cash_rcvd:number,
|
|
2071
|
+
winnings:number,
|
|
2072
|
+
net_winnings:number,
|
|
2073
|
+
wins:number,
|
|
2074
|
+
losses:number,
|
|
2075
|
+
draws:number
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
export interface OrderAnalyticsProps {
|
|
2079
|
+
day:string,
|
|
2080
|
+
player_id:string,
|
|
2081
|
+
league_id:string,
|
|
2082
|
+
market_id:string,
|
|
2083
|
+
side:string,
|
|
2084
|
+
side_id:string,
|
|
2085
|
+
side_type:string,
|
|
2086
|
+
fulfilled_positions:number,
|
|
2087
|
+
original_stake:number,
|
|
2088
|
+
cash_rcvd:number,
|
|
2089
|
+
winnings:number,
|
|
2090
|
+
net_winnings:number,
|
|
2091
|
+
wins:number,
|
|
2092
|
+
losses:number,
|
|
2093
|
+
draws:number
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2036
2096
|
export interface HedgeProps {
|
|
2037
2097
|
hedge_id:string,
|
|
2038
2098
|
hedged_amt:number,
|