4f47779303
* adding preorder button * adding preorder modal * frontend mostly done * check if its already purchased * refresh page after purchase * smooth out purchase process * check if user has card saved * handle case where its the users own upload * fix transaction listing order bug * cleaning up code for merge * fix lint errors * fix flow errors * allow eur purchases * support eur on customer transaction page * fix css
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import {
|
|
selectClaimForUri,
|
|
selectPreorderTag,
|
|
} from 'redux/selectors/claims';
|
|
import { doHideModal } from 'redux/actions/app';
|
|
import { preOrderPurchase } from 'redux/actions/wallet';
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
|
import { withRouter } from 'react-router';
|
|
import * as SETTINGS from 'constants/settings';
|
|
import { getChannelIdFromClaim, getChannelNameFromClaim } from 'util/claim';
|
|
import WalletSendTip from './view';
|
|
|
|
const select = (state, props) => {
|
|
const { uri } = props;
|
|
|
|
const claim = selectClaimForUri(state, uri, false);
|
|
const { claim_id: claimId, value_type: claimType } = claim || {};
|
|
|
|
// setup variables for backend tip API
|
|
const channelClaimId = getChannelIdFromClaim(claim);
|
|
const tipChannelName = getChannelNameFromClaim(claim);
|
|
|
|
const activeChannelClaim = selectActiveChannelClaim(state);
|
|
const { name: activeChannelName, claim_id: activeChannelId } = activeChannelClaim || {};
|
|
|
|
return {
|
|
activeChannelName,
|
|
activeChannelId,
|
|
claimId,
|
|
claimType,
|
|
channelClaimId,
|
|
tipChannelName,
|
|
preferredCurrency: selectClientSetting(state, SETTINGS.PREFERRED_CURRENCY),
|
|
preorderTag: selectPreorderTag(state, props.uri),
|
|
};
|
|
};
|
|
|
|
const perform = {
|
|
doHideModal,
|
|
preOrderPurchase,
|
|
};
|
|
|
|
export default withRouter(connect(select, perform)(WalletSendTip));
|