@privy-io/react-auth
Version:
React client for the Privy Auth API
2 lines (1 loc) • 2.55 kB
JavaScript
import{jsx as e}from"react/jsx-runtime";import{useRef as t,useCallback as o}from"react";import{u as r}from"./context-DLtU3JQy.mjs";import{u as n,c as a,b as l}from"./internal-context-Z-fyxadS.mjs";import{a as i}from"./events-context-CI0iqAXA.mjs";import{a as c}from"./privy-context-DrMxzgOR.mjs";import{i as s}from"./ConnectWalletView-pxEyo8WM.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-BnVmXtvG.mjs";import"./useActiveWallet-CvP7iYvj.mjs";import"zustand";import"./use-export-wallet-_wu5ex5t.mjs";import"./useWallets-BzNCTucF.mjs";import"viem";import"eventemitter3";import"viem/utils";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-B84kEIjT.mjs";import"qrcode";import"./EmailInputForm-Dgoii4vf.mjs";import"./ErrorMessage-D8VaAP5m.mjs";import"./useI18n-C4fmUAf3.mjs";import"./WalletCards-DH1rqayz.mjs";import"./Screen-Cycy3IzT.mjs";import"./index-Dq_xe9dz.mjs";const m={component:()=>{let{setWalletConnectionStatus:m,closePrivyModal:p,inProgressAuthFlowRef:u}=n(),{data:d,navigate:C}=c(),W=r(),j=i(),E=d?.externalConnectWallet?.description,w=t(d?.externalConnectWallet?.walletList??W.appearance.walletList),x=t(d?.externalConnectWallet?.walletChainType??W.appearance.walletChainType),v=w.current,h=x.current,y="link"===u.current?void 0:()=>C("LandingScreen");/*#__PURE__*/return e(s,{walletList:v,walletChainType:h,onClose:p,onConnect:o((({connector:e,wallet:t})=>{j("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),j("connectWallet","onError",e.privyErrorCode||l.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),j("connectWallet","onError",l.UNKNOWN_CONNECT_WALLET_ERROR))},onBack:y,customDescription:E||"",preSelectedWalletId:d?.externalConnectWallet?.preSelectedWalletId,app:W})},isUnauthenticatedScreem:!0};export{m as AuthenticateWithWalletScreen,m as default};