2020-01-14 21:44:07 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { withRouter } from 'react-router';
|
|
|
|
import REWARDS from 'rewards';
|
|
|
|
import { selectUser, selectSetReferrerPending, selectSetReferrerError } from 'redux/selectors/user';
|
|
|
|
import { doClaimRewardType } from 'redux/actions/rewards';
|
|
|
|
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
|
|
|
import { doUserSetReferrer } from 'redux/actions/user';
|
2021-11-12 15:47:07 +01:00
|
|
|
import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions';
|
2020-01-14 21:44:07 +01:00
|
|
|
import { doChannelSubscribe } from 'redux/actions/subscriptions';
|
|
|
|
import Invited from './view';
|
|
|
|
|
|
|
|
const select = (state, props) => {
|
|
|
|
return {
|
|
|
|
user: selectUser(state),
|
|
|
|
referrerSetPending: selectSetReferrerPending(state),
|
|
|
|
referrerSetError: selectSetReferrerError(state),
|
|
|
|
rewards: selectUnclaimedRewards(state),
|
2021-11-12 15:47:07 +01:00
|
|
|
isSubscribed: selectIsSubscribedForUri(state, props.fullUri),
|
2020-01-14 21:44:07 +01:00
|
|
|
fullUri: props.fullUri,
|
|
|
|
referrer: props.referrer,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-11-12 15:47:07 +01:00
|
|
|
const perform = (dispatch) => ({
|
2020-01-14 21:44:07 +01:00
|
|
|
claimReward: () => dispatch(doClaimRewardType(REWARDS.TYPE_REFEREE)),
|
2021-11-12 15:47:07 +01:00
|
|
|
setReferrer: (referrer) => dispatch(doUserSetReferrer(referrer)),
|
|
|
|
channelSubscribe: (uri) => dispatch(doChannelSubscribe(uri)),
|
2020-01-14 21:44:07 +01:00
|
|
|
});
|
|
|
|
|
2020-06-15 22:33:03 +02:00
|
|
|
export default withRouter(connect(select, perform)(Invited));
|