// @flow import React from 'react'; import Button from 'component/button'; import Card from 'component/common/card'; import { Lbryio } from 'lbryinc'; import moment from 'moment'; import { STRIPE_PUBLIC_KEY } from '../../../config'; let stripeEnvironment = 'test'; // if the key contains pk_live it's a live key // update the environment for the calls to the backend to indicate which environment to hit if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) { stripeEnvironment = 'live'; } type Props = { accountDetails: any, transactions: any, }; const WalletBalance = (props: Props) => { // receive transactions from parent component let accountTransactions = props.transactions; // reverse so most recent payments come first if (accountTransactions) { accountTransactions = accountTransactions.reverse(); } if (accountTransactions && accountTransactions.length > 10) { accountTransactions.length = 10; } // const [detailsExpanded, setDetailsExpanded] = React.useState(false); const [accountStatusResponse, setAccountStatusResponse] = React.useState(); const [subscriptions, setSubscriptions] = React.useState([]); function getAccountStatus() { return Lbryio.call( 'account', 'status', { environment: stripeEnvironment, }, 'post' ); } React.useEffect(() => { (async function() { const response = await getAccountStatus(); setAccountStatusResponse(response); console.log(response); })(); }, []); return ( <>
{accountTransactions && accountTransactions.map((transaction) => ( ))}
{__('Date')} {<>{__('Receiving Channel Name')}} {__('Tip Location')} {__('Amount (USD)')} {__('Processing Fee')} {__('Odysee Fee')} {__('Received Amount')}
{moment(transaction.created_at).format('LLL')} ${transaction.tipped_amount / 100} ${transaction.transaction_fee / 100} ${transaction.application_fee / 100} ${transaction.received_amount / 100}
{!accountTransactions &&

No Transactions

}
)} /> {/* */} {/*
*/} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* {subscriptions && */} {/* subscriptions.reverse().map((transaction) => ( */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* ))} */} {/* */} {/*
{__('Date')}{<>{__('Receiving Channel Name')}}{__('Tip Location')}{__('Amount (USD)')} {__('Card Last 4')}{__('Anonymous')}
{moment(transaction.created_at).format('LLL')} */} {/* */} {/* ${transaction.tipped_amount / 100}{lastFour}{transaction.private_tip ? 'Yes' : 'No'}
*/} {/* {(!subscriptions || subscriptions.length === 0) &&

No Subscriptions

} */} {/*
*/} {/* */} {/* } */} {/* /> */} ); }; export default WalletBalance;