UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 663 B
"use strict";var e=require("react/jsx-runtime");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/t(require("@hcaptcha/react-hcaptcha"));const a=({delayedExecution:t,captchaContext:a,...c})=>{let{setError:i,setToken:o,setExecuting:n,execute:s,siteKey:u,ref:p}=a;/*#__PURE__*/return e.jsx(r.default,{ref:p,sitekey:u??"",size:"invisible",onLoad:()=>{t||s()},onVerify:e=>{c.onSuccess?.(e),o(e),n(!1)},onError:e=>{c.onError?.(e),i("Captcha failed"),n(!1)},onExpire:()=>{c.onExpire?.("");try{p.current?.resetCaptcha(),i(void 0),o(void 0)}catch(e){i("expired_and_failed_reset")}}})};exports.HCaptchaWrapper=a,exports.default=a;