2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { doClearEmailEntry, doUserSignUp } from 'redux/actions/user';
|
2020-04-13 21:16:07 +02:00
|
|
|
import {
|
|
|
|
selectEmailNewIsPending,
|
|
|
|
selectEmailNewErrorMessage,
|
|
|
|
selectEmailAlreadyExists,
|
2020-04-20 22:53:40 +02:00
|
|
|
selectUser,
|
2020-06-15 22:33:03 +02:00
|
|
|
} from 'redux/selectors/user';
|
2021-10-17 10:36:14 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
|
|
|
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
2020-09-11 20:35:50 +02:00
|
|
|
import { doSetWalletSyncPreference, doSetDaemonSetting } from 'redux/actions/settings';
|
|
|
|
import { selectDaemonSettings, makeSelectClientSetting } from 'redux/selectors/settings';
|
2017-12-21 22:08:54 +01:00
|
|
|
import UserEmailNew from './view';
|
2017-06-02 02:51:52 +02:00
|
|
|
|
2021-03-19 21:52:59 +01: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),
|
2020-04-20 22:53:40 +02:00
|
|
|
user: selectUser(state),
|
2017-06-10 19:17:37 +02:00
|
|
|
});
|
2017-06-02 02:51:52 +02:00
|
|
|
|
2021-03-19 21:52:59 +01:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
setSync: (value) => dispatch(doSetWalletSyncPreference(value)),
|
|
|
|
setShareDiagnosticData: (shouldShareData) =>
|
2020-02-24 21:43:07 +01:00
|
|
|
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);
|