Socket
Socket
Sign inDemoInstall

@hcaptcha/vue3-hcaptcha

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hcaptcha/vue3-hcaptcha - npm Package Compare versions

Comparing version 1.0.0-alpha.2 to 1.0.0

2

dist/hcaptcha-vue3.es.js

@@ -197,3 +197,3 @@ import { openBlock, createElementBlock } from "vue";

onChallengeExpired() {
this.$emit("challenge-expired");
this.$emit("challengeExpired");
},

@@ -200,0 +200,0 @@ onOpen() {

@@ -1,1 +0,1 @@

(function(d,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r(require("vue")):typeof define=="function"&&define.amd?define(["vue"],r):(d=typeof globalThis!="undefined"?globalThis:d||self,d.VueHcaptcha=r(d.Vue))})(this,function(d){"use strict";const r="hcaptcha-api-script-id",h="_hcaptchaOnLoad";let s,c;const o=new Promise((t,e)=>{s=t,c=e});function p(t){if(window.hcaptcha)return s(),o;if(document.getElementById(r))return o;window[h]=s;const e=l(t),i=document.createElement("script");return i.id=r,i.src=e,i.async=!0,i.defer=!0,i.onerror=a=>{console.error("Failed to load api: "+e,a),c("Failed to load api.js")},document.head.appendChild(i),o}function l(t){let e=t.apiEndpoint;return e=n(e,"render","explicit"),e=n(e,"onload",h),e=n(e,"recaptchacompat",t.reCaptchaCompat===!1?"off":null),e=n(e,"hl",t.language),e=n(e,"sentry",t.sentry),e=n(e,"endpoint",t.endpoint),e=n(e,"assethost",t.assethost),e=n(e,"imghost",t.imghost),e=n(e,"reportapi",t.reportapi),e}function n(t,e,i){if(i!=null){const a=t.includes("?")?"&":"?";return t+a+e+"="+encodeURIComponent(i)}return t}var u=(t,e)=>{for(const[i,a]of e)t[i]=a;return t};const f={name:"VueHcaptcha",props:{sitekey:{type:String,required:!0},theme:{type:String,default:void 0},size:{type:String,default:void 0},tabindex:{type:String,default:void 0},language:{type:String,default:void 0},reCaptchaCompat:{type:Boolean,default:!0},challengeContainer:{type:String,default:void 0},rqdata:{type:String,default:void 0},sentry:{type:Boolean,default:!0},apiEndpoint:{type:String,default:"https://hcaptcha.com/1/api.js"},endpoint:{type:String,default:void 0},reportapi:{type:String,default:void 0},assethost:{type:String,default:void 0},imghost:{type:String,default:void 0}},data:()=>({widgetId:null,hcaptcha:null}),mounted(){return p(this.$props).then(this.onApiLoaded).catch(this.onError)},unmounted(){this.widgetId&&this.hcaptcha.then(()=>{this.hcaptcha.reset(this.widgetId),this.hcaptcha.remove(this.widgetId)})},methods:{onApiLoaded(){this.hcaptcha=window.hcaptcha;const t={sitekey:this.sitekey,theme:this.theme,size:this.size,tabindex:this.tabindex,callback:this.onVerify,"expired-callback":this.onExpired,"chalexpired-callback":this.onChallengeExpired,"error-callback":this.onError,"open-callback":this.onOpen,"close-callback":this.onClose};this.challengeContainer&&(t["challenge-container"]=this.challengeContainer),this.widgetId=this.hcaptcha.render(this.$el,t),this.rqdata&&this.hcaptcha.setData(this.widgetId,{rqdata:this.rqdata}),this.onRendered()},execute(){this.widgetId?(this.hcaptcha.execute(this.widgetId),this.onExecuted()):this.$on("rendered",this.execute)},reset(){this.widgetId?(this.hcaptcha.reset(this.widgetId),this.onReset()):this.$emit("error","Element is not rendered yet and thus cannot reset it. Wait for `rendered` event to safely call reset.")},onRendered(){this.$emit("rendered")},onExecuted(){this.$emit("executed")},onReset(){this.$emit("reset")},onError(t){this.$emit("error",t),this.reset()},onVerify(){const t=this.hcaptcha.getResponse(this.widgetId),e=this.hcaptcha.getRespKey(this.widgetId);this.$emit("verify",t,e)},onExpired(){this.$emit("expired")},onChallengeExpired(){this.$emit("challenge-expired")},onOpen(){this.$emit("opened")},onClose(){this.$emit("closed")}}},m={id:"hcap-script"};function g(t,e,i,a,x,w){return d.openBlock(),d.createElementBlock("div",m)}var y=u(f,[["render",g]]);return y});
(function(d,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r(require("vue")):typeof define=="function"&&define.amd?define(["vue"],r):(d=typeof globalThis!="undefined"?globalThis:d||self,d.VueHcaptcha=r(d.Vue))})(this,function(d){"use strict";const r="hcaptcha-api-script-id",h="_hcaptchaOnLoad";let s,c;const o=new Promise((t,e)=>{s=t,c=e});function p(t){if(window.hcaptcha)return s(),o;if(document.getElementById(r))return o;window[h]=s;const e=l(t),i=document.createElement("script");return i.id=r,i.src=e,i.async=!0,i.defer=!0,i.onerror=a=>{console.error("Failed to load api: "+e,a),c("Failed to load api.js")},document.head.appendChild(i),o}function l(t){let e=t.apiEndpoint;return e=n(e,"render","explicit"),e=n(e,"onload",h),e=n(e,"recaptchacompat",t.reCaptchaCompat===!1?"off":null),e=n(e,"hl",t.language),e=n(e,"sentry",t.sentry),e=n(e,"endpoint",t.endpoint),e=n(e,"assethost",t.assethost),e=n(e,"imghost",t.imghost),e=n(e,"reportapi",t.reportapi),e}function n(t,e,i){if(i!=null){const a=t.includes("?")?"&":"?";return t+a+e+"="+encodeURIComponent(i)}return t}var u=(t,e)=>{for(const[i,a]of e)t[i]=a;return t};const f={name:"VueHcaptcha",props:{sitekey:{type:String,required:!0},theme:{type:String,default:void 0},size:{type:String,default:void 0},tabindex:{type:String,default:void 0},language:{type:String,default:void 0},reCaptchaCompat:{type:Boolean,default:!0},challengeContainer:{type:String,default:void 0},rqdata:{type:String,default:void 0},sentry:{type:Boolean,default:!0},apiEndpoint:{type:String,default:"https://hcaptcha.com/1/api.js"},endpoint:{type:String,default:void 0},reportapi:{type:String,default:void 0},assethost:{type:String,default:void 0},imghost:{type:String,default:void 0}},data:()=>({widgetId:null,hcaptcha:null}),mounted(){return p(this.$props).then(this.onApiLoaded).catch(this.onError)},unmounted(){this.widgetId&&this.hcaptcha.then(()=>{this.hcaptcha.reset(this.widgetId),this.hcaptcha.remove(this.widgetId)})},methods:{onApiLoaded(){this.hcaptcha=window.hcaptcha;const t={sitekey:this.sitekey,theme:this.theme,size:this.size,tabindex:this.tabindex,callback:this.onVerify,"expired-callback":this.onExpired,"chalexpired-callback":this.onChallengeExpired,"error-callback":this.onError,"open-callback":this.onOpen,"close-callback":this.onClose};this.challengeContainer&&(t["challenge-container"]=this.challengeContainer),this.widgetId=this.hcaptcha.render(this.$el,t),this.rqdata&&this.hcaptcha.setData(this.widgetId,{rqdata:this.rqdata}),this.onRendered()},execute(){this.widgetId?(this.hcaptcha.execute(this.widgetId),this.onExecuted()):this.$on("rendered",this.execute)},reset(){this.widgetId?(this.hcaptcha.reset(this.widgetId),this.onReset()):this.$emit("error","Element is not rendered yet and thus cannot reset it. Wait for `rendered` event to safely call reset.")},onRendered(){this.$emit("rendered")},onExecuted(){this.$emit("executed")},onReset(){this.$emit("reset")},onError(t){this.$emit("error",t),this.reset()},onVerify(){const t=this.hcaptcha.getResponse(this.widgetId),e=this.hcaptcha.getRespKey(this.widgetId);this.$emit("verify",t,e)},onExpired(){this.$emit("expired")},onChallengeExpired(){this.$emit("challengeExpired")},onOpen(){this.$emit("opened")},onClose(){this.$emit("closed")}}},m={id:"hcap-script"};function g(t,e,i,a,x,w){return d.openBlock(),d.createElementBlock("div",m)}var y=u(f,[["render",g]]);return y});
{
"name": "@hcaptcha/vue3-hcaptcha",
"version": "1.0.0-alpha.2",
"version": "1.0.0",
"author": "hCaptcha team and contributors",

@@ -55,3 +55,3 @@ "homepage": "https://github.com/hCaptcha/vue-hcaptcha",

},
"gitHead": "11ba5322ce5028ffdbec11f41bb5a15d4be56ce5"
"gitHead": "74c1f6d54004dce39e03b6be29e7cff358b1441a"
}

@@ -85,3 +85,3 @@ # Vue.js hCaptcha Component Library

|`expired`|-|When the current token expires.|
|`challenge-expired`|-|When the unfinished challenge expires.|
|`challengeExpired`|-|When the unfinished challenge expires.|
|`opened`|-|When the challenge is opened.|

@@ -88,0 +88,0 @@ |`closed`|-|When the challenge is closed.|

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc