be-components 0.1.1 → 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,265 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, Platform, TouchableOpacity, Image } from 'react-native';
|
|
3
|
+
import { Button, Icons, Text } from '../../Components';
|
|
4
|
+
import Colors from '../../constants/colors';
|
|
5
|
+
import type { MyPlayerProps } from '../api/types';
|
|
6
|
+
import { ProfileApi } from '../api';
|
|
7
|
+
import moment from 'moment-mini';
|
|
8
|
+
|
|
9
|
+
type VouchCardProps = {
|
|
10
|
+
player:MyPlayerProps,
|
|
11
|
+
onClose:() => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const VouchCard = ({ player, onClose }:VouchCardProps) => {
|
|
15
|
+
const [ vouching, setVouching ] = useState(false);
|
|
16
|
+
const [ vouched, setVouched ] = useState<any | undefined>(undefined)
|
|
17
|
+
const [ disclaimer_confirmed, setDisclaimerConfirmed ] = useState(false);
|
|
18
|
+
const [ id_disclaimer_confirmed, setIDDisclaimerConfirmed ] = useState(false);
|
|
19
|
+
const [ info_visible, setInfoVisible ] = useState(false);
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
initializeVouch()
|
|
24
|
+
if(!vouched){ return }
|
|
25
|
+
vouched.mount('#vouched-element')
|
|
26
|
+
},[vouched])
|
|
27
|
+
|
|
28
|
+
const initializeVouch = () => {
|
|
29
|
+
if(Platform.OS != 'web' || !window || !document){ return }
|
|
30
|
+
if(window.Vouched){ return }
|
|
31
|
+
let script = document.createElement('script');
|
|
32
|
+
script.id = 'vouch';
|
|
33
|
+
script.src = 'https://static.vouched.id/plugin/releases/latest/index.js'
|
|
34
|
+
script.async = true;
|
|
35
|
+
script.defer = true;
|
|
36
|
+
script.onload = () => console.log('loaded!!!')
|
|
37
|
+
script.onerror = (e) => console.log(e);
|
|
38
|
+
document.body.appendChild(script);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const verifyErrors = (p:MyPlayerProps) => {
|
|
42
|
+
let errors:string[] = []
|
|
43
|
+
if(!p.first_name || !p.last_name){ errors.push('Please include your name. This must match your ID exactly.') }
|
|
44
|
+
if(!p.dob || p.dob == ''){ errors.push('Please include your date of birth. This must match your ID exactly.') }
|
|
45
|
+
if(p.dob){
|
|
46
|
+
let age_diff = moment().diff(moment(p.dob), 'years')
|
|
47
|
+
if(age_diff < 18){ errors.push('Must be over the age of 18 to participate in real money activities on BettorEdge') }
|
|
48
|
+
}
|
|
49
|
+
if(!p.verified){ errors.push('A valid and verified email must be associated with your account before we can verify') }
|
|
50
|
+
if(!p.phone_verified){ errors.push('A valid and verified phone number must be associated with your account before we can verify') }
|
|
51
|
+
if(p.no_password){ errors.push('Please add a password for your account before you continue to verify') }
|
|
52
|
+
return errors
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const startVouchingPlayer = async() => {
|
|
56
|
+
if(vouching || !player){ return }
|
|
57
|
+
//1) Lets make sure vouched js script has been initialized
|
|
58
|
+
if(!window.Vouched){ return alert('not ready') }
|
|
59
|
+
setVouching(true)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
setVouched(window.Vouched({
|
|
63
|
+
verification: {
|
|
64
|
+
// verify the user's information
|
|
65
|
+
firstName: player.first_name,
|
|
66
|
+
lastName: player.last_name,
|
|
67
|
+
// used for the crosscheck feature
|
|
68
|
+
email: player.email,
|
|
69
|
+
phone: player.phone,
|
|
70
|
+
enableIPAddress: true
|
|
71
|
+
},
|
|
72
|
+
id: 'camera',
|
|
73
|
+
face: 'camera',
|
|
74
|
+
showUploadFirst: false,
|
|
75
|
+
//token:player_vouch_token?.token,
|
|
76
|
+
appId: ProfileApi.getVouchId(),
|
|
77
|
+
//appId: "adqEZph8t*_NBFy6u_l4!t~Hin6kpK", //SANDBOX
|
|
78
|
+
// your webhook for POST verification processing
|
|
79
|
+
callbackURL: 'NEED TO ADD CALLBACK WEBHOOK URL HERE',
|
|
80
|
+
sandbox: true,
|
|
81
|
+
// mobile handoff
|
|
82
|
+
crossDevice: true,
|
|
83
|
+
crossDeviceQRCode: true,
|
|
84
|
+
includeBackId: true,
|
|
85
|
+
//includeBarcode:true,
|
|
86
|
+
cameraScreenLabelBackId: 'Please turn ID over to capture back',
|
|
87
|
+
onInit: async({token, job}:any) => {
|
|
88
|
+
console.log(token, job)
|
|
89
|
+
// If crossDevice is true, a web token is created during initialization
|
|
90
|
+
// Your backend will save and associate the token the user.
|
|
91
|
+
//fetch(`/yourapi/idv?job_token=${job.token}&&user=${user.id}`);
|
|
92
|
+
//let pvt:PlayerVouchTokenProps = {
|
|
93
|
+
// player_vouch_token_id:'', player_id:player.player_id, token, create_datetime:'', last_update_datetime:'', status:'active'
|
|
94
|
+
//}
|
|
95
|
+
//await player_saveVouchToken(pvt)
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
onDone: (job:any)=> {
|
|
99
|
+
// token used to query jobs
|
|
100
|
+
console.log("Scanning complete", { token: job.token });
|
|
101
|
+
|
|
102
|
+
// An alternative way to update your system based on the results of the job.
|
|
103
|
+
// Your backend could perform the following:
|
|
104
|
+
// 1. query jobs with the token
|
|
105
|
+
// 2. store relevant job information such as the id and success property into the user's profile
|
|
106
|
+
//fetch(`/yourapi/idv?job_token=${job.token}`);
|
|
107
|
+
console.log('vouch complete!')
|
|
108
|
+
setVouched(undefined)
|
|
109
|
+
setTimeout(() => {
|
|
110
|
+
setVouching(false)
|
|
111
|
+
}, 3000);
|
|
112
|
+
// Redirect to the next page based on the job success
|
|
113
|
+
if( job.result.success){
|
|
114
|
+
//window.location.replace("https");
|
|
115
|
+
} else {
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
// theme
|
|
119
|
+
theme: {
|
|
120
|
+
name: 'verbose',
|
|
121
|
+
},
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if(Platform.OS != 'web'){ return <></> }
|
|
126
|
+
|
|
127
|
+
if(vouched){
|
|
128
|
+
return (
|
|
129
|
+
<View style={{ borderRadius:8, backgroundColor:Colors.shades.shade100, paddingBottom:10 }}>
|
|
130
|
+
<View nativeID='vouch_header' style={{ padding:10 }}>
|
|
131
|
+
<Text size={16} color={Colors.brand.midnight} weight='semibold'>Verify your account</Text>
|
|
132
|
+
<Text style={{ marginTop:3 }} color={Colors.brand.midnight} size={14} weight='light'>Follow the prompts below to verify your identity instantly.</Text>
|
|
133
|
+
</View>
|
|
134
|
+
<div style={{ height:650 }} id='vouched-element'/>
|
|
135
|
+
</View>
|
|
136
|
+
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const verify_errors = verifyErrors(player)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
let scan_ready = disclaimer_confirmed && id_disclaimer_confirmed ? true : false
|
|
144
|
+
let dob = player?.dob ?? ''
|
|
145
|
+
let split_dob = dob.split('T')
|
|
146
|
+
if(split_dob[0]){
|
|
147
|
+
split_dob = split_dob[0].split('-')
|
|
148
|
+
}
|
|
149
|
+
let new_date = `${split_dob[1]}/${split_dob[2]}/${split_dob[0]}`
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<View style={{ flex:1 }}>
|
|
153
|
+
<View style={{ flex:1 }}>
|
|
154
|
+
<View nativeID='vouch_header' style={{ borderTopRightRadius: 8, borderTopLeftRadius: 8, backgroundColor:Colors.shades.shade100, padding:10 }}>
|
|
155
|
+
<Text size={16} color={Colors.brand.midnight} weight='semibold'>Help us identify you</Text>
|
|
156
|
+
<Text style={{ marginTop:3 }} color={Colors.brand.midnight} size={14} weight='light'>We need to take extra steps to verify your account. Scan your Driver's License or state issued ID and take a selfie for instant verification</Text>
|
|
157
|
+
</View>
|
|
158
|
+
<TouchableOpacity style={{padding:10, borderRadius:8, backgroundColor:Colors.highlights.highlight500Faded, marginLeft:15, marginRight:15, marginTop:10}} onPress={() => setInfoVisible(!info_visible)}>
|
|
159
|
+
<View style={{ flexDirection:'row', alignItems:'center' }}>
|
|
160
|
+
<Text style={{ flex:1 }} size={14} weight='semibold' color={Colors.brand.midnight}>Why is this step required?</Text>
|
|
161
|
+
<Icons.ChevronIcon direction={info_visible?'up':'down'} size={10} color={Colors.brand.midnight} />
|
|
162
|
+
</View>
|
|
163
|
+
{info_visible ?
|
|
164
|
+
<Text size={12} weight='regular' color={Colors.brand.midnight} style={{ marginTop:4 }}>When betting with real money, legally, BettorEdge has to verify your identity to make sure you are old enough to bet and that you are who you say you are.</Text>
|
|
165
|
+
:<></>}
|
|
166
|
+
</TouchableOpacity>
|
|
167
|
+
<View style={{ alignSelf:'center' }}>
|
|
168
|
+
<Image
|
|
169
|
+
source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1640215120/h4_2_media_fyiuoy.webp' }}
|
|
170
|
+
style={{ height: 150, width:300 }}
|
|
171
|
+
resizeMode='contain'
|
|
172
|
+
/>
|
|
173
|
+
</View>
|
|
174
|
+
{player.vouched_status == 'unverified' ?
|
|
175
|
+
<View>
|
|
176
|
+
<TouchableOpacity
|
|
177
|
+
style={{ flexDirection:'row', alignItems:'center', padding:10, marginLeft:15, marginRight:15, borderRadius:8, backgroundColor:Colors.shades.shade100, marginTop:5 }}
|
|
178
|
+
onPress={() => setDisclaimerConfirmed(!disclaimer_confirmed)}>
|
|
179
|
+
<View>
|
|
180
|
+
<View style={{ justifyContent:'center', alignItems:'center', borderWidth:1, borderColor:Colors.brand.midnight, borderRadius:4, height:20, width:20 }}>
|
|
181
|
+
{disclaimer_confirmed ?
|
|
182
|
+
<Icons.CheckIcon size={14} color={Colors.brand.midnight} />
|
|
183
|
+
:<></>}
|
|
184
|
+
</View>
|
|
185
|
+
</View>
|
|
186
|
+
<Text style={{ marginLeft:10 }} size={12} color={Colors.brand.midnight} weight='regular'>I confirm that my name is <Text size={12} weight='bold'>{player.first_name} {player.last_name}</Text> and that my date of birth is <Text size={12} weight='bold'>{new_date}</Text>. Mismatch will cause failure.</Text>
|
|
187
|
+
</TouchableOpacity>
|
|
188
|
+
<TouchableOpacity
|
|
189
|
+
style={{ flexDirection:'row', marginTop:5, alignItems:'center', padding:10, marginLeft:15, marginRight:15, borderRadius:8, backgroundColor:Colors.shades.shade100 }}
|
|
190
|
+
onPress={() => setIDDisclaimerConfirmed(!id_disclaimer_confirmed)}
|
|
191
|
+
>
|
|
192
|
+
<View>
|
|
193
|
+
<View style={{ justifyContent:'center', alignItems:'center', borderWidth:1, borderColor:Colors.brand.midnight, borderRadius:4, height:20, width:20 }}>
|
|
194
|
+
{id_disclaimer_confirmed ?
|
|
195
|
+
<Icons.CheckIcon size={14} color={Colors.brand.midnight} />
|
|
196
|
+
:<></>}
|
|
197
|
+
</View>
|
|
198
|
+
</View>
|
|
199
|
+
<Text style={{ marginLeft:10 }} size={12} color={Colors.brand.midnight} weight='regular'>I confirm that I am using a valid <Text size={12} weight='bold'>(Not Expired)</Text> US government issued ID. Expired ID will cause failure.</Text>
|
|
200
|
+
</TouchableOpacity>
|
|
201
|
+
</View>
|
|
202
|
+
:<></>}
|
|
203
|
+
</View>
|
|
204
|
+
{player.vouched_status == 'failed' ?
|
|
205
|
+
<View style={{ margin:10, borderRadius:8, padding:10, backgroundColor:Colors.utility.warning }}>
|
|
206
|
+
<Text textAlign='center' size={14} weight='bold' color={Colors.shades.white}>We are currently reviewing your account. If you do not hear from us within 48 hours, please reach out to support@bettoredge.com</Text>
|
|
207
|
+
</View>
|
|
208
|
+
:<></>}
|
|
209
|
+
<View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
|
|
210
|
+
<Button
|
|
211
|
+
padding={15}
|
|
212
|
+
style={{ flex:1, marginRight:5 }}
|
|
213
|
+
borderWidth={1}
|
|
214
|
+
borderColor={Colors.brand.electric}
|
|
215
|
+
title_color={Colors.brand.electric}
|
|
216
|
+
title='CLOSE'
|
|
217
|
+
onPress={() => onClose()}
|
|
218
|
+
/>
|
|
219
|
+
{player.vouched_status == 'unverified' ?
|
|
220
|
+
<Button
|
|
221
|
+
title='SCAN MY ID'
|
|
222
|
+
title_color={Colors.shades.white}
|
|
223
|
+
loading={vouching}
|
|
224
|
+
disabled={!scan_ready}
|
|
225
|
+
style={{ flex:3, opacity:scan_ready && scan_ready&&!vouching?1:0.5 }}
|
|
226
|
+
padding={15}
|
|
227
|
+
backgroundColor={Colors.utility.success}
|
|
228
|
+
onPress={() => startVouchingPlayer()}
|
|
229
|
+
/>
|
|
230
|
+
|
|
231
|
+
: player.vouched_status == 'failed' ?
|
|
232
|
+
<View style={{ flex:3, margin:4, borderRadius: 8, padding:10, backgroundColor:Colors.shades.shade100 }}>
|
|
233
|
+
<Text size={16} color={Colors.brand.midnight} textAlign='center' weight='semibold'>Account In Review</Text>
|
|
234
|
+
</View>
|
|
235
|
+
:
|
|
236
|
+
<View style={{ flex:3, margin:4, borderRadius: 8, padding:10, backgroundColor:Colors.highlights.highlight500 }}>
|
|
237
|
+
<Text size={16} color={Colors.brand.midnight} textAlign='center' weight='semibold'>You are verified!</Text>
|
|
238
|
+
</View>
|
|
239
|
+
}
|
|
240
|
+
</View>
|
|
241
|
+
{verify_errors.length > 0 ?
|
|
242
|
+
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, backgroundColor:Colors.shades.black_faded, justifyContent:'center', alignItems:'center', padding:20 }}>
|
|
243
|
+
<View style={{ backgroundColor:Colors.shades.white, padding:20, borderRadius:8 }}>
|
|
244
|
+
<View style={{ padding:10 }}>
|
|
245
|
+
<Text size={18} color={Colors.brand.midnight} weight='bold'>ERRORS:</Text>
|
|
246
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight}>Please fix the following before continuing to verify</Text>
|
|
247
|
+
</View>
|
|
248
|
+
<View style={{ padding:10, backgroundColor:Colors.shades.shade100, borderRadius:8 }}>
|
|
249
|
+
{verify_errors.map((e,i) => {
|
|
250
|
+
return (
|
|
251
|
+
<View style={{ padding:5, flexDirection:'row', alignItems:'center' }}>
|
|
252
|
+
<Text size={12} color={Colors.utility.warning} weight='bold'>{i+1} - {e}</Text>
|
|
253
|
+
|
|
254
|
+
</View>
|
|
255
|
+
)
|
|
256
|
+
})}
|
|
257
|
+
</View>
|
|
258
|
+
</View>
|
|
259
|
+
</View>
|
|
260
|
+
:<></>}
|
|
261
|
+
</View>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export default VouchCard
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import type { CodeRequestProps, MyPlayerProps, PasswordStateProps, PlayerBalanceProps, PlayerReferralProps, PromoProps, PublicPlayerProps, RewardOptionProps } from './types';
|
|
3
|
+
import { APIOverrides } from '../../ApiOverrides';
|
|
4
|
+
|
|
5
|
+
let AUTH_SVC_API = '';
|
|
6
|
+
let VOUCH_ID = '';
|
|
7
|
+
|
|
8
|
+
const ProfileApi = {
|
|
9
|
+
setEnvironment: () => {
|
|
10
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
11
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
12
|
+
VOUCH_ID = endpoints['VOUCH_ID'] as string;
|
|
13
|
+
},
|
|
14
|
+
getVouchId:() => {
|
|
15
|
+
return VOUCH_ID
|
|
16
|
+
},
|
|
17
|
+
isAttributeValid: async(attribute:string, attribute_value:string) => {
|
|
18
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/attribute/valid`, { attribute, attribute_value })
|
|
19
|
+
return resp.data.valid
|
|
20
|
+
},
|
|
21
|
+
updatePlayerPic: async(profile_pic:any):Promise<MyPlayerProps> => {
|
|
22
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/pic/update`, { profile_pic })
|
|
23
|
+
return resp.data.player
|
|
24
|
+
},
|
|
25
|
+
updatePlayerDOB: async(dob:any):Promise<MyPlayerProps> => {
|
|
26
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/dob/update`, { dob })
|
|
27
|
+
return resp.data.player
|
|
28
|
+
},
|
|
29
|
+
updatePlayerName: async(first_name:string, last_name:string):Promise<MyPlayerProps> => {
|
|
30
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/name/update`, { first_name, last_name })
|
|
31
|
+
return resp.data.player
|
|
32
|
+
},
|
|
33
|
+
updatePlayerUsername: async(username:string):Promise<MyPlayerProps> => {
|
|
34
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/username/update`, { username })
|
|
35
|
+
return resp.data.player
|
|
36
|
+
},
|
|
37
|
+
updatePlayerEmail: async(email:string):Promise<void> => {
|
|
38
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/email/update`, { email })
|
|
39
|
+
return
|
|
40
|
+
},
|
|
41
|
+
confirmPlayerEmail: async(token:string):Promise<MyPlayerProps> => {
|
|
42
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/email/confirm`, { token })
|
|
43
|
+
return resp.data.player
|
|
44
|
+
},
|
|
45
|
+
updatePlayerPhone: async(phone:string):Promise<void> => {
|
|
46
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/phone/update`, { phone })
|
|
47
|
+
return
|
|
48
|
+
},
|
|
49
|
+
confirmPlayerPhone: async(token:string):Promise<MyPlayerProps> => {
|
|
50
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/phone/confirm`, { token })
|
|
51
|
+
return resp.data.player
|
|
52
|
+
},
|
|
53
|
+
getMyDetails : async():Promise<MyPlayerProps> => {
|
|
54
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/me`)
|
|
55
|
+
return resp.data.player
|
|
56
|
+
},
|
|
57
|
+
getMyBalance: async():Promise<PlayerBalanceProps> => {
|
|
58
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/balance/me`)
|
|
59
|
+
return resp.data.player_balance
|
|
60
|
+
},
|
|
61
|
+
getMyCodeDetails: async():Promise<{ code_request?:CodeRequestProps, promo?:PromoProps, player_referral?:PlayerReferralProps, referrer?:PublicPlayerProps, reward_option?:RewardOptionProps }> => {
|
|
62
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/promos/request/me`)
|
|
63
|
+
return resp.data
|
|
64
|
+
},
|
|
65
|
+
redeemCode: async(code_request_id:string):Promise<{ code_request?:CodeRequestProps, promo?:PromoProps, player_referral?:PlayerReferralProps, referrer?:PublicPlayerProps, reward_option?:RewardOptionProps }> => {
|
|
66
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/promos/request/redeem`, { code_request_id })
|
|
67
|
+
return resp.data
|
|
68
|
+
},
|
|
69
|
+
tryCodeRequest: async(referral_code:string):Promise<{ result:'success'|'failed', error_message?:string, code_request?:CodeRequestProps, promo?:PromoProps, player_referral?:PlayerReferralProps, referrer?:PublicPlayerProps, reward_option?:RewardOptionProps }> => {
|
|
70
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/promos/request/try`, { referral_code })
|
|
71
|
+
console.log(resp.data)
|
|
72
|
+
return resp.data
|
|
73
|
+
},
|
|
74
|
+
setPassword: async(password:string, re_password:string, current_password?:string):Promise<MyPlayerProps> => {
|
|
75
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/password/create`, { password, re_password, current_password })
|
|
76
|
+
return resp.data.player
|
|
77
|
+
},
|
|
78
|
+
forgotUsername : async(attribute:string, attribute_value:string):Promise<void> => {
|
|
79
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/forgot/username`, { attribute, attribute_value })
|
|
80
|
+
return
|
|
81
|
+
},
|
|
82
|
+
forgotPassword : async(attribute:string, attribute_value:string):Promise<void> => {
|
|
83
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/forgot/password`, { attribute, attribute_value })
|
|
84
|
+
return
|
|
85
|
+
},
|
|
86
|
+
resetPassword : async(password:string, repassword:string, verify_code:string):Promise<void> => {
|
|
87
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/reset/password`, { password, repassword, verify_code })
|
|
88
|
+
return
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const ProfileHelpers = {
|
|
93
|
+
/**
|
|
94
|
+
* Takes a phone number string and returns a formatted verison of the phone number with - between numbers
|
|
95
|
+
* @param phone
|
|
96
|
+
* @returns formatted phone string
|
|
97
|
+
*/
|
|
98
|
+
formatPhone : (phone?:string) => {
|
|
99
|
+
if(!phone){ return '' }
|
|
100
|
+
let splitPhone = phone.split('')
|
|
101
|
+
if(splitPhone.length === 0){ return '' }
|
|
102
|
+
if(splitPhone.length > 10 && splitPhone[0] == '1'){ splitPhone.splice(0,1) }
|
|
103
|
+
let newPhone = ''
|
|
104
|
+
splitPhone.map((c, i) => {
|
|
105
|
+
newPhone += c
|
|
106
|
+
if(i === 2 && splitPhone.length > 3){ newPhone += '-' }
|
|
107
|
+
if(i === 5 && splitPhone.length > 6){ newPhone += '-' }
|
|
108
|
+
})
|
|
109
|
+
return newPhone
|
|
110
|
+
},
|
|
111
|
+
isEmailValid : (email:string):{ valid:boolean, error?:string } => {
|
|
112
|
+
if(email === ''){ return { valid:false, error:'Please enter valid email' } }
|
|
113
|
+
// function that returns true if value is email, false otherwise
|
|
114
|
+
var emailRex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
115
|
+
if (emailRex.test(email)) {
|
|
116
|
+
return { valid:true };
|
|
117
|
+
}
|
|
118
|
+
return { valid:false, error:'Must be a valid email' };
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Removes - from a formatted phone string
|
|
122
|
+
* @param formatted_phone
|
|
123
|
+
* @returns unformatted phone string
|
|
124
|
+
*/
|
|
125
|
+
unformatPhone : (formatted_phone:string) => {
|
|
126
|
+
let splitPhone = formatted_phone.split('-')
|
|
127
|
+
let newPhone = ''
|
|
128
|
+
splitPhone.map(c => {
|
|
129
|
+
newPhone += c
|
|
130
|
+
})
|
|
131
|
+
return newPhone
|
|
132
|
+
},
|
|
133
|
+
fullUnformatPhone : (formatted_phone:string) => {
|
|
134
|
+
let unformatted_phone = ProfileHelpers.unformatPhone(formatted_phone)
|
|
135
|
+
let no_par = unformatted_phone.split('(')
|
|
136
|
+
unformatted_phone = no_par.join('')
|
|
137
|
+
no_par = unformatted_phone.split(')')
|
|
138
|
+
unformatted_phone = no_par.join('')
|
|
139
|
+
let no_plus = unformatted_phone.split('+1')
|
|
140
|
+
unformatted_phone = no_plus.join('')
|
|
141
|
+
let no_space = unformatted_phone.split(' ')
|
|
142
|
+
unformatted_phone = no_space.join('')
|
|
143
|
+
return unformatted_phone
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
isAttributeValid : (attribute:string, value:string, optional?:boolean):{ valid:boolean, error?:string } => {
|
|
147
|
+
if(optional){ return { valid:true } }
|
|
148
|
+
switch(attribute){
|
|
149
|
+
case 'phone':
|
|
150
|
+
return ProfileHelpers.isPhoneValid(value)
|
|
151
|
+
case 'email':
|
|
152
|
+
return ProfileHelpers.isEmailValid(value)
|
|
153
|
+
default:
|
|
154
|
+
if(!value || value == ''){ return { valid:false, error: 'Attribute must not be blank' } }
|
|
155
|
+
return { valid:true }
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Checks if phone number is a vali US number
|
|
160
|
+
* @param phone
|
|
161
|
+
* @returns
|
|
162
|
+
*/
|
|
163
|
+
isPhoneValid : (phone:string):{ valid: boolean, error?:string } => {
|
|
164
|
+
if(!phone || phone === '') { return { valid: false, error:'Phone number must be entered' } }
|
|
165
|
+
let phoneasnum = parseInt(phone)
|
|
166
|
+
if(isNaN(phoneasnum)){ return { valid:false, error:'Phone number must be a US 10 digit number' } }
|
|
167
|
+
if(phone.length === 10){ return { valid:true } }
|
|
168
|
+
return { valid:false, error: 'Phone number must be a US 10 digit number' }
|
|
169
|
+
},
|
|
170
|
+
isPasswordValid : (password:string, validState:PasswordStateProps):PasswordStateProps => {
|
|
171
|
+
if(!password || password === ''){ return { ...validState, state:'not_started' } }
|
|
172
|
+
switch(validState.type){
|
|
173
|
+
case 'min_character':
|
|
174
|
+
if(password.length < 8){ return { ...validState, state:'invalid', error:`Password is only ${password.length} characters` } }
|
|
175
|
+
return { ...validState, state:'valid' }
|
|
176
|
+
case 'case':
|
|
177
|
+
if(ProfileHelpers.doesStringContainUpperAndLowercase(password)){ return { ...validState, state:'valid' } }
|
|
178
|
+
return { ...validState, state:'invalid', error:'Password does not contain upper and lower case' }
|
|
179
|
+
case 'number':
|
|
180
|
+
if(ProfileHelpers.doesStringContainDigit(password)){ return { ...validState, state:'valid' } }
|
|
181
|
+
return { ...validState, state:'invalid', error:'Password does not contain a number' }
|
|
182
|
+
case 'special':
|
|
183
|
+
if(ProfileHelpers.doesStringContainSpecialCharacter(password)) { return { ...validState, state:'valid' } }
|
|
184
|
+
return { ...validState, state:'invalid', error: 'Password does not contain a special character' }
|
|
185
|
+
default: return validState
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Regex to check if string contains upper and lowercase letter
|
|
191
|
+
* @param text
|
|
192
|
+
* @returns
|
|
193
|
+
*/
|
|
194
|
+
doesStringContainUpperAndLowercase : (text:string) => {
|
|
195
|
+
if(/^(?=.*[a-z])(?=.*[A-Z])/.test(text)){ return true }
|
|
196
|
+
return false
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Regex to check if string contains a number
|
|
201
|
+
* @param text
|
|
202
|
+
* @returns
|
|
203
|
+
*/
|
|
204
|
+
doesStringContainDigit : (text:string) => {
|
|
205
|
+
if(/^(?=.*\d)/.test(text)){ return true }
|
|
206
|
+
return false
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Regext to check if string contains a special character
|
|
211
|
+
* @param value
|
|
212
|
+
* @returns
|
|
213
|
+
*/
|
|
214
|
+
doesStringContainSpecialCharacter : (value:string) => {
|
|
215
|
+
var reg = /^(?=.*[~!@#$%^&*()?.,';`])/;
|
|
216
|
+
if(reg.test(value)) {
|
|
217
|
+
return true
|
|
218
|
+
}
|
|
219
|
+
return false
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Checks if two password strings match
|
|
225
|
+
* @param account
|
|
226
|
+
* @returns
|
|
227
|
+
*/
|
|
228
|
+
doPasswordsMatch : (password:string, re_password:string):PasswordStateProps => {
|
|
229
|
+
if(!re_password){ return { attribute:'re_password', state:'not_started' } }
|
|
230
|
+
if(password == re_password){ return { attribute:'re_password', state:'valid' } }
|
|
231
|
+
return { attribute: 're_password', state:'invalid', error: 'Passwords do not match' }
|
|
232
|
+
},
|
|
233
|
+
getReferralDescription : (promo:PromoProps) => {
|
|
234
|
+
switch(promo.type){
|
|
235
|
+
case 'promo_code': return `Get ${promo.amount} promo bucks after you verify your account`
|
|
236
|
+
case 'promo_sweepstakes': return `Have a chance at UP TO 500 promo bucks after you verify your account`
|
|
237
|
+
case 'referral_code': return `Get ${promo.amount} promo bucks after you verify your account. Your referrer will get the same after you make your first deposit`
|
|
238
|
+
case 'referral_sweepstakes': return `Have a change at UP TO 500 promo bucks after you verify your account. Your referrer will get the same after you make your first deposit`
|
|
239
|
+
default: return ''
|
|
240
|
+
}
|
|
241
|
+
} ,
|
|
242
|
+
isChangeCodeAllowed :(code_request?:CodeRequestProps ) => {
|
|
243
|
+
if(!code_request){ return true }
|
|
244
|
+
if(['fulfilled','closed'].includes(code_request.status)){ return false }
|
|
245
|
+
return true
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export { ProfileApi, ProfileHelpers }
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
Vouched?:any;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface PublicPlayerProps {
|
|
8
|
+
player_id:string,
|
|
9
|
+
username:string,
|
|
10
|
+
email:string,
|
|
11
|
+
dob?:string,
|
|
12
|
+
first_name:string,
|
|
13
|
+
phone:number,
|
|
14
|
+
premium_tier_id?:string,
|
|
15
|
+
zip?:string;
|
|
16
|
+
last_name:string;
|
|
17
|
+
type:string,
|
|
18
|
+
role:'admin'|'player'|'company'|'support'|'guest',
|
|
19
|
+
create_datetime:any,
|
|
20
|
+
verified:boolean,
|
|
21
|
+
home_location:string,
|
|
22
|
+
anonymous?:boolean,
|
|
23
|
+
auto_generated?:boolean,
|
|
24
|
+
no_password?:boolean,
|
|
25
|
+
show_name:string,
|
|
26
|
+
profile_pic?:string,
|
|
27
|
+
vouched_id?:string,
|
|
28
|
+
phone_verified:boolean,
|
|
29
|
+
bio?:string,
|
|
30
|
+
vouched_status:'unverified' | 'failed' | 'verified',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ProfileLevelProps {
|
|
34
|
+
num:number, label:string, description:string, identifier:string, pct_complete:number, profile_steps:ProfileStepProps[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ProfileStepProps {
|
|
38
|
+
num:number, check:string, label:string, description: string, pct_complete?:number, complete?:boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface PasswordStateProps {
|
|
42
|
+
type?:string,
|
|
43
|
+
label?:string,
|
|
44
|
+
attribute:string,
|
|
45
|
+
state:'not_started'|'valid'|'invalid',
|
|
46
|
+
error?:string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface CodeRequestProps {
|
|
50
|
+
code_request_id:string,
|
|
51
|
+
player_id:string,
|
|
52
|
+
referral_code:string,
|
|
53
|
+
create_datetime:any,
|
|
54
|
+
reward_option_id?:string,
|
|
55
|
+
status:'requested' | 'fulfilled' | 'invalid' | 'verified' | 'closed',
|
|
56
|
+
last_update_datetime: any,
|
|
57
|
+
referrer_id?:string,
|
|
58
|
+
pending_deposit?:boolean
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PlayerBalanceProps {
|
|
62
|
+
player_balance_id:string,
|
|
63
|
+
player_id:string,
|
|
64
|
+
free_market_balance:number,
|
|
65
|
+
balance:number,
|
|
66
|
+
promo_balance:number,
|
|
67
|
+
create_datetime:any,
|
|
68
|
+
last_udpate_datetime:any
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface RewardOptionProps {
|
|
72
|
+
reward_option_id: string,
|
|
73
|
+
reward_type: string,
|
|
74
|
+
reward_value: number,
|
|
75
|
+
reward_name:string,
|
|
76
|
+
status: 'active' | 'inactive',
|
|
77
|
+
market_type: 'FOR_MONEY' | 'FREE' | 'PROMO',
|
|
78
|
+
award_quotient: number,
|
|
79
|
+
create_datetime: any,
|
|
80
|
+
last_update_datetime: any
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export interface PlayerReferralProps {
|
|
85
|
+
player_referral_id:string,
|
|
86
|
+
referrer_id:string,
|
|
87
|
+
referred_phone?:number,
|
|
88
|
+
referral_code:string,
|
|
89
|
+
referral_quality_quotient?:number,
|
|
90
|
+
status:'pending' | 'closed' | 'inactive',
|
|
91
|
+
promo_id: string,
|
|
92
|
+
company_id?:string,
|
|
93
|
+
create_datetime?: any,
|
|
94
|
+
description?:string,
|
|
95
|
+
code_image?:string,
|
|
96
|
+
last_update_datetime?:any
|
|
97
|
+
promo?:PromoProps
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
export interface PromoProps {
|
|
102
|
+
promo_id:string,
|
|
103
|
+
description:string,
|
|
104
|
+
type: 'referral_code' | 'promo_code' | 'promo_sweepstakes' | 'referral_sweepstakes',
|
|
105
|
+
amount:number,
|
|
106
|
+
amount_type:'FOR_MONEY'|'FREE',
|
|
107
|
+
status: 'active' | 'inactive',
|
|
108
|
+
expire_type: 'quantity' | 'time',
|
|
109
|
+
available_codes: number,
|
|
110
|
+
expire_datetime:any,
|
|
111
|
+
create_datetime:any
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export interface MyPlayerProps {
|
|
116
|
+
player_id:string,
|
|
117
|
+
profile_pic:string,
|
|
118
|
+
username:string,
|
|
119
|
+
first_name:string,
|
|
120
|
+
last_name:string,
|
|
121
|
+
email:string,
|
|
122
|
+
type:'premium'|'freemium',
|
|
123
|
+
anonymous:boolean,
|
|
124
|
+
role:'player'|'admin',
|
|
125
|
+
guide_me?:boolean,
|
|
126
|
+
dob?:string,
|
|
127
|
+
auto_generated:boolean,
|
|
128
|
+
no_password:boolean,
|
|
129
|
+
open_to_challenges:boolean,
|
|
130
|
+
verified:boolean, //Email verification
|
|
131
|
+
phone:string,
|
|
132
|
+
phone_verified:boolean,
|
|
133
|
+
vouched_status: 'verified'|'unverified'|'failed',
|
|
134
|
+
bio?:string,
|
|
135
|
+
terms_agreed_on?:any,
|
|
136
|
+
create_datetime:any,
|
|
137
|
+
last_update_datetime:any
|
|
138
|
+
}
|