UNPKG

@turnkey/react-wallet-kit

Version:

The easiest and most powerful way to integrate Turnkey's Embedded Wallets into your React applications.

62 lines (58 loc) 1.94 kB
'use strict'; var jsxRuntime = require('react/jsx-runtime'); var Hook = require('../../providers/modal/Hook.js'); var clsx = require('clsx'); var Action = require('../auth/Action.js'); var Success = require('../design/Success.js'); function OnRampPage({ icon, onrampProvider, action, completed, successPageDuration = 2000, sandboxMode = false, onSuccess, onError }) { const { closeModal, isMobile } = Hook.useModal(); if (completed) { return jsxRuntime.jsx("div", { className: clsx("flex flex-col items-center justify-center py-5 transition-all duration-300 text-center", isMobile ? "w-full" : "w-72"), children: jsxRuntime.jsx(Success.SuccessPage, { text: "On Ramp Transaction Complete!", duration: successPageDuration, onComplete: () => { onSuccess?.(); closeModal(); } }) }); } return jsxRuntime.jsxs("div", { className: clsx("flex flex-col items-center justify-center py-5 transition-all duration-300 text-center", isMobile ? "w-full" : "w-72"), children: [jsxRuntime.jsx(Action.ActionPage, { title: "Initiating OnRamp", icon: icon, action: async () => { try { await action(); } catch (err) { onError?.(err); throw err; } }, closeOnComplete: false }), jsxRuntime.jsx("div", { className: "text-icon-text-light text-sm dark:text-icon-text-dark text-center !p-0", children: onrampProvider === "FIAT_ON_RAMP_PROVIDER_COINBASE" ? "Use the Coinbase popup to finish funding your account." : "Use the MoonPay popup to finish funding your account." }), sandboxMode && jsxRuntime.jsx("div", { className: "mt-2 text-xs text-primary-light dark:text-primary-dark", children: "Sandbox mode \u2014 no real funds will be used." })] }); } exports.OnRampPage = OnRampPage; //# sourceMappingURL=OnRamp.js.map