@websy/websy-designs 1.10.6 → 1.10.7
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/server/utils.js +6 -1
- package/dist/websy-designs-es6.debug.js +22 -1
- package/dist/websy-designs-es6.js +26 -1
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +24 -7
- package/dist/websy-designs.js +28 -3
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -2341,6 +2341,7 @@ class WebsyForm {
|
|
|
2341
2341
|
const defaults = {
|
|
2342
2342
|
submit: { text: 'Save', classes: [] },
|
|
2343
2343
|
useRecaptcha: false,
|
|
2344
|
+
recaptchaAction: 'submit',
|
|
2344
2345
|
clearAfterSave: false,
|
|
2345
2346
|
fields: [],
|
|
2346
2347
|
mode: 'add',
|
|
@@ -2403,6 +2404,23 @@ class WebsyForm {
|
|
|
2403
2404
|
resolve(false)
|
|
2404
2405
|
}
|
|
2405
2406
|
}
|
|
2407
|
+
else if (this.options.useRecaptchaV3 === true) {
|
|
2408
|
+
grecaptcha.ready(() => {
|
|
2409
|
+
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, { action: this.options.recaptchaAction }).then(token => {
|
|
2410
|
+
this.apiService.add('google/checkrecaptcha', {grecaptcharesponse: token}).then(response => {
|
|
2411
|
+
if (response.success && response.success === true) {
|
|
2412
|
+
resolve(true)
|
|
2413
|
+
grecaptcha.reset(`${this.elementId}_recaptcha`, {sitekey: ENVIRONMENT.RECAPTCHA_KEY})
|
|
2414
|
+
}
|
|
2415
|
+
else {
|
|
2416
|
+
resolve(false)
|
|
2417
|
+
}
|
|
2418
|
+
})
|
|
2419
|
+
}, err => {
|
|
2420
|
+
console.log(err)
|
|
2421
|
+
})
|
|
2422
|
+
})
|
|
2423
|
+
}
|
|
2406
2424
|
else {
|
|
2407
2425
|
resolve(true)
|
|
2408
2426
|
}
|
|
@@ -2740,7 +2758,7 @@ class WebsyForm {
|
|
|
2740
2758
|
`
|
|
2741
2759
|
el.innerHTML = html
|
|
2742
2760
|
this.processComponents(componentsToProcess, () => {
|
|
2743
|
-
if (this.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2761
|
+
if ((this.options.useRecaptcha === true || this.options.useRecaptchaV3 === true) && typeof grecaptcha !== 'undefined') {
|
|
2744
2762
|
this.recaptchaReady()
|
|
2745
2763
|
}
|
|
2746
2764
|
})
|
|
@@ -2830,6 +2848,9 @@ class WebsyForm {
|
|
|
2830
2848
|
if (recaptchErrEl) {
|
|
2831
2849
|
recaptchErrEl.classList.remove('websy-hidden')
|
|
2832
2850
|
}
|
|
2851
|
+
if (this.options.submitErr) {
|
|
2852
|
+
this.options.submitErr()
|
|
2853
|
+
}
|
|
2833
2854
|
}
|
|
2834
2855
|
})
|
|
2835
2856
|
}
|
|
@@ -5598,17 +5619,13 @@ class WebsySearch {
|
|
|
5598
5619
|
searchLetters.splice(term.position, term.length, {text: term.term, term: term})
|
|
5599
5620
|
})
|
|
5600
5621
|
let items = searchLetters.map(d => {
|
|
5601
|
-
let html = `
|
|
5602
|
-
<div
|
|
5603
|
-
`
|
|
5622
|
+
let html = `<div`
|
|
5604
5623
|
if (d.term && d.term.label) {
|
|
5605
5624
|
html += `
|
|
5606
5625
|
data-label="${d.term.label}"
|
|
5607
5626
|
`
|
|
5608
5627
|
}
|
|
5609
|
-
html +=
|
|
5610
|
-
>${d.text.replace(/ /g, ' ')}</div>
|
|
5611
|
-
`
|
|
5628
|
+
html += `>${d.text.replace(/ /g, ' ')}</div>`
|
|
5612
5629
|
return html
|
|
5613
5630
|
})
|
|
5614
5631
|
const el = document.getElementById(`${this.elementId}_lozenges`)
|
package/dist/websy-designs.js
CHANGED
|
@@ -2306,6 +2306,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2306
2306
|
classes: []
|
|
2307
2307
|
},
|
|
2308
2308
|
useRecaptcha: false,
|
|
2309
|
+
recaptchaAction: 'submit',
|
|
2309
2310
|
clearAfterSave: false,
|
|
2310
2311
|
fields: [],
|
|
2311
2312
|
mode: 'add',
|
|
@@ -2376,6 +2377,27 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2376
2377
|
} else {
|
|
2377
2378
|
resolve(false);
|
|
2378
2379
|
}
|
|
2380
|
+
} else if (_this15.options.useRecaptchaV3 === true) {
|
|
2381
|
+
grecaptcha.ready(function () {
|
|
2382
|
+
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
2383
|
+
action: _this15.options.recaptchaAction
|
|
2384
|
+
}).then(function (token) {
|
|
2385
|
+
_this15.apiService.add('google/checkrecaptcha', {
|
|
2386
|
+
grecaptcharesponse: token
|
|
2387
|
+
}).then(function (response) {
|
|
2388
|
+
if (response.success && response.success === true) {
|
|
2389
|
+
resolve(true);
|
|
2390
|
+
grecaptcha.reset("".concat(_this15.elementId, "_recaptcha"), {
|
|
2391
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY
|
|
2392
|
+
});
|
|
2393
|
+
} else {
|
|
2394
|
+
resolve(false);
|
|
2395
|
+
}
|
|
2396
|
+
});
|
|
2397
|
+
}, function (err) {
|
|
2398
|
+
console.log(err);
|
|
2399
|
+
});
|
|
2400
|
+
});
|
|
2379
2401
|
} else {
|
|
2380
2402
|
resolve(true);
|
|
2381
2403
|
}
|
|
@@ -2689,7 +2711,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2689
2711
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2690
2712
|
el.innerHTML = html;
|
|
2691
2713
|
this.processComponents(componentsToProcess, function () {
|
|
2692
|
-
if (_this20.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2714
|
+
if ((_this20.options.useRecaptcha === true || _this20.options.useRecaptchaV3 === true) && typeof grecaptcha !== 'undefined') {
|
|
2693
2715
|
_this20.recaptchaReady();
|
|
2694
2716
|
}
|
|
2695
2717
|
});
|
|
@@ -2778,6 +2800,9 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2778
2800
|
if (recaptchErrEl) {
|
|
2779
2801
|
recaptchErrEl.classList.remove('websy-hidden');
|
|
2780
2802
|
}
|
|
2803
|
+
if (_this21.options.submitErr) {
|
|
2804
|
+
_this21.options.submitErr();
|
|
2805
|
+
}
|
|
2781
2806
|
}
|
|
2782
2807
|
});
|
|
2783
2808
|
}
|
|
@@ -5418,11 +5443,11 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5418
5443
|
});
|
|
5419
5444
|
});
|
|
5420
5445
|
var items = searchLetters.map(function (d) {
|
|
5421
|
-
var html = "
|
|
5446
|
+
var html = "<div";
|
|
5422
5447
|
if (d.term && d.term.label) {
|
|
5423
5448
|
html += "\n data-label=\"".concat(d.term.label, "\"\n ");
|
|
5424
5449
|
}
|
|
5425
|
-
html += "
|
|
5450
|
+
html += ">".concat(d.text.replace(/ /g, ' '), "</div>");
|
|
5426
5451
|
return html;
|
|
5427
5452
|
});
|
|
5428
5453
|
var el = document.getElementById("".concat(this.elementId, "_lozenges"));
|