import { join } from 'path';
import React from 'react';
import { ChooseConnectionMethod } from './ChooseConnectionMethod';
import { ConnectWithPassphrase } from './ConnectWithPassphrase';
import { ConnectWithEmoji } from './ConnectWithEmoji';
import { Switch, Route } from 'react-router-dom';
import { useHistory } from 'react-router';
export var ConnectionFlow = function (_a) {
    var _b = _a.basePath, basePath = _b === void 0 ? '' : _b, name = _a.name, onCancel = _a.onCancel, onSuccess = _a.onSuccess, sdk = _a.sdk, walletService = _a.walletService, className = _a.className;
    var history = useHistory();
    var onConnectWithDeviceClick = function () {
        walletService.initializeConnection(name).then(function () {
            history.push(join(basePath, 'emoji'), { ensName: name });
        });
    };
    return React.createElement(Switch, null,
        React.createElement(Route, { exact: true, path: join(basePath, 'chooseMethod') },
            React.createElement(ChooseConnectionMethod, { onConnectWithDeviceClick: onConnectWithDeviceClick, onConnectWithPassphraseClick: function () { return history.push(join(basePath, 'recover'), { ensName: name }); }, onCancel: onCancel, className: className })),
        React.createElement(Route, { exact: true, path: join(basePath, 'recover') },
            React.createElement(ConnectWithPassphrase, { name: name, walletService: walletService, onRecover: onSuccess, className: className, onCancel: function () { return history.goBack(); } })),
        React.createElement(Route, { exact: true, path: join(basePath, 'emoji') },
            React.createElement(ConnectWithEmoji, { sdk: sdk, walletService: walletService, onConnect: onSuccess, onCancel: onCancel, className: className })));
};
//# sourceMappingURL=ConnectionFlow.js.map