diff --git a/ui/component/header/index.js b/ui/component/header/index.js index 34835dbd5..f3b1df29b 100644 --- a/ui/component/header/index.js +++ b/ui/component/header/index.js @@ -6,12 +6,11 @@ import { selectClientSetting } from 'redux/selectors/settings'; import { selectGetSyncErrorMessage } from 'redux/selectors/sync'; import { selectHasNavigated } from 'redux/selectors/app'; import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet'; -import { selectUserVerifiedEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user'; +import { selectEmailToVerify, selectUser } from 'redux/selectors/user'; import * as SETTINGS from 'constants/settings'; import Header from './view'; const select = (state) => ({ - authenticated: selectUserVerifiedEmail(state), balance: selectBalance(state), emailToVerify: selectEmailToVerify(state), hasNavigated: selectHasNavigated(state), diff --git a/ui/component/headerMenuButtons/index.js b/ui/component/headerMenuButtons/index.js index dab91821b..778f7228d 100644 --- a/ui/component/headerMenuButtons/index.js +++ b/ui/component/headerMenuButtons/index.js @@ -4,11 +4,10 @@ import { selectActiveChannelStakedLevel } from 'redux/selectors/app'; import { selectClientSetting } from 'redux/selectors/settings'; import * as SETTINGS from 'constants/settings'; import HeaderMenuButtons from './view'; -import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user'; +import { selectUser } from 'redux/selectors/user'; const select = (state) => ({ activeChannelStakedLevel: selectActiveChannelStakedLevel(state), - authenticated: selectUserVerifiedEmail(state), automaticDarkModeEnabled: selectClientSetting(state, SETTINGS.AUTOMATIC_DARK_MODE_ENABLED), currentTheme: selectClientSetting(state, SETTINGS.THEME), user: selectUser(state), diff --git a/ui/component/headerMenuButtons/view.jsx b/ui/component/headerMenuButtons/view.jsx index 687fe4b2e..953f6d678 100644 --- a/ui/component/headerMenuButtons/view.jsx +++ b/ui/component/headerMenuButtons/view.jsx @@ -12,7 +12,6 @@ import React from 'react'; import Tooltip from 'component/common/tooltip'; type HeaderMenuButtonProps = { - authenticated: boolean, automaticDarkModeEnabled: boolean, currentTheme: string, user: ?User, diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index 0fad88303..8c9a64c04 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -226,18 +226,20 @@ function AppRouter(props: Props) { /> ))} + {/* Odysee signin */} + + {/* @if TARGET='app' */} {/* @endif */} - diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 519e1a3a4..bcb2d1635 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -43,7 +43,6 @@ type Props = { toggleVideoTheaterMode: () => void, toggleAutoplayNext: () => void, setVideoPlaybackRate: (number) => void, - authenticated: boolean, userId: number, homepageData?: { [string]: HomepageCat }, shareTelemetry: boolean, diff --git a/ui/component/welcomeSplash/index.js b/ui/component/welcomeSplash/index.js index e463615c1..daf13dbd0 100644 --- a/ui/component/welcomeSplash/index.js +++ b/ui/component/welcomeSplash/index.js @@ -3,14 +3,12 @@ import { doSetDaemonSetting } from 'redux/actions/settings'; import { doSetWelcomeVersion } from 'redux/actions/app'; import * as DAEMON_SETTINGS from 'constants/daemon_settings'; import { WELCOME_VERSION } from 'config.js'; -import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectDaemonSettings, selectDaemonStatus } from 'redux/selectors/settings'; import WelcomeSplash from './view'; import { selectDiskSpace } from 'redux/selectors/app'; const select = (state) => ({ - authenticated: selectUserVerifiedEmail(state), diskSpace: selectDiskSpace(state), daemonSettings: selectDaemonSettings(state), daemonStatus: selectDaemonStatus(state), diff --git a/ui/component/welcomeSplash/view.jsx b/ui/component/welcomeSplash/view.jsx index ca3e3bbda..2837edbef 100644 --- a/ui/component/welcomeSplash/view.jsx +++ b/ui/component/welcomeSplash/view.jsx @@ -9,7 +9,6 @@ import YrblHappy from 'static/img/yrblhappy.svg'; type Props = { setWelcomeVersion: (number) => void, setShareDataInternal: (boolean) => void, - authenticated: boolean, handleNextPage: () => void, diskSpace?: DiskSpace, }; diff --git a/ui/constants/modal_types.js b/ui/constants/modal_types.js index bea70cdb5..81006585c 100644 --- a/ui/constants/modal_types.js +++ b/ui/constants/modal_types.js @@ -33,7 +33,6 @@ export const WALLET_UNLOCK = 'wallet_unlock'; export const WALLET_SYNC = 'wallet_sync'; export const WALLET_PASSWORD_UNSAVE = 'wallet_password_unsave'; export const CREATE_CHANNEL = 'create_channel'; -export const SET_REFERRER = 'set_referrer'; export const SIGN_OUT = 'sign_out'; export const LIQUIDATE_SUPPORTS = 'liquidate_supports'; export const MASS_TIP_UNLOCK = 'mass_tip_unlock'; diff --git a/ui/modal/modalRouter/view.jsx b/ui/modal/modalRouter/view.jsx index e5bc145ad..1efc39144 100644 --- a/ui/modal/modalRouter/view.jsx +++ b/ui/modal/modalRouter/view.jsx @@ -51,7 +51,6 @@ import ModalRevokeClaim from 'modal/modalRevokeClaim'; import ModalRewardCode from 'modal/modalRewardCode'; import ModalSendTip from 'modal/modalSendTip'; import ModalRepost from 'modal/modalRepost'; -import ModalSetReferrer from 'modal/modalSetReferrer'; import ModalSignOut from 'modal/modalSignOut'; import ModalSocialShare from 'modal/modalSocialShare'; import ModalSupportsLiquidate from 'modal/modalSupportsLiquidate'; @@ -122,8 +121,6 @@ function getModal(id) { return ModalRewardCode; case MODALS.COMMENT_ACKNOWEDGEMENT: return ModalCommentAcknowledgement; - case MODALS.SET_REFERRER: - return ModalSetReferrer; case MODALS.SIGN_OUT: return ModalSignOut; case MODALS.FILE_SELECTION: diff --git a/ui/modal/modalSetReferrer/index.js b/ui/modal/modalSetReferrer/index.js deleted file mode 100644 index 4de02df56..000000000 --- a/ui/modal/modalSetReferrer/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import { connect } from 'react-redux'; -import { doHideModal } from 'redux/actions/app'; -import { selectSetReferrerError, selectSetReferrerPending } from 'redux/selectors/user'; -import { doUserSetReferrer, doUserSetReferrerReset } from 'redux/actions/user'; -import ModalSetReferrer from './view'; - -const select = state => ({ - referrerSetPending: selectSetReferrerPending(state), - referrerSetError: selectSetReferrerError(state), -}); - -const perform = dispatch => ({ - closeModal: () => dispatch(doHideModal()), - setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)), - resetReferrerError: () => dispatch(doUserSetReferrerReset()), -}); - -export default connect(select, perform)(ModalSetReferrer); diff --git a/ui/modal/modalSetReferrer/view.jsx b/ui/modal/modalSetReferrer/view.jsx deleted file mode 100644 index d4669ed45..000000000 --- a/ui/modal/modalSetReferrer/view.jsx +++ /dev/null @@ -1,101 +0,0 @@ -// @flow -import * as React from 'react'; -import { FormField, Form } from 'component/common/form'; -import { Modal } from 'modal/modal'; -import Button from 'component/button'; -import HelpLink from 'component/common/help-link'; -import Card from 'component/common/card'; - -type Props = { - closeModal: () => void, - error: ?string, - rewardIsPending: boolean, - setReferrer: (string, boolean) => void, - referrerSetPending: boolean, - referrerSetError?: string, - resetReferrerError: () => void, -}; - -type State = { - referrer: string, -}; - -class ModalSetReferrer extends React.PureComponent { - constructor() { - super(); - - this.state = { - referrer: '', - }; - - (this: any).handleSubmit = this.handleSubmit.bind(this); - (this: any).handleClose = this.handleClose.bind(this); - (this: any).handleTextChange = this.handleTextChange.bind(this); - } - - handleSubmit() { - const { referrer } = this.state; - const { setReferrer } = this.props; - setReferrer(referrer, true); - } - - handleClose() { - const { referrerSetError, resetReferrerError, closeModal } = this.props; - if (referrerSetError) { - resetReferrerError(); - } - closeModal(); - } - - handleTextChange(e: SyntheticInputEvent<*>) { - const { referrerSetError, resetReferrerError } = this.props; - - this.setState({ referrer: e.target.value }); - if (referrerSetError) { - resetReferrerError(); - } - } - - render() { - const { closeModal, rewardIsPending, referrerSetError, referrerSetPending } = this.props; - const { referrer } = this.state; - - return ( - - - {__('Did someone invite you to use LBRY? Tell us who and you both get a reward!')} - - - } - actions={ - -
- - } - label={__('Code or channel')} - placeholder="0123abc" - value={referrer} - onChange={this.handleTextChange} - error={!referrerSetPending && referrerSetError} - /> - -
-
-
- } - /> -
- ); - } -} - -export default ModalSetReferrer; diff --git a/ui/page/home/view.jsx b/ui/page/home/view.jsx index 1e855d445..763ad43d4 100644 --- a/ui/page/home/view.jsx +++ b/ui/page/home/view.jsx @@ -13,7 +13,6 @@ import { useIsLargeScreen } from 'effects/use-screensize'; import { GetLinksData } from 'util/buildHomepage'; type Props = { - authenticated: boolean, followedTags: Array, subscribedChannels: Array, showNsfw: boolean, diff --git a/ui/page/settings/index.js b/ui/page/settings/index.js index 884395b9f..a9bad199e 100644 --- a/ui/page/settings/index.js +++ b/ui/page/settings/index.js @@ -1,13 +1,11 @@ import { connect } from 'react-redux'; import { doEnterSettingsPage, doExitSettingsPage } from 'redux/actions/settings'; import { selectDaemonSettings } from 'redux/selectors/settings'; -import { selectUserVerifiedEmail } from 'redux/selectors/user'; import SettingsPage from './view'; const select = (state) => ({ daemonSettings: selectDaemonSettings(state), - isAuthenticated: selectUserVerifiedEmail(state), }); const perform = (dispatch) => ({ diff --git a/ui/page/settings/view.jsx b/ui/page/settings/view.jsx index 9d8ae3816..350687df7 100644 --- a/ui/page/settings/view.jsx +++ b/ui/page/settings/view.jsx @@ -14,7 +14,6 @@ type DaemonSettings = { type Props = { daemonSettings: DaemonSettings, - isAuthenticated: boolean, enterSettings: () => void, exitSettings: () => void, }; diff --git a/ui/redux/actions/rewards.js b/ui/redux/actions/rewards.js index 7c5653a58..b2a8f77c6 100644 --- a/ui/redux/actions/rewards.js +++ b/ui/redux/actions/rewards.js @@ -4,7 +4,6 @@ import { doToast } from 'redux/actions/notifications'; import * as ACTIONS from 'constants/action_types'; import { selectUnclaimedRewards } from 'redux/selectors/rewards'; import { selectUserIsRewardApproved } from 'redux/selectors/user'; -// import { doFetchInviteStatus } from 'redux/actions/user'; import rewards from 'rewards'; export function doRewardList() { diff --git a/ui/redux/actions/user.js b/ui/redux/actions/user.js index 59d67493d..63493dc9c 100644 --- a/ui/redux/actions/user.js +++ b/ui/redux/actions/user.js @@ -6,7 +6,7 @@ import { batchActions } from 'util/batch-actions'; import * as ACTIONS from 'constants/action_types'; import { doClaimRewardType, doRewardList } from 'redux/actions/rewards'; -import { selectEmailToVerify, selectPhoneToVerify, selectUserCountryCode, selectUser } from 'redux/selectors/user'; +import { selectUser } from 'redux/selectors/user'; import rewards from 'rewards'; import { Lbryio } from 'lbryinc'; import { DOMAIN } from 'config'; @@ -14,37 +14,6 @@ import { getDefaultLanguage } from 'util/default-languages'; const AUTH_IN_PROGRESS = 'authInProgress'; export let sessionStorageAvailable = false; -export function doFetchInviteStatus(shouldCallRewardList = true) { - return (dispatch) => { - dispatch({ - type: ACTIONS.USER_INVITE_STATUS_FETCH_STARTED, - }); - - Promise.all([Lbryio.call('user', 'invite_status'), Lbryio.call('user_referral_code', 'list')]) - .then(([status, code]) => { - if (shouldCallRewardList) { - dispatch(doRewardList()); - } - - dispatch({ - type: ACTIONS.USER_INVITE_STATUS_FETCH_SUCCESS, - data: { - invitesRemaining: status.invites_remaining ? status.invites_remaining : 0, - invitees: status.invitees, - referralLink: `${Lbryio.CONNECTION_STRING}user/refer?r=${code}`, - referralCode: code, - }, - }); - }) - .catch((error) => { - dispatch({ - type: ACTIONS.USER_INVITE_STATUS_FETCH_FAILURE, - data: { error }, - }); - }); - }; -} - export function doInstallNew(appVersion, os = null, firebaseToken = null, callbackForUsersWhoAreSharingData, domain) { const payload = { app_version: appVersion, domain }; if (firebaseToken) { @@ -211,95 +180,6 @@ export function doUserPhoneNew(phone, countryCode) { }; } -export function doUserPhoneVerifyFailure(error) { - return { - type: ACTIONS.USER_PHONE_VERIFY_FAILURE, - data: { error }, - }; -} - -export function doUserPhoneVerify(verificationCode) { - return (dispatch, getState) => { - const phoneNumber = selectPhoneToVerify(getState()); - const countryCode = selectUserCountryCode(getState()); - - dispatch({ - type: ACTIONS.USER_PHONE_VERIFY_STARTED, - code: verificationCode, - }); - - Lbryio.call( - 'user', - 'phone_number_confirm', - { - verification_code: verificationCode, - phone_number: phoneNumber, - country_code: countryCode, - }, - 'post' - ) - .then((user) => { - if (user.is_identity_verified) { - dispatch({ - type: ACTIONS.USER_PHONE_VERIFY_SUCCESS, - data: { user }, - }); - dispatch(doClaimRewardType(rewards.TYPE_NEW_USER)); - } - }) - .catch((error) => dispatch(doUserPhoneVerifyFailure(error))); - }; -} - -export function doUserEmailToVerify(email) { - return (dispatch) => { - dispatch({ - type: ACTIONS.USER_EMAIL_VERIFY_SET, - data: { email }, - }); - }; -} - -export function doUserEmailNew(email) { - return (dispatch) => { - dispatch({ - type: ACTIONS.USER_EMAIL_NEW_STARTED, - email, - }); - - const success = () => { - dispatch({ - type: ACTIONS.USER_EMAIL_NEW_SUCCESS, - data: { email }, - }); - dispatch(doUserFetch()); - }; - - const failure = (error) => { - dispatch({ - type: ACTIONS.USER_EMAIL_NEW_FAILURE, - data: { error }, - }); - }; - - Lbryio.call('user_email', 'new', { email, send_verification_email: true }, 'post') - .catch((error) => { - if (error.response && error.response.status === 409) { - dispatch({ - type: ACTIONS.USER_EMAIL_NEW_EXISTS, - }); - - return Lbryio.call('user_email', 'resend_token', { email, only_if_expired: true }, 'post').then( - success, - failure - ); - } - throw error; - }) - .then(success, failure); - }; -} - export function doUserCheckIfEmailExists(email) { return (dispatch) => { dispatch({ @@ -530,41 +410,6 @@ export function doUserEmailVerifyFailure(error) { }; } -export function doUserEmailVerify(verificationToken, recaptcha) { - return (dispatch, getState) => { - const email = selectEmailToVerify(getState()); - - dispatch({ - type: ACTIONS.USER_EMAIL_VERIFY_STARTED, - code: verificationToken, - recaptcha, - }); - - Lbryio.call( - 'user_email', - 'confirm', - { - verification_token: verificationToken, - email, - recaptcha, - }, - 'post' - ) - .then((userEmail) => { - if (userEmail.is_verified) { - dispatch({ - type: ACTIONS.USER_EMAIL_VERIFY_SUCCESS, - data: { email }, - }); - dispatch(doUserFetch()); - } else { - throw new Error('Your email is still not verified.'); // shouldn't happen - } - }) - .catch((error) => dispatch(doUserEmailVerifyFailure(error))); - }; -} - export function doFetchAccessToken() { return (dispatch) => { const success = (token) => @@ -576,34 +421,6 @@ export function doFetchAccessToken() { }; } -export function doUserIdentityVerify(stripeToken) { - return (dispatch) => { - dispatch({ - type: ACTIONS.USER_IDENTITY_VERIFY_STARTED, - token: stripeToken, - }); - - Lbryio.call('user', 'verify_identity', { stripe_token: stripeToken }, 'post') - .then((user) => { - if (user.is_identity_verified) { - dispatch({ - type: ACTIONS.USER_IDENTITY_VERIFY_SUCCESS, - data: { user }, - }); - dispatch(doClaimRewardType(rewards.TYPE_NEW_USER)); - } else { - throw new Error('Your identity is still not verified. This should not happen.'); // shouldn't happen - } - }) - .catch((error) => { - dispatch({ - type: ACTIONS.USER_IDENTITY_VERIFY_FAILURE, - data: { error: error.toString() }, - }); - }); - }; -} - export function doUserSetReferrerReset() { return (dispatch) => { dispatch({ diff --git a/ui/redux/selectors/user.js b/ui/redux/selectors/user.js index 26f6161ef..fb3dec139 100644 --- a/ui/redux/selectors/user.js +++ b/ui/redux/selectors/user.js @@ -19,8 +19,6 @@ export const selectUserEmail = createSelector(selectUser, (user) => user ? user.primary_email || user.latest_claimed_email : null ); -export const selectUserPhone = createSelector(selectUser, (user) => (user ? user.phone_number : null)); - export const selectUserCountryCode = createSelector(selectUser, (user) => (user ? user.country_code : null)); export const selectEmailToVerify = createSelector( @@ -29,12 +27,6 @@ export const selectEmailToVerify = createSelector( (state, userEmail) => state.emailToVerify || userEmail ); -export const selectPhoneToVerify = createSelector( - selectState, - selectUserPhone, - (state, userPhone) => state.phoneToVerify || userPhone -); - export const selectYoutubeChannels = createSelector(selectUser, (user) => (user ? user.youtube_channels : null)); export const selectUserIsRewardApproved = createSelector(selectUser, (user) => user && user.is_reward_approved);