be-components 2.2.9 → 2.3.0
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/AdServer/index.js.map +1 -1
- package/lib/commonjs/ApiOverrides/index.js +6 -3
- package/lib/commonjs/ApiOverrides/index.js.map +1 -1
- package/lib/commonjs/Competition/components/CompetitionPlay.js.map +1 -1
- package/lib/commonjs/Competition/index.js.map +1 -1
- package/lib/commonjs/Components/Icons.js +115 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/TextInput.js +4 -0
- package/lib/commonjs/Components/TextInput.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/commonjs/Poll/index.js.map +1 -1
- package/lib/commonjs/Share/api/index.js +147 -0
- package/lib/commonjs/Share/api/index.js.map +1 -0
- package/lib/commonjs/Share/components/EmbedPreview.js +31 -0
- package/lib/commonjs/Share/components/EmbedPreview.js.map +1 -0
- package/lib/commonjs/Share/index.js +596 -0
- package/lib/commonjs/Share/index.js.map +1 -0
- package/lib/commonjs/Squares/index.js.map +1 -1
- package/lib/commonjs/Wallet/index.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/AdServer/index.js.map +1 -1
- package/lib/module/ApiOverrides/index.js +6 -3
- package/lib/module/ApiOverrides/index.js.map +1 -1
- package/lib/module/Competition/components/CompetitionPlay.js.map +1 -1
- package/lib/module/Competition/index.js.map +1 -1
- package/lib/module/Components/Icons.js +115 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/TextInput.js +4 -0
- package/lib/module/Components/TextInput.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/module/Poll/index.js.map +1 -1
- package/lib/module/Share/api/index.js +141 -0
- package/lib/module/Share/api/index.js.map +1 -0
- package/lib/module/Share/components/EmbedPreview.js +23 -0
- package/lib/module/Share/components/EmbedPreview.js.map +1 -0
- package/lib/module/Share/index.js +587 -0
- package/lib/module/Share/index.js.map +1 -0
- package/lib/module/Squares/index.js.map +1 -1
- package/lib/module/Wallet/index.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/AdServer/index.d.ts +1 -1
- package/lib/typescript/src/AdServer/index.d.ts.map +1 -1
- package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/src/Competition/components/CompetitionPlay.d.ts +1 -2
- package/lib/typescript/src/Competition/components/CompetitionPlay.d.ts.map +1 -1
- package/lib/typescript/src/Competition/index.d.ts +1 -2
- package/lib/typescript/src/Competition/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +4 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/TextInput.d.ts +3 -1
- package/lib/typescript/src/Components/TextInput.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +1 -2
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/lib/typescript/src/Observer/api/index.d.ts +1 -1
- package/lib/typescript/src/Observer/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Poll/index.d.ts +1 -2
- package/lib/typescript/src/Poll/index.d.ts.map +1 -1
- package/lib/typescript/src/Share/api/index.d.ts +27 -0
- package/lib/typescript/src/Share/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Share/components/EmbedPreview.d.ts +9 -0
- package/lib/typescript/src/Share/components/EmbedPreview.d.ts.map +1 -0
- package/lib/typescript/src/Share/index.d.ts +28 -0
- package/lib/typescript/src/Share/index.d.ts.map +1 -0
- package/lib/typescript/src/Squares/index.d.ts +1 -2
- package/lib/typescript/src/Squares/index.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/index.d.ts +1 -2
- package/lib/typescript/src/Wallet/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AdServer/index.tsx +1 -2
- package/src/ApiOverrides/index.ts +6 -5
- package/src/Competition/components/CompetitionPlay.tsx +1 -2
- package/src/Competition/index.tsx +1 -2
- package/src/Components/Icons.tsx +67 -0
- package/src/Components/TextInput.tsx +5 -1
- package/src/MarketComponents/components/TeamEventMarket/index.tsx +1 -2
- package/src/Observer/api/index.ts +1 -1
- package/src/Poll/index.tsx +1 -2
- package/src/Share/api/index.ts +114 -0
- package/src/Share/components/EmbedPreview.tsx +35 -0
- package/src/Share/index.tsx +370 -0
- package/src/Squares/index.tsx +1 -2
- package/src/Wallet/index.tsx +1 -2
- package/src/index.tsx +4 -1
- package/src/types.d.ts +38 -0
- package/lib/commonjs/Observer/api/types.d.js +0 -2
- package/lib/commonjs/Observer/api/types.d.js.map +0 -1
- package/lib/module/Observer/api/types.d.js +0 -2
- package/lib/module/Observer/api/types.d.js.map +0 -1
- package/src/Observer/api/types.d.ts +0 -38
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import Text from '../Components/Text';
|
|
3
|
+
import { View, TouchableOpacity, FlatList, ActivityIndicator, Clipboard, ScrollView } from 'react-native';
|
|
4
|
+
import { view_styles } from '../constants/styles';
|
|
5
|
+
import { Button, Icons, TextInput } from '../Components';
|
|
6
|
+
import Colors from '../constants/colors';
|
|
7
|
+
import { ShareApi, ShareHelpers } from './api';
|
|
8
|
+
import type { BEEventProps, GeneratedLinkProps } from '../types';
|
|
9
|
+
import EmbedPreview from './components/EmbedPreview';
|
|
10
|
+
|
|
11
|
+
const native_share_options = [
|
|
12
|
+
{ name: 'twitter', getIcon: () => <Icons.TwitterXIcon size={18}/> },
|
|
13
|
+
{ name: 'instagram', getIcon: () => <Icons.InstagramIcon size={18}/> },
|
|
14
|
+
{ name: 'facebook', getIcon:() => <Icons.FacebookIcon size={18} /> },
|
|
15
|
+
{ name: 'moare', getIcon:() => <Icons.MoreIcon size={18} color={Colors.brand.midnight} /> }
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
type ShareWidgetProps = {
|
|
19
|
+
redirect_url?:string,
|
|
20
|
+
generated_link_id?:string,
|
|
21
|
+
title:string,
|
|
22
|
+
body?:string,
|
|
23
|
+
player_id?:string,
|
|
24
|
+
generator: 'player'|'company'|'tool',
|
|
25
|
+
link_type: GeneratedLinkProps['link_type'],
|
|
26
|
+
link_sub_type: GeneratedLinkProps['link_sub_type'],
|
|
27
|
+
type_id?:string,
|
|
28
|
+
onEvent?:(be_event:BEEventProps) => void,
|
|
29
|
+
embed?:{
|
|
30
|
+
embed_code:string,
|
|
31
|
+
script_source?:string,
|
|
32
|
+
widget_element?:any,
|
|
33
|
+
div_id?:string
|
|
34
|
+
},
|
|
35
|
+
onCancel:() => void,
|
|
36
|
+
onShare:(generated_link_id:string) => void,
|
|
37
|
+
allow_edit?:boolean,
|
|
38
|
+
maxWidth?:number
|
|
39
|
+
maxHeight?:number
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const ShareWidget = ({ generated_link_id, title, body, redirect_url, maxWidth, maxHeight, generator, allow_edit, player_id, link_type, link_sub_type, type_id, embed, onEvent }:ShareWidgetProps) => {
|
|
43
|
+
const [ preview_embed, setPreviewEmbed ] = useState(false);
|
|
44
|
+
const [ link_height, setLinkHeight ] = useState(0);
|
|
45
|
+
const [ active_tab, setActiveTab ] = useState('link');
|
|
46
|
+
const [ link_status, setLinkStatus ] = useState<{
|
|
47
|
+
loading: boolean,
|
|
48
|
+
update_loading:boolean,
|
|
49
|
+
editing:boolean,
|
|
50
|
+
generated_link?:GeneratedLinkProps,
|
|
51
|
+
draft_generated_link?:GeneratedLinkProps,
|
|
52
|
+
visible_id_valid:Boolean,
|
|
53
|
+
query_params:{ key:string, value:string }[]
|
|
54
|
+
url?:string
|
|
55
|
+
}>({
|
|
56
|
+
loading: false,
|
|
57
|
+
update_loading: false,
|
|
58
|
+
editing:false,
|
|
59
|
+
visible_id_valid: true,
|
|
60
|
+
query_params: []
|
|
61
|
+
});
|
|
62
|
+
const { loading, editing, generated_link, draft_generated_link, url, visible_id_valid, update_loading } = link_status;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const native_share_allowed = useCallback(() => {
|
|
66
|
+
return ShareHelpers.nativeShareAvailable()
|
|
67
|
+
},[])
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if(!redirect_url && !generated_link_id){ return }//Unable to get redirect link
|
|
71
|
+
ShareApi.setEnvironment();
|
|
72
|
+
if(generated_link_id){ getGeneratedLink(generated_link_id) }
|
|
73
|
+
else if(redirect_url){ generateLink(redirect_url) }
|
|
74
|
+
},[redirect_url, generated_link_id]);
|
|
75
|
+
|
|
76
|
+
const getGeneratedLink = async(generated_link_id:string) => {
|
|
77
|
+
setLinkStatus({ ...link_status, loading:true });
|
|
78
|
+
const retrieved_link = await ShareApi.getGeneratedLinkById(generated_link_id);
|
|
79
|
+
setLinkStatus({
|
|
80
|
+
...link_status,
|
|
81
|
+
loading:false,
|
|
82
|
+
generated_link:retrieved_link?.generated_link,
|
|
83
|
+
draft_generated_link: retrieved_link?.generated_link,
|
|
84
|
+
query_params: ShareHelpers.extractQueryParams(retrieved_link?.generated_link.redirect_url),
|
|
85
|
+
url: retrieved_link?.url
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
const generateLink = async(redirect_url:string) => {
|
|
91
|
+
setLinkStatus({ ...link_status, loading: true });
|
|
92
|
+
|
|
93
|
+
const { generated_link, url } = await ShareApi.generateShortLink({
|
|
94
|
+
generator: generator,
|
|
95
|
+
generated_link_id:'',
|
|
96
|
+
generator_id: player_id,
|
|
97
|
+
type_id,
|
|
98
|
+
redirect_url,
|
|
99
|
+
link_type,
|
|
100
|
+
link_sub_type
|
|
101
|
+
});
|
|
102
|
+
setLinkStatus({
|
|
103
|
+
...link_status,
|
|
104
|
+
loading: false,
|
|
105
|
+
generated_link,
|
|
106
|
+
draft_generated_link: generated_link,
|
|
107
|
+
url
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
const renderNativeOptions = (data:{ item:any, index:number }) => {
|
|
114
|
+
return (
|
|
115
|
+
<View style={{ padding:5 }}>
|
|
116
|
+
{data.item.getIcon()}
|
|
117
|
+
</View>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const link_is_changed = JSON.stringify(draft_generated_link) != JSON.stringify(generated_link)
|
|
122
|
+
const needs_verification = link_is_changed && !visible_id_valid
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<View style={{ ...view_styles.section, minWidth:250, maxWidth, maxHeight }}>
|
|
126
|
+
<View style={{ ...view_styles.section_header, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
127
|
+
<View style={{ flex:1 }}>
|
|
128
|
+
<Text theme='header'>Share Modal</Text>
|
|
129
|
+
</View>
|
|
130
|
+
<Button
|
|
131
|
+
title='X'
|
|
132
|
+
title_weight='regular'
|
|
133
|
+
borderRadius={100}
|
|
134
|
+
backgroundColor={Colors.shades.shade100}
|
|
135
|
+
padding={5}
|
|
136
|
+
onPress={() => console.log('HELLP')}
|
|
137
|
+
/>
|
|
138
|
+
</View>
|
|
139
|
+
<ScrollView style={{ flex:1 }}>
|
|
140
|
+
{loading || !generated_link ?
|
|
141
|
+
<View>
|
|
142
|
+
<ActivityIndicator style={{ padding:20, alignSelf:'center' }} color={Colors.brand.midnight} size={'large'} />
|
|
143
|
+
</View>
|
|
144
|
+
: active_tab == 'link' ?
|
|
145
|
+
<View>
|
|
146
|
+
{editing && draft_generated_link ?
|
|
147
|
+
<View style={{ ...view_styles.section_body }}>
|
|
148
|
+
<View style={{ ...view_styles.body_row }}>
|
|
149
|
+
<View style={{ flex:1 }}>
|
|
150
|
+
<Text size={16} color={Colors.brand.midnight} weight='regular'>Edit This Link</Text>
|
|
151
|
+
<Text style={{ marginTop:3 }} theme='body'>Edit the visible Id and query parameters below</Text>
|
|
152
|
+
</View>
|
|
153
|
+
</View>
|
|
154
|
+
<View style={{ backgroundColor:Colors.shades.shade100, padding:10 }}>
|
|
155
|
+
<View style={{ ...view_styles.body_row }}>
|
|
156
|
+
<View style={{ flex:1 }}>
|
|
157
|
+
<Text theme='header_2'>Short Link</Text>
|
|
158
|
+
<View style={{ flexDirection:'row', alignItems:'center' }}>
|
|
159
|
+
<Text style={{ marginTop:3 }} theme='body'>https://share.mybe.app/id/</Text>
|
|
160
|
+
<TextInput
|
|
161
|
+
value={draft_generated_link.visible_id}
|
|
162
|
+
style={{ ...view_styles.input, flex:1, maxWidth:150 }}
|
|
163
|
+
onChangeText={(text) => {
|
|
164
|
+
setLinkStatus({
|
|
165
|
+
...link_status,
|
|
166
|
+
draft_generated_link: { ...draft_generated_link, visible_id: text },
|
|
167
|
+
visible_id_valid: false
|
|
168
|
+
})
|
|
169
|
+
}}
|
|
170
|
+
/>
|
|
171
|
+
</View>
|
|
172
|
+
</View>
|
|
173
|
+
</View>
|
|
174
|
+
<View style={{ ...view_styles.body_row }}>
|
|
175
|
+
<View style={{ flex:1 }}>
|
|
176
|
+
<Text theme='header_2'>Link Destination</Text>
|
|
177
|
+
<TextInput
|
|
178
|
+
value={draft_generated_link.redirect_url}
|
|
179
|
+
multiline={true}
|
|
180
|
+
style={{
|
|
181
|
+
...view_styles.input,
|
|
182
|
+
marginTop:4,
|
|
183
|
+
flex:1,
|
|
184
|
+
height: Math.max(link_height, 35) }}
|
|
185
|
+
onContentSizeChange={(ev) => {
|
|
186
|
+
setLinkHeight(ev.nativeEvent.contentSize.height)
|
|
187
|
+
}}
|
|
188
|
+
onChangeText={(text) => {
|
|
189
|
+
let new_params = ShareHelpers.extractQueryParams(text);
|
|
190
|
+
setLinkStatus({
|
|
191
|
+
...link_status,
|
|
192
|
+
draft_generated_link: { ...draft_generated_link, redirect_url: text },
|
|
193
|
+
query_params: new_params
|
|
194
|
+
})
|
|
195
|
+
}}
|
|
196
|
+
/>
|
|
197
|
+
</View>
|
|
198
|
+
</View>
|
|
199
|
+
</View>
|
|
200
|
+
<View style={{ ...view_styles.section_footer }}>
|
|
201
|
+
<Button
|
|
202
|
+
title='Cancel'
|
|
203
|
+
title_color={Colors.shades.white}
|
|
204
|
+
borderRadius={4}
|
|
205
|
+
backgroundColor={Colors.utility.error}
|
|
206
|
+
onPress={() => setLinkStatus({ ...link_status, editing: false, draft_generated_link: generated_link })}
|
|
207
|
+
/>
|
|
208
|
+
<View style={{ flex:1 }}/>
|
|
209
|
+
{needs_verification ?
|
|
210
|
+
<Button
|
|
211
|
+
title='Check Link Availability'
|
|
212
|
+
title_color={Colors.shades.white}
|
|
213
|
+
style={{ opacity:update_loading?0.5:1 }}
|
|
214
|
+
borderRadius={4}
|
|
215
|
+
loading={update_loading}
|
|
216
|
+
backgroundColor={Colors.brand.electric}
|
|
217
|
+
onPress={async() => {
|
|
218
|
+
setLinkStatus({ ...link_status, update_loading: true })
|
|
219
|
+
const is_available = await ShareApi.isGeneratedLinkAvailable(draft_generated_link);
|
|
220
|
+
if(!is_available){
|
|
221
|
+
setLinkStatus({ ...link_status, update_loading: false })
|
|
222
|
+
return alert('Sorry! This link is not available. Please change the visible id portion of the link and try again')
|
|
223
|
+
}
|
|
224
|
+
setLinkStatus({
|
|
225
|
+
...link_status,
|
|
226
|
+
update_loading:false,
|
|
227
|
+
visible_id_valid: true
|
|
228
|
+
})
|
|
229
|
+
}}
|
|
230
|
+
/>
|
|
231
|
+
:
|
|
232
|
+
<Button
|
|
233
|
+
title='Save'
|
|
234
|
+
style={{ opacity:link_is_changed && !update_loading?1:0.5 }}
|
|
235
|
+
disabled={!link_is_changed}
|
|
236
|
+
loading={update_loading}
|
|
237
|
+
title_color={Colors.shades.white}
|
|
238
|
+
borderRadius={4}
|
|
239
|
+
backgroundColor={Colors.utility.success}
|
|
240
|
+
onPress={async() => {
|
|
241
|
+
setLinkStatus({ ...link_status, update_loading: true });
|
|
242
|
+
const new_link = await ShareApi.updateGeneratedLink(draft_generated_link);
|
|
243
|
+
if(!new_link?.generated_link){ return alert('Unable to update link') }
|
|
244
|
+
setLinkStatus({
|
|
245
|
+
...link_status,
|
|
246
|
+
update_loading: false,
|
|
247
|
+
generated_link: new_link?.generated_link,
|
|
248
|
+
url: new_link?.url
|
|
249
|
+
});
|
|
250
|
+
}}
|
|
251
|
+
/>
|
|
252
|
+
}
|
|
253
|
+
</View>
|
|
254
|
+
</View>
|
|
255
|
+
:
|
|
256
|
+
<View style={{ ...view_styles.section_body }}>
|
|
257
|
+
<View style={{ paddingBottom:0 }}>
|
|
258
|
+
<View style={{ ...view_styles.body_row }}>
|
|
259
|
+
<Text size={16} color={Colors.brand.midnight} weight='regular'>Share this link via</Text>
|
|
260
|
+
</View>
|
|
261
|
+
{native_share_allowed() ?
|
|
262
|
+
<TouchableOpacity style={{ ...view_styles.body_row }} onPress={async() => {
|
|
263
|
+
const share_event = await ShareApi.share(title, body, link_status.url, generated_link.generated_link_id);
|
|
264
|
+
if(onEvent && share_event){ onEvent(share_event) }
|
|
265
|
+
}}>
|
|
266
|
+
<View style={{ flexDirection:'row', alignItems:'center', padding:3, paddingRight:10, borderWidth:1, borderRadius:22, borderColor:Colors.highlights.highlight400Faded, backgroundColor: Colors.shades.white, ...view_styles.float }}>
|
|
267
|
+
<View style={{ height:36, width:36, marginRight:10, backgroundColor:Colors.brand.electric, borderRadius:100, justifyContent:'center', alignItems:'center' }}>
|
|
268
|
+
<Icons.ShareIcon size={14} color={Colors.shades.white} />
|
|
269
|
+
</View>
|
|
270
|
+
<FlatList
|
|
271
|
+
horizontal
|
|
272
|
+
data={native_share_options}
|
|
273
|
+
keyExtractor={(item) => item.name}
|
|
274
|
+
renderItem={renderNativeOptions}
|
|
275
|
+
/>
|
|
276
|
+
</View>
|
|
277
|
+
</TouchableOpacity>
|
|
278
|
+
:<></>}
|
|
279
|
+
</View>
|
|
280
|
+
<View style={{ paddingTop:0, }}>
|
|
281
|
+
<View style={{ ...view_styles.body_row }}>
|
|
282
|
+
<Text selectable size={16} color={Colors.brand.midnight} weight='regular'>Copy link</Text>
|
|
283
|
+
</View>
|
|
284
|
+
<View style={{ ...view_styles.body_row, padding:10, borderRadius:4, borderWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
285
|
+
{url ?
|
|
286
|
+
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center', backgroundColor:Colors.brand.electric, padding:10, borderRadius:4 }} onPress={() => Clipboard.setString(url)}>
|
|
287
|
+
<Icons.LinkIcon size={18} color={Colors.shades.white} />
|
|
288
|
+
<Text style={{ marginLeft:4 }} size={12} color={Colors.shades.white} textAlign='left'>Copy</Text>
|
|
289
|
+
</TouchableOpacity>
|
|
290
|
+
:<></>}
|
|
291
|
+
<Text style={{ marginLeft:5, flex:1 }} theme='body'>{url}</Text>
|
|
292
|
+
{allow_edit ?
|
|
293
|
+
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center', backgroundColor:Colors.brand.electric, padding:10, borderRadius:4 }} onPress={() => setLinkStatus({ ...link_status, editing: true })}>
|
|
294
|
+
<Icons.EditIcon size={18} color={Colors.shades.white} />
|
|
295
|
+
</TouchableOpacity>
|
|
296
|
+
:<></>}
|
|
297
|
+
</View>
|
|
298
|
+
</View>
|
|
299
|
+
</View>
|
|
300
|
+
}
|
|
301
|
+
</View>
|
|
302
|
+
: active_tab == 'embed' && embed ?
|
|
303
|
+
<View style={{ ...view_styles.section_body, paddingTop:0 }}>
|
|
304
|
+
<View style={{ ...view_styles.body_row }}>
|
|
305
|
+
<View style={{ flex:1 }}>
|
|
306
|
+
<Text size={16} color={Colors.brand.midnight} weight='regular'>Embed this in your website</Text>
|
|
307
|
+
<Text style={{ marginTop:3 }} theme='body_2'>Copy and past the code snippet below into the 'body' tag</Text>
|
|
308
|
+
</View>
|
|
309
|
+
</View>
|
|
310
|
+
<View style={{ backgroundColor:Colors.shades.shade100, padding:10 }}>
|
|
311
|
+
<Text selectable size={14} color={Colors.brand.midnight}>{embed.embed_code}</Text>
|
|
312
|
+
<View style={{ ...view_styles.body_row }}>
|
|
313
|
+
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center', backgroundColor:Colors.brand.electric, padding:10, borderRadius:4 }}
|
|
314
|
+
onPress={() => Clipboard.setString(embed.embed_code)}>
|
|
315
|
+
<Icons.LinkIcon size={18} color={Colors.shades.white} />
|
|
316
|
+
<Text style={{ marginLeft:4 }} size={12} color={Colors.shades.white} textAlign='left'>Copy</Text>
|
|
317
|
+
</TouchableOpacity>
|
|
318
|
+
<View style={{ flex:1 }} />
|
|
319
|
+
{embed.widget_element && embed.script_source && embed.div_id ?
|
|
320
|
+
<Button
|
|
321
|
+
title={preview_embed ? 'Hide Preview' : 'Show Preview'}
|
|
322
|
+
title_color={Colors.shades.white}
|
|
323
|
+
borderRadius={4}
|
|
324
|
+
padding={10}
|
|
325
|
+
backgroundColor={preview_embed ? Colors.utility.error : Colors.brand.cyan}
|
|
326
|
+
onPress={() => setPreviewEmbed(!preview_embed)}
|
|
327
|
+
/>
|
|
328
|
+
:<></>}
|
|
329
|
+
</View>
|
|
330
|
+
</View>
|
|
331
|
+
|
|
332
|
+
{preview_embed && embed.widget_element && embed.script_source && embed.div_id ?
|
|
333
|
+
<View style={{ borderWidth:1, borderRadius:4, borderColor:Colors.brand.slate }}>
|
|
334
|
+
<EmbedPreview
|
|
335
|
+
script_source={embed.script_source}
|
|
336
|
+
widget_element={embed.widget_element}
|
|
337
|
+
div_id={embed.div_id}
|
|
338
|
+
/>
|
|
339
|
+
</View>
|
|
340
|
+
|
|
341
|
+
:<></>}
|
|
342
|
+
</View>
|
|
343
|
+
:<></>}
|
|
344
|
+
{active_tab == 'embed' ?
|
|
345
|
+
<TouchableOpacity style={{ ...view_styles.section_footer }} onPress={() => setActiveTab('link')}>
|
|
346
|
+
<View style={{ flex:1, marginRight:10 }}>
|
|
347
|
+
<Text theme='header'>Share Link Options</Text>
|
|
348
|
+
<Text style={{ marginTop:3 }} theme='body'>Customize the link and share</Text>
|
|
349
|
+
</View>
|
|
350
|
+
<View style={{ height:30, width:30, borderRadius:100, backgroundColor:Colors.shades.white, justifyContent:'center', alignItems:'center' }}>
|
|
351
|
+
<Icons.LinkIcon color={Colors.brand.midnight} size={18}/>
|
|
352
|
+
</View>
|
|
353
|
+
</TouchableOpacity>
|
|
354
|
+
: active_tab == 'link' ?
|
|
355
|
+
<TouchableOpacity style={{ ...view_styles.section_footer }} onPress={() => setActiveTab('embed')}>
|
|
356
|
+
<View style={{ flex:1, marginRight:10 }}>
|
|
357
|
+
<Text theme='header'>Available For Embed</Text>
|
|
358
|
+
<Text style={{ marginTop:3 }} theme='body'>Copy code snippet and paste into the html of your website</Text>
|
|
359
|
+
</View>
|
|
360
|
+
<View style={{ height:30, width:30, borderRadius:100, backgroundColor:Colors.shades.white, justifyContent:'center', alignItems:'center' }}>
|
|
361
|
+
<Icons.EmbedIcon color={Colors.brand.midnight} size={18}/>
|
|
362
|
+
</View>
|
|
363
|
+
</TouchableOpacity>
|
|
364
|
+
:<></>}
|
|
365
|
+
</ScrollView>
|
|
366
|
+
</View>
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export default ShareWidget
|
package/src/Squares/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react"
|
|
2
2
|
import { ActivityIndicator, View, Image, TouchableOpacity, ScrollView } from 'react-native';
|
|
3
|
-
import type { BuySquaresResponseProps, EventProps, LeagueProps, OfferResponseProps, PlayerBalanceProps, PlayerSquareProps, PublicPlayerProps, SquareOfferProps, SquarePrizeProps, SquareProps, SquareResultProps, SquaresCompetitionProps, SquaresPayoutProps, SquaresTypeProps } from "../types"
|
|
3
|
+
import type { BEEventProps, BuySquaresResponseProps, EventProps, LeagueProps, OfferResponseProps, PlayerBalanceProps, PlayerSquareProps, PublicPlayerProps, SquareOfferProps, SquarePrizeProps, SquareProps, SquareResultProps, SquaresCompetitionProps, SquaresPayoutProps, SquaresTypeProps } from "../types"
|
|
4
4
|
import Colors from "../constants/colors";
|
|
5
5
|
import { SqauresHelpers, SquaresApi } from "./api";
|
|
6
6
|
import { Button, Icons, Text } from "../Components";
|
|
@@ -12,7 +12,6 @@ import ResultsCard from "./components/ResultsCard";
|
|
|
12
12
|
import SquaresDetails from "./components/SquaresDetails";
|
|
13
13
|
import BoardStats from "./components/BoardStats";
|
|
14
14
|
import SquareOwnersCard from "./components/SquareOwners";
|
|
15
|
-
import type { BEEventProps } from "../Observer/api/types";
|
|
16
15
|
import OfferForm from "./components/OfferForm";
|
|
17
16
|
import MySquaresCard from "./components/MySquaresCard";
|
|
18
17
|
import { view_styles } from "../constants/styles";
|
package/src/Wallet/index.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { View, ActivityIndicator, FlatList, TouchableOpacity } from 'react-nativ
|
|
|
3
3
|
import { ItemOrderApi, WalletApi, WalletHelpers } from './api';
|
|
4
4
|
import Colors from '../constants/colors';
|
|
5
5
|
import WalletSetup from './components/WalletSetup';
|
|
6
|
-
import type { AccountProps, CodeRequestProps, ItemOrderProps, ItemProps, MyPlayerProps, PlayerAddressProps, PlayerBalanceProps, PlayerDepositLimitProps, PlayerReferralProps, PlayerWithdrawLimitProps, PromoProps, PublicPlayerProps, RewardOptionProps, WalletSettingsProps } from '../types';
|
|
6
|
+
import type { AccountProps, BEEventProps, CodeRequestProps, ItemOrderProps, ItemProps, MyPlayerProps, PlayerAddressProps, PlayerBalanceProps, PlayerDepositLimitProps, PlayerReferralProps, PlayerWithdrawLimitProps, PromoProps, PublicPlayerProps, RewardOptionProps, WalletSettingsProps } from '../types';
|
|
7
7
|
import MyBalance from './components/MyBalance';
|
|
8
8
|
import ManualCardAdd from './components/ManualCardAdd';
|
|
9
9
|
import DepositCard from './components/DepositCard';
|
|
@@ -24,7 +24,6 @@ import WalletActionSelector from './components/WalletActionSelector';
|
|
|
24
24
|
import ACHAddCard from './components/ACHAddCard';
|
|
25
25
|
import OrderManager from './components/OrderManager';
|
|
26
26
|
import WalletSettings from './components/WalletSettings';
|
|
27
|
-
import type { BEEventProps } from '../Observer/api/types';
|
|
28
27
|
|
|
29
28
|
type MyWalletProps = {
|
|
30
29
|
account_id?:string,
|
package/src/index.tsx
CHANGED
|
@@ -27,8 +27,10 @@ import SeasonModule from "./CompetitionSeason";
|
|
|
27
27
|
import CreateSeasonForm from "./CompetitionSeasonManager/components/CreateSeasonForm";
|
|
28
28
|
import MarketComponents from './MarketComponents';
|
|
29
29
|
import EventComponents from './EventComponents';
|
|
30
|
-
|
|
30
|
+
import Share from './Share';
|
|
31
31
|
import LocationTracker from "./LocationTracker";
|
|
32
|
+
|
|
33
|
+
|
|
32
34
|
export {
|
|
33
35
|
Authenticator,
|
|
34
36
|
Observer,
|
|
@@ -45,6 +47,7 @@ export {
|
|
|
45
47
|
BettorSearch,
|
|
46
48
|
Colors,
|
|
47
49
|
MyWallet,
|
|
50
|
+
Share,
|
|
48
51
|
Checkout,
|
|
49
52
|
MarketComponents,
|
|
50
53
|
EventComponents,
|
package/src/types.d.ts
CHANGED
|
@@ -1689,6 +1689,44 @@ export interface EventOrderStatProps {
|
|
|
1689
1689
|
market_type: string;
|
|
1690
1690
|
}
|
|
1691
1691
|
|
|
1692
|
+
export type EventNameTypes = 'generated_link' |'incoming_user' |'identify_user' |'visibility_on' |'visibility_off'|
|
|
1693
|
+
'page_hit'|'sign_up'|'game_view'|'game_join'|'game_result'|'order_create'|'order_result'|'vouch_start'|'vouch_attempt'|
|
|
1694
|
+
'account_add_start'|'account_add_result'|'transaction_attempt'|'transaction_result'|'message_support'|'room_view'|'view_social'|
|
|
1695
|
+
'view_market'|'interact_social'|'wallet_view'|'redeem_code'|'viewed_notification_prompt'|'notification_enabled'|'viewed_pwa_prompt'|'pwa_installed' | string
|
|
1696
|
+
|
|
1697
|
+
export interface BEEventProps {
|
|
1698
|
+
//be_event_id?:string,
|
|
1699
|
+
event_name:EventNameTypes,
|
|
1700
|
+
distinct_id?:string,
|
|
1701
|
+
session_id?:string,
|
|
1702
|
+
reference_id?:string,
|
|
1703
|
+
player_id?:string,
|
|
1704
|
+
event_data:any,
|
|
1705
|
+
source?:string,
|
|
1706
|
+
source_type?:'client'|'server'
|
|
1707
|
+
device_data?:any,
|
|
1708
|
+
ip_address?:string,
|
|
1709
|
+
coords?: any,
|
|
1710
|
+
level:number,
|
|
1711
|
+
//create_datetime?:any,
|
|
1712
|
+
//last_update_datetime?:any
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
export interface GeneratedLinkProps {
|
|
1716
|
+
generated_link_id?:string,
|
|
1717
|
+
visible_id?:string,
|
|
1718
|
+
redirect_url: string,
|
|
1719
|
+
generator_id?:string,
|
|
1720
|
+
generator:'player'|'company'|'tool'
|
|
1721
|
+
link_type: 'user_generated_link'|'brand_generated_link'|'bettoredge_tool'|'marketing'|'widget',
|
|
1722
|
+
link_sub_type: 'user_referral_link'|'h2h_share_link'|'social_post_link'|'podcast_link'|'competition_link'|'bracket_link'|'squares_link'|'room_link'|'poll_link'
|
|
1723
|
+
company_id?:string,
|
|
1724
|
+
type_id?:string,
|
|
1725
|
+
status?:string,
|
|
1726
|
+
distinct_id?:string,
|
|
1727
|
+
create_datetime?:any,
|
|
1728
|
+
last_update_datetime?:any
|
|
1729
|
+
}
|
|
1692
1730
|
|
|
1693
1731
|
export interface OrderProps {
|
|
1694
1732
|
order_id:string; //Primary key of the order
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["Observer/api/types.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["Observer/api/types.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export type EventNameTypes = 'generated_link' |'incoming_user' |'identify_user' |'visibility_on' |'visibility_off'|
|
|
2
|
-
'page_hit'|'sign_up'|'game_view'|'game_join'|'game_result'|'order_create'|'order_result'|'vouch_start'|'vouch_attempt'|
|
|
3
|
-
'account_add_start'|'account_add_result'|'transaction_attempt'|'transaction_result'|'message_support'|'room_view'|'view_social'|
|
|
4
|
-
'view_market'|'interact_social'|'wallet_view'|'redeem_code'|'viewed_notification_prompt'|'notification_enabled'|'viewed_pwa_prompt'|'pwa_installed' | string
|
|
5
|
-
|
|
6
|
-
export interface BEEventProps {
|
|
7
|
-
//be_event_id?:string,
|
|
8
|
-
event_name:EventNameTypes,
|
|
9
|
-
distinct_id?:string,
|
|
10
|
-
session_id?:string,
|
|
11
|
-
reference_id?:string,
|
|
12
|
-
player_id?:string,
|
|
13
|
-
event_data:any,
|
|
14
|
-
source?:string,
|
|
15
|
-
source_type?:'client'|'server'
|
|
16
|
-
device_data?:any,
|
|
17
|
-
ip_address?:string,
|
|
18
|
-
coords?: any,
|
|
19
|
-
level:number,
|
|
20
|
-
//create_datetime?:any,
|
|
21
|
-
//last_update_datetime?:any
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface GeneratedLinkProps {
|
|
25
|
-
generated_link_id?:string,
|
|
26
|
-
visible_id?:string,
|
|
27
|
-
redirect_url: string,
|
|
28
|
-
generator_id?:string,
|
|
29
|
-
generator:'player'|'company'|'tool'
|
|
30
|
-
link_type: 'user_generated_link'|'brand_generated_link'|'bettoredge_tool'|'marketing'|'widget',
|
|
31
|
-
link_sub_type: 'user_referral_link'|'h2h_share_link'|'social_post_link'|'podcast_link'|'competition_link'|'bracket_link'|'squares_link'|'room_link'|'poll_link'
|
|
32
|
-
company_id?:string,
|
|
33
|
-
type_id?:string,
|
|
34
|
-
status?:string,
|
|
35
|
-
distinct_id?:string,
|
|
36
|
-
create_datetime?:any,
|
|
37
|
-
last_update_datetime?:any
|
|
38
|
-
}
|