be-components 7.2.0 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/PartnerPortal/components/EmbedManager.js +214 -3
- package/lib/commonjs/PartnerPortal/components/EmbedManager.js.map +1 -1
- package/lib/commonjs/PartnerPortal/index.js +5 -2
- package/lib/commonjs/PartnerPortal/index.js.map +1 -1
- package/lib/module/PartnerPortal/components/EmbedManager.js +214 -3
- package/lib/module/PartnerPortal/components/EmbedManager.js.map +1 -1
- package/lib/module/PartnerPortal/index.js +5 -2
- package/lib/module/PartnerPortal/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/PartnerPortal/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/PartnerPortal/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
- package/lib/typescript/lib/module/PartnerPortal/index.d.ts +2 -1
- package/lib/typescript/lib/module/PartnerPortal/index.d.ts.map +1 -1
- package/lib/typescript/src/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
- package/lib/typescript/src/PartnerPortal/index.d.ts +2 -1
- package/lib/typescript/src/PartnerPortal/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/PartnerPortal/components/EmbedManager.tsx +127 -1
- package/src/PartnerPortal/index.tsx +4 -2
- package/src/types.d.ts +1 -0
|
@@ -22,7 +22,7 @@ type EmbedManagerProps = {
|
|
|
22
22
|
company_id:string,
|
|
23
23
|
onClose: () => void
|
|
24
24
|
}
|
|
25
|
-
const sections = ['header','embed','toggle','loading','name','properties','identifer','code']
|
|
25
|
+
const sections = ['header','embed','action','toggle','loading','name','properties','identifer','code']
|
|
26
26
|
const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition, onClose, header_style, footer_style }:EmbedManagerProps) => {
|
|
27
27
|
const Colors = useColors();
|
|
28
28
|
const [ size, setSize ] = useState({ height:0, width:0 });
|
|
@@ -45,6 +45,22 @@ const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition
|
|
|
45
45
|
});
|
|
46
46
|
const { loading, promos, player_referrals, embed, company_embed, embed_properties, draft_company_embed } = embed_data;
|
|
47
47
|
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const isValid = () => {
|
|
51
|
+
if(!company_embed){ return }
|
|
52
|
+
if(!company_embed.name){ return }
|
|
53
|
+
let valid = true
|
|
54
|
+
let props = company_embed.properties
|
|
55
|
+
embed_properties.map(p => {
|
|
56
|
+
if(!p.required){ return }
|
|
57
|
+
let exists = props[p.property]
|
|
58
|
+
if(!exists){ valid = false }
|
|
59
|
+
});
|
|
60
|
+
return valid
|
|
61
|
+
}
|
|
62
|
+
const is_valid = isValid();
|
|
63
|
+
|
|
48
64
|
useEffect(() => {
|
|
49
65
|
PartnerPortalApi.setEnvironment();
|
|
50
66
|
getEmbedData(company_embed_id);
|
|
@@ -81,6 +97,48 @@ const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition
|
|
|
81
97
|
setActionLoading(false);
|
|
82
98
|
}
|
|
83
99
|
|
|
100
|
+
const activate = async() => {
|
|
101
|
+
if(!company_embed){ return }
|
|
102
|
+
if(!is_valid){ return alert('Please complete all properties before activating') }
|
|
103
|
+
setActionLoading(true);
|
|
104
|
+
const new_embed = await PartnerPortalApi.CompanyEmbedApi.activateCompanyEmbed(company_embed.company_embed_id);
|
|
105
|
+
if(!new_embed){ setActionLoading(false); return alert('Unable to activate at this time. Please try again later') }
|
|
106
|
+
setEmbedData({
|
|
107
|
+
...embed_data,
|
|
108
|
+
company_embed: new_embed,
|
|
109
|
+
draft_company_embed: new_embed
|
|
110
|
+
})
|
|
111
|
+
setActionLoading(false);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const archive = async() => {
|
|
115
|
+
if(!company_embed){ return }
|
|
116
|
+
setActionLoading(true);
|
|
117
|
+
const new_embed = await PartnerPortalApi.CompanyEmbedApi.archiveCompanyEmbed(company_embed.company_embed_id);
|
|
118
|
+
if(!new_embed){ setActionLoading(false); return alert('Unable to archive at this time. Please try again later') }
|
|
119
|
+
setEmbedData({
|
|
120
|
+
...embed_data,
|
|
121
|
+
company_embed: new_embed,
|
|
122
|
+
draft_company_embed: new_embed
|
|
123
|
+
})
|
|
124
|
+
setActionLoading(false);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
const deactivate = async() => {
|
|
129
|
+
if(!company_embed){ return }
|
|
130
|
+
setActionLoading(true);
|
|
131
|
+
const new_embed = await PartnerPortalApi.CompanyEmbedApi.deActivateCompanyEmbed(company_embed.company_embed_id);
|
|
132
|
+
if(!new_embed){ setActionLoading(false); return alert('Unable to deactivate at this time. Please try again later') }
|
|
133
|
+
setEmbedData({
|
|
134
|
+
...embed_data,
|
|
135
|
+
company_embed: new_embed,
|
|
136
|
+
draft_company_embed: new_embed
|
|
137
|
+
})
|
|
138
|
+
setActionLoading(false);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
84
142
|
const renderProperties = (data:{ item:EmbedPropertyProps, index:number }) => {
|
|
85
143
|
if(!company_embed || !draft_company_embed){ return <></> }
|
|
86
144
|
const value:string | undefined = draft_company_embed.properties[data.item.property]
|
|
@@ -232,6 +290,66 @@ const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition
|
|
|
232
290
|
</View>
|
|
233
291
|
</ImageBackground>
|
|
234
292
|
)
|
|
293
|
+
case 'action':
|
|
294
|
+
if(!draft_company_embed){ return <></> }
|
|
295
|
+
switch(draft_company_embed.status){
|
|
296
|
+
case 'pending':
|
|
297
|
+
return (
|
|
298
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
299
|
+
<View transparent style={{ flex:1, marginRight:5 }}>
|
|
300
|
+
<Text theme='h1'>Pending</Text>
|
|
301
|
+
<Text theme='description' style={{ marginTop:3 }}>Once ready - press activate for the embed to become usable</Text>
|
|
302
|
+
</View>
|
|
303
|
+
<Button
|
|
304
|
+
title='ACTIVATE'
|
|
305
|
+
type='success'
|
|
306
|
+
loading={action_loading}
|
|
307
|
+
style={{ padding:10, opacity: is_valid ? 1 : 0.5 }}
|
|
308
|
+
onPress={() => activate()}
|
|
309
|
+
/>
|
|
310
|
+
</View>
|
|
311
|
+
)
|
|
312
|
+
case 'inactive':
|
|
313
|
+
return (
|
|
314
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
315
|
+
<View transparent style={{ flex:1, marginRight:5 }}>
|
|
316
|
+
<Text theme='h1'>Inactive</Text>
|
|
317
|
+
<Text theme='description' style={{ marginTop:3 }}>Press activate to reactive it or archive it</Text>
|
|
318
|
+
</View>
|
|
319
|
+
<Button
|
|
320
|
+
title='ACTIVATE'
|
|
321
|
+
type='success'
|
|
322
|
+
loading={action_loading}
|
|
323
|
+
style={{ padding:10, marginRight:5 }}
|
|
324
|
+
onPress={() => activate()}
|
|
325
|
+
/>
|
|
326
|
+
<Button
|
|
327
|
+
title='ARCHIVE'
|
|
328
|
+
type='error'
|
|
329
|
+
loading={action_loading}
|
|
330
|
+
style={{ padding:10 }}
|
|
331
|
+
onPress={() => archive()}
|
|
332
|
+
/>
|
|
333
|
+
</View>
|
|
334
|
+
)
|
|
335
|
+
case 'active':
|
|
336
|
+
return (
|
|
337
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
338
|
+
<View transparent style={{ flex:1, marginRight:5 }}>
|
|
339
|
+
<Text theme='h1'>Deactive</Text>
|
|
340
|
+
<Text theme='description' style={{ marginTop:3 }}>Your embed is active! Press deactivate to stop it</Text>
|
|
341
|
+
</View>
|
|
342
|
+
<Button
|
|
343
|
+
title='DEACTIVATE'
|
|
344
|
+
type='error'
|
|
345
|
+
loading={action_loading}
|
|
346
|
+
style={{ padding:10 }}
|
|
347
|
+
onPress={() => deactivate()}
|
|
348
|
+
/>
|
|
349
|
+
</View>
|
|
350
|
+
)
|
|
351
|
+
default: return <></>
|
|
352
|
+
}
|
|
235
353
|
case 'toggle':
|
|
236
354
|
return (
|
|
237
355
|
<View style={{ padding:10, paddingBottom:0 }}>
|
|
@@ -339,6 +457,13 @@ const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition
|
|
|
339
457
|
keyExtractor={item => item}
|
|
340
458
|
renderItem={renderSections}
|
|
341
459
|
/>
|
|
460
|
+
{company_embed?.status == 'archived' ?
|
|
461
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
462
|
+
<View float style={{ height:200, width:200, justifyContent:'center', alignItems:'center' }}>
|
|
463
|
+
<Text theme='h1' textAlign='center'>EMBED HAS BEEN ARCHIVED</Text>
|
|
464
|
+
</View>
|
|
465
|
+
</View>
|
|
466
|
+
:<></>}
|
|
342
467
|
{draft_company_embed ?
|
|
343
468
|
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, ...footer_style }}>
|
|
344
469
|
<Button
|
|
@@ -347,6 +472,7 @@ const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition
|
|
|
347
472
|
style={{ flex:1 }}
|
|
348
473
|
onPress={() => onClose()}
|
|
349
474
|
/>
|
|
475
|
+
{is_changed}
|
|
350
476
|
<Button
|
|
351
477
|
title='SAVE'
|
|
352
478
|
type='success'
|
|
@@ -12,6 +12,7 @@ import { Icons } from '../Components';
|
|
|
12
12
|
type PartnerPortalProps = {
|
|
13
13
|
me:MyPlayerProps,
|
|
14
14
|
company_id:string,
|
|
15
|
+
refresh_key?:string,
|
|
15
16
|
onCreateEmbed:() => void,
|
|
16
17
|
onCreateEngagement: (init_engagement?:string) => void,
|
|
17
18
|
onSelectCompanyEmbed: (company_embed:CompanyEmbedProps) => void,
|
|
@@ -23,7 +24,7 @@ type PartnerPortalProps = {
|
|
|
23
24
|
|
|
24
25
|
const sections = ['top_row','second_row','third_row']
|
|
25
26
|
|
|
26
|
-
const PartnerPortal = ({ me, company_id, onCreateEngagement, onSelectBracketCompetition, onCreateEmbed, onSelectCompanyEmbed, onSelectCompetition, onSelectFlashCampaign, onSelectSquaresCompetition }:PartnerPortalProps) => {
|
|
27
|
+
const PartnerPortal = ({ me, company_id, refresh_key, onCreateEngagement, onSelectBracketCompetition, onCreateEmbed, onSelectCompanyEmbed, onSelectCompetition, onSelectFlashCampaign, onSelectSquaresCompetition }:PartnerPortalProps) => {
|
|
27
28
|
const Colors = useColors();
|
|
28
29
|
const [ engagement_state, setEngagementState ] = useState<{
|
|
29
30
|
loading: boolean,
|
|
@@ -64,7 +65,7 @@ const PartnerPortal = ({ me, company_id, onCreateEngagement, onSelectBracketComp
|
|
|
64
65
|
PartnerPortalApi.setEnvironment();
|
|
65
66
|
getStateData();
|
|
66
67
|
getActiveEngagementData();
|
|
67
|
-
},[me.player_id, company_id]);
|
|
68
|
+
},[me.player_id, company_id, refresh_key]);
|
|
68
69
|
|
|
69
70
|
const getStateData = async() => {
|
|
70
71
|
setState({ ...state, loading:true });
|
|
@@ -211,6 +212,7 @@ const PartnerPortal = ({ me, company_id, onCreateEngagement, onSelectBracketComp
|
|
|
211
212
|
<Text theme='h1'>{data.item.name}</Text>
|
|
212
213
|
<Text theme='description' style={{ marginTop:3 }}>{embed.name}</Text>
|
|
213
214
|
</View>
|
|
215
|
+
<Text theme='description'>{data.item.status.toUpperCase()}</Text>
|
|
214
216
|
</Button>
|
|
215
217
|
)
|
|
216
218
|
}
|