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