Bliska Ci osoba interesuje się rękodziełem? Wiesz, że ucieszy się z materiałów plastycznych, ale nie wiesz co wybrać? Wybierz bon podarunkowy

Formularz rejestracyjny

Zapoznaj się z polityką prywatności oraz regulaminem.

Zapisywanie…

Dziękujemy za rejestrację! Za chwilę zostaniesz przekierowany…
Wystąpił błąd. Spróbuj ponownie lub skontaktuj się z nami.
// Klaviyo integration const KLAVIYO_COMPANY_ID = 'TQUcbx’; const KLAVIYO_LIST_ID = 'UzwRBe’; const OTO_PAGE_URL = 'https://kreatywnie.com/landingi/gratulacje-zapisales-sie-na-bezplatny-webinar-dla-rekodzielniczek-ktore-tworza-piekne-rzeczy-ale-czuja-ze-nikt-ich-nie-widzi/’; // Function to format and validate Polish phone number function formatPhoneNumber(phone) { if (!phone || phone.trim() === ”) { return null; } // Remove all non-digit characters let cleaned = phone.replace(/\D/g, ”); // If starts with 48, ensure it has + if (cleaned.startsWith(’48’)) { return '+’ + cleaned; } // If starts with 0, remove it and add +48 if (cleaned.startsWith(’0′)) { cleaned = cleaned.substring(1); } // If it’s 9 digits (standard Polish mobile), add +48 if (cleaned.length === 9) { return '+48′ + cleaned; } // If it already looks international and has reasonable length if (cleaned.length >= 9 && cleaned.length <= 15) { return '+' + cleaned; } // Invalid format - return null to skip sending return null; } document.getElementById('registrationForm').addEventListener('submit', async (e) => { e.preventDefault(); const submitBtn = document.getElementById(’submitBtn’); const btnText = document.getElementById(’btnText’); const loadingSpinner = document.getElementById(’loadingSpinner’); const successMessage = document.getElementById(’successMessage’); const errorMessage = document.getElementById(’errorMessage’); successMessage.style.display = 'none’; errorMessage.style.display = 'none’; submitBtn.disabled = true; btnText.style.display = 'none’; loadingSpinner.style.display = 'block’; const rawPhone = document.getElementById(’phone’).value; const formattedPhone = formatPhoneNumber(rawPhone); const formData = { firstName: document.getElementById(’firstName’).value, phone: formattedPhone, email: document.getElementById(’email’).value, consent: document.getElementById(’consent’).checked }; // Build profile attributes const profileAttributes = { email: formData.email, first_name: formData.firstName, properties: { webinar_registration: true, webinar_name: 'Pokaż światu to, co robisz’, registration_date: new Date().toISOString() } }; // Only add phone_number if it’s valid and properly formatted if (formData.phone) { profileAttributes.phone_number = formData.phone; } try { const response = await fetch(`https://a.klaviyo.com/client/subscriptions/?company_id=${KLAVIYO_COMPANY_ID}`, { method: 'POST’, headers: { 'Content-Type’: 'application/json’, 'Accept’: 'application/json’, 'revision’: '2024-10-15′ }, body: JSON.stringify({ data: { type: 'subscription’, attributes: { profile: { data: { type: 'profile’, attributes: profileAttributes } } }, relationships: { list: { data: { type: 'list’, id: KLAVIYO_LIST_ID } } } } }) }); if (response.ok || response.status === 202 || response.status === 201) { successMessage.style.display = 'block’; document.getElementById(’registrationForm’).reset(); // Redirect to OTO page after 2 seconds setTimeout(() => { window.open(OTO_PAGE_URL, '_blank’); }, 2000); } else { const errorData = await response.json(); console.error(’Klaviyo error:’, errorData); errorMessage.textContent = 'Wystąpił błąd: ’ + (errorData.errors?.[0]?.detail || 'Spróbuj ponownie’); errorMessage.style.display = 'block’; } } catch (error) { errorMessage.style.display = 'block’; console.error(’Error:’, error); } finally { submitBtn.disabled = false; btnText.style.display = 'inline’; loadingSpinner.style.display = 'none’; } });