be-components 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,81 @@
1
+ import React from 'react';
2
+ import { Image, View } from "react-native"
3
+ import type { MyPlayerProps } from "../api/types"
4
+ import { Button, Text } from '../../Components';
5
+ import ImageUploader from '../../Components/ImageUploader';
6
+ import Colors from '../../constants/colors';
7
+ import { ProfileApi } from '../api';
8
+
9
+ type ProfilePicManagerProps = {
10
+ player:MyPlayerProps,
11
+ walkthrough?:boolean,
12
+ onClose:() => void,
13
+ onNext:() => void,
14
+ onPlayerUpdate:(player:MyPlayerProps) => void
15
+ }
16
+
17
+ const ProfilePicManager = ({ player, onPlayerUpdate, walkthrough, onNext, onClose }:ProfilePicManagerProps) => {
18
+
19
+ const handleUpdatePic = async(profile_pic:string) => {
20
+ const new_player = await ProfileApi.updatePlayerPic(profile_pic)
21
+ onPlayerUpdate(new_player)
22
+ }
23
+
24
+ return (
25
+ <View style={{ flex:1 }}>
26
+ <View style={{ flex:1 }}>
27
+ <View style={{ padding:10 }}>
28
+ <Text size={16} weight='bold' color={Colors.brand.midnight}>MY PROFILE PICTURE</Text>
29
+ <Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight}>Your profile picture is how users will see you in leaderboards and activity feeds.</Text>
30
+ </View>
31
+ <View style={{ justifyContent:'center', alignItems:'center' }}>
32
+ <Image
33
+ source={{ uri: player.profile_pic ? player.profile_pic :'https://res.cloudinary.com/hoabts6mc/image/upload/v1714408535/sports_avatar_wdzsxc.webp' }}
34
+ style={{ height:400, width:400, borderRadius:4 }}
35
+ resizeMode='cover'
36
+ />
37
+ <View style={{ position:'absolute', left:0, bottom:0, right: 0, padding:10 }}>
38
+ <ImageUploader
39
+ public_id={`${player.player_id}_${Math.random()}`}
40
+ onStartUpload={() => console.log('STARTED!!!!')}
41
+ onFinishUpload={(obj) => handleUpdatePic(obj.secure_url)}
42
+ >
43
+ <Button
44
+ title={player.profile_pic ? 'CHANGE' : 'ADD PICTURE'}
45
+ disabled
46
+ title_color={Colors.brand.electric}
47
+ borderWidth={1}
48
+ borderColor={Colors.brand.electric}
49
+ padding={15}
50
+ onPress={() => console.log('NA')}
51
+ />
52
+ </ImageUploader>
53
+ </View>
54
+ </View>
55
+ </View>
56
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
57
+ <Button
58
+ title={walkthrough ? 'SKIP' : 'CLOSE'}
59
+ style={{ flex:1, marginRight:5 }}
60
+ borderColor={Colors.brand.electric}
61
+ title_color={Colors.brand.electric}
62
+ borderWidth={1}
63
+ padding={15}
64
+ onPress={() => walkthrough ? onNext() : onClose()}
65
+ />
66
+ <Button
67
+ title={'SET MY PASSWORD'}
68
+ style={{ flex:3 }}
69
+ padding={15}
70
+ //loading={loading}
71
+ //disabled={!is_valid}
72
+ backgroundColor={Colors.utility.success}
73
+ title_color={Colors.shades.white}
74
+ onPress={() => onNext()}
75
+ />
76
+ </View>
77
+ </View>
78
+ )
79
+ }
80
+
81
+ export default ProfilePicManager
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { View, Image } from 'react-native';
3
+ import type { MyPlayerProps } from '../api/types';
4
+ import Colors from '../../constants/colors';
5
+ import { Button, Text } from '../../Components';
6
+
7
+
8
+ type ProfileWelcomeProps = {
9
+ player:MyPlayerProps,
10
+ width:number,
11
+ onStartSetup: () => void,
12
+ onClose:() => void
13
+ }
14
+
15
+ const ProfileWelcome = ({ player, width, onStartSetup, onClose }:ProfileWelcomeProps) => {
16
+
17
+ return (
18
+ <View style={{ flex:1 }}>
19
+ <Image
20
+ source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1714506366/Welcome_James_pfzn7z.webp' }}
21
+ style={{ width, height:width }}
22
+ resizeMode='cover'
23
+ />
24
+ <View style={{ marginTop:-50, flex:1, backgroundColor:Colors.shades.black_faded_heavy }}>
25
+ <View style={{ padding:10 }}>
26
+ <Text size={24} color={Colors.shades.white} weight='bold'>Welcome @{player.username}</Text>
27
+ <Text style={{ marginTop:10 }} size={14} color={Colors.shades.white} weight='bold'>We have randomly generated this username for you. Finish setting up your profile to change it!</Text>
28
+ </View>
29
+ </View>
30
+ <View style={{ flexDirection:'row', padding:10 }}>
31
+ <Button
32
+ title='CLOSE'
33
+ style={{ flex:1, marginRight:5 }}
34
+ borderColor={Colors.brand.electric}
35
+ title_color={Colors.brand.electric}
36
+ borderWidth={1}
37
+ padding={15}
38
+ onPress={() => onClose()}
39
+ />
40
+ <Button
41
+ title='UPDATE MY INFO'
42
+ style={{ flex:3 }}
43
+ backgroundColor={Colors.utility.success}
44
+ title_color={Colors.shades.white}
45
+ padding={15}
46
+ onPress={() => onStartSetup()}
47
+ />
48
+ </View>
49
+ </View>
50
+ )
51
+ }
52
+
53
+ export default ProfileWelcome
@@ -0,0 +1,385 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, FlatList, TouchableOpacity, Image } from 'react-native';
3
+ import type { MyPlayerProps, ProfileLevelProps, ProfileStepProps } from "../api/types"
4
+ import { Icons, Text } from '../../Components';
5
+ import Colors from '../../constants/colors';
6
+ import BasicInfoManager from './BasicInfoManager';
7
+ import PasswordManager from './PasswordManager';
8
+ import EmailManager from './EmailManager';
9
+ import PhoneManager from './PhoneManager';
10
+ import BasicStatus from './BasicStatus';
11
+ import DOBManager from './DOBManager';
12
+ import VouchCard from './VouchCard';
13
+ import ProfilePicManager from './ProfilePicManager';
14
+ import ProfileWelcome from './ProfileWelcome';
15
+ import CodeRedeem from './CodeRedeem';
16
+
17
+ type ProfileWizardProps = {
18
+ player:MyPlayerProps,
19
+ width:number,
20
+ init_walkthrough?:boolean,
21
+ profile_attribute?:'basic'|'phone'|'email'|'dob'|'password'|'vouch',
22
+ onClose:() => void,
23
+ onSelectLevel:(level:ProfileLevelProps) => void,
24
+ onPlayerUpdate:(player:MyPlayerProps) => void
25
+ }
26
+
27
+ const ProfileWizard = ({ player, init_walkthrough, width, onPlayerUpdate, onSelectLevel, onClose }:ProfileWizardProps) => {
28
+ const [ draft_player, setDraftPlayer ] = useState(player);
29
+ const [ walkthrough, setWalkthrough ] = useState<boolean | undefined>(false);
30
+ const [ active_level, setActiveLevel ] = useState<ProfileLevelProps>()
31
+ const [ active_step, setActiveStep ] = useState<ProfileStepProps>()
32
+ const [ groups, setGroups ] = useState([
33
+ {
34
+ priority: 1, key: 'profile', name: 'My Profile', profile_levels: [
35
+ {
36
+ num: 1,
37
+ label: 'Basic Information',
38
+ description: 'Just enough information to get started playing our free to play games',
39
+ identifier: 'basic',
40
+ tracked:true,
41
+ pct_complete: 0,
42
+ profile_steps: [
43
+ { num:1, check: 'basic', label: 'Basic Info', description: `Let's get some basic information about you!`, complete:false },
44
+ { num:2, check: 'profile_pic', label: 'My Picture', description: `We initially created this based on your username using AI! Change it here!`, complete:false },
45
+ { num:3, check: 'password', label: 'Password', description: `Lets set a password for additional security`, complete:false },
46
+ { num:4, check: 'basic_review', label: 'Review', description: `Review your status!`, complete:false }
47
+ ]
48
+ },
49
+ {
50
+ num: 2,
51
+ label: 'Security & Verification',
52
+ description: 'Additional information needed to use real-money',
53
+ identifier: 'verify',
54
+ tracked:true,
55
+ pct_complete: 0,
56
+ profile_steps: [
57
+ { num:1, check: 'email', label: 'Email', description: `Lets make sure you can access your account in case you forget your password`, complete:false },
58
+ { num:2, check: 'phone', label: 'Phone', description: `Lets make sure you can access your account in case you forget your password`, complete:false },
59
+ { num:3, check: 'dob', label: 'Date of Birth', description: `We need to ensure you are at least 18 to play`, complete:false },
60
+ { num:4, check: 'vouch', label: 'Verify', description: `We need to ensure you are at least 18 to play`, complete:false },
61
+ { num:5, check: 'code', label: 'Promo', description: `Lets get you started with some promo bucks!`, complete:false },
62
+
63
+ ]
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ priority: 2, key: 'preferences', name: 'Preferences', profile_levels: [
69
+ {
70
+ num: 1,
71
+ label: 'Profile Settings',
72
+ description: 'Set your profile settings',
73
+ identifier: 'settings',
74
+ pct_complete: 1,
75
+ tracked:false,
76
+ profile_steps: [
77
+ { num: 1, check: 'preferences', label: 'Profile Preferences', description: 'Set your profile preferences like unit size and more', complete: true },
78
+ { num: 2, check: 'notification', label: 'Notification Settings', description: 'Set how and when you would like to be notified', complete:true },
79
+ ]
80
+
81
+ }
82
+ ]
83
+ }
84
+ ])
85
+
86
+ useEffect(() => {
87
+ if(!player){ return }
88
+ setWalkthrough(init_walkthrough)
89
+ setDraftPlayer(player)
90
+ const groups = setupSteps(player)
91
+ setGroups(groups);
92
+ },[player])
93
+
94
+ const getStepColor = (step:ProfileStepProps, active?:boolean) => {
95
+ if(step.complete){
96
+ if(active){ return Colors.highlights.highlight400 }
97
+ return Colors.highlights.highlight400Faded
98
+ } else {
99
+ if(active){ return Colors.brand.electric }
100
+ return Colors.shades.shade600
101
+ }
102
+ }
103
+
104
+
105
+ const setupSteps = (pl:MyPlayerProps):any[] => {
106
+
107
+ let new_groups = groups.map(g => {
108
+ g.profile_levels = g.profile_levels.map(level => {
109
+ level.profile_steps = level.profile_steps.map(s => {
110
+ switch(s.check){
111
+ case 'basic_review':
112
+ if(!pl.no_password && !pl.auto_generated && pl.first_name && pl.last_name){ return { ...s, complete:true } }
113
+ return s
114
+ case 'basic':
115
+ if(pl.first_name && pl.last_name){ return { ...s, complete:true } }
116
+ return s
117
+ case 'profile_pic':
118
+ if(pl.profile_pic && pl.profile_pic != ''){ return { ...s, complete:true } }
119
+ return s
120
+ case 'password':
121
+ if(!pl.no_password){ return { ...s, complete:true } }
122
+ return s
123
+ case 'email':
124
+ if(pl.verified){ return { ...s, complete: true } }
125
+ return s
126
+ case 'dob':
127
+ if(pl.dob && pl.dob != ''){ return { ...s, complete:true } }
128
+ return s
129
+ case 'vouch':
130
+ if(pl.vouched_status == 'verified'){ return { ...s, complete:true } }
131
+ return s
132
+ case 'phone':
133
+ if(pl.phone_verified){ return { ...s, complete: true } }
134
+ return s
135
+ default: return s
136
+ }
137
+ })
138
+ if(level.tracked){
139
+ let pct_complete = level.profile_steps.filter(s => s.complete).length / level.profile_steps.length
140
+ level.pct_complete = pct_complete
141
+ }
142
+ return level
143
+ })
144
+ return g
145
+ })
146
+
147
+ return new_groups
148
+ }
149
+
150
+ const renderLevels = (data: { item: ProfileLevelProps, index:number}) => {
151
+ return (
152
+ <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }} onPress={() => {
153
+ setActiveLevel(data.item)
154
+ setActiveStep(data.item.profile_steps[0])
155
+ }}>
156
+ <View style={{ height:20, width:20, borderRadius:100, borderWidth:1, borderColor:Colors.brand.slate, backgroundColor:Colors.shades.white, justifyContent:'center', alignItems:'center' }}>
157
+ {data.item.pct_complete == 1 ?
158
+ <Icons.CheckIcon color={Colors.utility.success} size={14} />
159
+ :<></>}
160
+ </View>
161
+ <View style={{ flex:1, marginLeft:10, marginRight:10 }}>
162
+ <Text size={16} color={Colors.brand.midnight} weight='bold'>{data.item.label}</Text>
163
+ <Text style={{ marginTop:3 }} size={14} color={Colors.brand.midnight} weight='regular'>{data.item.description}</Text>
164
+ </View>
165
+ {data.item.pct_complete ?
166
+ <View style={{ marginRight:10 }}>
167
+ <Text size={14} color={Colors.brand.midnight}>{(data.item.pct_complete*100).toFixed()}%</Text>
168
+ </View>
169
+ :<></>}
170
+ <Icons.ChevronIcon direction='right' size={10} color={Colors.brand.midnight} />
171
+ </TouchableOpacity>
172
+ )
173
+ }
174
+
175
+ const renderGroups = (data: { item:any, index:number }) => {
176
+ return (
177
+ <View>
178
+ <View style={{ padding: 10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
179
+ <Text size={18} color={Colors.brand.midnight} weight='bold'>{data.item.name}</Text>
180
+ </View>
181
+ <FlatList
182
+ data={data.item.profile_levels}
183
+ renderItem={renderLevels}
184
+ keyExtractor={(item) => item.identifier}
185
+ />
186
+ </View>
187
+ )
188
+ }
189
+
190
+ const renderSteps = (data:{ item: ProfileStepProps, index:number }) => {
191
+ const active = data.item.check == active_step?.check ? true : false
192
+ if(!active_level){ return <></> }
193
+ return (
194
+ <TouchableOpacity style={{ padding:10, width: width / active_level?.profile_steps.length, backgroundColor:getStepColor(data.item, active) }} onPress={() => setActiveStep(data.item)}>
195
+ <Text size={14} color={active?Colors.shades.white:Colors.brand.midnight} weight='bold' textAlign='center'>{data.item.label}</Text>
196
+ </TouchableOpacity>
197
+ )
198
+ }
199
+
200
+
201
+ return (
202
+ <View style={{ flex:1 }}>
203
+ {!active_level ?
204
+ <View style={{ flex:1 }}>
205
+ <View style={{ flex:1 }}>
206
+ <FlatList
207
+ data={groups}
208
+ renderItem={renderGroups}
209
+ keyExtractor={(item) => item.key}
210
+ />
211
+ </View>
212
+ <View style={{ justifyContent:'center', alignItems:'center' }}>
213
+ <Image
214
+ source={{ uri: require('../../Assets/images/powered_by_be.webp') }}
215
+ style={{ width: width * 0.6, height: (width*0.6) / 3 }}
216
+ resizeMode='center'
217
+ />
218
+ </View>
219
+ </View>
220
+ :
221
+ <View style={{ flex:1 }}>
222
+ <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopWidth:2, borderColor:Colors.shades.shade600 }} onPress={() => {
223
+ setActiveLevel(undefined)
224
+ setActiveStep(undefined)
225
+ }}>
226
+ <Icons.ChevronIcon direction='left' size={10} color={Colors.brand.midnight} />
227
+ <View style={{ flex:1, marginLeft:20, marginRight:20 }}>
228
+ <Text size={16} color={Colors.brand.midnight} weight='bold'>{active_level.label}</Text>
229
+ <Text style={{ marginTop:3 }} size={14} color={Colors.brand.midnight} weight='regular'>{active_level.description}</Text>
230
+ </View>
231
+ {active_level.pct_complete ?
232
+ <View>
233
+ <Text size={14} color={Colors.brand.midnight}>{(active_level.pct_complete*100).toFixed()}%</Text>
234
+ </View>
235
+ :<></>}
236
+ </TouchableOpacity>
237
+ <View style={{ borderWidth:1, borderColor:Colors.shades.shade600, borderRadius:22 }}>
238
+ <FlatList
239
+ data={active_level?.profile_steps}
240
+ renderItem={renderSteps}
241
+ horizontal
242
+ showsHorizontalScrollIndicator={false}
243
+ keyExtractor={(item) => item.check}
244
+ />
245
+ </View>
246
+ <View style={{ flex:1 }}>
247
+ {!active_step?
248
+ <ProfileWelcome
249
+ player={draft_player}
250
+ width={width}
251
+ onStartSetup={() => {
252
+ if(!active_level){ return }
253
+ setWalkthrough(true);
254
+ let next_step = active_level.profile_steps[0]
255
+ setActiveStep(next_step)
256
+ }}
257
+ onClose={() => onClose()}
258
+ />
259
+ :active_step.check == 'basic' ?
260
+ <BasicInfoManager
261
+ player={draft_player}
262
+ walkthrough={walkthrough}
263
+ onClose={onClose}
264
+ onNext={() => {
265
+ if(!active_level){ return }
266
+ let next_step = active_level.profile_steps[1]
267
+ setActiveStep(next_step)
268
+ }}
269
+ onPlayerUpdate={(player) => {
270
+ onPlayerUpdate(player)
271
+ }}
272
+ />
273
+ :active_step.check == 'profile_pic'?
274
+ <ProfilePicManager
275
+ player={draft_player}
276
+ walkthrough={walkthrough}
277
+ onClose={onClose}
278
+ onNext={() => {
279
+ if(!active_level){ return }
280
+ let next_step = active_level.profile_steps[2]
281
+ setActiveStep(next_step)
282
+ }}
283
+ onPlayerUpdate={(player) => onPlayerUpdate(player)}
284
+ />
285
+ :active_step.check == 'password' ?
286
+ <PasswordManager
287
+ player={draft_player}
288
+ onClose={onClose}
289
+ walkthrough={walkthrough}
290
+ onNext={() => {
291
+ if(!active_level){ return }
292
+ let next_step = active_level.profile_steps[3]
293
+ setActiveStep(next_step)
294
+ }}
295
+ onPlayerUpdate={(player) => onPlayerUpdate(player)}
296
+ />
297
+ :active_step.check == 'email' ?
298
+ <EmailManager
299
+ player={draft_player}
300
+ walkthrough={walkthrough}
301
+ onClose={onClose}
302
+ onNext={() => {
303
+ if(!active_level){ return }
304
+ let next_step = active_level.profile_steps[1]
305
+ setActiveStep(next_step)
306
+ }}
307
+ onPlayerUpdate={(player) => onPlayerUpdate(player)}
308
+ />
309
+ :active_step.check == 'phone' ?
310
+ <PhoneManager
311
+ player={draft_player}
312
+ onClose={onClose}
313
+ walkthrough={walkthrough}
314
+ onNext={() => {
315
+ if(!active_level){ return }
316
+ let next_step = active_level.profile_steps[2]
317
+ setActiveStep(next_step)
318
+ }}
319
+ onPlayerUpdate={(player) => onPlayerUpdate(player)}
320
+ />
321
+ :active_step.check == 'basic_review' ?
322
+ <BasicStatus
323
+ player={draft_player}
324
+ onClose={onClose}
325
+ onVerify={() => {
326
+ let new_level = groups[0]?.profile_levels[1]
327
+ if(!new_level){return }
328
+ setActiveLevel(new_level)
329
+ onSelectLevel(new_level)
330
+ setActiveStep(new_level.profile_steps[0])
331
+ }}
332
+ />
333
+ :active_step.check == 'dob' ?
334
+ <DOBManager
335
+ player={draft_player}
336
+ onClose={onClose}
337
+ walkthrough={walkthrough}
338
+ onNext={() => {
339
+ if(!active_level){ return }
340
+ let next_step = active_level.profile_steps[3]
341
+ setActiveStep(next_step)
342
+ }}
343
+ onPlayerUpdate={(player) => setDraftPlayer(player)}
344
+ />
345
+ :active_step.check == 'vouch' ?
346
+ <VouchCard
347
+ player={draft_player}
348
+ onClose={onClose}
349
+ />
350
+ :active_step.check == 'code' ?
351
+ <CodeRedeem
352
+ player={draft_player}
353
+ onNext={() => console.log('hey')}
354
+ onClose={onClose}
355
+
356
+ />
357
+ :<></>}
358
+ </View>
359
+ </View>
360
+ }
361
+ </View>
362
+ )
363
+ }
364
+
365
+ export default ProfileWizard
366
+
367
+
368
+
369
+
370
+ /*
371
+ {
372
+ num: 3,
373
+ label: 'Advanced',
374
+ description: 'Lets get your wallet ready to deposit / withdraw',
375
+ identifier: 'advance',
376
+ active_step: 'basic',
377
+ pct_complete: 0,
378
+ profile_steps: [
379
+ { num:1, check: 'deposit', label: 'Deposit', description: `Lets make your first deposit so you can use real money!`, complete:false },
380
+ { num:2, check: 'order', label: 'Order', description: `Create your first bet`, complete:false },
381
+ { num:3, check: 'pwa', label: 'Get the App', description: `Lets get the app installed`, complete:false },
382
+ { num:4, check: 'notifications', label: 'Get Notified', description: `Lets set up your notifications`, complete:false },
383
+ ]
384
+ }
385
+ */