"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = require("path");
var react_1 = __importDefault(require("react"));
var ChooseConnectionMethod_1 = require("./ChooseConnectionMethod");
var ConnectWithPassphrase_1 = require("./ConnectWithPassphrase");
var ConnectWithEmoji_1 = require("./ConnectWithEmoji");
var react_router_dom_1 = require("react-router-dom");
var react_router_1 = require("react-router");
exports.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 = react_router_1.useHistory();
    var onConnectWithDeviceClick = function () {
        walletService.initializeConnection(name).then(function () {
            history.push(path_1.join(basePath, 'emoji'), { ensName: name });
        });
    };
    return react_1.default.createElement(react_router_dom_1.Switch, null,
        react_1.default.createElement(react_router_dom_1.Route, { exact: true, path: path_1.join(basePath, 'chooseMethod') },
            react_1.default.createElement(ChooseConnectionMethod_1.ChooseConnectionMethod, { onConnectWithDeviceClick: onConnectWithDeviceClick, onConnectWithPassphraseClick: function () { return history.push(path_1.join(basePath, 'recover'), { ensName: name }); }, onCancel: onCancel, className: className })),
        react_1.default.createElement(react_router_dom_1.Route, { exact: true, path: path_1.join(basePath, 'recover') },
            react_1.default.createElement(ConnectWithPassphrase_1.ConnectWithPassphrase, { name: name, walletService: walletService, onRecover: onSuccess, className: className, onCancel: function () { return history.goBack(); } })),
        react_1.default.createElement(react_router_dom_1.Route, { exact: true, path: path_1.join(basePath, 'emoji') },
            react_1.default.createElement(ConnectWithEmoji_1.ConnectWithEmoji, { sdk: sdk, walletService: walletService, onConnect: onSuccess, onCancel: onCancel, className: className })));
};
//# sourceMappingURL=ConnectionFlow.js.map