vue-mtcaptcha 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-mtcaptcha.es.js +37 -37
- package/dist/vue-mtcaptcha.umd.js +1 -1
- package/package.json +1 -1
package/dist/vue-mtcaptcha.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { defineComponent as e, h as t } from "vue";
|
|
2
2
|
//#region src/MTCaptcha.ts
|
|
3
|
-
var n = !1,
|
|
4
|
-
function
|
|
5
|
-
return e == null || e === "" ? !0 :
|
|
3
|
+
var n = "service.mtcaptcha.com", r = "service2.mtcaptcha.com", i = !1, a = /^[a-zA-Z0-9\-_. ,]{1,30}$/;
|
|
4
|
+
function o(e) {
|
|
5
|
+
return e == null || e === "" ? !0 : a.test(e);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function s(e) {
|
|
8
8
|
return e == null || e === "" ? !0 : e === "mini" || e === "standard";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function c(e) {
|
|
11
11
|
return e == null ? !0 : Number.isFinite(e) && e >= 265 && e <= 600;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function l(e) {
|
|
14
14
|
return e == null ? !0 : Number.isFinite(e) && e >= 42 && e <= 55;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function u(e) {
|
|
17
17
|
return e == null || e === "" ? !0 : e === "force-visible" || e === "force-invisible";
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function d(e) {
|
|
20
20
|
return e == null || e === "" ? !0 : e === "imageonly" || e === "standard";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function f(e) {
|
|
23
23
|
return e == null || e === "" ? !0 : [
|
|
24
24
|
"basic",
|
|
25
25
|
"overcast",
|
|
@@ -34,23 +34,23 @@ function u(e) {
|
|
|
34
34
|
"highcontrast"
|
|
35
35
|
].includes(e);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
if (
|
|
39
|
-
|
|
37
|
+
function p() {
|
|
38
|
+
if (i) return;
|
|
39
|
+
i = !0;
|
|
40
40
|
let e = document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0], t = document.createElement("script");
|
|
41
|
-
t.async = !0, t.src =
|
|
42
|
-
let
|
|
43
|
-
|
|
41
|
+
t.async = !0, t.src = `https://${n}/mtcv1/client/mtcaptcha.min.js`, e.appendChild(t);
|
|
42
|
+
let a = document.createElement("script");
|
|
43
|
+
a.async = !0, a.src = `https://${r}/mtcv1/client/mtcaptcha2.min.js`, e.appendChild(a);
|
|
44
44
|
}
|
|
45
|
-
var
|
|
45
|
+
var m = { install(e, t) {
|
|
46
46
|
if (!t?.siteKey) throw Error("MTCaptcha: \"siteKey\" is required");
|
|
47
|
-
if (!
|
|
48
|
-
if (!
|
|
49
|
-
if (!
|
|
50
|
-
if (!
|
|
51
|
-
if (!
|
|
52
|
-
if (!
|
|
53
|
-
if (!
|
|
47
|
+
if (!o(t.action)) throw Error("MTCaptcha: \"action\" is invalid. Use 1-30 chars [a-zA-Z0-9-_. ,]");
|
|
48
|
+
if (!s(t.widgetSize)) throw Error("MTCaptcha: \"widgetSize\" must be \"mini\" or \"standard\"");
|
|
49
|
+
if (!c(t.miniFormWidth)) throw Error("MTCaptcha: \"miniFormWidth\" must be between 265 and 600");
|
|
50
|
+
if (!l(t.miniFormHeight)) throw Error("MTCaptcha: \"miniFormHeight\" must be between 42 and 55");
|
|
51
|
+
if (!u(t.lowFrictionInvisible)) throw Error("MTCaptcha: \"lowFrictionInvisible\" must be \"force-visible\" or \"force-invisible\"");
|
|
52
|
+
if (!d(t.challengeType)) throw Error("MTCaptcha: \"challengeType\" must be \"imageonly\" or \"standard\"");
|
|
53
|
+
if (!f(t.theme)) throw Error("MTCaptcha: \"theme\" must be one of basic, overcast, neowhite, goldbezel, blackmoon, darkruby, touchoforange, caribbean, woodyallen, chrome, highcontrast");
|
|
54
54
|
t && (window.mtcaptchaConfig = {
|
|
55
55
|
...window.mtcaptchaConfig ?? {},
|
|
56
56
|
sitekey: t.siteKey,
|
|
@@ -74,8 +74,8 @@ var f = { install(e, t) {
|
|
|
74
74
|
"error-callback": t.errorCallback ?? window.mtcaptchaConfig?.["error-callback"],
|
|
75
75
|
autoFormValidate: t.autoFormValidate ?? window.mtcaptchaConfig?.autoFormValidate,
|
|
76
76
|
autoFadeOuterText: t.autoFadeOuterText ?? window.mtcaptchaConfig?.autoFadeOuterText
|
|
77
|
-
}),
|
|
78
|
-
} },
|
|
77
|
+
}), p();
|
|
78
|
+
} }, h = e({
|
|
79
79
|
name: "MTCaptcha",
|
|
80
80
|
props: {
|
|
81
81
|
sitekey: {
|
|
@@ -85,7 +85,7 @@ var f = { install(e, t) {
|
|
|
85
85
|
action: {
|
|
86
86
|
type: String,
|
|
87
87
|
required: !1,
|
|
88
|
-
validator: (e) =>
|
|
88
|
+
validator: (e) => o(e)
|
|
89
89
|
},
|
|
90
90
|
enableTestMode: {
|
|
91
91
|
type: String,
|
|
@@ -107,22 +107,22 @@ var f = { install(e, t) {
|
|
|
107
107
|
type: String,
|
|
108
108
|
required: !1,
|
|
109
109
|
default: "basic",
|
|
110
|
-
validator: (e) =>
|
|
110
|
+
validator: (e) => f(e)
|
|
111
111
|
},
|
|
112
112
|
widgetSize: {
|
|
113
113
|
type: String,
|
|
114
114
|
required: !1,
|
|
115
|
-
validator: (e) =>
|
|
115
|
+
validator: (e) => s(e)
|
|
116
116
|
},
|
|
117
117
|
miniFormWidth: {
|
|
118
118
|
type: Number,
|
|
119
119
|
required: !1,
|
|
120
|
-
validator: (e) =>
|
|
120
|
+
validator: (e) => c(e)
|
|
121
121
|
},
|
|
122
122
|
miniFormHeight: {
|
|
123
123
|
type: Number,
|
|
124
124
|
required: !1,
|
|
125
|
-
validator: (e) =>
|
|
125
|
+
validator: (e) => l(e)
|
|
126
126
|
},
|
|
127
127
|
loadAnimation: {
|
|
128
128
|
type: Boolean,
|
|
@@ -132,12 +132,12 @@ var f = { install(e, t) {
|
|
|
132
132
|
lowFrictionInvisible: {
|
|
133
133
|
type: String,
|
|
134
134
|
required: !1,
|
|
135
|
-
validator: (e) =>
|
|
135
|
+
validator: (e) => u(e)
|
|
136
136
|
},
|
|
137
137
|
challengeType: {
|
|
138
138
|
type: String,
|
|
139
139
|
required: !1,
|
|
140
|
-
validator: (e) =>
|
|
140
|
+
validator: (e) => d(e)
|
|
141
141
|
},
|
|
142
142
|
jsloadedCallback: Function,
|
|
143
143
|
renderedCallback: Function,
|
|
@@ -180,7 +180,7 @@ var f = { install(e, t) {
|
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
mounted() {
|
|
183
|
-
|
|
183
|
+
p(), window.mtcaptchaConfig = {
|
|
184
184
|
...window.mtcaptchaConfig ?? {},
|
|
185
185
|
sitekey: this.sitekey,
|
|
186
186
|
enableTestMode: this.enableTestMode ?? window.mtcaptchaConfig?.enableTestMode,
|
|
@@ -207,9 +207,9 @@ var f = { install(e, t) {
|
|
|
207
207
|
render() {
|
|
208
208
|
return t("div", { class: "mtcaptcha" });
|
|
209
209
|
}
|
|
210
|
-
}),
|
|
211
|
-
function
|
|
212
|
-
e.use(
|
|
210
|
+
}), g = h;
|
|
211
|
+
function _(e, t) {
|
|
212
|
+
e.use(m, t);
|
|
213
213
|
}
|
|
214
214
|
//#endregion
|
|
215
|
-
export {
|
|
215
|
+
export { h as MTCaptcha, h as MTCaptchaComponent, m as MTCaptchaPlugin, g as default, _ as install };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MTCaptchaVue={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=!1,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MTCaptchaVue={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=`service.mtcaptcha.com`,r=`service2.mtcaptcha.com`,i=!1,a=/^[a-zA-Z0-9\-_. ,]{1,30}$/;function o(e){return e==null||e===``?!0:a.test(e)}function s(e){return e==null||e===``?!0:e===`mini`||e===`standard`}function c(e){return e==null?!0:Number.isFinite(e)&&e>=265&&e<=600}function l(e){return e==null?!0:Number.isFinite(e)&&e>=42&&e<=55}function u(e){return e==null||e===``?!0:e===`force-visible`||e===`force-invisible`}function d(e){return e==null||e===``?!0:e===`imageonly`||e===`standard`}function f(e){return e==null||e===``?!0:[`basic`,`overcast`,`neowhite`,`goldbezel`,`blackmoon`,`darkruby`,`touchoforange`,`caribbean`,`woodyallen`,`chrome`,`highcontrast`].includes(e)}function p(){if(i)return;i=!0;let e=document.getElementsByTagName(`head`)[0]||document.getElementsByTagName(`body`)[0],t=document.createElement(`script`);t.async=!0,t.src=`https://${n}/mtcv1/client/mtcaptcha.min.js`,e.appendChild(t);let a=document.createElement(`script`);a.async=!0,a.src=`https://${r}/mtcv1/client/mtcaptcha2.min.js`,e.appendChild(a)}var m={install(e,t){if(!t?.siteKey)throw Error(`MTCaptcha: "siteKey" is required`);if(!o(t.action))throw Error(`MTCaptcha: "action" is invalid. Use 1-30 chars [a-zA-Z0-9-_. ,]`);if(!s(t.widgetSize))throw Error(`MTCaptcha: "widgetSize" must be "mini" or "standard"`);if(!c(t.miniFormWidth))throw Error(`MTCaptcha: "miniFormWidth" must be between 265 and 600`);if(!l(t.miniFormHeight))throw Error(`MTCaptcha: "miniFormHeight" must be between 42 and 55`);if(!u(t.lowFrictionInvisible))throw Error(`MTCaptcha: "lowFrictionInvisible" must be "force-visible" or "force-invisible"`);if(!d(t.challengeType))throw Error(`MTCaptcha: "challengeType" must be "imageonly" or "standard"`);if(!f(t.theme))throw Error(`MTCaptcha: "theme" must be one of basic, overcast, neowhite, goldbezel, blackmoon, darkruby, touchoforange, caribbean, woodyallen, chrome, highcontrast`);t&&(window.mtcaptchaConfig={...window.mtcaptchaConfig??{},sitekey:t.siteKey,render:`explicit`,enableTestMode:t.enableTestMode??window.mtcaptchaConfig?.enableTestMode,lang:t.lang??window.mtcaptchaConfig?.lang,customLangText:t.customLangText??window.mtcaptchaConfig?.customLangText,customStyle:t.customStyle??window.mtcaptchaConfig?.customStyle,theme:t.theme??window.mtcaptchaConfig?.theme??`basic`,action:t.action??window.mtcaptchaConfig?.action,widgetSize:t.widgetSize??window.mtcaptchaConfig?.widgetSize,miniFormWidth:t.miniFormWidth??window.mtcaptchaConfig?.miniFormWidth,miniFormHeight:t.miniFormHeight??window.mtcaptchaConfig?.miniFormHeight,loadAnimation:t.loadAnimation??window.mtcaptchaConfig?.loadAnimation??!0,lowFrictionInvisible:t.lowFrictionInvisible??window.mtcaptchaConfig?.lowFrictionInvisible,challengeType:t.challengeType??window.mtcaptchaConfig?.challengeType,"jsloaded-callback":t.jsloadedCallback??window.mtcaptchaConfig?.[`jsloaded-callback`],"rendered-callback":t.renderedCallback??window.mtcaptchaConfig?.[`rendered-callback`],"verified-callback":t.verifiedCallback??window.mtcaptchaConfig?.[`verified-callback`],"verifyexpired-callback":t.verifyexpiredCallback??window.mtcaptchaConfig?.[`verifyexpired-callback`],"error-callback":t.errorCallback??window.mtcaptchaConfig?.[`error-callback`],autoFormValidate:t.autoFormValidate??window.mtcaptchaConfig?.autoFormValidate,autoFadeOuterText:t.autoFadeOuterText??window.mtcaptchaConfig?.autoFadeOuterText}),p()}},h=(0,t.defineComponent)({name:`MTCaptcha`,props:{sitekey:{type:String,required:!0},action:{type:String,required:!1,validator:e=>o(e)},enableTestMode:{type:String,required:!1},lang:{type:String,required:!1},customLangText:{type:Object,required:!1},customStyle:{type:Object,required:!1},theme:{type:String,required:!1,default:`basic`,validator:e=>f(e)},widgetSize:{type:String,required:!1,validator:e=>s(e)},miniFormWidth:{type:Number,required:!1,validator:e=>c(e)},miniFormHeight:{type:Number,required:!1,validator:e=>l(e)},loadAnimation:{type:Boolean,required:!1,default:!0},lowFrictionInvisible:{type:String,required:!1,validator:e=>u(e)},challengeType:{type:String,required:!1,validator:e=>d(e)},jsloadedCallback:Function,renderedCallback:Function,verifiedCallback:Function,verifyexpiredCallback:Function,errorCallback:Function,autoFormValidate:{type:Boolean,required:!1},autoFadeOuterText:{type:Boolean,required:!1}},methods:{setEnableTestMode(e){window.mtcaptcha?.enableTestMode(e)},getConfiguration(){return window.mtcaptcha?.getConfiguration()},getStatus(){return window.mtcaptcha?.getStatus()},getVerifiedToken(){return window.mtcaptcha?.getVerifiedToken()},resetUI(){window.mtcaptcha?.resetUI()},renderUI(){window.mtcaptcha?.renderUI()},remove(){window.mtcaptcha?.remove()},showMandatory(){window.mtcaptcha?.showMandatory()}},mounted(){p(),window.mtcaptchaConfig={...window.mtcaptchaConfig??{},sitekey:this.sitekey,enableTestMode:this.enableTestMode??window.mtcaptchaConfig?.enableTestMode,lang:this.lang??window.mtcaptchaConfig?.lang,customLangText:this.customLangText??window.mtcaptchaConfig?.customLangText,customStyle:this.customStyle??window.mtcaptchaConfig?.customStyle,theme:this.theme??window.mtcaptchaConfig?.theme??`basic`,action:this.action??window.mtcaptchaConfig?.action,widgetSize:this.widgetSize??window.mtcaptchaConfig?.widgetSize,miniFormWidth:this.miniFormWidth??window.mtcaptchaConfig?.miniFormWidth,miniFormHeight:this.miniFormHeight??window.mtcaptchaConfig?.miniFormHeight,loadAnimation:this.loadAnimation??window.mtcaptchaConfig?.loadAnimation??!0,lowFrictionInvisible:this.lowFrictionInvisible??window.mtcaptchaConfig?.lowFrictionInvisible,challengeType:this.challengeType??window.mtcaptchaConfig?.challengeType,"jsloaded-callback":this.jsloadedCallback??window.mtcaptchaConfig?.[`jsloaded-callback`],"rendered-callback":this.renderedCallback??window.mtcaptchaConfig?.[`rendered-callback`],"verified-callback":this.verifiedCallback??window.mtcaptchaConfig?.[`verified-callback`],"verifyexpired-callback":this.verifyexpiredCallback??window.mtcaptchaConfig?.[`verifyexpired-callback`],"error-callback":this.errorCallback??window.mtcaptchaConfig?.[`error-callback`],autoFormValidate:this.autoFormValidate??window.mtcaptchaConfig?.autoFormValidate,autoFadeOuterText:this.autoFadeOuterText??window.mtcaptchaConfig?.autoFadeOuterText}},render(){return(0,t.h)(`div`,{class:`mtcaptcha`})}}),g=h;function _(e,t){e.use(m,t)}e.MTCaptcha=h,e.MTCaptchaComponent=h,e.MTCaptchaPlugin=m,e.default=g,e.install=_});
|