@privy-io/react-auth
Version:
React client for the Privy Auth API
2 lines (1 loc) • 741 B
JavaScript
import{jsx as e}from"react/jsx-runtime";import{Turnstile as r}from"@marsidev/react-turnstile";const t=({delayedExecution:t,captchaContext:o,...n})=>{let{appId:s,setError:a,setToken:i,setExecuting:c,siteKey:p,ref:u}=o;/*#__PURE__*/return e(r,{...n,ref:u,siteKey:p??"",options:{action:s,size:"invisible",...t?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{n.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:e=>{n.onError?.(e),a("Captcha failed"),c(!1)},onSuccess:e=>{n.onSuccess?.(e),i(e),c(!1)},onExpire:e=>{n.onExpire?.(e);try{u.current?.reset(),a(void 0),i(void 0)}catch(e){a("expired_and_failed_reset")}}})};export{t as TurnstileWrapper,t as default};