UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 551 B
import{jsx as e}from"react/jsx-runtime";import r from"@hcaptcha/react-hcaptcha";const t=({delayedExecution:t,captchaContext:o,...a})=>{let{setError:c,setToken:i,setExecuting:n,execute:s,siteKey:p,ref:d}=o;/*#__PURE__*/return e(r,{ref:d,sitekey:p??"",size:"invisible",onLoad:()=>{t||s()},onVerify:e=>{a.onSuccess?.(e),i(e),n(!1)},onError:e=>{a.onError?.(e),c("Captcha failed"),n(!1)},onExpire:()=>{a.onExpire?.("");try{d.current?.resetCaptcha(),c(void 0),i(void 0)}catch(e){c("expired_and_failed_reset")}}})};export{t as HCaptchaWrapper,t as default};