2019-09-26 18:28:08 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-04-13 21:16:07 +02:00
|
|
|
import {
|
|
|
|
selectEmailNewIsPending,
|
|
|
|
selectEmailNewErrorMessage,
|
|
|
|
selectEmailAlreadyExists,
|
|
|
|
doUserSignUp,
|
|
|
|
doClearEmailEntry,
|
|
|
|
} from 'lbryinc';
|
2020-02-24 21:43:07 +01:00
|
|
|
import { DAEMON_SETTINGS } from 'lbry-redux';
|
|
|
|
import { doSetClientSetting, doSetDaemonSetting } from 'redux/actions/settings';
|
|
|
|
import { makeSelectClientSetting, selectDaemonSettings } from 'redux/selectors/settings';
|
2017-12-21 22:08:54 +01:00
|
|
|
import UserEmailNew from './view';
|
2017-06-02 02:51:52 +02:00
|
|
|
|
2017-06-10 19:17:37 +02:00
|
|
|
const select = state => ({
|
2017-06-02 02:51:52 +02:00
|
|
|
isPending: selectEmailNewIsPending(state),
|
|
|
|
errorMessage: selectEmailNewErrorMessage(state),
|
2019-09-26 18:28:08 +02:00
|
|
|
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
2020-02-24 21:43:07 +01:00
|
|
|
daemonSettings: selectDaemonSettings(state),
|
2020-04-13 21:16:07 +02:00
|
|
|
emailExists: selectEmailAlreadyExists(state),
|
2017-06-10 19:17:37 +02:00
|
|
|
});
|
2017-06-02 02:51:52 +02:00
|
|
|
|
2017-06-10 19:17:37 +02:00
|
|
|
const perform = dispatch => ({
|
2019-09-26 18:28:08 +02:00
|
|
|
setSync: value => dispatch(doSetClientSetting(SETTINGS.ENABLE_SYNC, value)),
|
2020-02-24 21:43:07 +01:00
|
|
|
setShareDiagnosticData: shouldShareData =>
|
|
|
|
dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, shouldShareData)),
|
2020-04-13 21:16:07 +02:00
|
|
|
doSignUp: (email, password) => dispatch(doUserSignUp(email, password)),
|
|
|
|
clearEmailEntry: () => dispatch(doClearEmailEntry()),
|
2017-06-10 19:17:37 +02:00
|
|
|
});
|
2017-06-02 02:51:52 +02:00
|
|
|
|
2020-04-13 21:16:07 +02:00
|
|
|
export default connect(select, perform)(UserEmailNew);
|