be-components 0.4.9 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +12 -3
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -1
  3. package/lib/commonjs/Checkout/api/index.js +254 -0
  4. package/lib/commonjs/Checkout/api/index.js.map +1 -0
  5. package/lib/commonjs/Checkout/components/AccountSummaryCard.js +274 -0
  6. package/lib/commonjs/Checkout/components/AccountSummaryCard.js.map +1 -0
  7. package/lib/commonjs/Checkout/components/ItemSummaryCard.js +56 -0
  8. package/lib/commonjs/Checkout/components/ItemSummaryCard.js.map +1 -0
  9. package/lib/commonjs/Checkout/components/OrderSummaryCard.js +84 -0
  10. package/lib/commonjs/Checkout/components/OrderSummaryCard.js.map +1 -0
  11. package/lib/commonjs/Checkout/index.js +590 -0
  12. package/lib/commonjs/Checkout/index.js.map +1 -0
  13. package/lib/commonjs/Components/Button.js +11 -3
  14. package/lib/commonjs/Components/Button.js.map +1 -1
  15. package/lib/commonjs/Components/Checkbox.js +6 -2
  16. package/lib/commonjs/Components/Checkbox.js.map +1 -1
  17. package/lib/commonjs/Components/Icons.js +441 -4
  18. package/lib/commonjs/Components/Icons.js.map +1 -1
  19. package/lib/commonjs/Components/Spring.js +6 -5
  20. package/lib/commonjs/Components/Spring.js.map +1 -1
  21. package/lib/commonjs/LocationTracker/LocationStatus.js +95 -0
  22. package/lib/commonjs/LocationTracker/LocationStatus.js.map +1 -0
  23. package/lib/commonjs/LocationTracker/api/index.js +124 -0
  24. package/lib/commonjs/LocationTracker/api/index.js.map +1 -0
  25. package/lib/commonjs/LocationTracker/index.js +207 -0
  26. package/lib/commonjs/LocationTracker/index.js.map +1 -0
  27. package/lib/commonjs/Observer/Observer.js +2 -0
  28. package/lib/commonjs/Observer/Observer.js.map +1 -1
  29. package/lib/commonjs/Wallet/api/index.js +621 -0
  30. package/lib/commonjs/Wallet/api/index.js.map +1 -0
  31. package/lib/commonjs/Wallet/components/ACHAdd.js +63 -0
  32. package/lib/commonjs/Wallet/components/ACHAdd.js.map +1 -0
  33. package/lib/commonjs/Wallet/components/AccountCard.js +137 -0
  34. package/lib/commonjs/Wallet/components/AccountCard.js.map +1 -0
  35. package/lib/commonjs/Wallet/components/AccountLimitManager.js +321 -0
  36. package/lib/commonjs/Wallet/components/AccountLimitManager.js.map +1 -0
  37. package/lib/commonjs/Wallet/components/AccountManager.js +202 -0
  38. package/lib/commonjs/Wallet/components/AccountManager.js.map +1 -0
  39. package/lib/commonjs/Wallet/components/AccountSnoozeManager.js +263 -0
  40. package/lib/commonjs/Wallet/components/AccountSnoozeManager.js.map +1 -0
  41. package/lib/commonjs/Wallet/components/AddressCard.js +56 -0
  42. package/lib/commonjs/Wallet/components/AddressCard.js.map +1 -0
  43. package/lib/commonjs/Wallet/components/AddressManager.js +365 -0
  44. package/lib/commonjs/Wallet/components/AddressManager.js.map +1 -0
  45. package/lib/commonjs/Wallet/components/DepositCard.js +195 -0
  46. package/lib/commonjs/Wallet/components/DepositCard.js.map +1 -0
  47. package/lib/commonjs/Wallet/components/LinkAccountManager.js +167 -0
  48. package/lib/commonjs/Wallet/components/LinkAccountManager.js.map +1 -0
  49. package/lib/commonjs/Wallet/components/ManageAccountCard.js +216 -0
  50. package/lib/commonjs/Wallet/components/ManageAccountCard.js.map +1 -0
  51. package/lib/commonjs/Wallet/components/ManualACHAdd.js +270 -0
  52. package/lib/commonjs/Wallet/components/ManualACHAdd.js.map +1 -0
  53. package/lib/commonjs/Wallet/components/ManualCardAdd.js +337 -0
  54. package/lib/commonjs/Wallet/components/ManualCardAdd.js.map +1 -0
  55. package/lib/commonjs/Wallet/components/MyBalance.js +73 -0
  56. package/lib/commonjs/Wallet/components/MyBalance.js.map +1 -0
  57. package/lib/commonjs/Wallet/components/PayPalOrderCapture.js +68 -0
  58. package/lib/commonjs/Wallet/components/PayPalOrderCapture.js.map +1 -0
  59. package/lib/commonjs/Wallet/components/RemoveAccount.js +108 -0
  60. package/lib/commonjs/Wallet/components/RemoveAccount.js.map +1 -0
  61. package/lib/commonjs/Wallet/components/VerifyACHAccount.js +196 -0
  62. package/lib/commonjs/Wallet/components/VerifyACHAccount.js.map +1 -0
  63. package/lib/commonjs/Wallet/components/WalletSetup.js +316 -0
  64. package/lib/commonjs/Wallet/components/WalletSetup.js.map +1 -0
  65. package/lib/commonjs/Wallet/components/WithdrawCard.js +336 -0
  66. package/lib/commonjs/Wallet/components/WithdrawCard.js.map +1 -0
  67. package/lib/commonjs/Wallet/index.js +221 -0
  68. package/lib/commonjs/Wallet/index.js.map +1 -0
  69. package/lib/commonjs/constants/colors.js +3 -0
  70. package/lib/commonjs/constants/colors.js.map +1 -1
  71. package/lib/commonjs/index.js +21 -0
  72. package/lib/commonjs/index.js.map +1 -1
  73. package/lib/module/ApiOverrides/index.js +12 -3
  74. package/lib/module/ApiOverrides/index.js.map +1 -1
  75. package/lib/module/Checkout/api/index.js +248 -0
  76. package/lib/module/Checkout/api/index.js.map +1 -0
  77. package/lib/module/Checkout/components/AccountSummaryCard.js +267 -0
  78. package/lib/module/Checkout/components/AccountSummaryCard.js.map +1 -0
  79. package/lib/module/Checkout/components/ItemSummaryCard.js +49 -0
  80. package/lib/module/Checkout/components/ItemSummaryCard.js.map +1 -0
  81. package/lib/module/Checkout/components/OrderSummaryCard.js +77 -0
  82. package/lib/module/Checkout/components/OrderSummaryCard.js.map +1 -0
  83. package/lib/module/Checkout/index.js +581 -0
  84. package/lib/module/Checkout/index.js.map +1 -0
  85. package/lib/module/Components/Button.js +11 -3
  86. package/lib/module/Components/Button.js.map +1 -1
  87. package/lib/module/Components/Checkbox.js +6 -2
  88. package/lib/module/Components/Checkbox.js.map +1 -1
  89. package/lib/module/Components/Icons.js +441 -4
  90. package/lib/module/Components/Icons.js.map +1 -1
  91. package/lib/module/Components/Spring.js +6 -5
  92. package/lib/module/Components/Spring.js.map +1 -1
  93. package/lib/module/LocationTracker/LocationStatus.js +88 -0
  94. package/lib/module/LocationTracker/LocationStatus.js.map +1 -0
  95. package/lib/module/LocationTracker/api/index.js +118 -0
  96. package/lib/module/LocationTracker/api/index.js.map +1 -0
  97. package/lib/module/LocationTracker/index.js +200 -0
  98. package/lib/module/LocationTracker/index.js.map +1 -0
  99. package/lib/module/Observer/Observer.js +2 -0
  100. package/lib/module/Observer/Observer.js.map +1 -1
  101. package/lib/module/Wallet/api/index.js +615 -0
  102. package/lib/module/Wallet/api/index.js.map +1 -0
  103. package/lib/module/Wallet/components/ACHAdd.js +56 -0
  104. package/lib/module/Wallet/components/ACHAdd.js.map +1 -0
  105. package/lib/module/Wallet/components/AccountCard.js +130 -0
  106. package/lib/module/Wallet/components/AccountCard.js.map +1 -0
  107. package/lib/module/Wallet/components/AccountLimitManager.js +312 -0
  108. package/lib/module/Wallet/components/AccountLimitManager.js.map +1 -0
  109. package/lib/module/Wallet/components/AccountManager.js +195 -0
  110. package/lib/module/Wallet/components/AccountManager.js.map +1 -0
  111. package/lib/module/Wallet/components/AccountSnoozeManager.js +254 -0
  112. package/lib/module/Wallet/components/AccountSnoozeManager.js.map +1 -0
  113. package/lib/module/Wallet/components/AddressCard.js +49 -0
  114. package/lib/module/Wallet/components/AddressCard.js.map +1 -0
  115. package/lib/module/Wallet/components/AddressManager.js +356 -0
  116. package/lib/module/Wallet/components/AddressManager.js.map +1 -0
  117. package/lib/module/Wallet/components/DepositCard.js +186 -0
  118. package/lib/module/Wallet/components/DepositCard.js.map +1 -0
  119. package/lib/module/Wallet/components/LinkAccountManager.js +158 -0
  120. package/lib/module/Wallet/components/LinkAccountManager.js.map +1 -0
  121. package/lib/module/Wallet/components/ManageAccountCard.js +207 -0
  122. package/lib/module/Wallet/components/ManageAccountCard.js.map +1 -0
  123. package/lib/module/Wallet/components/ManualACHAdd.js +261 -0
  124. package/lib/module/Wallet/components/ManualACHAdd.js.map +1 -0
  125. package/lib/module/Wallet/components/ManualCardAdd.js +328 -0
  126. package/lib/module/Wallet/components/ManualCardAdd.js.map +1 -0
  127. package/lib/module/Wallet/components/MyBalance.js +66 -0
  128. package/lib/module/Wallet/components/MyBalance.js.map +1 -0
  129. package/lib/module/Wallet/components/PayPalOrderCapture.js +61 -0
  130. package/lib/module/Wallet/components/PayPalOrderCapture.js.map +1 -0
  131. package/lib/module/Wallet/components/RemoveAccount.js +100 -0
  132. package/lib/module/Wallet/components/RemoveAccount.js.map +1 -0
  133. package/lib/module/Wallet/components/VerifyACHAccount.js +187 -0
  134. package/lib/module/Wallet/components/VerifyACHAccount.js.map +1 -0
  135. package/lib/module/Wallet/components/WalletSetup.js +307 -0
  136. package/lib/module/Wallet/components/WalletSetup.js.map +1 -0
  137. package/lib/module/Wallet/components/WithdrawCard.js +327 -0
  138. package/lib/module/Wallet/components/WithdrawCard.js.map +1 -0
  139. package/lib/module/Wallet/index.js +212 -0
  140. package/lib/module/Wallet/index.js.map +1 -0
  141. package/lib/module/constants/colors.js +3 -0
  142. package/lib/module/constants/colors.js.map +1 -1
  143. package/lib/module/index.js +4 -1
  144. package/lib/module/index.js.map +1 -1
  145. package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
  146. package/lib/typescript/src/Checkout/api/index.d.ts +49 -0
  147. package/lib/typescript/src/Checkout/api/index.d.ts.map +1 -0
  148. package/lib/typescript/src/Checkout/components/AccountSummaryCard.d.ts +18 -0
  149. package/lib/typescript/src/Checkout/components/AccountSummaryCard.d.ts.map +1 -0
  150. package/lib/typescript/src/Checkout/components/ItemSummaryCard.d.ts +8 -0
  151. package/lib/typescript/src/Checkout/components/ItemSummaryCard.d.ts.map +1 -0
  152. package/lib/typescript/src/Checkout/components/OrderSummaryCard.d.ts +8 -0
  153. package/lib/typescript/src/Checkout/components/OrderSummaryCard.d.ts.map +1 -0
  154. package/lib/typescript/src/Checkout/index.d.ts +12 -0
  155. package/lib/typescript/src/Checkout/index.d.ts.map +1 -0
  156. package/lib/typescript/src/Components/Button.d.ts.map +1 -1
  157. package/lib/typescript/src/Components/Checkbox.d.ts +3 -1
  158. package/lib/typescript/src/Components/Checkbox.d.ts.map +1 -1
  159. package/lib/typescript/src/Components/Icons.d.ts +8 -1
  160. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  161. package/lib/typescript/src/Components/Spring.d.ts.map +1 -1
  162. package/lib/typescript/src/LocationTracker/LocationStatus.d.ts +21 -0
  163. package/lib/typescript/src/LocationTracker/LocationStatus.d.ts.map +1 -0
  164. package/lib/typescript/src/LocationTracker/api/index.d.ts +19 -0
  165. package/lib/typescript/src/LocationTracker/api/index.d.ts.map +1 -0
  166. package/lib/typescript/src/LocationTracker/index.d.ts +22 -0
  167. package/lib/typescript/src/LocationTracker/index.d.ts.map +1 -0
  168. package/lib/typescript/src/Observer/Observer.d.ts.map +1 -1
  169. package/lib/typescript/src/Wallet/api/index.d.ts +94 -0
  170. package/lib/typescript/src/Wallet/api/index.d.ts.map +1 -0
  171. package/lib/typescript/src/Wallet/components/ACHAdd.d.ts +13 -0
  172. package/lib/typescript/src/Wallet/components/ACHAdd.d.ts.map +1 -0
  173. package/lib/typescript/src/Wallet/components/AccountCard.d.ts +10 -0
  174. package/lib/typescript/src/Wallet/components/AccountCard.d.ts.map +1 -0
  175. package/lib/typescript/src/Wallet/components/AccountLimitManager.d.ts +10 -0
  176. package/lib/typescript/src/Wallet/components/AccountLimitManager.d.ts.map +1 -0
  177. package/lib/typescript/src/Wallet/components/AccountManager.d.ts +13 -0
  178. package/lib/typescript/src/Wallet/components/AccountManager.d.ts.map +1 -0
  179. package/lib/typescript/src/Wallet/components/AccountSnoozeManager.d.ts +10 -0
  180. package/lib/typescript/src/Wallet/components/AccountSnoozeManager.d.ts.map +1 -0
  181. package/lib/typescript/src/Wallet/components/AddressCard.d.ts +10 -0
  182. package/lib/typescript/src/Wallet/components/AddressCard.d.ts.map +1 -0
  183. package/lib/typescript/src/Wallet/components/AddressManager.d.ts +23 -0
  184. package/lib/typescript/src/Wallet/components/AddressManager.d.ts.map +1 -0
  185. package/lib/typescript/src/Wallet/components/DepositCard.d.ts +14 -0
  186. package/lib/typescript/src/Wallet/components/DepositCard.d.ts.map +1 -0
  187. package/lib/typescript/src/Wallet/components/LinkAccountManager.d.ts +10 -0
  188. package/lib/typescript/src/Wallet/components/LinkAccountManager.d.ts.map +1 -0
  189. package/lib/typescript/src/Wallet/components/ManageAccountCard.d.ts +17 -0
  190. package/lib/typescript/src/Wallet/components/ManageAccountCard.d.ts.map +1 -0
  191. package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts +11 -0
  192. package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts.map +1 -0
  193. package/lib/typescript/src/Wallet/components/ManualCardAdd.d.ts +11 -0
  194. package/lib/typescript/src/Wallet/components/ManualCardAdd.d.ts.map +1 -0
  195. package/lib/typescript/src/Wallet/components/MyBalance.d.ts +14 -0
  196. package/lib/typescript/src/Wallet/components/MyBalance.d.ts.map +1 -0
  197. package/lib/typescript/src/Wallet/components/PayPalOrderCapture.d.ts +16 -0
  198. package/lib/typescript/src/Wallet/components/PayPalOrderCapture.d.ts.map +1 -0
  199. package/lib/typescript/src/Wallet/components/RemoveAccount.d.ts +10 -0
  200. package/lib/typescript/src/Wallet/components/RemoveAccount.d.ts.map +1 -0
  201. package/lib/typescript/src/Wallet/components/VerifyACHAccount.d.ts +10 -0
  202. package/lib/typescript/src/Wallet/components/VerifyACHAccount.d.ts.map +1 -0
  203. package/lib/typescript/src/Wallet/components/WalletSetup.d.ts +11 -0
  204. package/lib/typescript/src/Wallet/components/WalletSetup.d.ts.map +1 -0
  205. package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts +16 -0
  206. package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts.map +1 -0
  207. package/lib/typescript/src/Wallet/index.d.ts +10 -0
  208. package/lib/typescript/src/Wallet/index.d.ts.map +1 -0
  209. package/lib/typescript/src/constants/colors.d.ts +3 -0
  210. package/lib/typescript/src/constants/colors.d.ts.map +1 -1
  211. package/lib/typescript/src/index.d.ts +4 -1
  212. package/lib/typescript/src/index.d.ts.map +1 -1
  213. package/package.json +4 -1
  214. package/src/ApiOverrides/index.ts +13 -3
  215. package/src/Checkout/api/index.tsx +199 -0
  216. package/src/Checkout/components/AccountSummaryCard.tsx +169 -0
  217. package/src/Checkout/components/ItemSummaryCard.tsx +34 -0
  218. package/src/Checkout/components/OrderSummaryCard.tsx +40 -0
  219. package/src/Checkout/index.tsx +398 -0
  220. package/src/Components/Button.tsx +5 -4
  221. package/src/Components/Checkbox.tsx +5 -2
  222. package/src/Components/Icons.tsx +196 -3
  223. package/src/Components/Spring.tsx +4 -3
  224. package/src/LocationTracker/LocationStatus.tsx +96 -0
  225. package/src/LocationTracker/api/index.tsx +114 -0
  226. package/src/LocationTracker/index.tsx +130 -0
  227. package/src/Observer/Observer.tsx +2 -1
  228. package/src/Wallet/api/index.ts +461 -0
  229. package/src/Wallet/components/ACHAdd.tsx +49 -0
  230. package/src/Wallet/components/AccountCard.tsx +92 -0
  231. package/src/Wallet/components/AccountLimitManager.tsx +212 -0
  232. package/src/Wallet/components/AccountManager.tsx +103 -0
  233. package/src/Wallet/components/AccountSnoozeManager.tsx +153 -0
  234. package/src/Wallet/components/AddressCard.tsx +31 -0
  235. package/src/Wallet/components/AddressManager.tsx +203 -0
  236. package/src/Wallet/components/DepositCard.tsx +107 -0
  237. package/src/Wallet/components/LinkAccountManager.tsx +119 -0
  238. package/src/Wallet/components/ManageAccountCard.tsx +146 -0
  239. package/src/Wallet/components/ManualACHAdd.tsx +164 -0
  240. package/src/Wallet/components/ManualCardAdd.tsx +185 -0
  241. package/src/Wallet/components/MyBalance.tsx +64 -0
  242. package/src/Wallet/components/PayPalOrderCapture.tsx +59 -0
  243. package/src/Wallet/components/RemoveAccount.tsx +68 -0
  244. package/src/Wallet/components/VerifyACHAccount.tsx +140 -0
  245. package/src/Wallet/components/WalletSetup.tsx +197 -0
  246. package/src/Wallet/components/WithdrawCard.tsx +145 -0
  247. package/src/Wallet/index.tsx +229 -0
  248. package/src/constants/colors.ts +3 -0
  249. package/src/index.tsx +7 -2
  250. package/src/types.d.ts +296 -1
@@ -0,0 +1,203 @@
1
+ import React, { useState } from 'react';
2
+ import { FlatList, TouchableOpacity, View } from 'react-native';
3
+ import type { LocationProps, PlayerAddressProps } from '../../types';
4
+ import type { MyPlayerProps } from '../../ProfileManager/api/types';
5
+ import { WalletApi, WalletHelpers } from '../api';
6
+ import AddressCard from './AddressCard';
7
+ import { Button, Text, TextInput } from '../../Components';
8
+ import Colors from '../../constants/colors';
9
+
10
+ type AddressManaertProps = {
11
+ player:MyPlayerProps
12
+ location?: {
13
+ loading: boolean,
14
+ error?:string,
15
+ coordinates:any,
16
+ address_results:any[],
17
+ player_address?:PlayerAddressProps,
18
+ region?:string,
19
+ location?:LocationProps
20
+ }
21
+ player_addresses:PlayerAddressProps[],
22
+ onAddAddress:(address:PlayerAddressProps) => void,
23
+ onRemoveAddress:(address:PlayerAddressProps) => void,
24
+ onSelect: (address:PlayerAddressProps) => void
25
+ onCancel: () => void
26
+ }
27
+
28
+ const AddressManager = ({ location, player_addresses, onSelect, onCancel, onAddAddress, onRemoveAddress }:AddressManaertProps) => {
29
+ const [ loading, setLoading ] = useState(false);
30
+ const [ draft_address, setDraftAddress ] = useState<PlayerAddressProps|undefined>(undefined)
31
+
32
+ const address_errors = WalletHelpers.isAddressValid(draft_address)
33
+
34
+
35
+ const handleCreateAddress = async() => {
36
+ if(!draft_address){ return } //
37
+ if(loading){ return } //Prevent button mashing
38
+ if(address_errors.length > 0){ return }
39
+ setLoading(true)
40
+ const new_addy = await WalletApi.createAddress(draft_address)
41
+ onAddAddress(new_addy)
42
+ setLoading(false)
43
+ setDraftAddress(undefined)
44
+ }
45
+
46
+ const handleDeleteAddres = async(address:PlayerAddressProps) => {
47
+ if(loading){ return } //No no button mash
48
+ //if(!selected_address){ return } //No selected address
49
+ setLoading(true)
50
+ const removed_addy = await WalletApi.deleteAddress(address.player_address_id);
51
+ onRemoveAddress(removed_addy)
52
+ setLoading(false)
53
+ }
54
+
55
+ const tryAutoFill = async() => {
56
+ if(!draft_address || !location?.player_address){ return }
57
+ setDraftAddress({ ...location.player_address })
58
+ }
59
+
60
+
61
+
62
+ const renderAddresses = (data:{ item:PlayerAddressProps, index:number }) => {
63
+ return (
64
+ <View style={{ margin:3 }}>
65
+ <AddressCard
66
+ address={data.item}
67
+ onSelect={(a) => onSelect(a)}
68
+ onDelete={async(a) => {
69
+ let confirmed = await confirm('Are you sure you would like to remove this address?')
70
+ if(confirmed){ handleDeleteAddres(a) }
71
+ }}
72
+ />
73
+ </View>
74
+ )
75
+ }
76
+ if(draft_address){
77
+ return (
78
+ <View style={{ flex:1, minHeight:600 }}>
79
+ <View style={{ padding:20 }}>
80
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>CREATE NEW ADDRESS</Text>
81
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Use the form below to create a new address.</Text>
82
+ </View>
83
+ <View style={{ flex:1, padding:20 }}>
84
+ <View nativeID='address_name' style={{ backgroundColor:Colors.shades.shade100, borderRadius:4, margin:5, padding:10 }}>
85
+ <Text size={16} color={Colors.brand.midnight} weight='bold' textAlign='center'>Address Name / Label</Text>
86
+ <Text style={{ margin:3 }} size={12} color={Colors.brand.midnight} weight='regular' textAlign='center'>Give address a name (i.e., Home) to make it easily identifiable.</Text>
87
+ <TextInput
88
+ value={draft_address.name}
89
+ placeholder='My Home'
90
+ placeholderTextColor={Colors.brand.slate}
91
+ onChangeText={(e) => setDraftAddress({ ...draft_address, name: e })}
92
+ />
93
+ {location?.player_address ?
94
+ <TouchableOpacity style={{ marginTop:5, padding:10 }} onPress={() => tryAutoFill()}>
95
+ <Text size={14} textAlign='center' weight='regular' color={Colors.brand.electric}>Autofill with Location</Text>
96
+ </TouchableOpacity>
97
+ :<></>}
98
+ </View>
99
+ <View nativeID='address_street' style={{ flexDirection:'row', alignItems:'center', margin:5 }}>
100
+ <Text style={{ flex:1/4 }} size={14} color={Colors.brand.midnight} weight='regular'>Street</Text>
101
+ <TextInput
102
+ style={{ flex:1 }}
103
+ value={draft_address.street}
104
+ onChangeText={(e) => setDraftAddress({ ...draft_address, street: e })}
105
+ />
106
+ </View>
107
+ <View nativeID='address_city' style={{ flexDirection:'row', alignItems:'center', margin:5 }}>
108
+ <Text style={{ flex:1/4 }} size={14} color={Colors.brand.midnight} weight='regular'>City</Text>
109
+ <TextInput
110
+ style={{ flex:1 }}
111
+ value={draft_address.city}
112
+ onChangeText={(e) => setDraftAddress({ ...draft_address, city: e })}
113
+ />
114
+ </View>
115
+ <View nativeID='address_state' style={{ flexDirection:'row', alignItems:'center', margin:5 }}>
116
+ <Text style={{ flex:1/4 }} size={14} color={Colors.brand.midnight} weight='regular'>State</Text>
117
+ <TextInput
118
+ value={draft_address.state}
119
+ placeholder='MN'
120
+ style={{ flex:1 }}
121
+ placeholderTextColor={Colors.shades.shade600}
122
+ onChangeText={(e) => setDraftAddress({ ...draft_address, state: e })}
123
+ />
124
+ </View>
125
+ <Text size={12} color={Colors.utility.warning} textAlign='right'>Two letter codes only accepted</Text>
126
+ <View nativeID='address_zip' style={{ flexDirection:'row', alignItems:'center', margin:5 }}>
127
+ <Text style={{ flex:1/4 }} size={14} color={Colors.brand.midnight} weight='regular'>Zip</Text>
128
+ <TextInput
129
+ style={{ flex:1 }}
130
+ value={draft_address.zip}
131
+ onChangeText={(e) => setDraftAddress({ ...draft_address, zip: e })}
132
+ />
133
+ </View>
134
+ </View>
135
+ <View style={{ flexDirection:'row', padding:10 }}>
136
+ <Button
137
+ style={{ flex:1, marginRight:5, opacity: 1 }}
138
+ title={'CANCEL'}
139
+ title_color={Colors.brand.electric}
140
+ borderWidth={1}
141
+ borderColor={Colors.brand.electric}
142
+ padding={15}
143
+ onPress={() => setDraftAddress(undefined)}
144
+ />
145
+ <Button
146
+ style={{ flex:3, opacity:address_errors.length == 0 && !loading ? 1 : 0.5 }}
147
+ title={'CREATE'}
148
+ disabled={address_errors.length > 0 || loading ? true : false}
149
+ title_color={Colors.shades.white}
150
+ loading={loading}
151
+ backgroundColor={Colors.utility.success}
152
+ padding={15}
153
+ onPress={() => handleCreateAddress()}
154
+ />
155
+ </View>
156
+
157
+ </View>
158
+ )
159
+ }
160
+
161
+
162
+ return (
163
+ <View style={{ flex:1, minHeight:600 }}>
164
+ <View style={{ padding:20 }}>
165
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>MY ADDRESSES</Text>
166
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Below are the addresses we have on file. Manage or add a new one below</Text>
167
+ </View>
168
+ {player_addresses.length == 0 ?
169
+ <View style={{ flex:1, padding:10, borderRadius:8, margin:10, backgroundColor:Colors.shades.shade600, justifyContent:'center', alignItems:'center' }}>
170
+ <Text size={18} color={Colors.brand.midnight} weight='bold' textAlign='center'>Uh Oh!</Text>
171
+ <Text style={{ marginTop:10 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign='center'>It looks like you dont have any saved addresses</Text>
172
+ <TouchableOpacity style={{ marginTop:20, padding:10, backgroundColor:Colors.brand.electric, borderRadius:4 }} onPress={() => setDraftAddress(WalletHelpers.getEmptyAddress())}>
173
+ <Text size={14} color={Colors.shades.white} textAlign='center'>Create New Address</Text>
174
+ </TouchableOpacity>
175
+ </View>
176
+ :<></>}
177
+ <View style={{ flex:1, padding:20 }}>
178
+ <FlatList data={player_addresses} renderItem={renderAddresses} />
179
+ </View>
180
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
181
+ <Button
182
+ style={{ flex:1, marginRight:5, opacity: 1 }}
183
+ title={'CLOSE'}
184
+ title_color={Colors.brand.electric}
185
+ borderWidth={1}
186
+ borderColor={Colors.brand.electric}
187
+ padding={15}
188
+ onPress={() => onCancel()}
189
+ />
190
+ <Button
191
+ style={{ flex:3 }}
192
+ title={'NEW ADDRESS'}
193
+ title_color={Colors.shades.white}
194
+ backgroundColor={Colors.brand.electric}
195
+ padding={15}
196
+ onPress={() => setDraftAddress(WalletHelpers.getEmptyAddress())}
197
+ />
198
+ </View>
199
+ </View>
200
+ )
201
+ }
202
+
203
+ export default AddressManager
@@ -0,0 +1,107 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, ActivityIndicator } from "react-native";
3
+ import type { MyPlayerProps } from '../../ProfileManager/api/types';
4
+ import type { AccountProps, AccountSnoozeProps, ItemOrderProps, PlayerDepositLimitProps, WalletSettingsProps } from '../../types';
5
+ import { ItemOrderApi, ItemOrderHelpers, WalletApi } from '../api';
6
+ import Colors from '../../constants/colors';
7
+ import { Button, Text, TextInput } from '../../Components';
8
+ import { view_styles } from '../../constants/styles';
9
+
10
+ type DepositCardProps = {
11
+ player:MyPlayerProps,
12
+ wallet_settings:WalletSettingsProps,
13
+ account:AccountProps,
14
+ deposit_limit:PlayerDepositLimitProps,
15
+ onTransact:(draft_order:ItemOrderProps, account_id?:string) => void,
16
+ onCancel:() => void
17
+ }
18
+
19
+ const DepositCard = ({ wallet_settings, account, deposit_limit, onTransact, onCancel }:DepositCardProps) => {
20
+ const [ draft_order, setDraftOrder ] = useState<ItemOrderProps>();
21
+ const [ account_snooze, setAccountSnooze ] = useState<AccountSnoozeProps>();
22
+
23
+ useEffect(() => {
24
+ getItemFromServer()
25
+ },[])
26
+
27
+ const getItemFromServer = async() => {
28
+ const item = await ItemOrderApi.getItemByIdentifier('deposit')
29
+ const as = await WalletApi.getSnoozeByAccountId(account.account_id);
30
+ setAccountSnooze(as)
31
+ setDraftOrder(ItemOrderHelpers.genDepositOrder(item, account))
32
+ }
33
+
34
+ const handleTransact = () => {
35
+ if(!draft_order){ return }
36
+ onTransact({ ...draft_order, total_amount: draft_order.amount as number }, account.account_id)
37
+ }
38
+
39
+ let errors = ItemOrderHelpers.isDepositOrdervalid(account, deposit_limit, wallet_settings, draft_order)
40
+ if(account_snooze?.status == 'active'){ errors.push('This account is currently snoozing and cannot be used to deposit') }
41
+
42
+ if(!draft_order){
43
+ return (
44
+ <View style={{ padding:20 }}>
45
+ <ActivityIndicator style={{ alignSelf:'center' }} size='large' color={Colors.brand.midnight} />
46
+ </View>
47
+ )
48
+ }
49
+
50
+ return (
51
+ <View style={{ flex:1 }}>
52
+ <View nativeID='deposit_rules' style={{ padding:10 }}>
53
+ <Text size={28} textAlign='center' weight='bold' color={Colors.brand.midnight}>Top up your account</Text>
54
+ <Text style={{ marginTop:10 }} size={14} textAlign='center' weight='regular' color={Colors.brand.midnight}>Minumum $25 / Maximum ${ItemOrderHelpers.getDepositAvailable(deposit_limit, account).toFixed(2)}</Text>
55
+ </View>
56
+ <View style={{ flex:1 }}>
57
+ <View nativeID='deposit_amount' style={{ justifyContent:'center', alignItems:'center', padding:20 }}>
58
+ <TextInput
59
+ style={{ flex:1 }}
60
+ placeholder='25'
61
+ placeholderTextColor={Colors.brand.slate}
62
+ value={draft_order.amount as string}
63
+ onChangeText={(text) => setDraftOrder({ ...draft_order, amount:text })}
64
+ />
65
+ </View>
66
+ <View nativeID='instant_available' style={{ backgroundColor:Colors.shades.shade100, padding:10, borderRadius:8 }}>
67
+ <Text size={14} color={Colors.brand.midnight} weight='bold' textAlign='center'>Instant Deposit Available</Text>
68
+ <Text style={{ marginTop:5 }} size={18} color={Colors.brand.midnight} weight='bold' textAlign='center'>${deposit_limit.instant_available.toFixed(2)}</Text>
69
+ <Text style={{ marginTop:5 }} size={12} color={Colors.brand.midnight} weight='regular' textAlign='center'>Instant deposits are immediately available in your BettorEdge wallet</Text>
70
+ <Text style={{ marginTop:5 }} size={12} color={Colors.utility.error} weight='regular' textAlign='center'>All deposits are held for {deposit_limit.hold_days} days before they are eligible for withdraw</Text>
71
+ </View>
72
+ {errors.length > 0 ?
73
+ <View style={{ position:'absolute', bottom:0, left:0, right:0, margin:20, borderRadius:8, padding:20, backgroundColor:Colors.shades.white, ...view_styles.float }}>
74
+ <Text style={{ marginBottom:10 }} size={14} color={Colors.brand.midnight}>Please fix the following before continuing</Text>
75
+ {errors.map(e => {
76
+ return (
77
+ <Text size={14} color={Colors.utility.warning}>{e}</Text>
78
+ )
79
+ })}
80
+ </View>
81
+ :<></>}
82
+ </View>
83
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
84
+ <Button
85
+ style={{ flex:1, marginRight:5, opacity: 1 }}
86
+ title={'CANCEL'}
87
+ title_color={Colors.brand.electric}
88
+ borderWidth={1}
89
+ borderColor={Colors.brand.electric}
90
+ padding={15}
91
+ onPress={() => onCancel()}
92
+ />
93
+ <Button
94
+ style={{ flex:3, opacity: errors.length > 0 ? 0.5: 1 }}
95
+ disabled={errors.length > 0 ? true : false}
96
+ title={'REVIEW DEPOSIT'}
97
+ title_color={Colors.shades.white}
98
+ backgroundColor={Colors.brand.electric}
99
+ padding={15}
100
+ onPress={() => handleTransact()}
101
+ />
102
+ </View>
103
+ </View>
104
+ )
105
+ }
106
+
107
+ export default DepositCard
@@ -0,0 +1,119 @@
1
+ import React, { useState } from 'react';
2
+ import { TouchableOpacity, View, Linking } from "react-native"
3
+ import { Button, Icons, Text } from '../../Components';
4
+ import Colors from '../../constants/colors';
5
+ import { WalletApi } from '../api';
6
+ import type { AccountProps } from '../../types';
7
+
8
+ type LinkAccountManagerProps = {
9
+ ibt_placeholer_account:AccountProps,
10
+ onCancel: () => void
11
+ onComplete: (account_id:string) => void
12
+ }
13
+
14
+ const LinkAccountManager = ({ ibt_placeholer_account, onCancel, onComplete }: LinkAccountManagerProps) => {
15
+ const [ loading, setLoading ] = useState(false);
16
+ const [ try_counter, setTryCounter ] = useState(0);
17
+ const [ linking, setLinking ] = useState(false);
18
+ const [ account, setAccount ] = useState<AccountProps>();
19
+ const [ error, setError ] = useState<string>();
20
+ const [ redirect_url, setRedirectUrl ] = useState<string>();
21
+
22
+
23
+ const handleStartLink = async() => {
24
+ if(loading){ return }//Prevent button mashing
25
+ setLoading(true);
26
+ Linking.addEventListener('url', handler)
27
+ const a = await WalletApi.linkACHAccount(ibt_placeholer_account.account_id)
28
+ setAccount(a);
29
+ if(a.status != 'redirect' || !a.redirect_url){ setError('Unable to process') }
30
+ else { setRedirectUrl(a.redirect_url) }
31
+ setLoading(false);
32
+ }
33
+
34
+ const handler = (ev:any) => {
35
+ console.log(ev)
36
+ }
37
+
38
+ const tryGetAccount = async() => {
39
+ if(!account){ return }
40
+ if(try_counter > 60){ return } //Stop trying after 75 attempts
41
+ const a = await WalletApi.getAccountById(account.account_id)
42
+ setTryCounter(try_counter + 1)
43
+ setAccount(a);
44
+ if(a.status == 'redirect'){
45
+ setTimeout(() => {
46
+ console.log('trying again!')
47
+ tryGetAccount()
48
+ }, 4000);
49
+ } else {
50
+ setTryCounter(0);
51
+ onComplete(a.account_id)
52
+ }
53
+ }
54
+
55
+ const handleNavOut = async() => {
56
+ if(!redirect_url){ return }
57
+ setLinking(true);
58
+ Linking.openURL(redirect_url)
59
+ setTimeout(() => {
60
+ tryGetAccount()
61
+ }, 18000);
62
+ }
63
+
64
+ return (
65
+ <View style={{ flex:1 }}>
66
+ <View style={{ padding:20 }}>
67
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>LINK NEW ACCOUNT</Text>
68
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Link an account via instant bank transfer and get access to instant deposits and withdraws.</Text>
69
+ </View>
70
+ <View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
71
+ <Icons.IBTFLowIcon size={350} />
72
+ <View style={{backgroundColor:Colors.shades.shade100, padding:20, marginTop:20}}>
73
+ <Text size={16} color={Colors.brand.cobalt} weight='light' textAlign='center' style={{marginBottom:2}}>Using <TouchableOpacity onPress={() => window.open('https://plaid.com/safety', '_blank')}><Text weight='bold' color={Colors.brand.electric} size={18}>Plaid</Text></TouchableOpacity>, you will be asked to securly login to your bank and select the account you wish to link and transact from.</Text>
74
+ </View>
75
+ </View>
76
+
77
+ {error?
78
+ <Text size={14} color={Colors.utility.warning}>{error}</Text>
79
+ :<></>}
80
+ {!account || account.status == 'redirect' ?
81
+ <View nativeID='link_actions' style={{ flexDirection:'row', padding:20 }}>
82
+ <Button
83
+ title='CLOSE'
84
+ style={{ flex:1, marginRight:5 }}
85
+ title_color={Colors.brand.electric}
86
+ borderWidth={1}
87
+ borderColor={Colors.brand.electric}
88
+ onPress={() => onCancel()}
89
+ />
90
+ {!redirect_url ?
91
+ <Button
92
+ style={{ flex:3, opacity:loading?0.5:1 }}
93
+ disabled={loading}
94
+ title='START ACCOUNT LINK'
95
+ loading={loading}
96
+ title_color={Colors.shades.white}
97
+ backgroundColor={Colors.brand.electric}
98
+ padding={15}
99
+ onPress={() => handleStartLink()}
100
+ />
101
+ :
102
+ <Button
103
+ style={{ flex:3, opacity:linking?0.5:1 }}
104
+ disabled={linking}
105
+ title='FINISH WITH PLAID'
106
+ loading={linking}
107
+ title_color={Colors.shades.white}
108
+ backgroundColor={Colors.utility.success}
109
+ padding={15}
110
+ onPress={() => handleNavOut()}
111
+ />
112
+ }
113
+ </View>
114
+ :<></>}
115
+ </View>
116
+ )
117
+ }
118
+
119
+ export default LinkAccountManager
@@ -0,0 +1,146 @@
1
+ import React, { useState } from 'react';
2
+ import { View, TouchableOpacity, FlatList } from "react-native";
3
+ import type { AccountActionProps, AccountProps, ItemOrderProps, PlayerDepositLimitProps, PlayerWithdrawLimitProps, WalletSettingsProps } from '../../types';
4
+ import { Button, Icons, Text } from '../../Components';
5
+ import Colors from '../../constants/colors';
6
+ import { view_styles } from '../../constants/styles';
7
+ import { WalletHelpers } from '../api';
8
+ import DepositCard from './DepositCard';
9
+ import type { MyPlayerProps, PlayerBalanceProps } from '../../ProfileManager/api/types';
10
+ import WithdrawCard from './WithdrawCard';
11
+ import AccountLimitManager from './AccountLimitManager';
12
+ import AccountSnoozeManager from './AccountSnoozeManager';
13
+ import RemoveAccountCard from './RemoveAccount';
14
+
15
+ type ManageAccountCardProps = {
16
+ player:MyPlayerProps,
17
+ wallet_settings:WalletSettingsProps,
18
+ player_balance:PlayerBalanceProps,
19
+ account:AccountProps,
20
+ deposit_limit:PlayerDepositLimitProps,
21
+ withdraw_limit:PlayerWithdrawLimitProps,
22
+ onClose:() => void,
23
+ onAccountUpdate:(acct:AccountProps) => void,
24
+ onTransact:(draft_order:ItemOrderProps, account_id?:string) => void
25
+ }
26
+
27
+ const ManageAccountCard = ({ player, wallet_settings, player_balance, account, deposit_limit, withdraw_limit, onAccountUpdate, onTransact, onClose }:ManageAccountCardProps) => {
28
+ const [ active_action, setActiveAction ] = useState('select');
29
+
30
+ const account_actions = WalletHelpers.getAccountOptions(account)
31
+
32
+ const renderIcon = (action:AccountActionProps) => {
33
+ switch(action.action_type){
34
+ case 'deposit':
35
+ return <Icons.DepositIcon color={Colors.shades.white} size={20} />
36
+ case 'withdraw':
37
+ return <Icons.WithdrawIcon color={Colors.shades.white} size={20} />
38
+ case 'limits':
39
+ return <Icons.BankIcon color={Colors.shades.white} size={28}/>
40
+ case 'snoozes':
41
+ return <Icons.SnoozeIcon color={Colors.shades.white} size={18} />
42
+ case 'remove':
43
+ return <Icons.CloseIcon color={Colors.shades.white} size={14} />
44
+ default: return <></>
45
+ }
46
+ }
47
+
48
+ const renderAccountActions = (data: { item:AccountActionProps, index:number }) => {
49
+ if(!account){ return <></> }
50
+ if(account.ibt_placeholder && !['deposit'].includes(data.item.action_type)){ return <></> }
51
+ if(data.item.action_type == 'withdraw' && account.account_type == 'paypal'){ return <></> }
52
+ if(data.item.action_type == 'remove' && account.ibt_placeholder){ return <></> }
53
+ if(data.item.action_type == 'withdraw' && account.account_type == 'card'){ return <></> }
54
+ if(data.item.action_type == 'remove' && account.account_type === 'paypal'){ return <></> }
55
+
56
+ //if(data.item.action_type == 'deposit' && account.account_type == 'card' && account?.card_detail?.card_type != 'debit'){ return <></> }
57
+ return (
58
+ <TouchableOpacity style={{ flex:1, minHeight:80, margin:8, backgroundColor:Colors.shades.white, borderRadius:8, ...view_styles.float, padding:10 }} onPress={() => setActiveAction(data.item.action_type)}>
59
+ <View style={{flex:1, flexDirection:'row', alignItems:'center'}}>
60
+ <View style={{height:36, width:36, backgroundColor:Colors.brand.electric, justifyContent:'center', alignItems:'center', borderRadius:3.6 }}>
61
+ {renderIcon(data.item)}
62
+ </View>
63
+ <View style={{marginLeft:16, marginRight:10, flex:1, padding:2}}>
64
+ <Text size={14} weight='bold' color={Colors.brand.cobalt}>{data.item.action_title}</Text>
65
+ <Text style={{ marginTop:2 }} size={12} weight='regular' color={Colors.brand.cobalt}>{data.item.action_description}</Text>
66
+ </View>
67
+ <Icons.ChevronIcon direction='right' color={Colors.brand.cobalt} size={12} />
68
+ </View>
69
+ </TouchableOpacity>
70
+ )
71
+ }
72
+
73
+ return (
74
+ <View style={{ flex:1 }}>
75
+ <View style={{ padding:20 }}>
76
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>{account.account_label}</Text>
77
+ {active_action == 'select' ?
78
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Below are the available actions that can be performed on this account!</Text>
79
+ :<></>}
80
+ </View>
81
+ <View style={{ flex:1 }}>
82
+
83
+ {active_action == 'select' ?
84
+ <View style={{flex:1}}>
85
+ <View style={{flex:1, padding:20}}>
86
+ <FlatList data={account_actions} renderItem={renderAccountActions} />
87
+ </View>
88
+ <View style={{ padding:20 }}>
89
+ <Button
90
+ title='BACK'
91
+ padding={15}
92
+ borderWidth={1}
93
+ borderColor={Colors.brand.electric}
94
+ title_color={Colors.brand.electric}
95
+ onPress={() => onClose()}
96
+ />
97
+ </View>
98
+ </View>
99
+ :active_action == 'deposit' ?
100
+ <DepositCard
101
+ player={player}
102
+ wallet_settings={wallet_settings}
103
+ account={account}
104
+ deposit_limit={deposit_limit}
105
+ onTransact={onTransact}
106
+ onCancel={() => setActiveAction('select')}
107
+ />
108
+ :active_action == 'withdraw'?
109
+ <WithdrawCard
110
+ player={player}
111
+ deposit_limit={deposit_limit}
112
+ wallet_settings={wallet_settings}
113
+ player_balance={player_balance}
114
+ account={account}
115
+ withdraw_limit={withdraw_limit}
116
+ onTransact={onTransact}
117
+ onCancel={() => setActiveAction('select')}
118
+ />
119
+ :active_action == 'limits'?
120
+ <AccountLimitManager
121
+ account={account}
122
+ onCancel={() => setActiveAction('select')}
123
+ onSetLimit={(al) => console.log(al)}
124
+ />
125
+ :active_action == 'snoozes'?
126
+ <AccountSnoozeManager
127
+ account={account}
128
+ onCancel={() => setActiveAction('select')}
129
+ onSnooze={(snz) => console.log(snz)}
130
+ />
131
+ :active_action == 'remove'?
132
+ <RemoveAccountCard
133
+ account={account}
134
+ onCancel={() => setActiveAction('select')}
135
+ onRemove={(acct) => {
136
+ onAccountUpdate(acct)
137
+ onClose()
138
+ }}
139
+ />
140
+ :<></>}
141
+ </View>
142
+ </View>
143
+ )
144
+ }
145
+
146
+ export default ManageAccountCard