PageSourceSearch

https://hyperice.com/cdn/shop/t/117/assets/klaviyo-signup-form.DHEUnXkl.min.js

js hyperice.com collected 2026-10-01 11:44:11 UTC 2,824 bytes, 1 lines download raw bytes

1import{B as h}from"./BaseElement.DUV4NqCX.min.js";import{c as p}from"./WithApiClient.DyDsqC0I.min.js";import{t as u}from"./custom-element.BhZVzxrc.min.js";import"./lit-element.mvcqtviJ.min.js";import{e as l}from"./query.CpiO8Lcb.min.js";import"./index.CKJCYK2x.min.js";import"./base.CShCMygk.min.js";var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,c=(e,t,o,i)=>{for(var s=i>1?void 0:i?y(t,o):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,o,s):a(s))||s);return i&&s&&d(t,o,s),s};let n=class extends h{constructor(){super(),this.$klaviyoApi=p({baseUrl:"https://a.klaviyo.com/client",headers:{revision:"2024-07-15","Content-Type":"application/json"}}),this.handleFormSubmit=this.handleFormSubmit.bind(this)}get locale(){return this.getAttribute("locale")||"en"}get market(){return this.getAttribute("market")||"CA"}get country(){return this.getAttribute("country")||"Canada"}get listId(){return this.getAttribute("list-id")}get companyId(){return this.getAttribute("company-id")}connectedCallback(){super.connectedCallback(),this.form.addEventListener("submit",this.handleFormSubmit)}disconnectedCallback(){var e;(e=this.form)==null||e.removeEventListener("submit",this.handleFormSubmit),super.disconnectedCallback()}get companyIdFromScript(){const e=Array.from(document.scripts).find(t=>t.src.includes("static.klaviyo.com/onsite/js"));if(e){const t=new URL(e.src);return t.searchParams.get("company_id")||t.pathname.split("/")[4]||null}return null}async handleFormSubmit(e){e.preventDefault();const t=this.companyId||this.companyIdFromScript;!t||this.listId;const i=new FormData(e.target).get("email");if(!i){this.showValidationErrorMessage();return}try{this.submitButton.disabled=!0,this.resetMessage();const s={method:"POST",body:{data:{type:"subscription",attributes:{profile:{data:{type:"profile",attributes:{email:i,locale:this.locale,location:{country:this.country},properties:{locale:this.locale,locale_iso_code:`${this.locale}-${this.market}`,market:this.market,country:this.country}}}}},relationships:{list:{data:{type:"list",id:this.listId}}}}}};try{await this.$klaviyoApi(`/subscriptions/?company_id=${t}`,s),this.showSuccessMessage(),setTimeout(()=>{this.form.reset(),this.resetMessage()},6e3)}catch(r){if((r==null?void 0:r.errors)&&r.errors.length>0){const m=r.errors[0].detail||"An error occurred";console.error("API Error:",m),this.showApiErrorMessage();return}}}catch(s){console.error(s),this.showApiErrorMessage()}finally{this.submitButton.disabled=!1}}resetMessage(){this.dataset.state=""}showSuccessMessage(){this.dataset.state="success"}showValidationErrorMessage(){this.dataset.state="error-validation"}showApiErrorMessage(){this.dataset.state="error-api"}};c([l("form")],n.prototype,"form",2);c([l(".js-signup-form-submit")],n.prototype,"submitButton",2);n=c([u("klaviyo-signup-form")],n);

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.