be-components 5.8.0 → 5.8.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.
- package/lib/commonjs/Campaign/api/index.js +124 -0
- package/lib/commonjs/Campaign/api/index.js.map +1 -1
- package/lib/commonjs/Campaign/components/ActionList.js +46 -9
- package/lib/commonjs/Campaign/components/ActionList.js.map +1 -1
- package/lib/commonjs/Campaign/components/BetAlert.js +22 -10
- package/lib/commonjs/Campaign/components/BetAlert.js.map +1 -1
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js +142 -11
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js.map +1 -1
- package/lib/commonjs/Campaign/components/NewPlayerAlert.js +139 -0
- package/lib/commonjs/Campaign/components/NewPlayerAlert.js.map +1 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js +5 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js.map +1 -1
- package/lib/commonjs/Campaign/components/ParticipantsList.js +0 -1
- package/lib/commonjs/Campaign/components/ParticipantsList.js.map +1 -1
- package/lib/commonjs/Campaign/index.js +564 -222
- package/lib/commonjs/Campaign/index.js.map +1 -1
- package/lib/commonjs/FlashMarket/FlashHolder.js +29 -8
- package/lib/commonjs/FlashMarket/FlashHolder.js.map +1 -1
- package/lib/commonjs/FlashMarket/index.js +4 -4
- package/lib/commonjs/FlashMarket/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/api/index.js +21 -0
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/Ticker/index.js +112 -26
- package/lib/commonjs/Ticker/index.js.map +1 -1
- package/lib/module/Campaign/api/index.js +124 -0
- package/lib/module/Campaign/api/index.js.map +1 -1
- package/lib/module/Campaign/components/ActionList.js +46 -9
- package/lib/module/Campaign/components/ActionList.js.map +1 -1
- package/lib/module/Campaign/components/BetAlert.js +22 -10
- package/lib/module/Campaign/components/BetAlert.js.map +1 -1
- package/lib/module/Campaign/components/CampaignAnalytics.js +144 -13
- package/lib/module/Campaign/components/CampaignAnalytics.js.map +1 -1
- package/lib/module/Campaign/components/NewPlayerAlert.js +132 -0
- package/lib/module/Campaign/components/NewPlayerAlert.js.map +1 -0
- package/lib/module/Campaign/components/ParticipantCard.js +5 -0
- package/lib/module/Campaign/components/ParticipantCard.js.map +1 -1
- package/lib/module/Campaign/components/ParticipantsList.js +0 -1
- package/lib/module/Campaign/components/ParticipantsList.js.map +1 -1
- package/lib/module/Campaign/index.js +564 -222
- package/lib/module/Campaign/index.js.map +1 -1
- package/lib/module/FlashMarket/FlashHolder.js +29 -8
- package/lib/module/FlashMarket/FlashHolder.js.map +1 -1
- package/lib/module/FlashMarket/index.js +4 -4
- package/lib/module/FlashMarket/index.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +21 -0
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/Ticker/index.js +115 -29
- package/lib/module/Ticker/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts +11 -0
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts +4 -2
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/NewPlayerAlert.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Campaign/components/NewPlayerAlert.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantsList.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/index.d.ts +8 -5
- package/lib/typescript/lib/commonjs/Campaign/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Ticker/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Ticker/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/api/index.d.ts +11 -0
- package/lib/typescript/lib/module/Campaign/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts +4 -1
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts +3 -1
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts +4 -2
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/NewPlayerAlert.d.ts +10 -0
- package/lib/typescript/lib/module/Campaign/components/NewPlayerAlert.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts +3 -1
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/ParticipantsList.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/index.d.ts +8 -5
- package/lib/typescript/lib/module/Campaign/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Ticker/index.d.ts +2 -1
- package/lib/typescript/lib/module/Ticker/index.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/api/index.d.ts +21 -6
- package/lib/typescript/src/Campaign/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/ActionList.d.ts +5 -2
- package/lib/typescript/src/Campaign/components/ActionList.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts +4 -2
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts +6 -3
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/NewPlayerAlert.d.ts +12 -0
- package/lib/typescript/src/Campaign/components/NewPlayerAlert.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts +4 -2
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/index.d.ts +7 -4
- package/lib/typescript/src/Campaign/index.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +3 -2
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Ticker/index.d.ts +2 -1
- package/lib/typescript/src/Ticker/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Campaign/api/index.ts +86 -4
- package/src/Campaign/components/ActionList.tsx +38 -13
- package/src/Campaign/components/BetAlert.tsx +15 -6
- package/src/Campaign/components/CampaignAnalytics.tsx +76 -13
- package/src/Campaign/components/NewPlayerAlert.tsx +81 -0
- package/src/Campaign/components/ParticipantCard.tsx +7 -2
- package/src/Campaign/components/ParticipantsList.tsx +1 -1
- package/src/Campaign/index.tsx +421 -188
- package/src/FlashMarket/FlashHolder.tsx +17 -6
- package/src/FlashMarket/index.tsx +3 -1
- package/src/MarketComponents/api/index.ts +16 -2
- package/src/Ticker/index.tsx +64 -32
- package/src/types.d.ts +3 -0
|
@@ -4,46 +4,65 @@ import { Button, Text, View } from '../Components/Themed';
|
|
|
4
4
|
import { CampaignApi, CampaignHelpers } from '../Campaign/api';
|
|
5
5
|
import { MarketComponentApi } from '../MarketComponents/api';
|
|
6
6
|
import { useColors } from '../constants/useColors';
|
|
7
|
-
import moment from 'moment-mini';
|
|
8
7
|
import QRCode from 'react-qr-code';
|
|
9
8
|
import TickerApp from '../Ticker';
|
|
10
9
|
import BetAlert from './components/BetAlert';
|
|
11
10
|
import ParticipantsList from './components/ParticipantsList';
|
|
12
11
|
import ParticipantCard from './components/ParticipantCard';
|
|
13
12
|
import CampaignAnalytics from './components/CampaignAnalytics';
|
|
14
|
-
import
|
|
13
|
+
import SocketManager from '../Socket';
|
|
14
|
+
import NewPlayerAlert from './components/NewPlayerAlert';
|
|
15
|
+
import ActionList from './components/ActionList';
|
|
16
|
+
import { Icons, Toggle } from '../Components';
|
|
15
17
|
const HEADER_HEIGHT = 75;
|
|
18
|
+
const sections = ['header', 'participants', 'toggle', 'desktop_data', 'mobile_ticker', 'mobile_player', 'mobile_leaderboard', 'engagements'];
|
|
16
19
|
const Campaign = ({
|
|
20
|
+
player_id,
|
|
17
21
|
campaign_id,
|
|
18
22
|
insets,
|
|
19
23
|
color_mode,
|
|
20
|
-
auto,
|
|
21
24
|
distinct_id,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
onSelectCompetition,
|
|
26
|
+
onSelectPollCampaign,
|
|
27
|
+
onCreateOrder,
|
|
28
|
+
onViewProfile,
|
|
29
|
+
onCheckedIn,
|
|
30
|
+
onCheckedOut,
|
|
25
31
|
onBetNow
|
|
26
32
|
}) => {
|
|
27
33
|
const Colors = useColors();
|
|
34
|
+
const [needs_reload, setNeedsReload] = useState(false);
|
|
35
|
+
const [new_player_alert, setNewPlayerAlert] = useState(undefined);
|
|
28
36
|
const [new_bet_alert, setNewBetAlert] = useState(undefined);
|
|
29
37
|
//const [ refresh, setRefresh ] = useState(0);
|
|
30
|
-
const [cta_type, setCTAType] = useState('participant');
|
|
31
|
-
const [selected_ad, setSelectedAd] = useState(undefined);
|
|
32
38
|
const {
|
|
33
|
-
width
|
|
34
|
-
height
|
|
39
|
+
width
|
|
35
40
|
} = useWindowDimensions();
|
|
41
|
+
const view_mode = width > 710 ? 'desktop' : 'mobile';
|
|
42
|
+
const [active_toggle, setActiveToggle] = useState('odds');
|
|
36
43
|
const time_options = CampaignHelpers.getTimeOptions();
|
|
37
|
-
const participants_location = width > 1200 ? 'left' : 'top';
|
|
38
44
|
//const ad_location = width > 1200 ? 'right': 'bottom';
|
|
39
|
-
const
|
|
45
|
+
const [socket_participants, setSocketParticipants] = useState([]);
|
|
40
46
|
const [selected_participant, setSelectedParticipant] = useState(undefined);
|
|
41
47
|
const [new_event, setNewEvent] = useState(undefined);
|
|
48
|
+
const [new_tournaments, setNewTournaments] = useState(undefined);
|
|
42
49
|
const [analytics, setAnalytics] = useState([]);
|
|
50
|
+
const [my_details, setMyDetails] = useState({
|
|
51
|
+
my_loading: false
|
|
52
|
+
});
|
|
53
|
+
const {
|
|
54
|
+
my_loading,
|
|
55
|
+
my_participant
|
|
56
|
+
} = my_details;
|
|
43
57
|
const [embed_state, setEmbedState] = useState({
|
|
44
58
|
loading: false,
|
|
45
59
|
campaign_participants: [],
|
|
46
60
|
events: [],
|
|
61
|
+
leagues: [],
|
|
62
|
+
tournaments: [],
|
|
63
|
+
poll_campaigns: [],
|
|
64
|
+
competitions: [],
|
|
65
|
+
matches: [],
|
|
47
66
|
athletes: [],
|
|
48
67
|
participant_page: 0,
|
|
49
68
|
markets: [],
|
|
@@ -55,22 +74,85 @@ const Campaign = ({
|
|
|
55
74
|
const {
|
|
56
75
|
orders,
|
|
57
76
|
events,
|
|
77
|
+
tournaments,
|
|
58
78
|
athletes,
|
|
79
|
+
competitions,
|
|
80
|
+
poll_campaigns,
|
|
59
81
|
campaign,
|
|
60
82
|
participant_page,
|
|
61
83
|
action_page,
|
|
84
|
+
leagues,
|
|
62
85
|
campaign_participants,
|
|
63
86
|
players,
|
|
64
87
|
teams
|
|
65
88
|
} = embed_state;
|
|
66
89
|
//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)
|
|
67
|
-
|
|
68
90
|
useEffect(() => {
|
|
69
91
|
if (!campaign_id) {
|
|
70
92
|
return;
|
|
71
93
|
}
|
|
72
94
|
startUp(campaign_id);
|
|
73
95
|
}, [campaign_id]);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (!player_id || !campaign_id) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
getMyData(campaign_id);
|
|
101
|
+
}, [campaign_id, player_id]);
|
|
102
|
+
const getMyData = async id => {
|
|
103
|
+
const resp = await CampaignApi.getMyCampaignParticipants();
|
|
104
|
+
//find this campaign
|
|
105
|
+
const this_cp = resp.campaign_participants.find(cp => cp.campaign_id == id);
|
|
106
|
+
setMyDetails({
|
|
107
|
+
...my_details,
|
|
108
|
+
my_loading: false,
|
|
109
|
+
my_participant: this_cp
|
|
110
|
+
});
|
|
111
|
+
if (this_cp?.status == 'active' && onCheckedIn) {
|
|
112
|
+
onCheckedIn(this_cp);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (socket_participants.length == 0) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
handleNewParticipants(socket_participants);
|
|
120
|
+
}, [JSON.stringify(socket_participants)]);
|
|
121
|
+
const handleNewParticipants = async cps => {
|
|
122
|
+
if (cps.length == 0) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
let mine = cps.find(cp => cp.player_id == player_id);
|
|
126
|
+
if (mine) {
|
|
127
|
+
setMyDetails({
|
|
128
|
+
...my_details,
|
|
129
|
+
my_participant: mine
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
//Do we have this player
|
|
133
|
+
let needed_player_ids = [];
|
|
134
|
+
let plsers = [];
|
|
135
|
+
cps.map(cp => {
|
|
136
|
+
let found = players.find(p => p.player_id == cp.player_id);
|
|
137
|
+
if (!found) {
|
|
138
|
+
needed_player_ids.push(cp.player_id);
|
|
139
|
+
} else {
|
|
140
|
+
plsers.push(found);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
plsers = plsers.concat(await CampaignApi.getPlayersByPlayerIds(needed_player_ids));
|
|
144
|
+
//Set new bettor!!
|
|
145
|
+
let new_player = cps.filter(cp => cp.status == 'active')[0];
|
|
146
|
+
if (new_player && new_player.player_id != player_id) {
|
|
147
|
+
setNewPlayerAlert(new_player);
|
|
148
|
+
}
|
|
149
|
+
//Ok! Now lets update the participants
|
|
150
|
+
setEmbedState({
|
|
151
|
+
...embed_state,
|
|
152
|
+
players: players.filter(p => !plsers.find(np => np.player_id == p.player_id)).concat(plsers),
|
|
153
|
+
campaign_participants: campaign_participants.filter(cp => !cps.find(ncp => ncp.campaign_participant_id == cp.campaign_participant_id)).concat(cps)
|
|
154
|
+
});
|
|
155
|
+
};
|
|
74
156
|
useEffect(() => {
|
|
75
157
|
if (!new_event) {
|
|
76
158
|
return;
|
|
@@ -81,6 +163,16 @@ const Campaign = ({
|
|
|
81
163
|
});
|
|
82
164
|
setNewEvent(undefined);
|
|
83
165
|
}, [new_event]);
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
if (!new_tournaments) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
setEmbedState({
|
|
171
|
+
...embed_state,
|
|
172
|
+
tournaments: tournaments.filter(e => e.tournament_id != new_tournaments.tournament_id).concat(new_tournaments)
|
|
173
|
+
});
|
|
174
|
+
setNewEvent(undefined);
|
|
175
|
+
}, [new_tournaments]);
|
|
84
176
|
const startUp = async campaign_id => {
|
|
85
177
|
CampaignApi.setEnvironment();
|
|
86
178
|
MarketComponentApi.setEnvironment();
|
|
@@ -105,12 +197,21 @@ const Campaign = ({
|
|
|
105
197
|
const ords = await CampaignApi.getCampaignAction(campaign_id);
|
|
106
198
|
let vis_ords = [...ords];
|
|
107
199
|
let ev_ids = ords.filter(o => o.event_type == 'team').map(o => o.event_id);
|
|
200
|
+
let tn_ids = ords.filter(o => o.event_type == 'tournament').map(o => o.event_id);
|
|
108
201
|
const action_pages = Math.ceil(vis_ords.length / 5);
|
|
109
202
|
const participant_pages = Math.ceil(c_resp.campaign_participants.length / 5);
|
|
110
203
|
let next_participant_page = participant_page + 1;
|
|
111
204
|
if (next_participant_page > participant_pages) {
|
|
112
205
|
next_participant_page = 1;
|
|
113
206
|
}
|
|
207
|
+
let comps = [];
|
|
208
|
+
let pcs = [];
|
|
209
|
+
if (c_resp.campaign && c_resp.campaign.poll_campaign_ids) {
|
|
210
|
+
pcs = await CampaignApi.getPollCampaignsByIds(c_resp.campaign.poll_campaign_ids);
|
|
211
|
+
}
|
|
212
|
+
if (c_resp.campaign && c_resp.campaign.competition_ids) {
|
|
213
|
+
comps = await CampaignApi.getCompetitionsByIds(c_resp.campaign.competition_ids);
|
|
214
|
+
}
|
|
114
215
|
let next_action_page = action_page + 1;
|
|
115
216
|
if (next_action_page > action_pages) {
|
|
116
217
|
next_action_page = 1;
|
|
@@ -123,6 +224,9 @@ const Campaign = ({
|
|
|
123
224
|
if (new_bet.event_type == 'team') {
|
|
124
225
|
ev_ids.push(new_bet.event_id);
|
|
125
226
|
}
|
|
227
|
+
if (new_bet.event_type == 'tournament') {
|
|
228
|
+
tn_ids.push(new_bet.event_id);
|
|
229
|
+
}
|
|
126
230
|
if (new_bet.side_type == 'team') {
|
|
127
231
|
tm_ids.push(new_bet.side_id);
|
|
128
232
|
}
|
|
@@ -132,14 +236,20 @@ const Campaign = ({
|
|
|
132
236
|
}
|
|
133
237
|
}
|
|
134
238
|
const evs = await MarketComponentApi.getEventsByEventIds(ords.filter(o => o.event_type == 'team').map(o => o.event_id));
|
|
239
|
+
const tns = await MarketComponentApi.getTournamentsByTournamentIds(tn_ids);
|
|
135
240
|
const tms = await MarketComponentApi.getTeamsByIds(tm_ids);
|
|
136
241
|
const aths = await MarketComponentApi.getAthletesByIds(aths_ids);
|
|
242
|
+
const lgs = await MarketComponentApi.getLeagues();
|
|
137
243
|
setEmbedState({
|
|
138
244
|
...embed_state,
|
|
139
245
|
players: pls,
|
|
140
246
|
campaign: c_resp.campaign,
|
|
141
247
|
campaign_participants: c_resp.campaign_participants,
|
|
142
248
|
teams: tms,
|
|
249
|
+
leagues: lgs,
|
|
250
|
+
competitions: comps,
|
|
251
|
+
poll_campaigns: pcs,
|
|
252
|
+
tournaments: tns,
|
|
143
253
|
athletes: aths,
|
|
144
254
|
participant_page: next_participant_page,
|
|
145
255
|
action_page: next_action_page,
|
|
@@ -148,235 +258,424 @@ const Campaign = ({
|
|
|
148
258
|
loading: false
|
|
149
259
|
});
|
|
150
260
|
};
|
|
261
|
+
const handleCheckIn = async () => {
|
|
262
|
+
setMyDetails({
|
|
263
|
+
...my_details,
|
|
264
|
+
my_loading: true
|
|
265
|
+
});
|
|
266
|
+
const new_cp = await CampaignApi.joinCampaign(campaign_id);
|
|
267
|
+
setMyDetails({
|
|
268
|
+
...my_details,
|
|
269
|
+
my_participant: new_cp,
|
|
270
|
+
my_loading: false
|
|
271
|
+
});
|
|
272
|
+
if (new_cp && onCheckedIn) {
|
|
273
|
+
onCheckedIn(new_cp);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const handleCheckOut = async () => {
|
|
277
|
+
if (!my_participant) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
setMyDetails({
|
|
281
|
+
...my_details,
|
|
282
|
+
my_loading: true
|
|
283
|
+
});
|
|
284
|
+
const new_cp = await CampaignApi.leaveCampaign(my_participant.campaign_participant_id);
|
|
285
|
+
setMyDetails({
|
|
286
|
+
...my_details,
|
|
287
|
+
my_loading: false,
|
|
288
|
+
my_participant: new_cp
|
|
289
|
+
});
|
|
290
|
+
if (new_cp && onCheckedOut) {
|
|
291
|
+
onCheckedOut(new_cp);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const renderTicker = () => {
|
|
295
|
+
return /*#__PURE__*/React.createElement(TickerApp, {
|
|
296
|
+
league_ids: campaign?.league_ids ?? [],
|
|
297
|
+
distinct_id: distinct_id,
|
|
298
|
+
onCreateOrder: onCreateOrder,
|
|
299
|
+
color_mode: color_mode,
|
|
300
|
+
onOrders: async orders => {
|
|
301
|
+
//find if the orders are new!
|
|
302
|
+
let new_bet = orders.find(o => o.campaign_id);
|
|
303
|
+
if (new_bet) {
|
|
304
|
+
let og_bet = await MarketComponentApi.getOrderById(new_bet.order_id);
|
|
305
|
+
if (!og_bet) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
//Find the event
|
|
309
|
+
switch (og_bet.event_type) {
|
|
310
|
+
case 'team':
|
|
311
|
+
let ev = events.find(e => e.event_id == og_bet.event_id);
|
|
312
|
+
if (!ev) {
|
|
313
|
+
let evs = await MarketComponentApi.getEventsByEventIds([new_bet.event_id]);
|
|
314
|
+
setNewEvent(evs[0]);
|
|
315
|
+
}
|
|
316
|
+
return setNewBetAlert(og_bet);
|
|
317
|
+
case 'tournament':
|
|
318
|
+
let tn = tournaments.find(tn => tn.tournament_id == og_bet.event_id);
|
|
319
|
+
let ath = athletes.find(a => a.athlete_id == og_bet.side_id);
|
|
320
|
+
let tm = teams.find(t => t.team_id == og_bet.side_id);
|
|
321
|
+
if (!tn) {
|
|
322
|
+
let evs = await MarketComponentApi.getTournamentsByTournamentIds([new_bet.event_id]);
|
|
323
|
+
setNewTournaments(evs[0]);
|
|
324
|
+
}
|
|
325
|
+
if (og_bet.side_type == 'athlete' && !ath) {
|
|
326
|
+
let athls = await MarketComponentApi.getAthletesByIds([new_bet.side_id]);
|
|
327
|
+
setEmbedState({
|
|
328
|
+
...embed_state,
|
|
329
|
+
athletes: athletes.concat(athls)
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
if (og_bet.side_type == 'team' && !tm) {
|
|
333
|
+
let tms = await MarketComponentApi.getTeamsByIds([new_bet.side_id]);
|
|
334
|
+
setEmbedState({
|
|
335
|
+
...embed_state,
|
|
336
|
+
teams: teams.concat(tms)
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
return setNewBetAlert(og_bet);
|
|
340
|
+
default:
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
const renderEngagements = data => {
|
|
348
|
+
switch (data.item.type) {
|
|
349
|
+
case 'competition':
|
|
350
|
+
let comp = competitions.find(c => c.competition_id == data.item.id);
|
|
351
|
+
if (!comp) {
|
|
352
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
353
|
+
}
|
|
354
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
355
|
+
disabled: !onSelectCompetition,
|
|
356
|
+
style: {
|
|
357
|
+
flexDirection: 'row',
|
|
358
|
+
alignItems: 'center',
|
|
359
|
+
padding: 10,
|
|
360
|
+
borderBottomWidth: 1,
|
|
361
|
+
borderColor: Colors.borders.light
|
|
362
|
+
},
|
|
363
|
+
onPress: () => onSelectCompetition ? onSelectCompetition(comp) : console.log('')
|
|
364
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
365
|
+
source: {
|
|
366
|
+
uri: comp.image?.url
|
|
367
|
+
},
|
|
368
|
+
style: {
|
|
369
|
+
height: 40,
|
|
370
|
+
width: 40,
|
|
371
|
+
borderRadius: 4
|
|
372
|
+
},
|
|
373
|
+
resizeMode: "cover"
|
|
374
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
375
|
+
transparent: true,
|
|
376
|
+
style: {
|
|
377
|
+
flex: 1,
|
|
378
|
+
marginLeft: 10
|
|
379
|
+
}
|
|
380
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
381
|
+
theme: "h1"
|
|
382
|
+
}, comp.competition_name), /*#__PURE__*/React.createElement(Text, {
|
|
383
|
+
theme: "description",
|
|
384
|
+
style: {
|
|
385
|
+
marginTop: 3
|
|
386
|
+
}
|
|
387
|
+
}, comp.competition_description)), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
|
|
388
|
+
direction: "right",
|
|
389
|
+
size: 12,
|
|
390
|
+
color: Colors.text.action
|
|
391
|
+
}));
|
|
392
|
+
case 'poll_campaign':
|
|
393
|
+
let pc = poll_campaigns.find(c => c.poll_campaign_id == data.item.id);
|
|
394
|
+
if (!pc) {
|
|
395
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
396
|
+
}
|
|
397
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
398
|
+
disabled: !onSelectPollCampaign,
|
|
399
|
+
style: {
|
|
400
|
+
flexDirection: 'row',
|
|
401
|
+
alignItems: 'center',
|
|
402
|
+
padding: 10,
|
|
403
|
+
borderBottomWidth: 1,
|
|
404
|
+
borderColor: Colors.borders.light
|
|
405
|
+
},
|
|
406
|
+
onPress: () => onSelectPollCampaign ? onSelectPollCampaign(pc) : console.log('')
|
|
407
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
408
|
+
source: {
|
|
409
|
+
uri: pc.campaign_image?.url
|
|
410
|
+
},
|
|
411
|
+
style: {
|
|
412
|
+
height: 40,
|
|
413
|
+
width: 40,
|
|
414
|
+
borderRadius: 4
|
|
415
|
+
},
|
|
416
|
+
resizeMode: "cover"
|
|
417
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
418
|
+
transparent: true,
|
|
419
|
+
style: {
|
|
420
|
+
flex: 1,
|
|
421
|
+
marginLeft: 10
|
|
422
|
+
}
|
|
423
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
424
|
+
theme: "h1"
|
|
425
|
+
}, pc.name), /*#__PURE__*/React.createElement(Text, {
|
|
426
|
+
theme: "description",
|
|
427
|
+
style: {
|
|
428
|
+
marginTop: 3
|
|
429
|
+
}
|
|
430
|
+
}, pc.total_responders, " Players")), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
|
|
431
|
+
direction: "right",
|
|
432
|
+
size: 12,
|
|
433
|
+
color: Colors.text.action
|
|
434
|
+
}));
|
|
435
|
+
default:
|
|
436
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
437
|
+
}
|
|
438
|
+
};
|
|
151
439
|
const renderSections = data => {
|
|
152
440
|
switch (data.item) {
|
|
153
|
-
case '
|
|
154
|
-
if (!
|
|
441
|
+
case 'header':
|
|
442
|
+
if (!campaign) {
|
|
443
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
444
|
+
}
|
|
445
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
446
|
+
type: "header",
|
|
447
|
+
style: {
|
|
448
|
+
height: HEADER_HEIGHT,
|
|
449
|
+
padding: 10,
|
|
450
|
+
paddingLeft: 20,
|
|
451
|
+
paddingRight: 20,
|
|
452
|
+
flexDirection: 'row',
|
|
453
|
+
alignItems: 'center',
|
|
454
|
+
borderBottomWidth: 1,
|
|
455
|
+
borderColor: Colors.borders.light
|
|
456
|
+
}
|
|
457
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
458
|
+
source: {
|
|
459
|
+
uri: campaign.campaign_image?.url
|
|
460
|
+
},
|
|
461
|
+
style: {
|
|
462
|
+
height: 55,
|
|
463
|
+
width: 55
|
|
464
|
+
},
|
|
465
|
+
resizeMode: "cover"
|
|
466
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
467
|
+
transparent: true,
|
|
468
|
+
style: {
|
|
469
|
+
flex: 1,
|
|
470
|
+
marginLeft: 20
|
|
471
|
+
}
|
|
472
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
473
|
+
theme: "h1",
|
|
474
|
+
size: 18
|
|
475
|
+
}, campaign.campaign_name), /*#__PURE__*/React.createElement(Text, {
|
|
476
|
+
theme: "description",
|
|
477
|
+
style: {
|
|
478
|
+
marginTop: 4
|
|
479
|
+
}
|
|
480
|
+
}, campaign.description)), view_mode == 'desktop' ? /*#__PURE__*/React.createElement(View, {
|
|
481
|
+
transparent: true,
|
|
482
|
+
style: {
|
|
483
|
+
flexDirection: 'row',
|
|
484
|
+
alignItems: 'center',
|
|
485
|
+
padding: 10
|
|
486
|
+
}
|
|
487
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
488
|
+
transparent: true,
|
|
489
|
+
style: {
|
|
490
|
+
marginRight: 10
|
|
491
|
+
}
|
|
492
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
493
|
+
theme: "h1",
|
|
494
|
+
textAlign: "center"
|
|
495
|
+
}, "CHECK IN"), /*#__PURE__*/React.createElement(Text, {
|
|
496
|
+
theme: "h1",
|
|
497
|
+
textAlign: "center"
|
|
498
|
+
}, "HERE")), /*#__PURE__*/React.createElement(QRCode, {
|
|
499
|
+
value: `https://play.bettoredge.com/social/campaign/${campaign_id}`,
|
|
500
|
+
size: 65
|
|
501
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
502
|
+
case 'participants':
|
|
503
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
504
|
+
style: {
|
|
505
|
+
borderBottomWidth: 3,
|
|
506
|
+
borderColor: Colors.borders.light
|
|
507
|
+
}
|
|
508
|
+
}, /*#__PURE__*/React.createElement(ParticipantsList, {
|
|
509
|
+
campaign_participants: campaign_participants,
|
|
510
|
+
players: players,
|
|
511
|
+
horizontal: true,
|
|
512
|
+
selected_participant: selected_participant?.campaign_participant_id,
|
|
513
|
+
onSelect: cp => setSelectedParticipant(cp),
|
|
514
|
+
onDeselect: () => setSelectedParticipant(undefined)
|
|
515
|
+
}));
|
|
516
|
+
case 'mobile_ticker':
|
|
517
|
+
if (view_mode != 'mobile') {
|
|
518
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
519
|
+
}
|
|
520
|
+
if (active_toggle != 'odds') {
|
|
521
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
522
|
+
}
|
|
523
|
+
if (selected_participant) {
|
|
155
524
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
156
525
|
}
|
|
157
526
|
if (!campaign) {
|
|
158
527
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
159
528
|
}
|
|
160
|
-
return /*#__PURE__*/React.createElement(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
let ev = events.find(e => e.event_id == og_bet.event_id);
|
|
173
|
-
if (!ev) {
|
|
174
|
-
let evs = await MarketComponentApi.getEventsByEventIds([new_bet.event_id]);
|
|
175
|
-
setNewEvent(evs[0]);
|
|
176
|
-
}
|
|
177
|
-
setNewBetAlert(og_bet);
|
|
178
|
-
}
|
|
529
|
+
return /*#__PURE__*/React.createElement(View, null, renderTicker());
|
|
530
|
+
case 'toggle':
|
|
531
|
+
if (view_mode != 'mobile') {
|
|
532
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
533
|
+
}
|
|
534
|
+
if (selected_participant) {
|
|
535
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
536
|
+
}
|
|
537
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
538
|
+
style: {
|
|
539
|
+
padding: 10
|
|
179
540
|
}
|
|
541
|
+
}, /*#__PURE__*/React.createElement(Toggle, {
|
|
542
|
+
selected_option: active_toggle,
|
|
543
|
+
onSelectOption: toggle => setActiveToggle(toggle),
|
|
544
|
+
options: [{
|
|
545
|
+
key: 'odds',
|
|
546
|
+
label: 'Live Odds'
|
|
547
|
+
}, {
|
|
548
|
+
key: 'leaderboard',
|
|
549
|
+
label: 'Leaderboard'
|
|
550
|
+
}, {
|
|
551
|
+
key: 'engagements',
|
|
552
|
+
label: 'Games'
|
|
553
|
+
}]
|
|
554
|
+
}));
|
|
555
|
+
case 'mobile_leaderboard':
|
|
556
|
+
if (view_mode != 'mobile') {
|
|
557
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
558
|
+
}
|
|
559
|
+
if (active_toggle != 'leaderboard') {
|
|
560
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
561
|
+
}
|
|
562
|
+
return /*#__PURE__*/React.createElement(CampaignAnalytics, {
|
|
563
|
+
campaign_id: campaign_id,
|
|
564
|
+
players: players,
|
|
565
|
+
campaign_participants: campaign_participants
|
|
180
566
|
});
|
|
181
|
-
case '
|
|
182
|
-
if (
|
|
567
|
+
case 'engagements':
|
|
568
|
+
if (view_mode != 'mobile') {
|
|
183
569
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
184
570
|
}
|
|
185
|
-
if (
|
|
571
|
+
if (active_toggle != 'engagements') {
|
|
572
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
573
|
+
}
|
|
574
|
+
const sorted_engagements = CampaignHelpers.sortEngagements(competitions, poll_campaigns);
|
|
575
|
+
return /*#__PURE__*/React.createElement(FlatList, {
|
|
576
|
+
data: sorted_engagements,
|
|
577
|
+
renderItem: renderEngagements,
|
|
578
|
+
keyExtractor: item => item.id.toString(),
|
|
579
|
+
key: 'engagement_list_campaign'
|
|
580
|
+
});
|
|
581
|
+
case 'mobile_player':
|
|
582
|
+
if (view_mode != 'mobile') {
|
|
186
583
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
187
584
|
}
|
|
188
|
-
|
|
189
|
-
if (!
|
|
585
|
+
let mobile_selected_player = players.find(p => p.player_id == selected_participant?.player_id);
|
|
586
|
+
if (!selected_participant || !mobile_selected_player) {
|
|
190
587
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
191
588
|
}
|
|
192
|
-
return /*#__PURE__*/React.createElement(
|
|
589
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
590
|
+
type: "header"
|
|
591
|
+
}, /*#__PURE__*/React.createElement(ParticipantCard, {
|
|
193
592
|
campaign_participant: selected_participant,
|
|
194
|
-
player:
|
|
195
|
-
analytics: analytics.filter(a => a.player_id ==
|
|
196
|
-
orders: orders.filter(o => o.player_id ==
|
|
197
|
-
events: events
|
|
198
|
-
|
|
593
|
+
player: mobile_selected_player,
|
|
594
|
+
analytics: analytics.filter(a => a.player_id == selected_participant.player_id),
|
|
595
|
+
orders: orders.filter(o => o.player_id == selected_participant.player_id),
|
|
596
|
+
events: events,
|
|
597
|
+
tournaments: tournaments,
|
|
598
|
+
matches: []
|
|
599
|
+
}));
|
|
600
|
+
case 'desktop_data':
|
|
601
|
+
if (view_mode != 'desktop') {
|
|
602
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
603
|
+
}
|
|
604
|
+
if (!campaign) {
|
|
605
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
606
|
+
}
|
|
607
|
+
let selected_player = players.find(p => p.player_id == selected_participant?.player_id);
|
|
608
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
609
|
+
style: {
|
|
610
|
+
flexDirection: 'row'
|
|
611
|
+
}
|
|
612
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
613
|
+
nativeID: "recent_action",
|
|
614
|
+
style: {
|
|
615
|
+
width: 350,
|
|
616
|
+
borderRightWidth: 3,
|
|
617
|
+
borderColor: Colors.borders.light
|
|
618
|
+
}
|
|
619
|
+
}, selected_participant && selected_player ? /*#__PURE__*/React.createElement(View, {
|
|
620
|
+
type: "header"
|
|
621
|
+
}, /*#__PURE__*/React.createElement(ParticipantCard, {
|
|
622
|
+
campaign_participant: selected_participant,
|
|
623
|
+
player: selected_player,
|
|
624
|
+
analytics: analytics.filter(a => a.player_id == selected_participant.player_id),
|
|
625
|
+
orders: orders.filter(o => o.player_id == selected_participant.player_id),
|
|
626
|
+
events: events,
|
|
627
|
+
tournaments: tournaments,
|
|
628
|
+
matches: []
|
|
629
|
+
})) : /*#__PURE__*/React.createElement(ActionList, {
|
|
630
|
+
orders: orders,
|
|
631
|
+
events: events,
|
|
632
|
+
tournaments: tournaments,
|
|
633
|
+
matches: [],
|
|
634
|
+
players: players
|
|
635
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
636
|
+
nativeID: "ticker",
|
|
637
|
+
style: {
|
|
638
|
+
flex: 1,
|
|
639
|
+
borderRightWidth: 3,
|
|
640
|
+
borderColor: Colors.borders.light
|
|
641
|
+
}
|
|
642
|
+
}, renderTicker()), /*#__PURE__*/React.createElement(View, {
|
|
643
|
+
nativeID: "leaderboard",
|
|
644
|
+
style: {
|
|
645
|
+
width: 350,
|
|
646
|
+
borderLeftWidth: 1,
|
|
647
|
+
borderColor: Colors.borders.light
|
|
648
|
+
}
|
|
649
|
+
}, /*#__PURE__*/React.createElement(CampaignAnalytics, {
|
|
650
|
+
campaign_id: campaign_id,
|
|
651
|
+
players: players,
|
|
652
|
+
campaign_participants: campaign_participants
|
|
653
|
+
})));
|
|
199
654
|
default:
|
|
200
655
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
201
656
|
}
|
|
202
657
|
};
|
|
203
|
-
|
|
204
|
-
/*
|
|
205
|
-
const renderParticipants = (data: { item:CampaignParticipantProps, index:number }) => {
|
|
206
|
-
const player = players.find(p => p.player_id == data.item.player_id);
|
|
207
|
-
if(!player){ return <></> }
|
|
208
|
-
const team = teams.find(t => t.team_id == data.item.payload?.team_id);
|
|
209
|
-
return (
|
|
210
|
-
<View float style={{ margin:5, padding:5, borderRadius:100}}>
|
|
211
|
-
<View transparent style={{ flexDirection:'row' }}>
|
|
212
|
-
<Image
|
|
213
|
-
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
214
|
-
style={{ height:35, width:35, borderRadius:100 }}
|
|
215
|
-
resizeMode='cover'
|
|
216
|
-
/>
|
|
217
|
-
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
218
|
-
<Text theme='h2'>@{player.username}</Text>
|
|
219
|
-
<Text theme='description' style={{ marginTop:3 }}>Arrived @ {moment(data.item.create_datetime).format('MMM DD hh:mm a')}</Text>
|
|
220
|
-
</View>
|
|
221
|
-
{team ?
|
|
222
|
-
<Image
|
|
223
|
-
source={{ uri: team.image?.url }}
|
|
224
|
-
style={{ height:35, width:35, borderRadius:100 }}
|
|
225
|
-
resizeMode='cover'
|
|
226
|
-
/>
|
|
227
|
-
:<></>}
|
|
228
|
-
</View>
|
|
229
|
-
</View>
|
|
230
|
-
)
|
|
231
|
-
}
|
|
232
|
-
*/
|
|
233
|
-
|
|
658
|
+
const new_player = players.find(p => p.player_id == new_player_alert?.player_id);
|
|
234
659
|
const new_bet_player = players.find(p => p.player_id == new_bet_alert?.player_id);
|
|
235
660
|
const new_bet_team = teams.find(t => t.team_id == new_bet_alert?.side_id);
|
|
236
661
|
const new_bet_athlete = athletes.find(a => a.athlete_id == new_bet_alert?.side_id);
|
|
237
662
|
const new_bet_event = events.find(e => e.event_id == new_bet_alert?.event_id);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const selected_player = players.find(p => p.player_id == selected_participant?.player_id);
|
|
663
|
+
const new_bet_tournament = tournaments.find(t => t.tournament_id == new_bet_alert?.event_id);
|
|
664
|
+
const new_bet_league = new_bet_event ? leagues.find(l => l.league_id == new_bet_event.league_id) : leagues.find(l => l.league_id == new_bet_tournament?.league_id);
|
|
241
665
|
return /*#__PURE__*/React.createElement(View, {
|
|
242
666
|
style: {
|
|
243
667
|
flex: 1
|
|
244
668
|
}
|
|
245
|
-
},
|
|
246
|
-
type: "header",
|
|
247
|
-
style: {
|
|
248
|
-
height: HEADER_HEIGHT,
|
|
249
|
-
padding: 10,
|
|
250
|
-
paddingLeft: 20,
|
|
251
|
-
paddingRight: 20,
|
|
252
|
-
flexDirection: 'row',
|
|
253
|
-
alignItems: 'center',
|
|
254
|
-
borderBottomWidth: 1,
|
|
255
|
-
borderColor: Colors.borders.light
|
|
256
|
-
}
|
|
257
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
258
|
-
source: {
|
|
259
|
-
uri: campaign.campaign_image?.url
|
|
260
|
-
},
|
|
261
|
-
style: {
|
|
262
|
-
height: 55,
|
|
263
|
-
width: 55
|
|
264
|
-
},
|
|
265
|
-
resizeMode: "cover"
|
|
266
|
-
}), /*#__PURE__*/React.createElement(View, {
|
|
267
|
-
transparent: true,
|
|
268
|
-
style: {
|
|
269
|
-
flex: 1,
|
|
270
|
-
marginLeft: 20
|
|
271
|
-
}
|
|
272
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
273
|
-
theme: "h1",
|
|
274
|
-
size: 18
|
|
275
|
-
}, campaign.campaign_name), /*#__PURE__*/React.createElement(Text, {
|
|
276
|
-
theme: "description",
|
|
669
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
277
670
|
style: {
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
}, campaign.description)), /*#__PURE__*/React.createElement(View, {
|
|
281
|
-
transparent: true,
|
|
282
|
-
style: {
|
|
283
|
-
width: 250
|
|
284
|
-
}
|
|
285
|
-
}, /*#__PURE__*/React.createElement(AutoManager, {
|
|
286
|
-
campaign_participants: campaign_participants,
|
|
287
|
-
orders: orders,
|
|
288
|
-
campaign: campaign,
|
|
289
|
-
active: auto ? true : false,
|
|
290
|
-
analytics: analytics,
|
|
291
|
-
onChangeAd: ad => {
|
|
292
|
-
setCTAType('ad');
|
|
293
|
-
setSelectedAd(ad);
|
|
294
|
-
},
|
|
295
|
-
onChangeParticipant: cp => {
|
|
296
|
-
setCTAType('participant');
|
|
297
|
-
setSelectedParticipant(cp);
|
|
298
|
-
}
|
|
299
|
-
}))) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(CampaignAnalytics, {
|
|
300
|
-
campaign_id: campaign_id
|
|
301
|
-
}), participants_location == 'top' ? /*#__PURE__*/React.createElement(View, {
|
|
302
|
-
style: {
|
|
303
|
-
borderRightWidth: 1,
|
|
304
|
-
borderColor: Colors.borders.light
|
|
305
|
-
}
|
|
306
|
-
}, /*#__PURE__*/React.createElement(ParticipantsList, {
|
|
307
|
-
campaign_participants: campaign_participants,
|
|
308
|
-
players: players,
|
|
309
|
-
selected_participant: selected_participant?.campaign_participant_id,
|
|
310
|
-
horizontal: true,
|
|
311
|
-
onDeselect: () => setSelectedParticipant(undefined),
|
|
312
|
-
onSelect: cp => setSelectedParticipant(cp)
|
|
313
|
-
})) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(View, {
|
|
314
|
-
style: {
|
|
315
|
-
flex: 1,
|
|
316
|
-
flexDirection: 'row'
|
|
317
|
-
}
|
|
318
|
-
}, participants_location == 'left' ? /*#__PURE__*/React.createElement(View, {
|
|
319
|
-
transparent: true,
|
|
320
|
-
style: {
|
|
321
|
-
width: 400
|
|
322
|
-
}
|
|
323
|
-
}, /*#__PURE__*/React.createElement(ParticipantsList, {
|
|
324
|
-
campaign_participants: campaign_participants,
|
|
325
|
-
players: players,
|
|
326
|
-
selected_participant: selected_participant?.campaign_participant_id,
|
|
327
|
-
onSelect: cp => setSelectedParticipant(cp),
|
|
328
|
-
onDeselect: () => setSelectedParticipant(undefined)
|
|
329
|
-
}), /*#__PURE__*/React.createElement(View, {
|
|
330
|
-
type: "header",
|
|
331
|
-
style: {
|
|
332
|
-
padding: 20,
|
|
333
|
-
justifyContent: 'center',
|
|
334
|
-
alignItems: 'center'
|
|
335
|
-
}
|
|
336
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
337
|
-
theme: "h1",
|
|
338
|
-
style: {
|
|
339
|
-
marginBottom: 20
|
|
340
|
-
}
|
|
341
|
-
}, "SCAN TO CHECK IN NOW"), /*#__PURE__*/React.createElement(QRCode, {
|
|
342
|
-
size: 250,
|
|
343
|
-
value: `https://play.bettoredge.com/social/campaign/${campaign_id}`
|
|
344
|
-
}))) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(View, {
|
|
345
|
-
style: {
|
|
346
|
-
flex: 1,
|
|
347
|
-
height: height - HEADER_HEIGHT
|
|
671
|
+
flex: 1
|
|
348
672
|
}
|
|
349
673
|
}, /*#__PURE__*/React.createElement(FlatList, {
|
|
350
|
-
data:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
keyExtractor: item => item
|
|
354
|
-
|
|
355
|
-
})), campaign && participants_location == 'left' ? /*#__PURE__*/React.createElement(View, {
|
|
356
|
-
type: "header",
|
|
357
|
-
style: {
|
|
358
|
-
width: 400,
|
|
359
|
-
height: height - HEADER_HEIGHT
|
|
360
|
-
}
|
|
361
|
-
}, cta_type == 'participant' && selected_player && selected_participant ? /*#__PURE__*/React.createElement(ParticipantCard, {
|
|
362
|
-
campaign_participant: selected_participant,
|
|
363
|
-
player: selected_player,
|
|
364
|
-
events: events,
|
|
365
|
-
analytics: analytics.filter(a => a.player_id == selected_participant.player_id),
|
|
366
|
-
orders: orders.filter(o => o.player_id == selected_participant.player_id)
|
|
367
|
-
}) : cta_type == 'ad' && selected_ad?.url ? /*#__PURE__*/React.createElement(View, {
|
|
368
|
-
transparent: true
|
|
369
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
370
|
-
source: {
|
|
371
|
-
uri: selected_ad.url
|
|
372
|
-
},
|
|
373
|
-
style: {
|
|
374
|
-
width: (height - HEADER_HEIGHT) * 0.2857,
|
|
375
|
-
height: height - HEADER_HEIGHT,
|
|
376
|
-
alignSelf: 'center'
|
|
377
|
-
},
|
|
378
|
-
resizeMode: "contain"
|
|
379
|
-
})) : /*#__PURE__*/React.createElement(React.Fragment, null)) : /*#__PURE__*/React.createElement(React.Fragment, null)), /*#__PURE__*/React.createElement(View, {
|
|
674
|
+
data: sections,
|
|
675
|
+
renderItem: renderSections,
|
|
676
|
+
key: 'campaign_sections',
|
|
677
|
+
keyExtractor: item => item
|
|
678
|
+
})), view_mode == 'mobile' ? /*#__PURE__*/React.createElement(View, {
|
|
380
679
|
type: "footer",
|
|
381
680
|
style: {
|
|
382
681
|
flexDirection: 'row',
|
|
@@ -393,24 +692,27 @@ const Campaign = ({
|
|
|
393
692
|
title: 'Bet Now!',
|
|
394
693
|
onPress: () => onBetNow()
|
|
395
694
|
}) : /*#__PURE__*/React.createElement(React.Fragment, null), my_participant?.status == 'active' ? /*#__PURE__*/React.createElement(Button, {
|
|
396
|
-
type: "
|
|
695
|
+
type: "error",
|
|
397
696
|
style: {
|
|
398
697
|
flex: 2,
|
|
399
|
-
opacity: 0.5,
|
|
698
|
+
opacity: my_loading ? 0.5 : 1,
|
|
400
699
|
alignItems: 'center'
|
|
401
700
|
},
|
|
402
|
-
title: '
|
|
403
|
-
|
|
404
|
-
|
|
701
|
+
title: 'Check Out',
|
|
702
|
+
loading: my_loading,
|
|
703
|
+
disabled: my_loading,
|
|
704
|
+
onPress: () => handleCheckOut()
|
|
705
|
+
}) : /*#__PURE__*/React.createElement(Button, {
|
|
405
706
|
type: "success",
|
|
406
707
|
style: {
|
|
407
|
-
flex: 2
|
|
708
|
+
flex: 2,
|
|
709
|
+
opacity: my_loading ? 0.5 : 1
|
|
408
710
|
},
|
|
409
|
-
loading:
|
|
410
|
-
disabled:
|
|
711
|
+
loading: my_loading,
|
|
712
|
+
disabled: my_loading,
|
|
411
713
|
title: "Check In Now",
|
|
412
|
-
onPress: () =>
|
|
413
|
-
}) : /*#__PURE__*/React.createElement(React.Fragment, null)
|
|
714
|
+
onPress: () => handleCheckIn()
|
|
715
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null), new_bet_alert ? /*#__PURE__*/React.createElement(View, {
|
|
414
716
|
type: "blur",
|
|
415
717
|
style: {
|
|
416
718
|
position: 'absolute',
|
|
@@ -424,11 +726,51 @@ const Campaign = ({
|
|
|
424
726
|
}, /*#__PURE__*/React.createElement(BetAlert, {
|
|
425
727
|
order: new_bet_alert,
|
|
426
728
|
event: new_bet_event,
|
|
729
|
+
league: new_bet_league,
|
|
730
|
+
tournament: new_bet_tournament,
|
|
427
731
|
player: new_bet_player,
|
|
428
732
|
team: new_bet_team,
|
|
429
733
|
athlete: new_bet_athlete,
|
|
430
734
|
onClose: () => setNewBetAlert(undefined)
|
|
431
|
-
})) : /*#__PURE__*/React.createElement(React.Fragment, null)
|
|
735
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null), new_player_alert && new_player ? /*#__PURE__*/React.createElement(View, {
|
|
736
|
+
type: "blur",
|
|
737
|
+
style: {
|
|
738
|
+
position: 'absolute',
|
|
739
|
+
top: 0,
|
|
740
|
+
left: 0,
|
|
741
|
+
right: 0,
|
|
742
|
+
bottom: 0,
|
|
743
|
+
alignItems: 'center',
|
|
744
|
+
paddingTop: 100
|
|
745
|
+
}
|
|
746
|
+
}, /*#__PURE__*/React.createElement(NewPlayerAlert, {
|
|
747
|
+
campaign_participant: new_player_alert,
|
|
748
|
+
player: new_player,
|
|
749
|
+
view_mode: view_mode,
|
|
750
|
+
onViewProfile: onViewProfile,
|
|
751
|
+
onClose: () => setNewPlayerAlert(undefined)
|
|
752
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(SocketManager, {
|
|
753
|
+
onConnect: () => {
|
|
754
|
+
if (!needs_reload) {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
console.log('GET DATA!!!`');
|
|
758
|
+
},
|
|
759
|
+
onDisconnect: () => setNeedsReload(true),
|
|
760
|
+
subscribed_events: ['UPDATE_CAMPAIGN_PARTICIPANTS'],
|
|
761
|
+
onSocketEvent: event => {
|
|
762
|
+
switch (event.type) {
|
|
763
|
+
case 'UPDATE_CAMPAIGN_PARTICIPANTS':
|
|
764
|
+
let this_participants = event.campaign_participants.filter(cp => cp.campaign_id == campaign_id);
|
|
765
|
+
if (this_participants.length == 0) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
return setSocketParticipants(event.campaign_participants);
|
|
769
|
+
default:
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}));
|
|
432
774
|
};
|
|
433
775
|
export default Campaign;
|
|
434
776
|
//# sourceMappingURL=index.js.map
|