2020-06-15 22:33:03 +02:00
|
|
|
import REWARD_TYPES from 'rewards';
|
2020-04-13 21:16:07 +02:00
|
|
|
import { connect } from 'react-redux';
|
2021-02-17 19:25:52 +01:00
|
|
|
import { selectGetSyncIsPending, selectSyncHash, selectPrefsReady } from 'redux/selectors/sync';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { doClaimRewardType } from 'redux/actions/rewards';
|
2020-09-15 15:54:05 +02:00
|
|
|
import { doSetClientSetting } from 'redux/actions/settings';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { selectClaimedRewards, makeSelectIsRewardClaimPending } from 'redux/selectors/rewards';
|
2022-01-19 14:06:14 +01:00
|
|
|
import { selectUserIsPending, selectYoutubeChannels, selectEmailToVerify, selectUser } from 'redux/selectors/user';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { selectMyChannelClaims, selectFetchingMyChannels, selectCreatingChannel } from 'redux/selectors/claims';
|
|
|
|
import { selectBalance } from 'redux/selectors/wallet';
|
|
|
|
import * as SETTINGS from 'constants/settings';
|
2021-11-23 05:29:04 +01:00
|
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
2020-09-04 22:11:28 +02:00
|
|
|
import { selectInterestedInYoutubeSync } from 'redux/selectors/app';
|
|
|
|
import { doToggleInterestedInYoutubeSync } from 'redux/actions/app';
|
2020-04-13 21:16:07 +02:00
|
|
|
import UserSignIn from './view';
|
|
|
|
|
2021-02-17 19:25:52 +01:00
|
|
|
const select = (state) => ({
|
2020-04-13 21:16:07 +02:00
|
|
|
emailToVerify: selectEmailToVerify(state),
|
|
|
|
user: selectUser(state),
|
|
|
|
channels: selectMyChannelClaims(state),
|
|
|
|
claimedRewards: selectClaimedRewards(state),
|
|
|
|
claimingReward: makeSelectIsRewardClaimPending()(state, {
|
|
|
|
reward_type: REWARD_TYPES.TYPE_CONFIRM_EMAIL,
|
|
|
|
}),
|
|
|
|
balance: selectBalance(state),
|
|
|
|
fetchingChannels: selectFetchingMyChannels(state),
|
|
|
|
youtubeChannels: selectYoutubeChannels(state),
|
|
|
|
userFetchPending: selectUserIsPending(state),
|
2021-11-23 05:29:04 +01:00
|
|
|
syncEnabled: selectClientSetting(state, SETTINGS.ENABLE_SYNC),
|
|
|
|
followingAcknowledged: selectClientSetting(state, SETTINGS.FOLLOWING_ACKNOWLEDGED),
|
|
|
|
tagsAcknowledged: selectClientSetting(state, SETTINGS.TAGS_ACKNOWLEDGED),
|
|
|
|
rewardsAcknowledged: selectClientSetting(state, SETTINGS.REWARDS_ACKNOWLEDGED),
|
2020-04-13 21:16:07 +02:00
|
|
|
syncingWallet: selectGetSyncIsPending(state),
|
|
|
|
hasSynced: Boolean(selectSyncHash(state)),
|
|
|
|
creatingChannel: selectCreatingChannel(state),
|
2020-09-04 22:11:28 +02:00
|
|
|
interestedInYoutubeSync: selectInterestedInYoutubeSync(state),
|
2021-02-17 19:25:52 +01:00
|
|
|
prefsReady: selectPrefsReady(state),
|
2020-04-13 21:16:07 +02:00
|
|
|
});
|
|
|
|
|
2021-02-17 19:25:52 +01:00
|
|
|
const perform = (dispatch) => ({
|
2020-08-27 19:56:18 +02:00
|
|
|
claimConfirmEmailReward: () =>
|
2020-04-13 21:16:07 +02:00
|
|
|
dispatch(
|
|
|
|
doClaimRewardType(REWARD_TYPES.TYPE_CONFIRM_EMAIL, {
|
|
|
|
notifyError: false,
|
|
|
|
})
|
|
|
|
),
|
2020-08-27 19:56:18 +02:00
|
|
|
claimNewUserReward: () =>
|
|
|
|
dispatch(
|
|
|
|
doClaimRewardType(REWARD_TYPES.NEW_USER, {
|
|
|
|
notifyError: false,
|
|
|
|
})
|
|
|
|
),
|
2020-09-15 15:54:05 +02:00
|
|
|
setClientSetting: (setting, value, pushToPrefs) => dispatch(doSetClientSetting(setting, value, pushToPrefs)),
|
2020-09-04 22:11:28 +02:00
|
|
|
doToggleInterestedInYoutubeSync: () => dispatch(doToggleInterestedInYoutubeSync()),
|
2020-04-13 21:16:07 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(UserSignIn);
|