"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var react_router_1 = require("react-router");
var path_1 = require("path");
var DevicesList_1 = require("./DevicesList");
var ConnectionNotification_1 = require("../../Notifications/ConnectionNotification");
var DisconnectAccount_1 = require("../DisconnectAccount");
var ConnectionSuccessNotification_1 = require("../../Notifications/ConnectionSuccessNotification");
var WaitingForTransaction_1 = require("../../commons/WaitingForTransaction");
var ErrorMessage_1 = require("../../commons/ErrorMessage");
exports.Devices = function (_a) {
    var walletService = _a.walletService, onAccountDisconnected = _a.onAccountDisconnected, className = _a.className, _b = _a.basePath, basePath = _b === void 0 ? '' : _b;
    var deployedWallet = walletService.getDeployedWallet();
    var relayerConfig = walletService.sdk.getRelayerConfig();
    var history = react_router_1.useHistory();
    return (react_1.default.createElement(react_router_1.Switch, null,
        react_1.default.createElement(react_router_1.Route, { path: basePath + "/", exact: true },
            react_1.default.createElement(DevicesList_1.DevicesList, { deployedWallet: deployedWallet, devicesBasePath: basePath, className: className })),
        react_1.default.createElement(react_router_1.Route, { path: path_1.join(basePath, 'approveDevice'), exact: true },
            react_1.default.createElement(ConnectionNotification_1.ConnectionNotification, { deployedWallet: deployedWallet, devicesBasePath: basePath, className: className })),
        react_1.default.createElement(react_router_1.Route, { path: path_1.join(basePath, 'connectionSuccess'), exact: true },
            react_1.default.createElement(ConnectionSuccessNotification_1.ConnectionSuccessNotification, { basePath: basePath, className: className })),
        react_1.default.createElement(react_router_1.Route, { path: path_1.join(basePath, 'connectionFailed'), exact: true },
            react_1.default.createElement(ErrorMessage_1.ErrorMessage, { className: className })),
        react_1.default.createElement(react_router_1.Route, { path: path_1.join(basePath, 'disconnectAccount'), exact: true },
            react_1.default.createElement(DisconnectAccount_1.DisconnectAccount, { walletService: walletService, onDisconnectProgress: function (transactionHash) { return history.replace(path_1.join(basePath, 'waitingForDeletingAccount'), { transactionHash: transactionHash }); }, onAccountDisconnected: onAccountDisconnected, onCancelClick: function () { return history.replace(basePath + "/"); }, className: className })),
        react_1.default.createElement(react_router_1.Route, { path: path_1.join(basePath, 'waitingForRemovingDevice'), exact: true, render: function (_a) {
                var location = _a.location;
                var _b;
                return react_1.default.createElement(WaitingForTransaction_1.WaitingForTransaction, { action: "Removing device", relayerConfig: relayerConfig, className: className, transactionHash: (_b = location.state) === null || _b === void 0 ? void 0 : _b.transactionHash });
            } }),
        react_1.default.createElement(react_router_1.Route, { path: path_1.join(basePath, 'waitingForDeletingAccount'), exact: true, render: function (_a) {
                var location = _a.location;
                var _b;
                return react_1.default.createElement(WaitingForTransaction_1.WaitingForTransaction, { action: "Deleting account", relayerConfig: relayerConfig, className: className, transactionHash: (_b = location.state) === null || _b === void 0 ? void 0 : _b.transactionHash });
            } }),
        react_1.default.createElement(react_router_1.Route, { path: path_1.join(basePath, 'waitingForConnection'), exact: true, render: function (_a) {
                var location = _a.location;
                var _b;
                return react_1.default.createElement(WaitingForTransaction_1.WaitingForTransaction, { action: "Connecting device", relayerConfig: relayerConfig, className: className, transactionHash: (_b = location.state) === null || _b === void 0 ? void 0 : _b.transactionHash });
            } })));
};
//# sourceMappingURL=Devices.js.map