PageSourceSearch

https://representclo.com/cdn/shop/t/168/assets/klaviyo-signup.js?v=80647184638933397751777982070

js representclo.com collected 2026-09-24 15:26:05 UTC 2,533 bytes, 2 lines download raw bytes

1class KlaviyoSignup{constructor(){this.config=window.klaviyoSignupConfig||{}}async submit(formElement,options={}){const formData=new FormData(formElement),email=formData.get("email")||formData.get("ue")||formData.get("user_email"),firstName=formData.get("firstname")||formData.get("first_name")||"",lastName=formData.get("lastname")||formData.get("last_name")||"";let phone="";const telInput=formElement.querySelector("[data-tel-input]");if(telInput?.intlTelInput&&(phone=telInput.intlTelInput.getNumber()),phone||(phone=formData.get("phone_number")||formData.get("phone")||formData.get("full_phone")||formData.get("phone_mobile")||""),!email){const emailInput=formElement.querySelector('[type="email"]');emailInput&&(email=emailInput.value)}if(!email)throw{error:"Email is required"};const apiKey=options.api_key||this.config.apiKey,formType=options.form_type;let listId=options.list_id||this.config.lists?.[formType?.toLowerCase()];if(listId||(listId=this.config.lists?.subscribers),!apiKey||!listId)throw console.error("Klaviyo config missing:",{apiKey,listId,formType}),{error:"Klaviyo not configured"};const hasPhone=!!(phone&&phone.length>0),properties={};this.config.storeSignup&&(properties.store_signup=this.config.storeSignup),formType&&(properties.form_type=formType);const subscriptions={email:{marketing:{consent:"SUBSCRIBED",consented_at:new Date().toISOString()}}};hasPhone&&(subscriptions.sms={marketing:{consent:"SUBSCRIBED",consented_at:new Date().toISOString()}});const attributes={profile:{data:{type:"profile",attributes:{email,phone_number:hasPhone?phone:null,first_name:firstName,last_name:lastName,properties,subscriptions}}}};formType&&(attributes.custom_source=formType);const payload={data:{type:"subscription",attributes,relationships:{list:{data:{type:"list",id:listId}}}}},response=await fetch(`https://a.klaviyo.com/client/subscriptions?company_id=${apiKey}`,{method:"POST",headers:{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json",revision:this.config.revision||"2026-04-15"},body:JSON.stringify(payload)}),responseText=await response.text(),responseData=responseText?JSON.parse(responseText):{};if(!response.ok)throw{error:responseData?.errors?.[0]?.detail||"Something went wrong. Please try again."};return responseData}}document.addEventListener("DOMContentLoaded",()=>{window.klaviyoSignup=new KlaviyoSignup,window.dispatchEvent(new Event("klaviyoSignup:initialized"))});
2//# sourceMappingURL=/cdn/shop/t/168/assets/klaviyo-signup.js.map?v=80647184638933397751777982070

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.