UNPKG

decentraland-ui

Version:

Decentraland's UI components and styles

111 lines (110 loc) 6.4 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.BuyWithFiatNetwork = exports.gatewaysNames = exports.NetworkGatewayType = void 0; var React = __importStar(require("react")); var classnames_1 = __importDefault(require("classnames")); var network_1 = require("../../lib/network"); var Button_1 = require("../Button/Button"); require("./Network.css"); var NetworkGatewayType; (function (NetworkGatewayType) { NetworkGatewayType["MOON_PAY"] = "moonPay"; NetworkGatewayType["TRANSAK"] = "transak"; })(NetworkGatewayType = exports.NetworkGatewayType || (exports.NetworkGatewayType = {})); exports.gatewaysNames = (_a = {}, _a[NetworkGatewayType.MOON_PAY] = 'MoonPay', _a[NetworkGatewayType.TRANSAK] = 'Transak', _a); var ButWithFiatNetworkGateway = /** @class */ (function (_super) { __extends(ButWithFiatNetworkGateway, _super); function ButWithFiatNetworkGateway() { return _super !== null && _super.apply(this, arguments) || this; } ButWithFiatNetworkGateway.prototype.render = function () { var _a = this.props, type = _a.type, network = _a.network, i18n = _a.i18n, learnMoreLink = _a.learnMoreLink, _b = _a.disabled, disabled = _b === void 0 ? false : _b, onContinue = _a.onContinue; var title = "Buy ".concat((0, network_1.getNetworkMANADescription)(network), " with ").concat(exports.gatewaysNames[type]); var subtitle = 'You can buy with debit and credit cards, Apple Pay, Google Pay, or via bank transfer.'; var continueButtonText = "Continue with ".concat(exports.gatewaysNames[type]); return (React.createElement("div", { className: (0, classnames_1.default)('dcl', 'gateway', type, disabled) }, React.createElement("div", { className: "image" }), React.createElement("div", { className: "info" }, React.createElement("div", { className: "diseableable-container" }, React.createElement("div", { className: "title" }, (i18n === null || i18n === void 0 ? void 0 : i18n.title) || title), React.createElement("div", { className: "subtitle" }, (i18n === null || i18n === void 0 ? void 0 : i18n.subtitle) || subtitle), React.createElement(Button_1.Button, { primary: true, onClick: onContinue, className: 'continue-button', disabled: disabled }, (i18n === null || i18n === void 0 ? void 0 : i18n.continueButtonText) || continueButtonText)), (i18n === null || i18n === void 0 ? void 0 : i18n.learnMoreText) ? (React.createElement("a", { className: "learn-more", href: learnMoreLink, target: "_blank", rel: "external" }, i18n === null || i18n === void 0 ? void 0 : i18n.learnMoreText)) : (React.createElement("span", { className: "learn-more" }, React.createElement("a", { href: learnMoreLink, target: "_blank", rel: "external" }, "Learn more"), " about ".concat(exports.gatewaysNames[type])))))); }; return ButWithFiatNetworkGateway; }(React.PureComponent)); var BuyWithFiatNetwork = /** @class */ (function (_super) { __extends(BuyWithFiatNetwork, _super); function BuyWithFiatNetwork() { return _super !== null && _super.apply(this, arguments) || this; } BuyWithFiatNetwork.prototype.enabledFirst = function (_a, _b) { var _c = _a.disabled, disabledA = _c === void 0 ? false : _c; var _d = _b.disabled, disabledB = _d === void 0 ? false : _d; return Number(disabledA) - Number(disabledB); }; BuyWithFiatNetwork.prototype.render = function () { var _a = this.props, type = _a.type, gateways = _a.gateways; return (React.createElement("div", { className: "gateways-container" }, gateways.sort(this.enabledFirst).map(function (gatewayProps) { return (React.createElement(ButWithFiatNetworkGateway, __assign({}, gatewayProps, { key: gatewayProps.type, network: type }))); }))); }; BuyWithFiatNetwork.Gateway = ButWithFiatNetworkGateway; return BuyWithFiatNetwork; }(React.Component)); exports.BuyWithFiatNetwork = BuyWithFiatNetwork;