be-components 6.8.1 → 6.8.3

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/Competition/components/CompetitionLeaderboard.js +244 -143
  2. package/lib/commonjs/Competition/components/CompetitionLeaderboard.js.map +1 -1
  3. package/lib/commonjs/Competition/index.js +91 -55
  4. package/lib/commonjs/Competition/index.js.map +1 -1
  5. package/lib/commonjs/Components/ImageUploader.js +3 -1
  6. package/lib/commonjs/Components/ImageUploader.js.map +1 -1
  7. package/lib/commonjs/CreateEngagement/index.js +4 -3
  8. package/lib/commonjs/CreateEngagement/index.js.map +1 -1
  9. package/lib/commonjs/SquaresManager/api/index.js +129 -0
  10. package/lib/commonjs/SquaresManager/api/index.js.map +1 -0
  11. package/lib/commonjs/SquaresManager/index.js +629 -0
  12. package/lib/commonjs/SquaresManager/index.js.map +1 -0
  13. package/lib/commonjs/index.js +7 -0
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/module/Competition/components/CompetitionLeaderboard.js +244 -143
  16. package/lib/module/Competition/components/CompetitionLeaderboard.js.map +1 -1
  17. package/lib/module/Competition/index.js +91 -55
  18. package/lib/module/Competition/index.js.map +1 -1
  19. package/lib/module/Components/ImageUploader.js +3 -1
  20. package/lib/module/Components/ImageUploader.js.map +1 -1
  21. package/lib/module/CreateEngagement/index.js +4 -3
  22. package/lib/module/CreateEngagement/index.js.map +1 -1
  23. package/lib/module/SquaresManager/api/index.js +123 -0
  24. package/lib/module/SquaresManager/api/index.js.map +1 -0
  25. package/lib/module/SquaresManager/index.js +621 -0
  26. package/lib/module/SquaresManager/index.js.map +1 -0
  27. package/lib/module/index.js +2 -1
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/typescript/lib/commonjs/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
  30. package/lib/typescript/lib/commonjs/Competition/index.d.ts.map +1 -1
  31. package/lib/typescript/lib/commonjs/Components/ImageUploader.d.ts +2 -1
  32. package/lib/typescript/lib/commonjs/Components/ImageUploader.d.ts.map +1 -1
  33. package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
  34. package/lib/typescript/lib/commonjs/SquaresManager/api/index.d.ts +19 -0
  35. package/lib/typescript/lib/commonjs/SquaresManager/api/index.d.ts.map +1 -0
  36. package/lib/typescript/lib/commonjs/SquaresManager/index.d.ts +13 -0
  37. package/lib/typescript/lib/commonjs/SquaresManager/index.d.ts.map +1 -0
  38. package/lib/typescript/lib/commonjs/index.d.ts +1 -0
  39. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  40. package/lib/typescript/lib/module/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
  41. package/lib/typescript/lib/module/Competition/index.d.ts.map +1 -1
  42. package/lib/typescript/lib/module/Components/ImageUploader.d.ts +2 -1
  43. package/lib/typescript/lib/module/Components/ImageUploader.d.ts.map +1 -1
  44. package/lib/typescript/lib/module/CreateEngagement/index.d.ts.map +1 -1
  45. package/lib/typescript/lib/module/SquaresManager/api/index.d.ts +18 -0
  46. package/lib/typescript/lib/module/SquaresManager/api/index.d.ts.map +1 -0
  47. package/lib/typescript/lib/module/SquaresManager/index.d.ts +13 -0
  48. package/lib/typescript/lib/module/SquaresManager/index.d.ts.map +1 -0
  49. package/lib/typescript/lib/module/index.d.ts +2 -1
  50. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  51. package/lib/typescript/src/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
  52. package/lib/typescript/src/Competition/index.d.ts.map +1 -1
  53. package/lib/typescript/src/Components/ImageUploader.d.ts +3 -1
  54. package/lib/typescript/src/Components/ImageUploader.d.ts.map +1 -1
  55. package/lib/typescript/src/SquaresManager/api/index.d.ts +36 -0
  56. package/lib/typescript/src/SquaresManager/api/index.d.ts.map +1 -0
  57. package/lib/typescript/src/SquaresManager/index.d.ts +16 -0
  58. package/lib/typescript/src/SquaresManager/index.d.ts.map +1 -0
  59. package/lib/typescript/src/index.d.ts +2 -1
  60. package/lib/typescript/src/index.d.ts.map +1 -1
  61. package/package.json +1 -1
  62. package/src/Competition/components/CompetitionLeaderboard.tsx +115 -62
  63. package/src/Competition/index.tsx +69 -49
  64. package/src/Components/ImageUploader.tsx +4 -3
  65. package/src/CreateEngagement/index.tsx +6 -2
  66. package/src/SquaresManager/api/index.ts +99 -0
  67. package/src/SquaresManager/index.tsx +395 -0
  68. package/src/index.tsx +2 -0
  69. package/src/types.d.ts +1 -1
@@ -31,7 +31,7 @@ type CompetitionModuleProps = {
31
31
  }
32
32
 
33
33
 
34
- const competition_sections = ['header','join','test','details','leaderboard','play']
34
+ const competition_sections = ['header','pending','join','test','details','leaderboard','play']
35
35
 
36
36
  const CompetitionModule = ({ competition_id, view_mode, insets, player_id, confirm_padding, onManageCompetition, onFocusPosition, onRequestAuthentication, onShareCompetition, onClose, onViewCompetitionSeason }:CompetitionModuleProps) => {
37
37
  const C = useColors();
@@ -370,6 +370,23 @@ const CompetitionModule = ({ competition_id, view_mode, insets, player_id, confi
370
370
  </Button>
371
371
  </View>
372
372
  )
373
+ case 'pending':
374
+ if(competition.status != 'pending' || !onManageCompetition){ return <></> }
375
+ return (
376
+ <View type='header' style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
377
+ <View transparent style={{ flex:1 }}>
378
+ <Text theme='h1' color={Colors.text.error}>Competition Is Pending</Text>
379
+ <Text theme='description' color={Colors.text.error} style={{ marginTop:4 }}>This competition is not yet active</Text>
380
+ </View>
381
+ <Button
382
+ title='FINISH SET UP'
383
+ backgroundColor={Colors.text.warning}
384
+ title_color={Colors.text.white}
385
+ style={{ padding:10 }}
386
+ onPress={() => onManageCompetition(competition.competition_id)}
387
+ />
388
+ </View>
389
+ )
373
390
  case 'join':
374
391
  return (
375
392
  <View transparent>
@@ -473,29 +490,56 @@ const CompetitionModule = ({ competition_id, view_mode, insets, player_id, confi
473
490
  case 'play':
474
491
  if(!competition || !competition_type){ return <></> }
475
492
  return (
476
- <CompetitionPlay
477
- hidden={active_tab == 'play' ? false : true}
478
- competition={competition}
479
- disable_collapse
480
- competition_type={competition_type}
481
- competition_matches={competition_matches}
482
- competition_match_markets={competition_match_markets}
483
- leagues={leagues}
484
- events={events}
485
- pick_loading={pick_loading}
486
- athletes={athletes}
487
- markets={markets}
488
- tournaments={tournaments}
489
- matches={matches}
490
- player_picks={player_picks}
491
- player_id={player_id}
492
- competition_players={competition_players}
493
- authenticated_competition_player={authenticated_competition_player}
494
- height={module_size.height}
495
- width={module_size.width}
496
- onPick={handlePick}
497
- onRequestAuthentication={() => onRequestAuthentication(competition.auth_strategy_id)}
498
- />
493
+ <View transparent>
494
+ <CompetitionPlay
495
+ hidden={active_tab == 'play' ? false : true}
496
+ competition={competition}
497
+ disable_collapse
498
+ competition_type={competition_type}
499
+ competition_matches={competition_matches}
500
+ competition_match_markets={competition_match_markets}
501
+ leagues={leagues}
502
+ events={events}
503
+ pick_loading={pick_loading}
504
+ athletes={athletes}
505
+ markets={markets}
506
+ tournaments={tournaments}
507
+ matches={matches}
508
+ player_picks={player_picks}
509
+ player_id={player_id}
510
+ competition_players={competition_players}
511
+ authenticated_competition_player={authenticated_competition_player}
512
+ height={module_size.height}
513
+ width={module_size.width}
514
+ onPick={handlePick}
515
+ onRequestAuthentication={() => onRequestAuthentication(competition.auth_strategy_id)}
516
+ />
517
+ {active_tab == 'play' && (competition.status == 'paused' || competition.status =='pending') ?
518
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
519
+ <View style={{ ...view_styles.section, width: '70%' }}>
520
+ <View style={{ ...view_styles.section_header, justifyContent:'center', alignItems:'center' }}>
521
+ <Text theme='h1'>Competition is {competition.status}</Text>
522
+ </View>
523
+ <View style={{ ...view_styles.section_body, justifyContent:'center', alignItems:'center' }}>
524
+ <Image
525
+ source={{ uri: competition.image?.url }}
526
+ style={{ height:75, width: 75 }}
527
+ resizeMode='cover'
528
+ />
529
+ <Text theme='h2'>{competition.competition_name}</Text>
530
+ </View>
531
+ <View style={{ ...view_styles.section_footer }}>
532
+ <Button
533
+ title='CLOSE'
534
+ style={{ flex:1 }}
535
+ type='close'
536
+ onPress={() => onClose()}
537
+ />
538
+ </View>
539
+ </View>
540
+ </View>
541
+ :<></>}
542
+ </View>
499
543
  )
500
544
  default: return <></>
501
545
  }
@@ -653,31 +697,7 @@ const CompetitionModule = ({ competition_id, view_mode, insets, player_id, confi
653
697
  </View>
654
698
  </View>
655
699
  :<></>}
656
- {competition.status == 'paused' ?
657
- <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
658
- <View style={{ ...view_styles.section, width: '70%' }}>
659
- <View style={{ ...view_styles.section_header, justifyContent:'center', alignItems:'center' }}>
660
- <Text theme='h1'>Competition Is Paused</Text>
661
- </View>
662
- <View style={{ ...view_styles.section_body, justifyContent:'center', alignItems:'center' }}>
663
- <Image
664
- source={{ uri: competition.image?.url }}
665
- style={{ height:75, width: 75 }}
666
- resizeMode='cover'
667
- />
668
- <Text theme='h2'>{competition.competition_name}</Text>
669
- </View>
670
- <View style={{ ...view_styles.section_footer }}>
671
- <Button
672
- title='CLOSE'
673
- style={{ flex:1 }}
674
- type='close'
675
- onPress={() => onClose()}
676
- />
677
- </View>
678
- </View>
679
- </View>
680
- :<></>}
700
+
681
701
  </View>
682
702
  )
683
703
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
  import React from "react";
7
- import { TouchableOpacity } from "react-native";
7
+ import { TouchableOpacity, type ViewStyle } from "react-native";
8
8
  import * as ImagePicker from 'expo-image-picker';
9
9
  import axios from 'axios';
10
10
 
@@ -12,11 +12,12 @@ import axios from 'axios';
12
12
  type CldUploaderProps = {
13
13
  onFinishUpload : (obj:any | undefined) => void
14
14
  onStartUpload?: () => void,
15
+ style?:ViewStyle,
15
16
  onCancelUpload?: () => void,
16
17
  children?:any,
17
18
  public_id: string
18
19
  }
19
- const ImageUploader = ({ onStartUpload, onFinishUpload, public_id, children }:CldUploaderProps) => {
20
+ const ImageUploader = ({ style, onStartUpload, onFinishUpload, public_id, children }:CldUploaderProps) => {
20
21
 
21
22
  /*
22
23
  const processFile = async (file:any) => {
@@ -138,7 +139,7 @@ const ImageUploader = ({ onStartUpload, onFinishUpload, public_id, children }:Cl
138
139
  return onFinishUpload(object)
139
140
  }
140
141
  return (
141
- <TouchableOpacity style={{ padding:10 }} onPress={() => handleClick()}>
142
+ <TouchableOpacity style={{ padding:10, ...style }} onPress={() => handleClick()}>
142
143
  {children}
143
144
  </TouchableOpacity>
144
145
  );
@@ -321,7 +321,7 @@ const CreateEngagement = ({ float, player, init_engagement, onFocusPostiion, gro
321
321
  const { height, width } = ev.nativeEvent.layout;
322
322
  setSize({ height, width });
323
323
  }}>
324
- <View style={{ flex:1 }}>
324
+ <View transparent style={{ flex:1 }}>
325
325
  <FlatList
326
326
  data={sections}
327
327
  key={'create_engagement_list'}
@@ -428,6 +428,7 @@ const EngagementOptions = ({active_engagement, onSelectEngagement}:EngagementOpt
428
428
  <Text theme='description' color={active_engagement == 'squares' ? Colors.text.success : Colors.text.h1} style={{ marginTop:4 }}>Create an auction squares game. Bid on squares until the auction ends. Buy and sell squares throughout the game.</Text>
429
429
  </View>
430
430
  </Button>
431
+ {false ?
431
432
  <Button
432
433
  key='bracket'
433
434
  float
@@ -440,6 +441,8 @@ const EngagementOptions = ({active_engagement, onSelectEngagement}:EngagementOpt
440
441
  <Text theme='description' color={active_engagement == 'bracket' ? Colors.text.success : Colors.text.h1} style={{ marginTop:4 }}>Create a bracket. Make picks until the championship. Pick more correctly and win!</Text>
441
442
  </View>
442
443
  </Button>
444
+ :<></>}
445
+ {false ?
443
446
  <Button
444
447
  key='flash'
445
448
  float
@@ -452,6 +455,7 @@ const EngagementOptions = ({active_engagement, onSelectEngagement}:EngagementOpt
452
455
  <Text theme='description' color={active_engagement == 'flash' ? Colors.text.success : Colors.text.h1} style={{ marginTop:4 }}>Create a custom flash market. Players bet on the perimutuel outcomes, get it right and get paid!</Text>
453
456
  </View>
454
457
  </Button>
458
+ :<></>}
455
459
  </View>
456
460
  )
457
461
  }
@@ -669,7 +673,7 @@ const CreateSquares = ({onFocusPosition, onUpdateDraft}:SCProps) => {
669
673
  : active_event ?
670
674
  <Button style={{ borderColor:active_event?Colors.text.success:Colors.text.warning }} float onPress={() => setSQData({ ...sq_data, league_schedule: true })}>
671
675
  <Text theme='h1'>{active_event.event_title}</Text>
672
- </Button>
676
+ </Button>
673
677
  :<></>}
674
678
  </View>
675
679
  </View>
@@ -0,0 +1,99 @@
1
+ import axios from "axios";
2
+ import type { CompanyProps, EventProps, GroupPlayerProps, GroupProps, LeagueProps, PlayerSquareProps, SquareOfferProps, SquarePrizeProps, SquareProps, SquareResultProps, SquaresCompetitionProps, SquaresPayoutProps, SquaresTypeProps } from "../../types";
3
+ import { APIOverrides } from "../../ApiOverrides";
4
+ import type { CompanyMemberProps } from "../../Authenticator/api/types";
5
+
6
+ let AUTH_SVC_API = ''
7
+ let TP_SVC_API = ''
8
+ let EVENT_SVC_API = ''
9
+ let SOCIAL_SVC_API = ''
10
+ export { SquaresManagerApi }
11
+
12
+
13
+ const SquaresManagerApi = {
14
+ setEnvironment: () => {
15
+ const endpoints = APIOverrides.getEndpoints();
16
+ TP_SVC_API = endpoints['TP_SVC_API'] as string;
17
+ EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
18
+ //MK_SVC_API = endpoints['MK_SVC_API'] as string;
19
+ AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
20
+ SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
21
+ },
22
+ getLeagues: async():Promise<LeagueProps[]> => {
23
+ try {
24
+ const resp = await axios.get(`${EVENT_SVC_API}/v1/leagues`);
25
+ return resp.data.leagues
26
+ } catch (e) {
27
+ return []
28
+ }
29
+ },
30
+ getEventsByEventIds: async(event_ids:string[]):Promise<EventProps[]> => {
31
+ try {
32
+ if(event_ids.length == 0){ return [] }
33
+ const resp = await axios.post(`${EVENT_SVC_API}/v1/events/bulk/get`, { attribute:'event_id', values: event_ids })
34
+ return resp.data.events
35
+ } catch (e) {
36
+ return []
37
+ }
38
+ },
39
+ getSquareCompetitionById: async(sq_comp_id:string):Promise<undefined | { squares_competition:SquaresCompetitionProps, square_results:SquareResultProps[], squares:SquareProps[], player_squares:PlayerSquareProps[], square_offers:SquareOfferProps[], squares_type:SquaresTypeProps, squares_payout_type: SquaresPayoutProps, player_square_history:PlayerSquareProps[], square_prizes:SquarePrizeProps[] }> => {
40
+ try {
41
+ const resp = await axios.get(`${TP_SVC_API}/tp/squares/comp/details/${sq_comp_id}`)
42
+ return resp.data
43
+ } catch (e) {
44
+ return undefined
45
+ }
46
+ },
47
+ updateSquaresCompetition: async(squares_competition:SquaresCompetitionProps):Promise<SquaresCompetitionProps|undefined> => {
48
+ try {
49
+ const resp = await axios.post(`${TP_SVC_API}/v1/squares/competition/update`, { squares_competition });
50
+ return resp.data.squares_competition
51
+ } catch (e) {
52
+ return undefined
53
+ }
54
+ },
55
+ getMyCompanies : async():Promise<{companies:CompanyProps[], company_members:CompanyMemberProps[]}> => {
56
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/companies/me`)
57
+ const { companies, company_members } = resp.data
58
+ return { companies, company_members }
59
+ },
60
+ getMyGroups: async(offset:number):Promise<{groups: GroupProps[], group_players:GroupPlayerProps[]}> => {
61
+ try {
62
+ const resp = await axios.get(`${SOCIAL_SVC_API}/v2/groups/me/multiple?offset=${offset}`);
63
+ return resp.data
64
+ } catch (e) {
65
+ return { group_players: [], groups: [] }
66
+ }
67
+ },
68
+
69
+ createSquaresCompetition: async(squares_competition:SquaresCompetitionProps):Promise<SquaresCompetitionProps | undefined> => {
70
+ try {
71
+ const resp = await axios.post(`${TP_SVC_API}/v1/squares/competition/create`, { squares_competition });
72
+ return resp.data.squares_competition
73
+ } catch (e) {
74
+ console.log(e)
75
+ return undefined
76
+ }
77
+ },
78
+ activateSquares: async(sq_comp_id:string):Promise<undefined | { squares_competition:SquaresCompetitionProps }> => {
79
+ try {
80
+ const resp = await axios.post(`${TP_SVC_API}/v1/squares/competition/activate`, { sq_comp_id });
81
+ return resp.data
82
+ } catch (e) {
83
+ return undefined
84
+ }
85
+ }
86
+ }
87
+
88
+
89
+ export const SquaresManagerHelpers = {
90
+ isValid: (draft_squares?:SquaresCompetitionProps) => {
91
+ if(!draft_squares){ return ['Invalid'] }
92
+ let errors:string[] = []
93
+ if(!draft_squares){ errors.push('Please complete steps'); return errors }
94
+ if(!draft_squares.sq_comp_name){ errors.push('Please add a squares name') }
95
+ if(!draft_squares.sq_comp_description){ errors.push('Please add a description') }
96
+ if(!draft_squares.event_id){ errors.push('Please add an event') }
97
+ return errors
98
+ }
99
+ }