comand-component-library 4.1.49 → 4.1.50
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.
@@ -5701,6 +5701,13 @@ const Dd = /* @__PURE__ */ V(pd, [["render", Fd]]), Md = {
|
|
5701
5701
|
};
|
5702
5702
|
},
|
5703
5703
|
props: {
|
5704
|
+
/**
|
5705
|
+
* website-key for Google-recaptcha v3
|
5706
|
+
*/
|
5707
|
+
reCaptchaWebsiteKey: {
|
5708
|
+
type: String,
|
5709
|
+
required: !1
|
5710
|
+
},
|
5704
5711
|
/**
|
5705
5712
|
* activate if native submit-event should be used
|
5706
5713
|
*/
|
@@ -5872,19 +5879,28 @@ const Dd = /* @__PURE__ */ V(pd, [["render", Fd]]), Md = {
|
|
5872
5879
|
},
|
5873
5880
|
methods: {
|
5874
5881
|
onSubmit(e) {
|
5875
|
-
var s;
|
5876
5882
|
if (this.onValidate(), this.formData = Object.assign({}, this.validator.validatePrivacy(this.formData)), this.formData.error || this.useNativeSubmit) {
|
5877
5883
|
this.formData.error && e.originalEvent.preventDefault();
|
5878
5884
|
return;
|
5879
5885
|
}
|
5880
|
-
|
5886
|
+
e.originalEvent.preventDefault(), this.reCaptchaWebsiteKey ? grecaptcha.ready(function() {
|
5887
|
+
grecaptcha.execute(this.reCaptchaWebsiteKey, { action: "submit" }).then(function(n) {
|
5888
|
+
this.submitForm(n);
|
5889
|
+
});
|
5890
|
+
}) : this.submitForm();
|
5891
|
+
},
|
5892
|
+
submitForm(e) {
|
5893
|
+
var s;
|
5894
|
+
const n = new FormData();
|
5895
|
+
e && n.set("recaptchaToken", e);
|
5896
|
+
const t = Object.keys(this.configuration);
|
5881
5897
|
for (let i = 0; i < t.length; i++)
|
5882
5898
|
n.set(this.configuration[t[i]].name, this.formData[t[i]].value);
|
5883
5899
|
fetch(this.formAction, { method: ((s = this.cmdForm) == null ? void 0 : s.formMethod) || "POST", body: n }).then((i) => {
|
5884
5900
|
i.ok ? this.$refs.form.showMessage("success", this.getMessage("basic_form.system_message.success.message_sent_successfully")) : this.$refs.form.showMessage("error", this.getMessage("basic_form.system_message.error.message_could_not_be_sent"));
|
5885
5901
|
}).catch((i) => {
|
5886
5902
|
this.$refs.form.showMessage("error", this.getMessage("basic_form.system_message.error.message_could_not_be_sent")), console.error(i);
|
5887
|
-
})
|
5903
|
+
});
|
5888
5904
|
},
|
5889
5905
|
onCountrySelect(e) {
|
5890
5906
|
this.cityBeforeZip = e === "us" || e === "uk";
|
@@ -18488,7 +18504,7 @@ function c_(e, n, t, s, i, o) {
|
|
18488
18504
|
})
|
18489
18505
|
], 64);
|
18490
18506
|
}
|
18491
|
-
const bo = /* @__PURE__ */ V(e_, [["render", c_]]), u_ = "comand-component-library", m_ = "4.1.
|
18507
|
+
const bo = /* @__PURE__ */ V(e_, [["render", c_]]), u_ = "comand-component-library", m_ = "4.1.50", h_ = "GPL-3.0-only", p_ = "CoManD-UI", f_ = "module", g_ = {
|
18492
18508
|
prepublishOnly: "npm run build-lib",
|
18493
18509
|
dev: "vite",
|
18494
18510
|
build: "vite build",
|
package/package.json
CHANGED
@@ -304,6 +304,13 @@ export default {
|
|
304
304
|
}
|
305
305
|
},
|
306
306
|
props: {
|
307
|
+
/**
|
308
|
+
* website-key for Google-recaptcha v3
|
309
|
+
*/
|
310
|
+
reCaptchaWebsiteKey: {
|
311
|
+
type: String,
|
312
|
+
required: false
|
313
|
+
},
|
307
314
|
/**
|
308
315
|
* activate if native submit-event should be used
|
309
316
|
*/
|
@@ -487,8 +494,27 @@ export default {
|
|
487
494
|
return
|
488
495
|
}
|
489
496
|
|
497
|
+
// prevent original levent form CmdForm (to avoid submit and reload)
|
498
|
+
event.originalEvent.preventDefault()
|
499
|
+
|
500
|
+
if(this.reCaptchaWebsiteKey) {
|
501
|
+
grecaptcha.ready(function() {
|
502
|
+
grecaptcha.execute(this.reCaptchaWebsiteKey, {action: 'submit'}).then(function(token) {
|
503
|
+
this.submitForm(token)
|
504
|
+
})
|
505
|
+
})
|
506
|
+
} else {
|
507
|
+
this.submitForm()
|
508
|
+
}
|
509
|
+
},
|
510
|
+
submitForm(token) {
|
490
511
|
// custom submit of form-data
|
491
512
|
const customSubmitFormData = new FormData()
|
513
|
+
|
514
|
+
if(token) {
|
515
|
+
customSubmitFormData.set("recaptchaToken", token)
|
516
|
+
}
|
517
|
+
|
492
518
|
// get keys for form-elements from configuration
|
493
519
|
const configurationEntries = Object.keys(this.configuration)
|
494
520
|
|
@@ -508,9 +534,6 @@ export default {
|
|
508
534
|
this.$refs.form.showMessage("error", this.getMessage("basic_form.system_message.error.message_could_not_be_sent"))
|
509
535
|
console.error(error)
|
510
536
|
})
|
511
|
-
|
512
|
-
// prevent original levent form CmdForm (to avoid submit and reload)
|
513
|
-
event.originalEvent.preventDefault()
|
514
537
|
},
|
515
538
|
onCountrySelect(event) {
|
516
539
|
this.cityBeforeZip = event === 'us' || event === 'uk';
|