be-components 0.1.2 → 0.1.3
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/ApiOverrides/index.js +179 -0
- package/lib/commonjs/ApiOverrides/index.js.map +1 -0
- package/lib/commonjs/ApiOverrides/types.d.js.map +1 -0
- package/lib/commonjs/Assets/images/powered_by_be.webp +0 -0
- package/lib/commonjs/Authenticator/Components/LoginForm.js +491 -0
- package/lib/commonjs/Authenticator/Components/LoginForm.js.map +1 -0
- package/lib/commonjs/{AuthenticateWizard → Authenticator}/Components/StrategyForm.js +81 -58
- package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -0
- package/lib/commonjs/{AuthenticateWizard → Authenticator}/api/index.js +31 -36
- package/lib/commonjs/Authenticator/api/index.js.map +1 -0
- package/lib/commonjs/Authenticator/api/types.d.js +2 -0
- package/lib/commonjs/Authenticator/api/types.d.js.map +1 -0
- package/lib/commonjs/{AuthenticateWizard → Authenticator}/index.js +69 -25
- package/lib/commonjs/Authenticator/index.js.map +1 -0
- package/lib/commonjs/Components/Button.js +1 -1
- package/lib/commonjs/Components/Button.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/ImageUploader.js +86 -0
- package/lib/commonjs/Components/ImageUploader.js.map +1 -0
- package/lib/commonjs/Components/Spring.js +16 -6
- package/lib/commonjs/Components/Spring.js.map +1 -1
- package/lib/commonjs/Components/TextInput.js +9 -3
- package/lib/commonjs/Components/TextInput.js.map +1 -1
- package/lib/commonjs/Font.css +4 -4
- package/lib/commonjs/ProfileManager/Components/BasicInfoManager.js +250 -0
- package/lib/commonjs/ProfileManager/Components/BasicInfoManager.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/BasicStatus.js +135 -0
- package/lib/commonjs/ProfileManager/Components/BasicStatus.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/CodeRedeem.js +361 -0
- package/lib/commonjs/ProfileManager/Components/CodeRedeem.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/DOBManager.js +195 -0
- package/lib/commonjs/ProfileManager/Components/DOBManager.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/EmailManager.js +287 -0
- package/lib/commonjs/ProfileManager/Components/EmailManager.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/PasswordManager.js +334 -0
- package/lib/commonjs/ProfileManager/Components/PasswordManager.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/PhoneManager.js +291 -0
- package/lib/commonjs/ProfileManager/Components/PhoneManager.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/ProfilePicManager.js +114 -0
- package/lib/commonjs/ProfileManager/Components/ProfilePicManager.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js +80 -0
- package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +545 -0
- package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -0
- package/lib/commonjs/ProfileManager/Components/VouchCard.js +454 -0
- package/lib/commonjs/ProfileManager/Components/VouchCard.js.map +1 -0
- package/lib/commonjs/ProfileManager/api/index.js +400 -0
- package/lib/commonjs/ProfileManager/api/index.js.map +1 -0
- package/lib/commonjs/ProfileManager/api/types.d.js +2 -0
- package/lib/commonjs/ProfileManager/api/types.d.js.map +1 -0
- package/lib/commonjs/ProfileManager/index.js +128 -0
- package/lib/commonjs/ProfileManager/index.js.map +1 -0
- package/lib/commonjs/constants/styles.js +10 -0
- package/lib/commonjs/constants/styles.js.map +1 -1
- package/lib/commonjs/index.js +24 -10
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/ApiOverrides/index.js +173 -0
- package/lib/module/ApiOverrides/index.js.map +1 -0
- package/lib/module/ApiOverrides/types.d.js.map +1 -0
- package/lib/module/Assets/images/powered_by_be.webp +0 -0
- package/lib/module/Authenticator/Components/LoginForm.js +482 -0
- package/lib/module/Authenticator/Components/LoginForm.js.map +1 -0
- package/lib/module/{AuthenticateWizard → Authenticator}/Components/StrategyForm.js +82 -59
- package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -0
- package/lib/module/{AuthenticateWizard → Authenticator}/api/index.js +31 -36
- package/lib/module/Authenticator/api/index.js.map +1 -0
- package/lib/module/Authenticator/api/types.d.js +2 -0
- package/lib/module/Authenticator/api/types.d.js.map +1 -0
- package/lib/module/Authenticator/index.js +121 -0
- package/lib/module/Authenticator/index.js.map +1 -0
- package/lib/module/Components/Button.js +1 -1
- package/lib/module/Components/Button.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/ImageUploader.js +78 -0
- package/lib/module/Components/ImageUploader.js.map +1 -0
- package/lib/module/Components/Spring.js +17 -7
- package/lib/module/Components/Spring.js.map +1 -1
- package/lib/module/Components/TextInput.js +9 -3
- package/lib/module/Components/TextInput.js.map +1 -1
- package/lib/module/Font.css +4 -4
- package/lib/module/ProfileManager/Components/BasicInfoManager.js +241 -0
- package/lib/module/ProfileManager/Components/BasicInfoManager.js.map +1 -0
- package/lib/module/ProfileManager/Components/BasicStatus.js +128 -0
- package/lib/module/ProfileManager/Components/BasicStatus.js.map +1 -0
- package/lib/module/ProfileManager/Components/CodeRedeem.js +352 -0
- package/lib/module/ProfileManager/Components/CodeRedeem.js.map +1 -0
- package/lib/module/ProfileManager/Components/DOBManager.js +186 -0
- package/lib/module/ProfileManager/Components/DOBManager.js.map +1 -0
- package/lib/module/ProfileManager/Components/EmailManager.js +278 -0
- package/lib/module/ProfileManager/Components/EmailManager.js.map +1 -0
- package/lib/module/ProfileManager/Components/PasswordManager.js +325 -0
- package/lib/module/ProfileManager/Components/PasswordManager.js.map +1 -0
- package/lib/module/ProfileManager/Components/PhoneManager.js +282 -0
- package/lib/module/ProfileManager/Components/PhoneManager.js.map +1 -0
- package/lib/module/ProfileManager/Components/ProfilePicManager.js +107 -0
- package/lib/module/ProfileManager/Components/ProfilePicManager.js.map +1 -0
- package/lib/module/ProfileManager/Components/ProfileWelcome.js +73 -0
- package/lib/module/ProfileManager/Components/ProfileWelcome.js.map +1 -0
- package/lib/module/ProfileManager/Components/ProfileWizard.js +537 -0
- package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -0
- package/lib/module/ProfileManager/Components/VouchCard.js +445 -0
- package/lib/module/ProfileManager/Components/VouchCard.js.map +1 -0
- package/lib/module/ProfileManager/api/index.js +394 -0
- package/lib/module/ProfileManager/api/index.js.map +1 -0
- package/lib/module/ProfileManager/api/types.d.js +2 -0
- package/lib/module/ProfileManager/api/types.d.js.map +1 -0
- package/lib/module/ProfileManager/index.js +119 -0
- package/lib/module/ProfileManager/index.js.map +1 -0
- package/lib/module/constants/styles.js +10 -0
- package/lib/module/constants/styles.js.map +1 -1
- package/lib/module/index.js +7 -3
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/ApiOverrides/index.d.ts +24 -0
- package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -0
- package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts +10 -0
- package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts.map +1 -0
- package/lib/typescript/src/{AuthenticateWizard → Authenticator}/Components/StrategyForm.d.ts +2 -1
- package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts.map +1 -0
- package/lib/typescript/src/{AuthenticateWizard → Authenticator}/api/index.d.ts +16 -8
- package/lib/typescript/src/Authenticator/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Authenticator/index.d.ts +16 -0
- package/lib/typescript/src/Authenticator/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/Icons.d.ts +3 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/ImageUploader.d.ts +11 -0
- package/lib/typescript/src/Components/ImageUploader.d.ts.map +1 -0
- package/lib/typescript/src/Components/Spring.d.ts +2 -1
- package/lib/typescript/src/Components/Spring.d.ts.map +1 -1
- package/lib/typescript/src/Components/TextInput.d.ts +4 -1
- package/lib/typescript/src/Components/TextInput.d.ts.map +1 -1
- package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts +12 -0
- package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts +10 -0
- package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts +11 -0
- package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts +12 -0
- package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts +12 -0
- package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts +12 -0
- package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts +12 -0
- package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts +12 -0
- package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts +11 -0
- package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts +14 -0
- package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts +9 -0
- package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/api/index.d.ts +104 -0
- package/lib/typescript/src/ProfileManager/api/index.d.ts.map +1 -0
- package/lib/typescript/src/ProfileManager/index.d.ts +11 -0
- package/lib/typescript/src/ProfileManager/index.d.ts.map +1 -0
- package/lib/typescript/src/constants/styles.d.ts +10 -0
- package/lib/typescript/src/constants/styles.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +7 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +7 -2
- package/src/ApiOverrides/index.ts +135 -0
- package/src/ApiOverrides/types.d.ts +7 -0
- package/src/Assets/images/powered_by_be.webp +0 -0
- package/src/Authenticator/Components/LoginForm.tsx +298 -0
- package/src/{AuthenticateWizard → Authenticator}/Components/StrategyForm.tsx +54 -40
- package/src/{AuthenticateWizard → Authenticator}/api/index.ts +27 -31
- package/src/{AuthenticateWizard → Authenticator}/api/types.d.ts +11 -28
- package/src/Authenticator/index.tsx +109 -0
- package/src/Components/Button.tsx +1 -1
- package/src/Components/Icons.tsx +59 -0
- package/src/Components/ImageUploader.tsx +104 -0
- package/src/Components/Spring.tsx +16 -11
- package/src/Components/TextInput.tsx +9 -3
- package/src/Font.css +4 -4
- package/src/ProfileManager/Components/BasicInfoManager.tsx +157 -0
- package/src/ProfileManager/Components/BasicStatus.tsx +81 -0
- package/src/ProfileManager/Components/CodeRedeem.tsx +234 -0
- package/src/ProfileManager/Components/DOBManager.tsx +154 -0
- package/src/ProfileManager/Components/EmailManager.tsx +205 -0
- package/src/ProfileManager/Components/PasswordManager.tsx +198 -0
- package/src/ProfileManager/Components/PhoneManager.tsx +210 -0
- package/src/ProfileManager/Components/ProfilePicManager.tsx +81 -0
- package/src/ProfileManager/Components/ProfileWelcome.tsx +53 -0
- package/src/ProfileManager/Components/ProfileWizard.tsx +385 -0
- package/src/ProfileManager/Components/VouchCard.tsx +265 -0
- package/src/ProfileManager/api/index.ts +250 -0
- package/src/ProfileManager/api/types.d.ts +138 -0
- package/src/ProfileManager/index.tsx +84 -0
- package/src/constants/styles.ts +10 -0
- package/src/index.tsx +12 -6
- package/lib/commonjs/AuthenticateWizard/Components/StrategyForm.js.map +0 -1
- package/lib/commonjs/AuthenticateWizard/api/index.js.map +0 -1
- package/lib/commonjs/AuthenticateWizard/api/types.d.js.map +0 -1
- package/lib/commonjs/AuthenticateWizard/index.js.map +0 -1
- package/lib/module/AuthenticateWizard/Components/StrategyForm.js.map +0 -1
- package/lib/module/AuthenticateWizard/api/index.js.map +0 -1
- package/lib/module/AuthenticateWizard/api/types.d.js.map +0 -1
- package/lib/module/AuthenticateWizard/index.js +0 -77
- package/lib/module/AuthenticateWizard/index.js.map +0 -1
- package/lib/typescript/src/AuthenticateWizard/Components/StrategyForm.d.ts.map +0 -1
- package/lib/typescript/src/AuthenticateWizard/api/index.d.ts.map +0 -1
- package/lib/typescript/src/AuthenticateWizard/index.d.ts +0 -15
- package/lib/typescript/src/AuthenticateWizard/index.d.ts.map +0 -1
- package/src/AuthenticateWizard/index.tsx +0 -84
- /package/lib/commonjs/{AuthenticateWizard/api → ApiOverrides}/types.d.js +0 -0
- /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
- /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
- /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
- /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
- /package/lib/module/{AuthenticateWizard/api → ApiOverrides}/types.d.js +0 -0
- /package/lib/module/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
- /package/lib/module/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
- /package/lib/module/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
- /package/lib/module/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
- /package/src/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
- /package/src/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
- /package/src/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
- /package/src/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { View, ActivityIndicator } from 'react-native';
|
|
4
|
+
import { Button, Icons, Text, TextInput } from '../../Components';
|
|
5
|
+
import Colors from '../../constants/colors';
|
|
6
|
+
import type { MyPlayerProps } from '../api/types';
|
|
7
|
+
import { view_styles } from '../../constants/styles';
|
|
8
|
+
import { ProfileApi, ProfileHelpers } from '../api';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type EmailManagerProps = {
|
|
12
|
+
player:MyPlayerProps,
|
|
13
|
+
walkthrough?:boolean,
|
|
14
|
+
onClose:() => void,
|
|
15
|
+
onNext:() => void,
|
|
16
|
+
onPlayerUpdate:(player:MyPlayerProps) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const EmailManager = ({ player, walkthrough, onPlayerUpdate, onNext, onClose }:EmailManagerProps) => {
|
|
20
|
+
const [ loading, setLoading ] = useState(false);
|
|
21
|
+
const [ verify_token, setVerifyToken ] = useState({
|
|
22
|
+
loading:false,
|
|
23
|
+
visible: false,
|
|
24
|
+
token: ''
|
|
25
|
+
})
|
|
26
|
+
const [ draft_player, setDraftPlayer ] = useState<MyPlayerProps>(player)
|
|
27
|
+
const [ update_error, setUpdateError ] = useState<string>();
|
|
28
|
+
const [ verify_error, setVerifyError ] = useState<string>();
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setDraftPlayer(player);
|
|
32
|
+
},[player])
|
|
33
|
+
|
|
34
|
+
const { valid, error } = ProfileHelpers.isEmailValid(draft_player.email)
|
|
35
|
+
|
|
36
|
+
const is_changed = draft_player.email?.toLowerCase() != player.email?.toLowerCase() ? true : false
|
|
37
|
+
const token_valid = verify_token.token != '' ? true : false
|
|
38
|
+
const update_allowed = valid && is_changed ? true : false
|
|
39
|
+
const handleUpdatePlayer = async() => {
|
|
40
|
+
try {
|
|
41
|
+
setLoading(true);
|
|
42
|
+
await ProfileApi.updatePlayerEmail(draft_player.email);
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
setLoading(false);
|
|
45
|
+
setVerifyToken({
|
|
46
|
+
loading:false,
|
|
47
|
+
visible:true,
|
|
48
|
+
token: ''
|
|
49
|
+
})
|
|
50
|
+
}, 1000);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
setLoading(false);
|
|
53
|
+
setUpdateError('Unable to use this email. Please try again')
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const handleVerifyEmail = async() => {
|
|
58
|
+
try {
|
|
59
|
+
console.log(update_error, verify_error)
|
|
60
|
+
setVerifyToken({ ...verify_token, loading:true });
|
|
61
|
+
const player = await ProfileApi.confirmPlayerEmail(verify_token.token);
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
setLoading(false);
|
|
64
|
+
setVerifyToken({
|
|
65
|
+
loading:false,
|
|
66
|
+
visible:false,
|
|
67
|
+
token: ''
|
|
68
|
+
})
|
|
69
|
+
if(onNext){ onNext() }
|
|
70
|
+
}, 1000);
|
|
71
|
+
onPlayerUpdate(player)
|
|
72
|
+
} catch (e) {
|
|
73
|
+
setVerifyToken({ ...verify_token, loading:false });
|
|
74
|
+
setVerifyError('Invalid Token. Please try again')
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const handleCancelUpdate = () => {
|
|
79
|
+
setVerifyToken({ visible:false, loading:false, token: '' })
|
|
80
|
+
setDraftPlayer(player)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<View style={{ flex:1 }}>
|
|
86
|
+
<View style={{ flex:1 }}>
|
|
87
|
+
<View style={{ padding:10 }}>
|
|
88
|
+
<Text weight='bold' size={16} textAlign='left' color={Colors.brand.midnight}>My Email Address</Text>
|
|
89
|
+
<Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>A valid email is required to verify your account</Text>
|
|
90
|
+
</View>
|
|
91
|
+
<View style={{ padding:10 }}>
|
|
92
|
+
<View style={{ backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
|
|
93
|
+
<View style={{ paddingLeft:15, paddingRight:15 }}>
|
|
94
|
+
<Icons.EmailIcon
|
|
95
|
+
color={Colors.brand.midnight}
|
|
96
|
+
size={18}
|
|
97
|
+
/>
|
|
98
|
+
</View>
|
|
99
|
+
<TextInput
|
|
100
|
+
value={draft_player.email}
|
|
101
|
+
keyboardType='email-address'
|
|
102
|
+
style={{ flex:1, borderRadius:0 }}
|
|
103
|
+
onChangeText={(text) => setDraftPlayer({ ...draft_player, email: text })}
|
|
104
|
+
/>
|
|
105
|
+
<View style={{ paddingLeft:15, paddingRight:15 }}>
|
|
106
|
+
{loading ?
|
|
107
|
+
<ActivityIndicator size='small' color={Colors.brand.midnight}/>
|
|
108
|
+
:
|
|
109
|
+
<View>
|
|
110
|
+
{ valid ?
|
|
111
|
+
<Icons.CheckIcon size={16} color={Colors.utility.success} />
|
|
112
|
+
: verify_token.visible ?
|
|
113
|
+
<Icons.AlertIcon size={16} color={Colors.utility.warning} />
|
|
114
|
+
:
|
|
115
|
+
<Icons.CloseIcon size={14} color={Colors.utility.error} />
|
|
116
|
+
}
|
|
117
|
+
</View>
|
|
118
|
+
}
|
|
119
|
+
</View>
|
|
120
|
+
</View>
|
|
121
|
+
{error ?
|
|
122
|
+
<Text size={14} color={Colors.utility.warning}>{error}</Text>
|
|
123
|
+
:<></>}
|
|
124
|
+
</View>
|
|
125
|
+
</View>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
<View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
|
|
129
|
+
<Button
|
|
130
|
+
title={walkthrough ? 'SKIP' : 'CLOSE'}
|
|
131
|
+
style={{ flex:1, marginRight:5 }}
|
|
132
|
+
borderColor={Colors.brand.electric}
|
|
133
|
+
title_color={Colors.brand.electric}
|
|
134
|
+
borderWidth={1}
|
|
135
|
+
padding={15}
|
|
136
|
+
onPress={() => walkthrough ? onNext() : onClose()}
|
|
137
|
+
/>
|
|
138
|
+
{!is_changed && player.verified ?
|
|
139
|
+
<Button
|
|
140
|
+
title='CONFIRM MY PHONE'
|
|
141
|
+
style={{ flex:3 }}
|
|
142
|
+
padding={15}
|
|
143
|
+
backgroundColor={Colors.utility.success}
|
|
144
|
+
title_color={Colors.shades.white}
|
|
145
|
+
onPress={() => onNext()}
|
|
146
|
+
/>
|
|
147
|
+
:
|
|
148
|
+
<Button
|
|
149
|
+
title='NEXT'
|
|
150
|
+
style={{ flex:3, opacity:update_allowed ? 1 : 0.5 }}
|
|
151
|
+
padding={15}
|
|
152
|
+
disabled={!update_allowed}
|
|
153
|
+
backgroundColor={Colors.utility.success}
|
|
154
|
+
title_color={Colors.shades.white}
|
|
155
|
+
onPress={() => handleUpdatePlayer()}
|
|
156
|
+
/>
|
|
157
|
+
}
|
|
158
|
+
</View>
|
|
159
|
+
{verify_token.visible ?
|
|
160
|
+
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, backgroundColor:Colors.shades.black_faded, justifyContent:'center', alignItems:'center' }}>
|
|
161
|
+
<View style={{ padding:20, backgroundColor:Colors.shades.white, borderRadius:8, ...view_styles.float }}>
|
|
162
|
+
<View style={{ padding:10 }}>
|
|
163
|
+
<Text size={14} weight='semibold' color={Colors.brand.midnight} textAlign='center'>Enter Code Sent To</Text>
|
|
164
|
+
<Text size={18} style={{ marginTop:10 }} weight='bold' color={Colors.brand.midnight} textAlign='center'>{draft_player.email}</Text>
|
|
165
|
+
</View>
|
|
166
|
+
<View style={{ backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
|
|
167
|
+
|
|
168
|
+
<TextInput
|
|
169
|
+
value={verify_token.token}
|
|
170
|
+
textContentType='oneTimeCode'
|
|
171
|
+
style={{ flex:1}}
|
|
172
|
+
placeholder='00000'
|
|
173
|
+
placeholderTextColor={Colors.brand.slate}
|
|
174
|
+
onChangeText={(text) => setVerifyToken({ ...verify_token, token: text })}
|
|
175
|
+
/>
|
|
176
|
+
</View>
|
|
177
|
+
<Button
|
|
178
|
+
title='CONFIRM'
|
|
179
|
+
style={{ marginTop:20, opacity:token_valid && !loading ? 1 : 0.5 }}
|
|
180
|
+
disabled={!token_valid || loading}
|
|
181
|
+
padding={15}
|
|
182
|
+
loading={verify_token.loading}
|
|
183
|
+
title_color={Colors.shades.white}
|
|
184
|
+
backgroundColor={Colors.utility.success}
|
|
185
|
+
onPress={() => handleVerifyEmail()}
|
|
186
|
+
/>
|
|
187
|
+
<Button
|
|
188
|
+
title='CANCEL'
|
|
189
|
+
style={{ marginTop:10 }}
|
|
190
|
+
disabled={loading}
|
|
191
|
+
padding={15}
|
|
192
|
+
loading={verify_token.loading}
|
|
193
|
+
title_color={Colors.brand.electric}
|
|
194
|
+
borderWidth={1}
|
|
195
|
+
borderColor={Colors.brand.electric}
|
|
196
|
+
onPress={() => handleCancelUpdate()}
|
|
197
|
+
/>
|
|
198
|
+
</View>
|
|
199
|
+
</View>
|
|
200
|
+
:<></>}
|
|
201
|
+
</View>
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export default EmailManager
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, FlatList } from 'react-native';
|
|
3
|
+
import { Button, Icons, Text, TextInput } from '../../Components';
|
|
4
|
+
import type { MyPlayerProps, PasswordStateProps } from '../api/types';
|
|
5
|
+
import Colors from '../../constants/colors';
|
|
6
|
+
import { ProfileApi, ProfileHelpers } from '../api';
|
|
7
|
+
|
|
8
|
+
type PasswordManagerProps = {
|
|
9
|
+
player:MyPlayerProps,
|
|
10
|
+
walkthrough?:boolean,
|
|
11
|
+
onNext:() => void,
|
|
12
|
+
onClose:() => void,
|
|
13
|
+
onPlayerUpdate:(player:MyPlayerProps) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const PasswordManager = ({ player, walkthrough, onPlayerUpdate, onNext, onClose }:PasswordManagerProps) => {
|
|
17
|
+
const [ draft_player, setDraftPlayer ] = useState<MyPlayerProps>(player);
|
|
18
|
+
const [ draft_password, setDraftPassword ] = useState({
|
|
19
|
+
change_visible:false,
|
|
20
|
+
loading:false,
|
|
21
|
+
current_password: '',
|
|
22
|
+
password: '',
|
|
23
|
+
re_password: ''
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const { loading, change_visible, password, re_password, current_password } = draft_password;
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setDraftPlayer(player)
|
|
30
|
+
},[player])
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
let password_states:PasswordStateProps[] = [
|
|
34
|
+
{ attribute:'password', type:'min_character', state: 'not_started', label:'At least 8 characters' },
|
|
35
|
+
{ attribute:'password', type: 'case', state:'not_started', label:'Uppercase and lowercase character' },
|
|
36
|
+
{ attribute:'password', type:'number', state:'not_started', label: 'Must use a number' },
|
|
37
|
+
{ attribute:'password', type:'special', state:'not_started', label: 'Includes at least 1 special character' },
|
|
38
|
+
{ attribute:'rePassword', type:'special', state:'not_started', label: 'Passwords do not match' },
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
const validatePassword = () => {
|
|
42
|
+
let valid_states:PasswordStateProps[] = []
|
|
43
|
+
password_states.map(ps => {
|
|
44
|
+
if(ps.attribute == 'rePassword'){
|
|
45
|
+
if(re_password != password){
|
|
46
|
+
valid_states.push({ ...ps, state: 'invalid' })
|
|
47
|
+
} else {
|
|
48
|
+
valid_states.push({ ...ps, state: 'valid' })
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
valid_states.push(ProfileHelpers.isPasswordValid(password, ps))
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
return valid_states
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Flatlist render function to render all the password statuses and their states
|
|
61
|
+
* @param data
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
const renderPasswordStatuses = (data: { item:PasswordStateProps, index:number }) => {
|
|
65
|
+
return (
|
|
66
|
+
<View style={{flex:1, flexDirection:'row', alignItems:'center', padding:8}}>
|
|
67
|
+
<Text style={{ flex:1}} size={14} color={Colors.brand.midnight}>{data.item.label}</Text>
|
|
68
|
+
{data.item.state === 'valid' ?
|
|
69
|
+
<Icons.CheckCirlceIcon size={14} color={Colors.utility.success} />
|
|
70
|
+
:
|
|
71
|
+
<Icons.AlertIcon size={14} color={Colors.utility.warning} />
|
|
72
|
+
}
|
|
73
|
+
</View>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const valid_states = validatePassword()
|
|
78
|
+
const is_valid = !valid_states.find(vs => ['invalid'].includes(vs.state)) ? true : false
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
const handleSetPassword = async() => {
|
|
82
|
+
if(!password){ return onNext() }
|
|
83
|
+
setDraftPassword({ ...draft_password, loading:true })
|
|
84
|
+
const player = await ProfileApi.setPassword(password, re_password, current_password)
|
|
85
|
+
onPlayerUpdate(player);
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
setDraftPassword({ current_password:'', change_visible: false, loading:false, password: '', re_password: '' })
|
|
88
|
+
if(walkthrough){ onNext() }
|
|
89
|
+
}, 500);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<View style={{ flex:1 }}>
|
|
94
|
+
{draft_player.no_password || change_visible ?
|
|
95
|
+
<View style={{ flex:1 }}>
|
|
96
|
+
<View style={{ padding:10 }}>
|
|
97
|
+
<Text weight='bold' size={16} textAlign='left' color={Colors.brand.midnight}>{draft_player.no_password ? 'SET MY PASSWORD': 'CHANGE MY PASSWORD'}</Text>
|
|
98
|
+
<Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>Help up secure your account with a password. Once set, you can login using your username and password</Text>
|
|
99
|
+
</View>
|
|
100
|
+
{!draft_player.no_password ?
|
|
101
|
+
<View style={{ margin:10, backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
|
|
102
|
+
<View style={{ paddingLeft:15, paddingRight:15 }}>
|
|
103
|
+
<Icons.LockClosedIcon
|
|
104
|
+
color={Colors.brand.midnight}
|
|
105
|
+
size={18}
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
<TextInput
|
|
109
|
+
value={draft_password.current_password}
|
|
110
|
+
placeholder='My Current Password'
|
|
111
|
+
secureTextEntry
|
|
112
|
+
placeholderTextColor={Colors.brand.slate}
|
|
113
|
+
style={{ flex:1, borderTopLeftRadius:0, borderBottomLeftRadius:0 }}
|
|
114
|
+
onChangeText={(text) => setDraftPassword({ ...draft_password, current_password : text })}
|
|
115
|
+
/>
|
|
116
|
+
</View>
|
|
117
|
+
:<></>}
|
|
118
|
+
<View style={{ margin:10, marginTop:0, backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
|
|
119
|
+
<View style={{ paddingLeft:15, paddingRight:15 }}>
|
|
120
|
+
<Icons.LockClosedIcon
|
|
121
|
+
color={Colors.brand.midnight}
|
|
122
|
+
size={18}
|
|
123
|
+
/>
|
|
124
|
+
</View>
|
|
125
|
+
<TextInput
|
|
126
|
+
value={draft_password.password}
|
|
127
|
+
placeholder='Enter Password'
|
|
128
|
+
secureTextEntry
|
|
129
|
+
placeholderTextColor={Colors.brand.slate}
|
|
130
|
+
style={{ flex:1, borderTopLeftRadius:0, borderBottomLeftRadius:0 }}
|
|
131
|
+
onChangeText={(text) => setDraftPassword({ ...draft_password, password : text })}
|
|
132
|
+
/>
|
|
133
|
+
</View>
|
|
134
|
+
<View style={{ margin:10, marginTop:0, backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
|
|
135
|
+
<View style={{ paddingLeft:15, paddingRight:15 }}>
|
|
136
|
+
<Icons.LockClosedIcon
|
|
137
|
+
color={Colors.brand.midnight}
|
|
138
|
+
size={18}
|
|
139
|
+
/>
|
|
140
|
+
</View>
|
|
141
|
+
<TextInput
|
|
142
|
+
value={draft_password.re_password}
|
|
143
|
+
placeholder='Re-Enter Password'
|
|
144
|
+
secureTextEntry
|
|
145
|
+
placeholderTextColor={Colors.brand.slate}
|
|
146
|
+
style={{ flex:1, borderTopLeftRadius:0, borderBottomLeftRadius:0 }}
|
|
147
|
+
onChangeText={(text) => setDraftPassword({ ...draft_password, re_password : text })}
|
|
148
|
+
/>
|
|
149
|
+
</View>
|
|
150
|
+
<View style={{ padding:10 }}>
|
|
151
|
+
<FlatList data={valid_states} renderItem={renderPasswordStatuses} keyExtractor={(item) => item.type??item.attribute}/>
|
|
152
|
+
</View>
|
|
153
|
+
|
|
154
|
+
</View>
|
|
155
|
+
:
|
|
156
|
+
<View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
|
|
157
|
+
<View style={{ borderRadius:8, backgroundColor:Colors.shades.shade600, justifyContent:'center', alignItems:'center', padding:30 }}>
|
|
158
|
+
|
|
159
|
+
<Text style={{ marginBottom:30 }} size={24} color={Colors.brand.midnight} weight='bold'>Password Set</Text>
|
|
160
|
+
|
|
161
|
+
<Icons.LockClosedIcon size={40} color={Colors.utility.success} />
|
|
162
|
+
<Button
|
|
163
|
+
title='CHANGE'
|
|
164
|
+
style={{ marginTop:20, padding:15, paddingLeft:40, paddingRight:40 }}
|
|
165
|
+
|
|
166
|
+
title_color={Colors.shades.white}
|
|
167
|
+
backgroundColor={Colors.brand.electric}
|
|
168
|
+
onPress={() => setDraftPassword({ ...draft_password, change_visible: true })}
|
|
169
|
+
/>
|
|
170
|
+
</View>
|
|
171
|
+
</View>
|
|
172
|
+
}
|
|
173
|
+
<View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
|
|
174
|
+
<Button
|
|
175
|
+
title={walkthrough ? 'SKIP' : 'CLOSE'}
|
|
176
|
+
style={{ flex:1, marginRight:5 }}
|
|
177
|
+
borderColor={Colors.brand.electric}
|
|
178
|
+
title_color={Colors.brand.electric}
|
|
179
|
+
borderWidth={1}
|
|
180
|
+
padding={15}
|
|
181
|
+
onPress={() => walkthrough ? onNext() : onClose()}
|
|
182
|
+
/>
|
|
183
|
+
<Button
|
|
184
|
+
title={'NEXT'}
|
|
185
|
+
style={{ flex:3, opacity:is_valid ? 1 : 0.5 }}
|
|
186
|
+
padding={15}
|
|
187
|
+
loading={loading}
|
|
188
|
+
disabled={!is_valid}
|
|
189
|
+
backgroundColor={Colors.utility.success}
|
|
190
|
+
title_color={Colors.shades.white}
|
|
191
|
+
onPress={() => handleSetPassword()}
|
|
192
|
+
/>
|
|
193
|
+
</View>
|
|
194
|
+
</View>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export default PasswordManager
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { View, ActivityIndicator } from 'react-native';
|
|
4
|
+
import { Button, Icons, Text, TextInput } from '../../Components';
|
|
5
|
+
import Colors from '../../constants/colors';
|
|
6
|
+
import type { MyPlayerProps } from '../api/types';
|
|
7
|
+
import { view_styles } from '../../constants/styles';
|
|
8
|
+
import { ProfileApi, ProfileHelpers } from '../api';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type PhoneManagerProps = {
|
|
12
|
+
player:MyPlayerProps,
|
|
13
|
+
walkthrough?:boolean,
|
|
14
|
+
onNext:() => void,
|
|
15
|
+
onClose:() => void,
|
|
16
|
+
onPlayerUpdate:(player:MyPlayerProps) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const PhoneManager = ({ player, walkthrough, onPlayerUpdate, onNext, onClose }:PhoneManagerProps) => {
|
|
20
|
+
const [ loading, setLoading ] = useState(false);
|
|
21
|
+
const [ verify_token, setVerifyToken ] = useState({
|
|
22
|
+
loading:false,
|
|
23
|
+
visible: false,
|
|
24
|
+
token: ''
|
|
25
|
+
})
|
|
26
|
+
const [ draft_player, setDraftPlayer ] = useState<MyPlayerProps>(player)
|
|
27
|
+
const [ update_error, setUpdateError ] = useState<string>();
|
|
28
|
+
const [ verify_error, setVerifyError ] = useState<string>();
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setDraftPlayer(player);
|
|
32
|
+
},[player])
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const handlePhoneChange = (text:string) => {
|
|
36
|
+
let phone = ProfileHelpers.unformatPhone(text)
|
|
37
|
+
setDraftPlayer({ ...draft_player, phone })
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { valid, error } = ProfileHelpers.isPhoneValid(draft_player.phone)
|
|
41
|
+
|
|
42
|
+
const is_changed = draft_player.phone.toLowerCase() != player.phone.toLowerCase() ? true : false
|
|
43
|
+
const token_valid = verify_token.token != '' ? true : false
|
|
44
|
+
const update_allowed = valid && is_changed ? true : false
|
|
45
|
+
const handleUpdatePlayer = async() => {
|
|
46
|
+
try {
|
|
47
|
+
console.log(update_error, verify_error)
|
|
48
|
+
setLoading(true);
|
|
49
|
+
await ProfileApi.updatePlayerPhone(draft_player.phone);
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
setLoading(false);
|
|
52
|
+
setVerifyToken({
|
|
53
|
+
loading:false,
|
|
54
|
+
visible:true,
|
|
55
|
+
token: ''
|
|
56
|
+
})
|
|
57
|
+
}, 1000);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
setLoading(false);
|
|
60
|
+
setUpdateError('Unable to use this phone number. Please try again')
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const handleVerifyPhone = async() => {
|
|
65
|
+
try {
|
|
66
|
+
setVerifyToken({ ...verify_token, loading:true });
|
|
67
|
+
const player = await ProfileApi.confirmPlayerPhone(verify_token.token);
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
setLoading(false);
|
|
70
|
+
setVerifyToken({
|
|
71
|
+
loading:false,
|
|
72
|
+
visible:false,
|
|
73
|
+
token: ''
|
|
74
|
+
})
|
|
75
|
+
if(onNext){ onNext() }
|
|
76
|
+
}, 1000);
|
|
77
|
+
onPlayerUpdate(player)
|
|
78
|
+
} catch (e) {
|
|
79
|
+
setVerifyToken({ ...verify_token, loading:false });
|
|
80
|
+
setVerifyError('Invalid Token. Please try again')
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const handleCancelUpdate = () => {
|
|
85
|
+
setVerifyToken({ visible:false, loading:false, token: '' })
|
|
86
|
+
setDraftPlayer(player)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<View style={{ flex:1 }}>
|
|
92
|
+
<View style={{ flex:1 }}>
|
|
93
|
+
<View style={{ padding:10 }}>
|
|
94
|
+
<Text weight='bold' size={16} textAlign='left' color={Colors.brand.midnight}>My Phone Number</Text>
|
|
95
|
+
<Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>A valid phone number is required to verify your account</Text>
|
|
96
|
+
</View>
|
|
97
|
+
<View style={{ padding:10 }}>
|
|
98
|
+
|
|
99
|
+
<View style={{ backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
|
|
100
|
+
<View style={{ paddingLeft:15, paddingRight:15 }}>
|
|
101
|
+
<Icons.PhoneIcon
|
|
102
|
+
color={Colors.brand.midnight}
|
|
103
|
+
size={18}
|
|
104
|
+
/>
|
|
105
|
+
</View>
|
|
106
|
+
<TextInput
|
|
107
|
+
value={ProfileHelpers.formatPhone(draft_player.phone)}
|
|
108
|
+
keyboardType='phone-pad'
|
|
109
|
+
style={{ flex:1, borderRadius:0 }}
|
|
110
|
+
onChangeText={(text) => handlePhoneChange(text)}
|
|
111
|
+
/>
|
|
112
|
+
<View style={{ paddingLeft:15, paddingRight:15 }}>
|
|
113
|
+
{loading ?
|
|
114
|
+
<ActivityIndicator size='small' color={Colors.brand.midnight}/>
|
|
115
|
+
:
|
|
116
|
+
<View>
|
|
117
|
+
{ valid ?
|
|
118
|
+
<Icons.CheckIcon size={16} color={Colors.utility.success} />
|
|
119
|
+
: verify_token.visible ?
|
|
120
|
+
<Icons.AlertIcon size={16} color={Colors.utility.warning} />
|
|
121
|
+
:
|
|
122
|
+
<Icons.CloseIcon size={14} color={Colors.utility.error} />
|
|
123
|
+
}
|
|
124
|
+
</View>
|
|
125
|
+
}
|
|
126
|
+
</View>
|
|
127
|
+
</View>
|
|
128
|
+
</View>
|
|
129
|
+
{error ?
|
|
130
|
+
<Text size={14} color={Colors.utility.warning}>{error}</Text>
|
|
131
|
+
:<></>}
|
|
132
|
+
</View>
|
|
133
|
+
<View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
|
|
134
|
+
<Button
|
|
135
|
+
title={walkthrough ? 'SKIP' : 'CLOSE'}
|
|
136
|
+
style={{ flex:1, marginRight:5 }}
|
|
137
|
+
borderColor={Colors.brand.electric}
|
|
138
|
+
title_color={Colors.brand.electric}
|
|
139
|
+
borderWidth={1}
|
|
140
|
+
padding={15}
|
|
141
|
+
onPress={() => walkthrough ? onNext() : onClose()}
|
|
142
|
+
/>
|
|
143
|
+
{!is_changed && player.phone_verified ?
|
|
144
|
+
<Button
|
|
145
|
+
title='SET MY DATE OF BIRTH'
|
|
146
|
+
style={{ flex:3 }}
|
|
147
|
+
padding={15}
|
|
148
|
+
backgroundColor={Colors.utility.success}
|
|
149
|
+
title_color={Colors.shades.white}
|
|
150
|
+
onPress={() => onNext()}
|
|
151
|
+
/>
|
|
152
|
+
:
|
|
153
|
+
<Button
|
|
154
|
+
title='UPDATE'
|
|
155
|
+
style={{ flex:3, opacity:update_allowed ? 1 : 0.5 }}
|
|
156
|
+
padding={15}
|
|
157
|
+
disabled={!update_allowed}
|
|
158
|
+
backgroundColor={Colors.utility.success}
|
|
159
|
+
title_color={Colors.shades.white}
|
|
160
|
+
onPress={() => handleUpdatePlayer()}
|
|
161
|
+
/>
|
|
162
|
+
}
|
|
163
|
+
</View>
|
|
164
|
+
{verify_token.visible ?
|
|
165
|
+
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, backgroundColor:Colors.shades.black_faded, justifyContent:'center', alignItems:'center' }}>
|
|
166
|
+
<View style={{ padding:20, backgroundColor:Colors.shades.white, borderRadius:8, ...view_styles.float }}>
|
|
167
|
+
<View style={{ padding:10 }}>
|
|
168
|
+
<Text size={14} weight='semibold' color={Colors.brand.midnight} textAlign='center'>Enter Code Sent To</Text>
|
|
169
|
+
<Text size={18} style={{ marginTop:10 }} weight='bold' color={Colors.brand.midnight} textAlign='center'>{draft_player.phone}</Text>
|
|
170
|
+
</View>
|
|
171
|
+
<View style={{ backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
|
|
172
|
+
|
|
173
|
+
<TextInput
|
|
174
|
+
value={verify_token.token}
|
|
175
|
+
textContentType='oneTimeCode'
|
|
176
|
+
style={{ flex:1}}
|
|
177
|
+
placeholder='00000'
|
|
178
|
+
placeholderTextColor={Colors.brand.slate}
|
|
179
|
+
onChangeText={(text) => setVerifyToken({ ...verify_token, token: text })}
|
|
180
|
+
/>
|
|
181
|
+
</View>
|
|
182
|
+
<Button
|
|
183
|
+
title='CONFIRM'
|
|
184
|
+
style={{ marginTop:20, opacity:token_valid && !loading ? 1 : 0.5 }}
|
|
185
|
+
disabled={!token_valid || loading}
|
|
186
|
+
padding={15}
|
|
187
|
+
loading={verify_token.loading}
|
|
188
|
+
title_color={Colors.shades.white}
|
|
189
|
+
backgroundColor={Colors.utility.success}
|
|
190
|
+
onPress={() => handleVerifyPhone()}
|
|
191
|
+
/>
|
|
192
|
+
<Button
|
|
193
|
+
title='CANCEL'
|
|
194
|
+
style={{ marginTop:10 }}
|
|
195
|
+
disabled={loading}
|
|
196
|
+
padding={15}
|
|
197
|
+
loading={verify_token.loading}
|
|
198
|
+
title_color={Colors.brand.electric}
|
|
199
|
+
borderWidth={1}
|
|
200
|
+
borderColor={Colors.brand.electric}
|
|
201
|
+
onPress={() => handleCancelUpdate()}
|
|
202
|
+
/>
|
|
203
|
+
</View>
|
|
204
|
+
</View>
|
|
205
|
+
:<></>}
|
|
206
|
+
</View>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export default PhoneManager
|