be-components 7.4.0 → 7.4.2

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 (149) hide show
  1. package/lib/commonjs/CreateEngagement/index.js +3 -0
  2. package/lib/commonjs/CreateEngagement/index.js.map +1 -1
  3. package/lib/commonjs/FlashMarket/api/index.js +61 -0
  4. package/lib/commonjs/FlashMarket/api/index.js.map +1 -1
  5. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js +55 -81
  6. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js.map +1 -1
  7. package/lib/commonjs/MyAction/api/index.js +580 -0
  8. package/lib/commonjs/MyAction/api/index.js.map +1 -0
  9. package/lib/commonjs/MyAction/components/BracketRow.js +67 -0
  10. package/lib/commonjs/MyAction/components/BracketRow.js.map +1 -0
  11. package/lib/commonjs/MyAction/components/CompetitionRow.js +68 -0
  12. package/lib/commonjs/MyAction/components/CompetitionRow.js.map +1 -0
  13. package/lib/commonjs/MyAction/components/ContestStatRow.js +265 -0
  14. package/lib/commonjs/MyAction/components/ContestStatRow.js.map +1 -0
  15. package/lib/commonjs/MyAction/components/FlashRow.js +131 -0
  16. package/lib/commonjs/MyAction/components/FlashRow.js.map +1 -0
  17. package/lib/commonjs/MyAction/components/ParlayRow.js +236 -0
  18. package/lib/commonjs/MyAction/components/ParlayRow.js.map +1 -0
  19. package/lib/commonjs/MyAction/components/SquaresRow.js +83 -0
  20. package/lib/commonjs/MyAction/components/SquaresRow.js.map +1 -0
  21. package/lib/commonjs/MyAction/index.js +354 -0
  22. package/lib/commonjs/MyAction/index.js.map +1 -0
  23. package/lib/commonjs/PartnerPortal/components/EmbedManager.js +42 -0
  24. package/lib/commonjs/PartnerPortal/components/EmbedManager.js.map +1 -1
  25. package/lib/commonjs/PartnerPortal/components/StringSelector.js +90 -0
  26. package/lib/commonjs/PartnerPortal/components/StringSelector.js.map +1 -0
  27. package/lib/commonjs/index.js +7 -0
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/types.d.js.map +1 -1
  30. package/lib/module/CreateEngagement/index.js +3 -0
  31. package/lib/module/CreateEngagement/index.js.map +1 -1
  32. package/lib/module/FlashMarket/api/index.js +61 -0
  33. package/lib/module/FlashMarket/api/index.js.map +1 -1
  34. package/lib/module/FlashMarket/components/ManageFlashMarket.js +55 -81
  35. package/lib/module/FlashMarket/components/ManageFlashMarket.js.map +1 -1
  36. package/lib/module/MyAction/api/index.js +573 -0
  37. package/lib/module/MyAction/api/index.js.map +1 -0
  38. package/lib/module/MyAction/components/BracketRow.js +60 -0
  39. package/lib/module/MyAction/components/BracketRow.js.map +1 -0
  40. package/lib/module/MyAction/components/CompetitionRow.js +61 -0
  41. package/lib/module/MyAction/components/CompetitionRow.js.map +1 -0
  42. package/lib/module/MyAction/components/ContestStatRow.js +258 -0
  43. package/lib/module/MyAction/components/ContestStatRow.js.map +1 -0
  44. package/lib/module/MyAction/components/FlashRow.js +124 -0
  45. package/lib/module/MyAction/components/FlashRow.js.map +1 -0
  46. package/lib/module/MyAction/components/ParlayRow.js +229 -0
  47. package/lib/module/MyAction/components/ParlayRow.js.map +1 -0
  48. package/lib/module/MyAction/components/SquaresRow.js +76 -0
  49. package/lib/module/MyAction/components/SquaresRow.js.map +1 -0
  50. package/lib/module/MyAction/index.js +344 -0
  51. package/lib/module/MyAction/index.js.map +1 -0
  52. package/lib/module/PartnerPortal/components/EmbedManager.js +42 -0
  53. package/lib/module/PartnerPortal/components/EmbedManager.js.map +1 -1
  54. package/lib/module/PartnerPortal/components/StringSelector.js +83 -0
  55. package/lib/module/PartnerPortal/components/StringSelector.js.map +1 -0
  56. package/lib/module/index.js +2 -1
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/module/types.d.js.map +1 -1
  59. package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
  60. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts +1 -0
  61. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts.map +1 -1
  62. package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  63. package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts +110 -0
  64. package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts.map +1 -0
  65. package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts +8 -0
  66. package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts.map +1 -0
  67. package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts +9 -0
  68. package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts.map +1 -0
  69. package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts +15 -0
  70. package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts.map +1 -0
  71. package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts +10 -0
  72. package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts.map +1 -0
  73. package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts +15 -0
  74. package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts.map +1 -0
  75. package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts +8 -0
  76. package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts.map +1 -0
  77. package/lib/typescript/lib/commonjs/MyAction/index.d.ts +7 -0
  78. package/lib/typescript/lib/commonjs/MyAction/index.d.ts.map +1 -0
  79. package/lib/typescript/lib/commonjs/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  80. package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts +8 -0
  81. package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  82. package/lib/typescript/lib/commonjs/index.d.ts +1 -0
  83. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  84. package/lib/typescript/lib/module/CreateEngagement/index.d.ts.map +1 -1
  85. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts +1 -0
  86. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts.map +1 -1
  87. package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  88. package/lib/typescript/lib/module/MyAction/api/index.d.ts +110 -0
  89. package/lib/typescript/lib/module/MyAction/api/index.d.ts.map +1 -0
  90. package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts +8 -0
  91. package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts.map +1 -0
  92. package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts +9 -0
  93. package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts.map +1 -0
  94. package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts +15 -0
  95. package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts.map +1 -0
  96. package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts +10 -0
  97. package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts.map +1 -0
  98. package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts +15 -0
  99. package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts.map +1 -0
  100. package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts +8 -0
  101. package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts.map +1 -0
  102. package/lib/typescript/lib/module/MyAction/index.d.ts +7 -0
  103. package/lib/typescript/lib/module/MyAction/index.d.ts.map +1 -0
  104. package/lib/typescript/lib/module/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  105. package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts +8 -0
  106. package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  107. package/lib/typescript/lib/module/index.d.ts +2 -1
  108. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  109. package/lib/typescript/src/CreateEngagement/index.d.ts.map +1 -1
  110. package/lib/typescript/src/FlashMarket/api/index.d.ts +1 -0
  111. package/lib/typescript/src/FlashMarket/api/index.d.ts.map +1 -1
  112. package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  113. package/lib/typescript/src/MyAction/api/index.d.ts +103 -0
  114. package/lib/typescript/src/MyAction/api/index.d.ts.map +1 -0
  115. package/lib/typescript/src/MyAction/components/BracketRow.d.ts +10 -0
  116. package/lib/typescript/src/MyAction/components/BracketRow.d.ts.map +1 -0
  117. package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts +15 -0
  118. package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts.map +1 -0
  119. package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts +18 -0
  120. package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts.map +1 -0
  121. package/lib/typescript/src/MyAction/components/FlashRow.d.ts +12 -0
  122. package/lib/typescript/src/MyAction/components/FlashRow.d.ts.map +1 -0
  123. package/lib/typescript/src/MyAction/components/ParlayRow.d.ts +18 -0
  124. package/lib/typescript/src/MyAction/components/ParlayRow.d.ts.map +1 -0
  125. package/lib/typescript/src/MyAction/components/SquaresRow.d.ts +10 -0
  126. package/lib/typescript/src/MyAction/components/SquaresRow.d.ts.map +1 -0
  127. package/lib/typescript/src/MyAction/index.d.ts +14 -0
  128. package/lib/typescript/src/MyAction/index.d.ts.map +1 -0
  129. package/lib/typescript/src/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  130. package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts +10 -0
  131. package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  132. package/lib/typescript/src/index.d.ts +2 -1
  133. package/lib/typescript/src/index.d.ts.map +1 -1
  134. package/package.json +3 -3
  135. package/src/CreateEngagement/index.tsx +4 -1
  136. package/src/FlashMarket/api/index.ts +72 -0
  137. package/src/FlashMarket/components/ManageFlashMarket.tsx +10 -0
  138. package/src/MyAction/api/index.ts +393 -0
  139. package/src/MyAction/components/BracketRow.tsx +34 -0
  140. package/src/MyAction/components/CompetitionRow.tsx +39 -0
  141. package/src/MyAction/components/ContestStatRow.tsx +153 -0
  142. package/src/MyAction/components/FlashRow.tsx +74 -0
  143. package/src/MyAction/components/ParlayRow.tsx +137 -0
  144. package/src/MyAction/components/SquaresRow.tsx +55 -0
  145. package/src/MyAction/index.tsx +316 -0
  146. package/src/PartnerPortal/components/EmbedManager.tsx +20 -0
  147. package/src/PartnerPortal/components/StringSelector.tsx +55 -0
  148. package/src/index.tsx +2 -0
  149. package/src/types.d.ts +12 -0
@@ -0,0 +1,316 @@
1
+ /**
2
+ * My Action Components
3
+ * This is responsible for viewing all of your action in one spot
4
+ * @returns
5
+ */
6
+ import React, { useEffect, useState } from 'react';
7
+ import { Text, View } from "../Components/Themed"
8
+ import { FlatList } from 'react-native';
9
+ import type { ActionListProps, AthleteProps, BracketCompetitionProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps, EventProps, LeagueProps, MatchProps, MyPlayerProps, OrderProps, ParlayPositionProps, ParlayProps, PollOptionProps, PollProps, PollResponseProps, SquaresCompetitionProps, TeamProps, TournamentProps } from '../types';
10
+ import { MyActionApi, MyActionHelpers } from './api';
11
+ //import { useColors } from '../constants/useColors';
12
+ import ContestStatRow from './components/ContestStatRow';
13
+ import ParlayRow from './components/ParlayRow';
14
+ import FlashRow from './components/FlashRow';
15
+ import SquaresRow from './components/SquaresRow';
16
+ import CompetitionRow from './components/CompetitionRow';
17
+ import BracketRow from './components/BracketRow';
18
+
19
+ type MyActionProps = {
20
+ me:MyPlayerProps,
21
+ market_type:'FOR_MONEY'|'FREE'
22
+ }
23
+
24
+
25
+ const sections = [ 'header', 'action' ]
26
+ const MyAction = ({ me, market_type }:MyActionProps) => {
27
+ //const Colors = useColors();
28
+ const [ size, setSize ] = useState({ width:0, height:0 });
29
+ const [ contest_state, setContestState ] = useState<{
30
+ loading:boolean,
31
+ leagues:LeagueProps[],
32
+ events:EventProps[],
33
+ tournaments:TournamentProps[],
34
+ matches:MatchProps[],
35
+ athletes:AthleteProps[],
36
+ teams:TeamProps[]
37
+ }>({
38
+ loading:false,
39
+ events:[],
40
+ matches:[],
41
+ leagues:[],
42
+ tournaments:[],
43
+ athletes: [],
44
+ teams:[]
45
+ });
46
+ const { events, tournaments, matches, teams, athletes, leagues } = contest_state;
47
+ const [ engagement_state, setEngagementState ] = useState<{
48
+ loading:boolean,
49
+ competitions:CompetitionProps[],
50
+ competition_players:CompetitionPlayerProps[],
51
+ competition_records:CompetitionRecordProps[],
52
+ competition_results:CompetitionResultProps[],
53
+ competition_types:CompetitionTypeProps[],
54
+ competition_result_types:CompetitionResultTypeProps[],
55
+ squares_competitions:SquaresCompetitionProps[],
56
+ bracket_competitions:BracketCompetitionProps[]
57
+ }>({
58
+ loading:false,
59
+ competitions:[],
60
+ competition_players:[],
61
+ competition_result_types:[],
62
+ competition_results:[],
63
+ competition_records:[],
64
+ competition_types:[],
65
+ squares_competitions:[],
66
+ bracket_competitions:[]
67
+ });
68
+ const { competition_players, competition_records, competition_result_types, competition_results, competition_types, competitions, squares_competitions, bracket_competitions } = engagement_state;
69
+ const [ active_flash_state, setActiveFlashState ] = useState<{
70
+ loading:boolean,
71
+ poll_responses:PollResponseProps[],
72
+ polls:PollProps[],
73
+ poll_options:PollOptionProps[],
74
+ }>({
75
+ loading: false,
76
+ poll_options:[],
77
+ poll_responses:[],
78
+ polls:[],
79
+ });
80
+ const { polls, poll_options, poll_responses } = active_flash_state;
81
+
82
+ const [ active_order_state, setActiveOrderState ] = useState<{
83
+ loading:boolean,
84
+ orders:OrderProps[],
85
+ parlays:ParlayProps[],
86
+ parlay_positions:ParlayPositionProps[],
87
+ parlay_orders:OrderProps[]
88
+ }>({
89
+ loading:false,
90
+ orders: [],
91
+ parlays:[],
92
+ parlay_positions:[],
93
+ parlay_orders:[]
94
+ });
95
+ const { orders, parlays, parlay_orders, parlay_positions } = active_order_state;
96
+
97
+ const action_list = MyActionHelpers.sortAction(orders, parlays, parlay_orders, polls, competitions, squares_competitions, bracket_competitions);
98
+ //const stats = MyActionHelpers.getActionStats(orders, parlays, parlay_positions, competitions, squares_competitions, bracket_competitions)
99
+
100
+ useEffect(() => {
101
+ if(!me){ return }
102
+ MyActionApi.setEnvironment();
103
+ getActiveOrderData();
104
+ getActiveFlashData();
105
+ getActiveEngagements();
106
+ },[me]);
107
+
108
+ const getActiveEngagements = async() => {
109
+ setEngagementState({ ...engagement_state, loading:true });
110
+ const options = await MyActionApi.EngagementApi.getCompetitionOptions();
111
+ const c_resp = await MyActionApi.EngagementApi.getMyActiveCompetitions();
112
+ const s_resp = await MyActionApi.EngagementApi.getMyActiveSquaresCompetitions();
113
+ const b_resp = await MyActionApi.EngagementApi.getMyActiveBracketCompetitions();
114
+ setEngagementState({
115
+ ...engagement_state,
116
+ loading:false,
117
+ competition_types: options.competition_types,
118
+ competition_result_types: options.competition_result_types,
119
+ competitions: c_resp.competitions,
120
+ competition_players: c_resp.competition_players,
121
+ competition_records: c_resp.competition_records,
122
+ competition_results: c_resp.competition_results,
123
+ squares_competitions: s_resp.squares_competitions,
124
+ bracket_competitions: b_resp.bracket_competitions
125
+ });
126
+ }
127
+
128
+ const getActiveFlashData = async() => {
129
+ setActiveFlashState({ ...active_flash_state, loading:true });
130
+ const sfa = await MyActionApi.FlashApi.getMyFlashAction();
131
+ setActiveFlashState({
132
+ ...active_flash_state,
133
+ polls: sfa.polls,
134
+ poll_responses: sfa.poll_responses,
135
+ poll_options: sfa.poll_options,
136
+ loading:false
137
+ })
138
+ }
139
+
140
+ const getActiveOrderData = async() => {
141
+ setActiveOrderState({ ...active_order_state, loading:true });
142
+ const soa = await MyActionApi.OrderApi.getMyAction();
143
+ setActiveOrderState({
144
+ ...active_order_state,
145
+ orders: soa.orders,
146
+ parlays: soa.parlays,
147
+ parlay_orders: soa.parlay_orders,
148
+ parlay_positions: soa.parlay_positions,
149
+ loading:false
150
+ });
151
+ getContestData(soa.orders.concat(soa.parlay_orders))
152
+ }
153
+
154
+ const getContestData = async(orders:OrderProps[]) => {
155
+ setContestState({ ...contest_state, loading:true });
156
+ const { event_ids, tournament_ids, match_ids, athlete_ids, team_ids } = MyActionHelpers.getContestsFromOrders(orders);
157
+ const s_contests = await MyActionHelpers.getContestsByIds(event_ids, tournament_ids, match_ids, athlete_ids, team_ids);
158
+ const s_leagues = await MyActionApi.ContestApi.getLeagues();
159
+ setContestState({
160
+ ...contest_state,
161
+ leagues: s_leagues,
162
+ events: s_contests.events,
163
+ tournaments: s_contests.tournaments,
164
+ matches: s_contests.matches,
165
+ athletes: s_contests.athletes,
166
+ teams: s_contests.teams,
167
+ loading:false
168
+ })
169
+ }
170
+
171
+ const renderAction = (data:{ item:ActionListProps, index:number }) => {
172
+ switch(data.item.type){
173
+ case 'contest':
174
+ if(!data.item.contest_type){ return <></> }
175
+ const event = events.find(e => data.item.contest_type == 'team' && e.event_id == data.item.id);
176
+ const tournament = tournaments.find(t => data.item.contest_type == 'tournament' && t.tournament_id == data.item.id);
177
+ const match = matches.find(m => data.item.contest_type == 'match' && m.match_id == data.item.id);
178
+ const { contest_title, scheduled_datetime } = MyActionHelpers.getContestDetails(data.item.contest_type, event, tournament, match);
179
+ return (
180
+ <ContestStatRow
181
+ leagues={leagues}
182
+ events={events}
183
+ tournaments={tournaments}
184
+ matches={matches}
185
+ teams={teams}
186
+ athletes={athletes}
187
+ market_type={market_type}
188
+ width={size.width}
189
+ contest_label={contest_title}
190
+ time_detail={scheduled_datetime.format('MMM DD YYYY @ hh:mm a')}
191
+ orders={data.item.orders}
192
+ />
193
+ )
194
+ case 'parlay':
195
+ const parlay = parlays.find(p => p.parlay_id == data.item.id);
196
+ const p_orders = parlay_orders.filter(po => po.parlay_id == data.item.id);
197
+ const p_positions = parlay_positions.filter(pp => pp.parlay_id == data.item.id);
198
+ if(!parlay){ return <></> }
199
+ return (
200
+ <ParlayRow
201
+ parlay={parlay}
202
+ leagues={leagues}
203
+ events={events}
204
+ tournaments={tournaments}
205
+ matches={matches}
206
+ athletes={athletes}
207
+ teams={teams}
208
+ parlay_orders={p_orders}
209
+ parlay_positions={p_positions}
210
+ market_type={market_type}
211
+ width={size.width}
212
+ />
213
+ )
214
+ case 'flash':
215
+ const poll = polls.find(p => p.poll_id == data.item.id);
216
+ if(!poll){ return <></> }
217
+ let responses = poll_responses.filter(pr => pr.poll_id == data.item.id);
218
+ let options = poll_options.filter(po => po.poll_id == data.item.id);
219
+ return (
220
+ <FlashRow
221
+ poll={poll}
222
+ poll_options={options}
223
+ poll_responses={responses}
224
+ market_type={market_type}
225
+ width={size.width}
226
+ />
227
+ )
228
+ case 'squares':
229
+ const squares_competition = squares_competitions.find(sc => sc.sq_comp_id == data.item.id);
230
+ if(!squares_competition){ return <></> }
231
+ return (
232
+ <SquaresRow
233
+ squares_competition={squares_competition}
234
+ market_type={market_type}
235
+ width={size.width}
236
+ />
237
+ )
238
+ case 'competition':
239
+ const competition = competitions.find(c => c.competition_id == data.item.id);
240
+ if(!competition){ return <></> }
241
+ const competition_type = competition_types.find(ct => ct.competition_type_id == competition.competition_type_id);
242
+ const competition_result_type = competition_result_types.find(crt => crt.competition_result_type_id == competition.competition_result_type_id);
243
+ const competition_player = competition_players.find(cp => cp.competition_id == data.item.id);
244
+ const competition_record = competition_records.find(cr => cr.competition_id == data.item.id);
245
+ const competition_result = competition_results.find(cr => cr.competition_id == data.item.id);
246
+ if(!competition_result_type || !competition_type ||!competition_player || !competition_record || !competition_result){ return <></> }
247
+ return (
248
+ <CompetitionRow
249
+ competition={competition}
250
+ competition_player={competition_player}
251
+ competition_record={competition_record}
252
+ competition_result={competition_result}
253
+ competition_result_type={competition_result_type}
254
+ competition_type={competition_type}
255
+ market_type={market_type}
256
+ width={size.width}
257
+ />
258
+ )
259
+ case 'bracket':
260
+ const bracket_competition = bracket_competitions.find(bc => bc.bracket_competition_id == data.item.id);
261
+ if(!bracket_competition){ return <></> }
262
+ return (
263
+ <BracketRow
264
+ bracket_competition={bracket_competition}
265
+ width={size.width}
266
+ market_type={market_type}
267
+ />
268
+ )
269
+ default: return <></>
270
+ }
271
+ }
272
+
273
+ const renderSections = (data:{ item:string, index:number }) => {
274
+ switch(data.item){
275
+ case 'header':
276
+ return (
277
+ <></>
278
+ )
279
+ case 'action':
280
+ return (
281
+ <View>
282
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
283
+ <View transparent style={{ flex:1 }}>
284
+ <Text theme='h1'>My Action</Text>
285
+ <Text theme='description' style={{ marginTop:3 }}>Action List</Text>
286
+ </View>
287
+ </View>
288
+ <FlatList
289
+ data={action_list}
290
+ key={'action_list'}
291
+ keyExtractor={(item) => item.id.toString()}
292
+ renderItem={renderAction}
293
+ />
294
+ </View>
295
+ )
296
+ default: return <></>
297
+ }
298
+ }
299
+
300
+
301
+ return (
302
+ <View transparent style={{ flex:1 }} onLayout={(ev) => {
303
+ const { width, height } = ev.nativeEvent.layout
304
+ setSize({ width, height });
305
+ }}>
306
+ <FlatList
307
+ data={sections}
308
+ key={'action_sections'}
309
+ keyExtractor={item => item}
310
+ renderItem={renderSections}
311
+ />
312
+ </View>
313
+ )
314
+ }
315
+
316
+ export default MyAction
@@ -12,6 +12,7 @@ import CompetitionSelector from './CompetitionSelector';
12
12
  import SquaresSelector from './SquaresSelector';
13
13
  import FlashSelector from './FlashSelector';
14
14
  import FlashMarketSelector from './FlashMarketSelector';
15
+ import StringSelector from './StringSelector';
15
16
 
16
17
  type EmbedManagerProps = {
17
18
  company_embed_id:string,
@@ -163,6 +164,25 @@ const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition
163
164
  />
164
165
  </View>
165
166
  )
167
+ case 'string_selector':
168
+ if(!data.item.options){ return <></> }
169
+ return (
170
+ <View transparent style={{ borderBottomWidth:1, borderColor:Colors.borders.light, padding:10 }}>
171
+ <View transparent>
172
+ <Text theme='h1'>{data.item.label}</Text>
173
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.description}</Text>
174
+ </View>
175
+ <View transparent style={{ marginTop:10 }}>
176
+ <StringSelector
177
+ active_value={value}
178
+ options={data.item.options}
179
+ onSelectOption={(option) => {
180
+ setEmbedData({ ...embed_data, draft_company_embed: { ...draft_company_embed, properties: { ...draft_company_embed.properties, [data.item.property]: option?.value } } })
181
+ }}
182
+ />
183
+ </View>
184
+ </View>
185
+ )
166
186
  case 'switch':
167
187
  //Switch is going to be either a 1 or a 0. 0 is off
168
188
  const boolean_value = value && value == '1' ? true : false
@@ -0,0 +1,55 @@
1
+ import React, { useState } from "react";
2
+ import type { StringSelectorOptionProps } from "../../types";
3
+ import { useColors } from "../../constants/useColors";
4
+ import { Button, Text, View } from "../../Components/Themed";
5
+ import { FlatList } from "react-native";
6
+ import { Icons } from "../../Components";
7
+
8
+ type StringSelectorProps = {
9
+ active_value?:string,
10
+ options: StringSelectorOptionProps[],
11
+ onSelectOption:(option:StringSelectorOptionProps | undefined) => void
12
+ }
13
+ const StringSelector = ({ active_value, options, onSelectOption }:StringSelectorProps) => {
14
+ const Colors = useColors();
15
+ const [ visible, setVisible ] = useState(false);
16
+
17
+ const active_option = options.find(o => o.value == active_value);
18
+
19
+
20
+ const renderLeagues = (data:{ item:StringSelectorOptionProps, index:number }) => {
21
+ return (
22
+ <Button
23
+ transparent
24
+ style={{ flexDirection:'row', alignItems:'center', padding:10, borderRadius:0, borderBottomWidth:1, borderColor:Colors.borders.light }}
25
+ onPress={() => { setVisible(false); onSelectOption(data.item) }}
26
+ >
27
+ <View transparent style={{ flex:1, marginLeft:10 }}>
28
+ <Text theme='h1'>{data.item.label}</Text>
29
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.description}</Text>
30
+ </View>
31
+ </Button>
32
+ )
33
+ }
34
+
35
+ return (
36
+ <View style={{ padding:15 }} float>
37
+ <Button transparent style={{ padding:0, flexDirection:'row', alignItems:'center' }} onPress={() => { setVisible(!visible); onSelectOption(undefined)}}>
38
+ <Text style={{ flex:1, marginRight:10 }} theme='h1'>{active_option?.label ?? 'Select Option'}</Text>
39
+ <Icons.ChevronIcon direction={visible?'up':'down'} color={Colors.text.h1} size={8} />
40
+ </Button>
41
+ {visible ?
42
+ <View transparent style={{ marginTop:20 }}>
43
+ <FlatList
44
+ data={options.sort((a,b) => a.value.localeCompare(b.value))}
45
+ key={'string_option_selector'}
46
+ keyExtractor={item => item.value.toString()}
47
+ renderItem={renderLeagues}
48
+ />
49
+ </View>
50
+ :<></>}
51
+ </View>
52
+ )
53
+ }
54
+
55
+ export default StringSelector
package/src/index.tsx CHANGED
@@ -68,10 +68,12 @@ import EmbedManager from './PartnerPortal/components/EmbedManager';
68
68
  import CreateEmbed from './PartnerPortal/components/CreateEmbed';
69
69
  import ReferralCodeManager from './PartnerPortal/components/ReferralCodeManager';
70
70
  import FlashCampaignManager from './PartnerPortal/components/FlashCampaignManager';
71
+ import MyAction from './MyAction';
71
72
 
72
73
  export {
73
74
  Authenticator,
74
75
  Observer,
76
+ MyAction,
75
77
  CreateEmbed,
76
78
  ReferralCodeManager,
77
79
  CreateEngagement,
package/src/types.d.ts CHANGED
@@ -2596,6 +2596,17 @@ export interface ParlayPositionProps {
2596
2596
  last_update_datetime:any
2597
2597
  }
2598
2598
 
2599
+ export interface ActionListProps {
2600
+ id: string,
2601
+ type: 'contest'|'order'|'parlay'|'competition'|'squares'|'bracket'|'flash',
2602
+ contest_type?:'team'|'tournament'|'match',
2603
+ orders:OrderProps[],
2604
+ action_datetime:Moment
2605
+ }
2606
+
2607
+ export interface StringSelectorOptionProps {
2608
+ value:string, label:string, description:string
2609
+ }
2599
2610
 
2600
2611
  export interface OrderProps {
2601
2612
  order_id:string; //Primary key of the order
@@ -3125,6 +3136,7 @@ export interface EmbedPropertyProps {
3125
3136
  label:string,
3126
3137
  priority:number
3127
3138
  create_datetime: any,
3139
+ options?: StringSelectorOptionProps[],
3128
3140
  last_update_datetime:any
3129
3141
  }
3130
3142