@privy-io/react-auth
Version:
React client for the Privy Auth API
2 lines (1 loc) • 2.35 kB
JavaScript
import{jsx as t}from"react/jsx-runtime";import{useState as e}from"react";import{u as o,a as i}from"./get-is-unified-wallet-DvKS5IUO.mjs";import{S as n}from"./ScreenLayout-CddsD3Of.mjs";import"viem";import"./context-Bycd1SKV.mjs";import"@privy-io/js-sdk-core";import"tinycolor2";import"./internal-context-e-Eni5bG.mjs";import"ofetch";import"./Button-B8mqatRx.mjs";import"styled-components";import"./useActiveWallet-Bsy5GTCV.mjs";import"zustand";import"react-device-detect";import"./prepareFundingModalData-CIgFwA7s.mjs";import"eventemitter3";import"./events-context-CI0iqAXA.mjs";import"viem/utils";import"./getPublicClient-A9RSftUZ.mjs";import"./useWallets-D0lpBS44.mjs";import"./Screen-BTyXgDrd.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"./index-CJMgUOnw.mjs";const r=({title:e,subtitle:o,buttonText:i,buttonHref:r,isLoading:l=!1,helpText:a,onButtonClick:m})=>/*#__PURE__*/t(n,{title:e,subtitle:o,primaryCta:{label:i,onClick:()=>{r&&window.open(r,"_self"),m?.()},disabled:l},helpText:a,watermark:!0}),l={component:()=>{let{ready:n}=o(),{data:l}=i(),[a,m]=e(!1);if(!l?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:s,connectOnly:c,chainType:p}=l.installWalletModalData,u=s.getMobileRedirect({useUniversalLink:!a,isSolana:"solana"===p,connectOnly:c}),d=s.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 n&&(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 ${s.name} mobile app.`,h.footnote=`Once you're done, you can connect with ${s.name} wallet to complete the login.`),/*#__PURE__*/t(r,{title:h.title,subtitle:h.description,buttonText:a?"Go to App Store":"Continue",buttonHref:u,isLoading:n&&!u,helpText:h.footnote||void 0,onButtonClick:()=>{setTimeout((()=>m(!0)),1e3)}})}};export{l as WalletInterstitialScreen,r as WalletInterstitialScreenView,l as default};