Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mapLedgerActionsToProps = (actions) => ({
poll: () => actions.call()
});
const mapLedgerDataToProps = (data) => {
const { deviceInfo, publicKey } = data || {};
return { deviceInfo, publicKey };
};
const mapLedgerErrorToProps = (error) => ({
deviceError: error
});
export default compose(
withActions(ledgerActions, mapLedgerActionsToProps),
withData(ledgerActions, mapLedgerDataToProps),
withError(ledgerActions, mapLedgerErrorToProps),
// redirect on login
withRouter,
withLogin((state, { history }) => history.push('/browser'))
)(LoginFormLedger);
return (Component) => {
class WithCleanComponent extends React.PureComponent {
componentWillUnmount() {
this.props[propName]();
}
render() {
return ;
}
}
return withActions(actions, mapActionsToProps)(WithCleanComponent);
};
}
export default function withProgressPanel(
actions,
{ title, strategy = recentlyCompletedStrategy, ...options } = {},
) {
const Loading = withProps({ title })(LoadingPanel)
const Failed = withProps(props => ({ title, onRetry: props.onRetry }))(
FailedPanel,
)
return compose(
withActions(actions, mapActionsToProps),
withProgressComponents(
actions,
{
[LOADING]: Loading,
[FAILED]: Failed,
},
{
strategy,
...options,
},
),
)
}
const mapStoreProfileActionsToProps = (actions) => ({
storeProfile: ({ walletName, address, encryptedKey }) => {
return actions.call({ walletName, address, encryptedKey });
}
});
const mapAuthActionsToProps = (actions) => ({
login: ({ wif, passphrase, encryptedWIF, publicKey }) => {
return actions.call({ wif, passphrase, encryptedWIF, publicKey });
}
});
export default compose(
withAlert(),
withActions(writePreviousAuthActions, mapPreviousAuthActionsToProps),
withActions(storeProfileActions, mapStoreProfileActionsToProps),
withActions(authActions, mapAuthActionsToProps),
withProgress(authActions, { strategy: pureStrategy }),
withProps((props) => ({ loading: props.progress === LOADING }))
)(SaveAccount);
import { withActions, withData } from 'spunky';
import AddressBar from './AddressBar';
import nameServiceActions from '../../../actions/nameServiceActions';
const mapNameServiceActionsToProps = (actions) => ({
doQuery: (params) => actions.call(params)
});
const mapNameServiceDataToProps = (data) => ({
query: data && data.query,
target: data && data.target
});
export default compose(
withActions(nameServiceActions, mapNameServiceActionsToProps),
withData(nameServiceActions, mapNameServiceDataToProps),
withRouter
)(AddressBar);
import { compose } from 'recompose';
import { withActions } from 'spunky';
import Login from './Login';
import authActions from '../../actions/authActions';
import withAuthError from '../../hocs/withAuthError';
const mapAuthActionsToProps = (actions) => ({
login: ({ wif, passphrase, encryptedWIF, publicKey }) => {
return actions.call({ wif, passphrase, encryptedWIF, publicKey });
}
});
export default compose(
withActions(authActions, mapAuthActionsToProps),
withAuthError
)(Login);
import { progressValues, withActions } from 'spunky';
import { withErrorToast } from 'shared/hocs/withToast';
import withProgressChange from 'shared/hocs/withProgressChange';
import { importWalletActions } from 'auth/actions/walletActions';
import ExistingImport from './ExistingImport';
const { FAILED, LOADED } = progressValues;
const mapAddAccountActionsToProps = (actions) => ({
addAccount: (data) => actions.call(data)
});
export default compose(
withActions(importWalletActions, mapAddAccountActionsToProps),
withState('currentAccount', 'setCurrentAccount', ({ accounts }) => {
return accounts[0] && accounts[0].encryptedKey;
}),
withState('legacyPassphrase', 'setLegacyPassphrase', ''),
withState('passphrase', 'setPassphrase', ''),
withErrorToast(),
withProgressChange(importWalletActions, FAILED, (state, props) => {
props.showErrorToast(state.error);
}),
withProgressChange(importWalletActions, LOADED, (state, props) => {
props.onConfirm();
})
)(ExistingImport);