mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-03 18:08:30 +02:00
* test another legal disclaimer approach * swapped disclaimers * revert contact form id
89 lines
3.5 KiB
HTML
89 lines
3.5 KiB
HTML
<div id="{{- .id -}}" {{ if .classes }}class="{{ .classes }}"{{ end }}>
|
|
<script>
|
|
(function() {
|
|
const options = {{- .hubspotFormOptions | safeJS -}};
|
|
|
|
const honeypotClass = "weh";
|
|
const createHoneypot = function() {
|
|
const honeypot = document.createElement("input");
|
|
honeypot.classList.add(honeypotClass);
|
|
honeypot.type = "text";
|
|
honeypot.name = "my-work-email";
|
|
honeypot.style.display = "none";
|
|
honeypot.placeholder = "Email";
|
|
honeypot.ariaHidden = "true";
|
|
return honeypot;
|
|
};
|
|
|
|
const initHoneypot = function($form) {
|
|
const honeypot = createHoneypot();
|
|
$form.appendChild(honeypot);
|
|
|
|
const submit = $form.querySelector('[type="submit"]');
|
|
|
|
honeypot.addEventListener('input', function () {
|
|
if (honeypot.value.length > 0) {
|
|
submit.disabled = true;
|
|
}
|
|
});
|
|
};
|
|
|
|
// List of countries that require explicit consent for data processing
|
|
const restrictedCountries = [
|
|
"Argentina", "Belgium", "Canada", "Czech Republic", "Cyprus", "Denmark", "Germany",
|
|
"Hungary", "Latvia", "Liechtenstein", "Luxembourg", "Netherlands", "Norway", "France",
|
|
"Finland", "Croatia", "Bulgaria", "Belarus", "Bosnia and Herzegovina", "Austria", "Estonia",
|
|
"Georgia", "Greenland", "Hong Kong", "Israel", "Italy", "Maldives", "Moldova", "Monaco",
|
|
"Portugal", "Russia", "Serbia", "Slovakia", "Slovenia", "Sweden", "Switzerland", "Türkiye",
|
|
"Ukraine", "Macedonia (FYROM)", "United Kingdom"
|
|
];
|
|
|
|
// consent block should show additional checkbox for restricted countries
|
|
function updateConsentBlocks(form) {
|
|
const countryField = form.querySelector('select[name="country"]');
|
|
const legitDisclaimerText = form.querySelector('#Legit-interest-text-legal-disclaimer');
|
|
const explicitDisclaimerText = form.querySelector('#explicit-text-legal-disclaimer');
|
|
|
|
if (!countryField || !legitDisclaimerText || !explicitDisclaimerText) {
|
|
// If there is no country field or related disclaimers, exit early
|
|
return;
|
|
}
|
|
|
|
const selected = countryField.value;
|
|
const isRestricted = restrictedCountries.includes(selected);
|
|
const showOptIn = selected && isRestricted;
|
|
|
|
if (legitDisclaimerText) legitDisclaimerText.style.display = showOptIn ? "none" : "block";
|
|
if (explicitDisclaimerText) explicitDisclaimerText.style.display = showOptIn ? "block" : "none";
|
|
}
|
|
|
|
|
|
try {
|
|
hbspt.forms.create({
|
|
...options,
|
|
formInstanceId: "{{- .context.Permalink -}}#{{- .id -}}",
|
|
pageId: "{{- .context.Permalink -}}",
|
|
target: "#{{- .id -}}",
|
|
onFormReady: function($form) {
|
|
if (!$form) {
|
|
console.warn("Form not found.");
|
|
return;
|
|
}
|
|
|
|
initHoneypot($form);
|
|
|
|
updateConsentBlocks($form)
|
|
const countryField = $form.querySelector('select[name="country"]');
|
|
if (countryField) {
|
|
countryField.addEventListener("change", () => updateConsentBlocks($form));
|
|
}
|
|
|
|
},
|
|
});
|
|
} catch (e) {
|
|
document.getElementById("{{- .id -}}").innerHTML = '<p class="text-white">Here should be a form but looks like it was blocked on your side. Please, check your trackers blocking policy.</p>';
|
|
}
|
|
})()
|
|
</script>
|
|
</div>
|