vue-turnstile
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,5 +0,5 @@ | ||
import { defineComponent as u, openBlock as l, createElementBlock as d } from "vue"; | ||
const c = "https://challenges.cloudflare.com/turnstile/v0/api.js", o = "cfTurnstileOnLoad"; | ||
let n = typeof window < "u" && window.turnstile !== void 0 ? "ready" : "unloaded", s; | ||
const p = u({ | ||
import { defineComponent as a, openBlock as u, createElementBlock as l } from "vue"; | ||
const c = "https://challenges.cloudflare.com/turnstile/v0/api.js", d = "cfTurnstileOnLoad"; | ||
let i = typeof window < "u" && window.turnstile !== void 0 ? "ready" : "unloaded", s; | ||
const p = a({ | ||
name: "VueTurnstile", | ||
@@ -49,3 +49,4 @@ emits: ["update:modelValue"], | ||
return { | ||
resetTimeout: void 0 | ||
resetTimeout: void 0, | ||
widgetId: void 0 | ||
}; | ||
@@ -72,4 +73,7 @@ }, | ||
}, | ||
remove() { | ||
this.widgetId && (window.turnstile.remove(this.widgetId), this.widgetId = void 0); | ||
}, | ||
render() { | ||
window.turnstile.render(this.$refs.turnstile, this.turnstileOptions); | ||
this.widgetId = window.turnstile.render(this.$refs.turnstile, this.turnstileOptions); | ||
}, | ||
@@ -84,10 +88,10 @@ startResetTimeout() { | ||
const r = new Promise((t, e) => { | ||
s = { resolve: t, reject: e }, n === "ready" && t(void 0); | ||
s = { resolve: t, reject: e }, i === "ready" && t(void 0); | ||
}); | ||
window[o] = () => { | ||
s.resolve(), n = "ready"; | ||
window[d] = () => { | ||
s.resolve(), i = "ready"; | ||
}, await (() => { | ||
if (n === "unloaded") { | ||
n = "loading"; | ||
const t = `${c}?onload=${o}&render=explicit`, e = document.createElement("script"); | ||
if (i === "unloaded") { | ||
i = "loading"; | ||
const t = `${c}?onload=${d}&render=explicit`, e = document.createElement("script"); | ||
e.src = t, e.async = !0, e.addEventListener("error", () => { | ||
@@ -99,15 +103,18 @@ s.reject("Failed to load Turnstile."); | ||
})(), this.renderOnMount && this.render(); | ||
}, | ||
beforeUnmount() { | ||
this.remove(), clearTimeout(this.resetTimeout); | ||
} | ||
}), m = (r, i) => { | ||
}), m = (r, n) => { | ||
const t = r.__vccOpts || r; | ||
for (const [e, a] of i) | ||
t[e] = a; | ||
for (const [e, o] of n) | ||
t[e] = o; | ||
return t; | ||
}, f = { ref: "turnstile" }; | ||
function h(r, i, t, e, a, y) { | ||
return l(), d("div", f, null, 512); | ||
function h(r, n, t, e, o, w) { | ||
return u(), l("div", f, null, 512); | ||
} | ||
const _ = /* @__PURE__ */ m(p, [["render", h]]); | ||
const v = /* @__PURE__ */ m(p, [["render", h]]); | ||
export { | ||
_ as default | ||
v as default | ||
}; |
@@ -11,2 +11,3 @@ import type { PropType } from 'vue'; | ||
resetTimeout?: ReturnType<typeof setTimeout>; | ||
widgetId?: string; | ||
} | ||
@@ -64,2 +65,3 @@ declare const _default: import("vue").DefineComponent<{ | ||
reset(): void; | ||
remove(): void; | ||
render(): void; | ||
@@ -66,0 +68,0 @@ startResetTimeout(): void; |
{ | ||
"name": "vue-turnstile", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Vue library for Cloudflare Turnstile CAPTCHA alternative", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13777
243