be-components 7.0.6 → 7.0.8

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 (180) hide show
  1. package/lib/commonjs/Components/BETimePicker.js +110 -0
  2. package/lib/commonjs/Components/BETimePicker.js.map +1 -0
  3. package/lib/commonjs/Components/Icons.js +37 -0
  4. package/lib/commonjs/Components/Icons.js.map +1 -1
  5. package/lib/commonjs/Components/ImageUploader.js +4 -0
  6. package/lib/commonjs/Components/ImageUploader.js.map +1 -1
  7. package/lib/commonjs/Components/Slider.js +2 -0
  8. package/lib/commonjs/Components/Slider.js.map +1 -1
  9. package/lib/commonjs/Components/Themed.js +4 -2
  10. package/lib/commonjs/Components/Themed.js.map +1 -1
  11. package/lib/commonjs/CreateEngagement/api/index.js +89 -1
  12. package/lib/commonjs/CreateEngagement/api/index.js.map +1 -1
  13. package/lib/commonjs/CreateEngagement/index.js +306 -5
  14. package/lib/commonjs/CreateEngagement/index.js.map +1 -1
  15. package/lib/commonjs/FlashMarket/FlashHolder.js +14 -1
  16. package/lib/commonjs/FlashMarket/FlashHolder.js.map +1 -1
  17. package/lib/commonjs/FlashMarket/api/index.js +42 -0
  18. package/lib/commonjs/FlashMarket/api/index.js.map +1 -1
  19. package/lib/commonjs/FlashMarket/components/FlashOptionCard.js +265 -0
  20. package/lib/commonjs/FlashMarket/components/FlashOptionCard.js.map +1 -0
  21. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js +1222 -0
  22. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js.map +1 -0
  23. package/lib/commonjs/FlashMarket/index.js +18 -6
  24. package/lib/commonjs/FlashMarket/index.js.map +1 -1
  25. package/lib/commonjs/Group/api/index.js +6 -3
  26. package/lib/commonjs/Group/api/index.js.map +1 -1
  27. package/lib/commonjs/Group/index.js +135 -20
  28. package/lib/commonjs/Group/index.js.map +1 -1
  29. package/lib/commonjs/Poll/api/index.js +0 -1
  30. package/lib/commonjs/Poll/api/index.js.map +1 -1
  31. package/lib/commonjs/constants/useColors.js +2 -0
  32. package/lib/commonjs/constants/useColors.js.map +1 -1
  33. package/lib/commonjs/index.js +7 -0
  34. package/lib/commonjs/index.js.map +1 -1
  35. package/lib/commonjs/types.d.js.map +1 -1
  36. package/lib/module/Components/BETimePicker.js +102 -0
  37. package/lib/module/Components/BETimePicker.js.map +1 -0
  38. package/lib/module/Components/Icons.js +37 -0
  39. package/lib/module/Components/Icons.js.map +1 -1
  40. package/lib/module/Components/ImageUploader.js +4 -0
  41. package/lib/module/Components/ImageUploader.js.map +1 -1
  42. package/lib/module/Components/Slider.js +2 -0
  43. package/lib/module/Components/Slider.js.map +1 -1
  44. package/lib/module/Components/Themed.js +4 -2
  45. package/lib/module/Components/Themed.js.map +1 -1
  46. package/lib/module/CreateEngagement/api/index.js +89 -1
  47. package/lib/module/CreateEngagement/api/index.js.map +1 -1
  48. package/lib/module/CreateEngagement/index.js +306 -5
  49. package/lib/module/CreateEngagement/index.js.map +1 -1
  50. package/lib/module/FlashMarket/FlashHolder.js +14 -1
  51. package/lib/module/FlashMarket/FlashHolder.js.map +1 -1
  52. package/lib/module/FlashMarket/api/index.js +42 -0
  53. package/lib/module/FlashMarket/api/index.js.map +1 -1
  54. package/lib/module/FlashMarket/components/FlashOptionCard.js +258 -0
  55. package/lib/module/FlashMarket/components/FlashOptionCard.js.map +1 -0
  56. package/lib/module/FlashMarket/components/ManageFlashMarket.js +1214 -0
  57. package/lib/module/FlashMarket/components/ManageFlashMarket.js.map +1 -0
  58. package/lib/module/FlashMarket/index.js +18 -6
  59. package/lib/module/FlashMarket/index.js.map +1 -1
  60. package/lib/module/Group/api/index.js +6 -3
  61. package/lib/module/Group/api/index.js.map +1 -1
  62. package/lib/module/Group/index.js +135 -20
  63. package/lib/module/Group/index.js.map +1 -1
  64. package/lib/module/Poll/api/index.js +0 -1
  65. package/lib/module/Poll/api/index.js.map +1 -1
  66. package/lib/module/constants/useColors.js +2 -0
  67. package/lib/module/constants/useColors.js.map +1 -1
  68. package/lib/module/index.js +2 -1
  69. package/lib/module/index.js.map +1 -1
  70. package/lib/module/types.d.js.map +1 -1
  71. package/lib/typescript/lib/commonjs/Components/BETimePicker.d.ts +8 -0
  72. package/lib/typescript/lib/commonjs/Components/BETimePicker.d.ts.map +1 -0
  73. package/lib/typescript/lib/commonjs/Components/Icons.d.ts +5 -0
  74. package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
  75. package/lib/typescript/lib/commonjs/Components/ImageUploader.d.ts +2 -1
  76. package/lib/typescript/lib/commonjs/Components/ImageUploader.d.ts.map +1 -1
  77. package/lib/typescript/lib/commonjs/Components/Slider.d.ts +2 -1
  78. package/lib/typescript/lib/commonjs/Components/Slider.d.ts.map +1 -1
  79. package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
  80. package/lib/typescript/lib/commonjs/CreateEngagement/api/index.d.ts +40 -1
  81. package/lib/typescript/lib/commonjs/CreateEngagement/api/index.d.ts.map +1 -1
  82. package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
  83. package/lib/typescript/lib/commonjs/FlashMarket/FlashHolder.d.ts +3 -1
  84. package/lib/typescript/lib/commonjs/FlashMarket/FlashHolder.d.ts.map +1 -1
  85. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts +2 -0
  86. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts.map +1 -1
  87. package/lib/typescript/lib/commonjs/FlashMarket/components/FlashOptionCard.d.ts +13 -0
  88. package/lib/typescript/lib/commonjs/FlashMarket/components/FlashOptionCard.d.ts.map +1 -0
  89. package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts +9 -0
  90. package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -0
  91. package/lib/typescript/lib/commonjs/FlashMarket/index.d.ts +2 -1
  92. package/lib/typescript/lib/commonjs/FlashMarket/index.d.ts.map +1 -1
  93. package/lib/typescript/lib/commonjs/Group/api/index.d.ts.map +1 -1
  94. package/lib/typescript/lib/commonjs/Group/index.d.ts +2 -1
  95. package/lib/typescript/lib/commonjs/Group/index.d.ts.map +1 -1
  96. package/lib/typescript/lib/commonjs/Poll/api/index.d.ts.map +1 -1
  97. package/lib/typescript/lib/commonjs/constants/useColors.d.ts +1 -0
  98. package/lib/typescript/lib/commonjs/constants/useColors.d.ts.map +1 -1
  99. package/lib/typescript/lib/commonjs/index.d.ts +1 -0
  100. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  101. package/lib/typescript/lib/module/Components/BETimePicker.d.ts +8 -0
  102. package/lib/typescript/lib/module/Components/BETimePicker.d.ts.map +1 -0
  103. package/lib/typescript/lib/module/Components/Icons.d.ts +5 -0
  104. package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
  105. package/lib/typescript/lib/module/Components/ImageUploader.d.ts +2 -1
  106. package/lib/typescript/lib/module/Components/ImageUploader.d.ts.map +1 -1
  107. package/lib/typescript/lib/module/Components/Slider.d.ts +2 -1
  108. package/lib/typescript/lib/module/Components/Slider.d.ts.map +1 -1
  109. package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
  110. package/lib/typescript/lib/module/CreateEngagement/api/index.d.ts +41 -1
  111. package/lib/typescript/lib/module/CreateEngagement/api/index.d.ts.map +1 -1
  112. package/lib/typescript/lib/module/CreateEngagement/index.d.ts.map +1 -1
  113. package/lib/typescript/lib/module/FlashMarket/FlashHolder.d.ts +3 -1
  114. package/lib/typescript/lib/module/FlashMarket/FlashHolder.d.ts.map +1 -1
  115. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts +2 -0
  116. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts.map +1 -1
  117. package/lib/typescript/lib/module/FlashMarket/components/FlashOptionCard.d.ts +13 -0
  118. package/lib/typescript/lib/module/FlashMarket/components/FlashOptionCard.d.ts.map +1 -0
  119. package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts +9 -0
  120. package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -0
  121. package/lib/typescript/lib/module/FlashMarket/index.d.ts +2 -1
  122. package/lib/typescript/lib/module/FlashMarket/index.d.ts.map +1 -1
  123. package/lib/typescript/lib/module/Group/api/index.d.ts.map +1 -1
  124. package/lib/typescript/lib/module/Group/index.d.ts +2 -1
  125. package/lib/typescript/lib/module/Group/index.d.ts.map +1 -1
  126. package/lib/typescript/lib/module/Poll/api/index.d.ts.map +1 -1
  127. package/lib/typescript/lib/module/constants/useColors.d.ts +1 -0
  128. package/lib/typescript/lib/module/constants/useColors.d.ts.map +1 -1
  129. package/lib/typescript/lib/module/index.d.ts +2 -1
  130. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  131. package/lib/typescript/src/Components/BETimePicker.d.ts +11 -0
  132. package/lib/typescript/src/Components/BETimePicker.d.ts.map +1 -0
  133. package/lib/typescript/src/Components/Icons.d.ts +1 -0
  134. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  135. package/lib/typescript/src/Components/ImageUploader.d.ts +2 -1
  136. package/lib/typescript/src/Components/ImageUploader.d.ts.map +1 -1
  137. package/lib/typescript/src/Components/Slider.d.ts +2 -1
  138. package/lib/typescript/src/Components/Slider.d.ts.map +1 -1
  139. package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
  140. package/lib/typescript/src/CreateEngagement/api/index.d.ts +8 -2
  141. package/lib/typescript/src/CreateEngagement/api/index.d.ts.map +1 -1
  142. package/lib/typescript/src/CreateEngagement/index.d.ts.map +1 -1
  143. package/lib/typescript/src/FlashMarket/FlashHolder.d.ts +4 -2
  144. package/lib/typescript/src/FlashMarket/FlashHolder.d.ts.map +1 -1
  145. package/lib/typescript/src/FlashMarket/api/index.d.ts +2 -0
  146. package/lib/typescript/src/FlashMarket/api/index.d.ts.map +1 -1
  147. package/lib/typescript/src/FlashMarket/components/FlashOptionCard.d.ts +15 -0
  148. package/lib/typescript/src/FlashMarket/components/FlashOptionCard.d.ts.map +1 -0
  149. package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts +11 -0
  150. package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -0
  151. package/lib/typescript/src/FlashMarket/index.d.ts +2 -1
  152. package/lib/typescript/src/FlashMarket/index.d.ts.map +1 -1
  153. package/lib/typescript/src/Group/api/index.d.ts +5 -2
  154. package/lib/typescript/src/Group/api/index.d.ts.map +1 -1
  155. package/lib/typescript/src/Group/index.d.ts +3 -2
  156. package/lib/typescript/src/Group/index.d.ts.map +1 -1
  157. package/lib/typescript/src/Poll/api/index.d.ts.map +1 -1
  158. package/lib/typescript/src/constants/useColors.d.ts +1 -0
  159. package/lib/typescript/src/constants/useColors.d.ts.map +1 -1
  160. package/lib/typescript/src/index.d.ts +2 -1
  161. package/lib/typescript/src/index.d.ts.map +1 -1
  162. package/package.json +4 -2
  163. package/src/Components/BETimePicker.tsx +77 -0
  164. package/src/Components/Icons.tsx +17 -0
  165. package/src/Components/ImageUploader.tsx +3 -1
  166. package/src/Components/Slider.tsx +3 -1
  167. package/src/Components/Themed.tsx +6 -4
  168. package/src/CreateEngagement/api/index.ts +78 -2
  169. package/src/CreateEngagement/index.tsx +181 -7
  170. package/src/FlashMarket/FlashHolder.tsx +11 -2
  171. package/src/FlashMarket/api/index.ts +24 -1
  172. package/src/FlashMarket/components/FlashOptionCard.tsx +174 -0
  173. package/src/FlashMarket/components/ManageFlashMarket.tsx +766 -0
  174. package/src/FlashMarket/index.tsx +14 -8
  175. package/src/Group/api/index.ts +5 -5
  176. package/src/Group/index.tsx +84 -9
  177. package/src/Poll/api/index.ts +0 -2
  178. package/src/constants/useColors.tsx +2 -0
  179. package/src/index.tsx +2 -0
  180. package/src/types.d.ts +8 -1
@@ -19,6 +19,7 @@ type FlashMarketProps = {
19
19
  hide_image?:boolean,
20
20
  location?:LocationProps,
21
21
  card_style?:any,
22
+ onManageFlash?:(poll:PollProps) => void,
22
23
  init_expanded?:boolean,
23
24
  hide_timer?:boolean,
24
25
  onReload:() => void,
@@ -31,7 +32,7 @@ type FlashMarketProps = {
31
32
  onFocusPosition?: (position:{ x:number, y:number, width:number, height:number }) => void,
32
33
  onRequestAuthenticate: () => void
33
34
  }
34
- const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, poll_summaries, poll_campaign, flash_market_fees, hide_image, init_expanded, card_style, header_style, footer_style, onReload, location, player, player_id, onRequestAuthenticate, onFocusPosition, onRequestLocation }:FlashMarketProps) => {
35
+ const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, poll_summaries, poll_campaign, flash_market_fees, hide_image, init_expanded, card_style, header_style, footer_style, onReload, location, player, player_id, onManageFlash, onRequestAuthenticate, onFocusPosition, onRequestLocation }:FlashMarketProps) => {
35
36
  const Colors = useColors();
36
37
  const [ admin_action, setAdminActions ] = useState<{
37
38
  selected_option_id?:string,
@@ -66,7 +67,7 @@ const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, pol
66
67
 
67
68
  const is_inactive = poll && ['pending','paused'].includes(poll?.status) ? true : false
68
69
  const is_upcoming = poll && poll.start_datetime && moment().isBefore(moment(poll.start_datetime)) ? true : false
69
-
70
+ const is_admin = player?.role == 'admin' ? true : poll?.admins && poll.admins.includes(player?.player_id ?? '0') ? true : false
70
71
  useEffect(() => {
71
72
  if(!poll){ return }
72
73
  FlashMarketApi.setEnvironment();
@@ -83,7 +84,7 @@ const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, pol
83
84
  const isResolveable = () => {
84
85
  if(!poll){ return false }
85
86
  if(!player){ return false }
86
- if(player.role != 'admin'){ return false }
87
+ if(!is_admin){ return false }
87
88
  if(!['paused','active'].includes(poll.status)){ return false }
88
89
  if(!poll.winning_option_id){ return false }
89
90
  if(poll.winning_option_id != selected_option_id){ return false }
@@ -206,7 +207,7 @@ const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, pol
206
207
  const admin_checked = selected_option_id == data.item.poll_option_id ? true : false
207
208
  return (
208
209
  <View transparent style={{ borderRadius:8, flexDirection:'row', alignItems:'center', borderWidth:my_option?1:0, borderColor:Colors.text.action, padding:10 }}>
209
- {!selected && poll?.status != 'closed' && player?.role == 'admin' ?
210
+ {!selected && poll?.status != 'closed' && is_admin ?
210
211
  <Checkbox
211
212
  style={{ marginRight:5 }}
212
213
  checked={admin_checked}
@@ -343,7 +344,7 @@ const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, pol
343
344
  renderItem={renderOptions}
344
345
  keyExtractor={(item) => item.poll_option_id.toString()}
345
346
  />
346
- {is_inactive && player?.role != 'admin' ?
347
+ {is_inactive && is_admin ?
347
348
  <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
348
349
  <View float style={{ flexDirection:'row', alignItems:'center', padding:20 }}>
349
350
  <Icons.PausedIcon size={35} color={Colors.text.h1} />
@@ -375,9 +376,14 @@ const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, pol
375
376
  </View>
376
377
  }
377
378
  </View>
378
- {player?.role == 'admin' ?
379
+ {is_admin ?
379
380
  <View type='footer' style={{ flexDirection:'row', padding:5 }}>
380
- {poll.flash_active ?
381
+ {onManageFlash ?
382
+ <Button float style={{ margin:5, padding:16 }} onPress={() => onManageFlash(poll)}>
383
+ <Icons.SettingsIcon size={16} color={Colors.text.h1} />
384
+ </Button>
385
+ :<></>}
386
+ {player?.role =='admin' && poll.flash_active ?
381
387
  <Button
382
388
  title={`Unflash`}
383
389
  style={{ flex:0.5, margin:4 }}
@@ -392,7 +398,7 @@ const FlashMarket = ({ loading, poll, hide_footer, hide_timer, poll_options, pol
392
398
  setAdminActions({ ...admin_action, admin_loading: false });
393
399
  }}
394
400
  />
395
- :['active','paused'].includes(poll.status) ?
401
+ :['active','paused'].includes(poll.status) && player?.role == 'admin' ?
396
402
  <Button
397
403
  title={`Flash`}
398
404
  style={{ flex:0.5, margin:4 }}
@@ -1,6 +1,6 @@
1
1
  import axios from "axios";
2
2
  import { APIOverrides } from "../../ApiOverrides"
3
- import type { BracketCompetitionProps, CompetitionPayoutTypeProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionSeasonProps, CompetitionTypeProps, CreateGroupStepProps, EventProps, GroupMessageProps, GroupPlayerProps, GroupProps, NewOverallAnalytics, OrderAnalyticsProps, OrderProps, PollCampaignProps, PostProps, PublicPlayerProps, SquaresCompetitionProps } from "../../types";
3
+ import type { BracketCompetitionProps, CompetitionPayoutTypeProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionSeasonProps, CompetitionTypeProps, CreateGroupStepProps, EventProps, GroupMessageProps, GroupPlayerProps, GroupProps, NewOverallAnalytics, OrderAnalyticsProps, OrderProps, PollCampaignProps, PollProps, PostProps, PublicPlayerProps, SquaresCompetitionProps } from "../../types";
4
4
  import type { Moment } from "moment-mini";
5
5
  import moment from "moment-mini";
6
6
 
@@ -161,12 +161,12 @@ const GroupApi = {
161
161
  return { competition_players:[], competition_records:[], competition_results:[], competitions:[] }
162
162
  }
163
163
  },
164
- getActivePolls: async(group_id:string):Promise<PollCampaignProps[]> => {
164
+ getActivePolls: async(group_id:string):Promise<{poll_campaigns:PollCampaignProps[], polls:PollProps[]}> => {
165
165
  try {
166
166
  const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/group/active/${group_id}`);
167
- return resp.data.poll_campaigns
167
+ return resp.data
168
168
  } catch (e) {
169
- return []
169
+ return { poll_campaigns: [], polls:[] }
170
170
  }
171
171
  },
172
172
  getHistoryPolls: async(group_id:string, offset:number):Promise<PollCampaignProps[]> => {
@@ -250,7 +250,7 @@ const GroupHelpers = {
250
250
  competitions.map(c => data.push({ id:c.competition_id, type: 'competition', scheduled_datetime: moment(c.scheduled_datetime) }));
251
251
  bracket_competitions.map(bc => data.push({ id: bc.bracket_competition_id, type: 'bracket', scheduled_datetime: moment(bc.scheduled_datetime) }));
252
252
  squares_competitions.map(sc => data.push({ id: sc.sq_comp_id, type: 'squares', scheduled_datetime: moment(sc.begin_datetime) }));
253
- poll_campaigns.map(pc => data.push({ id: pc.poll_campaign_id, type: 'poll_campaign', scheduled_datetime: moment(pc.create_datetime) }));
253
+ poll_campaigns.filter(pc => pc.market_type == 'FREE').map(pc => data.push({ id: pc.poll_campaign_id, type: 'poll_campaign', scheduled_datetime: moment(pc.create_datetime) }));
254
254
  return data.sort((a,b) => a.scheduled_datetime.unix() - b.scheduled_datetime.unix())
255
255
  },
256
256
  generateGroup: ():GroupProps => {
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { Button, Text, TextInput, View } from "../Components/Themed"
3
3
  import { GroupApi, GroupHelpers } from './api';
4
- import type { ArticleProps, CompetitionPayoutTypeProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps, EventProps, FocusPositionProps, GroupMessageProps, GroupPlayerProps, GroupProps, MyPlayerProps, NewOverallAnalytics, OrderAnalyticsProps, OrderProps, PollCampaignProps, PostProps, PublicPlayerProps, SquaresCompetitionProps, TextTagProps } from '../types';
4
+ import type { ArticleProps, CompetitionPayoutTypeProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps, EventProps, FocusPositionProps, GroupMessageProps, GroupPlayerProps, GroupProps, MyPlayerProps, NewOverallAnalytics, OrderAnalyticsProps, OrderProps, PollCampaignProps, PollProps, PostProps, PublicPlayerProps, SquaresCompetitionProps, TextTagProps } from '../types';
5
5
  import { ActivityIndicator, FlatList, Image } from 'react-native';
6
6
  import { Icons, Toggle } from '../Components';
7
7
  import { useColors } from '../constants/useColors';
@@ -22,6 +22,7 @@ type GroupComponentProps = {
22
22
  mode:'desktop'|'mobile',
23
23
  init_invite_code?:string,
24
24
  refresh_key:string,
25
+ onSelectFlashMarket:(poll:PollProps) => void,
25
26
  onViewComments?:(post_id:string, post_type:string) => void,
26
27
  onFocusPosition:(pos:FocusPositionProps) => void,
27
28
  onSelectChat?:(group:GroupProps) => void
@@ -64,16 +65,16 @@ type TimeOptionProps = {
64
65
  option:string,
65
66
  label:string
66
67
  }
67
- const sections = ['header','chat','toggle','me', 'competition_toggle', 'new_competition', 'members', 'competitions', 'activity']
68
+ const sections = ['header','chat','flash','toggle','me', 'competition_toggle', 'new_competition', 'members', 'competitions', 'activity']
68
69
  const member_stat_options:{ stat_key:string, label:string, multiplier:number, prefix?:string, suffix?:string }[] = [
69
70
  { stat_key: 'roi_pct', label: 'ROI Percent', multiplier:100, suffix: '%' },
70
- { stat_key: 'winnings', label: 'Winnings', multiplier:1 , prefix: '$'},
71
+ //{ stat_key: 'winnings', label: 'Winnings', multiplier:1 , prefix: '$'},
71
72
  { stat_key: 'win_pct', label: 'Win Percent', multiplier: 100, suffix: '%' },
72
- { stat_key: 'fulfilled_positions', label: 'Matched Bets', multiplier:1, suffix: ' Bets' },
73
- { stat_key: 'original_stake', label: 'Betting Volume', multiplier: 1, prefix: '$' }
73
+ //{ stat_key: 'fulfilled_positions', label: 'Matched Bets', multiplier:1, suffix: ' Bets' },
74
+ //{ stat_key: 'original_stake', label: 'Betting Volume', multiplier: 1, prefix: '$' }
74
75
  ]
75
76
 
76
- const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code, onViewComments, onCopyOrder, onFadeOrder, onSelectArticle, onSelectImage, onSelectTag, onCreateEngagement, onRequestAuthenticate, onFocusPosition, onShareGroup, onInvitePlayer, onSelectCompetition, onSelectChat, onSelectPlayer, onNudgePlayer, onSelectPollCampaign, onSelectSquaresCompetition } : GroupComponentProps) => {
77
+ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code, onViewComments, onCopyOrder,onSelectFlashMarket, onFadeOrder, onSelectArticle, onSelectImage, onSelectTag, onCreateEngagement, onRequestAuthenticate, onFocusPosition, onShareGroup, onInvitePlayer, onSelectCompetition, onSelectChat, onSelectPlayer, onNudgePlayer, onSelectPollCampaign, onSelectSquaresCompetition } : GroupComponentProps) => {
77
78
  const Colors = useColors();
78
79
  const leader_options:TimeOptionProps[] = [
79
80
  { to: moment().subtract(1, 'days').unix(), from: moment().unix(), option: '24_hours', label: '24 Hours' },
@@ -93,6 +94,16 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
93
94
  orders:[],
94
95
  offset:0
95
96
  });
97
+ const [ flash_data, setFlashData ] = useState<{
98
+ expanded?:boolean,
99
+ flash_campaigns:PollCampaignProps[],
100
+ flash_markets:PollProps[]
101
+ }>({
102
+ flash_campaigns: [],
103
+ expanded:false,
104
+ flash_markets: []
105
+ });
106
+ const { expanded, flash_campaigns, flash_markets } = flash_data;
96
107
  const [ comp_data, setCompData ] = useState<{
97
108
  loading:boolean,
98
109
  toggle: 'upcoming'|'history',
@@ -152,7 +163,6 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
152
163
  const admin = player?.player_id == group?.group_admin ? true : false;
153
164
  const { sorted_players, player_analytics } = GroupHelpers.sortMembers(group_players, order_analytics, active_stat?.stat_key);
154
165
  const sorted_engagements = GroupHelpers.sortCompetitionAction([], comp_data.active_competitions, [], comp_data.squares_competitions, comp_data.poll_campaigns);
155
-
156
166
  useEffect(() => {
157
167
  getGroupData(group_id);
158
168
  },[group_id, refresh_key]);
@@ -197,7 +207,8 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
197
207
  let server_events:EventProps[] = []
198
208
  if(type == 'upcoming'){
199
209
  resp = await GroupApi.getActiveCompetitions(group_id);
200
- server_polls = await GroupApi.getActivePolls(group_id);
210
+ let flash_resp = await GroupApi.getActivePolls(group_id);
211
+ server_polls = flash_resp.poll_campaigns.filter(pc => pc.market_type == 'FREE');
201
212
  server_sq = await GroupApi.getActiveSquares(group_id);
202
213
  let event_ids = server_sq.map(sq => sq.event_id);
203
214
  server_events = await GroupApi.getEventsByIds(event_ids);
@@ -213,7 +224,7 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
213
224
  ...comp_data,
214
225
  loading:false,
215
226
  toggle: type,
216
- poll_campaigns: server_polls,
227
+ poll_campaigns: server_polls.filter(p => p.market_type == 'FREE'),
217
228
  squares_competitions: server_sq,
218
229
  events: server_events,
219
230
  competition_players: resp.competition_players,
@@ -249,6 +260,10 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
249
260
  let player_ids = [ ...new Set(g_data.group_players.map(p => p.player_id).concat(g_data.group_messages.map(m => m.player_id)))]
250
261
  let plyers = await GroupApi.getPlayersByIds(player_ids);
251
262
  let my_gp = g_data.my_group_player && g_data.my_group_player.status == 'inactive' ? undefined : g_data.my_group_player
263
+
264
+ let server_flash = await GroupApi.getActivePolls(group_id);
265
+ setFlashData({ flash_campaigns: server_flash.poll_campaigns, flash_markets: server_flash.polls.filter(p => p.status != 'pending') });
266
+
252
267
  setGroupData({
253
268
  ...group_data,
254
269
  loading: false,
@@ -260,6 +275,8 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
260
275
  group_players: g_data.group_players,
261
276
  my_group_player: my_gp
262
277
  });
278
+
279
+
263
280
  }
264
281
 
265
282
  const renderPlayers = (data:{ item:GroupPlayerProps, index:number }) => {
@@ -374,6 +391,32 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
374
391
  )
375
392
  }
376
393
 
394
+ const renderFlash = (data: { item: PollProps, index:number }) => {
395
+ return (
396
+ <View transparent style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
397
+ {data.item.poll_image?.url ?
398
+ <Image
399
+ source={{ uri: data.item.poll_image.url }}
400
+ style={{ height:30, width: 30 }}
401
+ resizeMode='contain'
402
+ />
403
+ :
404
+ <Icons.FlameIcon size={30} color={Colors.text.error} />
405
+ }
406
+ <View transparent style={{ flex:1, marginLeft:10 }}>
407
+ <Text theme='h1'>{data.item.poll_question}</Text>
408
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.status.toUpperCase()}</Text>
409
+ </View>
410
+ <Button
411
+ style={{ padding:10, marginLeft:5 }}
412
+ type={data.item.status == 'active' ? 'success' : 'action'}
413
+ title={data.item.status == 'active' ? 'BUY' : 'VIEW'}
414
+ onPress={() => onSelectFlashMarket(data.item)}
415
+ />
416
+ </View>
417
+ )
418
+ }
419
+
377
420
  const renderEngagements = (data: { item:{id:string, type:string, scheduled_datetime:any}, index: number }) => {
378
421
  switch (data.item.type){
379
422
  case 'competition':
@@ -501,6 +544,36 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
501
544
  />
502
545
  </View>
503
546
  )
547
+ case 'flash':
548
+ if(flash_campaigns.length == 0){ return <></> }
549
+ return (
550
+ <View float style={{ margin:10 }}>
551
+ <Button style={{ backgroundColor:Colors.views.header, flexDirection:'row', alignItems:'center', padding:10, borderBottomLeftRadius:expanded?0:8, borderBottomRightRadius:expanded?0:8 }} onPress={() => setFlashData({ ...flash_data, expanded: !expanded })}>
552
+ <Icons.FlameIcon size={35} color={Colors.text.error} />
553
+ <View transparent style={{ flex:1, marginLeft:10 }}>
554
+ <Text theme='h1'>Flash Markets Available!</Text>
555
+ <Text theme='description' style={{ marginTop:3 }}>Press here to see all flash markets for this group</Text>
556
+ </View>
557
+ <View float style={{ borderRadius:100, height:25, width:25, justifyContent:'center', alignItems:'center' }}>
558
+ <Text theme='h1'>{flash_markets.length}</Text>
559
+ </View>
560
+ </Button>
561
+ {expanded ?
562
+ <View transparent>
563
+ <FlatList
564
+ data={flash_markets.sort((a,b) => {
565
+ let a_status = a.status == 'active' ? 2 : a.status == 'paused' ? 1 : 0
566
+ let b_status = b.status == 'active' ? 2 : b.status == 'paused' ? 1 : 0
567
+ return b_status - a_status || moment(a.end_datetime).unix() - moment(b.end_datetime).unix()
568
+ })}
569
+ renderItem={renderFlash}
570
+ key={'flash_markets_group'}
571
+ keyExtractor={item => item.poll_campaign_id.toString()}
572
+ />
573
+ </View>
574
+ :<></>}
575
+ </View>
576
+ )
504
577
  case 'new_competition':
505
578
  if(active_toggle != 'competitions' || !group){ return <></> }
506
579
  if(!onCreateEngagement){ return <></> }
@@ -703,6 +776,8 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
703
776
  <FlatList
704
777
  data={sections}
705
778
  key={'group_list'}
779
+ refreshing={loading}
780
+ onRefresh={() => getGroupData(group_id)}
706
781
  keyExtractor={item => item}
707
782
  renderItem={renderSections}
708
783
  />
@@ -147,9 +147,7 @@ const PollApi = {
147
147
  return resp.data.polls
148
148
  },
149
149
  getPollById : async(poll_id:string):Promise<{ poll:PollProps, poll_options:PollOptionProps[], poll_summaries: PollSummaryProps[] }> => {
150
- console.log('getting data')
151
150
  const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/poll/${poll_id}`)
152
-
153
151
  const { poll, poll_options, poll_summaries } = resp.data;
154
152
  return { poll, poll_options, poll_summaries }
155
153
  }
@@ -44,6 +44,7 @@ export const useColors = (props?:UseColorProps) => {
44
44
  success: Colors.utility.success,
45
45
  action: Colors.brand.electric,
46
46
  error: Colors.utility.error,
47
+ warning: Colors.utility.warning,
47
48
  close: Colors.shades.white,
48
49
  info: Colors.shades.white,
49
50
  squares: Colors.highlights.highlight100,
@@ -125,6 +126,7 @@ export const useColors = (props?:UseColorProps) => {
125
126
  success: Colors.brand.successDark, // **(NEW)** #395B4A
126
127
  action: Colors.brand.electricLight,
127
128
  error: Colors.brand.errorDark, // **(NEW)** #5A2A2A
129
+ warning: Colors.utility.warning,
128
130
  close: Colors.shades.black, // #111111
129
131
  info: Colors.shades.black, // #111111,
130
132
  squares: Colors.highlights.highlight100Faded, // rgba(98, 10, 255, 0.4)
package/src/index.tsx CHANGED
@@ -62,6 +62,7 @@ import CreateGroupWizard from './Group/components/CreateGroupWizard';
62
62
  import CreateEngagement from './CreateEngagement';
63
63
  import SquaresManager from './SquaresManager';
64
64
  import DiscordConnectionManager from './Discord';
65
+ import ManageFlashMarket from './FlashMarket/components/ManageFlashMarket';
65
66
  export {
66
67
  Authenticator,
67
68
  Observer,
@@ -69,6 +70,7 @@ export {
69
70
  DiscordConnectionManager,
70
71
  BEEventApi,
71
72
  RankingsCard,
73
+ ManageFlashMarket,
72
74
  BELinkApi,
73
75
  SquaresManager,
74
76
  GuideView,
package/src/types.d.ts CHANGED
@@ -929,6 +929,7 @@ export interface PollCampaignProps {
929
929
  name: string,
930
930
  player_id:string,
931
931
  company_id?:string,
932
+ group_id?:string,
932
933
  admins:string[],
933
934
  phone:string,
934
935
  market_type:'FREE'|'FOR_MONEY',
@@ -1001,9 +1002,11 @@ export interface PollProps {
1001
1002
  market_type:'FOR_MONEY'|'FREE',
1002
1003
  status:string,
1003
1004
  minimum_pool?:number,
1005
+ admins?:string[],
1004
1006
  stake_increase_allowed?:boolean,
1005
1007
  multi_responses_allowed?:boolean,
1006
1008
  poll_open_time?:any,
1009
+ base_stake:number,
1007
1010
  coupon_campaign_id?:string,
1008
1011
  coupon_payout_type?:any,
1009
1012
  flash_active?:boolean,
@@ -1046,6 +1049,8 @@ export interface PollSummaryProps {
1046
1049
  poll_option_id:string,
1047
1050
  count:number,
1048
1051
  stake:number,
1052
+ winnings:number,
1053
+ player_ids:[],
1049
1054
  pct:number
1050
1055
  }
1051
1056
 
@@ -1054,9 +1059,11 @@ export interface PollOptionProps {
1054
1059
  poll_id:string,
1055
1060
  option_type: 'select'|'input',
1056
1061
  option_name: string,
1062
+ probability_locked?:boolean,
1057
1063
  option_value:string,
1058
1064
  input_type?:string,
1059
- input_result:number,
1065
+ input_result?:number,
1066
+ initial_odds?: number,
1060
1067
  priority:number,
1061
1068
  status:string,
1062
1069
  result_ind?:'win'|'lose'|'draw'