@privy-io/react-auth
Version:
React client for the Privy Auth API
2 lines (1 loc) • 2.3 kB
JavaScript
import{jsx as t}from"react/jsx-runtime";import{useState as e}from"react";import{u as o,a as i}from"./privy-context-DrMxzgOR.mjs";import{S as r}from"./ScreenLayout-D1p_ntex.mjs";import"@privy-io/are-addresses-equal";import"./context-DLtU3JQy.mjs";import"@privy-io/js-sdk-core";import"tinycolor2";import"./internal-context-Z-fyxadS.mjs";import"ofetch";import"./ModalHeader-BnVmXtvG.mjs";import"styled-components";import"./useActiveWallet-CvP7iYvj.mjs";import"zustand";import"react-device-detect";import"./use-export-wallet-_wu5ex5t.mjs";import"./useWallets-BzNCTucF.mjs";import"viem";import"eventemitter3";import"viem/utils";import"./events-context-CI0iqAXA.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"./Screen-Cycy3IzT.mjs";import"./index-Dq_xe9dz.mjs";const n=({title:e,subtitle:o,buttonText:i,buttonHref:n,isLoading:l=!1,helpText:a,onButtonClick:s})=>/*#__PURE__*/t(r,{title:e,subtitle:o,primaryCta:{label:i,onClick:()=>{n&&window.open(n,"_self"),s?.()},disabled:l},helpText:a,watermark:!0}),l={component:()=>{let{ready:r}=o(),{data:l}=i(),[a,s]=e(!1);if(!l?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:m,connectOnly:c,chainType:p}=l.installWalletModalData,u=m.getMobileRedirect({useUniversalLink:!a,isSolana:"solana"===p,connectOnly:c}),d=m.name.replace(/ wallet/gi,""),h={title:`Redirecting to ${d} Mobile Wallet`,description:`We'll take you to the ${d} Mobile Wallet app to continue your login experience.`,footnote:""};return r&&(h.description=`For the best experience, we'll automatically log you into the ${d} Mobile Wallet in-app browser.`,h.footnote="You can always return here to login via other methods."),a&&(h.title="Still here?",h.description=`You may need to install the ${m.name} mobile app.`,h.footnote=`Once you're done, you can connect with ${m.name} wallet to complete the login.`),/*#__PURE__*/t(n,{title:h.title,subtitle:h.description,buttonText:a?"Go to App Store":"Continue",buttonHref:u,isLoading:r&&!u,helpText:h.footnote||void 0,onButtonClick:()=>{setTimeout((()=>s(!0)),1e3)}})}};export{l as WalletInterstitialScreen,n as WalletInterstitialScreenView,l as default};