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
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import axios from "axios"
|
|
2
|
-
import type { AuthExecutionRequestProps, AuthStrategyIdentifierProps, AuthStrategyProps,
|
|
2
|
+
import type { AuthCheckResponseProps, AuthExecutionRequestProps, AuthStrategyIdentifierProps, AuthStrategyProps, CompanyMemberProps, CompanyProps, PlayerTokenProps } from "./types";
|
|
3
|
+
import { APIOverrides } from "../../ApiOverrides";
|
|
3
4
|
|
|
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
5
|
|
|
10
|
-
let AUTH_SVC_API = ''
|
|
6
|
+
let AUTH_SVC_API = '';
|
|
11
7
|
|
|
12
8
|
export {
|
|
13
9
|
AuthenticateApi,
|
|
@@ -15,8 +11,27 @@ export {
|
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
const AuthenticateApi = {
|
|
18
|
-
setEnvironment: (
|
|
19
|
-
|
|
14
|
+
setEnvironment: () => {
|
|
15
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
16
|
+
console.log('setting env!!!')
|
|
17
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
18
|
+
},
|
|
19
|
+
authCheck: async(attribute:'email'|'phone'|'username', value:string):Promise<AuthCheckResponseProps> => {
|
|
20
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/authenticate/check`, { attribute, value })
|
|
21
|
+
return resp.data.auth_response
|
|
22
|
+
},
|
|
23
|
+
authForgot: async(attribute:'email'|'phone'|'username', value:string):Promise<AuthCheckResponseProps> => {
|
|
24
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/authenticate/forgot`, { attribute, value })
|
|
25
|
+
return resp.data.auth_response
|
|
26
|
+
},
|
|
27
|
+
authLogin: async(attribute:'email'|'phone'|'username', value:string, token:string, verification_session_id?:string):Promise<{ result:'success'|'fail', message:string, access_token?:string, refresh_token?:string, expire_datetime?:any }> => {
|
|
28
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/authenticate/login`, { attribute, verification_session_id }, {
|
|
29
|
+
auth: {
|
|
30
|
+
username: value,
|
|
31
|
+
password: token
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return resp.data.login_response
|
|
20
35
|
},
|
|
21
36
|
authenticateLocal : async(username:string, password:string, device_id:string):Promise<{ access_token:string, refresh_token:string, expire_datetime:string }> => {
|
|
22
37
|
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/authenticate`, { username, password, device_id })
|
|
@@ -33,22 +48,7 @@ const AuthenticateApi = {
|
|
|
33
48
|
let resp = await axios.post(`${AUTH_SVC_API}/v1/players/player/phone/verify`, { token, device_id })
|
|
34
49
|
return resp.data
|
|
35
50
|
},
|
|
36
|
-
|
|
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
|
-
},
|
|
51
|
+
|
|
52
52
|
getShortToken : async():Promise<PlayerTokenProps> => {
|
|
53
53
|
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/tokens/short`)
|
|
54
54
|
return resp.data.player_token
|
|
@@ -59,17 +59,14 @@ const AuthenticateApi = {
|
|
|
59
59
|
},
|
|
60
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
61
|
const resp = await axios.post(`${AUTH_SVC_API}/v1/authenticate/strategy/try`, { auth_execution_request })
|
|
62
|
-
console.log(resp.data)
|
|
63
62
|
return resp.data
|
|
64
63
|
},
|
|
65
|
-
verifyAuthStrategyIdentifier: async(auth_strategy_identifier_id:string, verification_session_id:string, token:string, device_id
|
|
64
|
+
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
65
|
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
66
|
return resp.data
|
|
69
67
|
},
|
|
70
|
-
getCompanyById: async(company_id:string) => {
|
|
68
|
+
getCompanyById: async(company_id:string):Promise<{ company:CompanyProps, company_members:CompanyMemberProps[] }> => {
|
|
71
69
|
const resp = await axios.get(`${AUTH_SVC_API}/v1/companies/company/id/${company_id}`)
|
|
72
|
-
console.log(resp.data)
|
|
73
70
|
return resp.data
|
|
74
71
|
}
|
|
75
72
|
}
|
|
@@ -160,5 +157,4 @@ isPhoneValid : (phone:string):{ valid: boolean, error?:string } => {
|
|
|
160
157
|
if(phone.length === 10){ return { valid:true } }
|
|
161
158
|
return { valid:false, error: 'Phone number must be a US 10 digit number' }
|
|
162
159
|
}
|
|
163
|
-
|
|
164
160
|
}
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
}
|
|
1
|
+
|
|
26
2
|
|
|
27
3
|
export interface PlayerTokenProps {
|
|
28
4
|
player_token_id:string,
|
|
@@ -36,9 +12,6 @@ export interface PlayerTokenProps {
|
|
|
36
12
|
expire_datetime:any
|
|
37
13
|
}
|
|
38
14
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
15
|
export interface AuthStrategyProps {
|
|
43
16
|
auth_strategy_id:string,
|
|
44
17
|
name: string,
|
|
@@ -49,6 +22,15 @@ export interface AuthStrategyProps {
|
|
|
49
22
|
last_update_datetime:any
|
|
50
23
|
}
|
|
51
24
|
|
|
25
|
+
export interface AuthCheckResponseProps {
|
|
26
|
+
result: 'success'|'fail',
|
|
27
|
+
message:string,
|
|
28
|
+
verification_session_id?:string,
|
|
29
|
+
attribute?: 'email'|'phone'|'username',
|
|
30
|
+
value?: string,
|
|
31
|
+
next?: 'password' | 'token'
|
|
32
|
+
}
|
|
33
|
+
|
|
52
34
|
export interface AuthIdentifierProps {
|
|
53
35
|
auth_identifier_id:string,
|
|
54
36
|
attribute: string,
|
|
@@ -67,6 +49,7 @@ export interface AuthStrategyIdentifierProps {
|
|
|
67
49
|
priority:number,
|
|
68
50
|
optional?:boolean,
|
|
69
51
|
secure_text_entry?:boolean,
|
|
52
|
+
primary_login?:boolean,
|
|
70
53
|
label:string,
|
|
71
54
|
token_required?:boolean,
|
|
72
55
|
description:string,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import StrategyForm from './Components/StrategyForm';
|
|
3
|
+
import { AuthenticateApi } from './api';
|
|
4
|
+
import { View, Image } from 'react-native';
|
|
5
|
+
import LoginForm from './Components/LoginForm';
|
|
6
|
+
import { Text } from '../Components';
|
|
7
|
+
import Colors from '../constants/colors';
|
|
8
|
+
import type { CompanyProps } from './api/types';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type AuthenticateWizardProps = {
|
|
13
|
+
auth_strategy_id:string,
|
|
14
|
+
width:number,
|
|
15
|
+
company_id?:string,
|
|
16
|
+
default_view?:'login'|'register'
|
|
17
|
+
distinct_id:string,
|
|
18
|
+
source:string,
|
|
19
|
+
opt_in_url?:string,
|
|
20
|
+
referral_code?:string,
|
|
21
|
+
visible?:boolean,
|
|
22
|
+
onAuthenticated: (access_token:string, refresh_token:string, expire_datetime:any) => void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Authenticator = ({ auth_strategy_id, distinct_id, default_view, company_id, source, referral_code, width, opt_in_url, onAuthenticated }:AuthenticateWizardProps) => {
|
|
26
|
+
const [ loaded, setLoaded ] = useState(false);
|
|
27
|
+
const [ company, setCompany ] = useState<CompanyProps>();
|
|
28
|
+
const [ active_view, setActiveView ] = useState(default_view ?? 'register')
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
getWidgetData();
|
|
32
|
+
},[])
|
|
33
|
+
|
|
34
|
+
const getWidgetData = async() => {
|
|
35
|
+
AuthenticateApi.setEnvironment();
|
|
36
|
+
if(company_id){
|
|
37
|
+
const company_resp = await AuthenticateApi.getCompanyById(company_id)
|
|
38
|
+
setCompany(company_resp.company)
|
|
39
|
+
}
|
|
40
|
+
setLoaded(true);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const handleAuthenticated = async(access_token:string, refresh_token:string, expire_datetime:any) => {
|
|
44
|
+
return onAuthenticated(access_token, refresh_token, expire_datetime)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if(!loaded){ return <></> }
|
|
48
|
+
return (
|
|
49
|
+
<View style={{ flex:1 }}>
|
|
50
|
+
{company ?
|
|
51
|
+
<View style={{ padding:20, flexDirection:'row', alignItems:'center', borderTopRightRadius:22, borderTopLeftRadius:22, borderBottomWidth:1, borderColor:Colors.accents.accent200 }}>
|
|
52
|
+
<View style={{ flex:1, marginRight:10 }}>
|
|
53
|
+
<Text size={28} weight='bold' color={Colors.brand.midnight}>{active_view == 'login' ? 'Log In!': 'Welcome!'}</Text>
|
|
54
|
+
<Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} weight='semibold' textAlign='left'>{active_view == 'login' ? 'Continue to login with':'Complete the form below to participate with'} {company?.company_name ?? 'Bettoredge'}</Text>
|
|
55
|
+
</View>
|
|
56
|
+
<View>
|
|
57
|
+
<Image
|
|
58
|
+
source={{ uri: company?.company_image?.url }}
|
|
59
|
+
style={{ width: width * 0.15, height: width * 0.15, borderRadius:8 }}
|
|
60
|
+
resizeMode='cover'
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
</View>
|
|
64
|
+
:<></>}
|
|
65
|
+
<StrategyForm
|
|
66
|
+
visible={active_view == 'register' ? true : false}
|
|
67
|
+
width={width}
|
|
68
|
+
onLogin={() => setActiveView('login')}
|
|
69
|
+
auth_strategy_id={auth_strategy_id}
|
|
70
|
+
company_id={company_id}
|
|
71
|
+
device_id={distinct_id}
|
|
72
|
+
source={source}
|
|
73
|
+
referral_code={referral_code}
|
|
74
|
+
opt_in_url={opt_in_url}
|
|
75
|
+
onAuthenticated={handleAuthenticated}
|
|
76
|
+
/>
|
|
77
|
+
<LoginForm
|
|
78
|
+
width={width}
|
|
79
|
+
visible={ active_view == 'login' ? true : false }
|
|
80
|
+
onAuthenticated={handleAuthenticated}
|
|
81
|
+
onRegister={() => setActiveView('register')}
|
|
82
|
+
/>
|
|
83
|
+
</View>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default Authenticator
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
{authenticated ?
|
|
91
|
+
<Spring
|
|
92
|
+
style={{ position:'absolute', backgroundColor:Colors.shades.white, borderTopRightRadius:22, borderTopLeftRadius:22, top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}
|
|
93
|
+
to={0}
|
|
94
|
+
from={500}
|
|
95
|
+
slide="vertical"
|
|
96
|
+
>
|
|
97
|
+
<View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
|
|
98
|
+
<View style={{ marginTop: 30 }}>
|
|
99
|
+
<Image
|
|
100
|
+
source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1704746039/be_logo_2_idjbro.png' }}
|
|
101
|
+
style={{ height:width * 0.5, width:width * 0.5 }}
|
|
102
|
+
resizeMode="cover"
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
</View>
|
|
106
|
+
</Spring>
|
|
107
|
+
:<></>}
|
|
108
|
+
|
|
109
|
+
*/
|
|
@@ -30,7 +30,7 @@ type ButtonProps = {
|
|
|
30
30
|
const Button = ({ title, style, title_weight, disabled, loading, title_size, padding, borderRadiusOverride, avatar_url, title_color, borderWidth, borderColor, backgroundColor, borderRadius, onPress }:ButtonProps) => {
|
|
31
31
|
let input_style = style ?? {}
|
|
32
32
|
const getBorderRadiusOverride = () => {
|
|
33
|
-
if(!borderRadiusOverride){ return { borderRadius: borderRadius??
|
|
33
|
+
if(!borderRadiusOverride){ return { borderRadius: borderRadius??22 } }
|
|
34
34
|
return { ...borderRadiusOverride }
|
|
35
35
|
}
|
|
36
36
|
|
package/src/Components/Icons.tsx
CHANGED
|
@@ -658,6 +658,62 @@ type IconProps = {
|
|
|
658
658
|
)
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
+
const PhoneIcon = ({ color, size } : IconProps) => {
|
|
662
|
+
const ratio = .7727
|
|
663
|
+
let height = size ?? 14
|
|
664
|
+
let width = height * ratio
|
|
665
|
+
return (
|
|
666
|
+
<svg width={`${width}px`} height={`${height}px`} viewBox="0 0 17 22" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
667
|
+
<title>phone-svgrepo-com</title>
|
|
668
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
|
|
669
|
+
<g id="phone-svgrepo-com" transform="translate(1.438912, 1.000000)" stroke={color ?? Colors.brand.midnight} stroke-width="2">
|
|
670
|
+
<path d="M14.0067027,15.5000775 L14.0067027,4.5000225 C14.069603,3.37367687 13.684301,2.26821134 12.9347973,1.42505713 C12.1852936,0.58190291 11.1326883,0.0695803479 10.0066827,0 L4.00666266,0 C2.88071703,0.0695803479 1.82805177,0.58190291 1.07858802,1.42505713 C0.329114272,2.26821134 -0.0562676553,3.37367687 0.00665265933,4.5000225 L0.00665265933,15.5000775 C-0.0562676553,16.6263831 0.329114272,17.7317887 1.07858802,18.5748929 C1.82805177,19.4180971 2.88071703,19.9303997 4.00666266,20 L10.0066827,20 C11.1326883,19.9303997 12.1852936,19.4180971 12.9347973,18.5748929 C13.684301,17.7317887 14.069603,16.6263831 14.0067027,15.5000775 L14.0067027,15.5000775 Z" id="Path"></path>
|
|
671
|
+
<line x1="9.00687766" y1="3.000015" x2="5.00685766" y2="3.000015" id="Path"></line>
|
|
672
|
+
</g>
|
|
673
|
+
</g>
|
|
674
|
+
</svg>
|
|
675
|
+
)
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
const EmailIcon = ({ color, size } : IconProps) => {
|
|
680
|
+
const ratio = .8181
|
|
681
|
+
let width = size ?? 14
|
|
682
|
+
let height = width * ratio
|
|
683
|
+
return (
|
|
684
|
+
<svg width={`${width}px`} height={`${height}px`} viewBox="0 0 22 18" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
685
|
+
<title>email-svgrepo-com</title>
|
|
686
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
|
687
|
+
<g id="email-svgrepo-com" transform="translate(1.000000, 1.000000)" stroke={color ?? Colors.brand.midnight} stroke-width="2">
|
|
688
|
+
<path d="M1.11111111,2.22222222 L8,7.38888889 C9.18522222,8.27777778 10.8147778,8.27777778 12,7.38888889 L18.8888889,2.22222222" id="Path" stroke-linejoin="round"></path>
|
|
689
|
+
<rect id="Rectangle" x="0" y="0" width="20" height="15.5555556" rx="1"></rect>
|
|
690
|
+
</g>
|
|
691
|
+
</g>
|
|
692
|
+
</svg>
|
|
693
|
+
)
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
const BirthdayIcon = ({ color, size } : IconProps) => {
|
|
697
|
+
const ratio = .958
|
|
698
|
+
let height = size ?? 14
|
|
699
|
+
let width = height * ratio
|
|
700
|
+
return (
|
|
701
|
+
<svg width={`${width}px`} height={`${height}px`} viewBox="0 0 23 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
702
|
+
<title>birthday-card-invitation-svgrepo-com</title>
|
|
703
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
704
|
+
<g id="birthday-card-invitation-svgrepo-com" fill={color ?? Colors.brand.midnight} fill-rule="nonzero">
|
|
705
|
+
<path d="M22.0403438,9.3645 L20.3392969,7.75045312 L20.3392969,3.18304687 C20.3392969,2.92148437 20.1273281,2.70951562 19.8657656,2.70951562 L15.0264375,2.70951562 L12.9365625,0.726609375 C11.915625,-0.242203125 10.3160625,-0.242203125 9.29503125,0.726609375 L7.20520312,2.70951562 L2.365875,2.70951562 C2.1043125,2.70951562 1.89234375,2.92148437 1.89234375,3.18304687 L1.89234375,7.75045312 L0.147609375,9.40589062 C-0.042140625,9.58589062 -0.0481875,9.88382812 0.130078125,10.0753594 C0.211828125,10.16325 7.89342187,15.8377969 7.89342187,15.8377969 L1.52517187,21.8800781 C1.36954687,22.0276875 1.25953125,22.207875 1.19798438,22.4021719 C1.03964062,22.1668594 0.9470625,21.8836875 0.9470625,21.579375 L0.9470625,12.7727344 C0.9470625,12.5111719 0.73509375,12.2992031 0.47353125,12.2992031 C0.21196875,12.2992031 0,12.5111719 0,12.7727344 L0,21.579375 C0,22.8550312 0.990375,23.9029687 2.24245312,23.996625 C2.28534375,24.001125 19.94625,24.001125 19.9891875,23.996625 C21.2412187,23.9029219 22.2314533,22.8549375 22.2314533,21.579375 L22.2314533,9.82626562 C22.2314533,9.66520312 22.1904844,9.51473437 22.0403438,9.3645 Z M9.946875,1.41360938 C10.602375,0.791625 11.6292656,0.791765625 12.2846719,1.41360938 L13.6504687,2.70951562 L8.58098437,2.70951562 L9.946875,1.41360938 Z M1.21125,9.7021875 L1.89234375,9.05596875 L1.89234375,9.24159375 C1.89234375,9.50315625 2.1043125,9.715125 2.365875,9.715125 C2.6274375,9.715125 2.83940625,9.50315625 2.83940625,9.24159375 L2.83940625,3.65657813 L14.8336406,3.65657813 C14.8349531,3.65657813 14.8363125,3.65676563 14.837625,3.65676563 C14.8388906,3.65676563 14.8401562,3.65657813 14.8413281,3.65657813 L19.3921406,3.65657813 L19.3921406,9.25129687 C19.3921406,9.51285937 19.6041094,9.72482812 19.8656719,9.72482812 C20.1272344,9.72482812 20.3392031,9.51285937 20.3392031,9.25129687 L20.3392031,9.05596875 L21.0260156,9.70767187 L13.6464844,15.1815 L12.9365156,14.5078594 C11.9155781,13.5390469 10.3160156,13.5389531 9.29498437,14.5078594 L8.59078125,15.1759687 L1.21125,9.7021875 Z M20.1229219,22.878375 C20.1023906,22.9298437 20.0374219,23.0454844 19.8794531,23.0552812 C19.8552656,23.0565 2.37628125,23.0565 2.35223437,23.0552812 C2.194125,23.0455781 2.12929687,22.9298437 2.10876562,22.878375 C2.08729687,22.8245625 2.0510625,22.6867031 2.17701562,22.567125 L8.91089062,16.1777812 C8.94257812,16.154625 8.97173438,16.1271562 8.99770312,16.0954688 L9.946875,15.1948594 C10.274625,14.8838906 10.6952344,14.7284062 11.1157969,14.7284062 C11.5363594,14.7284062 11.9569687,14.8839375 12.2847187,15.1948594 L20.054625,22.567125 C20.180625,22.6866562 20.1443437,22.8245625 20.1229219,22.878375 Z M21.2844375,21.5793281 C21.2844375,21.8837344 21.1918594,22.1667656 21.0335156,22.402125 C20.9719688,22.2079219 20.8619531,22.0277344 20.7063281,21.8800781 L14.3439375,15.8432344 L21.2844375,10.6950937 L21.2844375,21.5793281 L21.2844375,21.5793281 Z" id="Shape"></path>
|
|
706
|
+
<path d="M7.498125,5.2335 C7.24354687,5.2335 7.04409375,5.43295312 7.04409375,5.68753125 L7.04409375,7.49971875 L5.1174375,7.49971875 L5.1174375,5.68753125 C5.1174375,5.43295313 4.9145625,5.2335 4.65571875,5.2335 C4.40109375,5.2335 4.20164063,5.43295312 4.20164063,5.68753125 L4.20164063,10.2201094 C4.20164063,10.4746875 4.40109375,10.6741406 4.65571875,10.6741406 C4.91465625,10.6741406 5.1174375,10.4746875 5.1174375,10.2201094 L5.1174375,8.40792187 L7.04404688,8.40792187 L7.04404688,10.2201094 C7.04404688,10.4746875 7.2435,10.6741406 7.49807813,10.6741406 C7.7570625,10.6741406 7.95989063,10.4746875 7.95989063,10.2201094 L7.95989063,5.68753125 C7.95989063,5.43295313 7.7570625,5.2335 7.498125,5.2335 Z" id="Path"></path>
|
|
707
|
+
<path d="M12.4064531,7.59215625 C12.5886094,7.33776563 12.6846562,7.0385625 12.6846562,6.7246875 C12.6846562,5.9025 12.0157031,5.23354688 11.1935156,5.23354688 L10.1026875,5.23354688 C9.85223438,5.23354688 9.64851562,5.43721875 9.64851562,5.68757812 L9.64851562,10.2201563 C9.64846875,10.46625 9.85640625,10.6741875 10.1026875,10.6741875 C10.1089219,10.6741875 10.114125,10.672875 10.1179687,10.6712344 C10.1225156,10.6731094 10.1276719,10.6741875 10.1333906,10.6741875 L11.4931406,10.6741875 C12.4170469,10.6741875 13.1686875,9.919125 13.1686875,8.991 C13.1686875,8.42817188 12.8844375,7.90771875 12.4064531,7.59215625 Z M10.5643594,6.14939063 L11.1935156,6.14939063 C11.5161094,6.14939063 11.7687656,6.40204687 11.7687656,6.72464063 C11.7687656,7.050375 11.5107188,7.31535937 11.1935156,7.31535937 L10.5643594,7.31535937 L10.5643594,6.14939063 L10.5643594,6.14939063 Z M11.4931406,9.75825 L10.5643594,9.75825 L10.5643594,8.23120313 L11.4925313,8.23120313 C11.9188594,8.23870313 12.2527969,8.57240625 12.2527969,8.99095313 C12.2527969,9.41376562 11.9188594,9.75079688 11.4931406,9.75825 Z" id="Shape"></path>
|
|
708
|
+
<path d="M15.5724844,5.2335 L14.6660156,5.2335 C14.4114375,5.2335 14.2119844,5.43295313 14.2119844,5.68753125 L14.2119844,10.2201094 C14.2119844,10.4705156 14.4156094,10.6741875 14.6660156,10.6741875 L15.5724844,10.6741875 C17.0682187,10.6741875 18.2851406,9.450375 18.2851406,7.94615625 C18.2851406,6.45042188 17.0682656,5.2335 15.5724844,5.2335 Z M15.5724844,9.75829687 L15.1277344,9.75829687 L15.1277344,9.75829687 L15.1277344,6.14939063 L15.5724844,6.14939063 C16.5632344,6.14939063 17.3693437,6.95545313 17.3693437,7.94615625 C17.3692969,8.95476563 16.5799687,9.75075 15.5724844,9.75829687 Z" id="Shape"></path>
|
|
709
|
+
</g>
|
|
710
|
+
</g>
|
|
711
|
+
</svg>
|
|
712
|
+
)
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
661
717
|
|
|
662
718
|
|
|
663
719
|
export default {
|
|
@@ -671,10 +727,13 @@ export default {
|
|
|
671
727
|
TrophyIcon,
|
|
672
728
|
ListIcon,
|
|
673
729
|
UserIcon,
|
|
730
|
+
PhoneIcon,
|
|
731
|
+
EmailIcon,
|
|
674
732
|
InProgressIcon,
|
|
675
733
|
LockClosedIcon,
|
|
676
734
|
CloseIcon,
|
|
677
735
|
BettorEdgeIcon,
|
|
736
|
+
BirthdayIcon,
|
|
678
737
|
CheckIcon,
|
|
679
738
|
ImageIcon,
|
|
680
739
|
MenuIcon,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Set your cloud name and unsigned upload preset here:
|
|
2
|
+
const YOUR_CLOUD_NAME = "hoabts6mc";
|
|
3
|
+
const YOUR_UNSIGNED_UPLOAD_PRESET = "be_auth_svc";
|
|
4
|
+
import React, { useRef } from "react";
|
|
5
|
+
import { TouchableOpacity } from "react-native";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
type CldUploaderProps = {
|
|
9
|
+
onFinishUpload : (obj:any) => void
|
|
10
|
+
onStartUpload?: () => void,
|
|
11
|
+
onCancelUpload?: () => void,
|
|
12
|
+
children?:any,
|
|
13
|
+
public_id: string
|
|
14
|
+
}
|
|
15
|
+
const ImageUploader = ({ onFinishUpload, public_id, children }:CldUploaderProps) => {
|
|
16
|
+
const upload_ref:any = useRef()
|
|
17
|
+
|
|
18
|
+
const processFile = async (e:any) => {
|
|
19
|
+
var file = e.target.files[0];
|
|
20
|
+
|
|
21
|
+
var POST_URL =
|
|
22
|
+
"https://api.cloudinary.com/v1_1/" + YOUR_CLOUD_NAME + "/auto/upload";
|
|
23
|
+
|
|
24
|
+
var XUniqueUploadId = +new Date();
|
|
25
|
+
|
|
26
|
+
processFile();
|
|
27
|
+
|
|
28
|
+
function processFile() {
|
|
29
|
+
var size = file.size;
|
|
30
|
+
var sliceSize = 20000000;
|
|
31
|
+
var start = 0;
|
|
32
|
+
|
|
33
|
+
setTimeout(loop, 3);
|
|
34
|
+
|
|
35
|
+
function loop() {
|
|
36
|
+
var end = start + sliceSize;
|
|
37
|
+
|
|
38
|
+
if (end > size) {
|
|
39
|
+
end = size;
|
|
40
|
+
}
|
|
41
|
+
var s = slice(file, start, end);
|
|
42
|
+
send(s, start, end - 1, size);
|
|
43
|
+
if (end < size) {
|
|
44
|
+
start += sliceSize;
|
|
45
|
+
setTimeout(loop, 3);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const send = (piece:any, start:any, end:any, size:any) => {
|
|
51
|
+
|
|
52
|
+
var formdata = new FormData();
|
|
53
|
+
|
|
54
|
+
formdata.append("file", piece);
|
|
55
|
+
formdata.append("cloud_name", YOUR_CLOUD_NAME);
|
|
56
|
+
formdata.append("upload_preset", YOUR_UNSIGNED_UPLOAD_PRESET);
|
|
57
|
+
formdata.append("public_id", public_id);
|
|
58
|
+
|
|
59
|
+
var xhr = new XMLHttpRequest();
|
|
60
|
+
xhr.open("POST", POST_URL, false);
|
|
61
|
+
xhr.setRequestHeader("X-Unique-Upload-Id", XUniqueUploadId as any);
|
|
62
|
+
xhr.setRequestHeader(
|
|
63
|
+
"Content-Range",
|
|
64
|
+
"bytes " + start + "-" + end + "/" + size
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
xhr.onload = function () {
|
|
68
|
+
// do something to response
|
|
69
|
+
onFinishUpload(JSON.parse(this.responseText))
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
xhr.send(formdata);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function slice(file:any, start:any, end:any) {
|
|
76
|
+
var slice = file.mozSlice
|
|
77
|
+
? file.mozSlice
|
|
78
|
+
: file.webkitSlice
|
|
79
|
+
? file.webkitSlice
|
|
80
|
+
: file.slice
|
|
81
|
+
? file.slice
|
|
82
|
+
: noop;
|
|
83
|
+
|
|
84
|
+
return slice.bind(file)(start, end);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function noop() {}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const handleClick = () => {
|
|
91
|
+
if(!upload_ref?.current) { return console.log('no ref') }
|
|
92
|
+
upload_ref.current.click()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<TouchableOpacity style={{ padding:10 }} onPress={() => handleClick()}>
|
|
97
|
+
<input ref={upload_ref as any} style={{ display:'none' }} type="file" onChange={processFile} />
|
|
98
|
+
{children}
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default ImageUploader;
|
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useSpring, animated } from '@react-spring/web';
|
|
2
|
+
import { useSpring, animated, easings } from '@react-spring/web';
|
|
3
3
|
|
|
4
4
|
type SpringViewProps = {
|
|
5
5
|
style?: any,
|
|
6
6
|
slide: 'vertical'|'horizontal'
|
|
7
7
|
from: number,
|
|
8
|
+
onResolve?:() => void,
|
|
8
9
|
to:number,
|
|
9
10
|
children: any
|
|
10
11
|
}
|
|
11
|
-
const SpringView = ({ style, children, from, to, slide }:SpringViewProps) => {
|
|
12
|
+
const SpringView = ({ style, children, from, to, slide, onResolve }:SpringViewProps) => {
|
|
13
|
+
|
|
12
14
|
let config:any = {
|
|
13
15
|
from: { x: from},
|
|
14
|
-
to: { x: to }
|
|
16
|
+
to: { x: to },
|
|
17
|
+
friction: 120,
|
|
18
|
+
tension: 280
|
|
15
19
|
}
|
|
16
20
|
if(slide == 'vertical'){
|
|
17
21
|
config = {
|
|
18
22
|
from: { y: from},
|
|
19
|
-
to: { y: to }
|
|
23
|
+
to: { y: to },
|
|
24
|
+
onResolve: () => { if(onResolve){ onResolve() } },
|
|
25
|
+
easing: easings.easeInBounce
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
const springs = useSpring(config)
|
|
24
29
|
|
|
25
30
|
|
|
31
|
+
const props = useSpring(config)
|
|
32
|
+
|
|
26
33
|
return (
|
|
27
34
|
<animated.div
|
|
28
|
-
|
|
29
|
-
...
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
35
|
+
onAnimationEnd={() => console.log('animation has ended')}
|
|
36
|
+
style={{ ...style, ...props}}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
34
39
|
</animated.div>
|
|
35
40
|
)
|
|
36
41
|
}
|
|
@@ -9,13 +9,16 @@ type TextInputProps = {
|
|
|
9
9
|
autoFocus?:boolean,
|
|
10
10
|
keyboardType?:string,
|
|
11
11
|
textContentType?:string,
|
|
12
|
+
editable?:boolean,
|
|
12
13
|
secureTextEntry?:boolean,
|
|
14
|
+
onSubmitEditing?: (evt:any) => void,
|
|
15
|
+
onBlur?: (evt:any) => void,
|
|
13
16
|
placeholderTextColor?:string,
|
|
14
17
|
onChangeText:(text:string) => void,
|
|
15
18
|
style?:any
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
const TextInput = ({ onChangeText, placeholderTextColor, value, placeholder, style, autoFocus, keyboardType, textContentType, secureTextEntry } : TextInputProps) => {
|
|
21
|
+
const TextInput = ({ onChangeText, placeholderTextColor, value, placeholder, style, autoFocus, keyboardType, textContentType, editable, secureTextEntry, onSubmitEditing, onBlur } : TextInputProps) => {
|
|
19
22
|
|
|
20
23
|
return (
|
|
21
24
|
<RNTextInput
|
|
@@ -27,17 +30,20 @@ const TextInput = ({ onChangeText, placeholderTextColor, value, placeholder, sty
|
|
|
27
30
|
fontFamily:'barlow-bold',
|
|
28
31
|
fontSize:16,
|
|
29
32
|
borderColor:Colors.shades.shade600,
|
|
30
|
-
backgroundColor:Colors.shades.white,
|
|
33
|
+
backgroundColor:editable == false ? Colors.shades.shade100 : Colors.shades.white,
|
|
31
34
|
...style
|
|
32
35
|
}}
|
|
36
|
+
editable={editable ?? true}
|
|
33
37
|
placeholder={placeholder}
|
|
34
38
|
value={value}
|
|
39
|
+
onSubmitEditing={onSubmitEditing}
|
|
40
|
+
onBlur={onBlur}
|
|
35
41
|
secureTextEntry={secureTextEntry}
|
|
36
42
|
placeholderTextColor={placeholderTextColor}
|
|
37
43
|
autoFocus={autoFocus}
|
|
38
44
|
textContentType={textContentType as any}
|
|
39
45
|
keyboardType={keyboardType as any}
|
|
40
|
-
onChangeText={
|
|
46
|
+
onChangeText={onChangeText}
|
|
41
47
|
/>
|
|
42
48
|
)
|
|
43
49
|
}
|
package/src/Font.css
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: 'barlow-bold';
|
|
3
3
|
src: local('Barlow-Bold'),
|
|
4
|
-
url('./fonts/Barlow-Bold.ttf')
|
|
4
|
+
url('./Assets/fonts/Barlow-Bold.ttf')
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
@font-face {
|
|
8
8
|
font-family: 'barlow-semibold';
|
|
9
9
|
src: local('Barlow-SemiBold'),
|
|
10
|
-
url('./fonts/Barlow-SemiBold.ttf')
|
|
10
|
+
url('./Assets/fonts/Barlow-SemiBold.ttf')
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@font-face {
|
|
14
14
|
font-family: 'barlow-regular';
|
|
15
15
|
src: local('Barlow-Regular'),
|
|
16
|
-
url('./fonts/Barlow-Regular.ttf')
|
|
16
|
+
url('./Assets/fonts/Barlow-Regular.ttf')
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
@font-face {
|
|
20
20
|
font-family: 'barlow-light';
|
|
21
21
|
src: local('Barlow-Light'),
|
|
22
|
-
url('./fonts/Barlow-Light.ttf')
|
|
22
|
+
url('./Assets/fonts/Barlow-Light.ttf')
|
|
23
23
|
}
|