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,164 @@
1
+ import React, { useState } from 'react';
2
+ import { View, TouchableOpacity } from "react-native";
3
+ import { Button, Checkbox, Text, TextInput } from '../../Components';
4
+ import type { MyPlayerProps } from '../../ProfileManager/api/types';
5
+ import Colors from '../../constants/colors';
6
+ import { WalletApi, WalletHelpers } from '../api';
7
+ import type { AccountProps } from '../../types';
8
+ const validator = require('us-bank-account-validator');
9
+
10
+ type ManualACHAddProps = {
11
+ player:MyPlayerProps,
12
+ onAddAccount:(account:AccountProps) => void,
13
+ onCancel:() => void
14
+ }
15
+ const ManualACHAdd = ({ player, onAddAccount, onCancel }:ManualACHAddProps) => {
16
+ const [ loading, setLoading ] = useState(false);
17
+ const [ error, setError ] = useState<string>();
18
+ const [ ach_account, setACHAccount ] = useState({
19
+ account: WalletHelpers.getEmptyACHAccount(),
20
+ ach_details: WalletHelpers.getEmptyACHDetail()
21
+ })
22
+ const [ disclaimer, setDisclaimer ] = useState(false);
23
+
24
+ const { account, ach_details } = ach_account;
25
+ const bank_valid = ach_details.bank_name ? true : false;
26
+ const routing_valid = validator.routingNumber(ach_details.routing_number);
27
+ const account_valid = validator.accountNumber(ach_details.account_number);
28
+ const valid = bank_valid && routing_valid && account_valid && disclaimer ? true : false
29
+
30
+ const handleAddAccount = async() => {
31
+ if(!valid || loading){ return }
32
+ setLoading(true);
33
+ try {
34
+ const resp = await WalletApi.addACHAccount(account, ach_details)
35
+ setACHAccount({ account: resp.account, ach_details: resp.ach_detail })
36
+ onAddAccount({ ...resp.account, ach_detail: resp.ach_detail })
37
+ } catch (e) {
38
+ setError('Sorry, we were not able to add this account. Please try again later.')
39
+ }
40
+
41
+ setLoading(false);
42
+ }
43
+
44
+ return (
45
+ <View style={{ flex:1 }}>
46
+ <View style={{ padding:20 }}>
47
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>MANUAL ACH ACCOUNT</Text>
48
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Complete the form below to add a new ACH account. Once submitted, we will send 2 small deposits to the account to confirm ownership. This process can take up to 3 business days.</Text>
49
+ </View>
50
+ <View style={{ flex:1, padding:20 }}>
51
+ <View style={{ marginTop:10 }}>
52
+ <Text size={14} color={Colors.brand.midnight} weight='semibold'>Name on account</Text>
53
+ <TextInput
54
+ style={{ marginTop:10 }}
55
+ value={`${player.first_name} ${player.last_name}`}
56
+ editable={false}
57
+ onChangeText={() => console.log('ehy')}
58
+ />
59
+ </View>
60
+ <View style={{ marginTop: 16 }}>
61
+ <Text size={14} color={Colors.brand.midnight} weight='semibold'>Bank Name</Text>
62
+ <TextInput
63
+ style={{ marginTop:10 }}
64
+ keyboardType='default'
65
+ placeholderTextColor={Colors.shades.shade600}
66
+ placeholder={'Bank Name'}
67
+ value={ach_details.bank_name}
68
+ autoFocus={true}
69
+ onChangeText={(e) => setACHAccount({ ...ach_account, ach_details: { ...ach_details, bank_name: e } })}
70
+ />
71
+ {!bank_valid ?
72
+ <Text style={{ marginTop:5 }} size={14} color={Colors.utility.warning}>Bank Name Is Not Valid</Text>
73
+ :<></>}
74
+ </View>
75
+ <View style={{ marginTop: 16 }}>
76
+ <Text size={14} color={Colors.brand.midnight} weight='semibold'>Routing Number</Text>
77
+ <TextInput
78
+ style={{ marginTop:10 }}
79
+ placeholderTextColor={Colors.shades.shade600}
80
+ keyboardType='number-pad'
81
+ placeholder={'xxxxxx911'}
82
+ value={ach_details.routing_number}
83
+ onChangeText={(e) => setACHAccount({ ...ach_account, ach_details: { ...ach_details, routing_number: e } })}
84
+ />
85
+ {!routing_valid.isValid ?
86
+ <Text style={{ marginTop:5 }} size={14} color={Colors.utility.warning}>Routing Number Is Not Valid</Text>
87
+ :<></>}
88
+ </View>
89
+ <View style={{ marginTop:16 }}>
90
+ <Text size={14} color={Colors.brand.midnight} weight='semibold'>Account Number</Text>
91
+ <TextInput
92
+ style={{ marginTop:10 }}
93
+ placeholderTextColor={Colors.shades.shade600}
94
+ keyboardType='number-pad'
95
+ value={ach_details.account_number}
96
+ placeholder={'xxxxxxxxx0000'}
97
+ onChangeText={(e) => setACHAccount({ ...ach_account, ach_details: { ...ach_details, account_number: e } })}
98
+ />
99
+ {!account_valid.isValid ?
100
+ <Text style={{ marginTop:5 }} size={14} color={Colors.utility.warning}>Account Number Is Not Valid</Text>
101
+ :<></>}
102
+ </View>
103
+ </View>
104
+ <View>
105
+ <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', paddingLeft:20, paddingRight:20 }} onPress={() => setDisclaimer(!disclaimer)}>
106
+ <Checkbox size={30} checked={disclaimer} disabled onSelect={() => console.log('')}/>
107
+ <Text style={{ marginLeft:10 }} size={14} color={Colors.brand.midnight}>I understand that by continuing, we will send 2 small deposits to this bank account to confirm ownership. Once received, I will enter the amounts here.</Text>
108
+ </TouchableOpacity>
109
+ </View>
110
+ {error?
111
+ <View style={{ padding:10 }}>
112
+ <Text size={16} color={Colors.utility.warning} textAlign='center' weight='semibold'>{error}</Text>
113
+ </View>
114
+ :<></>}
115
+ {account.status == 'pending' ?
116
+ <View style={{ flexDirection:'row', padding:20 }}>
117
+ <Button
118
+ title='CANCEL'
119
+ style={{ flex:1, marginRight:5, opacity:loading?0.5:1 }}
120
+ disabled={loading}
121
+ title_color={Colors.brand.electric}
122
+ padding={15}
123
+ borderWidth={1}
124
+ borderColor={Colors.brand.electric}
125
+ onPress={() => onCancel()}
126
+ />
127
+ <Button
128
+ title='ADD ACCOUNT'
129
+ style={{ flex:3, opacity:valid&&!loading&&!error?1:0.5 }}
130
+ disabled={!valid || loading || error?true:false}
131
+ loading={loading}
132
+ title_color={Colors.shades.white}
133
+ padding={15}
134
+ backgroundColor={Colors.utility.success}
135
+ onPress={() => handleAddAccount()}
136
+ />
137
+ </View>
138
+ : account.status == 'verify' ?
139
+ <View style={{ flexDirection:'row', padding:20 }}>
140
+ <Button
141
+ title='CLOSE'
142
+ style={{ flex:1, marginRight:5 }}
143
+ title_color={Colors.brand.electric}
144
+ padding={15}
145
+ borderWidth={1}
146
+ borderColor={Colors.brand.electric}
147
+ onPress={() => onCancel()}
148
+ />
149
+ <Button
150
+ title='VERIFY TRANSACTIONS SENT'
151
+ style={{ flex:3 }}
152
+ disabled
153
+ title_color={Colors.shades.white}
154
+ backgroundColor={Colors.brand.slate}
155
+ padding={15}
156
+ onPress={() => console.log('')}
157
+ />
158
+ </View>
159
+ :<></>}
160
+ </View>
161
+ )
162
+ }
163
+
164
+ export default ManualACHAdd
@@ -0,0 +1,185 @@
1
+ import React, { useState } from 'react';
2
+ import { View, StyleSheet } from "react-native";
3
+ import type { MyPlayerProps } from '../../ProfileManager/api/types';
4
+ import { WalletApi, WalletHelpers } from '../api';
5
+ import { Button, Icons, Text, TextInput } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+ import type { AccountProps } from '../../types';
8
+ import moment from 'moment-mini';
9
+
10
+ type ManualCardAddProps = {
11
+ player:MyPlayerProps,
12
+ onAddAccount:(acct:AccountProps) => void,
13
+ onCancel:() => void
14
+ }
15
+
16
+ const ManualCardAdd = ({ player, onAddAccount, onCancel }:ManualCardAddProps) => {
17
+ const [ loading, setLoading ] = useState(false);
18
+ const [ error, setError ] = useState<string>();
19
+ const [ card_account, setCardAccount ] = useState({
20
+ account: WalletHelpers.getEmptyCardAccount(),
21
+ card_detail: { ...WalletHelpers.getEmptyCardDetails(), first_name: player.first_name, last_name: player.last_name }
22
+ })
23
+
24
+
25
+ const { account, card_detail } = card_account;
26
+ const { valid, card_number, first_name, last_name, expiration_date } = WalletHelpers.isCardValid(card_detail);
27
+
28
+ const handleExpiry = (text:string) => {
29
+ setCardAccount({ ...card_account, card_detail: { ...card_detail, expiration_date: text } })
30
+ }
31
+
32
+ const handleCardNumber = (text:string) => {
33
+ let unformated_number = WalletHelpers.unformatCardNumber(text)
34
+ setCardAccount({ ...card_account, card_detail: { ...card_detail, card_number: unformated_number, card_brand: WalletHelpers.getCardBrandFromNumber(text) } })
35
+ }
36
+
37
+ const handleSaveCard = async() => {
38
+ if(!valid || loading){ return }
39
+ setLoading(true);
40
+ try {
41
+ const resp = await WalletApi.addCardAccount(account, { ...card_detail, expiration_date: moment(card_detail.expiration_date, 'MM/YYYY') })
42
+ //setCardAccount(resp)
43
+ onAddAccount({ ...resp.account, card_detail: resp.card_detail })
44
+ setError(undefined)
45
+ } catch (e) {
46
+ setError('Invalid card. Please try again')
47
+ }
48
+ setLoading(false)
49
+ }
50
+
51
+ const renderCardIcon = (brand?:string) => {
52
+ switch(brand){
53
+ case 'AMEX':
54
+ return <Icons.AmexCardIcon size={30} />
55
+ case 'VISA':
56
+ return <Icons.VisaCardIcon size={30} />
57
+ case 'MASTERCARD':
58
+ return <Icons.MasterCardIcon size={30} />
59
+ case 'DISCOVER':
60
+ return <Icons.DiscoverCardIcon size={30} />
61
+ default:
62
+ return <Icons.CreditCardIcon size={22} color={Colors.brand.midnight}/>
63
+ }
64
+ }
65
+
66
+ return (
67
+ <View style={{ flex:1 }}>
68
+ <View style={{ padding:20 }}>
69
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>NEW CARD ACCOUNT</Text>
70
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Complete the form below to add a new card account. Once submitted and approve, you can transact immediately.</Text>
71
+ </View>
72
+ <View style={{ flex:1, padding:10, margin:10 }}>
73
+ <View nativeID='cc_input' style={{ marginTop:10 }}>
74
+ <View nativeID='card_number' style={{ padding:5 }}>
75
+ <View style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
76
+ <Text style={{flex:1}} size={14} color={Colors.brand.midnight} weight='semibold'>Card Number</Text>
77
+ <View style={{ flexDirection:'row', alignItems:'center' }}>
78
+ <View style={local_styles.inactive_brand}>
79
+ <Icons.CreditCardIcon size={24} color={Colors.brand.midnight}/>
80
+ </View>
81
+ <View style={card_detail.card_brand == 'VISA' ? local_styles.active_brand : local_styles.inactive_brand}>
82
+ <Icons.VisaCardIcon size={30} />
83
+ </View>
84
+ <View style={card_detail.card_brand == 'MASTERCARD' ? local_styles.active_brand : local_styles.inactive_brand}>
85
+ <Icons.MasterCardIcon size={30} />
86
+ </View>
87
+ <View style={card_detail.card_brand == 'AMEX' ? local_styles.active_brand : local_styles.inactive_brand}>
88
+ <Icons.AmexCardIcon size={30} />
89
+ </View>
90
+ <View style={card_detail.card_brand == 'DISCOVER' ? local_styles.active_brand : local_styles.inactive_brand}>
91
+ <Icons.DiscoverCardIcon size={30} />
92
+ </View>
93
+
94
+ </View>
95
+ </View>
96
+ <View style={{ flexDirection:'row', borderRadius:22, backgroundColor:Colors.shades.white }}>
97
+ <View style={{ justifyContent:'center', alignItems:'center', paddingLeft:10, paddingRight:10 }}>
98
+ {renderCardIcon(card_detail.card_brand)}
99
+ </View>
100
+ <TextInput
101
+ style={{ borderWidth:0, padding:15, flex:1 }}
102
+ placeholder='1234 5678 9876 5432'
103
+ placeholderTextColor={Colors.shades.shade600}
104
+ value={WalletHelpers.formatCardNumber(card_detail.card_number)}
105
+ onChangeText={(e) => handleCardNumber(e)}
106
+ />
107
+ </View>
108
+ </View>
109
+ {card_detail.card_number && !card_number ?
110
+ <Text size={14} color={Colors.utility.warning} weight='semibold'>Card number is not valid</Text>
111
+ :<></>}
112
+ <View nativeID='first_name' style={{ padding:5 }}>
113
+ <Text style={{ padding:10 }} size={14} color={Colors.brand.midnight} weight='semibold'>First Name</Text>
114
+ <TextInput
115
+ placeholder='Jonathan'
116
+ placeholderTextColor={Colors.shades.shade600}
117
+ value={card_detail.first_name}
118
+ onChangeText={(e) => setCardAccount({ ...card_account, card_detail: { ...card_detail, first_name: e } })}
119
+ />
120
+ </View>
121
+ {!first_name ?
122
+ <Text size={14} color={Colors.utility.warning} weight='semibold'>First name is not valid</Text>
123
+ :<></>}
124
+ <View nativeID='last_name' style={{ padding:5 }}>
125
+ <Text size={14} color={Colors.brand.midnight} weight='semibold' style={{ padding:10 }}>Last Name</Text>
126
+ <TextInput
127
+ placeholder='Smith'
128
+ placeholderTextColor={Colors.shades.shade600}
129
+ value={card_detail.last_name}
130
+ onChangeText={(e) => setCardAccount({ ...card_account, card_detail: { ...card_detail, last_name: e } })}
131
+ />
132
+ </View>
133
+ {!last_name ?
134
+ <Text size={14} color={Colors.utility.warning} weight='semibold'>Last name is not valid</Text>
135
+ :<></>}
136
+ <View nativeID='expiration_date' style={{ padding:5 }}>
137
+ <Text size={14} color={Colors.brand.midnight} weight='semibold' style={{ padding:10 }}>Expiration Date (MM/YYYY)</Text>
138
+ <TextInput
139
+ value={card_detail.expiration_date}
140
+ placeholder={'MM/YYYY'}
141
+ placeholderTextColor={Colors.shades.shade600}
142
+ onChangeText={(e) => handleExpiry(e)}
143
+ />
144
+ </View>
145
+ {card_detail.expiration_date && !expiration_date ?
146
+ <Text size={14} color={Colors.utility.warning} weight='semibold'>Expiration date is not valid</Text>
147
+ :<></>}
148
+ </View>
149
+ </View>
150
+ {error ?
151
+ <View style={{ padding:10 }}>
152
+ <Text size={16} color={Colors.utility.warning} weight='bold' textAlign='center'>{error}</Text>
153
+ </View>
154
+ :<></>}
155
+ <View style={{ flexDirection:'row', padding:20 }}>
156
+ <Button
157
+ title='CANCEL'
158
+ style={{ flex:1, marginRight:5 }}
159
+ title_color={Colors.brand.electric}
160
+ padding={15}
161
+ borderWidth={1}
162
+ borderColor={Colors.brand.electric}
163
+ onPress={() => onCancel()}
164
+ />
165
+ <Button
166
+ title='ADD ACCOUNT'
167
+ style={{ flex:3, opacity:valid?1:0.5 }}
168
+ disabled={!valid}
169
+ loading={loading}
170
+ title_color={Colors.shades.white}
171
+ padding={15}
172
+ backgroundColor={Colors.utility.success}
173
+ onPress={() => handleSaveCard()}
174
+ />
175
+ </View>
176
+ </View>
177
+ )
178
+ }
179
+
180
+ const local_styles = StyleSheet.create({
181
+ active_brand: { borderRadius:4, padding:3, borderWidth:2, borderColor:Colors.brand.midnight },
182
+ inactive_brand: { padding:3, borderWidth:2, borderColor:'transparent' }
183
+ })
184
+
185
+ export default ManualCardAdd
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import { View, TouchableOpacity } from "react-native"
3
+ import type { MyPlayerProps, PlayerBalanceProps } from '../../ProfileManager/api/types';
4
+ import type { AccountProps } from '../../types';
5
+ import { Button, Icons, Text } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+ import { button_styles } from '../../constants/styles';
8
+
9
+ type MyBalanceProps = {
10
+ player:MyPlayerProps,
11
+ player_balance:PlayerBalanceProps,
12
+ balance_account?:AccountProps,
13
+ walkthrough?:boolean,
14
+ onClose:() => void,
15
+ onNext:() => void
16
+ }
17
+
18
+ const MyBalance = ({ player, balance_account, player_balance, walkthrough, onClose, onNext }:MyBalanceProps) => {
19
+
20
+ console.log(player, player_balance, balance_account)
21
+
22
+
23
+ return (
24
+ <View style={{ flex:1 }}>
25
+ <View style={{ padding:20 }}>
26
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>BettorEdge Balance</Text>
27
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>All order and game activity goes in and out of your BettorEdge balance.</Text>
28
+ </View>
29
+ <View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
30
+ <View>
31
+ <Text size={14} color={Colors.brand.midnight}>Your BettorEdge balance is made up of 3 currencies</Text>
32
+ </View>
33
+ <View>
34
+ <Text>REAL MONEY (USD)</Text>
35
+ </View>
36
+ <View>
37
+ <Text>PROMO</Text>
38
+ </View>
39
+ <View>
40
+ <Text>EDGE COINS</Text>
41
+ </View>
42
+ </View>
43
+ {walkthrough ?
44
+ <View nativeID='action_row' style={{ flexDirection:'row', justifyContent:'space-between', padding:10 }}>
45
+ <Button
46
+ title='EXIT SETUP'
47
+ title_color={Colors.utility.error}
48
+ backgroundColor='transparent'
49
+ onPress={() => onClose()}
50
+ />
51
+ <TouchableOpacity
52
+ style={button_styles.wizard_valid}
53
+ onPress={() => onNext()}
54
+ //disabled={loading}
55
+ >
56
+ <Icons.ChevronIcon size={20} direction='right' color={Colors.brand.midnight}/>
57
+ </TouchableOpacity>
58
+ </View>
59
+ :<></>}
60
+ </View>
61
+ )
62
+ }
63
+
64
+ export default MyBalance
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import { PayPalButtons } from "@paypal/react-paypal-js";
3
+ import { View } from "react-native";
4
+ import type { AccountProps, ItemOrderProps, ItemProps, TransactionProps } from '../../types';
5
+ import { CheckoutApi, CheckoutHelpers } from '../../Checkout/api';
6
+
7
+ type PayPalOrderCaptureProps = {
8
+ paypal_account:AccountProps,
9
+ items:ItemProps[],
10
+ region?:string,
11
+ coordinates?:any,
12
+ draft_item_order:ItemOrderProps,
13
+ button_height?:number,
14
+ order_valid?:boolean,
15
+ onOrderUpdate:(item_order:ItemOrderProps, transaction:TransactionProps) => void,
16
+ onCancel:() => void
17
+ }
18
+
19
+ const PayPalOrderCapture = ({ draft_item_order, region, coordinates, items, paypal_account, button_height, order_valid, onOrderUpdate, onCancel }:PayPalOrderCaptureProps) => {
20
+
21
+ const createOrder = async() => {
22
+ try {
23
+ const draft_transaction = CheckoutHelpers.genTransactionFromItemOrder(draft_item_order, items, paypal_account?.account_id, coordinates)
24
+ const { transaction } = await CheckoutApi.createOrder({ ...draft_item_order, region, location: coordinates }, draft_transaction)
25
+ return transaction.external_id as string //This should be the paypal order Id
26
+ } catch (e) {
27
+ return ''
28
+ }
29
+ }
30
+
31
+ const onApprove = async(data:any) => {
32
+ const resp = await CheckoutApi.capturePayPalTransaction(data.orderID);
33
+ onOrderUpdate(resp.item_order, resp.transaction)
34
+ }
35
+
36
+ const handleCancel = async(data:any) => {
37
+ await CheckoutApi.cancelTransaction(undefined, data.orderID)
38
+ onCancel()
39
+
40
+ }
41
+
42
+ let height = 55
43
+ if(button_height && button_height > 24 && button_height < 56){ height = button_height }
44
+
45
+ return (
46
+ <View style={{ flex:1 }}>
47
+ <PayPalButtons
48
+ disabled={!order_valid ? true : false}
49
+ style={{ layout: 'horizontal', shape:'pill', height }}
50
+ createOrder={createOrder}
51
+ onError={(e) => console.log(e)}
52
+ onApprove={onApprove}
53
+ onCancel={handleCancel}
54
+ />
55
+ </View>
56
+ )
57
+ }
58
+
59
+ export default PayPalOrderCapture
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { useState } from 'react';
3
+ import { TouchableOpacity, View } from 'react-native';
4
+ import type { AccountProps } from '../../types';
5
+ import { Button, Icons, Text } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+ import { WalletApi } from '../api';
8
+
9
+ type UnlinkAccountCardProps = {
10
+ account:AccountProps,
11
+ onCancel: () => void,
12
+ onRemove: (acct:AccountProps) => void
13
+ }
14
+
15
+ const RemoveAccountCard = ({ account, onCancel, onRemove }:UnlinkAccountCardProps) => {
16
+ const [ loading, setLoading ] = useState(false);
17
+ const [ disclaimer, setDisclaimer ] = useState(false);
18
+
19
+ //Player accounts
20
+ //Filter to ensure only this player and not inactive accounts
21
+
22
+ const handleRemove = async() => {
23
+ if(!account){ return }
24
+ if(loading){ return }
25
+ if(!disclaimer){ return }
26
+ setLoading(true);
27
+ const resp = await WalletApi.removeAccount(account.account_id)
28
+ onRemove(resp.account)
29
+ setLoading(false);
30
+ }
31
+
32
+ return (
33
+ <View style={{ flex:1 }}>
34
+ <View nativeID='snooze_disclaimer' style={{ flex:1, margin:10 }}>
35
+ <TouchableOpacity style={{ flexDirection:'row', padding:5 }} onPress={() => setDisclaimer(!disclaimer)}>
36
+ <View style={{ justifyContent:'center', marginRight:10, alignItems:'center', height:25, width:25, borderRadius:4, backgroundColor: disclaimer ? Colors.brand.midnight : 'transparent', borderWidth:1, borderColor:Colors.brand.midnight }}>
37
+ {disclaimer ?
38
+ <Icons.CheckIcon size={14} color={Colors.shades.white} />
39
+ :<></>}
40
+ </View>
41
+ <Text size={14} color={Colors.brand.midnight} weight='regular'>I confirm my request to remove my account. I understand that this will take up to 24 hours to come into effect. I understand that I will no longer be able to use this account to transact.</Text>
42
+ </TouchableOpacity>
43
+ </View>
44
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
45
+ <Button
46
+ style={{ flex:1, marginRight:5, opacity: 1 }}
47
+ title={'CANCEL'}
48
+ title_color={Colors.shades.white}
49
+ backgroundColor={Colors.brand.electric}
50
+ padding={15}
51
+ onPress={() => onCancel()}
52
+ />
53
+ <Button
54
+ style={{ flex:3, opacity: !disclaimer||loading?0.5:1 }}
55
+ disabled={!disclaimer}
56
+ loading={loading}
57
+ title={'REMOVE ACCOUNT'}
58
+ title_color={Colors.shades.white}
59
+ backgroundColor={Colors.utility.error}
60
+ padding={15}
61
+ onPress={() => handleRemove()}
62
+ />
63
+ </View>
64
+ </View>
65
+ )
66
+ }
67
+
68
+ export default RemoveAccountCard