be-components 0.1.1
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/LICENSE +20 -0
- package/README.md +31 -0
- package/lib/commonjs/AuthenticateWizard/Components/StrategyForm.js +398 -0
- package/lib/commonjs/AuthenticateWizard/Components/StrategyForm.js.map +1 -0
- package/lib/commonjs/AuthenticateWizard/api/index.js +246 -0
- package/lib/commonjs/AuthenticateWizard/api/index.js.map +1 -0
- package/lib/commonjs/AuthenticateWizard/api/types.d.js +2 -0
- package/lib/commonjs/AuthenticateWizard/api/types.d.js.map +1 -0
- package/lib/commonjs/AuthenticateWizard/index.js +85 -0
- package/lib/commonjs/AuthenticateWizard/index.js.map +1 -0
- package/lib/commonjs/Components/Button.js +84 -0
- package/lib/commonjs/Components/Button.js.map +1 -0
- package/lib/commonjs/Components/Checkbox.js +41 -0
- package/lib/commonjs/Components/Checkbox.js.map +1 -0
- package/lib/commonjs/Components/Icons.js +1492 -0
- package/lib/commonjs/Components/Icons.js.map +1 -0
- package/lib/commonjs/Components/Spring.js +44 -0
- package/lib/commonjs/Components/Spring.js.map +1 -0
- package/lib/commonjs/Components/Text.js +44 -0
- package/lib/commonjs/Components/Text.js.map +1 -0
- package/lib/commonjs/Components/TextInput.js +45 -0
- package/lib/commonjs/Components/TextInput.js.map +1 -0
- package/lib/commonjs/Components/index.js +49 -0
- package/lib/commonjs/Components/index.js.map +1 -0
- package/lib/commonjs/Font.css +23 -0
- package/lib/commonjs/constants/colors.js +66 -0
- package/lib/commonjs/constants/colors.js.map +1 -0
- package/lib/commonjs/constants/styles.js +43 -0
- package/lib/commonjs/constants/styles.js.map +1 -0
- package/lib/commonjs/fonts/Barlow-Bold.ttf +0 -0
- package/lib/commonjs/fonts/Barlow-Light.ttf +0 -0
- package/lib/commonjs/fonts/Barlow-Regular.ttf +0 -0
- package/lib/commonjs/fonts/Barlow-SemiBold.ttf +0 -0
- package/lib/commonjs/index.js +33 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/AuthenticateWizard/Components/StrategyForm.js +389 -0
- package/lib/module/AuthenticateWizard/Components/StrategyForm.js.map +1 -0
- package/lib/module/AuthenticateWizard/api/index.js +240 -0
- package/lib/module/AuthenticateWizard/api/index.js.map +1 -0
- package/lib/module/AuthenticateWizard/api/types.d.js +2 -0
- package/lib/module/AuthenticateWizard/api/types.d.js.map +1 -0
- package/lib/module/AuthenticateWizard/index.js +77 -0
- package/lib/module/AuthenticateWizard/index.js.map +1 -0
- package/lib/module/Components/Button.js +77 -0
- package/lib/module/Components/Button.js.map +1 -0
- package/lib/module/Components/Checkbox.js +34 -0
- package/lib/module/Components/Checkbox.js.map +1 -0
- package/lib/module/Components/Icons.js +1485 -0
- package/lib/module/Components/Icons.js.map +1 -0
- package/lib/module/Components/Spring.js +37 -0
- package/lib/module/Components/Spring.js.map +1 -0
- package/lib/module/Components/Text.js +37 -0
- package/lib/module/Components/Text.js.map +1 -0
- package/lib/module/Components/TextInput.js +38 -0
- package/lib/module/Components/TextInput.js.map +1 -0
- package/lib/module/Components/index.js +8 -0
- package/lib/module/Components/index.js.map +1 -0
- package/lib/module/Font.css +23 -0
- package/lib/module/constants/colors.js +60 -0
- package/lib/module/constants/colors.js.map +1 -0
- package/lib/module/constants/styles.js +36 -0
- package/lib/module/constants/styles.js.map +1 -0
- package/lib/module/fonts/Barlow-Bold.ttf +0 -0
- package/lib/module/fonts/Barlow-Light.ttf +0 -0
- package/lib/module/fonts/Barlow-Regular.ttf +0 -0
- package/lib/module/fonts/Barlow-SemiBold.ttf +0 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/AuthenticateWizard/Components/StrategyForm.d.ts +15 -0
- package/lib/typescript/src/AuthenticateWizard/Components/StrategyForm.d.ts.map +1 -0
- package/lib/typescript/src/AuthenticateWizard/api/index.d.ts +80 -0
- package/lib/typescript/src/AuthenticateWizard/api/index.d.ts.map +1 -0
- package/lib/typescript/src/AuthenticateWizard/index.d.ts +15 -0
- package/lib/typescript/src/AuthenticateWizard/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/Button.d.ts +30 -0
- package/lib/typescript/src/Components/Button.d.ts.map +1 -0
- package/lib/typescript/src/Components/Checkbox.d.ts +11 -0
- package/lib/typescript/src/Components/Checkbox.d.ts.map +1 -0
- package/lib/typescript/src/Components/Icons.d.ts +44 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -0
- package/lib/typescript/src/Components/Spring.d.ts +11 -0
- package/lib/typescript/src/Components/Spring.d.ts.map +1 -0
- package/lib/typescript/src/Components/Text.d.ts +13 -0
- package/lib/typescript/src/Components/Text.d.ts.map +1 -0
- package/lib/typescript/src/Components/TextInput.d.ts +15 -0
- package/lib/typescript/src/Components/TextInput.d.ts.map +1 -0
- package/lib/typescript/src/Components/index.d.ts +8 -0
- package/lib/typescript/src/Components/index.d.ts.map +1 -0
- package/lib/typescript/src/constants/colors.d.ts +60 -0
- package/lib/typescript/src/constants/colors.d.ts.map +1 -0
- package/lib/typescript/src/constants/styles.d.ts +34 -0
- package/lib/typescript/src/constants/styles.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +167 -0
- package/src/AuthenticateWizard/Components/StrategyForm.tsx +292 -0
- package/src/AuthenticateWizard/api/index.ts +164 -0
- package/src/AuthenticateWizard/api/types.d.ts +134 -0
- package/src/AuthenticateWizard/index.tsx +84 -0
- package/src/Components/Button.tsx +63 -0
- package/src/Components/Checkbox.tsx +28 -0
- package/src/Components/Icons.tsx +698 -0
- package/src/Components/Spring.tsx +38 -0
- package/src/Components/Text.tsx +35 -0
- package/src/Components/TextInput.tsx +45 -0
- package/src/Components/index.tsx +15 -0
- package/src/Font.css +23 -0
- package/src/constants/colors.ts +61 -0
- package/src/constants/styles.ts +40 -0
- package/src/fonts/Barlow-Bold.ttf +0 -0
- package/src/fonts/Barlow-Light.ttf +0 -0
- package/src/fonts/Barlow-Regular.ttf +0 -0
- package/src/fonts/Barlow-SemiBold.ttf +0 -0
- package/src/index.tsx +9 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import axios from "axios"
|
|
2
|
+
import type { AuthExecutionRequestProps, AuthStrategyIdentifierProps, AuthStrategyProps, PlayerTokenProps, PublicPlayerProps } from "./types";
|
|
3
|
+
|
|
4
|
+
const AUTH_ENDPOINTS = {
|
|
5
|
+
DEVELOPMENT: 'http://localhost:5000',
|
|
6
|
+
STAGING: 'https://stage-be-auth-svc.herokuapp.com',
|
|
7
|
+
PRODUCTION: 'https://api.players.bettoredge.com'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let AUTH_SVC_API = ''
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
AuthenticateApi,
|
|
14
|
+
AuthenticateHelpers
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const AuthenticateApi = {
|
|
18
|
+
setEnvironment: (env:'PRODUCTION'|'STAGING'|'DEVELOPMENT') => {
|
|
19
|
+
AUTH_SVC_API = AUTH_ENDPOINTS[env];
|
|
20
|
+
},
|
|
21
|
+
authenticateLocal : async(username:string, password:string, device_id:string):Promise<{ access_token:string, refresh_token:string, expire_datetime:string }> => {
|
|
22
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/authenticate`, { username, password, device_id })
|
|
23
|
+
return resp.data
|
|
24
|
+
},
|
|
25
|
+
refreshToken : async(refresh_token:string, device_id:string):Promise<{ access_token:string, refresh_token:string, expire_datetime:string }> => {
|
|
26
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/tokens/token/refresh`, { refresh_token, device_id })
|
|
27
|
+
return resp.data
|
|
28
|
+
},
|
|
29
|
+
authenticatePhone : async(phone:string, device_id:string, referral_code?:string):Promise<void> => {
|
|
30
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/phone/authenticate`, { phone, device_id, referral_code })
|
|
31
|
+
},
|
|
32
|
+
verifyPhoneAuthenticate : async(token:string, device_id:string):Promise<{ access_token:string, refresh_token:string, expire_datetime:string }> => {
|
|
33
|
+
let resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/phone/verify`, { token, device_id })
|
|
34
|
+
return resp.data
|
|
35
|
+
},
|
|
36
|
+
getMyDetails : async():Promise<PublicPlayerProps> => {
|
|
37
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/me`)
|
|
38
|
+
return resp.data.player
|
|
39
|
+
},
|
|
40
|
+
forgotUsername : async(attribute:string, attribute_value:string):Promise<void> => {
|
|
41
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/forgot/username`, { attribute, attribute_value })
|
|
42
|
+
return
|
|
43
|
+
},
|
|
44
|
+
forgotPassword : async(attribute:string, attribute_value:string):Promise<void> => {
|
|
45
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/forgot/password`, { attribute, attribute_value })
|
|
46
|
+
return
|
|
47
|
+
},
|
|
48
|
+
resetPassword : async(password:string, repassword:string, verify_code:string):Promise<void> => {
|
|
49
|
+
await axios.post(`${AUTH_SVC_API}/v1/players/player/reset/password`, { password, repassword, verify_code })
|
|
50
|
+
return
|
|
51
|
+
},
|
|
52
|
+
getShortToken : async():Promise<PlayerTokenProps> => {
|
|
53
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/tokens/short`)
|
|
54
|
+
return resp.data.player_token
|
|
55
|
+
},
|
|
56
|
+
getAuthStrategyById: async(auth_strategy_id:string):Promise<{ auth_strategy:AuthStrategyProps, auth_strategy_identifiers:AuthStrategyIdentifierProps[] }> => {
|
|
57
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/authenticate/strategy/id/${auth_strategy_id}`)
|
|
58
|
+
return resp.data
|
|
59
|
+
},
|
|
60
|
+
executeAuthStrategy: async(auth_execution_request:AuthExecutionRequestProps):Promise<{ result:'success'|'fail', device_id:string, message:string, auth_strategy_id:string, verification_session_id:string, session_expire_datetime:any, auth_strategy_identifier_id:string }> => {
|
|
61
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/authenticate/strategy/try`, { auth_execution_request })
|
|
62
|
+
console.log(resp.data)
|
|
63
|
+
return resp.data
|
|
64
|
+
},
|
|
65
|
+
verifyAuthStrategyIdentifier: async(auth_strategy_identifier_id:string, verification_session_id:string, token:string, device_id?:string):Promise<{ result: 'success'|'fail', access_token?:string, refresh_token?:string, expire_datetime?:any }> => {
|
|
66
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/authenticate/strategy/identifier/verify`, { auth_strategy_identifier_id, verification_session_id, token, device_id });
|
|
67
|
+
console.log(resp.data)
|
|
68
|
+
return resp.data
|
|
69
|
+
},
|
|
70
|
+
getCompanyById: async(company_id:string) => {
|
|
71
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/companies/company/id/${company_id}`)
|
|
72
|
+
console.log(resp.data)
|
|
73
|
+
return resp.data
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const AuthenticateHelpers = {
|
|
78
|
+
/**
|
|
79
|
+
* Takes a phone number string and returns a formatted verison of the phone number with - between numbers
|
|
80
|
+
* @param phone
|
|
81
|
+
* @returns formatted phone string
|
|
82
|
+
*/
|
|
83
|
+
formatPhone : (phone?:string) => {
|
|
84
|
+
if(!phone){ return '' }
|
|
85
|
+
let splitPhone = phone.split('')
|
|
86
|
+
if(splitPhone.length === 0){ return '' }
|
|
87
|
+
if(splitPhone.length > 10 && splitPhone[0] == '1'){ splitPhone.splice(0,1) }
|
|
88
|
+
let newPhone = ''
|
|
89
|
+
splitPhone.map((c, i) => {
|
|
90
|
+
newPhone += c
|
|
91
|
+
if(i === 2 && splitPhone.length > 3){ newPhone += '-' }
|
|
92
|
+
if(i === 5 && splitPhone.length > 6){ newPhone += '-' }
|
|
93
|
+
})
|
|
94
|
+
return newPhone
|
|
95
|
+
},
|
|
96
|
+
isEmailValid : (email:string):{ valid:boolean, error?:string } => {
|
|
97
|
+
if(email === ''){ return { valid:false, error:'Please enter valid email' } }
|
|
98
|
+
// function that returns true if value is email, false otherwise
|
|
99
|
+
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,}))$/;
|
|
100
|
+
if (emailRex.test(email)) {
|
|
101
|
+
return { valid:true };
|
|
102
|
+
}
|
|
103
|
+
return { valid:false, error:'Must be a valid email' };
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Removes - from a formatted phone string
|
|
107
|
+
* @param formatted_phone
|
|
108
|
+
* @returns unformatted phone string
|
|
109
|
+
*/
|
|
110
|
+
unformatPhone : (formatted_phone:string) => {
|
|
111
|
+
let splitPhone = formatted_phone.split('-')
|
|
112
|
+
let newPhone = ''
|
|
113
|
+
splitPhone.map(c => {
|
|
114
|
+
newPhone += c
|
|
115
|
+
})
|
|
116
|
+
return newPhone
|
|
117
|
+
},
|
|
118
|
+
fullUnformatPhone : (formatted_phone:string) => {
|
|
119
|
+
let unformatted_phone = AuthenticateHelpers.unformatPhone(formatted_phone)
|
|
120
|
+
let no_par = unformatted_phone.split('(')
|
|
121
|
+
unformatted_phone = no_par.join('')
|
|
122
|
+
no_par = unformatted_phone.split(')')
|
|
123
|
+
unformatted_phone = no_par.join('')
|
|
124
|
+
let no_plus = unformatted_phone.split('+1')
|
|
125
|
+
unformatted_phone = no_plus.join('')
|
|
126
|
+
let no_space = unformatted_phone.split(' ')
|
|
127
|
+
unformatted_phone = no_space.join('')
|
|
128
|
+
return unformatted_phone
|
|
129
|
+
},
|
|
130
|
+
isStrategyValid : (auth_execution_request:AuthExecutionRequestProps) => {
|
|
131
|
+
let request_valid = true;
|
|
132
|
+
auth_execution_request.attributes.map(a => {
|
|
133
|
+
if(!request_valid){ return }
|
|
134
|
+
const { valid } = AuthenticateHelpers.isAttributeValid(a.attribute, a.value)
|
|
135
|
+
if(!valid){ request_valid = false }
|
|
136
|
+
})
|
|
137
|
+
return request_valid
|
|
138
|
+
},
|
|
139
|
+
isAttributeValid : (attribute:string, value:string, optional?:boolean):{ valid:boolean, error?:string } => {
|
|
140
|
+
if(optional){ return { valid:true } }
|
|
141
|
+
switch(attribute){
|
|
142
|
+
case 'phone':
|
|
143
|
+
return AuthenticateHelpers.isPhoneValid(value)
|
|
144
|
+
case 'email':
|
|
145
|
+
return AuthenticateHelpers.isEmailValid(value)
|
|
146
|
+
default:
|
|
147
|
+
if(!value || value == ''){ return { valid:false, error: 'Attribute must not be blank' } }
|
|
148
|
+
return { valid:true }
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Checks if phone number is a vali US number
|
|
153
|
+
* @param phone
|
|
154
|
+
* @returns
|
|
155
|
+
*/
|
|
156
|
+
isPhoneValid : (phone:string):{ valid: boolean, error?:string } => {
|
|
157
|
+
if(!phone || phone === '') { return { valid: false, error:'Phone number must be entered' } }
|
|
158
|
+
let phoneasnum = parseInt(phone)
|
|
159
|
+
if(isNaN(phoneasnum)){ return { valid:false, error:'Phone number must be a US 10 digit number' } }
|
|
160
|
+
if(phone.length === 10){ return { valid:true } }
|
|
161
|
+
return { valid:false, error: 'Phone number must be a US 10 digit number' }
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export interface PublicPlayerProps {
|
|
2
|
+
player_id:string,
|
|
3
|
+
username:string,
|
|
4
|
+
email:string,
|
|
5
|
+
dob?:string,
|
|
6
|
+
first_name:string,
|
|
7
|
+
phone:number,
|
|
8
|
+
premium_tier_id?:string,
|
|
9
|
+
zip?:string;
|
|
10
|
+
last_name:string;
|
|
11
|
+
type:string,
|
|
12
|
+
role:'admin'|'player'|'company'|'support'|'guest',
|
|
13
|
+
create_datetime:any,
|
|
14
|
+
verified:boolean,
|
|
15
|
+
home_location:string,
|
|
16
|
+
anonymous?:boolean,
|
|
17
|
+
auto_generated?:boolean,
|
|
18
|
+
no_password?:boolean,
|
|
19
|
+
show_name:string,
|
|
20
|
+
profile_pic?:string,
|
|
21
|
+
vouched_id?:string,
|
|
22
|
+
phone_verified:boolean,
|
|
23
|
+
bio?:string,
|
|
24
|
+
vouched_status:'unverified' | 'failed' | 'verified',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface PlayerTokenProps {
|
|
28
|
+
player_token_id:string,
|
|
29
|
+
player_id:string|number,
|
|
30
|
+
token:string,
|
|
31
|
+
token_type:'refresh'|'phone_verify'|'email_verify'|'password_verify'|'short',
|
|
32
|
+
device_id:string,
|
|
33
|
+
status:'active'|'inactive'|'rotated',
|
|
34
|
+
create_datetime:any,
|
|
35
|
+
last_update_datetime:any,
|
|
36
|
+
expire_datetime:any
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export interface AuthStrategyProps {
|
|
43
|
+
auth_strategy_id:string,
|
|
44
|
+
name: string,
|
|
45
|
+
description: string,
|
|
46
|
+
status:string,
|
|
47
|
+
allow_login?:boolean,
|
|
48
|
+
create_datetime: any,
|
|
49
|
+
last_update_datetime:any
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface AuthIdentifierProps {
|
|
53
|
+
auth_identifier_id:string,
|
|
54
|
+
attribute: string,
|
|
55
|
+
status:'active'|'inactive',
|
|
56
|
+
create_datetime: any,
|
|
57
|
+
last_update_datetime: any
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface AuthStrategyIdentifierProps {
|
|
61
|
+
auth_strategy_identifier_id:string,
|
|
62
|
+
auth_strategy_id: string,
|
|
63
|
+
auth_identifier?:AuthIdentifierProps,
|
|
64
|
+
auth_identifier_id: string,
|
|
65
|
+
verify_required:boolean,
|
|
66
|
+
verify_label?:string,
|
|
67
|
+
priority:number,
|
|
68
|
+
optional?:boolean,
|
|
69
|
+
secure_text_entry?:boolean,
|
|
70
|
+
label:string,
|
|
71
|
+
token_required?:boolean,
|
|
72
|
+
description:string,
|
|
73
|
+
status: 'active'|'inactive',
|
|
74
|
+
create_datetime: any,
|
|
75
|
+
last_update_datetime:any
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface AuthExecutionRequestProps {
|
|
79
|
+
auth_strategy_id:string,
|
|
80
|
+
device_id?:string,
|
|
81
|
+
source:string,
|
|
82
|
+
referral_code?:string,
|
|
83
|
+
attributes: {
|
|
84
|
+
attribute: string,
|
|
85
|
+
value: string,
|
|
86
|
+
pretty_value?:string
|
|
87
|
+
}[]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface AuthExecutionResponseProps {
|
|
91
|
+
auth_strategy_id: string,
|
|
92
|
+
result: 'authenticated' | 'verify' | 'failed',
|
|
93
|
+
access_token?:string,
|
|
94
|
+
refresh_token?:string,
|
|
95
|
+
expire_datetime?:any
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
export interface CompanyProps {
|
|
100
|
+
company_id:string,
|
|
101
|
+
company_name: string,
|
|
102
|
+
company_code:string,
|
|
103
|
+
company_description: string,
|
|
104
|
+
type: string,
|
|
105
|
+
admin_id:string,
|
|
106
|
+
player_referrals?:PlayerReferralProps[],
|
|
107
|
+
short_name:string,
|
|
108
|
+
status: 'active'|'inactive',
|
|
109
|
+
company_image?: {
|
|
110
|
+
url: string,
|
|
111
|
+
width?:number,
|
|
112
|
+
height?:number
|
|
113
|
+
},
|
|
114
|
+
brand_primary?:string,
|
|
115
|
+
brand_secondary?:string,
|
|
116
|
+
advertising_enabled:boolean,
|
|
117
|
+
competitions_enabled:boolean,
|
|
118
|
+
catalog_enabled:boolean,
|
|
119
|
+
api_enabled:boolean,
|
|
120
|
+
legacy_id?:string,
|
|
121
|
+
create_datetime:any,
|
|
122
|
+
last_update_datetime: any
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
export interface CompanyMemberProps {
|
|
127
|
+
company_member_id:string,
|
|
128
|
+
company_id:string,
|
|
129
|
+
player_id:string,
|
|
130
|
+
status: 'active' | 'inactive',
|
|
131
|
+
role: 'admin'|'contributor',
|
|
132
|
+
create_datetime:any,
|
|
133
|
+
last_update_datetime:any
|
|
134
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { LinearGradient } from 'expo-linear-gradient';
|
|
3
|
+
import { Spring } from '../Components';
|
|
4
|
+
import Colors from '../constants/colors';
|
|
5
|
+
import StrategyForm from './Components/StrategyForm';
|
|
6
|
+
import { AuthenticateApi } from './api';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
type AuthenticateWizardProps = {
|
|
10
|
+
auth_strategy_id:string,
|
|
11
|
+
width:number,
|
|
12
|
+
company_id?:string,
|
|
13
|
+
device_id?:string,
|
|
14
|
+
source:string,
|
|
15
|
+
opt_in_url?:string,
|
|
16
|
+
referral_code?:string,
|
|
17
|
+
environment: 'PRODUCTION'|'STAGING'|'DEVELOPMENT',
|
|
18
|
+
onAuthenticated: (access_token:string, refresh_token:string, expire_datetime:any) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const AuthenticateWizard = ({ environment, auth_strategy_id, company_id, device_id, source, referral_code, width, opt_in_url, onAuthenticated }:AuthenticateWizardProps) => {
|
|
22
|
+
const [ loaded, setLoaded ] = useState(false);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
getWidgetData();
|
|
26
|
+
},[environment])
|
|
27
|
+
|
|
28
|
+
const getWidgetData = async() => {
|
|
29
|
+
AuthenticateApi.setEnvironment(environment)
|
|
30
|
+
setLoaded(true);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Spring
|
|
35
|
+
|
|
36
|
+
to={0}
|
|
37
|
+
from={500}
|
|
38
|
+
slide='vertical'
|
|
39
|
+
style={{ width }}
|
|
40
|
+
>
|
|
41
|
+
<LinearGradient
|
|
42
|
+
style={{ flex:1, minHeight:500, borderTopRightRadius:30, borderTopLeftRadius:30 }}
|
|
43
|
+
nativeID='auth_widget'
|
|
44
|
+
colors={[Colors.shades.shade100, Colors.shades.shade600]}
|
|
45
|
+
>
|
|
46
|
+
<StrategyForm
|
|
47
|
+
visible={loaded?true:false}
|
|
48
|
+
width={width}
|
|
49
|
+
auth_strategy_id={auth_strategy_id}
|
|
50
|
+
company_id={company_id}
|
|
51
|
+
device_id={device_id}
|
|
52
|
+
source={source}
|
|
53
|
+
referral_code={referral_code}
|
|
54
|
+
opt_in_url={opt_in_url}
|
|
55
|
+
onAuthenticated={onAuthenticated}
|
|
56
|
+
/>
|
|
57
|
+
</LinearGradient>
|
|
58
|
+
</Spring>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default AuthenticateWizard
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
{authenticated ?
|
|
66
|
+
<Spring
|
|
67
|
+
style={{ position:'absolute', backgroundColor:Colors.shades.white, borderTopRightRadius:22, borderTopLeftRadius:22, top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}
|
|
68
|
+
to={0}
|
|
69
|
+
from={500}
|
|
70
|
+
slide="vertical"
|
|
71
|
+
>
|
|
72
|
+
<View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
|
|
73
|
+
<View style={{ marginTop: 30 }}>
|
|
74
|
+
<Image
|
|
75
|
+
source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1704746039/be_logo_2_idjbro.png' }}
|
|
76
|
+
style={{ height:width * 0.5, width:width * 0.5 }}
|
|
77
|
+
resizeMode="cover"
|
|
78
|
+
/>
|
|
79
|
+
</View>
|
|
80
|
+
</View>
|
|
81
|
+
</Spring>
|
|
82
|
+
:<></>}
|
|
83
|
+
|
|
84
|
+
*/
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, Image, TouchableOpacity, View } from "react-native"
|
|
3
|
+
import { Text } from '.';
|
|
4
|
+
import Colors from '../constants/colors';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
type ButtonProps = {
|
|
8
|
+
borderRadiusOverride?: { borderTopRightRadius:number, borderBottomRightRadius:number, borderTopLeftRadius:number, borderBottomLeftRadius:number }
|
|
9
|
+
title?:string,
|
|
10
|
+
title_weight?:'bold'|'semibold'|'regular'|'light',
|
|
11
|
+
avatar_url?:string,
|
|
12
|
+
icon_size?:number,
|
|
13
|
+
icon_side?:'left'|'right',
|
|
14
|
+
icon_name?:'chevron'|'list'|'trophy',
|
|
15
|
+
loading?:boolean,
|
|
16
|
+
icon_direction?:'up'|'down'|'right'|'left'
|
|
17
|
+
borderRadius?:number,
|
|
18
|
+
padding?:number,
|
|
19
|
+
title_color?:string,
|
|
20
|
+
disabled?:boolean,
|
|
21
|
+
title_size?:number,
|
|
22
|
+
style?:any,
|
|
23
|
+
backgroundColor?:string,
|
|
24
|
+
borderWidth?:number,
|
|
25
|
+
borderColor?:string,
|
|
26
|
+
onPress:any
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const Button = ({ title, style, title_weight, disabled, loading, title_size, padding, borderRadiusOverride, avatar_url, title_color, borderWidth, borderColor, backgroundColor, borderRadius, onPress }:ButtonProps) => {
|
|
31
|
+
let input_style = style ?? {}
|
|
32
|
+
const getBorderRadiusOverride = () => {
|
|
33
|
+
if(!borderRadiusOverride){ return { borderRadius: borderRadius??4 } }
|
|
34
|
+
return { ...borderRadiusOverride }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<TouchableOpacity
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
style={{ ...getBorderRadiusOverride(), flexDirection:'row', alignItems:'center', padding:padding??8, backgroundColor:backgroundColor??Colors.shades.white, borderWidth:borderWidth??0, borderColor:borderColor??'transparent', ...input_style }} onPress={(ev) => onPress(ev)}>
|
|
41
|
+
{avatar_url ?
|
|
42
|
+
<Image
|
|
43
|
+
source={{ uri: avatar_url }}
|
|
44
|
+
style={{ height:28, width:28, borderRadius:100, marginRight:12 }}
|
|
45
|
+
resizeMode='cover'
|
|
46
|
+
/>
|
|
47
|
+
:<></>}
|
|
48
|
+
|
|
49
|
+
{title ?
|
|
50
|
+
<View style={{ flex:1, marginLeft:5, marginRight:5 }}>
|
|
51
|
+
{!loading ?
|
|
52
|
+
<Text size={title_size??14} weight={title_weight ?? 'bold'} textAlign="center" color={title_color??Colors.brand.midnight}>{title}</Text>
|
|
53
|
+
:
|
|
54
|
+
<ActivityIndicator style={{ alignSelf:'center' }} size='small' color={title_color??Colors.brand.midnight} />
|
|
55
|
+
}
|
|
56
|
+
</View>
|
|
57
|
+
:<></>}
|
|
58
|
+
|
|
59
|
+
</TouchableOpacity>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default Button
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import Colors from '../constants/colors';
|
|
4
|
+
|
|
5
|
+
type CheckBoxProps = {
|
|
6
|
+
checked?:boolean,
|
|
7
|
+
size?:number
|
|
8
|
+
color?:string,
|
|
9
|
+
style?: any,
|
|
10
|
+
onSelect:(checked:boolean) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Checkbox = ({ checked, size, color, onSelect, style }:CheckBoxProps) => {
|
|
14
|
+
const box_size = size ?? 20
|
|
15
|
+
const box_color = color ?? Colors.brand.midnight
|
|
16
|
+
return (
|
|
17
|
+
<TouchableOpacity
|
|
18
|
+
style={{ height:box_size, width:box_size, borderWidth:1, borderRadius:4, borderColor:box_color, justifyContent:'center', alignItems:'center', ...style }}
|
|
19
|
+
onPress={() => onSelect(checked ? false : true)}
|
|
20
|
+
>
|
|
21
|
+
{checked ?
|
|
22
|
+
<View style={{ height:box_size*0.75, width:box_size*0.75, backgroundColor:box_color }} />
|
|
23
|
+
:<></>}
|
|
24
|
+
</TouchableOpacity>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Checkbox
|