UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 3.46 kB
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{FileCheck as r,ExternalLink as i}from"lucide-react";import"react";import{styled as o}from"styled-components";import{B as n}from"./Button-B8mqatRx.mjs";import{u as a}from"./context-Bycd1SKV.mjs";import{u as s}from"./internal-context-e-Eni5bG.mjs";import{u as m,a as l}from"./get-is-unified-wallet-DvKS5IUO.mjs";import{s as c}from"./shouldProceedtoEmbeddedWalletCreationFlow-Djgu4xiS.mjs";import{S as p}from"./ScreenLayout-CddsD3Of.mjs";import"./useActiveWallet-Bsy5GTCV.mjs";import"zustand";import"react-device-detect";import"./prepareFundingModalData-CIgFwA7s.mjs";import"@privy-io/js-sdk-core";import"eventemitter3";import"./events-context-CI0iqAXA.mjs";import"viem";import"viem/utils";import"./getPublicClient-A9RSftUZ.mjs";import"./useWallets-D0lpBS44.mjs";import"tinycolor2";import"ofetch";import"./index-CCyaupaz.mjs";import"uuid";import"jose";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"mipd";import"@privy-io/popup";import"./paths-3HW55qZg.mjs";import"./usePrivy-BaiIHGte.mjs";import"@scure/base";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"@privy-io/urls";import"js-cookie";import"./frame-CwE9r3cT.mjs";import"@privy-io/routes";import"x402/client";import"@privy-io/api-base";import"viem/accounts";import"./use-sign-with-user-signer-eEm9Olt_.mjs";import"./getEmbeddedConnectedWallet-CM6cDQCS.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 d={component:()=>{let{user:t,logout:r}=m(),{onUserCloseViaDialogOrKeybindRef:i,setModalData:o,navigate:n}=l(),p=a(),{acceptTerms:d,closePrivyModal:y,createAnalyticsEvent:h}=s(),v=e=>{e?.preventDefault(),y({shouldCallAuthOnSuccess:!1}),r()};i.current=v;/*#__PURE__*/return e(u,{termsAndConditionsUrl:p?.legal.termsAndConditionsUrl,privacyPolicyUrl:p?.legal.privacyPolicyUrl,onAccept:async e=>{e?.preventDefault(),await d(),t&&c(t,p.embeddedWallets)?(o({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),n("EmbeddedWalletOnAccountCreateScreen")):y()},onDecline:v})}},u=({termsAndConditionsUrl:o,privacyPolicyUrl:a,onAccept:s,onDecline:m,title:l="One last step",subtitle:c="By signing up, you agree to our terms and privacy policy."})=>/*#__PURE__*/e(p,{title:l,subtitle:c,icon:r,primaryCta:{label:"Accept",onClick:s},secondaryCta:{label:"No thanks",onClick:m},watermark:!0,children:(o||a)&&/*#__PURE__*/t(y,{children:[o&&/*#__PURE__*/t(n,{variant:"muted",href:o,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Terms",/*#__PURE__*/e(i,{width:16,height:16,strokeWidth:2.25})]}),a&&/*#__PURE__*/t(n,{variant:"muted",href:a,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Privacy Policy",/*#__PURE__*/e(i,{width:16,height:16,strokeWidth:2.25})]})]})});let y=/*#__PURE__*/o.div.withConfig({displayName:"LinksContainer",componentId:"sc-d5115275-0"})(["display:flex;flex-direction:column;gap:12px;margin-top:var(--screen-space);"]);export{d as AffirmativeConsentScreen,u as AffirmativeConsentScreenView,d as default};