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,140 @@
1
+ import React, { useState } from 'react';
2
+ import { View } from 'react-native';
3
+ import { Button, Text, TextInput } from '../../Components';
4
+ import Colors from '../../constants/colors';
5
+ import { WalletApi, WalletHelpers } from '../api';
6
+ import moment from 'moment-mini';
7
+ import type { AccountProps } from '../../types';
8
+
9
+ type VerifyACHWidgetProps = {
10
+ account:AccountProps,
11
+ onUpdateAccount:(account:AccountProps) => void,
12
+ onClose: () => void,
13
+ }
14
+
15
+ const VerifyACHAccount = ({ account, onClose, onUpdateAccount }:VerifyACHWidgetProps) => {
16
+ const [ loading, setLoading ] = useState(false);
17
+ const [ verify_amount_1, setVerify1Amount ] = useState('')
18
+ const [ verify_amount_2, setVerify2Amount ] = useState('')
19
+ const [ error, setError ] = useState<string>();
20
+
21
+
22
+ let next_allowed = moment().subtract(1, 'minute')
23
+ if(account?.last_verify_attempt){
24
+ next_allowed = moment(account.last_verify_attempt).add(10, 'minutes');
25
+ }
26
+
27
+ const timedout = moment().isBefore(next_allowed)
28
+ let verify_allowed = verify_amount_1 && verify_amount_2 && !timedout ? true : false
29
+
30
+
31
+ /**
32
+ * Try to verify the account
33
+ * @returns void
34
+ */
35
+ const handleVerify = async() => {
36
+ if(verify_amount_1 == '0' || verify_amount_2 == '0'){ return alert('Please enter verification amounts') }
37
+ if(account.status != 'verify'){ return } //Dont do anything
38
+ if(!verify_allowed){ return }
39
+ if(!WalletHelpers.isNumber(verify_amount_1)){ return alert('Amount 1 is not a valid number') }
40
+ if(!WalletHelpers.isNumber(verify_amount_2)){ return alert('Amount 2 is not a valid number') }
41
+ let amount_1 = parseFloat(verify_amount_1)
42
+ let amount_2 = parseFloat(verify_amount_2)
43
+ setLoading(true);
44
+ const resp = await WalletApi.verifyACHAccount(account.account_id, amount_1, amount_2);
45
+ if(resp.status == 'fail'){
46
+ setError('Entered amounts are invalid')
47
+ }
48
+ onUpdateAccount(resp.account)
49
+ setLoading(false);
50
+
51
+ }
52
+
53
+
54
+ if(!account){ return <></> }
55
+
56
+ return (
57
+ <View style={{ flex:1 }}>
58
+ <View style={{ padding:20 }}>
59
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>VERIFY ACCOUNT</Text>
60
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Verify this account by entering the two deposit amounts received from Bettoredge when setting up the account.</Text>
61
+ </View>
62
+ <View nativeID='verify_inputs' style={{ flex:1, margin:20 }}>
63
+ <View style={{marginTop:30}}>
64
+ <Text textAlign='center' size={16} color={Colors.brand.midnight} weight='semibold'>Deposit 1</Text>
65
+ <TextInput
66
+ style={{ marginTop:5 }}
67
+ value={verify_amount_1}
68
+ editable={account.status == 'verify' ? true : false}
69
+ placeholderTextColor={Colors.brand.slate}
70
+ keyboardType='decimal-pad'
71
+ placeholder='0.00'
72
+ onChangeText={(e) => setVerify1Amount(e)}
73
+ />
74
+ </View>
75
+ <View style={{marginTop:20}}>
76
+ <Text textAlign='center' size={16} color={Colors.brand.midnight} weight='semibold'>Deposit 2</Text>
77
+ <TextInput
78
+ style={{ marginTop:5 }}
79
+ editable={account.status == 'verify' ? true : false}
80
+ value={verify_amount_2}
81
+ placeholderTextColor={Colors.brand.slate}
82
+ keyboardType='decimal-pad'
83
+ placeholder='0.00'
84
+ onChangeText={(e) => setVerify2Amount(e)}
85
+ />
86
+ </View>
87
+ {error ?
88
+ <Text style={{ marginTop:10 }} textAlign='center' size={14} color={Colors.utility.warning} weight='bold'>{error}</Text>
89
+ :<></>}
90
+
91
+ </View>
92
+ {account.status == 'verify' ?
93
+ <View nativeID='verify_actions' style={{ flexDirection:'row', padding:20 }}>
94
+ <Button
95
+ style={{ flex:1, marginRight:5 }}
96
+ title='CANCEL'
97
+ title_color={Colors.brand.electric}
98
+ padding={15}
99
+ borderWidth={1}
100
+ borderColor={Colors.brand.electric}
101
+ onPress={() => onClose()}
102
+ />
103
+ <Button
104
+ style={{ flex:3, opacity:verify_allowed?1:0.5 }}
105
+ disabled={!verify_allowed}
106
+ loading={loading}
107
+ title={timedout?`Try Again ${moment(next_allowed).fromNow()}`:'VERIFY ACCOUNT'}
108
+ title_color={Colors.shades.white}
109
+ backgroundColor={Colors.utility.success}
110
+ padding={15}
111
+ onPress={() => handleVerify()}
112
+ />
113
+ </View>
114
+ :
115
+ <View nativeID='verify_actions' style={{ flexDirection:'row', padding:20 }}>
116
+ <Button
117
+ style={{ flex:1, marginRight:5 }}
118
+ title='CLOSE'
119
+ title_color={Colors.brand.electric}
120
+ padding={15}
121
+ borderWidth={1}
122
+ borderColor={Colors.brand.electric}
123
+ onPress={() => onClose()}
124
+ />
125
+ <Button
126
+ style={{ flex:3, opacity:0.5 }}
127
+ title='ACCOUNT VERIFIED!'
128
+ title_color={Colors.shades.white}
129
+ title_weight='bold'
130
+ padding={15}
131
+ backgroundColor={Colors.utility.success}
132
+ onPress={() => onClose()}
133
+ />
134
+ </View>
135
+ }
136
+ </View>
137
+ )
138
+ }
139
+
140
+ export default VerifyACHAccount
@@ -0,0 +1,197 @@
1
+ import React, { useState } from 'react';
2
+ import { View, Image, TouchableOpacity, Linking } from "react-native";
3
+ import type { WalletSettingsProps } from '../../types';
4
+ import { Button, Checkbox, Text, TextInput } from '../../Components';
5
+ import Colors from '../../constants/colors';
6
+ import type { MyPlayerProps } from '../../ProfileManager/api/types';
7
+ import { WalletApi } from '../api';
8
+ import moment from 'moment-mini';
9
+
10
+ type WalletSetupProps = {
11
+ player: MyPlayerProps,
12
+ wallet_settings: WalletSettingsProps,
13
+ onSettingsUpdate:(ws:WalletSettingsProps) => void,
14
+ }
15
+
16
+ const WalletSetup = ({ wallet_settings, onSettingsUpdate }:WalletSetupProps) => {
17
+ const [ terms_agreed, setTermsAgreed ] = useState(false);
18
+ const [ auth_error, setAuthError ] = useState<string>();
19
+ const [ pin_view, setPinView ] = useState<'set'|'confirm'>('set');
20
+ const [ pin_settings, setPinSettings ] = useState({
21
+ pin: '',
22
+ confirm_pin:''
23
+ })
24
+ const { pin, confirm_pin } = pin_settings;
25
+
26
+ const pin_valid = pin.length >= 4 ? true:false;
27
+ const go_valid = pin_valid && confirm_pin == pin ? true : false;
28
+ console.log(pin_valid)
29
+ const handleAgreeTerms = async() => {
30
+ const ws = await WalletApi.agreeToTerms()
31
+ onSettingsUpdate(ws)
32
+ }
33
+
34
+ const handleSetPin = async() => {
35
+ if(!pin_valid || !go_valid){ return }
36
+ const ws = await WalletApi.setPin(pin)
37
+ onSettingsUpdate(ws);
38
+ }
39
+
40
+ const handleAuthPin = async() => {
41
+ if(!pin_valid){ return }
42
+ try {
43
+ const ws = await WalletApi.authenticatePin(pin);
44
+ onSettingsUpdate(ws);
45
+ } catch (e) {
46
+ setAuthError('Invalid Pin - Please try again')
47
+ }
48
+ }
49
+
50
+ const auth_required = wallet_settings.auth_end_datetime && moment().isAfter(wallet_settings.auth_end_datetime) ? true : false
51
+
52
+ return (
53
+ <View style={{ flex:1 }}>
54
+ <View style={{ padding:20 }}>
55
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>My Wallet!</Text>
56
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Welcome to your wallet. Go through the wizard to get set up to deposit and withdraw!</Text>
57
+ </View>
58
+ {!wallet_settings.agreed_to_terms ?
59
+ <View style={{ flex:1, padding:20 }}>
60
+ <View>
61
+ <Text size={20} color={Colors.brand.slate} weight='semibold' textAlign='center'>BettorEdge Wallet</Text>
62
+ <Text style={{ marginTop:5 }} size={26} color={Colors.brand.midnight} weight='bold' textAlign='center'>Terms and Conditions</Text>
63
+ </View>
64
+ <View style={{ justifyContent:'center', alignItems:'center' }}>
65
+ <Image
66
+ source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1717098691/Signing_the_contract_stfvtj.png' }}
67
+ style={{ width: 250, height:250 }}
68
+ resizeMode='cover'
69
+ />
70
+
71
+ </View>
72
+ <TouchableOpacity onPress={() => Linking.openURL('https://www.bettoredge.com/wallet-terms-of-use')}>
73
+ <Text size={14} color={Colors.brand.midnight} textAlign='center'>Press here to review our <Text size={14} color={Colors.brand.electric} weight='bold'>Wallet Terms of Use</Text>. To continue setting up your wallet please review and agree to the terms.</Text>
74
+ </TouchableOpacity>
75
+ <TouchableOpacity
76
+ style={{ marginTop:15, flexDirection:'row', alignItems:'center', backgroundColor:Colors.highlights.highlight400Faded, padding:20, borderRadius:8 }}
77
+ onPress={() => setTermsAgreed(!terms_agreed)}>
78
+ <Text style={{ flex:1 }} size={16} color={Colors.brand.midnight}>I have read and agree to the terms</Text>
79
+ <Checkbox size={30} checked={terms_agreed} disabled onSelect={() => console.log('')}/>
80
+ </TouchableOpacity>
81
+ </View>
82
+ : !wallet_settings.pin ?
83
+ <View style={{ flex:1, padding:20 }}>
84
+ <View>
85
+ <Text size={20} color={Colors.brand.slate} weight='semibold' textAlign='center'>BettorEdge Wallet</Text>
86
+ <Text style={{ marginTop:5 }} size={26} color={Colors.brand.midnight} weight='bold' textAlign='center'>{pin_view == 'set' ? 'Set' : 'Confirm'} Security PIN</Text>
87
+ </View>
88
+ <View style={{ justifyContent:'center', alignItems:'center' }}>
89
+ <Image
90
+ source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1717099686/Secure_lock_and_key_successfully_unlocked_it6hy0.png' }}
91
+ style={{ width: 250, height:250 }}
92
+ resizeMode='cover'
93
+ />
94
+ </View>
95
+ <View style={{ marginBottom:15 }}>
96
+ <Text size={14} color={Colors.brand.midnight} textAlign='center'>Let's secure your sensitive information. Before doing any activity in your wallet, you will be required to enter a pin. Lets set it now.</Text>
97
+ </View>
98
+ {pin_view == 'set' ?
99
+ <TextInput
100
+ style={{ width:200, alignSelf:'center' }}
101
+ placeholder='HARDPIN'
102
+ placeholderTextColor={Colors.brand.slate}
103
+ value={pin}
104
+ onChangeText={(text) => setPinSettings({ ...pin_settings, pin: text })}
105
+ />
106
+ :
107
+ <View>
108
+ <TextInput
109
+ style={{ width:200, alignSelf:'center' }}
110
+ placeholder='RE-Enter PIN'
111
+ placeholderTextColor={Colors.brand.slate}
112
+ value={confirm_pin}
113
+ onChangeText={(text) => setPinSettings({ ...pin_settings, confirm_pin: text })}
114
+ />
115
+ </View>
116
+
117
+ }
118
+ </View>
119
+ :auth_required ?
120
+ <View style={{ flex:1, padding:20 }}>
121
+ <View>
122
+ <Text size={20} color={Colors.brand.slate} weight='semibold' textAlign='center'>BettorEdge Wallet</Text>
123
+ <Text style={{ marginTop:5 }} size={26} color={Colors.brand.midnight} weight='bold' textAlign='center'>Enter Security PIN</Text>
124
+ </View>
125
+ <View style={{ justifyContent:'center', alignItems:'center' }}>
126
+ <Image
127
+ source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1717099686/Secure_lock_and_key_successfully_unlocked_it6hy0.png' }}
128
+ style={{ width: 250, height:250 }}
129
+ resizeMode='cover'
130
+ />
131
+ </View>
132
+ <View style={{ marginBottom:15 }}>
133
+ <Text size={14} color={Colors.brand.midnight} textAlign='center'>Before you can continue to your wallet. Please enter your security pin.</Text>
134
+ </View>
135
+
136
+ <TextInput
137
+ style={{ width:200, alignSelf:'center' }}
138
+ placeholder='ENTER PIN'
139
+ placeholderTextColor={Colors.brand.slate}
140
+ value={pin}
141
+ onChangeText={(text) => setPinSettings({ ...pin_settings, pin: text })}
142
+ />
143
+ {auth_error ?
144
+ <View style={{ padding:10 }}>
145
+ <Text size={14} color={Colors.utility.warning} weight='bold' textAlign='center'>{auth_error}</Text>
146
+ </View>
147
+ :<></>}
148
+ </View>
149
+ :<></>}
150
+ <View style={{ flexDirection:'row', padding:10 }}>
151
+ {!wallet_settings.agreed_to_terms ?
152
+ <Button
153
+ title='I AGREE'
154
+ style={{ flex:3, opacity:terms_agreed?1:0.5 }}
155
+ disabled={!terms_agreed}
156
+ backgroundColor={Colors.brand.electric}
157
+ title_color={Colors.shades.white}
158
+ padding={15}
159
+ onPress={() => handleAgreeTerms()}
160
+ />
161
+ : !wallet_settings.pin && pin_view == 'set' ?
162
+ <Button
163
+ title='CONFIRM PIN'
164
+ style={{ flex:3, opacity:pin_valid?1:0.5 }}
165
+ disabled={!pin_valid}
166
+ backgroundColor={Colors.utility.success}
167
+ title_color={Colors.shades.white}
168
+ padding={15}
169
+ onPress={() => setPinView('confirm')}
170
+ />
171
+ : !wallet_settings.pin && pin_view == 'confirm' ?
172
+ <Button
173
+ title='LETS GO!'
174
+ style={{ flex:3, opacity:go_valid ? 1: 0.5}}
175
+ disabled={!go_valid}
176
+ backgroundColor={Colors.utility.success}
177
+ title_color={Colors.shades.white}
178
+ padding={15}
179
+ onPress={() => handleSetPin()}
180
+ />
181
+ : auth_required ?
182
+ <Button
183
+ title='SUBMIT'
184
+ style={{ flex:3, opacity:pin_valid ? 1: 0.5}}
185
+ disabled={!pin_valid}
186
+ backgroundColor={Colors.utility.success}
187
+ title_color={Colors.shades.white}
188
+ padding={15}
189
+ onPress={() => handleAuthPin()}
190
+ />
191
+ :<></>}
192
+ </View>
193
+ </View>
194
+ )
195
+ }
196
+
197
+ export default WalletSetup
@@ -0,0 +1,145 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { ActivityIndicator, View } from "react-native";
3
+ import type { AccountProps, ItemOrderProps, PlayerDepositLimitProps, PlayerWithdrawLimitProps, WalletSettingsProps } from '../../types';
4
+ import { ItemOrderApi, ItemOrderHelpers } from '../api';
5
+ import type { MyPlayerProps, PlayerBalanceProps } from '../../ProfileManager/api/types';
6
+ import Colors from '../../constants/colors';
7
+ import { Button, Text, TextInput } from '../../Components';
8
+ import { view_styles } from '../../constants/styles';
9
+
10
+
11
+ type WithdrawCardProps = {
12
+ player:MyPlayerProps,
13
+ wallet_settings:WalletSettingsProps,
14
+ player_balance:PlayerBalanceProps,
15
+ account:AccountProps,
16
+ deposit_limit:PlayerDepositLimitProps,
17
+ withdraw_limit:PlayerWithdrawLimitProps,
18
+ onTransact:(draft_order:ItemOrderProps) => void,
19
+ onCancel:() => void
20
+ }
21
+ const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, withdraw_limit, deposit_limit , onCancel}:WithdrawCardProps) => {
22
+ const [ draft_order, setDraftOrder ] = useState<ItemOrderProps>();
23
+
24
+ useEffect(() => {
25
+ getItemFromServer()
26
+ },[])
27
+
28
+ const getItemFromServer = async() => {
29
+ const item = await ItemOrderApi.getItemByIdentifier('withdraw')
30
+ setDraftOrder(ItemOrderHelpers.genWithdrawOrder(item, account))
31
+ }
32
+
33
+
34
+ const { errors, available_for_withdraw } = ItemOrderHelpers.isWithdrawOrderValid(account, withdraw_limit, deposit_limit, player_balance, wallet_settings, draft_order)
35
+
36
+ const handleTransact = () => {
37
+ if(!draft_order){ return }
38
+ if(errors.length > 0){ return }
39
+ onTransact({ ...draft_order, total_amount: draft_order.amount as number })
40
+ }
41
+
42
+
43
+ if(!draft_order){
44
+ return (
45
+ <View style={{ padding:20 }}>
46
+ <ActivityIndicator style={{ alignSelf:'center' }} size='large' color={Colors.brand.midnight} />
47
+ </View>
48
+ )
49
+ }
50
+
51
+
52
+ let balance = Math.floor(player_balance.balance * 100) / 100
53
+
54
+ return (
55
+ <View style={{ flex:1 }}>
56
+ <View nativeID='deposit_rules' style={{ padding:10 }}>
57
+ <Text size={28} textAlign='center' weight='bold' color={Colors.brand.midnight}>Withdraw to your bank</Text>
58
+ <Text style={{ marginTop:10 }} size={14} textAlign='center' weight='regular' color={Colors.brand.midnight}>Withdraws can take up to 3 business days</Text>
59
+ </View>
60
+ <View style={{ flex:1 }}>
61
+ <View nativeID='deposit_amount' style={{ justifyContent:'center', alignItems:'center', padding:20 }}>
62
+ <TextInput
63
+ placeholder='0'
64
+ value={draft_order.amount as string}
65
+ onChangeText={(text) => setDraftOrder({ ...draft_order, amount:text })}
66
+ />
67
+ </View>
68
+ </View>
69
+ <View nativeID='withdraw_limits' style={{ backgroundColor:Colors.shades.shade100, padding:20 }}>
70
+ <View style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
71
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='semibold'>Weekly Withdraws Available</Text>
72
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>{withdraw_limit.withdraws_per_week - withdraw_limit.week_withdraw_count}</Text>
73
+ </View>
74
+ <View style={{ flexDirection:'row', alignItems:'center', padding:10, paddingTop:0 }}>
75
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='semibold'>Available For Withdraw</Text>
76
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>{available_for_withdraw.toFixed(2)}</Text>
77
+ </View>
78
+ <View style={{ marginTop:5, borderRadius:8, padding:10, backgroundColor:Colors.shades.shade600 }}>
79
+ <Text size={14} color={Colors.brand.midnight} textAlign='left' weight='semibold'>Determined by the LESSER OF</Text>
80
+ <View nativeID='available_to_withdraw_calculation' style={{ margin:5, marginTop:10, padding:10, backgroundColor:Colors.shades.white, borderRadius:4 }}>
81
+ <View style={{ padding:5, flexDirection:'row', alignItems:'center' }}>
82
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='regular'>My Balance</Text>
83
+ <Text size={14} color={Colors.brand.midnight} weight='semibold'>${balance}</Text>
84
+ </View>
85
+ <View style={{ padding:5, flexDirection:'row', alignItems:'center', paddingLeft:15 }}>
86
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='regular'>Instant Deposits (unsettled)</Text>
87
+ <Text size={14} color={Colors.utility.error} weight='semibold'>${deposit_limit.instant_deposits.toFixed(2)}</Text>
88
+ </View>
89
+ <View style={{ padding:5, flexDirection:'row', alignItems:'center', borderTopWidth:1, borderTopColor:Colors.shades.shade600 }}>
90
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='bold'>Withdrawable Balance</Text>
91
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>${available_for_withdraw.toFixed(2)}</Text>
92
+ </View>
93
+ </View>
94
+
95
+ <View nativeID='daily_limit' style={{ margin:5, padding:10, backgroundColor:Colors.shades.white, borderRadius:4 }}>
96
+ <View style={{ padding:5, flexDirection:'row', alignItems:'center' }}>
97
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='regular'>Daily Limit</Text>
98
+ <Text size={14} color={Colors.brand.midnight} weight='semibold'>${withdraw_limit.ach_daily_limit.toFixed(2)}</Text>
99
+ </View>
100
+ <View style={{ padding:5, flexDirection:'row', alignItems:'center', paddingLeft:15}}>
101
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='regular'>Last Days Withdraws</Text>
102
+ <Text size={14} color={Colors.utility.error} weight='semibold'>${withdraw_limit.last_days_ach_withdraws.toFixed(2)}</Text>
103
+ </View>
104
+ <View style={{ padding:5, flexDirection:'row', alignItems:'center' , borderTopWidth:1, borderTopColor:Colors.shades.shade600 }}>
105
+ <Text style={{ flex:1 }} size={14} color={Colors.brand.midnight} weight='bold'>Limit Available</Text>
106
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>${(withdraw_limit.ach_daily_limit - withdraw_limit.last_days_ach_withdraws).toFixed(2)}</Text>
107
+ </View>
108
+ </View>
109
+ </View>
110
+ {errors.length > 0 ?
111
+ <View style={{ position:'absolute', bottom:0, left:0, right:0, margin:20, borderRadius:8, padding:20, backgroundColor:Colors.shades.white, ...view_styles.float }}>
112
+ <Text style={{ marginBottom:10 }} size={14} color={Colors.brand.midnight}>Please fix the following before continuing</Text>
113
+ {errors.map(e => {
114
+ return (
115
+ <Text size={14} color={Colors.utility.warning}>{e}</Text>
116
+ )
117
+ })}
118
+ </View>
119
+ :<></>}
120
+ </View>
121
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
122
+ <Button
123
+ style={{ flex:1, marginRight:5, opacity: 1 }}
124
+ title={'CANCEL'}
125
+ title_color={Colors.brand.electric}
126
+ borderWidth={1}
127
+ borderColor={Colors.brand.electric}
128
+ padding={15}
129
+ onPress={() => onCancel()}
130
+ />
131
+ <Button
132
+ style={{ flex:3, opacity: errors.length > 0 ? 0.5: 1 }}
133
+ disabled={errors.length > 0 ? true : false}
134
+ title={'REVIEW WITHDRAW'}
135
+ title_color={Colors.shades.white}
136
+ backgroundColor={Colors.brand.electric}
137
+ padding={15}
138
+ onPress={() => handleTransact()}
139
+ />
140
+ </View>
141
+ </View>
142
+ )
143
+ }
144
+
145
+ export default WithdrawCard