@@ -51,12 +51,18 @@ const { title = "ksctl - Strive towards Fast, Efficient and Sustainable Computin
5151 color: #9ca3af;
5252 }
5353
54- .sib-hide-loader-icon {
54+ .sib-form-block__button .sib- hide-loader-icon {
5555 display: none !important;
5656 }
57- .sib-show-loader-icon {
57+ .sib-form-block__button .sib- show-loader-icon {
5858 display: inline-block !important;
5959 }
60+ .sib-form-block__button[data-loading="true"] .sib-hide-loader-icon {
61+ display: inline-block !important;
62+ }
63+ .sib-form-block__button[data-loading="true"] .sib-form-block__button-text {
64+ display: none !important;
65+ }
6066
6167 /* Style error and success messages */
6268 .sib-form-message-panel {
@@ -170,22 +176,28 @@ const { title = "ksctl - Strive towards Fast, Efficient and Sustainable Computin
170176 });
171177 </script >
172178
179+ <!-- Cloudflare Turnstile -->
180+ <script src =" https://challenges.cloudflare.com/turnstile/v0/api.js" async defer ></script >
181+
173182 <!-- Brevo Form Scripts -->
174183 <script is:inline >
175- // reCAPTCHA callback function
176- function handleCaptchaResponse() {
184+ // Turnstile/reCAPTCHA callback function
185+ window.handleCaptchaResponse = function(token) {
186+ console.log('Captcha completed:', token);
177187 var event = new Event('captchaChange');
178188 var captchaElement = document.getElementById('sib-captcha');
179189 if (captchaElement) {
190+ // Store the token for Brevo form validation
191+ captchaElement.dataset.captchaToken = token;
180192 captchaElement.dispatchEvent(event);
181193 }
182- }
194+ };
183195
184- // Brevo form configuration
196+ // Brevo form configuration (must be set before main.js loads)
185197 window.REQUIRED_CODE_ERROR_MESSAGE = 'Please choose a country code';
186198 window.LOCALE = 'en';
187199 window.EMAIL_INVALID_MESSAGE = window.SMS_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
188- window.REQUIRED_ERROR_MESSAGE = "This field cannot be left blank. ";
200+ window.REQUIRED_ERROR_MESSAGE = "Please complete the captcha verification. ";
189201 window.GENERIC_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
190202 window.translation = {
191203 common: {
@@ -195,9 +207,24 @@ const { title = "ksctl - Strive towards Fast, Efficient and Sustainable Computin
195207 selectedOptions: '{quantity} selected',
196208 }
197209 };
198- var AUTOHIDE = Boolean(0);
210+ window.AUTOHIDE = Boolean(0);
211+
212+ // Load Brevo script only after DOM is ready
213+ if (document.readyState === 'loading') {
214+ document.addEventListener('DOMContentLoaded', loadBrevoScript);
215+ } else {
216+ loadBrevoScript();
217+ }
218+
219+ function loadBrevoScript() {
220+ // Check if the form exists before loading the script
221+ if (document.getElementById('sib-form')) {
222+ var script = document.createElement('script');
223+ script.src = 'https://sibforms.com/forms/end-form/build/main.js';
224+ script.defer = true;
225+ document.body.appendChild(script);
226+ }
227+ }
199228 </script >
200- <script defer src =" https://sibforms.com/forms/end-form/build/main.js" ></script >
201- <script src =" https://challenges.cloudflare.com/turnstile/v0/api.js" async defer ></script >
202229 </body >
203230 </html >
0 commit comments