UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 2.59 kB
import{jsx as e}from"react/jsx-runtime";import{useRef as t,useCallback as o}from"react";import{u as r}from"./context-WTldtXS8.mjs";import{u as n,c as a,b as i}from"./internal-context-Z-fyxadS.mjs";import{a as l}from"./events-context-CI0iqAXA.mjs";import{a as c}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{i as s}from"./ConnectWalletView-CDqboUej.mjs";import"@privy-io/js-sdk-core";import"tinycolor2";import"ofetch";import"@privy-io/are-addresses-equal";import"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"react-device-detect";import"styled-components";import"./ModalHeader-D8-mhjp4.mjs";import"./useActiveWallet-3RHPIBxJ.mjs";import"zustand";import"./use-export-wallet-CV4p7L0b.mjs";import"eventemitter3";import"viem/utils";import"./useWallets-CR0z5IIt.mjs";import"viem";import"./getPublicClient-B4uPLKn-.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"./CopyableText-BCytXyJL.mjs";import"lucide-react";import"./Link-DJ5gq9Di.mjs";import"./QrCode-C1tgJtOy.mjs";import"qrcode";import"./EmailInputForm-Dgoii4vf.mjs";import"./ErrorMessage-D8VaAP5m.mjs";import"./useI18n-BuIe8nUA.mjs";import"./WalletCards-DH1rqayz.mjs";import"./Screen-Bp-TN9gb.mjs";import"./index-Dq_xe9dz.mjs";const m={component:()=>{let{setWalletConnectionStatus:m,closePrivyModal:p,inProgressAuthFlowRef:u}=n(),{data:d,navigate:C}=c(),j=r(),W=l(),w=d?.externalConnectWallet?.description,E=t(d?.externalConnectWallet?.walletList??j.appearance.walletList),x=t(d?.externalConnectWallet?.walletChainType??j.appearance.walletChainType),f=E.current,h=x.current,v="link"===u.current?void 0:()=>C("LandingScreen");/*#__PURE__*/return e(s,{walletList:f,walletChainType:h,onClose:p,onConnect:o((({connector:e,wallet:t})=>{W("connectWallet","onSuccess",{wallet:t}),m({status:"connected",connectedWallet:t,connector:e,connectError:null,connectRetry:()=>null}),C("ConnectionStatusScreen",!d?.externalConnectWallet?.preSelectedWalletId)}),[m,C,d?.login?.disableSignup,d?.externalConnectWallet?.preSelectedWalletId]),onConnectError:e=>{e instanceof a?(console.warn(e.cause?e.cause:e.message),W("connectWallet","onError",e.privyErrorCode||i.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),W("connectWallet","onError",i.UNKNOWN_CONNECT_WALLET_ERROR))},onBack:v,customDescription:w||"",preSelectedWalletId:d?.externalConnectWallet?.preSelectedWalletId,app:j})},isUnauthenticatedScreem:!0};export{m as AuthenticateWithWalletScreen,m as default};