new melv-turnstile.js
This commit is contained in:
parent
171897c912
commit
ed5865f2f5
@ -1,99 +1,86 @@
|
|||||||
! function(e) {
|
Shopware.Component.override('sw-settings-captcha-select-v2', {
|
||||||
var t = {};
|
template: `
|
||||||
|
{% block sw_settings_captcha_select_v2_google_recaptcha_v2 %}
|
||||||
|
{% parent() %}
|
||||||
|
{% block sw_settings_captcha_select_v2_cloudflare_turnstile %}
|
||||||
|
<sw-container
|
||||||
|
v-if="currentValue.cloudFlareTurnstile && currentValue.cloudFlareTurnstile.isActive"
|
||||||
|
class="sw-settings-captcha-select-v2__cloudflare-turnstile"
|
||||||
|
>
|
||||||
|
{% block sw_settings_captcha_select_v2_cloudflare_turnstile_description %}
|
||||||
|
<p class="sw-settings-captcha-select-v2__description">
|
||||||
|
{{ $tc('sw-settings-basic-information.captcha.label.cloudFlareTurnstileDescription') }}
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
function n(l) {
|
{% block sw_settings_captcha_select_v2_cloudflare_turnstile_site_key %}
|
||||||
if(t[l]) return t[l].exports;
|
<sw-text-field
|
||||||
var r = t[l] = {
|
:value="currentValue.cloudFlareTurnstile.config.siteKey"
|
||||||
i: l,
|
@input="updateSiteKey($event)"
|
||||||
l: !1,
|
name="cloudFlareTurnstileSiteKey"
|
||||||
exports: {}
|
:label="$tc('sw-settings-basic-information.captcha.label.cloudFlareTurnstileSiteKey')"
|
||||||
};
|
/>
|
||||||
return e[l].call(r.exports, r, r.exports, n), r.l = !0, r.exports
|
{% endblock %}
|
||||||
}
|
|
||||||
n.m = e, n.c = t, n.d = function(e, t, l) {
|
|
||||||
n.o(e, t) || Object.defineProperty(e, t, {
|
|
||||||
enumerable: !0,
|
|
||||||
get: l
|
|
||||||
})
|
|
||||||
}, n.r = function(e) {
|
|
||||||
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
|
|
||||||
value: "Module"
|
|
||||||
}), Object.defineProperty(e, "__esModule", {
|
|
||||||
value: !0
|
|
||||||
})
|
|
||||||
}, n.t = function(e, t) {
|
|
||||||
if(1 & t && (e = n(e)), 8 & t) return e;
|
|
||||||
if(4 & t && "object" == typeof e && e && e.__esModule) return e;
|
|
||||||
var l = Object.create(null);
|
|
||||||
if(n.r(l), Object.defineProperty(l, "default", {
|
|
||||||
enumerable: !0,
|
|
||||||
value: e
|
|
||||||
}), 2 & t && "string" != typeof e)
|
|
||||||
for(var r in e) n.d(l, r, function(t) {
|
|
||||||
return e[t]
|
|
||||||
}.bind(null, r));
|
|
||||||
return l
|
|
||||||
}, n.n = function(e) {
|
|
||||||
var t = e && e.__esModule ? function() {
|
|
||||||
return e.default
|
|
||||||
} : function() {
|
|
||||||
return e
|
|
||||||
};
|
|
||||||
return n.d(t, "a", t), t
|
|
||||||
}, n.o = function(e, t) {
|
|
||||||
return Object.prototype.hasOwnProperty.call(e, t)
|
|
||||||
}, n.p = "/bundles/melvturnstile/", n(n.s = "wNoc")
|
|
||||||
}({
|
|
||||||
"+t2p": function(e) {
|
|
||||||
e.exports = JSON.parse('{"sw-settings-basic-information":{"captcha":{"label":{"cloudFlareTurnstile":"CloudFlare Turnstile","cloudFlareTurnstileSiteKey":"CloudFlare Turnstile site key","cloudFlareTurnstileSecretKey":"CloudFlare Turnstile secret key","cloudFlareTurnstileDescription":"Turnstile is CloudFlare\'s CAPTCHA alternative. It automatically chooses from a rotating suite of non-intrusive browser challenges based on telemetry and client behavior exhibited during a session."}}}}')
|
|
||||||
},
|
|
||||||
"R+yN": function(e) {
|
|
||||||
e.exports = JSON.parse('{"sw-settings-basic-information":{"captcha":{"label":{"cloudFlareTurnstile":"CloudFlare Turnstile","cloudFlareTurnstileSiteKey":"CloudFlare Turnstile site key","cloudFlareTurnstileSecretKey":"CloudFlare Turnstile secret key","cloudFlareTurnstileDescription":"Turnstile is CloudFlare\'s CAPTCHA alternative. It automatically chooses from a rotating suite of non-intrusive browser challenges based on telemetry and client behavior exhibited during a session."}}}}')
|
|
||||||
},
|
|
||||||
wNoc: function(e, t, n) {
|
|
||||||
"use strict";
|
|
||||||
n.r(t);
|
|
||||||
var l = n("+t2p"),
|
|
||||||
r = n("R+yN"),
|
|
||||||
s = Shopware,
|
|
||||||
i = s.Component,
|
|
||||||
c = s.Locale;
|
|
||||||
c.extend("en-GB", l), c.extend("de-DE", r), i.override("sw-settings-captcha-select-v2", {
|
|
||||||
template: `\n{% block sw_settings_captcha_select_v2_google_recaptcha_v2 %}\n {% parent() %}\n {% block sw_settings_captcha_select_v2_cloudflare_turnstile %}\n <sw-container\n v-if="currentValue.cloudFlareTurnstile && currentValue.cloudFlareTurnstile.isActive"\n class="sw-settings-captcha-select-v2__cloudflare-turnstile"\n >\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_description %}\n <p class="sw-settings-captcha-select-v2__description sw-settings-captcha-select-v2__cloudflare-turnstile-description">\n {{ $tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileDescription\') }}\n </p>\n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_site_key %}\n <sw-text-field\n v-model="currentValue.cloudFlareTurnstile.config.siteKey"\n name="cloudFlareTurnstileSiteKey"\n :label="$tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileSiteKey\')"\n @input="updateCaptchaConfig"\n @blur="updateCaptchaConfig"\n />\n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_secret_key %}\n <sw-text-field\n v-model="currentValue.cloudFlareTurnstile.config.secretKey"\n name="cloudFlareTurnstileSecretKey"\n :label="$tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileSecretKey\')"\n @input="updateCaptchaConfig"\n @blur="updateCaptchaConfig"\n />\n {% endblock %}\n </sw-container>\n {% endblock %}\n{% endblock %}`,
|
|
||||||
|
|
||||||
mounted() {
|
{% block sw_settings_captcha_select_v2_cloudflare_turnstile_secret_key %}
|
||||||
// Warte, bis die Daten verfügbar sind
|
<sw-text-field
|
||||||
this.$nextTick(() => {
|
:value="currentValue.cloudFlareTurnstile.config.secretKey"
|
||||||
if (!this.currentValue.cloudFlareTurnstile) {
|
@input="updateSecretKey($event)"
|
||||||
this.currentValue.cloudFlareTurnstile = {
|
name="cloudFlareTurnstileSecretKey"
|
||||||
|
:label="$tc('sw-settings-basic-information.captcha.label.cloudFlareTurnstileSecretKey')"
|
||||||
|
/>
|
||||||
|
{% endblock %}
|
||||||
|
</sw-container>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
`,
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
defaultConfig: {
|
||||||
isActive: false,
|
isActive: false,
|
||||||
config: {
|
config: {
|
||||||
siteKey: '',
|
siteKey: '',
|
||||||
secretKey: ''
|
secretKey: ''
|
||||||
}
|
}
|
||||||
};
|
|
||||||
} else if (!this.currentValue.cloudFlareTurnstile.config) {
|
|
||||||
this.currentValue.cloudFlareTurnstile.config = {
|
|
||||||
siteKey: '',
|
|
||||||
secretKey: ''
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
console.log('Mounted - Initial cloudFlareTurnstile:', JSON.stringify(this.currentValue.cloudFlareTurnstile.config));
|
created() {
|
||||||
});
|
this.initializeTurnstileConfig();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
initializeTurnstileConfig() {
|
||||||
|
if (!this.currentValue.cloudFlareTurnstile) {
|
||||||
|
this.$set(this.currentValue, 'cloudFlareTurnstile', { ...this.defaultConfig });
|
||||||
|
} else if (!this.currentValue.cloudFlareTurnstile.config) {
|
||||||
|
this.$set(this.currentValue.cloudFlareTurnstile, 'config', { ...this.defaultConfig.config });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSiteKey(value) {
|
||||||
|
this.$set(this.currentValue.cloudFlareTurnstile.config, 'siteKey', value);
|
||||||
|
this.updateCaptchaConfig();
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSecretKey(value) {
|
||||||
|
this.$set(this.currentValue.cloudFlareTurnstile.config, 'secretKey', value);
|
||||||
|
this.updateCaptchaConfig();
|
||||||
|
},
|
||||||
|
|
||||||
updateCaptchaConfig() {
|
updateCaptchaConfig() {
|
||||||
console.log('Before updating - SiteKey:', this.currentValue.cloudFlareTurnstile.config.siteKey);
|
this.$emit('config-update', this.currentValue);
|
||||||
console.log('Before updating - SecretKey:', this.currentValue.cloudFlareTurnstile.config.secretKey);
|
}
|
||||||
|
},
|
||||||
|
|
||||||
this.$set(this.currentValue.cloudFlareTurnstile.config, 'siteKey', this.currentValue.cloudFlareTurnstile.config.siteKey);
|
watch: {
|
||||||
this.$set(this.currentValue.cloudFlareTurnstile.config, 'secretKey', this.currentValue.cloudFlareTurnstile.config.secretKey);
|
'currentValue.cloudFlareTurnstile.config': {
|
||||||
|
deep: true,
|
||||||
console.log('Updated Captcha Config:', JSON.stringify(this.currentValue.cloudFlareTurnstile.config));
|
handler(newVal) {
|
||||||
|
console.debug('Turnstile config updated:', newVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
Reference in New Issue
Block a user