be-components 4.8.8 → 4.8.9
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/Wallet/api/index.js +2 -1
- package/lib/commonjs/Wallet/api/index.js.map +1 -1
- package/lib/commonjs/Wallet/components/DepositCard.js +344 -140
- package/lib/commonjs/Wallet/components/DepositCard.js.map +1 -1
- package/lib/commonjs/Wallet/components/WithdrawCard.js +263 -206
- package/lib/commonjs/Wallet/components/WithdrawCard.js.map +1 -1
- package/lib/module/Wallet/api/index.js +2 -1
- package/lib/module/Wallet/api/index.js.map +1 -1
- package/lib/module/Wallet/components/DepositCard.js +346 -142
- package/lib/module/Wallet/components/DepositCard.js.map +1 -1
- package/lib/module/Wallet/components/WithdrawCard.js +264 -207
- package/lib/module/Wallet/components/WithdrawCard.js.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/components/DepositCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/components/WithdrawCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/components/DepositCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/components/WithdrawCard.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/components/DepositCard.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Wallet/api/index.ts +2 -1
- package/src/Wallet/components/DepositCard.tsx +173 -84
- package/src/Wallet/components/WithdrawCard.tsx +106 -64
package/src/Wallet/api/index.ts
CHANGED
|
@@ -226,7 +226,8 @@ const ItemOrderHelpers = {
|
|
|
226
226
|
|
|
227
227
|
let transactions_remaining = withdraw_limit.withdraws_per_week - withdraw_limit.week_withdraw_count
|
|
228
228
|
if(transactions_remaining <=0){ errors.push(`Already reached your max week withdraw transactions of ${withdraw_limit.withdraws_per_week}`) }
|
|
229
|
-
let
|
|
229
|
+
let balance = Math.floor(player_balance.balance * 100) / 100
|
|
230
|
+
let available_for_withdraw = balance - deposit_limit.instant_deposits;
|
|
230
231
|
switch(account.account_type){
|
|
231
232
|
case 'card':
|
|
232
233
|
let card_available = withdraw_limit.card_daily_limit - withdraw_limit.last_days_card_withdraws
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { FlatList, Image, Keyboard, Pressable } from "react-native";
|
|
3
3
|
import type { AccountProps, AccountSnoozeProps, CodeRequestProps, FocusPositionProps, ItemOrderProps, MyPlayerProps, PlayerDepositLimitProps, PlayerReferralProps, PromoProps, PublicPlayerProps, RewardOptionProps, WalletSettingsProps } from '../../types';
|
|
4
4
|
import { ItemOrderApi, ItemOrderHelpers, WalletApi } from '../api';
|
|
5
|
-
import { Icons } from '../../Components';
|
|
5
|
+
import { Checkbox, Icons } from '../../Components';
|
|
6
6
|
import { Button, Text, TextInput, View } from '../../Components/Themed';
|
|
7
7
|
import { useColors } from '../../constants/useColors';
|
|
8
8
|
|
|
@@ -22,10 +22,11 @@ type DepositCardProps = {
|
|
|
22
22
|
onTransact:(draft_order:ItemOrderProps, account_id?:string) => void,
|
|
23
23
|
onCancel:() => void
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
const sections = [ 'header', 'input', 'limits' ]
|
|
26
26
|
const DepositCard = ({ wallet_settings, code_details, account, deposit_limit, onFocusPosition, onTransact, onCancel }:DepositCardProps) => {
|
|
27
27
|
const Colors = useColors();
|
|
28
28
|
const [ draft_order, setDraftOrder ] = useState<ItemOrderProps>();
|
|
29
|
+
const [ instant_disclaimer, setInstantDisclaimer ] = useState(false);
|
|
29
30
|
const [ account_snooze, setAccountSnooze ] = useState<AccountSnoozeProps>();
|
|
30
31
|
|
|
31
32
|
useEffect(() => {
|
|
@@ -47,115 +48,203 @@ const DepositCard = ({ wallet_settings, code_details, account, deposit_limit, on
|
|
|
47
48
|
let errors = ItemOrderHelpers.isDepositOrdervalid(account, deposit_limit, wallet_settings, draft_order)
|
|
48
49
|
if(account_snooze?.status == 'active'){ errors.push('This account is currently snoozing and cannot be used to deposit') }
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
|
|
52
|
+
let order_amount = parseFloat(draft_order?.amount as string);
|
|
53
|
+
let ach_daily_avail = deposit_limit.ach_daily_limit - deposit_limit.last_days_ach_deposits
|
|
54
|
+
let card_daily_avail = deposit_limit.card_daily_limit - deposit_limit.last_days_card_deposits
|
|
55
|
+
|
|
56
|
+
const instant_alert = errors.length == 0 && order_amount > deposit_limit.instant_available ? true : false
|
|
57
|
+
const instant_confirmed = !instant_alert ? true : instant_alert && instant_disclaimer ? true : false
|
|
58
|
+
|
|
59
|
+
const renderSections = (data:{ item:string, index:number }) => {
|
|
60
|
+
switch(data.item){
|
|
61
|
+
case 'header':
|
|
62
|
+
return (
|
|
63
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:15 }}>
|
|
64
|
+
<View transparent style={{flex:1}}>
|
|
65
|
+
<Text size={20} theme='h1'>MAKE A DEPOSIT</Text>
|
|
66
|
+
<Text style={{ marginTop:5}} theme='description'>In order to participate in real-money activities, you will need to fund your BettorEdge Wallet. Please enter the amount you wish to deposit below</Text>
|
|
67
|
+
</View>
|
|
68
|
+
</View>
|
|
69
|
+
)
|
|
70
|
+
case 'input':
|
|
71
|
+
if(!draft_order){ return <></> }
|
|
72
|
+
return (
|
|
73
|
+
<View nativeID='deposit_amount' style={{ justifyContent:'center', alignItems:'center', padding:20 }}>
|
|
74
|
+
<Text style={{ marginBottom:15 }} size={14} theme='description'>Minumum $25 / Maximum ${ItemOrderHelpers.getDepositAvailable(deposit_limit, account).toFixed(2)}</Text>
|
|
75
|
+
<TextInput
|
|
76
|
+
style={{ flexGrow:1, width:200, textAlign:'center', color:Colors.text.success, fontSize:28 }}
|
|
77
|
+
placeholder='25'
|
|
78
|
+
onFocusPosition={onFocusPosition}
|
|
79
|
+
keyboardType='decimal-pad'
|
|
80
|
+
value={draft_order.amount as string}
|
|
81
|
+
onChangeText={(text) => setDraftOrder({ ...draft_order, amount:text })}
|
|
82
|
+
/>
|
|
83
|
+
<Text style={{ marginTop:15 }} size={14} theme='warning' textAlign='center'>*All deposits are held for {deposit_limit.hold_days} days before they are eligible for withdraw</Text>
|
|
84
|
+
|
|
85
|
+
</View>
|
|
86
|
+
)
|
|
87
|
+
case 'limits':
|
|
88
|
+
return (
|
|
89
|
+
<Pressable onPress={() => Keyboard.dismiss()}>
|
|
90
|
+
<View float style={{ margin:10 }}>
|
|
91
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', borderTopRightRadius:8, borderTopLeftRadius:8, padding:10 }}>
|
|
92
|
+
<View transparent style={{ flex:1 }}>
|
|
93
|
+
<Text theme='h1'>My Deposit Limits</Text>
|
|
94
|
+
</View>
|
|
95
|
+
</View>
|
|
96
|
+
<View transparent type='body'>
|
|
97
|
+
{account.account_type == 'ach' ?
|
|
98
|
+
<View type='row' style={{ padding:10 }}>
|
|
99
|
+
<Text theme='description' style={{ flex:1 }}>ACH Daily Limit</Text>
|
|
100
|
+
<Text theme='success'>${deposit_limit.ach_daily_limit.toFixed(2)}</Text>
|
|
101
|
+
</View>
|
|
102
|
+
:<></>}
|
|
103
|
+
{account.account_type == 'ach' ?
|
|
104
|
+
<View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light}}>
|
|
105
|
+
<Text theme='description' style={{ flex:1 }}>Rolling 24 hour deposits</Text>
|
|
106
|
+
<Text theme='error'>(${deposit_limit.last_days_ach_deposits.toFixed(2)})</Text>
|
|
107
|
+
</View>
|
|
108
|
+
:<></>}
|
|
109
|
+
{account.account_type == 'ach' ?
|
|
110
|
+
<View type='row' style={{ padding:20 }}>
|
|
111
|
+
<Text theme='h1' style={{ flex:1 }}>ACH Available</Text>
|
|
112
|
+
<Text theme='h1' color={ach_daily_avail > 25 ? Colors.text.success : Colors.text.error}>${ach_daily_avail.toFixed(2)}</Text>
|
|
113
|
+
</View>
|
|
114
|
+
:<></>}
|
|
115
|
+
{account.account_type != 'ach' ?
|
|
116
|
+
<View type='row' style={{ padding:10 }}>
|
|
117
|
+
<Text theme='description' style={{ flex:1 }}>Daily Limit</Text>
|
|
118
|
+
<Text theme='success'>${deposit_limit.card_daily_limit.toFixed(2)}</Text>
|
|
119
|
+
</View>
|
|
120
|
+
:<></>}
|
|
121
|
+
{account.account_type != 'ach' ?
|
|
122
|
+
<View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light}}>
|
|
123
|
+
<Text theme='description' style={{ flex:1 }}>Rolling 24 hour deposits</Text>
|
|
124
|
+
<Text theme='error'>(${deposit_limit.last_days_card_deposits.toFixed(2)})</Text>
|
|
125
|
+
</View>
|
|
126
|
+
:<></>}
|
|
127
|
+
{account.account_type != 'ach' ?
|
|
128
|
+
<View type='row' style={{ padding:20 }}>
|
|
129
|
+
<Text theme='h1' style={{ flex:1 }}>Available</Text>
|
|
130
|
+
<Text theme='h1' color={card_daily_avail > 25 ? Colors.text.success : Colors.text.error}>${card_daily_avail.toFixed(2)}</Text>
|
|
131
|
+
</View>
|
|
132
|
+
:<></>}
|
|
133
|
+
</View>
|
|
134
|
+
<View type='footer' style={{ padding:10, flexDirection:'row', alignItems:'center', borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
135
|
+
<View transparent style={{ flex:1, marginRight:5 }}>
|
|
136
|
+
<Text theme='h1'>Instant Available</Text>
|
|
137
|
+
<Text style={{ marginTop:2 }} theme='description'>The amount that can be instantly available in your account</Text>
|
|
138
|
+
</View>
|
|
139
|
+
<Text theme='h1' color={deposit_limit.instant_available > 0 ? Colors.text.success : Colors.text.error}>${deposit_limit.instant_available.toFixed(2)}</Text>
|
|
140
|
+
</View>
|
|
141
|
+
</View>
|
|
142
|
+
</Pressable>
|
|
143
|
+
)
|
|
144
|
+
case 'referral':
|
|
145
|
+
if(!code_details?.code_request?.pending_deposit){ return <></> }
|
|
146
|
+
if(!code_details.promo || !code_details.referrer){ return <></> }
|
|
147
|
+
if(!['referral_code','referral_sweepstakes'].includes(code_details.promo.type)){ return <></> }
|
|
148
|
+
return (
|
|
149
|
+
<View style={{ margin:15, flexDirection:'row' }}>
|
|
150
|
+
<View style={{ justifyContent:'center' }}>
|
|
151
|
+
{code_details.referrer?.profile_pic?
|
|
152
|
+
<Image
|
|
153
|
+
source={{ uri: code_details.referrer.profile_pic }}
|
|
154
|
+
style={{ height: 60, width:60, borderRadius:4 }}
|
|
155
|
+
resizeMode='cover'
|
|
156
|
+
/>
|
|
157
|
+
:
|
|
158
|
+
<Icons.GiftIcon size={40} color={Colors.text.gold} />
|
|
159
|
+
}
|
|
160
|
+
</View>
|
|
161
|
+
<View style={{flex:1, backgroundColor:Colors.absolutes.incentive.gold_faded, padding:10 }}>
|
|
162
|
+
<Text style={{ paddingBottom:10, borderBottomWidth:1, borderBottomColor:Colors.borders.light }} theme='h1'>Give back to {code_details.referrer?.username}</Text>
|
|
163
|
+
<Text style={{ paddingTop:5 }} size={12} theme='h2'>Make a qualifying deposit and {code_details.referrer.username} will receive a reward!</Text>
|
|
164
|
+
</View>
|
|
165
|
+
</View>
|
|
166
|
+
)
|
|
167
|
+
default: return <></>
|
|
168
|
+
}
|
|
56
169
|
}
|
|
57
|
-
|
|
58
|
-
let order_amount = parseFloat(draft_order.amount as string);
|
|
170
|
+
|
|
59
171
|
|
|
60
172
|
return (
|
|
61
173
|
<View style={{ flex:1 }}>
|
|
62
|
-
<View style={{ flex:1 }}>
|
|
63
|
-
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:15 }}>
|
|
64
|
-
<View transparent style={{flex:1}}>
|
|
65
|
-
<Text size={20} theme='h1'>MAKE A DEPOSIT</Text>
|
|
66
|
-
<Text style={{ marginTop:5}} theme='description'>In order to participate in real-money activities, you will need to fund your BettorEdge Wallet. Please enter the amount you wish to deposit below</Text>
|
|
67
|
-
</View>
|
|
68
|
-
</View>
|
|
69
174
|
<View style={{ flex:1 }}>
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</View>
|
|
83
|
-
<Pressable style={{ flex:1 }} onPress={() => Keyboard.dismiss()}>
|
|
84
|
-
|
|
85
|
-
{errors.length == 0 && order_amount > deposit_limit.instant_available ?
|
|
86
|
-
<View float nativeID='instant_available' style={{ padding:5, borderRadius:8, margin:10 }}>
|
|
87
|
-
<View style={{ padding:10, borderBottomWidth:1, borderBottomColor:Colors.borders.light }}>
|
|
88
|
-
<View style={{flexDirection:'row', marginBottom:5 }}>
|
|
89
|
-
<Icons.AlertIcon color={Colors.text.warning} size={16}/>
|
|
90
|
-
<Text style={{ marginLeft:10 }} size={14} color={Colors.text.warning} weight='bold'>INSTANT DEPOSIT NOTICE</Text>
|
|
175
|
+
<FlatList
|
|
176
|
+
data={sections}
|
|
177
|
+
key={'deposit_sections'}
|
|
178
|
+
keyExtractor={item => item}
|
|
179
|
+
renderItem={renderSections}
|
|
180
|
+
/>
|
|
181
|
+
{instant_alert ?
|
|
182
|
+
<View float nativeID='instant_available' style={{ borderBottomRightRadius:0, borderBottomLeftRadius:0 }}>
|
|
183
|
+
<View transparent style={{ borderTopRightRadius:8, borderTopLeftRadius:8, backgroundColor:Colors.text.warning, borderBottomWidth:1, borderBottomColor:Colors.borders.light }}>
|
|
184
|
+
<View transparent style={{flexDirection:'row', padding:18 }}>
|
|
185
|
+
<Icons.AlertIcon color={Colors.text.white} size={16}/>
|
|
186
|
+
<Text theme='h1' style={{ marginLeft:10 }} size={14} color={Colors.text.white}>INSTANT DEPOSIT NOTICE</Text>
|
|
91
187
|
</View>
|
|
92
|
-
<Text size={14} theme='description'>Transactions take time to leave your account and settle in ours. In order to get you started before they arrive, we allow for some to be instantly available. The remainder is available after settlement.</Text>
|
|
93
188
|
</View>
|
|
94
|
-
<View style={{ padding:5 }}>
|
|
95
|
-
<View style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
|
|
189
|
+
<View transparent style={{ padding:5 }}>
|
|
190
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
|
|
96
191
|
<Text style={{ flex:1 }} size={14} theme='h2'>Available Instantly</Text>
|
|
97
192
|
<Text size={14} theme='h1'>${deposit_limit.instant_available.toFixed(2)}</Text>
|
|
98
193
|
</View>
|
|
99
|
-
<View style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
|
|
194
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
|
|
100
195
|
<Text style={{ flex:1 }} theme='h2'>Available after settlement ({deposit_limit.hold_days} days)</Text>
|
|
101
196
|
<Text size={14} theme='h1'>${(order_amount - deposit_limit.instant_available).toFixed(2)}</Text>
|
|
102
197
|
</View>
|
|
103
|
-
<View style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
|
|
198
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
|
|
104
199
|
<Text style={{ flex:1 }} theme='h2'>Total Deposit</Text>
|
|
105
200
|
<Text size={14} theme='h1'>${order_amount.toFixed(2)}</Text>
|
|
106
201
|
</View>
|
|
107
202
|
</View>
|
|
203
|
+
<Button style={{ borderRadius:0, flexDirection:'row', alignItems:'center', padding:14, backgroundColor:Colors.views.footer }} onPress={() => setInstantDisclaimer(!instant_disclaimer)}>
|
|
204
|
+
<Checkbox color={Colors.text.action} disabled checked={instant_disclaimer} onSelect={() => console.log('')} />
|
|
205
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
206
|
+
<Text size={14} color={Colors.text.action} theme='description'>I understand that ${deposit_limit.instant_available.toFixed(2)} will instantly be added and ${(order_amount - deposit_limit.instant_available).toFixed(2)} will be added after {deposit_limit.hold_days} days.</Text>
|
|
207
|
+
</View>
|
|
208
|
+
</Button>
|
|
108
209
|
</View>
|
|
109
|
-
:<></>}
|
|
210
|
+
:<></>}
|
|
110
211
|
{errors.length > 0 ?
|
|
111
|
-
<View float style={{
|
|
112
|
-
<
|
|
212
|
+
<View float nativeID='errors' style={{ borderBottomRightRadius:0, borderBottomLeftRadius:0 }}>
|
|
213
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:15, borderTopRightRadius:8, borderTopLeftRadius:8, backgroundColor:Colors.text.error, borderBottomWidth:1, borderBottomColor:Colors.borders.light }}>
|
|
214
|
+
<Icons.AlertIcon color={Colors.text.white} size={24}/>
|
|
215
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
216
|
+
<Text theme='h1' size={14} color={Colors.text.white}>ERRORS</Text>
|
|
217
|
+
<Text style={{ marginTop: 3}} theme='description' color={Colors.text.white}>Please fix the following before continuing</Text>
|
|
218
|
+
</View>
|
|
219
|
+
</View>
|
|
220
|
+
<View transparent style={{ padding:10 }}>
|
|
113
221
|
{errors.map(e => {
|
|
114
222
|
return (
|
|
115
|
-
<Text size={14} color={Colors.text.
|
|
223
|
+
<Text size={14} theme='h2' color={Colors.text.error}>{e}</Text>
|
|
116
224
|
)
|
|
117
225
|
})}
|
|
226
|
+
</View>
|
|
118
227
|
</View>
|
|
119
228
|
:<></>}
|
|
120
|
-
</Pressable>
|
|
121
229
|
</View>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
<Text style={{ paddingBottom:10, borderBottomWidth:1, borderBottomColor:Colors.borders.light }} theme='h1'>Give back to {code_details.referrer?.username}</Text>
|
|
137
|
-
<Text style={{ paddingTop:5 }} size={12} theme='h2'>Make a qualifying deposit and {code_details.referrer.username} will receive a reward!</Text>
|
|
138
|
-
</View>
|
|
230
|
+
<View type='footer' style={{ flexDirection:'row', padding:20 }}>
|
|
231
|
+
<Button
|
|
232
|
+
style={{ flex:1, marginRight:5, opacity: 1 }}
|
|
233
|
+
title={'CANCEL'}
|
|
234
|
+
type='close'
|
|
235
|
+
onPress={() => onCancel()}
|
|
236
|
+
/>
|
|
237
|
+
<Button
|
|
238
|
+
style={{ flex:3, opacity: errors.length > 0 || !instant_confirmed ? 0.5: 1 }}
|
|
239
|
+
disabled={errors.length > 0 || !instant_confirmed ? true : false}
|
|
240
|
+
title={'REVIEW DEPOSIT'}
|
|
241
|
+
type='success'
|
|
242
|
+
onPress={() => handleTransact()}
|
|
243
|
+
/>
|
|
139
244
|
</View>
|
|
140
|
-
:<></>}
|
|
141
|
-
<View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
|
|
142
|
-
<Button
|
|
143
|
-
style={{ flex:1, marginRight:5, opacity: 1 }}
|
|
144
|
-
title={'CANCEL'}
|
|
145
|
-
type='close'
|
|
146
|
-
onPress={() => onCancel()}
|
|
147
|
-
/>
|
|
148
|
-
<Button
|
|
149
|
-
style={{ flex:3, opacity: errors.length > 0 ? 0.5: 1 }}
|
|
150
|
-
disabled={errors.length > 0 ? true : false}
|
|
151
|
-
title={'REVIEW DEPOSIT'}
|
|
152
|
-
type='success'
|
|
153
|
-
onPress={() => handleTransact()}
|
|
154
|
-
/>
|
|
155
|
-
</View>
|
|
156
|
-
</View>
|
|
157
245
|
</View>
|
|
158
246
|
)
|
|
159
247
|
}
|
|
160
248
|
|
|
161
|
-
export default DepositCard
|
|
249
|
+
export default DepositCard
|
|
250
|
+
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { ActivityIndicator, Keyboard, Pressable } from "react-native";
|
|
2
|
+
import { ActivityIndicator, FlatList, Keyboard, Pressable } from "react-native";
|
|
3
3
|
import type { AccountProps, FocusPositionProps, ItemOrderProps, MyPlayerProps, PlayerBalanceProps, PlayerDepositLimitProps, PlayerWithdrawLimitProps, WalletSettingsProps } from '../../types';
|
|
4
4
|
import { ItemOrderApi, ItemOrderHelpers } from '../api';
|
|
5
5
|
import { Button, Text, TextInput, View } from '../../Components/Themed';
|
|
6
6
|
import { useColors } from '../../constants/useColors';
|
|
7
|
+
import { Icons } from '../../Components';
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
type WithdrawCardProps = {
|
|
@@ -17,6 +18,7 @@ type WithdrawCardProps = {
|
|
|
17
18
|
onTransact:(draft_order:ItemOrderProps) => void,
|
|
18
19
|
onCancel:() => void
|
|
19
20
|
}
|
|
21
|
+
const sections = ['header','input','limits']
|
|
20
22
|
const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, withdraw_limit, onFocusPosition, deposit_limit , onCancel}:WithdrawCardProps) => {
|
|
21
23
|
const Colors = useColors();
|
|
22
24
|
const [ draft_order, setDraftOrder ] = useState<ItemOrderProps>();
|
|
@@ -40,6 +42,94 @@ const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, wi
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
|
|
45
|
+
let balance = Math.floor(player_balance.balance * 100) / 100
|
|
46
|
+
let limit_available = withdraw_limit.ach_daily_limit - withdraw_limit.last_days_ach_withdraws
|
|
47
|
+
|
|
48
|
+
const renderSections = (data: { item: string, index:number }) => {
|
|
49
|
+
switch(data.item){
|
|
50
|
+
case 'header':
|
|
51
|
+
return (
|
|
52
|
+
<View nativeID='deposit_rules' style={{ padding:10 }}>
|
|
53
|
+
<Text size={28} textAlign='center' theme='h1'>Withdraw to your bank</Text>
|
|
54
|
+
<Text style={{ marginTop:10 }} size={14} textAlign='center' theme='description'>Withdraws can take up to 3 business days</Text>
|
|
55
|
+
</View>
|
|
56
|
+
)
|
|
57
|
+
case 'input':
|
|
58
|
+
if(!draft_order){ return <></> }
|
|
59
|
+
return (
|
|
60
|
+
<View nativeID='deposit_amount' style={{ justifyContent:'center', alignItems:'center', padding:20 }}>
|
|
61
|
+
<TextInput
|
|
62
|
+
style={{ flexGrow:1, width:200, textAlign:'center', color:Colors.text.success, fontSize:28 }}
|
|
63
|
+
placeholder='0'
|
|
64
|
+
onFocusPosition={onFocusPosition}
|
|
65
|
+
keyboardType='decimal-pad'
|
|
66
|
+
value={draft_order.amount as string}
|
|
67
|
+
onChangeText={(text) => setDraftOrder({ ...draft_order, amount:text })}
|
|
68
|
+
/>
|
|
69
|
+
</View>
|
|
70
|
+
)
|
|
71
|
+
case 'limits':
|
|
72
|
+
const withdraws_available = withdraw_limit.withdraws_per_week - withdraw_limit.week_withdraw_count
|
|
73
|
+
const avail_for_withdraw = withdraws_available == 0 ? 0 : Math.min(available_for_withdraw, limit_available)
|
|
74
|
+
return (
|
|
75
|
+
<Pressable onPress={() => Keyboard.dismiss()}>
|
|
76
|
+
<View float nativeID='withdraw_limits' style={{ margin:10 }}>
|
|
77
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
78
|
+
<View transparent style={{ flex:1 }}>
|
|
79
|
+
<Text theme='h1'>Withdraw Amount Available</Text>
|
|
80
|
+
<Text style={{ marginTop:3 }} theme='description'>Weekly withdraws remaining</Text>
|
|
81
|
+
</View>
|
|
82
|
+
<View transparent style={{ alignItems:'flex-end' }}>
|
|
83
|
+
<Text theme='h1' color={avail_for_withdraw>0?Colors.text.success:Colors.text.error}>{avail_for_withdraw.toFixed(2)}</Text>
|
|
84
|
+
<Text style={{ marginTop:3 }} theme='description' color={withdraws_available>0?Colors.text.success:Colors.text.error}>{withdraws_available.toFixed()} Remaining</Text>
|
|
85
|
+
</View>
|
|
86
|
+
</View>
|
|
87
|
+
<View transparent type='body'>
|
|
88
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
89
|
+
<View transparent style={{ flex:1 }}>
|
|
90
|
+
<Text theme='h1'>How is this deteremined?</Text>
|
|
91
|
+
<Text theme='description' style={{ marginTop:3 }}>Use the lessor of the following amounts</Text>
|
|
92
|
+
</View>
|
|
93
|
+
</View>
|
|
94
|
+
<View transparent type='body' style={{ padding:10 }}>
|
|
95
|
+
<View float style={{ padding:10 }}>
|
|
96
|
+
<View transparent type='row' style={{ padding:4 }}>
|
|
97
|
+
<Text theme='description' style={{ flex:1 }}>My Balance</Text>
|
|
98
|
+
<Text theme='h2'>{balance.toFixed(2)}</Text>
|
|
99
|
+
</View>
|
|
100
|
+
<View transparent type='row' style={{ padding:4, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
101
|
+
<Text theme='description' style={{ flex:1 }}>Unsettled Deposits</Text>
|
|
102
|
+
<Text theme='h2' color={Colors.text.error}>(${deposit_limit.instant_deposits.toFixed(2)})</Text>
|
|
103
|
+
</View>
|
|
104
|
+
<View transparent type='row' style={{ padding:4 }}>
|
|
105
|
+
<Text theme='h2' style={{ flex:1 }}>Withdrawable Balance</Text>
|
|
106
|
+
<Text theme='h1'>{available_for_withdraw.toFixed(2)}</Text>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
<View float style={{ marginTop:20, padding:10 }}>
|
|
110
|
+
<View transparent type='row' style={{ padding:4 }}>
|
|
111
|
+
<Text theme='description' style={{ flex:1 }}>Daily Limit</Text>
|
|
112
|
+
<Text theme='h2'>${withdraw_limit.ach_daily_limit.toFixed(2)}</Text>
|
|
113
|
+
</View>
|
|
114
|
+
<View transparent type='row' style={{ padding:4, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
115
|
+
<Text theme='description' style={{ flex:1 }}>Rolling 24 hour withdraws</Text>
|
|
116
|
+
<Text theme='h2' color={Colors.text.error}>(${withdraw_limit.last_days_ach_withdraws.toFixed(2)})</Text>
|
|
117
|
+
</View>
|
|
118
|
+
<View transparent type='row' style={{ padding:4 }}>
|
|
119
|
+
<Text theme='h2' style={{ flex:1 }}>Limit Available</Text>
|
|
120
|
+
<Text theme='h1'>${(limit_available).toFixed(2)}</Text>
|
|
121
|
+
</View>
|
|
122
|
+
</View>
|
|
123
|
+
</View>
|
|
124
|
+
</View>
|
|
125
|
+
</View>
|
|
126
|
+
</Pressable>
|
|
127
|
+
)
|
|
128
|
+
default: return <></>
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
43
133
|
if(!draft_order){
|
|
44
134
|
return (
|
|
45
135
|
<View style={{ padding:20 }}>
|
|
@@ -48,81 +138,34 @@ const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, wi
|
|
|
48
138
|
)
|
|
49
139
|
}
|
|
50
140
|
|
|
51
|
-
|
|
52
|
-
let balance = Math.floor(player_balance.balance * 100) / 100
|
|
53
|
-
let limit_available = withdraw_limit.ach_daily_limit - withdraw_limit.last_days_ach_withdraws
|
|
54
141
|
return (
|
|
55
142
|
<View style={{ flex:1 }}>
|
|
56
143
|
<View style={{flex:1}}>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<View nativeID='deposit_amount' style={{ justifyContent:'center', alignItems:'center', padding:20 }}>
|
|
63
|
-
<TextInput
|
|
64
|
-
style={{ flexGrow:1, width:200, textAlign:'center', color:Colors.text.success, fontSize:28 }}
|
|
65
|
-
placeholder='0'
|
|
66
|
-
onFocusPosition={onFocusPosition}
|
|
67
|
-
keyboardType='decimal-pad'
|
|
68
|
-
value={draft_order.amount as string}
|
|
69
|
-
onChangeText={(text) => setDraftOrder({ ...draft_order, amount:text })}
|
|
144
|
+
<FlatList
|
|
145
|
+
data={sections}
|
|
146
|
+
key='withdraw_sections'
|
|
147
|
+
keyExtractor={item => item}
|
|
148
|
+
renderItem={renderSections}
|
|
70
149
|
/>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<View style={{ flexDirection:'row', alignItems:'center', padding:10, paddingTop:0 }}>
|
|
79
|
-
<Text style={{ flex:1 }} size={14} theme='h2'>Available For Withdraw</Text>
|
|
80
|
-
<Text size={14} theme='h1'>{Math.min(available_for_withdraw, limit_available).toFixed(2)}</Text>
|
|
81
|
-
</View>
|
|
82
|
-
<View style={{ marginTop:5, borderRadius:8, padding:10 }}>
|
|
83
|
-
<Text size={14} theme='h2'>Determined by the LESSER OF</Text>
|
|
84
|
-
<View nativeID='available_to_withdraw_calculation' style={{ margin:5, marginTop:10, padding:10, borderRadius:4 }}>
|
|
85
|
-
<View style={{ padding:5, flexDirection:'row', alignItems:'center' }}>
|
|
86
|
-
<Text style={{ flex:1 }} size={14} theme='description'>My Balance</Text>
|
|
87
|
-
<Text size={14} theme='h2'>${balance}</Text>
|
|
88
|
-
</View>
|
|
89
|
-
<View style={{ padding:5, flexDirection:'row', alignItems:'center', paddingLeft:15 }}>
|
|
90
|
-
<Text style={{ flex:1 }} size={14} theme='description'>Instant Deposits (unsettled)</Text>
|
|
91
|
-
<Text size={14} color={Colors.text.error} weight='semibold'>${deposit_limit.instant_deposits.toFixed(2)}</Text>
|
|
92
|
-
</View>
|
|
93
|
-
<View style={{ padding:5, flexDirection:'row', alignItems:'center', borderTopWidth:1, borderTopColor:Colors.borders.light }}>
|
|
94
|
-
<Text style={{ flex:1 }} size={14} theme='h2'>Withdrawable Balance</Text>
|
|
95
|
-
<Text size={14} theme='h1'>${available_for_withdraw.toFixed(2)}</Text>
|
|
96
|
-
</View>
|
|
97
|
-
</View>
|
|
98
|
-
|
|
99
|
-
<View nativeID='daily_limit' style={{ margin:5, padding:10, borderRadius:4 }}>
|
|
100
|
-
<View style={{ padding:5, flexDirection:'row', alignItems:'center' }}>
|
|
101
|
-
<Text style={{ flex:1 }} size={14} theme='description'>Daily Limit</Text>
|
|
102
|
-
<Text size={14} theme='h2'>${withdraw_limit.ach_daily_limit.toFixed(2)}</Text>
|
|
103
|
-
</View>
|
|
104
|
-
<View style={{ padding:5, flexDirection:'row', alignItems:'center', paddingLeft:15}}>
|
|
105
|
-
<Text style={{ flex:1 }} size={14} theme='description'>Last Days Withdraws</Text>
|
|
106
|
-
<Text size={14} color={Colors.text.error} weight='semibold'>${withdraw_limit.last_days_ach_withdraws.toFixed(2)}</Text>
|
|
107
|
-
</View>
|
|
108
|
-
<View style={{ padding:5, flexDirection:'row', alignItems:'center' , borderTopWidth:1, borderTopColor:Colors.borders.light }}>
|
|
109
|
-
<Text style={{ flex:1 }} size={14} theme='h1'>Limit Available</Text>
|
|
110
|
-
<Text size={14} theme='h1'>${(limit_available).toFixed(2)}</Text>
|
|
150
|
+
{errors.length > 0 ?
|
|
151
|
+
<View float nativeID='errors' style={{ borderBottomRightRadius:0, borderBottomLeftRadius:0 }}>
|
|
152
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:15, borderTopRightRadius:8, borderTopLeftRadius:8, backgroundColor:Colors.text.error, borderBottomWidth:1, borderBottomColor:Colors.borders.light }}>
|
|
153
|
+
<Icons.AlertIcon color={Colors.text.white} size={24}/>
|
|
154
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
155
|
+
<Text theme='h1' size={14} color={Colors.text.white}>ERRORS</Text>
|
|
156
|
+
<Text style={{ marginTop: 3}} theme='description' color={Colors.text.white}>Please fix the following before continuing</Text>
|
|
111
157
|
</View>
|
|
112
158
|
</View>
|
|
113
|
-
|
|
114
|
-
{errors.length > 0 ?
|
|
115
|
-
<View style={{ margin:20, borderRadius:8, padding:20 }}>
|
|
116
|
-
<Text style={{ marginBottom:10 }} theme='description'>Please fix the following before continuing</Text>
|
|
159
|
+
<View transparent style={{ padding:10 }}>
|
|
117
160
|
{errors.map(e => {
|
|
118
161
|
return (
|
|
119
|
-
<Text size={14} color={Colors.text.
|
|
162
|
+
<Text size={14} theme='h2' color={Colors.text.error}>{e}</Text>
|
|
120
163
|
)
|
|
121
164
|
})}
|
|
165
|
+
</View>
|
|
122
166
|
</View>
|
|
123
167
|
:<></>}
|
|
124
168
|
</View>
|
|
125
|
-
</Pressable>
|
|
126
169
|
<View type='footer' style={{ flexDirection:'row', padding:20 }}>
|
|
127
170
|
<Button
|
|
128
171
|
style={{ flex:1, marginRight:5, opacity: 1 }}
|
|
@@ -139,7 +182,6 @@ const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, wi
|
|
|
139
182
|
/>
|
|
140
183
|
</View>
|
|
141
184
|
</View>
|
|
142
|
-
</View>
|
|
143
185
|
)
|
|
144
186
|
}
|
|
145
187
|
|