2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2020-06-15 16:33:03 -04:00
|
|
|
import { doClearEmailEntry, doUserSignUp } from 'redux/actions/user';
|
2020-04-13 15:16:07 -04:00
|
|
|
import {
|
|
|
|
selectEmailNewIsPending,
|
|
|
|
selectEmailNewErrorMessage,
|
|
|
|
selectEmailAlreadyExists,
|
2020-04-20 16:53:40 -04:00
|
|
|
selectUser,
|
2020-06-15 16:33:03 -04:00
|
|
|
} from 'redux/selectors/user';
|
2020-07-10 17:04:36 -04:00
|
|
|
import { DAEMON_SETTINGS, SETTINGS } from 'lbry-redux';
|
2020-09-11 14:35:50 -04:00
|
|
|
import { doSetWalletSyncPreference, doSetDaemonSetting } from 'redux/actions/settings';
|
|
|
|
import { selectDaemonSettings, makeSelectClientSetting } from 'redux/selectors/settings';
|
2017-12-21 18:08:54 -03:00
|
|
|
import UserEmailNew from './view';
|
2017-06-01 20:51:52 -04:00
|
|
|
|
2021-03-19 16:52:59 -04:00
|
|
|
const select = (state) => ({
|
2017-06-01 20:51:52 -04:00
|
|
|
isPending: selectEmailNewIsPending(state),
|
|
|
|
errorMessage: selectEmailNewErrorMessage(state),
|
2019-09-26 12:28:08 -04:00
|
|
|
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
2020-02-24 15:43:07 -05:00
|
|
|
daemonSettings: selectDaemonSettings(state),
|
2020-04-13 15:16:07 -04:00
|
|
|
emailExists: selectEmailAlreadyExists(state),
|
2020-04-20 16:53:40 -04:00
|
|
|
user: selectUser(state),
|
2021-03-19 16:52:59 -04:00
|
|
|
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
|
2017-06-11 00:17:37 +07:00
|
|
|
});
|
2017-06-01 20:51:52 -04:00
|
|
|
|
2021-03-19 16:52:59 -04:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
setSync: (value) => dispatch(doSetWalletSyncPreference(value)),
|
|
|
|
setShareDiagnosticData: (shouldShareData) =>
|
2020-02-24 15:43:07 -05:00
|
|
|
dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, shouldShareData)),
|
2020-04-13 15:16:07 -04:00
|
|
|
doSignUp: (email, password) => dispatch(doUserSignUp(email, password)),
|
|
|
|
clearEmailEntry: () => dispatch(doClearEmailEntry()),
|
2017-06-11 00:17:37 +07:00
|
|
|
});
|
2017-06-01 20:51:52 -04:00
|
|
|
|
2020-04-13 15:16:07 -04:00
|
|
|
export default connect(select, perform)(UserEmailNew);
|