1function normalizeRussianPhoneContact(value) { 2 const contact = value.trim(); 3 if (!contact || contact.includes("@") || /[a-zа-Ñ]/i.test(contact)) { 4 return contact; 5 } 6 const digits = contact.replace(/\D/g, ""); 7 if (digits.length === 11 && (digits.startsWith("8") || digits.startsWith("7"))) { 8 return `+7${digits.slice(1)}`; 9 } 10 if (digits.length === 10) { 11 return `+7${digits}`; 12 } 13 return contact; 14} 15 16async function submitLead(payload) { 17 const response = await fetch("/api/leads", { 18 method: "POST", 19 headers: { "Content-Type": "application/json" }, 20 body: JSON.stringify({ 21 ...payload, 22 contact: normalizeRussianPhoneContact(payload.contact) 23 }) 24 }); 25 const data = await response.json().catch(() => ({})); 26 if (!response.ok) { 27 throw new Error(data.error || "Ðе ÑдалоÑÑ Ð¾ÑпÑавиÑÑ Ð·Ð°ÑвкÑ"); 28 } 29 return data; 30} 31 32export { submitLead as s };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.