be-components 7.1.4 → 7.1.6

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 (103) hide show
  1. package/lib/commonjs/PartnerPortal/api/index.js +373 -0
  2. package/lib/commonjs/PartnerPortal/api/index.js.map +1 -0
  3. package/lib/commonjs/PartnerPortal/components/CompetitionSelector.js +120 -0
  4. package/lib/commonjs/PartnerPortal/components/CompetitionSelector.js.map +1 -0
  5. package/lib/commonjs/PartnerPortal/components/EmbedManager.js +639 -0
  6. package/lib/commonjs/PartnerPortal/components/EmbedManager.js.map +1 -0
  7. package/lib/commonjs/PartnerPortal/components/FlashSelector.js +120 -0
  8. package/lib/commonjs/PartnerPortal/components/FlashSelector.js.map +1 -0
  9. package/lib/commonjs/PartnerPortal/components/LeagueSelector.js +113 -0
  10. package/lib/commonjs/PartnerPortal/components/LeagueSelector.js.map +1 -0
  11. package/lib/commonjs/PartnerPortal/components/ReferralSelector.js +101 -0
  12. package/lib/commonjs/PartnerPortal/components/ReferralSelector.js.map +1 -0
  13. package/lib/commonjs/PartnerPortal/components/SquaresSelector.js +120 -0
  14. package/lib/commonjs/PartnerPortal/components/SquaresSelector.js.map +1 -0
  15. package/lib/commonjs/PartnerPortal/index.js +854 -0
  16. package/lib/commonjs/PartnerPortal/index.js.map +1 -0
  17. package/lib/commonjs/index.js +14 -0
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/types.d.js.map +1 -1
  20. package/lib/module/PartnerPortal/api/index.js +367 -0
  21. package/lib/module/PartnerPortal/api/index.js.map +1 -0
  22. package/lib/module/PartnerPortal/components/CompetitionSelector.js +112 -0
  23. package/lib/module/PartnerPortal/components/CompetitionSelector.js.map +1 -0
  24. package/lib/module/PartnerPortal/components/EmbedManager.js +631 -0
  25. package/lib/module/PartnerPortal/components/EmbedManager.js.map +1 -0
  26. package/lib/module/PartnerPortal/components/FlashSelector.js +112 -0
  27. package/lib/module/PartnerPortal/components/FlashSelector.js.map +1 -0
  28. package/lib/module/PartnerPortal/components/LeagueSelector.js +106 -0
  29. package/lib/module/PartnerPortal/components/LeagueSelector.js.map +1 -0
  30. package/lib/module/PartnerPortal/components/ReferralSelector.js +93 -0
  31. package/lib/module/PartnerPortal/components/ReferralSelector.js.map +1 -0
  32. package/lib/module/PartnerPortal/components/SquaresSelector.js +112 -0
  33. package/lib/module/PartnerPortal/components/SquaresSelector.js.map +1 -0
  34. package/lib/module/PartnerPortal/index.js +846 -0
  35. package/lib/module/PartnerPortal/index.js.map +1 -0
  36. package/lib/module/index.js +3 -1
  37. package/lib/module/index.js.map +1 -1
  38. package/lib/module/types.d.js.map +1 -1
  39. package/lib/typescript/lib/commonjs/PartnerPortal/api/index.d.ts +47 -0
  40. package/lib/typescript/lib/commonjs/PartnerPortal/api/index.d.ts.map +1 -0
  41. package/lib/typescript/lib/commonjs/PartnerPortal/components/CompetitionSelector.d.ts +9 -0
  42. package/lib/typescript/lib/commonjs/PartnerPortal/components/CompetitionSelector.d.ts.map +1 -0
  43. package/lib/typescript/lib/commonjs/PartnerPortal/components/EmbedManager.d.ts +13 -0
  44. package/lib/typescript/lib/commonjs/PartnerPortal/components/EmbedManager.d.ts.map +1 -0
  45. package/lib/typescript/lib/commonjs/PartnerPortal/components/FlashSelector.d.ts +9 -0
  46. package/lib/typescript/lib/commonjs/PartnerPortal/components/FlashSelector.d.ts.map +1 -0
  47. package/lib/typescript/lib/commonjs/PartnerPortal/components/LeagueSelector.d.ts +7 -0
  48. package/lib/typescript/lib/commonjs/PartnerPortal/components/LeagueSelector.d.ts.map +1 -0
  49. package/lib/typescript/lib/commonjs/PartnerPortal/components/ReferralSelector.d.ts +9 -0
  50. package/lib/typescript/lib/commonjs/PartnerPortal/components/ReferralSelector.d.ts.map +1 -0
  51. package/lib/typescript/lib/commonjs/PartnerPortal/components/SquaresSelector.d.ts +9 -0
  52. package/lib/typescript/lib/commonjs/PartnerPortal/components/SquaresSelector.d.ts.map +1 -0
  53. package/lib/typescript/lib/commonjs/PartnerPortal/index.d.ts +13 -0
  54. package/lib/typescript/lib/commonjs/PartnerPortal/index.d.ts.map +1 -0
  55. package/lib/typescript/lib/commonjs/index.d.ts +2 -0
  56. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  57. package/lib/typescript/lib/module/PartnerPortal/api/index.d.ts +46 -0
  58. package/lib/typescript/lib/module/PartnerPortal/api/index.d.ts.map +1 -0
  59. package/lib/typescript/lib/module/PartnerPortal/components/CompetitionSelector.d.ts +9 -0
  60. package/lib/typescript/lib/module/PartnerPortal/components/CompetitionSelector.d.ts.map +1 -0
  61. package/lib/typescript/lib/module/PartnerPortal/components/EmbedManager.d.ts +13 -0
  62. package/lib/typescript/lib/module/PartnerPortal/components/EmbedManager.d.ts.map +1 -0
  63. package/lib/typescript/lib/module/PartnerPortal/components/FlashSelector.d.ts +9 -0
  64. package/lib/typescript/lib/module/PartnerPortal/components/FlashSelector.d.ts.map +1 -0
  65. package/lib/typescript/lib/module/PartnerPortal/components/LeagueSelector.d.ts +7 -0
  66. package/lib/typescript/lib/module/PartnerPortal/components/LeagueSelector.d.ts.map +1 -0
  67. package/lib/typescript/lib/module/PartnerPortal/components/ReferralSelector.d.ts +9 -0
  68. package/lib/typescript/lib/module/PartnerPortal/components/ReferralSelector.d.ts.map +1 -0
  69. package/lib/typescript/lib/module/PartnerPortal/components/SquaresSelector.d.ts +9 -0
  70. package/lib/typescript/lib/module/PartnerPortal/components/SquaresSelector.d.ts.map +1 -0
  71. package/lib/typescript/lib/module/PartnerPortal/index.d.ts +13 -0
  72. package/lib/typescript/lib/module/PartnerPortal/index.d.ts.map +1 -0
  73. package/lib/typescript/lib/module/index.d.ts +3 -1
  74. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  75. package/lib/typescript/src/PartnerPortal/api/index.d.ts +75 -0
  76. package/lib/typescript/src/PartnerPortal/api/index.d.ts.map +1 -0
  77. package/lib/typescript/src/PartnerPortal/components/CompetitionSelector.d.ts +11 -0
  78. package/lib/typescript/src/PartnerPortal/components/CompetitionSelector.d.ts.map +1 -0
  79. package/lib/typescript/src/PartnerPortal/components/EmbedManager.d.ts +16 -0
  80. package/lib/typescript/src/PartnerPortal/components/EmbedManager.d.ts.map +1 -0
  81. package/lib/typescript/src/PartnerPortal/components/FlashSelector.d.ts +11 -0
  82. package/lib/typescript/src/PartnerPortal/components/FlashSelector.d.ts.map +1 -0
  83. package/lib/typescript/src/PartnerPortal/components/LeagueSelector.d.ts +9 -0
  84. package/lib/typescript/src/PartnerPortal/components/LeagueSelector.d.ts.map +1 -0
  85. package/lib/typescript/src/PartnerPortal/components/ReferralSelector.d.ts +11 -0
  86. package/lib/typescript/src/PartnerPortal/components/ReferralSelector.d.ts.map +1 -0
  87. package/lib/typescript/src/PartnerPortal/components/SquaresSelector.d.ts +11 -0
  88. package/lib/typescript/src/PartnerPortal/components/SquaresSelector.d.ts.map +1 -0
  89. package/lib/typescript/src/PartnerPortal/index.d.ts +15 -0
  90. package/lib/typescript/src/PartnerPortal/index.d.ts.map +1 -0
  91. package/lib/typescript/src/index.d.ts +3 -1
  92. package/lib/typescript/src/index.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/src/PartnerPortal/api/index.ts +314 -0
  95. package/src/PartnerPortal/components/CompetitionSelector.tsx +88 -0
  96. package/src/PartnerPortal/components/EmbedManager.tsx +364 -0
  97. package/src/PartnerPortal/components/FlashSelector.tsx +88 -0
  98. package/src/PartnerPortal/components/LeagueSelector.tsx +76 -0
  99. package/src/PartnerPortal/components/ReferralSelector.tsx +63 -0
  100. package/src/PartnerPortal/components/SquaresSelector.tsx +88 -0
  101. package/src/PartnerPortal/index.tsx +475 -0
  102. package/src/index.tsx +5 -0
  103. package/src/types.d.ts +29 -0
@@ -0,0 +1,88 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import type { SquaresCompetitionProps } from "../../types";
3
+ import { useColors } from "../../constants/useColors";
4
+ import { Button, Text, View } from "../../Components/Themed";
5
+ import { FlatList, Image } from "react-native";
6
+ import { Checkbox, Icons, SearchBox } from "../../Components";
7
+ import moment from "moment-mini";
8
+ import { PartnerPortalApi } from "../api";
9
+
10
+ type SquaresSelectorProps = {
11
+ company_id:string,
12
+ active_competitions:string[],
13
+ onSelectCompetition:(sc:SquaresCompetitionProps) => void,
14
+ onDeselectCompetition:(sc:SquaresCompetitionProps) => void
15
+ }
16
+ const SquaresSelector = ({ company_id, active_competitions, onSelectCompetition, onDeselectCompetition }:SquaresSelectorProps) => {
17
+ const Colors = useColors();
18
+ const [ visible, setVisible ] = useState(false);
19
+ const [ competitions, setCompetitions ] = useState<SquaresCompetitionProps[]>([])
20
+ const [ search, setSearch ] = useState('');
21
+
22
+ const filtered_competitions = competitions.filter(pr => pr.sq_comp_name.toLowerCase().includes(search.toLowerCase())).slice(0,10)
23
+
24
+ useEffect(() => {
25
+ getCompetitions()
26
+ },[company_id]);
27
+
28
+ const getCompetitions = async() => {
29
+ PartnerPortalApi.setEnvironment();
30
+ const s_resp = await PartnerPortalApi.EngagementApi.getActiveSquaresCompetitions(company_id);
31
+ setCompetitions(s_resp);
32
+ }
33
+
34
+ const renderCompetitions = (data:{ item:SquaresCompetitionProps, index:number }) => {
35
+ const selected = active_competitions.includes(data.item.sq_comp_id.toString());
36
+
37
+ return (
38
+ <Button
39
+ transparent
40
+ style={{ flexDirection:'row', alignItems:'center', padding:10, borderRadius:0, borderBottomWidth:1, borderColor:Colors.borders.light }}
41
+ onPress={() => {
42
+ if(selected){ return onDeselectCompetition(data.item) }
43
+ return onSelectCompetition(data.item);
44
+ }}
45
+ >
46
+ <Image
47
+ source={{ uri: data.item.image?.url }}
48
+ style={{ height: 35, width:35 }}
49
+ resizeMode="cover"
50
+ />
51
+ <View transparent style={{ flex:1, marginLeft:10 }}>
52
+ <Text theme='h1'>{data.item.sq_comp_name}</Text>
53
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.sq_comp_description}</Text>
54
+ </View>
55
+ <Checkbox
56
+ checked={selected}
57
+ disabled
58
+ onSelect={() => console.log('')}
59
+ />
60
+ </Button>
61
+ )
62
+ }
63
+
64
+ return (
65
+ <View float style={{ padding:15 }}>
66
+ <Button transparent style={{ padding:0, flexDirection:'row', alignItems:'center' }} onPress={() => setVisible(!visible)}>
67
+ <Text style={{ flex:1, marginRight:10 }} theme='h1'>{active_competitions.length} Comeptitions</Text>
68
+ <Icons.ChevronIcon direction={visible?'up':'down'} color={Colors.text.h1} size={8} />
69
+ </Button>
70
+ {visible ?
71
+ <View transparent style={{ marginTop:20 }}>
72
+ <SearchBox
73
+ onChange={(text) => setSearch(text)}
74
+ hide_search_button
75
+ />
76
+ <FlatList
77
+ data={filtered_competitions.sort((a,b) => moment(a.begin_datetime).unix() - moment(b.begin_datetime).unix())}
78
+ key={'comp_selector'}
79
+ keyExtractor={item => item.sq_comp_id.toString()}
80
+ renderItem={renderCompetitions}
81
+ />
82
+ </View>
83
+ :<></>}
84
+ </View>
85
+ )
86
+ }
87
+
88
+ export default SquaresSelector
@@ -0,0 +1,475 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Button, Text, View } from "../Components/Themed"
3
+ import type { BracketCompetitionProps, CompanyEmbedProps, CompanyProps, CompetitionProps, EmbedPropertyProps, EmbedProps, ExternalKeyProps, MyPlayerProps, PollCampaignProps, PublicPlayerProps, SquaresCompetitionProps } from '../types';
4
+ import type { CompanyMemberProps } from '../Authenticator/api/types';
5
+ import { PartnerPortalApi } from './api';
6
+ import { FlatList, Image } from 'react-native';
7
+ import { useColors } from '../constants/useColors';
8
+ import ImageUploader from '../Components/ImageUploader';
9
+ import moment from 'moment-mini';
10
+ import { Icons } from '../Components';
11
+
12
+ type PartnerPortalProps = {
13
+ me:MyPlayerProps,
14
+ company_id:string,
15
+ onCreateEngagement: (init_engagement?:string) => void,
16
+ onSelectCompanyEmbed: (company_embed:CompanyEmbedProps) => void,
17
+ onSelectCompetition: (competition:CompetitionProps) => void,
18
+ onSelectBracketCompetition:(bracket_competition:BracketCompetitionProps) => void,
19
+ onSelectSquaresCompetition: (squares_competition:SquaresCompetitionProps) => void,
20
+ onSelectFlashCampaign: (flash_campaign:PollCampaignProps) => void
21
+ }
22
+
23
+ const sections = ['top_row','second_row','third_row']
24
+
25
+ const PartnerPortal = ({ me, company_id, onCreateEngagement, onSelectBracketCompetition, onSelectCompanyEmbed, onSelectCompetition, onSelectFlashCampaign, onSelectSquaresCompetition }:PartnerPortalProps) => {
26
+ const Colors = useColors();
27
+ const [ engagement_state, setEngagementState ] = useState<{
28
+ loading: boolean,
29
+ competitions:CompetitionProps[],
30
+ squares_competitions:SquaresCompetitionProps[],
31
+ bracket_competitions:BracketCompetitionProps[],
32
+ flash_campaigns:PollCampaignProps[],
33
+ embeds:EmbedProps[],
34
+ embed_properties:EmbedPropertyProps[],
35
+ company_embeds:CompanyEmbedProps[]
36
+ }>({
37
+ loading:false,
38
+ competitions: [],
39
+ squares_competitions: [],
40
+ bracket_competitions: [],
41
+ flash_campaigns:[],
42
+ embeds:[],
43
+ embed_properties: [],
44
+ company_embeds:[]
45
+ });
46
+ const { competitions, squares_competitions, bracket_competitions, flash_campaigns, embeds, company_embeds } = engagement_state;
47
+ const [ state, setState ] = useState<{
48
+ loading: boolean,
49
+ company?:CompanyProps,
50
+ my_member?:CompanyMemberProps,
51
+ company_members:CompanyMemberProps[],
52
+ external_keys:ExternalKeyProps[],
53
+ players:PublicPlayerProps[],
54
+ }>({
55
+ loading:false,
56
+ company_members: [],
57
+ external_keys: [],
58
+ players: []
59
+ })
60
+ const { company, external_keys, players, company_members } = state;
61
+
62
+ useEffect(() => {
63
+ PartnerPortalApi.setEnvironment();
64
+ getStateData();
65
+ getActiveEngagementData();
66
+ },[me.player_id, company_id]);
67
+
68
+ const getStateData = async() => {
69
+ setState({ ...state, loading:true });
70
+ //First get company data
71
+ const company_response = await PartnerPortalApi.CompanyApi.getCompanyById(company_id);
72
+ let player_ids = company_response ? company_response.company_members.map(cm => cm.player_id) : []
73
+ const s_playes = await PartnerPortalApi.getPlayersByPlayerIds(player_ids);
74
+ const my_co_member = company_response?.company_members.find(cm => cm.player_id == me.player_id);
75
+ const s_keys = await PartnerPortalApi.CompanyApi.getApiKeys(company_id);
76
+ setState({
77
+ ...state,
78
+ loading: false,
79
+ company: company_response?.company,
80
+ external_keys: s_keys,
81
+ players: s_playes,
82
+ my_member:my_co_member,
83
+ company_members: company_response?.company_members ?? []
84
+ });
85
+ }
86
+
87
+ const getActiveEngagementData = async() => {
88
+ setEngagementState({ ...engagement_state, loading:true });
89
+ //Now lets grab our engagements
90
+ const s_comps = await PartnerPortalApi.EngagementApi.getActiveCompetitions(company_id);
91
+ const s_squares = await PartnerPortalApi.EngagementApi.getActiveSquaresCompetitions(company_id);
92
+ const s_brackets = await PartnerPortalApi.EngagementApi.getActiveBracketCompetitions(company_id);
93
+
94
+ const s_embeds = await PartnerPortalApi.CompanyEmbedApi.getEmbedsByCompanyId(company_id, 0);
95
+ const s_flash = await PartnerPortalApi.EngagementApi.getActiveFlashCampaigns(company_id);
96
+ setEngagementState({
97
+ ...engagement_state,
98
+ loading:false,
99
+ competitions: s_comps.competitions,
100
+ squares_competitions: s_squares,
101
+ bracket_competitions: s_brackets,
102
+ company_embeds: s_embeds.company_embeds,
103
+ embeds:s_embeds.embeds,
104
+ flash_campaigns: s_flash,
105
+ embed_properties:s_embeds.embed_properties
106
+ })
107
+ }
108
+
109
+ const renderCompetitions = (data:{ item:CompetitionProps, index:number }) => {
110
+ return (
111
+ <Button
112
+ transparent
113
+ style={{ padding:10, borderRadius:0, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}
114
+ onPress={() => onSelectCompetition(data.item)}>
115
+ <Image
116
+ source={{ uri: data.item.image?.url }}
117
+ style={{ height:35, width:35, borderRadius:4 }}
118
+ resizeMode='cover'
119
+ />
120
+ <View transparent style={{ flex:1, marginLeft:10 }}>
121
+ <Text theme='h1'>{data.item.competition_name}</Text>
122
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.competition_description}</Text>
123
+ </View>
124
+ </Button>
125
+ )
126
+ }
127
+
128
+ const renderSquares = (data:{ item:SquaresCompetitionProps, index:number }) => {
129
+ return (
130
+ <Button
131
+ transparent
132
+ style={{ padding:10, borderRadius:0, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}
133
+ onPress={() => onSelectSquaresCompetition(data.item)}>
134
+ <Image
135
+ source={{ uri: data.item.image?.url }}
136
+ style={{ height:35, width:35, borderRadius:4 }}
137
+ resizeMode='cover'
138
+ />
139
+ <View transparent style={{ flex:1, marginLeft:10 }}>
140
+ <Text theme='h1'>{data.item.sq_comp_name}</Text>
141
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.sq_comp_description}</Text>
142
+ </View>
143
+ </Button>
144
+ )
145
+ }
146
+
147
+ const renderBrackets = (data:{ item:BracketCompetitionProps, index:number }) => {
148
+ return (
149
+ <Button
150
+ transparent
151
+ style={{ padding:10, borderRadius:0, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}
152
+ onPress={() => onSelectBracketCompetition(data.item)}>
153
+ <Image
154
+ source={{ uri: data.item.image?.url }}
155
+ style={{ height:35, width:35, borderRadius:4 }}
156
+ resizeMode='cover'
157
+ />
158
+ <View transparent style={{ flex:1, marginLeft:10 }}>
159
+ <Text theme='h1'>{data.item.competition_name}</Text>
160
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.competition_description}</Text>
161
+ </View>
162
+ </Button>
163
+ )
164
+ }
165
+
166
+ const renderKeys = (data:{ item:ExternalKeyProps, index:number }) => {
167
+ return (
168
+ <Button
169
+ transparent
170
+ style={{ padding:10, borderRadius:0, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}
171
+ onPress={() => console.log(data.item)}>
172
+ <Icons.LinkIcon size={40} color={Colors.text.h1} />
173
+ <View transparent style={{ flex:1, marginLeft:10 }}>
174
+ <Text theme='h2'>{data.item.key}</Text>
175
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.key_source}</Text>
176
+ </View>
177
+ </Button>
178
+ )
179
+ }
180
+
181
+ const renderFlashCampaigns = (data:{ item:PollCampaignProps, index:number }) => {
182
+ return (
183
+ <Button
184
+ transparent
185
+ style={{ padding:10, borderRadius:0, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}
186
+ onPress={() => onSelectFlashCampaign(data.item)}>
187
+ <Image
188
+ source={{ uri: data.item.campaign_image?.url }}
189
+ style={{ height:35, width:35, borderRadius:4 }}
190
+ resizeMode='cover'
191
+ />
192
+ <View transparent style={{ flex:1, marginLeft:10 }}>
193
+ <Text theme='h1'>{data.item.name}</Text>
194
+ <Text theme='description' style={{ marginTop:3 }}>Flash markets</Text>
195
+ </View>
196
+ </Button>
197
+ )
198
+ }
199
+
200
+ const renderEmbeds = (data:{ item:CompanyEmbedProps, index:number }) => {
201
+ const embed = embeds.find(e => e.embed_id == data.item.embed_id);
202
+ if(!embed){ return <></> }
203
+ return (
204
+ <Button
205
+ transparent
206
+ style={{ padding:10, borderRadius:0, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}
207
+ onPress={() => onSelectCompanyEmbed(data.item)}>
208
+ <Icons.EmbedIcon size={24} color={Colors.text.h1} />
209
+ <View transparent style={{ flex:1, marginLeft:10 }}>
210
+ <Text theme='h1'>{data.item.name}</Text>
211
+ <Text theme='description' style={{ marginTop:3 }}>{embed.name}</Text>
212
+ </View>
213
+ </Button>
214
+ )
215
+ }
216
+
217
+ const renderMembers = (data:{ item:CompanyMemberProps, index:number }) => {
218
+ const player = players.find(p => p.player_id == data.item.player_id);
219
+ if(!player){ return <></> }
220
+ return (
221
+ <View transparent type='row' style={{ padding:10, margin:4, minWidth:300, flexGrow:1, borderBottomWidth:1, borderColor:Colors.borders.light }}>
222
+ <Image
223
+ source={{ uri: player.profile_pic }}
224
+ style={{ height:40, width:40, borderRadius:100 }}
225
+ resizeMode='cover'
226
+ />
227
+ <View transparent style={{ flex:1, marginLeft:10 }}>
228
+ <Text theme='h1'>{player.first_name} {player.last_name}</Text>
229
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.role}</Text>
230
+ </View>
231
+ </View>
232
+ )
233
+ }
234
+
235
+ const renderSections = (data:{ item:string, index:number }) => {
236
+ switch(data.item){
237
+ case 'top_row':
238
+ if(!company){ return <></> }
239
+ //Top Rows will consist of all the metrics
240
+ return (
241
+ <View transparent style={{ flexDirection:'row', flexWrap:'wrap' }}>
242
+
243
+ <View float nativeID='company_info' style={{ flexGrow:1, flexBasis:1, minWidth:200, margin:10 }}>
244
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
245
+ <View transparent style={{ flex:1 }}>
246
+ <Text theme='h1'>Company Information</Text>
247
+ </View>
248
+ </View>
249
+ <View type='body' transparent style={{ padding:10 }}>
250
+ <View transparent type='row'>
251
+ <View transparent style={{ flex:1 }}>
252
+ <Text theme='h1' size={32}>{company.company_name}</Text>
253
+ <Text theme='h2' style={{ marginTop:3, flexWrap:'wrap', flexShrink:1 }} size={14}>{company.company_description} with more long text</Text>
254
+ </View>
255
+ <ImageUploader onFinishUpload={(obj) => console.log(obj.secure_url)} public_id={`company_logo_${company_id}_${Math.random()*100000}`}>
256
+ <Image
257
+ source={{ uri: company.company_image?.url }}
258
+ style={{ height:75, width:75 }}
259
+ resizeMode='contain'
260
+ />
261
+ </ImageUploader>
262
+ </View>
263
+ </View>
264
+ </View>
265
+
266
+ <View float nativeID='company_details' style={{ flexGrow:1, flexBasis:1, minWidth: 200, margin:10 }}>
267
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
268
+ <View transparent style={{ flex:1 }}>
269
+ <Text theme='h1'>Company Members</Text>
270
+ </View>
271
+ <Button
272
+ type='success'
273
+ title='NEW MEMBER'
274
+ style={{ padding:10 }}
275
+ onPress={() => console.log('hey')}
276
+ />
277
+ </View>
278
+ <View transparent style={{ flexDirection:'row', flexWrap:'wrap'}}>
279
+ {company_members.map((m,i) => {
280
+ return renderMembers({ item: m, index:i })
281
+ })}
282
+ </View>
283
+ </View>
284
+
285
+ <View float nativeID='company_competitions' style={{ flexGrow:1, flexBasis:1, minWidth:300, margin:10 }}>
286
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
287
+ <View transparent style={{ flex:1 }}>
288
+ <Text theme='h1'>Keys</Text>
289
+ <Text theme='description' style={{ marginTop:3 }}>Your active API Keys</Text>
290
+ </View>
291
+ <Button
292
+ title='REQUEST'
293
+ type='success'
294
+ style={{ padding:10 }}
295
+ onPress={() => console.log('CREATE A NEW KEY!!!')}
296
+ />
297
+ </View>
298
+ <View transparent type='body'>
299
+ <FlatList
300
+ data={external_keys.sort((a,b) => moment(a.create_datetime).unix() - moment(b.create_datetime).unix()).slice(0,3)}
301
+ key={'company_keys'}
302
+ keyExtractor={item => item.external_key_id.toString()}
303
+ renderItem={renderKeys}
304
+ />
305
+ </View>
306
+ </View>
307
+
308
+ </View>
309
+ )
310
+ case 'second_row':
311
+ const active_embeds = company_embeds.length
312
+ return (
313
+ <View transparent style={{ flexDirection:'row', flexWrap:'wrap' }}>
314
+
315
+ <View float nativeID='active_embeds' style={{ minWidth: 250, margin:10 }}>
316
+ <View transparent style={{ flex:1, justifyContent:'center', alignItems:'center', padding:10 }}>
317
+ <Text theme='h1' size={40}>{active_embeds}</Text>
318
+ </View>
319
+ <View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
320
+ <View transparent style={{ flex:1 }}>
321
+ <Text theme='h1' color={Colors.text.success}>Active Embeds</Text>
322
+ </View>
323
+ </View>
324
+ </View>
325
+
326
+ <View float nativeID='company_competitions' style={{ flexGrow:4, flexBasis:4, minWidth:300, margin:10 }}>
327
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
328
+ <View transparent style={{ flex:1 }}>
329
+ <Text theme='h1'>Embeds</Text>
330
+ <Text theme='description' style={{ marginTop:3 }}>Active Embeds</Text>
331
+ </View>
332
+ <Button
333
+ title='CREATE'
334
+ type='success'
335
+ style={{ padding:10 }}
336
+ onPress={() => console.log('CREATE A NEW EMBED!!!')}
337
+ />
338
+ </View>
339
+ <View transparent type='body'>
340
+ <FlatList
341
+ data={company_embeds.sort((a,b) => moment(a.create_datetime).unix() - moment(b.create_datetime).unix())}
342
+ key={'company_embeds'}
343
+ keyExtractor={item => item.company_embed_id.toString()}
344
+ renderItem={renderEmbeds}
345
+ />
346
+ </View>
347
+ </View>
348
+ </View>
349
+ )
350
+ case 'third_row':
351
+ const active_engagements = competitions.length + squares_competitions.length + bracket_competitions.length + flash_campaigns.length
352
+ return (
353
+ <View transparent style={{ flexDirection:'row', flexWrap:'wrap' }}>
354
+
355
+ <View float nativeID='active_engagements' style={{ minWidth: 250, margin:10 }}>
356
+ <View transparent style={{ flex:1, justifyContent:'center', alignItems:'center', padding:10 }}>
357
+ <Text theme='h1' size={40}>{active_engagements}</Text>
358
+ </View>
359
+ <View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
360
+ <View transparent style={{ flex:1 }}>
361
+ <Text theme='h1' color={Colors.text.success}>Active Engagements</Text>
362
+ </View>
363
+ </View>
364
+ </View>
365
+
366
+ <View float nativeID='company_competitions' style={{ flexGrow:1, flexBasis:1, minWidth:300, margin:10 }}>
367
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
368
+ <View transparent style={{ flex:1 }}>
369
+ <Text theme='h1'>Competitions</Text>
370
+ <Text theme='description' style={{ marginTop:3 }}>Pick-ems / Wager competitions that are currently active</Text>
371
+ </View>
372
+ <Button
373
+ title='CREATE'
374
+ type='success'
375
+ style={{ padding:10 }}
376
+ onPress={() => onCreateEngagement('competition')}
377
+ />
378
+ </View>
379
+ <View transparent type='body'>
380
+ <FlatList
381
+ data={competitions.sort((a,b) => moment(a.scheduled_datetime).unix() - moment(b.scheduled_datetime).unix())}
382
+ key={'company_comps'}
383
+ keyExtractor={item => item.competition_id.toString()}
384
+ renderItem={renderCompetitions}
385
+ />
386
+ </View>
387
+ </View>
388
+ <View float nativeID='company_squares' style={{ flexGrow:1, flexBasis:1, minWidth:300, margin:10 }}>
389
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
390
+ <View transparent style={{ flex:1 }}>
391
+ <Text theme='h1'>Squares</Text>
392
+ <Text theme='description' style={{ marginTop:3 }}>Bid on squares and win at the end of each quarter</Text>
393
+ </View>
394
+ <Button
395
+ title='CREATE'
396
+ type='success'
397
+ style={{ padding:10 }}
398
+ onPress={() => onCreateEngagement('squares')}
399
+ />
400
+ </View>
401
+ <View transparent type='body'>
402
+ <FlatList
403
+ data={squares_competitions.sort((a,b) => moment(a.begin_datetime).unix() - moment(b.begin_datetime).unix())}
404
+ key={'company_comps'}
405
+ keyExtractor={item => item.sq_comp_id.toString()}
406
+ renderItem={renderSquares}
407
+ />
408
+ </View>
409
+ </View>
410
+
411
+ <View float nativeID='company_brackets' style={{ flexGrow:1, flexBasis:1, minWidth:300, margin:10 }}>
412
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
413
+ <View transparent style={{ flex:1 }}>
414
+ <Text theme='h1'>Brackets</Text>
415
+ <Text theme='description' style={{ marginTop:3 }}>Active Bracket Competitions</Text>
416
+ </View>
417
+ <Button
418
+ title='CREATE'
419
+ type='success'
420
+ style={{ padding:10 }}
421
+ onPress={() => onCreateEngagement('bracket')}
422
+ />
423
+ </View>
424
+ <View transparent type='body'>
425
+ <FlatList
426
+ data={bracket_competitions.sort((a,b) => moment(a.scheduled_datetime).unix() - moment(b.scheduled_datetime).unix())}
427
+ key={'company_comps'}
428
+ keyExtractor={item => item.bracket_competition_id.toString()}
429
+ renderItem={renderBrackets}
430
+ />
431
+ </View>
432
+ </View>
433
+
434
+ <View float nativeID='company_flash' style={{ flexGrow:1, flexBasis:1, minWidth:300, margin:10 }}>
435
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
436
+ <View transparent style={{ flex:1 }}>
437
+ <Text theme='h1'>Flash Market Campaigns</Text>
438
+ <Text theme='description' style={{ marginTop:3 }}>Active Flash Campaigns</Text>
439
+ </View>
440
+ <Button
441
+ title='CREATE'
442
+ type='success'
443
+ style={{ padding:10 }}
444
+ onPress={() => onCreateEngagement('flash')}
445
+ />
446
+ </View>
447
+ <View transparent type='body'>
448
+ <FlatList
449
+ data={flash_campaigns.sort((a,b) => moment(a.create_datetime).unix() - moment(b.create_datetime).unix())}
450
+ key={'company_flash'}
451
+ keyExtractor={item => item.poll_campaign_id.toString()}
452
+ renderItem={renderFlashCampaigns}
453
+ />
454
+ </View>
455
+ </View>
456
+
457
+ </View>
458
+ )
459
+ default: return <></>
460
+ }
461
+ }
462
+
463
+ return (
464
+ <View style={{ flex:1 }}>
465
+ <FlatList
466
+ data={sections}
467
+ key={'partner_portal_sections'}
468
+ keyExtractor={item => item}
469
+ renderItem={renderSections}
470
+ />
471
+ </View>
472
+ )
473
+ }
474
+
475
+ export default PartnerPortal
package/src/index.tsx CHANGED
@@ -63,15 +63,20 @@ import CreateEngagement from './CreateEngagement';
63
63
  import SquaresManager from './SquaresManager';
64
64
  import DiscordConnectionManager from './Discord';
65
65
  import ManageFlashMarket from './FlashMarket/components/ManageFlashMarket';
66
+ import PartnerPortal from './PartnerPortal';
67
+ import EmbedManager from './PartnerPortal/components/EmbedManager';
68
+
66
69
  export {
67
70
  Authenticator,
68
71
  Observer,
69
72
  CreateEngagement,
70
73
  DiscordConnectionManager,
71
74
  BEEventApi,
75
+ EmbedManager,
72
76
  RankingsCard,
73
77
  ManageFlashMarket,
74
78
  BELinkApi,
79
+ PartnerPortal,
75
80
  SquaresManager,
76
81
  GuideView,
77
82
  BetMatch,
package/src/types.d.ts CHANGED
@@ -384,6 +384,31 @@ export interface PodcastEpisodesProps {
384
384
  last_update_datetime: any,
385
385
  }
386
386
 
387
+
388
+ export interface ExternalKeyProps {
389
+ external_key_id:string,
390
+ company_id:string,
391
+ key:string,
392
+ key_level:string,
393
+ key_source:'svc'|'origin',
394
+ status:string,
395
+ origin?:string,
396
+ create_datetime:any,
397
+ last_update_datetime:any,
398
+ expire_datetime:any
399
+ }
400
+
401
+ export interface ExternalKeyRequestProps {
402
+ external_key_request_id:string,
403
+ external_key_id: string,
404
+ status:string,
405
+ operation_name: string,
406
+ error_description: string,
407
+ create_datetime:any,
408
+ last_update_datetime:any,
409
+ invalid_key_attempted?:string
410
+ }
411
+
387
412
  export interface CompanyProps {
388
413
  company_id:string,
389
414
  company_name: string,
@@ -3073,6 +3098,9 @@ export interface EmbedPropertyProps {
3073
3098
  property:string,
3074
3099
  description: string,
3075
3100
  status: 'active'|'archived',
3101
+ component:string,
3102
+ label:string,
3103
+ priority:number
3076
3104
  create_datetime: any,
3077
3105
  last_update_datetime:any
3078
3106
  }
@@ -3081,6 +3109,7 @@ export interface CompanyEmbedProps {
3081
3109
  company_embed_id:string,
3082
3110
  company_id:string,
3083
3111
  identifier:string,
3112
+ name:string,
3084
3113
  status:'pending'|'active'|'inactive'|'archived',
3085
3114
  embed_id:string,
3086
3115
  properties: { [key:string]:any }