be-components 0.4.9 → 0.5.0
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.
- package/lib/commonjs/ApiOverrides/index.js +12 -3
- package/lib/commonjs/ApiOverrides/index.js.map +1 -1
- package/lib/commonjs/Checkout/api/index.js +247 -0
- package/lib/commonjs/Checkout/api/index.js.map +1 -0
- package/lib/commonjs/Checkout/components/AccountSummaryCard.js +274 -0
- package/lib/commonjs/Checkout/components/AccountSummaryCard.js.map +1 -0
- package/lib/commonjs/Checkout/components/ItemSummaryCard.js +56 -0
- package/lib/commonjs/Checkout/components/ItemSummaryCard.js.map +1 -0
- package/lib/commonjs/Checkout/components/OrderSummaryCard.js +84 -0
- package/lib/commonjs/Checkout/components/OrderSummaryCard.js.map +1 -0
- package/lib/commonjs/Checkout/index.js +590 -0
- package/lib/commonjs/Checkout/index.js.map +1 -0
- package/lib/commonjs/Components/Button.js +11 -3
- package/lib/commonjs/Components/Button.js.map +1 -1
- package/lib/commonjs/Components/Checkbox.js +6 -2
- package/lib/commonjs/Components/Checkbox.js.map +1 -1
- package/lib/commonjs/Components/Icons.js +441 -4
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/Spring.js +6 -5
- package/lib/commonjs/Components/Spring.js.map +1 -1
- package/lib/commonjs/LocationTracker/LocationStatus.js +95 -0
- package/lib/commonjs/LocationTracker/LocationStatus.js.map +1 -0
- package/lib/commonjs/LocationTracker/api/index.js +124 -0
- package/lib/commonjs/LocationTracker/api/index.js.map +1 -0
- package/lib/commonjs/LocationTracker/index.js +207 -0
- package/lib/commonjs/LocationTracker/index.js.map +1 -0
- package/lib/commonjs/Observer/Observer.js +2 -0
- package/lib/commonjs/Observer/Observer.js.map +1 -1
- package/lib/commonjs/Wallet/api/index.js +621 -0
- package/lib/commonjs/Wallet/api/index.js.map +1 -0
- package/lib/commonjs/Wallet/components/ACHAdd.js +63 -0
- package/lib/commonjs/Wallet/components/ACHAdd.js.map +1 -0
- package/lib/commonjs/Wallet/components/AccountCard.js +137 -0
- package/lib/commonjs/Wallet/components/AccountCard.js.map +1 -0
- package/lib/commonjs/Wallet/components/AccountLimitManager.js +321 -0
- package/lib/commonjs/Wallet/components/AccountLimitManager.js.map +1 -0
- package/lib/commonjs/Wallet/components/AccountManager.js +202 -0
- package/lib/commonjs/Wallet/components/AccountManager.js.map +1 -0
- package/lib/commonjs/Wallet/components/AccountSnoozeManager.js +260 -0
- package/lib/commonjs/Wallet/components/AccountSnoozeManager.js.map +1 -0
- package/lib/commonjs/Wallet/components/AddressCard.js +56 -0
- package/lib/commonjs/Wallet/components/AddressCard.js.map +1 -0
- package/lib/commonjs/Wallet/components/AddressManager.js +365 -0
- package/lib/commonjs/Wallet/components/AddressManager.js.map +1 -0
- package/lib/commonjs/Wallet/components/DepositCard.js +165 -0
- package/lib/commonjs/Wallet/components/DepositCard.js.map +1 -0
- package/lib/commonjs/Wallet/components/LinkAccountManager.js +167 -0
- package/lib/commonjs/Wallet/components/LinkAccountManager.js.map +1 -0
- package/lib/commonjs/Wallet/components/ManageAccountCard.js +216 -0
- package/lib/commonjs/Wallet/components/ManageAccountCard.js.map +1 -0
- package/lib/commonjs/Wallet/components/ManualACHAdd.js +270 -0
- package/lib/commonjs/Wallet/components/ManualACHAdd.js.map +1 -0
- package/lib/commonjs/Wallet/components/ManualCardAdd.js +337 -0
- package/lib/commonjs/Wallet/components/ManualCardAdd.js.map +1 -0
- package/lib/commonjs/Wallet/components/MyBalance.js +73 -0
- package/lib/commonjs/Wallet/components/MyBalance.js.map +1 -0
- package/lib/commonjs/Wallet/components/PayPalOrderCapture.js +68 -0
- package/lib/commonjs/Wallet/components/PayPalOrderCapture.js.map +1 -0
- package/lib/commonjs/Wallet/components/RemoveAccount.js +108 -0
- package/lib/commonjs/Wallet/components/RemoveAccount.js.map +1 -0
- package/lib/commonjs/Wallet/components/VerifyACHAccount.js +196 -0
- package/lib/commonjs/Wallet/components/VerifyACHAccount.js.map +1 -0
- package/lib/commonjs/Wallet/components/WalletSetup.js +316 -0
- package/lib/commonjs/Wallet/components/WalletSetup.js.map +1 -0
- package/lib/commonjs/Wallet/components/WithdrawCard.js +336 -0
- package/lib/commonjs/Wallet/components/WithdrawCard.js.map +1 -0
- package/lib/commonjs/Wallet/index.js +221 -0
- package/lib/commonjs/Wallet/index.js.map +1 -0
- package/lib/commonjs/constants/colors.js +3 -0
- package/lib/commonjs/constants/colors.js.map +1 -1
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/ApiOverrides/index.js +12 -3
- package/lib/module/ApiOverrides/index.js.map +1 -1
- package/lib/module/Checkout/api/index.js +241 -0
- package/lib/module/Checkout/api/index.js.map +1 -0
- package/lib/module/Checkout/components/AccountSummaryCard.js +267 -0
- package/lib/module/Checkout/components/AccountSummaryCard.js.map +1 -0
- package/lib/module/Checkout/components/ItemSummaryCard.js +49 -0
- package/lib/module/Checkout/components/ItemSummaryCard.js.map +1 -0
- package/lib/module/Checkout/components/OrderSummaryCard.js +77 -0
- package/lib/module/Checkout/components/OrderSummaryCard.js.map +1 -0
- package/lib/module/Checkout/index.js +581 -0
- package/lib/module/Checkout/index.js.map +1 -0
- package/lib/module/Components/Button.js +11 -3
- package/lib/module/Components/Button.js.map +1 -1
- package/lib/module/Components/Checkbox.js +6 -2
- package/lib/module/Components/Checkbox.js.map +1 -1
- package/lib/module/Components/Icons.js +441 -4
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/Spring.js +6 -5
- package/lib/module/Components/Spring.js.map +1 -1
- package/lib/module/LocationTracker/LocationStatus.js +88 -0
- package/lib/module/LocationTracker/LocationStatus.js.map +1 -0
- package/lib/module/LocationTracker/api/index.js +118 -0
- package/lib/module/LocationTracker/api/index.js.map +1 -0
- package/lib/module/LocationTracker/index.js +200 -0
- package/lib/module/LocationTracker/index.js.map +1 -0
- package/lib/module/Observer/Observer.js +2 -0
- package/lib/module/Observer/Observer.js.map +1 -1
- package/lib/module/Wallet/api/index.js +615 -0
- package/lib/module/Wallet/api/index.js.map +1 -0
- package/lib/module/Wallet/components/ACHAdd.js +56 -0
- package/lib/module/Wallet/components/ACHAdd.js.map +1 -0
- package/lib/module/Wallet/components/AccountCard.js +130 -0
- package/lib/module/Wallet/components/AccountCard.js.map +1 -0
- package/lib/module/Wallet/components/AccountLimitManager.js +312 -0
- package/lib/module/Wallet/components/AccountLimitManager.js.map +1 -0
- package/lib/module/Wallet/components/AccountManager.js +195 -0
- package/lib/module/Wallet/components/AccountManager.js.map +1 -0
- package/lib/module/Wallet/components/AccountSnoozeManager.js +251 -0
- package/lib/module/Wallet/components/AccountSnoozeManager.js.map +1 -0
- package/lib/module/Wallet/components/AddressCard.js +49 -0
- package/lib/module/Wallet/components/AddressCard.js.map +1 -0
- package/lib/module/Wallet/components/AddressManager.js +356 -0
- package/lib/module/Wallet/components/AddressManager.js.map +1 -0
- package/lib/module/Wallet/components/DepositCard.js +156 -0
- package/lib/module/Wallet/components/DepositCard.js.map +1 -0
- package/lib/module/Wallet/components/LinkAccountManager.js +158 -0
- package/lib/module/Wallet/components/LinkAccountManager.js.map +1 -0
- package/lib/module/Wallet/components/ManageAccountCard.js +207 -0
- package/lib/module/Wallet/components/ManageAccountCard.js.map +1 -0
- package/lib/module/Wallet/components/ManualACHAdd.js +261 -0
- package/lib/module/Wallet/components/ManualACHAdd.js.map +1 -0
- package/lib/module/Wallet/components/ManualCardAdd.js +328 -0
- package/lib/module/Wallet/components/ManualCardAdd.js.map +1 -0
- package/lib/module/Wallet/components/MyBalance.js +66 -0
- package/lib/module/Wallet/components/MyBalance.js.map +1 -0
- package/lib/module/Wallet/components/PayPalOrderCapture.js +61 -0
- package/lib/module/Wallet/components/PayPalOrderCapture.js.map +1 -0
- package/lib/module/Wallet/components/RemoveAccount.js +100 -0
- package/lib/module/Wallet/components/RemoveAccount.js.map +1 -0
- package/lib/module/Wallet/components/VerifyACHAccount.js +187 -0
- package/lib/module/Wallet/components/VerifyACHAccount.js.map +1 -0
- package/lib/module/Wallet/components/WalletSetup.js +307 -0
- package/lib/module/Wallet/components/WalletSetup.js.map +1 -0
- package/lib/module/Wallet/components/WithdrawCard.js +327 -0
- package/lib/module/Wallet/components/WithdrawCard.js.map +1 -0
- package/lib/module/Wallet/index.js +212 -0
- package/lib/module/Wallet/index.js.map +1 -0
- package/lib/module/constants/colors.js +3 -0
- package/lib/module/constants/colors.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/src/Checkout/api/index.d.ts +49 -0
- package/lib/typescript/src/Checkout/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Checkout/components/AccountSummaryCard.d.ts +18 -0
- package/lib/typescript/src/Checkout/components/AccountSummaryCard.d.ts.map +1 -0
- package/lib/typescript/src/Checkout/components/ItemSummaryCard.d.ts +8 -0
- package/lib/typescript/src/Checkout/components/ItemSummaryCard.d.ts.map +1 -0
- package/lib/typescript/src/Checkout/components/OrderSummaryCard.d.ts +8 -0
- package/lib/typescript/src/Checkout/components/OrderSummaryCard.d.ts.map +1 -0
- package/lib/typescript/src/Checkout/index.d.ts +12 -0
- package/lib/typescript/src/Checkout/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/Button.d.ts.map +1 -1
- package/lib/typescript/src/Components/Checkbox.d.ts +3 -1
- package/lib/typescript/src/Components/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +8 -1
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/Spring.d.ts.map +1 -1
- package/lib/typescript/src/LocationTracker/LocationStatus.d.ts +21 -0
- package/lib/typescript/src/LocationTracker/LocationStatus.d.ts.map +1 -0
- package/lib/typescript/src/LocationTracker/api/index.d.ts +19 -0
- package/lib/typescript/src/LocationTracker/api/index.d.ts.map +1 -0
- package/lib/typescript/src/LocationTracker/index.d.ts +22 -0
- package/lib/typescript/src/LocationTracker/index.d.ts.map +1 -0
- package/lib/typescript/src/Observer/Observer.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/api/index.d.ts +94 -0
- package/lib/typescript/src/Wallet/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/ACHAdd.d.ts +13 -0
- package/lib/typescript/src/Wallet/components/ACHAdd.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/AccountCard.d.ts +10 -0
- package/lib/typescript/src/Wallet/components/AccountCard.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/AccountLimitManager.d.ts +10 -0
- package/lib/typescript/src/Wallet/components/AccountLimitManager.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/AccountManager.d.ts +13 -0
- package/lib/typescript/src/Wallet/components/AccountManager.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/AccountSnoozeManager.d.ts +10 -0
- package/lib/typescript/src/Wallet/components/AccountSnoozeManager.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/AddressCard.d.ts +10 -0
- package/lib/typescript/src/Wallet/components/AddressCard.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/AddressManager.d.ts +23 -0
- package/lib/typescript/src/Wallet/components/AddressManager.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/DepositCard.d.ts +14 -0
- package/lib/typescript/src/Wallet/components/DepositCard.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/LinkAccountManager.d.ts +10 -0
- package/lib/typescript/src/Wallet/components/LinkAccountManager.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/ManageAccountCard.d.ts +17 -0
- package/lib/typescript/src/Wallet/components/ManageAccountCard.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts +11 -0
- package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/ManualCardAdd.d.ts +11 -0
- package/lib/typescript/src/Wallet/components/ManualCardAdd.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/MyBalance.d.ts +14 -0
- package/lib/typescript/src/Wallet/components/MyBalance.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/PayPalOrderCapture.d.ts +16 -0
- package/lib/typescript/src/Wallet/components/PayPalOrderCapture.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/RemoveAccount.d.ts +10 -0
- package/lib/typescript/src/Wallet/components/RemoveAccount.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/VerifyACHAccount.d.ts +10 -0
- package/lib/typescript/src/Wallet/components/VerifyACHAccount.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/WalletSetup.d.ts +11 -0
- package/lib/typescript/src/Wallet/components/WalletSetup.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts +16 -0
- package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts.map +1 -0
- package/lib/typescript/src/Wallet/index.d.ts +10 -0
- package/lib/typescript/src/Wallet/index.d.ts.map +1 -0
- package/lib/typescript/src/constants/colors.d.ts +3 -0
- package/lib/typescript/src/constants/colors.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/ApiOverrides/index.ts +13 -3
- package/src/Checkout/api/index.tsx +190 -0
- package/src/Checkout/components/AccountSummaryCard.tsx +169 -0
- package/src/Checkout/components/ItemSummaryCard.tsx +34 -0
- package/src/Checkout/components/OrderSummaryCard.tsx +40 -0
- package/src/Checkout/index.tsx +398 -0
- package/src/Components/Button.tsx +5 -4
- package/src/Components/Checkbox.tsx +5 -2
- package/src/Components/Icons.tsx +196 -3
- package/src/Components/Spring.tsx +4 -3
- package/src/LocationTracker/LocationStatus.tsx +96 -0
- package/src/LocationTracker/api/index.tsx +114 -0
- package/src/LocationTracker/index.tsx +130 -0
- package/src/Observer/Observer.tsx +2 -1
- package/src/Wallet/api/index.ts +461 -0
- package/src/Wallet/components/ACHAdd.tsx +49 -0
- package/src/Wallet/components/AccountCard.tsx +92 -0
- package/src/Wallet/components/AccountLimitManager.tsx +204 -0
- package/src/Wallet/components/AccountManager.tsx +103 -0
- package/src/Wallet/components/AccountSnoozeManager.tsx +150 -0
- package/src/Wallet/components/AddressCard.tsx +31 -0
- package/src/Wallet/components/AddressManager.tsx +203 -0
- package/src/Wallet/components/DepositCard.tsx +91 -0
- package/src/Wallet/components/LinkAccountManager.tsx +119 -0
- package/src/Wallet/components/ManageAccountCard.tsx +146 -0
- package/src/Wallet/components/ManualACHAdd.tsx +164 -0
- package/src/Wallet/components/ManualCardAdd.tsx +185 -0
- package/src/Wallet/components/MyBalance.tsx +64 -0
- package/src/Wallet/components/PayPalOrderCapture.tsx +59 -0
- package/src/Wallet/components/RemoveAccount.tsx +68 -0
- package/src/Wallet/components/VerifyACHAccount.tsx +140 -0
- package/src/Wallet/components/WalletSetup.tsx +197 -0
- package/src/Wallet/components/WithdrawCard.tsx +145 -0
- package/src/Wallet/index.tsx +229 -0
- package/src/constants/colors.ts +3 -0
- package/src/index.tsx +7 -2
- package/src/types.d.ts +295 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Image, Linking } from 'react-native';
|
|
3
|
+
import { Button, Text } from '../Components';
|
|
4
|
+
import Colors from '../constants/colors';
|
|
5
|
+
import { isSafari, isChrome, isIOS } from 'react-device-detect';
|
|
6
|
+
import type { LocationProps, PlayerAddressProps } from '../types';
|
|
7
|
+
|
|
8
|
+
type LocationTrackerProps = {
|
|
9
|
+
onClose: () => void,
|
|
10
|
+
permission: {
|
|
11
|
+
checked:boolean,
|
|
12
|
+
permission?: 'granted'|'denied'|'prompt'
|
|
13
|
+
},
|
|
14
|
+
location: {
|
|
15
|
+
loading: boolean,
|
|
16
|
+
error?:string,
|
|
17
|
+
coordinates:any,
|
|
18
|
+
address_results:any[],
|
|
19
|
+
player_address?:PlayerAddressProps,
|
|
20
|
+
region?:string,
|
|
21
|
+
location?:LocationProps
|
|
22
|
+
}
|
|
23
|
+
onGetLocation: () => void
|
|
24
|
+
}
|
|
25
|
+
const LocationTracker = ({ onClose, onGetLocation, permission, location }: LocationTrackerProps) => {
|
|
26
|
+
|
|
27
|
+
const { loading, error } = location;
|
|
28
|
+
|
|
29
|
+
const handleHelpMe = () => {
|
|
30
|
+
if(isSafari && isIOS){ return Linking.openURL('https://support.bettoredge.com/hc/en-us/articles/1500010390982-How-do-I-turn-on-Location-Settings-for-Apple-Safari') }
|
|
31
|
+
if(isChrome && isIOS){ return Linking.openURL('https://support.bettoredge.com/hc/en-us/articles/1500010423381-How-do-I-turn-on-Location-Settings-for-Android-Chrome') }
|
|
32
|
+
return Linking.openURL('https://support.bettoredge.com/hc/en-us/articles/1500010423381-How-do-I-turn-on-Location-Settings-for-Android-Chrome')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View>
|
|
37
|
+
{permission.permission == 'prompt' ?
|
|
38
|
+
<View style={{ padding:20 }}>
|
|
39
|
+
<View style={{ padding:10 }}>
|
|
40
|
+
<Text size={18} color={Colors.brand.midnight} weight='semibold' textAlign='center'>ALL REAL-MONEY TRANSACTIONS REQUIRE LOCATION</Text>
|
|
41
|
+
</View>
|
|
42
|
+
<View style={{ justifyContent:'center', alignItems:'center', padding:15 }}>
|
|
43
|
+
<Image
|
|
44
|
+
source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1696434494/loc_icon_qdkurk.png' }}
|
|
45
|
+
style={{ width: 80, height: 80 * 1.232 }}
|
|
46
|
+
/>
|
|
47
|
+
</View>
|
|
48
|
+
<View style={{ padding:10 }}>
|
|
49
|
+
<Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} weight='regular' textAlign='center'>When using real money, either in the form of a bet, competition or deposit/withdrawal, BettorEdge requires location services turned on to verify you are in a location where betting is permitted.</Text>
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
: permission.permission == 'denied' ?
|
|
53
|
+
<View style={{ padding:20 }}>
|
|
54
|
+
<View style={{ padding:10 }}>
|
|
55
|
+
<Text size={18} color={Colors.brand.midnight} weight='semibold' textAlign='center'>LOCATION SETTINGS ARE NOT ENABLED</Text>
|
|
56
|
+
</View>
|
|
57
|
+
<View style={{ justifyContent:'center', alignItems:'center', padding:15 }}>
|
|
58
|
+
<Image
|
|
59
|
+
source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1696434494/loc_icon_qdkurk.png' }}
|
|
60
|
+
style={{ width: 80, height: 80 * 1.232 }}
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
<View style={{ padding:10 }}>
|
|
64
|
+
<Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} weight='regular' textAlign='center'>{error ?? `We were not able to get your location. Please use the Help Me button below to troubleshoot enabling your device's location services`}</Text>
|
|
65
|
+
</View>
|
|
66
|
+
</View>
|
|
67
|
+
: permission.permission == 'granted' || location.location ?
|
|
68
|
+
<View style={{ padding:20 }}>
|
|
69
|
+
<View style={{ padding:10 }}>
|
|
70
|
+
<Text size={18} color={Colors.brand.midnight} weight='semibold' textAlign='center'>ALL REAL-MONEY TRANSACTIONS REQUIRE LOCATION</Text>
|
|
71
|
+
</View>
|
|
72
|
+
<View style={{ justifyContent:'center', alignItems:'center', padding:15 }}>
|
|
73
|
+
<Image
|
|
74
|
+
source={{ uri: location.location?.location_image }}
|
|
75
|
+
style={{ width: 100, height: 100 }}
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
78
|
+
<View style={{ padding:10 }}>
|
|
79
|
+
<Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} weight='regular' textAlign='center'>When using real money, either in the form of a bet, competition or deposit/withdrawal, BettorEdge requires location services turned on to verify you are in a location where betting is permitted.</Text>
|
|
80
|
+
</View>
|
|
81
|
+
</View>
|
|
82
|
+
:<></>}
|
|
83
|
+
{ permission.permission != 'denied' ?
|
|
84
|
+
<View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
|
|
85
|
+
<Button
|
|
86
|
+
title='CLOSE'
|
|
87
|
+
style={{ flex:1, marginRight:5 }}
|
|
88
|
+
title_color={Colors.utility.error}
|
|
89
|
+
borderWidth={1}
|
|
90
|
+
padding={15}
|
|
91
|
+
borderColor={Colors.utility.error}
|
|
92
|
+
onPress={() => onClose()}
|
|
93
|
+
/>
|
|
94
|
+
<Button
|
|
95
|
+
title={permission.permission == 'prompt' ? 'PROMPT FOR LOCATION' : 'UPDATE LOCATION'}
|
|
96
|
+
style={{ flex:3, opacity: loading ? 0.5 : 1 }}
|
|
97
|
+
loading={loading}
|
|
98
|
+
disabled={loading}
|
|
99
|
+
backgroundColor={Colors.brand.electric}
|
|
100
|
+
title_color={Colors.shades.white}
|
|
101
|
+
onPress={() => onGetLocation()}
|
|
102
|
+
/>
|
|
103
|
+
</View>
|
|
104
|
+
:
|
|
105
|
+
<View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
|
|
106
|
+
<Button
|
|
107
|
+
title='CLOSE'
|
|
108
|
+
style={{ flex:1, marginRight:5 }}
|
|
109
|
+
title_color={Colors.utility.error}
|
|
110
|
+
borderWidth={1}
|
|
111
|
+
padding={15}
|
|
112
|
+
borderColor={Colors.utility.error}
|
|
113
|
+
onPress={() => onClose()}
|
|
114
|
+
/>
|
|
115
|
+
<Button
|
|
116
|
+
title='HELP ME'
|
|
117
|
+
style={{ flex:3 }}
|
|
118
|
+
title_color={Colors.shades.white}
|
|
119
|
+
borderWidth={1}
|
|
120
|
+
padding={15}
|
|
121
|
+
backgroundColor={Colors.brand.electric}
|
|
122
|
+
onPress={() => handleHelpMe()}
|
|
123
|
+
/>
|
|
124
|
+
</View>
|
|
125
|
+
}
|
|
126
|
+
</View>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default LocationTracker
|
|
@@ -10,8 +10,9 @@ type BEAnalyticsObserverProps = {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const BEAnalyticsObserver = ({ source, session_id, distinct_id }:BEAnalyticsObserverProps) => {
|
|
13
|
+
console.log('YO')
|
|
13
14
|
const [ init_loaded, setInitLoaded ] = useState(false);
|
|
14
|
-
|
|
15
|
+
console.log('MA')
|
|
15
16
|
const device_data = deviceDetect(undefined);
|
|
16
17
|
|
|
17
18
|
useEffect(() => {
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { APIOverrides } from '../../ApiOverrides';
|
|
3
|
+
import type { ACHDetailProps, AccountActionProps, AccountLimitProps, AccountProps, AccountSnoozeProps, CardDetailProps, ItemOrderProps, ItemProps, PlayerAddressProps, PlayerDepositLimitProps, PlayerWithdrawLimitProps, WalletSettingsProps } from '../../types';
|
|
4
|
+
import type { MyPlayerProps, PlayerBalanceProps } from '../../ProfileManager/api/types';
|
|
5
|
+
import moment from 'moment-mini';
|
|
6
|
+
|
|
7
|
+
let WALLET_SVC_API = ''
|
|
8
|
+
let AUTH_SVC_API = ''
|
|
9
|
+
export { WalletApi, WalletHelpers, ItemOrderApi, ItemOrderHelpers }
|
|
10
|
+
|
|
11
|
+
const WalletApi = {
|
|
12
|
+
setEnvironment: () => {
|
|
13
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
14
|
+
WALLET_SVC_API = endpoints['WALLET_SVC_API'] as string;
|
|
15
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
16
|
+
console.log(AUTH_SVC_API)
|
|
17
|
+
},
|
|
18
|
+
getMyDetails: async():Promise<MyPlayerProps> => {
|
|
19
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/me`)
|
|
20
|
+
return resp.data.player
|
|
21
|
+
},
|
|
22
|
+
updateDefaultAccount:async(account_id:string):Promise<AccountProps[]> => {
|
|
23
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/default`, { account_id })
|
|
24
|
+
return resp.data.accounts
|
|
25
|
+
},
|
|
26
|
+
getAddressById: async(player_address_id:string):Promise<PlayerAddressProps> => {
|
|
27
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/addresses/address/${player_address_id}`)
|
|
28
|
+
return resp.data.player_address
|
|
29
|
+
},
|
|
30
|
+
getMyAddresses: async():Promise<PlayerAddressProps[]> => {
|
|
31
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/addresses/me`)
|
|
32
|
+
return resp.data.player_addresses
|
|
33
|
+
},
|
|
34
|
+
createAddress: async(player_address:PlayerAddressProps):Promise<PlayerAddressProps> => {
|
|
35
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/addresses/address/create`, { player_address })
|
|
36
|
+
return resp.data.player_address
|
|
37
|
+
},
|
|
38
|
+
deleteAddress: async(player_address_id:string):Promise<PlayerAddressProps> => {
|
|
39
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/addresses/address/delete`, { player_address_id })
|
|
40
|
+
return resp.data.player_address
|
|
41
|
+
},
|
|
42
|
+
getMyBalance: async():Promise<PlayerBalanceProps> => {
|
|
43
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/balance/me`)
|
|
44
|
+
return resp.data.player_balance
|
|
45
|
+
},
|
|
46
|
+
getMySettings: async():Promise<WalletSettingsProps> => {
|
|
47
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/settings/me`);
|
|
48
|
+
return resp.data.wallet_settings
|
|
49
|
+
},
|
|
50
|
+
agreeToTerms: async():Promise<WalletSettingsProps> => {
|
|
51
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/settings/terms/agree`)
|
|
52
|
+
return resp.data.wallet_settings
|
|
53
|
+
} ,
|
|
54
|
+
setPin: async(pin:string):Promise<WalletSettingsProps> => {
|
|
55
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/settings/pin/set`, { pin })
|
|
56
|
+
return resp.data.wallet_settings
|
|
57
|
+
},
|
|
58
|
+
changePin: async(pin:string, new_pin:string):Promise<WalletSettingsProps> => {
|
|
59
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/settings/pin/change`, { pin, new_pin })
|
|
60
|
+
return resp.data.wallet_settings
|
|
61
|
+
},
|
|
62
|
+
authenticatePin: async(pin:string):Promise<WalletSettingsProps> => {
|
|
63
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/settings/pin/authenticate`, { pin })
|
|
64
|
+
return resp.data.wallet_settings
|
|
65
|
+
},
|
|
66
|
+
getMyAccounts: async():Promise<AccountProps[]> => {
|
|
67
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/accounts/me`);
|
|
68
|
+
return resp.data.accounts
|
|
69
|
+
},
|
|
70
|
+
getMyDepositLimit: async():Promise<PlayerDepositLimitProps> => {
|
|
71
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/limits/deposit/me`)
|
|
72
|
+
return resp.data.deposit_limit
|
|
73
|
+
},
|
|
74
|
+
getMyWithdrawLimit: async():Promise<PlayerWithdrawLimitProps> => {
|
|
75
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/limits/withdraw/me`)
|
|
76
|
+
return resp.data.withdraw_limit
|
|
77
|
+
},
|
|
78
|
+
getSnoozeByAccountId: async(account_id:string):Promise<AccountSnoozeProps|undefined> => {
|
|
79
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/snoozes/account/${account_id}`);
|
|
80
|
+
return resp.data.account_snooze
|
|
81
|
+
},
|
|
82
|
+
createAccountSnooze: async(account_snooze:AccountSnoozeProps):Promise<AccountSnoozeProps> => {
|
|
83
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/snoozes/account/create`, { account_snooze })
|
|
84
|
+
return resp.data.account_snooze
|
|
85
|
+
},
|
|
86
|
+
getLimitByAccountId: async(account_id:string):Promise<AccountLimitProps|undefined> => {
|
|
87
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/limits/account/${account_id}`);
|
|
88
|
+
return resp.data.account_limit
|
|
89
|
+
},
|
|
90
|
+
createAccountLimit: async(account_limit:AccountLimitProps):Promise<AccountLimitProps> => {
|
|
91
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/limits/account/create`, { account_limit })
|
|
92
|
+
return resp.data.account_limit
|
|
93
|
+
},
|
|
94
|
+
removeAccountLimit: async(account_limit_id:string):Promise<AccountLimitProps> => {
|
|
95
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/limits/account/remove`, { account_limit_id })
|
|
96
|
+
return resp.data.account_limit
|
|
97
|
+
},
|
|
98
|
+
getAccountById: async(account_id:string):Promise<AccountProps> => {
|
|
99
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/accounts/account/${account_id}`)
|
|
100
|
+
return resp.data.account
|
|
101
|
+
},
|
|
102
|
+
removeAccount: async(account_id:string):Promise<{ account:AccountProps, ach_detail?:ACHDetailProps, card_detail?:CardDetailProps }> => {
|
|
103
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/remove`, { account_id })
|
|
104
|
+
return { account: resp.data.account, ach_detail:resp.data.ach_detail, card_detail:resp.data.card_detail }
|
|
105
|
+
},
|
|
106
|
+
addACHAccount: async(account:AccountProps, ach_detail:ACHDetailProps):Promise<{ account:AccountProps, ach_detail:ACHDetailProps }> => {
|
|
107
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/ach/add`, { account, ach_detail })
|
|
108
|
+
return { account: resp.data.account, ach_detail: resp.data.ach_detail }
|
|
109
|
+
},
|
|
110
|
+
verifyACHAccount: async(account_id:string, amount_1:number, amount_2:number):Promise<{ account:AccountProps, status:'success'|'fail' }> => {
|
|
111
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/ach/verify`, { account_id, amount_1, amount_2 })
|
|
112
|
+
return { account: resp.data.account, status:resp.data.status }
|
|
113
|
+
},
|
|
114
|
+
updateACHAccount: async(account:AccountProps, ach_detail:ACHDetailProps):Promise<{ account: AccountProps, ach_detail:ACHDetailProps }> => {
|
|
115
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/ach/update`, { account, ach_detail })
|
|
116
|
+
return resp.data
|
|
117
|
+
},
|
|
118
|
+
getACHDetailByAccountId: async(account_id:string):Promise<ACHDetailProps> => {
|
|
119
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/accounts/ach/${account_id}`)
|
|
120
|
+
return resp.data.ach_detail
|
|
121
|
+
},
|
|
122
|
+
linkACHAccount: async(account_id:string):Promise<AccountProps> => {
|
|
123
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/ach/link`, { account_id })
|
|
124
|
+
console.log(resp.data)
|
|
125
|
+
return resp.data.account
|
|
126
|
+
},
|
|
127
|
+
addCardAccount: async(account:AccountProps, card_detail:CardDetailProps):Promise<{ account:AccountProps, card_detail:CardDetailProps }> => {
|
|
128
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/card/add`, { account, card_detail })
|
|
129
|
+
return { account:resp.data.account, card_detail:resp.data.card_detail }
|
|
130
|
+
},
|
|
131
|
+
getCardDetailByAccountId: async(account_id:string):Promise<CardDetailProps> => {
|
|
132
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/accounts/card/${account_id}`)
|
|
133
|
+
return resp.data.card_detail
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const ItemOrderApi = {
|
|
138
|
+
getItemByIdentifier: async(identifier:string) => {
|
|
139
|
+
const resp = await axios.get(`${WALLET_SVC_API}/v1/items/identifier/${identifier}`)
|
|
140
|
+
return resp.data.item
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const ItemOrderHelpers = {
|
|
145
|
+
genDepositOrder : (item:ItemProps, account:AccountProps):ItemOrderProps => {
|
|
146
|
+
let amount = 25
|
|
147
|
+
let fee = account.transaction_fee * amount
|
|
148
|
+
let total_amount = amount + fee
|
|
149
|
+
return {
|
|
150
|
+
items: [{
|
|
151
|
+
item_id: item.item_id,
|
|
152
|
+
amount: amount,
|
|
153
|
+
quantity: 1
|
|
154
|
+
}],
|
|
155
|
+
type: 'wallet',
|
|
156
|
+
item_order_id: '',
|
|
157
|
+
amount,
|
|
158
|
+
total_amount,
|
|
159
|
+
description: 'One time deposit',
|
|
160
|
+
location: {},
|
|
161
|
+
region: '',
|
|
162
|
+
fee_1: "Transaction Fee",
|
|
163
|
+
fee_1_amount: fee,
|
|
164
|
+
player_id: '',
|
|
165
|
+
status: 'pending',
|
|
166
|
+
create_datetime: '',
|
|
167
|
+
last_update_datetime: ''
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
isWithdrawOrderValid: (account:AccountProps, withdraw_limit:PlayerWithdrawLimitProps, deposit_limit:PlayerDepositLimitProps, player_balance:PlayerBalanceProps, wallet_settings?:WalletSettingsProps, draft_order?:ItemOrderProps):{ available_for_withdraw:number, errors:string[]} => {
|
|
171
|
+
if(!draft_order){ return { available_for_withdraw: 0, errors:['Awaiting draft order'] } }
|
|
172
|
+
if(!wallet_settings){ return {available_for_withdraw: 0, errors: ['Awaiting players setting values'] } }
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
let errors:string[] = []
|
|
176
|
+
let amount = parseFloat(draft_order.amount as string);
|
|
177
|
+
if(isNaN(amount)){ errors.push('Invalid Amount') }
|
|
178
|
+
if(amount < 1){ errors.push('Minumim withdrawal amount is $1') }
|
|
179
|
+
if(wallet_settings.status != 'active'){ errors.push('Your account is not setup for withdraws') }
|
|
180
|
+
if(amount > player_balance.balance){ errors.push('Amount exceeds your balance amount') }
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
let transactions_remaining = withdraw_limit.withdraws_per_week - withdraw_limit.week_withdraw_count
|
|
184
|
+
if(transactions_remaining <=0){ errors.push(`Already reached your max week withdraw transactions of ${withdraw_limit.withdraws_per_week}`) }
|
|
185
|
+
let available_for_withdraw = player_balance.balance - deposit_limit.instant_deposits;
|
|
186
|
+
switch(account.account_type){
|
|
187
|
+
case 'card':
|
|
188
|
+
let card_available = withdraw_limit.card_daily_limit - withdraw_limit.last_days_card_withdraws - deposit_limit.instant_deposits
|
|
189
|
+
if(amount > card_available){ errors.push(`This amount exceeds your daily limit for card accounts`) }
|
|
190
|
+
if(!wallet_settings.allow_cards){ errors.push(`Your account does not currently allow card withdraws`) }
|
|
191
|
+
break
|
|
192
|
+
case 'ach':
|
|
193
|
+
let ach_available = withdraw_limit.ach_daily_limit - withdraw_limit.last_days_ach_withdraws - deposit_limit.instant_deposits
|
|
194
|
+
|
|
195
|
+
if(amount > ach_available){ errors.push('This amount exceeds your daily limit for ach accounts') }
|
|
196
|
+
if(account?.ach_detail?.ach_type=='manual' && !wallet_settings.allow_manual_ach){ errors.push(`Your account does not currently allow manual ACH withdraws`) }
|
|
197
|
+
break
|
|
198
|
+
case 'paypal':
|
|
199
|
+
let pp_available = withdraw_limit.card_daily_limit - withdraw_limit.last_days_card_withdraws - deposit_limit.instant_deposits
|
|
200
|
+
|
|
201
|
+
if(amount > pp_available){ errors.push(`This amount exceeds your daily limit for paypal`) }
|
|
202
|
+
if(!wallet_settings.allow_paypal){ errors.push(`Your account does not currently allow paypal withdraws`)}
|
|
203
|
+
break
|
|
204
|
+
default:
|
|
205
|
+
errors.push('This account is not eligible for withdraws');
|
|
206
|
+
break
|
|
207
|
+
}
|
|
208
|
+
return { available_for_withdraw, errors }
|
|
209
|
+
},
|
|
210
|
+
isDepositOrdervalid :(account:AccountProps, deposit_limit:PlayerDepositLimitProps, wallet_settings?:WalletSettingsProps, draft_order?:ItemOrderProps):string[] => {
|
|
211
|
+
if(!draft_order){ return ['Awaiting draft order'] }
|
|
212
|
+
if(!wallet_settings){ return ['Awaiting players setting values'] }
|
|
213
|
+
let errors:string[] = []
|
|
214
|
+
let amount = parseFloat(draft_order.amount as string);
|
|
215
|
+
if(isNaN(amount)){ errors.push('Invalid Amount') }
|
|
216
|
+
|
|
217
|
+
if(amount < 25){ errors.push('Amount must be greater than $25')}
|
|
218
|
+
if(wallet_settings.status != 'active'){ errors.push(`Your account is not setup for deposits`) }
|
|
219
|
+
switch(account.account_type){
|
|
220
|
+
case 'card':
|
|
221
|
+
let card_available = deposit_limit.card_daily_limit - deposit_limit.last_days_card_deposits
|
|
222
|
+
if(amount > card_available){ errors.push(`This amount exceeds your daily limit for card accounts`) }
|
|
223
|
+
if(!wallet_settings.allow_cards){ errors.push(`Your account does not currently allow card deposits`) }
|
|
224
|
+
break
|
|
225
|
+
case 'ach':
|
|
226
|
+
let ach_available = deposit_limit.ach_daily_limit - deposit_limit.last_days_ach_deposits
|
|
227
|
+
if(amount > ach_available){ errors.push('This amount exceeds your daily limit for ach accounts') }
|
|
228
|
+
if(account?.ach_detail?.ach_type=='manual' && !wallet_settings.allow_manual_ach){ errors.push(`Your account does not currently allow manual ACH deposits`) }
|
|
229
|
+
break
|
|
230
|
+
case 'paypal':
|
|
231
|
+
let pp_available = deposit_limit.card_daily_limit - deposit_limit.last_days_card_deposits
|
|
232
|
+
if(amount > pp_available){ errors.push(`This amount exceeds your daily limit for paypal`) }
|
|
233
|
+
if(!wallet_settings.allow_paypal){ errors.push(`Your account does not currently allow paypal deposits`)}
|
|
234
|
+
break
|
|
235
|
+
default:
|
|
236
|
+
errors.push('This account is not eligible for deposits');
|
|
237
|
+
break
|
|
238
|
+
}
|
|
239
|
+
return errors
|
|
240
|
+
},
|
|
241
|
+
genWithdrawOrder : (item:ItemProps, account:AccountProps):ItemOrderProps => {
|
|
242
|
+
let amount = 1
|
|
243
|
+
let fee = account.transaction_fee * amount
|
|
244
|
+
let total_amount = amount + fee
|
|
245
|
+
return {
|
|
246
|
+
items: [{
|
|
247
|
+
item_id: item.item_id,
|
|
248
|
+
amount: amount,
|
|
249
|
+
quantity: 1
|
|
250
|
+
}],
|
|
251
|
+
type: 'wallet',
|
|
252
|
+
item_order_id: '',
|
|
253
|
+
amount,
|
|
254
|
+
total_amount,
|
|
255
|
+
description: item.description,
|
|
256
|
+
location: {},
|
|
257
|
+
region: '',
|
|
258
|
+
fee_1: "Transaction Fee",
|
|
259
|
+
fee_1_amount: fee,
|
|
260
|
+
player_id: '',
|
|
261
|
+
status: 'pending',
|
|
262
|
+
create_datetime: '',
|
|
263
|
+
last_update_datetime: ''
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
getDepositAvailable: (deposit_limit:PlayerDepositLimitProps, account:AccountProps) => {
|
|
268
|
+
let deposit_available = 0
|
|
269
|
+
if(deposit_limit){
|
|
270
|
+
deposit_available = deposit_limit.card_daily_limit - deposit_limit.last_days_card_deposits
|
|
271
|
+
if(account?.account_type == 'ach'){
|
|
272
|
+
deposit_available = deposit_limit.ach_daily_limit - deposit_limit.last_days_ach_deposits
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return deposit_available
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const WalletHelpers = {
|
|
280
|
+
isWalletAuthenticated: (wallet_settings:WalletSettingsProps):boolean => {
|
|
281
|
+
if(!wallet_settings.agreed_to_terms || !wallet_settings.pin || !wallet_settings.auth_end_datetime || moment().isAfter(moment(wallet_settings.auth_end_datetime))){ return false }
|
|
282
|
+
return true
|
|
283
|
+
},
|
|
284
|
+
isNumber(value?: string | number): boolean
|
|
285
|
+
{
|
|
286
|
+
return ((value != null) &&
|
|
287
|
+
(value !== '') &&
|
|
288
|
+
!isNaN(Number(value.toString())));
|
|
289
|
+
},
|
|
290
|
+
getEmptyCardAccount: ():AccountProps => {
|
|
291
|
+
return {
|
|
292
|
+
account_id: '',
|
|
293
|
+
account_type: 'card',
|
|
294
|
+
player_id: '',
|
|
295
|
+
transaction_fee: 0.045,
|
|
296
|
+
create_datetime:'',
|
|
297
|
+
last_update_datetime: '',
|
|
298
|
+
status: 'pending',
|
|
299
|
+
account_label: ''
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
getCardBrandFromNumber: (card_number:string):string => {
|
|
303
|
+
if(!card_number){ return '' }
|
|
304
|
+
let first_number = card_number[0]
|
|
305
|
+
switch(first_number){
|
|
306
|
+
case '3': return 'AMEX'
|
|
307
|
+
case '4': return 'VISA'
|
|
308
|
+
case '5': return 'MASTERCARD'
|
|
309
|
+
case '6': return 'DISCOVER'
|
|
310
|
+
default: return ''
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
getEmptyCardDetails:():CardDetailProps => {
|
|
314
|
+
return {
|
|
315
|
+
account_id: '',
|
|
316
|
+
card_detail_id: '',
|
|
317
|
+
first_name: '',
|
|
318
|
+
last_name: '',
|
|
319
|
+
card_number:'',
|
|
320
|
+
create_datetime:'',
|
|
321
|
+
last_update_datetime:'',
|
|
322
|
+
masked_card_number: '',
|
|
323
|
+
expiration_date: '',
|
|
324
|
+
encryption_iv:'',
|
|
325
|
+
cvv: '',
|
|
326
|
+
status: 'active'
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
isCardValid: (card_detail:CardDetailProps) => {
|
|
330
|
+
let valid = {
|
|
331
|
+
valid: false,
|
|
332
|
+
card_number: WalletHelpers.isNumberValid(card_detail.card_number),
|
|
333
|
+
expiration_date: WalletHelpers.isExpireValid(card_detail.expiration_date),
|
|
334
|
+
first_name: card_detail.first_name.length > 0 ? true : false,
|
|
335
|
+
last_name: card_detail.last_name.length > 0 ? true : false
|
|
336
|
+
}
|
|
337
|
+
if(valid.card_number && valid.expiration_date && valid.first_name && valid.last_name){ valid.valid = true }
|
|
338
|
+
return valid
|
|
339
|
+
},
|
|
340
|
+
isNumberValid: (card_number:string) => {
|
|
341
|
+
if(isNaN(parseInt(card_number))){ return false }
|
|
342
|
+
|
|
343
|
+
let brand = WalletHelpers.getCardBrandFromNumber(card_number)
|
|
344
|
+
switch(brand){
|
|
345
|
+
case 'AMEX':
|
|
346
|
+
if(card_number.length != 15){ return false }
|
|
347
|
+
return true
|
|
348
|
+
default:
|
|
349
|
+
if(card_number.length != 16){ return false }
|
|
350
|
+
return true
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
isExpireValid : (expiry:string) => {
|
|
354
|
+
if(expiry.length != 7){ return false }
|
|
355
|
+
let moment_date = moment(expiry, 'MM/YYYY')
|
|
356
|
+
if(!moment_date.isValid()){ return false }
|
|
357
|
+
if(moment_date.isBefore(moment())){ return false }
|
|
358
|
+
return true
|
|
359
|
+
},
|
|
360
|
+
formatCardNumber : (card_number:string) => {
|
|
361
|
+
let brand = WalletHelpers.getCardBrandFromNumber(card_number)
|
|
362
|
+
if(!brand){ return card_number }
|
|
363
|
+
let split_number = card_number.split('')
|
|
364
|
+
let fcn = ''
|
|
365
|
+
switch(brand){
|
|
366
|
+
case 'AMEX':
|
|
367
|
+
split_number.map((n, i) => {
|
|
368
|
+
|
|
369
|
+
if(i === 4 || i === 10){ fcn += ` ${n}` }
|
|
370
|
+
else { fcn+= n }
|
|
371
|
+
})
|
|
372
|
+
break
|
|
373
|
+
default:
|
|
374
|
+
split_number.map((n, i) => {
|
|
375
|
+
if(i === 4 || i === 8 || i === 12){ fcn += ` ${n}` }
|
|
376
|
+
else { fcn += n }
|
|
377
|
+
})
|
|
378
|
+
break
|
|
379
|
+
}
|
|
380
|
+
return fcn
|
|
381
|
+
},
|
|
382
|
+
unformatCardNumber: (card_number:string) => {
|
|
383
|
+
return card_number.replace(/\s/g, "");
|
|
384
|
+
},
|
|
385
|
+
getEmptyACHAccount:():AccountProps => {
|
|
386
|
+
return {
|
|
387
|
+
account_id: '',
|
|
388
|
+
account_type: 'ach',
|
|
389
|
+
transaction_fee: 0,
|
|
390
|
+
player_id: '',
|
|
391
|
+
create_datetime:'',
|
|
392
|
+
last_update_datetime: '',
|
|
393
|
+
status: 'pending',
|
|
394
|
+
account_label: ''
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
getEmptyACHDetail:():ACHDetailProps => {
|
|
398
|
+
return {
|
|
399
|
+
account_id: '',
|
|
400
|
+
ach_detail_id:'',
|
|
401
|
+
ach_type:'manual',
|
|
402
|
+
create_datetime:'',
|
|
403
|
+
account_type: 'checking',
|
|
404
|
+
last_update_datetime:'',
|
|
405
|
+
bank_name: '',
|
|
406
|
+
routing_number: '',
|
|
407
|
+
account_number: '',
|
|
408
|
+
external_id: '',
|
|
409
|
+
payment_provider:'payliance'
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
getAccountOptions: (account:AccountProps):AccountActionProps[] => {
|
|
413
|
+
if(!account){ console.log('') }
|
|
414
|
+
return [
|
|
415
|
+
{ action_id: '1', action_type: 'deposit', action_title: 'Deposit Funds', action_description: 'Deposit to your BettorEdge balance using this account' },
|
|
416
|
+
{ action_id: '2', action_type: 'withdraw', action_title: 'Withdraw Funds', action_description: 'Withdraw funds to this bank account from your BettorEdge balance' },
|
|
417
|
+
{ action_id: '3', action_type: 'limits', action_title: 'Account Limits', action_description: 'Set personal deposit limits to manage how much you use BettorEdge' },
|
|
418
|
+
{ action_id: '4', action_type: 'snoozes', action_title: 'Snooze Account', action_description: 'Set snooze for this account to take a break from BettorEdge' },
|
|
419
|
+
{ action_id: '5', action_type: 'remove', action_title: 'Remove Account', action_description: 'Remove and delete this account from your profile' },
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
/**
|
|
423
|
+
* Get the frequency from the days
|
|
424
|
+
* @param days
|
|
425
|
+
* @returns
|
|
426
|
+
*/
|
|
427
|
+
getFrequencyFromDays:(days:number):string => {
|
|
428
|
+
switch(days){
|
|
429
|
+
case 1: return 'Daily'
|
|
430
|
+
case 7: return 'Weekly'
|
|
431
|
+
case 30: return 'Monthly'
|
|
432
|
+
default: return 'Daily'
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
getEmptyAddress : ():PlayerAddressProps => {
|
|
437
|
+
return {
|
|
438
|
+
player_address_id: '',
|
|
439
|
+
name: '',
|
|
440
|
+
street: '',
|
|
441
|
+
state: '',
|
|
442
|
+
city: '',
|
|
443
|
+
country: 'US',
|
|
444
|
+
type: 'billing',
|
|
445
|
+
zip: '',
|
|
446
|
+
player_id :'',
|
|
447
|
+
create_datetime: '',
|
|
448
|
+
last_update_datetime:'',
|
|
449
|
+
status:'active'
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
isAddressValid: (address?:PlayerAddressProps):string[] => {
|
|
453
|
+
let errors:string[] = []
|
|
454
|
+
if(!address){ return ['There is no address'] }
|
|
455
|
+
const { street, city, country, zip, state, name } = address
|
|
456
|
+
if(street == '' || city == '' || country == '' || zip == '' || state == '' || name == ''){ errors.push('Please complete all required fields') }
|
|
457
|
+
if(state.length != 2){ errors.push('State Codes must be 2 letters') }
|
|
458
|
+
return errors
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import type { MyPlayerProps } 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 AccountAddProps = {
|
|
10
|
+
player:MyPlayerProps,
|
|
11
|
+
accounts:AccountProps[],
|
|
12
|
+
walkthrough?:boolean,
|
|
13
|
+
onClose: () => void,
|
|
14
|
+
onNext: () => void,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const ACHAdd = ({ onClose, onNext, walkthrough }:AccountAddProps) => {
|
|
18
|
+
//const [ loading, setLoading ] = useState(false);
|
|
19
|
+
//const [ add_type, setAddType ] = useState('manual');
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<View style={{ flex:1 }}>
|
|
23
|
+
<View style={{ padding:20 }}>
|
|
24
|
+
<Text size={30} color={Colors.brand.midnight} weight='bold'>GET ACCESS TO YOUR WINNINGS</Text>
|
|
25
|
+
<Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>At BettorEdge - we celebrate withdraws! In order to move funds out of your BettorEdge account, we need to link an eligible bank account.</Text>
|
|
26
|
+
</View>
|
|
27
|
+
|
|
28
|
+
{walkthrough ?
|
|
29
|
+
<View nativeID='action_row' style={{ flexDirection:'row', justifyContent:'space-between', padding:10 }}>
|
|
30
|
+
<Button
|
|
31
|
+
title='EXIT SETUP'
|
|
32
|
+
title_color={Colors.utility.error}
|
|
33
|
+
backgroundColor='transparent'
|
|
34
|
+
onPress={() => onClose()}
|
|
35
|
+
/>
|
|
36
|
+
<TouchableOpacity
|
|
37
|
+
style={button_styles.wizard_valid}
|
|
38
|
+
onPress={() => onNext()}
|
|
39
|
+
//disabled={loading}
|
|
40
|
+
>
|
|
41
|
+
<Icons.ChevronIcon size={20} direction='right' color={Colors.brand.midnight}/>
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
</View>
|
|
44
|
+
:<></>}
|
|
45
|
+
</View>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default ACHAdd
|