be-components 6.3.3 → 6.3.5

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 (42) hide show
  1. package/lib/commonjs/Campaign/index.js +16 -4
  2. package/lib/commonjs/Campaign/index.js.map +1 -1
  3. package/lib/commonjs/Checkout/components/AccountSummaryCard.js +2 -2
  4. package/lib/commonjs/Checkout/components/AccountSummaryCard.js.map +1 -1
  5. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +114 -2
  6. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  7. package/lib/commonjs/Wallet/api/index.js +3 -0
  8. package/lib/commonjs/Wallet/api/index.js.map +1 -1
  9. package/lib/commonjs/Wallet/components/AccountCard.js +2 -2
  10. package/lib/commonjs/Wallet/components/AccountCard.js.map +1 -1
  11. package/lib/module/Campaign/index.js +17 -5
  12. package/lib/module/Campaign/index.js.map +1 -1
  13. package/lib/module/Checkout/components/AccountSummaryCard.js +2 -2
  14. package/lib/module/Checkout/components/AccountSummaryCard.js.map +1 -1
  15. package/lib/module/MarketComponents/components/TeamEventMarket/index.js +114 -2
  16. package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  17. package/lib/module/Wallet/api/index.js +3 -0
  18. package/lib/module/Wallet/api/index.js.map +1 -1
  19. package/lib/module/Wallet/components/AccountCard.js +2 -2
  20. package/lib/module/Wallet/components/AccountCard.js.map +1 -1
  21. package/lib/typescript/lib/commonjs/Campaign/index.d.ts.map +1 -1
  22. package/lib/typescript/lib/commonjs/Wallet/api/index.d.ts +1 -0
  23. package/lib/typescript/lib/commonjs/Wallet/api/index.d.ts.map +1 -1
  24. package/lib/typescript/lib/module/Campaign/index.d.ts.map +1 -1
  25. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts +3 -1
  26. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  27. package/lib/typescript/lib/module/Wallet/api/index.d.ts +1 -0
  28. package/lib/typescript/lib/module/Wallet/api/index.d.ts.map +1 -1
  29. package/lib/typescript/src/Campaign/index.d.ts.map +1 -1
  30. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +4 -2
  31. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  32. package/lib/typescript/src/MarketComponents/index.d.ts +3 -1
  33. package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
  34. package/lib/typescript/src/Wallet/api/index.d.ts +1 -0
  35. package/lib/typescript/src/Wallet/api/index.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/Campaign/index.tsx +18 -9
  38. package/src/Checkout/components/AccountSummaryCard.tsx +2 -2
  39. package/src/MarketComponents/components/TeamEventMarket/index.tsx +61 -2
  40. package/src/Wallet/api/index.ts +3 -0
  41. package/src/Wallet/components/AccountCard.tsx +2 -2
  42. package/src/types.d.ts +1 -0
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { FlatList, Image, ImageBackground, useWindowDimensions } from "react-native"
2
+ import { ActivityIndicator, FlatList, Image, ImageBackground, useWindowDimensions } from "react-native"
3
3
  import { Button, Text, View } from '../Components/Themed';
4
4
  import type { AthleteProps, CampaignParticipantProps, CampaignProps, CompanyProps, CompetitionProps, EventProps, LeagueProps, MarketProps, MatchProps, OrderAnalyticsProps, OrderProps, PollCampaignProps, PollOptionProps, PollProps, PublicPlayerProps, TeamProps, TournamentProps } from '../types';
5
5
  import { CampaignApi, CampaignHelpers } from '../Campaign/api';
@@ -107,7 +107,7 @@ const Campaign = ({ player_id, campaign_id, insets, color_mode, mode, distinct_i
107
107
  players:[],
108
108
  teams:[]
109
109
  });
110
- const { orders, events, tournaments, flash_options, sponsors, athletes, competitions, flash_markets, poll_campaigns, campaign, participant_page, action_page, leagues, campaign_participants, players, teams, } = embed_state;
110
+ const { loading, orders, events, tournaments, flash_options, sponsors, athletes, competitions, flash_markets, poll_campaigns, campaign, participant_page, action_page, leagues, campaign_participants, players, teams, } = embed_state;
111
111
  //const visible_orders = orders.sort((a,b) => moment(b.create_datetime).unix() - moment(a.create_datetime).unix()).slice((action_page-1) * 5, ((action_page-1) * 5) + 5)
112
112
  useEffect(() => {
113
113
  if(!campaign_id){ return }
@@ -272,7 +272,10 @@ const Campaign = ({ player_id, campaign_id, insets, color_mode, mode, distinct_i
272
272
  events: evs,
273
273
  orders: vis_ords,
274
274
  loading:false
275
- })
275
+ });
276
+ setTimeout(() => {
277
+ getData(campaign_id)
278
+ }, 240000); //Update every 4 minutes
276
279
  }
277
280
 
278
281
  const handleCheckIn = async() => {
@@ -369,7 +372,7 @@ const Campaign = ({ player_id, campaign_id, insets, color_mode, mode, distinct_i
369
372
  <Text theme='description' style={{ marginTop:3 }}>@{player.username}</Text>
370
373
  </View>
371
374
  </View>
372
- <Text theme='h1'>{data.item.payload.pin_distance}</Text>
375
+ <Text theme='h1'>{data.item.payload.pin_distance == 999 ? 'MISS' : data.item.payload.pin_distance}</Text>
373
376
  </View>
374
377
  )
375
378
  }
@@ -541,7 +544,7 @@ const Campaign = ({ player_id, campaign_id, insets, color_mode, mode, distinct_i
541
544
  </View>
542
545
  <View style={{ minWidth:400 }}>
543
546
  <FlatList
544
- data={campaign_participants.sort((a,b) => parseFloat((a.payload.pin_distance ?? 9999)) - parseFloat((b.payload.pin_distance ?? 9999)))}
547
+ data={campaign_participants.filter(cp => cp.status == 'active').sort((a,b) => parseFloat((a.payload.pin_distance ?? 9999)) - parseFloat((b.payload.pin_distance ?? 9999)))}
545
548
  key={'closed_pin_leaders'}
546
549
  keyExtractor={(item) => item.campaign_participant_id}
547
550
  renderItem={renderGolfers}
@@ -836,12 +839,18 @@ const Campaign = ({ player_id, campaign_id, insets, color_mode, mode, distinct_i
836
839
  </View>
837
840
  :<></>}
838
841
  <View style={{ flex:1, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
839
- <View style={{ padding:10 }}>
840
- <Text theme='h1'>LEADERBOARD</Text>
841
- <Text theme='description' style={{ marginTop:4 }}>Closest to the pin - distance in feet from the pin</Text>
842
+ <View style={{ flexDirection:'row' }}>
843
+ <View transparent style={{ padding:10 }}>
844
+ <Text theme='h1'>LEADERBOARD</Text>
845
+ <Text theme='description' style={{ marginTop:4 }}>Closest to the pin - distance in feet from the pin</Text>
846
+ </View>
847
+ {loading ?
848
+ <ActivityIndicator color={Colors.text.h1} size={14} />
849
+ :<></>}
842
850
  </View>
851
+
843
852
  <FlatList
844
- data={campaign_participants.sort((a,b) => parseFloat((a.payload.pin_distance ? a.payload.pin_distance : 9999)) - parseFloat((b.payload.pin_distance ? b.payload.pin_distance : 9999)))}
853
+ data={campaign_participants.filter(cp => cp.status == 'active').sort((a,b) => parseFloat((a.payload.pin_distance ? a.payload.pin_distance : 9999)) - parseFloat((b.payload.pin_distance ? b.payload.pin_distance : 9999)))}
845
854
  key={'closed_pin_leaders'}
846
855
  keyExtractor={(item) => item.campaign_participant_id}
847
856
  renderItem={renderGolfers}
@@ -3,9 +3,9 @@ import { Image } from "react-native";
3
3
  import { Checkbox, Icons } from '../../Components';
4
4
  import type { AccountProps, FocusPositionProps, ItemProps, PlayerAddressProps } from '../../types';
5
5
  import { CheckoutApi, CheckoutHelpers } from '../api';
6
- import moment from 'moment-mini';
7
6
  import { Button, Text, TextInput, View } from '../../Components/Themed';
8
7
  import { useColors } from '../../constants/useColors';
8
+ import { WalletHelpers } from '../../Wallet/api';
9
9
 
10
10
  type AccountSummaryCardProps = {
11
11
  selected_account?:AccountProps,
@@ -127,7 +127,7 @@ const AccountSummaryCard = ({ accounts, cvv, items, selected_account, billing_ad
127
127
  <View style={{ flex:1, marginRight:5 }}>
128
128
  <Text size={14} weight='bold'>{selected_account.account_label}</Text>
129
129
  {selected_account.account_type == 'card' && selected_account.card_detail ?
130
- <Text style={{ marginTop:3 }} size={12} color={Colors.text.descriptionLight}>EXP: {moment(selected_account.card_detail.expiration_date).format('MM/YYYY')}</Text>
130
+ <Text style={{ marginTop:3 }} size={12} color={Colors.text.descriptionLight}>EXP: {WalletHelpers.formateTimeToExpireDate(selected_account.card_detail.expiration_date)}</Text>
131
131
  :<></>}
132
132
  </View>
133
133
  <View style={{ flexDirection:'row', alignItems:'center' }}>
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { Image, FlatList, ActivityIndicator, ScrollView } from 'react-native';
3
- import type { AthleteProps, BEEventProps, BestAvailableOrderProps, CompanyProps, CompetitionProps, EventOrderStatProps, EventProps, LeagueProps, MarketProps, MarketSideOptionProps, OrderProps, PodcastProps, PollProps, SquaresCompetitionProps, TradeProps } from '../../../types';
3
+ import type { AthleteProps, BEEventProps, BestAvailableOrderProps, CompanyProps, CompetitionProps, EventOrderStatProps, EventProps, LeagueProps, MarketProps, MarketSideOptionProps, OrderProps, ParlayProps, PodcastProps, PollProps, SquaresCompetitionProps, TradeProps } from '../../../types';
4
4
  import { view_styles } from '../../../constants/styles';
5
5
  import { Icons, LinearDiagnal } from '../../../Components';
6
6
  import {TeamEventMarketHelpers} from './api';
@@ -17,10 +17,12 @@ import ContestStatsCard from '../ContestStats';
17
17
  import PodcastCard from '../PodcastCard';
18
18
  import { Button, Text, View } from '../../../Components/Themed';
19
19
  import { useColors } from '../../../constants/useColors';
20
+ import OrderGradeBar from '../OrderGradeBar';
20
21
 
21
22
  type TeamEventMarketProps = {
22
23
  event:EventProps,
23
24
  markets:MarketProps[],
25
+ parlays?:ParlayProps[],
24
26
  init_expanded?:boolean,
25
27
  onViewMarketStats?:() => void,
26
28
  onSetMarket?:(market_id:string, side_type?:string, side_id?:string) => void,
@@ -35,6 +37,7 @@ type TeamEventMarketProps = {
35
37
  squares_competitions?:SquaresCompetitionProps[],
36
38
  latest_trades:TradeProps[],
37
39
  style?:any,
40
+ onParlaySelect?:(parlay:ParlayProps) => void,
38
41
  flash_markets?:PollProps[],
39
42
  best_available_orders:BestAvailableOrderProps[],
40
43
  event_order_stats:EventOrderStatProps[],
@@ -57,7 +60,7 @@ type TeamEventMarketProps = {
57
60
  onActivate?:(event_id:string, event_type:string) => void
58
61
  activate_loading?:boolean
59
62
  }
60
- const TeamEventMarket = ({ event, hide_non_primary, disabled_markets, flash_markets, league, float, style, init_expanded, hot_markets_direction, show_id, hide_liquidity, show_podcasts, activate_loading, competitions, squares_competitions, show_grades, markets, latest_trades, best_available_orders, event_order_stats, default_price_view, onSetMarket, onTeamSelect, onFlashSelect, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onViewMarketStats, onView, onViewAdditionalMarkets, onTradeLongPress, onTVSelect, onActivate, onEvent, onShare, onPodcastSelect }:TeamEventMarketProps) => {
63
+ const TeamEventMarket = ({ event, parlays, hide_non_primary, disabled_markets, flash_markets, league, float, style, init_expanded, hot_markets_direction, show_id, hide_liquidity, show_podcasts, activate_loading, competitions, squares_competitions, show_grades, markets, latest_trades, best_available_orders, event_order_stats, default_price_view, onSetMarket, onTeamSelect, onFlashSelect, onParlaySelect, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onViewMarketStats, onView, onViewAdditionalMarkets, onTradeLongPress, onTVSelect, onActivate, onEvent, onShare, onPodcastSelect }:TeamEventMarketProps) => {
61
64
  const C = useColors();
62
65
  const [ market_width, setMarketWidth ] = useState(180);
63
66
  const [ expanded_data, setExpandedData ] = useState<{
@@ -76,6 +79,7 @@ const TeamEventMarket = ({ event, hide_non_primary, disabled_markets, flash_mark
76
79
  const [ show_stats, setShowStats ] = useState(false);
77
80
  const [ sponsor, setSponsor ] = useState<CompanyProps|undefined>(undefined);
78
81
  const [ competitions_expanded, setCompetitionsExpanded ] = useState(false);
82
+ const [ parlays_expanded, setParlaysExpanded ] = useState(false);
79
83
  const [ squares_expanded, setSquaresExpanded ] = useState(false);
80
84
  const { expanded, athletes, loaded, loading, podcasts } = expanded_data;
81
85
  const event_status = TeamEventMarketHelpers.getEventStatus(event);
@@ -156,6 +160,13 @@ const TeamEventMarket = ({ event, hide_non_primary, disabled_markets, flash_mark
156
160
  return setCompetitionsExpanded(true);
157
161
  }
158
162
 
163
+ const handleSelectParlay = () => {
164
+ if(!parlays || parlays.length == 0){ return }
165
+ if(!onParlaySelect){ return }
166
+ if(parlays.length == 1 && parlays[0]){ return onParlaySelect(parlays[0]) }
167
+ return setParlaysExpanded(true);
168
+ }
169
+
159
170
  const handleSelectSquares = () => {
160
171
  if(!squares_competitions || squares_competitions.length == 0){ return }
161
172
  if(squares_competitions.length == 1 && squares_competitions[0]){ return onSquaresSelect(squares_competitions[0].sq_comp_id) }
@@ -184,6 +195,27 @@ const TeamEventMarket = ({ event, hide_non_primary, disabled_markets, flash_mark
184
195
  )
185
196
  }
186
197
 
198
+ const renderParlays = (data:{ item:ParlayProps, index: number }) => {
199
+ return (
200
+ <Button
201
+ type='text'
202
+ transparent
203
+ style={{ padding:10, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:C.borders.light, borderRadius:0 }}
204
+ onPress={() => {
205
+ if(!onParlaySelect){ return }
206
+ setParlaysExpanded(false);
207
+ onParlaySelect(data.item)
208
+ }}>
209
+ <Icons.ParlayIcon size={14} color={C.text.h1} />
210
+ <OrderGradeBar style={{ marginLeft:5 }} grade={data.item.grade} view_type='book'/>
211
+ <View transparent style={{ flex:1, marginLeft:10, marginRight:10 }}>
212
+ <Text theme='h2'>{data.item.name}</Text>
213
+ </View>
214
+ <Icons.ChevronIcon direction='right' size={10} color={C.text.h1} />
215
+ </Button>
216
+ )
217
+ }
218
+
187
219
  const renderSquaresCompetitions = (data:{ item:SquaresCompetitionProps, index: number }) => {
188
220
  return (
189
221
  <Button
@@ -629,6 +661,14 @@ const TeamEventMarket = ({ event, hide_non_primary, disabled_markets, flash_mark
629
661
  <Text style={{ marginLeft:5 }} size={14} color={C.text.white} weight='semibold'>Squares</Text>
630
662
  </Button>
631
663
  :<></>}
664
+ {onParlaySelect && parlays && parlays.length > 0 ?
665
+ <Button
666
+ float
667
+ style={{ marginRight:3, flexDirection:'row', alignItems:'center', padding:10, borderRadius:22, backgroundColor:C.text.gold }}
668
+ onPress={() => handleSelectParlay()}>
669
+ <Icons.ParlayIcon size={14} color={C.text.white} />
670
+ </Button>
671
+ :<></>}
632
672
  {competitions && competitions.length > 0 ?
633
673
  <Button
634
674
  float
@@ -676,6 +716,25 @@ const TeamEventMarket = ({ event, hide_non_primary, disabled_markets, flash_mark
676
716
  </ScrollView>
677
717
  </View>
678
718
  :<></>}
719
+ {parlays && parlays_expanded ?
720
+ <View float style={{ position:'absolute', bottom:0, right:0, justifyContent:'flex-end', maxHeight:230, minWidth:300, maxWidth:350 }}>
721
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
722
+ <Icons.ParlayIcon size={18} color={C.text.h1} />
723
+ <Text style={{ flex:1, marginLeft:10 }} theme='h2'>Available Parlays</Text>
724
+ <Button
725
+ title='X'
726
+ style={{ padding:10, borderRadius:100 }}
727
+ type='error'
728
+ onPress={() => setParlaysExpanded(false)}
729
+ />
730
+ </View>
731
+ <FlatList
732
+ data={parlays}
733
+ renderItem={renderParlays}
734
+ keyExtractor={(item) => item.parlay_id.toString()}
735
+ />
736
+ </View>
737
+ :<></>}
679
738
  {squares_competitions && squares_expanded ?
680
739
  <View float style={{ position:'absolute', bottom:0, right:0, justifyContent:'flex-end', maxHeight:230, minWidth:300 }}>
681
740
  <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
@@ -326,6 +326,9 @@ const WalletHelpers = {
326
326
  if(!wallet_settings.agreed_to_terms || !wallet_settings.pin || !wallet_settings.auth_end_datetime || moment().isAfter(moment(wallet_settings.auth_end_datetime))){ return false }
327
327
  return true
328
328
  },
329
+ formateTimeToExpireDate: (date:any) => {
330
+ return moment.parseZone(date).utc().format('MM/YYYY')
331
+ },
329
332
  formatBalance: (balance:number) => {
330
333
  let round_down_balance = Math.round(balance * 100) / 100;
331
334
  let str_balance = round_down_balance.toFixed(2).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { AccountProps } from '../../types';
3
3
  import { Icons } from '../../Components';
4
- import moment from 'moment-mini';
5
4
  import { Button, Text, View } from '../../Components/Themed';
6
5
  import { useColors } from '../../constants/useColors';
6
+ import { WalletHelpers } from '../api';
7
7
 
8
8
  type AccountCardProps = {
9
9
  account:AccountProps,
@@ -61,7 +61,7 @@ const AccountCard = ({ account, hide_status, onSelectAccount }: AccountCardProps
61
61
  return account.ach_detail.account_type.toUpperCase()
62
62
  case 'card':
63
63
  if(!account.card_detail){ return '' }
64
- return `EXP ${moment(account.card_detail.expiration_date).format('MM/YYYY')}`
64
+ return `EXP ${WalletHelpers.formateTimeToExpireDate(account.card_detail.expiration_date)}`
65
65
  case 'paypal':
66
66
  return `Login to your Paypal and transact`
67
67
  default: return ''
package/src/types.d.ts CHANGED
@@ -2337,6 +2337,7 @@ export interface ParlayProps {
2337
2337
  odds:number,
2338
2338
  offer_side:'maker'|'taker',
2339
2339
  winning_side?:'maker'|'taker',
2340
+ grade?:number,
2340
2341
  probability:number,
2341
2342
  status: 'approved'|'cancelled'|'closed',
2342
2343
  expire_datetime: any,