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,92 @@
1
+ import React from 'react';
2
+ import { View, TouchableOpacity } from "react-native";
3
+ import type { AccountProps } from '../../types';
4
+ import { Icons, Text } from '../../Components';
5
+ import Colors from '../../constants/colors';
6
+ import { view_styles } from '../../constants/styles';
7
+ import moment from 'moment-mini';
8
+
9
+ type AccountCardProps = {
10
+ account:AccountProps,
11
+ hide_status?:boolean,
12
+ onSelectAccount: (account:AccountProps) => void
13
+ }
14
+
15
+ const AccountCard = ({ account, hide_status, onSelectAccount }: AccountCardProps) => {
16
+ console.log(account)
17
+
18
+ const getIcon = () => {
19
+ switch(account.account_type){
20
+ case 'ach':
21
+ if(account.ach_detail?.payment_provider == 'nuvei'){ return <Icons.BankInstantIcon size={28} color={Colors.brand.midnight}/> }
22
+ return <Icons.BankIcon size={28} color={Colors.utility.success} />
23
+ case 'card':
24
+ return renderCardIcon(account.card_detail?.card_brand)
25
+ default: return <></>
26
+
27
+ }
28
+ }
29
+
30
+ const renderCardIcon = (brand?:string) => {
31
+ switch(brand?.toLowerCase()){
32
+ case 'amex':
33
+ return <Icons.AmexCardIcon size={28} />
34
+ case 'visa':
35
+ return <Icons.VisaCardIcon size={28} />
36
+ case 'mastercard':
37
+ return <Icons.MasterCardIcon size={28} />
38
+ case 'discover':
39
+ return <Icons.DiscoverCardIcon size={28} />
40
+ default:
41
+ return <Icons.CreditCardIcon size={22} color={Colors.brand.midnight}/>
42
+ }
43
+ }
44
+
45
+ const getStatusColor = () => {
46
+ switch(account.status){
47
+ case 'active': return Colors.utility.success
48
+ case 'inactive': return Colors.utility.error
49
+ case 'suspended': return Colors.utility.warning
50
+ case 'verify': return Colors.utility.warning
51
+ default: return Colors.brand.midnight
52
+ }
53
+ }
54
+
55
+ const getDescriptionLabel = () => {
56
+ switch(account.account_type){
57
+ case 'ach':
58
+ if(!account.ach_detail){ return '' }
59
+ if(account.ibt_placeholder){ return `Securely link a new account and transact instantly` }
60
+ return account.ach_detail.account_type.toUpperCase()
61
+ case 'card':
62
+ if(!account.card_detail){ return '' }
63
+ return `EXP ${moment(account.card_detail.expiration_date).format('MM/YYYY')}`
64
+ default: return ''
65
+ }
66
+ }
67
+
68
+ return (
69
+ <TouchableOpacity
70
+ style={{ borderRadius:8, backgroundColor:Colors.shades.white, ...view_styles.float }}
71
+ onPress={() => onSelectAccount(account)}
72
+ >
73
+ <View style={{ padding:10, flexDirection:'row' }}>
74
+ <View style={{ marginRight:10, justifyContent:'center', alignItems:'center' }}>
75
+ {getIcon()}
76
+ </View>
77
+ <View style={{ flex:1 }}>
78
+ <Text size={16} color={Colors.brand.midnight} weight='bold'>{account.account_label}</Text>
79
+ <Text style={{ marginTop:4 }} size={14} color={Colors.brand.midnight} weight='regular'>{getDescriptionLabel()}</Text>
80
+ </View>
81
+ {!hide_status ?
82
+ <View>
83
+ <Text size={12} color={getStatusColor()} weight='bold'>{account.status.toUpperCase()}</Text>
84
+ </View>
85
+ :<></>}
86
+ </View>
87
+ </TouchableOpacity>
88
+ )
89
+ }
90
+
91
+
92
+ export default AccountCard
@@ -0,0 +1,212 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { FlatList, TouchableOpacity, View } from 'react-native';
3
+ import type { AccountLimitProps, AccountProps } from '../../types';
4
+ import { WalletApi, WalletHelpers } from '../api';
5
+ import { Button, Icons, Text } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+
8
+ const limit_amount_options = [ 50, 100, 250, 500, 1000]
9
+ const frequency_options = ['Daily', 'Weekly', 'Monthly']
10
+
11
+ type AccountLimitManagerProps = {
12
+ account: AccountProps,
13
+ onCancel: () => void,
14
+ onSetLimit: (account_limit:AccountLimitProps) => void
15
+ }
16
+
17
+ const AccountLimitManager = ({ account, onCancel, onSetLimit }: AccountLimitManagerProps ) => {
18
+ const [ loading, setLoading ] = useState(false);
19
+ const [ freq_width, setFreqWidth ] = useState(0);
20
+ const [ disclaimer, setDisclaimer ] = useState(false);
21
+ const [ dropdown_visible, setDropdownVisible ] = useState(false);
22
+ const [ active_frequency, setActiveFrequency ] = useState('Daily')
23
+ const [ active_amount, setActiveAmount ] = useState<number | undefined>(undefined);
24
+ const [ account_limit, setAccountLimit ] = useState<AccountLimitProps>();
25
+
26
+ //Filter to ensure only this player and not inactive accounts
27
+
28
+ //Account Limits
29
+
30
+ /**
31
+ * Effect whenever the account_id changes. Need to get the data from server
32
+ */
33
+ useEffect(() => {
34
+ if(!account){ return }
35
+ getDataFromServer(account.account_id)
36
+ },[account])
37
+
38
+ useEffect(() => {
39
+ if(!account_limit){ return }
40
+ if(account_limit.status == 'active'){
41
+ setActiveFrequency(WalletHelpers.getFrequencyFromDays(account_limit.limit_days))
42
+ setActiveAmount(account_limit.limit_amount)
43
+ }
44
+ },[account_limit])
45
+
46
+ /**
47
+ * Get data from the server
48
+ * @param account_id
49
+ */
50
+ const getDataFromServer = async(account_id:string) => {
51
+ const al = await WalletApi.getLimitByAccountId(account_id)
52
+ setAccountLimit(al)
53
+ if(al){ onSetLimit(al) }
54
+ }
55
+
56
+ const handleSetLimit = async() => {
57
+ if(loading){ return alert('Hold your horses please. Still updating') };
58
+ if(!active_amount || !active_frequency){ return alert('Invalid limit') };
59
+ let days = 0;
60
+ switch(active_frequency){
61
+ case 'Daily':
62
+ days = 1
63
+ break
64
+ case 'Weekly':
65
+ days = 7
66
+ break
67
+ case 'Monthly':
68
+ days = 30
69
+ break
70
+ default: break
71
+ }
72
+ if(days == 0){ return alert('Invalid limit') }
73
+
74
+ let account_limit:AccountLimitProps = {
75
+ account_id:account.account_id,
76
+ account_limit_id: '',
77
+ limit_amount: active_amount,
78
+ limit_days: days,
79
+ create_datetime: '',
80
+ last_update_datetime: '',
81
+ status: 'active',
82
+ current_amount: 0,
83
+ reset_datetime: ''
84
+ }
85
+
86
+ setLoading(true)
87
+ const al = await WalletApi.createAccountLimit(account_limit)
88
+ setAccountLimit(al)
89
+ setLoading(false)
90
+ }
91
+
92
+ const handleRemoveAccountLimit = async() => {
93
+ if(!account_limit){ return }//There is no account limit
94
+ if(loading){ return alert('Still processing') }
95
+ setLoading(true)
96
+ const al = await WalletApi.removeAccountLimit(account_limit.account_limit_id)
97
+ setAccountLimit(al)
98
+ onSetLimit(al)
99
+ setLoading(false)
100
+ }
101
+
102
+ const renderOptions = (data: { item:number, index:number }) => {
103
+ //const selected = data.item == active_amount ? true : false
104
+ return (
105
+ <TouchableOpacity style={{ padding:10 }} onPress={() => {
106
+ setActiveAmount(data.item);
107
+ setDropdownVisible(false);
108
+ }}>
109
+ <Text color={Colors.brand.midnight} weight='semibold' size={14}>${data.item}</Text>
110
+ </TouchableOpacity>
111
+ )
112
+ }
113
+
114
+ const renderFrequencies = (data: {item:string, index:number}) => {
115
+ const selected = data.item == active_frequency ? true : false
116
+ return (
117
+ <TouchableOpacity style={{ width:freq_width/3, backgroundColor:selected?Colors.shades.white:'transparent', borderRadius:4, padding:10 }} onPress={() => setActiveFrequency(data.item)}>
118
+ <Text size={14} color={Colors.brand.midnight} weight={selected?'bold':'regular'} textAlign='center'>{data.item}</Text>
119
+ </TouchableOpacity>
120
+ )
121
+ }
122
+ const valid = active_amount && active_frequency ? true : false
123
+ return (
124
+ <View style={{ flex:1 }}>
125
+ <View style={{ padding:20 }}>
126
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>{account_limit?.status == 'active'?'Update Deposit Limits':'Deposit Limits'}</Text>
127
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Set your own limit for depositing.</Text>
128
+ </View>
129
+ <View style={{ flex:1 }}>
130
+ <View style={{padding:16}}>
131
+ <Text size={16} color={Colors.brand.cobalt} weight='semibold'>Amount</Text>
132
+ <TouchableOpacity
133
+ onPress={() => setDropdownVisible(!dropdown_visible)}
134
+ style={{marginTop:8, flexDirection:'row', alignItems:'center', justifyContent:'space-between', padding:15, backgroundColor:Colors.shades.shade100}}>
135
+ <Text color={Colors.brand.cobalt} size={14} weight='semibold'>{active_amount?`$${active_amount}`:'Select Limit'}</Text>
136
+ <Icons.ChevronIcon direction='down' color={Colors.brand.cobalt} size={8} />
137
+ </TouchableOpacity>
138
+ {dropdown_visible ?
139
+ <View style={{ borderBottomRightRadius:8, borderBottomLeftRadius:8, padding:10, borderWidth:1, borderTopWidth:1, borderColor:Colors.shades.shade600 }}>
140
+ <FlatList
141
+ data={limit_amount_options}
142
+ renderItem={renderOptions}
143
+ />
144
+ </View>
145
+ :<></>}
146
+ </View>
147
+ <View style={{ padding:16 }}>
148
+ <Text size={16} color={Colors.brand.cobalt} weight='semibold'>Frequency</Text>
149
+ <View style={{ marginTop:8, backgroundColor: '#e9e9e9', padding:2, borderRadius:4 }} onLayout={(ev) => {
150
+ setFreqWidth(ev.nativeEvent.layout.width)
151
+ }}>
152
+ <FlatList
153
+ data={frequency_options}
154
+ renderItem={renderFrequencies}
155
+ horizontal
156
+ showsHorizontalScrollIndicator={false}
157
+ />
158
+ </View>
159
+ </View>
160
+ {account_limit?.status == 'active' ?
161
+ <View style={{ margin:10, borderRadius:8, backgroundColor:Colors.shades.shade600, padding:10 }}>
162
+ <Text size={14} color={Colors.brand.midnight} weight='semibold' textAlign='center'>There is an active limit on this account of ${account_limit.limit_amount} every {account_limit.limit_days} days</Text>
163
+ <Button
164
+ style={{ marginTop:10 }}
165
+ title='REMOVE'
166
+ title_color={Colors.shades.white}
167
+ padding={15}
168
+ backgroundColor={Colors.utility.error}
169
+ onPress={() => handleRemoveAccountLimit()}
170
+ />
171
+ </View>
172
+ :<></>}
173
+ </View>
174
+
175
+ { valid ?
176
+ <View nativeID='limit_disclaimer' style={{ margin:10 }}>
177
+ <TouchableOpacity style={{ flexDirection:'row', padding:5 }} onPress={() => setDisclaimer(!disclaimer)}>
178
+ <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 }}>
179
+ {disclaimer ?
180
+ <Icons.CheckIcon color={Colors.shades.white} size={14} />
181
+ :<></>}
182
+ </View>
183
+ <Text size={14} color={Colors.brand.midnight} weight='regular'>I confirm I would like to the my deposit limit to {active_amount}, and deposit frequency to {active_frequency}</Text>
184
+ </TouchableOpacity>
185
+ </View>
186
+ :<></>}
187
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
188
+ <Button
189
+ style={{ flex:1, marginRight:5, opacity: 1 }}
190
+ title={'CLOSE'}
191
+ title_color={Colors.brand.electric}
192
+ borderColor={Colors.brand.electric}
193
+ borderWidth={1}
194
+ padding={15}
195
+ onPress={() => onCancel()}
196
+ />
197
+ <Button
198
+ style={{ flex:3, opacity: valid&&disclaimer?1:0.5 }}
199
+ title={'SAVE LIMIT'}
200
+ disabled={!valid||!disclaimer}
201
+ loading={loading}
202
+ title_color={Colors.shades.white}
203
+ backgroundColor={Colors.brand.electric}
204
+ padding={15}
205
+ onPress={() => handleSetLimit()}
206
+ />
207
+ </View>
208
+ </View>
209
+ )
210
+ }
211
+
212
+ export default AccountLimitManager
@@ -0,0 +1,103 @@
1
+ import React from 'react';
2
+ import { FlatList, View, TouchableOpacity, Image } from 'react-native';
3
+ import type { AccountProps } from '../../types';
4
+ import AccountCard from './AccountCard';
5
+ import { Button, Icons, Text } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+
8
+ type AccountManagerProps = {
9
+ accounts:AccountProps[],
10
+ onClose:() => void,
11
+ onSelectAccount: (account:AccountProps) => void
12
+ onSelectManualACH: () => void,
13
+ onSelectManualCard: () => void,
14
+ onSelectInstantBankTransfer: () => void
15
+ }
16
+
17
+ const AccountManager = ({ accounts, onSelectAccount, onSelectManualACH, onSelectManualCard, onSelectInstantBankTransfer , onClose}:AccountManagerProps) => {
18
+
19
+ const my_accounts = accounts.filter(a => !a.ibt_placeholder && !['bettoredge', 'paypal'].includes(a.account_type))
20
+ //const ibt_placeholder = accounts.find(a => a.ibt_placeholder);
21
+
22
+ const renderAccounts = (data:{item:AccountProps, index:number}) => {
23
+ return (
24
+ <View style={{ margin:5 }}>
25
+ <AccountCard
26
+ account={data.item}
27
+ onSelectAccount={(account) => onSelectAccount(account)}
28
+ />
29
+ </View>
30
+ )
31
+ }
32
+
33
+ return (
34
+ <View style={{ flex:1 }}>
35
+ <View style={{ padding:20 }}>
36
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>WALLET ACCOUNTS</Text>
37
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Below are the accounts we have on file for you. Please select one to manage or transact!</Text>
38
+ </View>
39
+ <View style={{ flex:1, padding:10 }}>
40
+ {my_accounts.length > 0 ?
41
+ <View style={{ padding:10 }}>
42
+ <Text size={16} color={Colors.brand.midnight} weight='bold'>MY ACCOUNTS</Text>
43
+ <View style={{ marginTop:10 }}>
44
+ <FlatList
45
+ data={my_accounts}
46
+ renderItem={renderAccounts}
47
+ keyExtractor={(item) => item.account_id.toString()}
48
+ />
49
+ </View>
50
+ </View>
51
+ :<></>}
52
+ <View style={{ padding:10, marginTop:20 }}>
53
+ <Text size={16} color={Colors.brand.midnight} weight='bold'>ADD NEW ACCOUNT</Text>
54
+ <TouchableOpacity style={{ marginTop:10, padding:3, flexDirection:'row', alignItems:'center', borderRadius:30, backgroundColor:Colors.shades.white }}
55
+ onPress={() => onSelectInstantBankTransfer()}>
56
+ <View style={{ height:50, width:110, borderRadius:100, justifyContent:'center', alignItems:'center', borderWidth:1, borderColor:Colors.brand.cobalt }}>
57
+ <Image
58
+ source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1695821528/1630344814441_wjq98b.png' }}
59
+ style={{ width:50, height:30 }}
60
+ resizeMode='cover'
61
+ />
62
+ </View>
63
+ <View style={{ flex:1 }}>
64
+ <Text size={14} color={Colors.brand.cobalt} textAlign='center' weight='bold'>LINK ACH ACCOUNT</Text>
65
+ </View>
66
+ </TouchableOpacity>
67
+ <TouchableOpacity style={{ marginTop:10, padding:3, flexDirection:'row', alignItems:'center', borderRadius:30, backgroundColor:Colors.brand.midnight }}
68
+ onPress={() => onSelectManualACH()}>
69
+ <View style={{ height:50, width:50, borderRadius:100, justifyContent:'center', alignItems:'center', backgroundColor:Colors.shades.white }}>
70
+ <Icons.BankIcon size={22} color={Colors.brand.midnight} />
71
+ </View>
72
+ <View style={{ flex:1 }}>
73
+ <Text size={14} color={Colors.shades.white} textAlign='center' weight='bold'>ADD MANUAL ACH ACCOUNT</Text>
74
+ </View>
75
+ </TouchableOpacity>
76
+ <TouchableOpacity style={{ marginTop:10, padding:3, flexDirection:'row', alignItems:'center', borderRadius:30, backgroundColor:Colors.brand.cyan }}
77
+ onPress={() => onSelectManualCard()}>
78
+ <View style={{ height:50, width:50, borderRadius:100, justifyContent:'center', alignItems:'center', backgroundColor:Colors.shades.white }}>
79
+ <Icons.CreditCardIcon size={22} color={Colors.brand.cyan} />
80
+ </View>
81
+ <View style={{ flex:1 }}>
82
+ <Text size={14} color={Colors.shades.white} textAlign='center' weight='bold'>ADD NEW CARD ACCOUNT</Text>
83
+ </View>
84
+ </TouchableOpacity>
85
+
86
+ </View>
87
+ </View>
88
+ <View nativeID='action_row' style={{ padding:20 }}>
89
+ <Button
90
+ style={{ flex:1, opacity: 1 }}
91
+ title={'CLOSE'}
92
+ title_color={Colors.brand.electric}
93
+ borderWidth={1}
94
+ borderColor={Colors.brand.electric}
95
+ padding={15}
96
+ onPress={() => onClose()}
97
+ />
98
+ </View>
99
+ </View>
100
+ )
101
+ }
102
+
103
+ export default AccountManager
@@ -0,0 +1,153 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { FlatList, TouchableOpacity, View } from 'react-native';
3
+ import type { AccountProps, AccountSnoozeProps } from '../../types';
4
+ import { WalletApi } from '../api';
5
+ import { Button, Icons, Text } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+ import moment from 'moment-mini';
8
+
9
+ const duration_options = [1,7,14,30]
10
+
11
+ type AccountSnoozeManagerProps = {
12
+ account:AccountProps,
13
+ onCancel: () => void
14
+ onSnooze: (account_snooze?:AccountSnoozeProps) => void
15
+ }
16
+
17
+ const AccountSnoozeManager = ({ account, onCancel, onSnooze } : AccountSnoozeManagerProps) => {
18
+ const [ loading, setLoading ] = useState(false);
19
+ const [ dropdown_visible, setDropdownVisible ] = useState(false);
20
+ const [ disclaimer, setDisclaimer ] = useState(false);
21
+ const [ active_duration, setActiveDuration ] = useState<number | undefined>(undefined);
22
+ const [ account_snooze, setAccountSnooze ] = useState<AccountSnoozeProps>()
23
+ /**
24
+ * Effect whenever the account_id changes. Need to get the data from server
25
+ */
26
+ useEffect(() => {
27
+ if(!account){ return }
28
+ getDataFromServer(account.account_id)
29
+ },[account])
30
+
31
+ useEffect(() => {
32
+ if(!account_snooze){ return }
33
+ if(account_snooze.status == 'active'){
34
+ //update
35
+ }
36
+ },[account_snooze])
37
+
38
+ /**
39
+ * Get data from the server
40
+ * @param account_id
41
+ */
42
+ const getDataFromServer = async(account_id:string) => {
43
+ setLoading(true);
44
+ const as = await WalletApi.getSnoozeByAccountId(account_id)
45
+ setAccountSnooze(as)
46
+ onSnooze(as)
47
+ setLoading(false)
48
+ }
49
+
50
+ const handleSetSnooze = async() => {
51
+ if(account_snooze || !active_duration || loading){ return }
52
+ let snooze:AccountSnoozeProps = {
53
+ account_id:account.account_id,
54
+ account_snooze_id:'',
55
+ snooze_days: active_duration,
56
+ status: 'active',
57
+ create_datetime: '',
58
+ last_update_datetime: '',
59
+ end_datetime: ''
60
+ }
61
+ setLoading(true)
62
+ const new_snooze = await WalletApi.createAccountSnooze(snooze)
63
+ setAccountSnooze(new_snooze)
64
+ setLoading(false)
65
+ }
66
+
67
+ const renderOptions = (data: { item:number, index:number }) => {
68
+ return (
69
+ <TouchableOpacity style={{ padding:10 }} onPress={() => {
70
+ setActiveDuration(data.item);
71
+ setDropdownVisible(false);
72
+ }}>
73
+ <Text color={Colors.brand.midnight} weight='semibold' size={14}>{data.item} days</Text>
74
+ </TouchableOpacity>
75
+ )
76
+ }
77
+ const valid = active_duration ? true : false;
78
+ return (
79
+ <View style={{ flex:1 }}>
80
+ <View style={{ padding:20 }}>
81
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>Snooze Account</Text>
82
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>Take a break from the real money features of BettorEdge using this account.</Text>
83
+ </View>
84
+ <View style={{ flex:1, padding:16}}>
85
+ <Text size={16} color={Colors.brand.cobalt} weight='semibold'>Amount</Text>
86
+ <TouchableOpacity
87
+ onPress={() => setDropdownVisible(!dropdown_visible)}
88
+ style={{marginTop:8, flexDirection:'row', alignItems:'center', justifyContent:'space-between', padding:15, backgroundColor:Colors.shades.shade100}}>
89
+ <Text color={Colors.brand.cobalt} size={14} weight='semibold'>{active_duration?`${active_duration} Days`:'Select Duration'}</Text>
90
+ <Icons.ChevronIcon direction='down' color={Colors.brand.cobalt} size={8} />
91
+ </TouchableOpacity>
92
+ {dropdown_visible ?
93
+ <View style={{ borderBottomRightRadius:8, borderBottomLeftRadius:8, padding:10, borderWidth:1, borderTopWidth:1, borderColor:Colors.shades.shade600 }}>
94
+ <FlatList
95
+ data={duration_options}
96
+ renderItem={renderOptions}
97
+ />
98
+ </View>
99
+ :<></>}
100
+ </View>
101
+ { valid ?
102
+ <View nativeID='snooze_disclaimer' style={{ margin:10 }}>
103
+ <TouchableOpacity style={{ flexDirection:'row', padding:5 }} onPress={() => setDisclaimer(!disclaimer)}>
104
+ <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 }}>
105
+ {disclaimer ?
106
+ <Icons.CheckIcon color={Colors.shades.white} size={14} />
107
+ :<></>}
108
+ </View>
109
+ <Text size={14} color={Colors.brand.midnight} weight='regular'>I confirm I wwould like to snooze my account for {active_duration} days. This cannot be undone!</Text>
110
+ </TouchableOpacity>
111
+ </View>
112
+ :<></>}
113
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
114
+ <Button
115
+ style={{ flex:1, marginRight:5, opacity: 1 }}
116
+ title={'CLOSE'}
117
+ title_color={Colors.brand.electric}
118
+ borderColor={Colors.brand.electric}
119
+ borderWidth={1}
120
+ padding={15}
121
+ onPress={() => onCancel()}
122
+ />
123
+ <Button
124
+ style={{ flex:3, opacity: valid&&disclaimer?1:0.5 }}
125
+ title={'SAVE SNOOZE'}
126
+ disabled={!valid||!disclaimer}
127
+ loading={loading}
128
+ title_color={Colors.shades.white}
129
+ backgroundColor={Colors.brand.electric}
130
+ padding={15}
131
+ onPress={() => handleSetSnooze()}
132
+ />
133
+ </View>
134
+
135
+ {account_snooze ?
136
+ <View style={{ position:'absolute', top:0, right:0, left:0, bottom:0, backgroundColor:Colors.shades.black_faded, justifyContent:'center', alignItems:'center' }}>
137
+ <View style={{ backgroundColor:Colors.shades.white, borderRadius:8, padding:20}}>
138
+ <View style={{ padding:10, backgroundColor:Colors.brand.cyan, borderRadius:8, alignSelf:'center' }}>
139
+ <Icons.SnoozeIcon size={24} color={Colors.shades.white} />
140
+ </View>
141
+ <Text style={{ padding:10 }} size={18} weight='bold' textAlign='center'>Account is Snoozing</Text>
142
+ <Text size={14} color={Colors.brand.midnight} weight='semibold' textAlign='center'>Snooze ends {moment(account_snooze.end_datetime).fromNow()}</Text>
143
+ <TouchableOpacity style={{ marginTop:10, padding:10, borderWidth:1, borderColor:Colors.brand.electric, borderRadius:8 }} onPress={() => onCancel()}>
144
+ <Text size={14} color={Colors.brand.electric} textAlign='center'>Go Back</Text>
145
+ </TouchableOpacity>
146
+ </View>
147
+ </View>
148
+ :<></>}
149
+ </View>
150
+ )
151
+ }
152
+
153
+ export default AccountSnoozeManager
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { TouchableOpacity, View } from 'react-native';
3
+ import type { PlayerAddressProps } from '../../types';
4
+ import { Button, Text } from '../../Components';
5
+ import Colors from '../../constants/colors';
6
+
7
+ type AddressCardProps = {
8
+ address:PlayerAddressProps,
9
+ onDelete:(address:PlayerAddressProps) => void,
10
+ onSelect:(address:PlayerAddressProps) => void
11
+ }
12
+
13
+ const AddressCard = ({ address, onSelect, onDelete }:AddressCardProps) => {
14
+ return (
15
+ <View nativeID='address_info' style={{ padding:10, flexDirection:'row', alignItems:'center', borderWidth:1, borderColor:Colors.shades.shade600, borderRadius:8 }} >
16
+ <TouchableOpacity style={{ flex:1 }} onPress={() => onSelect(address)}>
17
+ <Text color={Colors.brand.midnight} weight='bold' size={16}>{address.name}</Text>
18
+ <Text style={{ marginTop:4 }} size={14} weight='regular'>{address.street}</Text>
19
+ <Text style={{ marginTop:2 }} size={14} weight='regular'>{address.city} {address.state} {address.zip}</Text>
20
+ </TouchableOpacity>
21
+ <Button
22
+ title='DELETE'
23
+ title_color={Colors.shades.white}
24
+ backgroundColor={Colors.utility.error}
25
+ onPress={() => onDelete(address)}
26
+ />
27
+ </View>
28
+ )
29
+ }
30
+
31
+ export default AddressCard