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.
Files changed (221) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +179 -0
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -0
  3. package/lib/commonjs/ApiOverrides/types.d.js.map +1 -0
  4. package/lib/commonjs/Assets/images/powered_by_be.webp +0 -0
  5. package/lib/commonjs/Authenticator/Components/LoginForm.js +491 -0
  6. package/lib/commonjs/Authenticator/Components/LoginForm.js.map +1 -0
  7. package/lib/commonjs/{AuthenticateWizard → Authenticator}/Components/StrategyForm.js +81 -58
  8. package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -0
  9. package/lib/commonjs/{AuthenticateWizard → Authenticator}/api/index.js +31 -36
  10. package/lib/commonjs/Authenticator/api/index.js.map +1 -0
  11. package/lib/commonjs/Authenticator/api/types.d.js +2 -0
  12. package/lib/commonjs/Authenticator/api/types.d.js.map +1 -0
  13. package/lib/commonjs/{AuthenticateWizard → Authenticator}/index.js +69 -25
  14. package/lib/commonjs/Authenticator/index.js.map +1 -0
  15. package/lib/commonjs/Components/Button.js +1 -1
  16. package/lib/commonjs/Components/Button.js.map +1 -1
  17. package/lib/commonjs/Components/Icons.js +115 -0
  18. package/lib/commonjs/Components/Icons.js.map +1 -1
  19. package/lib/commonjs/Components/ImageUploader.js +86 -0
  20. package/lib/commonjs/Components/ImageUploader.js.map +1 -0
  21. package/lib/commonjs/Components/Spring.js +16 -6
  22. package/lib/commonjs/Components/Spring.js.map +1 -1
  23. package/lib/commonjs/Components/TextInput.js +9 -3
  24. package/lib/commonjs/Components/TextInput.js.map +1 -1
  25. package/lib/commonjs/Font.css +4 -4
  26. package/lib/commonjs/ProfileManager/Components/BasicInfoManager.js +250 -0
  27. package/lib/commonjs/ProfileManager/Components/BasicInfoManager.js.map +1 -0
  28. package/lib/commonjs/ProfileManager/Components/BasicStatus.js +135 -0
  29. package/lib/commonjs/ProfileManager/Components/BasicStatus.js.map +1 -0
  30. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js +361 -0
  31. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js.map +1 -0
  32. package/lib/commonjs/ProfileManager/Components/DOBManager.js +195 -0
  33. package/lib/commonjs/ProfileManager/Components/DOBManager.js.map +1 -0
  34. package/lib/commonjs/ProfileManager/Components/EmailManager.js +287 -0
  35. package/lib/commonjs/ProfileManager/Components/EmailManager.js.map +1 -0
  36. package/lib/commonjs/ProfileManager/Components/PasswordManager.js +334 -0
  37. package/lib/commonjs/ProfileManager/Components/PasswordManager.js.map +1 -0
  38. package/lib/commonjs/ProfileManager/Components/PhoneManager.js +291 -0
  39. package/lib/commonjs/ProfileManager/Components/PhoneManager.js.map +1 -0
  40. package/lib/commonjs/ProfileManager/Components/ProfilePicManager.js +114 -0
  41. package/lib/commonjs/ProfileManager/Components/ProfilePicManager.js.map +1 -0
  42. package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js +80 -0
  43. package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js.map +1 -0
  44. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +545 -0
  45. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -0
  46. package/lib/commonjs/ProfileManager/Components/VouchCard.js +454 -0
  47. package/lib/commonjs/ProfileManager/Components/VouchCard.js.map +1 -0
  48. package/lib/commonjs/ProfileManager/api/index.js +400 -0
  49. package/lib/commonjs/ProfileManager/api/index.js.map +1 -0
  50. package/lib/commonjs/ProfileManager/api/types.d.js +2 -0
  51. package/lib/commonjs/ProfileManager/api/types.d.js.map +1 -0
  52. package/lib/commonjs/ProfileManager/index.js +128 -0
  53. package/lib/commonjs/ProfileManager/index.js.map +1 -0
  54. package/lib/commonjs/constants/styles.js +10 -0
  55. package/lib/commonjs/constants/styles.js.map +1 -1
  56. package/lib/commonjs/index.js +24 -10
  57. package/lib/commonjs/index.js.map +1 -1
  58. package/lib/module/ApiOverrides/index.js +173 -0
  59. package/lib/module/ApiOverrides/index.js.map +1 -0
  60. package/lib/module/ApiOverrides/types.d.js.map +1 -0
  61. package/lib/module/Assets/images/powered_by_be.webp +0 -0
  62. package/lib/module/Authenticator/Components/LoginForm.js +482 -0
  63. package/lib/module/Authenticator/Components/LoginForm.js.map +1 -0
  64. package/lib/module/{AuthenticateWizard → Authenticator}/Components/StrategyForm.js +82 -59
  65. package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -0
  66. package/lib/module/{AuthenticateWizard → Authenticator}/api/index.js +31 -36
  67. package/lib/module/Authenticator/api/index.js.map +1 -0
  68. package/lib/module/Authenticator/api/types.d.js +2 -0
  69. package/lib/module/Authenticator/api/types.d.js.map +1 -0
  70. package/lib/module/Authenticator/index.js +121 -0
  71. package/lib/module/Authenticator/index.js.map +1 -0
  72. package/lib/module/Components/Button.js +1 -1
  73. package/lib/module/Components/Button.js.map +1 -1
  74. package/lib/module/Components/Icons.js +115 -0
  75. package/lib/module/Components/Icons.js.map +1 -1
  76. package/lib/module/Components/ImageUploader.js +78 -0
  77. package/lib/module/Components/ImageUploader.js.map +1 -0
  78. package/lib/module/Components/Spring.js +17 -7
  79. package/lib/module/Components/Spring.js.map +1 -1
  80. package/lib/module/Components/TextInput.js +9 -3
  81. package/lib/module/Components/TextInput.js.map +1 -1
  82. package/lib/module/Font.css +4 -4
  83. package/lib/module/ProfileManager/Components/BasicInfoManager.js +241 -0
  84. package/lib/module/ProfileManager/Components/BasicInfoManager.js.map +1 -0
  85. package/lib/module/ProfileManager/Components/BasicStatus.js +128 -0
  86. package/lib/module/ProfileManager/Components/BasicStatus.js.map +1 -0
  87. package/lib/module/ProfileManager/Components/CodeRedeem.js +352 -0
  88. package/lib/module/ProfileManager/Components/CodeRedeem.js.map +1 -0
  89. package/lib/module/ProfileManager/Components/DOBManager.js +186 -0
  90. package/lib/module/ProfileManager/Components/DOBManager.js.map +1 -0
  91. package/lib/module/ProfileManager/Components/EmailManager.js +278 -0
  92. package/lib/module/ProfileManager/Components/EmailManager.js.map +1 -0
  93. package/lib/module/ProfileManager/Components/PasswordManager.js +325 -0
  94. package/lib/module/ProfileManager/Components/PasswordManager.js.map +1 -0
  95. package/lib/module/ProfileManager/Components/PhoneManager.js +282 -0
  96. package/lib/module/ProfileManager/Components/PhoneManager.js.map +1 -0
  97. package/lib/module/ProfileManager/Components/ProfilePicManager.js +107 -0
  98. package/lib/module/ProfileManager/Components/ProfilePicManager.js.map +1 -0
  99. package/lib/module/ProfileManager/Components/ProfileWelcome.js +73 -0
  100. package/lib/module/ProfileManager/Components/ProfileWelcome.js.map +1 -0
  101. package/lib/module/ProfileManager/Components/ProfileWizard.js +537 -0
  102. package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -0
  103. package/lib/module/ProfileManager/Components/VouchCard.js +445 -0
  104. package/lib/module/ProfileManager/Components/VouchCard.js.map +1 -0
  105. package/lib/module/ProfileManager/api/index.js +394 -0
  106. package/lib/module/ProfileManager/api/index.js.map +1 -0
  107. package/lib/module/ProfileManager/api/types.d.js +2 -0
  108. package/lib/module/ProfileManager/api/types.d.js.map +1 -0
  109. package/lib/module/ProfileManager/index.js +119 -0
  110. package/lib/module/ProfileManager/index.js.map +1 -0
  111. package/lib/module/constants/styles.js +10 -0
  112. package/lib/module/constants/styles.js.map +1 -1
  113. package/lib/module/index.js +7 -3
  114. package/lib/module/index.js.map +1 -1
  115. package/lib/typescript/src/ApiOverrides/index.d.ts +24 -0
  116. package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -0
  117. package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts +10 -0
  118. package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts.map +1 -0
  119. package/lib/typescript/src/{AuthenticateWizard → Authenticator}/Components/StrategyForm.d.ts +2 -1
  120. package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts.map +1 -0
  121. package/lib/typescript/src/{AuthenticateWizard → Authenticator}/api/index.d.ts +16 -8
  122. package/lib/typescript/src/Authenticator/api/index.d.ts.map +1 -0
  123. package/lib/typescript/src/Authenticator/index.d.ts +16 -0
  124. package/lib/typescript/src/Authenticator/index.d.ts.map +1 -0
  125. package/lib/typescript/src/Components/Icons.d.ts +3 -0
  126. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  127. package/lib/typescript/src/Components/ImageUploader.d.ts +11 -0
  128. package/lib/typescript/src/Components/ImageUploader.d.ts.map +1 -0
  129. package/lib/typescript/src/Components/Spring.d.ts +2 -1
  130. package/lib/typescript/src/Components/Spring.d.ts.map +1 -1
  131. package/lib/typescript/src/Components/TextInput.d.ts +4 -1
  132. package/lib/typescript/src/Components/TextInput.d.ts.map +1 -1
  133. package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts +12 -0
  134. package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts.map +1 -0
  135. package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts +10 -0
  136. package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts.map +1 -0
  137. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts +11 -0
  138. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts.map +1 -0
  139. package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts +12 -0
  140. package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts.map +1 -0
  141. package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts +12 -0
  142. package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts.map +1 -0
  143. package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts +12 -0
  144. package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts.map +1 -0
  145. package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts +12 -0
  146. package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts.map +1 -0
  147. package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts +12 -0
  148. package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts.map +1 -0
  149. package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts +11 -0
  150. package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts.map +1 -0
  151. package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts +14 -0
  152. package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts.map +1 -0
  153. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts +9 -0
  154. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts.map +1 -0
  155. package/lib/typescript/src/ProfileManager/api/index.d.ts +104 -0
  156. package/lib/typescript/src/ProfileManager/api/index.d.ts.map +1 -0
  157. package/lib/typescript/src/ProfileManager/index.d.ts +11 -0
  158. package/lib/typescript/src/ProfileManager/index.d.ts.map +1 -0
  159. package/lib/typescript/src/constants/styles.d.ts +10 -0
  160. package/lib/typescript/src/constants/styles.d.ts.map +1 -1
  161. package/lib/typescript/src/index.d.ts +7 -3
  162. package/lib/typescript/src/index.d.ts.map +1 -1
  163. package/package.json +7 -2
  164. package/src/ApiOverrides/index.ts +135 -0
  165. package/src/ApiOverrides/types.d.ts +7 -0
  166. package/src/Assets/images/powered_by_be.webp +0 -0
  167. package/src/Authenticator/Components/LoginForm.tsx +298 -0
  168. package/src/{AuthenticateWizard → Authenticator}/Components/StrategyForm.tsx +54 -40
  169. package/src/{AuthenticateWizard → Authenticator}/api/index.ts +27 -31
  170. package/src/{AuthenticateWizard → Authenticator}/api/types.d.ts +11 -28
  171. package/src/Authenticator/index.tsx +109 -0
  172. package/src/Components/Button.tsx +1 -1
  173. package/src/Components/Icons.tsx +59 -0
  174. package/src/Components/ImageUploader.tsx +104 -0
  175. package/src/Components/Spring.tsx +16 -11
  176. package/src/Components/TextInput.tsx +9 -3
  177. package/src/Font.css +4 -4
  178. package/src/ProfileManager/Components/BasicInfoManager.tsx +157 -0
  179. package/src/ProfileManager/Components/BasicStatus.tsx +81 -0
  180. package/src/ProfileManager/Components/CodeRedeem.tsx +234 -0
  181. package/src/ProfileManager/Components/DOBManager.tsx +154 -0
  182. package/src/ProfileManager/Components/EmailManager.tsx +205 -0
  183. package/src/ProfileManager/Components/PasswordManager.tsx +198 -0
  184. package/src/ProfileManager/Components/PhoneManager.tsx +210 -0
  185. package/src/ProfileManager/Components/ProfilePicManager.tsx +81 -0
  186. package/src/ProfileManager/Components/ProfileWelcome.tsx +53 -0
  187. package/src/ProfileManager/Components/ProfileWizard.tsx +385 -0
  188. package/src/ProfileManager/Components/VouchCard.tsx +265 -0
  189. package/src/ProfileManager/api/index.ts +250 -0
  190. package/src/ProfileManager/api/types.d.ts +138 -0
  191. package/src/ProfileManager/index.tsx +84 -0
  192. package/src/constants/styles.ts +10 -0
  193. package/src/index.tsx +12 -6
  194. package/lib/commonjs/AuthenticateWizard/Components/StrategyForm.js.map +0 -1
  195. package/lib/commonjs/AuthenticateWizard/api/index.js.map +0 -1
  196. package/lib/commonjs/AuthenticateWizard/api/types.d.js.map +0 -1
  197. package/lib/commonjs/AuthenticateWizard/index.js.map +0 -1
  198. package/lib/module/AuthenticateWizard/Components/StrategyForm.js.map +0 -1
  199. package/lib/module/AuthenticateWizard/api/index.js.map +0 -1
  200. package/lib/module/AuthenticateWizard/api/types.d.js.map +0 -1
  201. package/lib/module/AuthenticateWizard/index.js +0 -77
  202. package/lib/module/AuthenticateWizard/index.js.map +0 -1
  203. package/lib/typescript/src/AuthenticateWizard/Components/StrategyForm.d.ts.map +0 -1
  204. package/lib/typescript/src/AuthenticateWizard/api/index.d.ts.map +0 -1
  205. package/lib/typescript/src/AuthenticateWizard/index.d.ts +0 -15
  206. package/lib/typescript/src/AuthenticateWizard/index.d.ts.map +0 -1
  207. package/src/AuthenticateWizard/index.tsx +0 -84
  208. /package/lib/commonjs/{AuthenticateWizard/api → ApiOverrides}/types.d.js +0 -0
  209. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
  210. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
  211. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
  212. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
  213. /package/lib/module/{AuthenticateWizard/api → ApiOverrides}/types.d.js +0 -0
  214. /package/lib/module/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
  215. /package/lib/module/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
  216. /package/lib/module/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
  217. /package/lib/module/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
  218. /package/src/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
  219. /package/src/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
  220. /package/src/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
  221. /package/src/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
@@ -0,0 +1,157 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, ActivityIndicator } from 'react-native';
3
+ import { Button, Icons, Text, TextInput } from '../../Components';
4
+ import type { MyPlayerProps } from '../api/types';
5
+ import Colors from '../../constants/colors';
6
+ import { ProfileApi } from '../api';
7
+
8
+ type BasicInfoManagerProps = {
9
+ player:MyPlayerProps,
10
+ walkthrough?:boolean,
11
+ onNext:() => void,
12
+ onClose:() => void,
13
+ onPlayerUpdate:(player:MyPlayerProps) => void
14
+ }
15
+
16
+ const BasicInfoManager = ({ player, walkthrough, onPlayerUpdate, onNext, onClose }:BasicInfoManagerProps) => {
17
+ const [ draft_player, setDraftPlayer ] = useState<MyPlayerProps>(player)
18
+ const [ username_valid, setUsernameValid ] = useState<{
19
+ loading:boolean,
20
+ valid:boolean
21
+ }>({
22
+ loading:false,
23
+ valid:true
24
+ });
25
+
26
+ useEffect(() => {
27
+ setDraftPlayer(player)
28
+ },[player])
29
+
30
+
31
+ const is_changed = JSON.stringify(player) != JSON.stringify(draft_player) ? true : false
32
+
33
+
34
+ const handleUpdatePlayer = async() => {
35
+ if(username_valid.loading || !username_valid.valid) { return }
36
+ //Check if name needs updating
37
+ let new_player:MyPlayerProps = { ...draft_player };
38
+ if(`${draft_player.first_name.toLowerCase()}${draft_player.last_name.toLowerCase()}` != `${player.first_name.toLowerCase()}${player.last_name.toLowerCase()}`){
39
+ new_player = await ProfileApi.updatePlayerName(draft_player.first_name, draft_player.last_name)
40
+ }
41
+ if(draft_player.username.toLowerCase() != player.username.toLowerCase()){
42
+ new_player = await ProfileApi.updatePlayerUsername(draft_player.username)
43
+ }
44
+ onPlayerUpdate(new_player)
45
+ if(walkthrough){ onNext() }
46
+ }
47
+
48
+
49
+ return (
50
+ <View style={{ flex:1 }}>
51
+ <View style={{ flex:1 }}>
52
+ <View style={{ padding:10 }}>
53
+ <Text weight='bold' size={16} color={Colors.brand.midnight}>MY USERNAME</Text>
54
+ <Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>To start, we randomly generate a username for you! Change it if you'd like here.</Text>
55
+ </View>
56
+ <View style={{ margin:10, backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
57
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
58
+ <Text size={20} color={Colors.brand.midnight} weight='bold'>@</Text>
59
+ </View>
60
+ <TextInput
61
+ value={draft_player.username}
62
+ style={{ flex:1, borderRadius:0 }}
63
+ onBlur={async() => {
64
+ if(draft_player.username.toLowerCase() == player.username.toLowerCase()){ return }//USERNAME HAS NOT CHANGED
65
+ setUsernameValid({ ...username_valid, loading:true })
66
+ const is_valid = await ProfileApi.isAttributeValid('username', draft_player.username)
67
+ setTimeout(() => {
68
+ setUsernameValid({ loading: false, valid: is_valid });
69
+ }, 500);
70
+ }}
71
+ onChangeText={(text) => {
72
+ setDraftPlayer({ ...draft_player, username: text })
73
+ if(text.toLowerCase() != player.username.toLowerCase()){
74
+ setUsernameValid({ loading:false, valid:false })
75
+ } else {
76
+ setUsernameValid({ loading: false, valid:true });
77
+ }
78
+ }}
79
+ />
80
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
81
+ {username_valid.loading ?
82
+ <ActivityIndicator size='small' color={Colors.brand.midnight}/>
83
+ :
84
+ <View>
85
+ {username_valid.valid ?
86
+ <Icons.CheckIcon size={16} color={Colors.utility.success} />
87
+ :
88
+ <Icons.AlertIcon size={16} color={Colors.utility.warning} />
89
+ }
90
+ </View>
91
+ }
92
+ </View>
93
+ </View>
94
+
95
+
96
+ <View style={{ padding:10 }}>
97
+ <Text weight='bold' size={16} textAlign='left' color={Colors.brand.midnight}>MY NAME</Text>
98
+ <Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>Add / Update your name below. This is required to verify your account</Text>
99
+ </View>
100
+ <View style={{ margin:10, backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
101
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
102
+ <Icons.UserIcon
103
+ color={Colors.brand.midnight}
104
+ size={18}
105
+ />
106
+ </View>
107
+ <TextInput
108
+ value={draft_player.first_name}
109
+ placeholder='First Name'
110
+ placeholderTextColor={Colors.brand.slate}
111
+ editable={player.vouched_status != 'verified' ? true : false}
112
+ style={{ flex:1, borderTopLeftRadius:0, borderBottomLeftRadius:0 }}
113
+ onChangeText={(text) => setDraftPlayer({ ...draft_player, first_name: text })}
114
+ />
115
+ </View>
116
+ <View style={{ margin:10, backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
117
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
118
+ <Icons.UserIcon
119
+ color={Colors.brand.midnight}
120
+ size={18}
121
+ />
122
+ </View>
123
+ <TextInput
124
+ value={draft_player.last_name}
125
+ placeholder='Last Name'
126
+ placeholderTextColor={Colors.brand.slate}
127
+ editable={player.vouched_status != 'verified' ? true : false}
128
+ style={{ flex:1, borderTopLeftRadius:0, borderBottomLeftRadius:0 }}
129
+ onChangeText={(text) => setDraftPlayer({ ...draft_player, last_name: text })}
130
+ />
131
+ </View>
132
+ </View>
133
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
134
+ <Button
135
+ title={walkthrough ? 'SKIP' : 'CLOSE'}
136
+ style={{ flex:1, marginRight:5 }}
137
+ borderColor={Colors.brand.electric}
138
+ title_color={Colors.brand.electric}
139
+ borderWidth={1}
140
+ padding={15}
141
+ onPress={() => walkthrough ? onNext() : onClose()}
142
+ />
143
+ <Button
144
+ title={walkthrough?'UPDATE MY PHOTO':is_changed ? 'UPDATE':'DONE'}
145
+ style={{ flex:3 }}
146
+ padding={15}
147
+ //disabled={!update_allowed}
148
+ backgroundColor={Colors.utility.success}
149
+ title_color={Colors.shades.white}
150
+ onPress={() => handleUpdatePlayer()}
151
+ />
152
+ </View>
153
+ </View>
154
+ )
155
+ }
156
+
157
+ export default BasicInfoManager
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { View, Image } from 'react-native';
3
+ import { Button, Text } from '../../Components';
4
+ import Colors from '../../constants/colors';
5
+ import type { MyPlayerProps } from '../api/types';
6
+
7
+ type BasicStatusProps = {
8
+ player:MyPlayerProps,
9
+ onClose:() => void,
10
+ onVerify:() => void
11
+ }
12
+
13
+ const BasicStatus = ({ onVerify, player, onClose }:BasicStatusProps) => {
14
+
15
+
16
+ const getStatus = (p:MyPlayerProps) => {
17
+ let errors:string[] = []
18
+ if(!p.first_name || !p.last_name){ errors.push('A first and last name are required to use real money') }
19
+ if(p.no_password){ errors.push('A password is required to use real money') }
20
+ return errors
21
+ }
22
+
23
+ const errors = getStatus(player)
24
+
25
+ return (
26
+ <View style={{ flex:1 }}>
27
+ <View style={{ flex:1 }}>
28
+ <View style={{ padding:10 }}>
29
+ <Text weight='bold' size={16} color={Colors.brand.midnight}>FREE TO PLAY - ENGAGED!</Text>
30
+ <Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>Your profile is ready to go for play money betting and all our FREE TO PLAY games.</Text>
31
+ </View>
32
+ <View style={{ justifyContent:'center', alignItems:'center' }}>
33
+ <Image
34
+ source={{ uri:'https://res.cloudinary.com/hoabts6mc/image/upload/v1714410165/Welcome_banner_bqu6cc.webp' }}
35
+ style={{ width:400, height:400, borderRadius:4 }}
36
+ resizeMode='cover'
37
+ />
38
+ </View>
39
+ <View style={{ padding:10, backgroundColor:Colors.shades.black_faded_super_heavy, marginTop:-40 }}>
40
+ <Text weight='bold' size={16} color={Colors.shades.white}>WANT TO USE REAL MONEY?</Text>
41
+ {errors.length == 0 ?
42
+ <Text style={{ marginTop:5 }} color={Colors.shades.white} size={14} textAlign='left'>Continue on your journey and complete the verification steps in just a couple minutes.</Text>
43
+ :
44
+ <View style={{ marginTop:5 }}>
45
+ <Text size={14} color={Colors.utility.warning} weight='bold'>FIX THE FOLLOWING BEFORE CONTINUING</Text>
46
+ <View style={{ padding:10 }}>
47
+ {errors.map((e,i) => {
48
+ return (
49
+ <Text style={{ padding:2 }} size={14} color={Colors.utility.warning} weight='bold'>{i+1} - {e}</Text>
50
+ )
51
+ })}
52
+ </View>
53
+ </View>
54
+ }
55
+ </View>
56
+ </View>
57
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
58
+ <Button
59
+ title='CLOSE'
60
+ style={{ flex:1, marginRight:5 }}
61
+ padding={15}
62
+ borderWidth={1}
63
+ borderColor={Colors.brand.electric}
64
+ title_color={Colors.brand.electric}
65
+ onPress={() => onClose()}
66
+ />
67
+ <Button
68
+ title='VERIFY ACCOUNT'
69
+ style={{ flex:3, opacity: errors.length > 0 ? 0.5 : 1 }}
70
+ padding={15}
71
+ disabled={errors.length > 0}
72
+ backgroundColor={Colors.utility.success}
73
+ title_color={Colors.shades.white}
74
+ onPress={() => onVerify()}
75
+ />
76
+ </View>
77
+ </View>
78
+ )
79
+ }
80
+
81
+ export default BasicStatus
@@ -0,0 +1,234 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { ActivityIndicator, View, Image } from 'react-native';
3
+ import { Button, Icons, Text, TextInput } from '../../Components';
4
+ import Colors from '../../constants/colors';
5
+ import type { CodeRequestProps, MyPlayerProps, PlayerReferralProps, PromoProps, PublicPlayerProps, RewardOptionProps } from '../api/types';
6
+ import { ProfileApi, ProfileHelpers } from '../api';
7
+
8
+ type CodeRedeemProps = {
9
+ player:MyPlayerProps,
10
+ walkthrough?:boolean,
11
+ onNext:() => void,
12
+ onClose:() => void
13
+ }
14
+
15
+ const CodeRedeem = ({ walkthrough, onNext, onClose }:CodeRedeemProps) => {
16
+ const [ loading, setLoading ] = useState(false);
17
+ const [ show_reward, setShowReward ] = useState(false);
18
+ const [ action_loading, setActionLoading ] = useState(false);
19
+ const [ data, setData ] = useState<{
20
+ code_request?:CodeRequestProps,
21
+ promo?:PromoProps,
22
+ player_referral?:PlayerReferralProps,
23
+ reward_option?:RewardOptionProps,
24
+ referrer?:PublicPlayerProps
25
+ }>({})
26
+ const [ code_error, setCodeError ] = useState('');
27
+ const [ draft_code, setDraftCode ] = useState<string>('')
28
+
29
+ const { code_request, promo, reward_option, referrer } = data;
30
+
31
+ useEffect(() => {
32
+ getDataFromServer()
33
+ },[])
34
+
35
+ const getDataFromServer = async() => {
36
+ setLoading(true);
37
+ const request_response = await ProfileApi.getMyCodeDetails();
38
+ setData({ ...request_response })
39
+ if(request_response.code_request){ setDraftCode(request_response.code_request.referral_code) }
40
+ setLoading(false);
41
+ }
42
+
43
+ const handleTryCodeRequest = async() => {
44
+ if(!draft_code){ setCodeError('Please enter a code') }
45
+ const request_response = await ProfileApi.tryCodeRequest(draft_code);
46
+ if(request_response.result == 'failed'){
47
+ return setCodeError(request_response.error_message ?? 'Unable to use this code')
48
+ }
49
+ setCodeError('');
50
+ return setData({ ...request_response })
51
+ }
52
+
53
+ const handleRedeemCode = async() => {
54
+ if(!code_request || action_loading){ return }
55
+ setActionLoading(true)
56
+ const request_response = await ProfileApi.redeemCode(code_request.code_request_id)
57
+ setShowReward(true);
58
+ setTimeout(() => {
59
+ setData({ ...request_response })
60
+ setActionLoading(false);
61
+ }, 2000);
62
+ }
63
+
64
+
65
+
66
+ if(loading){
67
+ return (
68
+ <ActivityIndicator size='large' color={Colors.brand.midnight} style={{ padding:40, alignSelf:'center' }} />
69
+ )
70
+ }
71
+
72
+ const is_changed = draft_code && draft_code != code_request?.referral_code ? true : false
73
+ const try_allowed = draft_code ? true : false
74
+ const change_allowed = !loading && ProfileHelpers.isChangeCodeAllowed(code_request) ? true : false
75
+ return (
76
+ <View style={{ flex:1 }}>
77
+ <View style={{ flex:1 }}>
78
+ <View style={{ padding:10 }}>
79
+ <Text weight='bold' size={16} textAlign='left' color={Colors.brand.midnight}>Referral Code</Text>
80
+ <Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>You can find the code used to sign up for your account below. Feel free to change it before redeeming.</Text>
81
+ </View>
82
+ <View style={{ padding:10 }}>
83
+ <View style={{ backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
84
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
85
+ <Icons.USDIcon
86
+ color={Colors.brand.midnight}
87
+ size={18}
88
+ />
89
+ </View>
90
+ <TextInput
91
+ value={draft_code}
92
+ style={{ flex:1, borderRadius:0, backroundColor:change_allowed?Colors.shades.white:Colors.shades.shade100 }}
93
+ placeholder='Add Code Here'
94
+ editable={change_allowed}
95
+ placeholderTextColor={Colors.brand.slate}
96
+ onChangeText={(text) => setDraftCode(text)}
97
+ />
98
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
99
+ {loading ?
100
+ <ActivityIndicator size='small' color={Colors.brand.midnight}/>
101
+ :
102
+ <View>
103
+ { !is_changed && code_request ?
104
+ <Icons.CheckIcon size={16} color={Colors.utility.success} />
105
+ : !code_error ?
106
+ <Icons.AlertIcon size={16} color={Colors.utility.warning} />
107
+ :
108
+ <Icons.CloseIcon size={14} color={Colors.utility.error} />
109
+ }
110
+ </View>
111
+ }
112
+ </View>
113
+ </View>
114
+ {code_error ?
115
+ <Text style={{ padding:5 }} size={14} color={Colors.utility.error} textAlign='center'>{code_error}</Text>
116
+ :<></>}
117
+ {is_changed ?
118
+ <Button
119
+ title='Apply Code'
120
+ style={{ marginTop:20, opacity:try_allowed?1:0.5 }}
121
+ disabled={!try_allowed}
122
+ padding={15}
123
+ onPress={() => handleTryCodeRequest()}
124
+ title_color={Colors.shades.white}
125
+ backgroundColor={Colors.brand.electric}
126
+ />
127
+ :<></>}
128
+ {false ?
129
+ <Text size={14} color={Colors.utility.warning}>{'ERROR GOES HERE'}</Text>
130
+ :<></>}
131
+ </View>
132
+ <View style={{ margin:10, padding:5, backgroundColor:Colors.shades.white, borderRadius:8 }}>
133
+ {referrer ?
134
+ <View nativeID='referrer_details' style={{ flexDirection:'row', padding:5, borderBottomColor:Colors.shades.shade600, borderBottomWidth:1 }}>
135
+ <Image
136
+ source={{ uri:referrer.profile_pic }}
137
+ style={{ height:50, width:50, borderRadius:8 }}
138
+ resizeMode='cover'
139
+ />
140
+ <View style={{ flex:1, marginLeft:20 }}>
141
+ <Text size={16} weight='bold'>Referred By: {referrer.first_name} {referrer.last_name}</Text>
142
+ <Text style={{ marginTop:5 }} size={14} weight='regular'>@{referrer.username}</Text>
143
+ </View>
144
+
145
+ </View>
146
+ :<></>}
147
+ {promo ?
148
+ <View style={{ marginTop:5, padding:10 }}>
149
+ <Text size={16} color={Colors.brand.midnight} weight='bold' textAlign='left'>Code Offer</Text>
150
+ <Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign='left'>{ProfileHelpers.getReferralDescription(promo)}</Text>
151
+ {reward_option ?
152
+ <View style={{ marginTop:10, backgroundColor:Colors.highlights.highlight400Faded, padding:10, borderRadius:8 }}>
153
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>AWARD REDEEMED: {reward_option.reward_name}</Text>
154
+ {code_request && promo && ['referral_sweepstakes','referral_code'].includes(promo.type) ?
155
+ <Text style={{ marginTop:4 }} size={14} color={Colors.brand.midnight} weight='bold'>KICKBACK STATUS: {code_request.status == 'fulfilled' ? 'Pending Deposit': 'Kickback received'}</Text>
156
+ :<></>}
157
+ </View>
158
+ :<></>}
159
+ </View>
160
+ :<></>}
161
+ </View>
162
+ </View>
163
+ <View style={{ flexDirection:'row', padding:10 }}>
164
+ <Button
165
+ title={walkthrough ? 'SKIP' : 'CLOSE'}
166
+ style={{ flex:1, marginRight:5 }}
167
+ borderColor={Colors.brand.electric}
168
+ title_color={Colors.brand.electric}
169
+ borderWidth={1}
170
+ padding={15}
171
+ onPress={() => walkthrough ? onNext() : onClose()}
172
+ />
173
+ {code_request?.status == 'requested' ?
174
+ <Button
175
+ title='VERIFY MY ACCOUNT'
176
+ style={{ flex:3 }}
177
+ backgroundColor={Colors.utility.warning}
178
+ title_color={Colors.shades.white}
179
+ padding={15}
180
+ onPress={() => console.log('BERIFY')}
181
+ />
182
+ :code_request?.status == 'verified' ?
183
+ <Button
184
+ title='REDEEM CODE'
185
+ style={{ flex:3 }}
186
+ backgroundColor={Colors.utility.success}
187
+ title_color={Colors.shades.white}
188
+ padding={15}
189
+ onPress={() => handleRedeemCode()}
190
+ />
191
+ :
192
+ <Button
193
+ title='CODE REDEEMED'
194
+ style={{ flex:3 }}
195
+ disabled
196
+ backgroundColor={Colors.brand.slate}
197
+ title_color={Colors.shades.white}
198
+ padding={15}
199
+ onPress={() => console.log('REDEEMED!!!')}
200
+ />
201
+ }
202
+ </View>
203
+ {show_reward ?
204
+ <View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, backgroundColor:Colors.shades.black_faded, justifyContent:'center', alignItems:'center' }}>
205
+ <View style={{ borderRadius:8, backgroundColor:Colors.shades.white, padding:20, minWidth:250, minHeight:200 }}>
206
+ {reward_option ?
207
+ <View>
208
+ <Text size={14} color={Colors.brand.midnight} weight='semibold' textAlign='center'>CONGRATULATIONS!</Text>
209
+ <Text style={{ marginTop:10 }} size={30} color={Colors.utility.success} weight='bold' textAlign='center'>{reward_option.reward_name}</Text>
210
+ <Text style={{ marginTop:10 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign='center'>AWARD RECEIVED</Text>
211
+ <Button
212
+ title='CLOSE'
213
+ title_color={Colors.shades.white}
214
+ style={{ marginTop:20 }}
215
+ padding={15}
216
+ backgroundColor={Colors.brand.electric}
217
+ onPress={() => setShowReward(false)}
218
+ />
219
+ </View>
220
+ :
221
+ <View>
222
+ <Text size={14} color={Colors.brand.midnight} weight='semibold' textAlign='center'>GETTING YOUR REWARD...</Text>
223
+ <ActivityIndicator size='large' color={Colors.brand.midnight} style={{alignSelf:'center', marginTop:20 }}/>
224
+ </View>
225
+ }
226
+ </View>
227
+ :<></>
228
+ </View>
229
+ :<></>}
230
+ </View>
231
+ )
232
+ }
233
+
234
+ export default CodeRedeem
@@ -0,0 +1,154 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import type { MyPlayerProps } from '../api/types';
3
+ import moment from 'moment-mini';
4
+ import { View, ActivityIndicator } from 'react-native';
5
+ import { Button, Icons, Text, TextInput } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+ import { ProfileApi } from '../api';
8
+
9
+ type DOBManagerProps = {
10
+ player:MyPlayerProps,
11
+ walkthrough?:boolean,
12
+ onNext:() => void,
13
+ onClose:() => void,
14
+ onPlayerUpdate:(player:MyPlayerProps) => void
15
+ }
16
+
17
+ const DOBManager = ({ player, walkthrough, onPlayerUpdate, onNext, onClose }: DOBManagerProps ) => {
18
+ const [ loading, setLoading ] = useState(false);
19
+ const [ dob, setDob ] = useState<string>('');
20
+ const [ error, setError ] = useState<undefined | string>(undefined)
21
+ const [ age_error, setAgeError ] = useState<undefined | string>(undefined)
22
+
23
+
24
+ useEffect(() => {
25
+ if(player.dob){
26
+ let split_dob = player.dob.split('T')
27
+ if(!split_dob[0]){ return }
28
+ split_dob = split_dob[0].split('-')
29
+ let new_date = `${split_dob[1]}/${split_dob[2]}/${split_dob[0]}`
30
+ let valid = moment(new_date, 'MM/DD/YYYY', true).isValid()
31
+ if(valid){ setDob(new_date) }
32
+ else { setDob(moment(player.dob).format('MM/DD/YYYY')) }
33
+ let age_diff = moment().diff(moment(player.dob), 'years')
34
+ if(age_diff < 18){
35
+ setAgeError('Must be over the age of 18 to participate in real money activities on BettorEdge')
36
+ } else {
37
+ setAgeError(undefined)
38
+ }
39
+ }
40
+ },[player])
41
+
42
+ const isUpdateNeeded = () => {
43
+ let new_dob = moment(dob).format('MM/DD/YYYY');
44
+ let old_dob = moment(player.dob).format('MM/DD/YYYY');
45
+ if(new_dob != old_dob){ return true }
46
+ return false
47
+ }
48
+
49
+ const handleDOBChange = (val:string) => {
50
+ let dob_moment = moment(val, 'MM/DD/YYYY', true)
51
+ if(val != '' && !dob_moment.isValid()){
52
+ setError('Invalid date format')
53
+ } else {
54
+ setError(undefined)
55
+ let age_diff = moment().diff(dob_moment, 'years')
56
+ if(age_diff < 18){
57
+ setAgeError('Must be over the age of 18 to participate in real money activities on BettorEdge')
58
+ } else {
59
+ setAgeError(undefined)
60
+ }
61
+ }
62
+ setDob(val)
63
+ }
64
+
65
+ const handleUpdatePlayerDOB = async() => {
66
+ setLoading(true);
67
+ const new_player = await ProfileApi.updatePlayerDOB(dob);
68
+ onPlayerUpdate(new_player)
69
+ setLoading(false);
70
+ }
71
+
72
+ const update_allowed = isUpdateNeeded() && !error
73
+
74
+ return (
75
+ <View style={{ flex:1 }}>
76
+ <View style={{ flex:1, justifyContent:'center'}}>
77
+ <View style={{ padding:10 }}>
78
+ <Text weight='bold' size={16} textAlign='left' color={Colors.brand.midnight}>My Date of Birth</Text>
79
+ <Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>In order to participate in real-money gaming you must be over 18.</Text>
80
+ </View>
81
+ <View style={{ padding:10, flex:1 }}>
82
+ <View style={{ backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
83
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
84
+ <Icons.BirthdayIcon
85
+ color={Colors.brand.midnight}
86
+ size={18}
87
+ />
88
+ </View>
89
+ <TextInput
90
+ value={dob}
91
+ placeholder='01/01/2005'
92
+ editable={player.vouched_status == 'verified' ? false : true}
93
+ placeholderTextColor={Colors.brand.slate}
94
+ style={{ flex:1, borderRadius:0 }}
95
+ onChangeText={(text) => handleDOBChange(text)}
96
+ />
97
+ <View style={{ paddingLeft:15, paddingRight:15 }}>
98
+ {loading ?
99
+ <ActivityIndicator size='small' color={Colors.brand.midnight}/>
100
+ :
101
+ <View>
102
+ { player.dob && !error ?
103
+ <Icons.CheckIcon size={16} color={Colors.utility.success} />
104
+ :
105
+ <Icons.AlertIcon size={16} color={Colors.utility.warning} />
106
+ }
107
+ </View>
108
+ }
109
+ </View>
110
+ </View>
111
+ {error ?
112
+ <Text size={14} color={Colors.utility.warning}>{error}</Text>
113
+ : age_error ?
114
+ <Text size={14} color={Colors.utility.warning}>{age_error}</Text>
115
+ :<></>}
116
+ </View>
117
+ </View>
118
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
119
+ <Button
120
+ title={walkthrough ? 'SKIP' : 'CLOSE'}
121
+ style={{ flex:1, marginRight:5 }}
122
+ borderColor={Colors.brand.electric}
123
+ title_color={Colors.brand.electric}
124
+ borderWidth={1}
125
+ padding={15}
126
+ onPress={() => walkthrough ? onNext() : onClose()}
127
+ />
128
+ {!update_allowed && player.dob ?
129
+ <Button
130
+ title='COMPLETE VERIFICATION'
131
+ style={{ flex:3 }}
132
+ padding={15}
133
+ backgroundColor={Colors.utility.success}
134
+ title_color={Colors.shades.white}
135
+ onPress={() => onNext()}
136
+ />
137
+ :
138
+ <Button
139
+ title={'UPDATE'}
140
+ style={{ flex:3, opacity:update_allowed?1:0.5 }}
141
+ padding={15}
142
+ loading={loading}
143
+ disabled={!update_allowed}
144
+ backgroundColor={Colors.utility.success}
145
+ title_color={Colors.shades.white}
146
+ onPress={() => handleUpdatePlayerDOB()}
147
+ />
148
+ }
149
+ </View>
150
+ </View>
151
+ )
152
+ }
153
+
154
+ export default DOBManager