UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 2.58 kB
import{jsx as e}from"react/jsx-runtime";import{useRef as t,useCallback as o}from"react";import{u as r}from"./context-Bycd1SKV.mjs";import{u as n,c as a,b as i}from"./internal-context-e-Eni5bG.mjs";import{a as l}from"./events-context-CI0iqAXA.mjs";import{a as c}from"./get-is-unified-wallet-DvKS5IUO.mjs";import{i as s}from"./ConnectWalletView-eQbJO3Pg.mjs";import"@privy-io/js-sdk-core";import"tinycolor2";import"ofetch";import"viem";import"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"react-device-detect";import"styled-components";import"./Button-B8mqatRx.mjs";import"./useActiveWallet-Bsy5GTCV.mjs";import"zustand";import"./prepareFundingModalData-CIgFwA7s.mjs";import"eventemitter3";import"viem/utils";import"./getPublicClient-A9RSftUZ.mjs";import"./useWallets-D0lpBS44.mjs";import"@heroicons/react/24/outline/CheckIcon";import"./copy-Bx2Jwc5_.mjs";import"./ModalHeader-BLGC-7ev.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"./QrCode-DR5LogOp.mjs";import"qrcode";import"./EmailInputForm-B4hjCxRU.mjs";import"./ErrorMessage-Cx8GKGhL.mjs";import"./useI18n-BtdAZuQ8.mjs";import"./WalletCards-DH1rqayz.mjs";import"./Screen-BTyXgDrd.mjs";import"./index-CJMgUOnw.mjs";const m={component:()=>{let{setWalletConnectionStatus:m,closePrivyModal:p,inProgressAuthFlowRef:u}=n(),{data:d,navigate:C}=c(),W=r(),j=l(),w=d?.externalConnectWallet?.description,h=t(d?.externalConnectWallet?.walletList??W.appearance.walletList),E=t(d?.externalConnectWallet?.walletChainType??W.appearance.walletChainType),f=h.current,v=E.current,x="link"===u.current?void 0:()=>C("LandingScreen");/*#__PURE__*/return e(s,{walletList:f,walletChainType:v,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||i.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),j("connectWallet","onError",i.UNKNOWN_CONNECT_WALLET_ERROR))},onBack:x,customDescription:w||"",preSelectedWalletId:d?.externalConnectWallet?.preSelectedWalletId,app:W})},isUnauthenticatedScreem:!0};export{m as AuthenticateWithWalletScreen,m as default};