{"version":3,"file":"KitForm.C_jGwidP.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/3dq5WuBQcJ3IWKMN32VX/ZRWvmYM4ZvSwVdAKGqFt/KitForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Kit Signup Form — posts directly to a Kit form from the top-level document.\n *\n * Why this exists: Framer renders HTML embeds inside an <iframe srcdoc=\"…\">, which\n * has no URL of its own (location.href === \"about:srcdoc\"). Kit's embed script reads\n * its own location/referrer to build tracking, so it always submits host=about:srcdoc\n * with an empty referrer and empty search — UTMs never reach Kit.\n *\n * This component renders in the real page, so document.referrer and location.search\n * are genuine. It forwards them in Kit's own native field names (referrer/host/search),\n * which is what Kit parses UTMs from, plus optional utm_* custom fields.\n *\n * The optional extra field posts as fields[<key>]; the key must be an existing Kit\n * custom field or Kit drops it silently.\n *\n * @framerIntrinsicWidth 480\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function KitForm(props){const{formId=\"9775600\",showFirstName=true,showLastName=true,firstNamePlaceholder=\"First Name\",lastNamePlaceholder=\"Last Name\",emailPlaceholder=\"Email Address\",showExtra=false,extraFieldKey=\"linkedin\",extraPlaceholder=\"LinkedIn profile URL\",extraRequired=true,extraType=\"url\",buttonLabel=\"Continue\",redirect=\"/ty/email-course\",successMessage=\"Done — check your inbox.\",sendTracking=true,buttonColor=\"#A71D02\",buttonTextColor=\"#FFFFFF\",inputBackground=\"#FFFFFF\",inputTextColor=\"#111111\",inputBorderColor=\"#E2E2E2\",radius=4,buttonRadius=5,gap=12,font,style}=props;const[status,setStatus]=useState(\"idle\");const[message,setMessage]=useState(\"\");// Real page context. Inside a srcdoc iframe these would all be empty.\nfunction collectTracking(){const out={};if(typeof window===\"undefined\")return out;try{out[\"referrer\"]=document.referrer||\"\";out[\"host\"]=window.location.hostname||\"\";out[\"search\"]=window.location.search||\"\";const params=new URLSearchParams(window.location.search);const keys=[\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_term\",\"utm_content\"];for(const k of keys){const v=params.get(k);if(v)out[\"fields[\"+k+\"]\"]=v;}}catch{// location access can throw in exotic embedding contexts; tracking is best-effort\n}return out;}async function handleSubmit(event){event.preventDefault();if(RenderTarget.current()===RenderTarget.canvas)return;const formEl=event.currentTarget;const data=new FormData(formEl);if(sendTracking){const t=collectTracking();for(const key in t)data.append(key,t[key]);}startTransition(()=>{setStatus(\"loading\");setMessage(\"\");});try{const res=await fetch(\"https://app.kit.com/forms/\"+formId+\"/subscriptions\",{method:\"POST\",body:data,headers:{accept:\"application/json\"}});let json=null;try{json=await res.json();}catch{json=null;}const failed=!res.ok||json&&(json.status===\"failed\"||json.errors);if(failed){const err=json&&json.errors?String(json.errors[0]):\"Something went wrong. Please try again.\";startTransition(()=>{setStatus(\"error\");setMessage(err);});return;}const target=(redirect||\"\").trim();if(target&&typeof window!==\"undefined\"){window.location.assign(target);return;}startTransition(()=>{setStatus(\"success\");setMessage(successMessage);});formEl.reset();}catch{startTransition(()=>{setStatus(\"error\");setMessage(\"Network error. Please try again.\");});}}const inputStyle={width:\"100%\",height:47,padding:\"12px 14px\",background:inputBackground,color:inputTextColor,border:\"1px solid \"+inputBorderColor,borderRadius:radius,boxSizing:\"border-box\",...font};return /*#__PURE__*/_jsxs(\"form\",{className:\"kf-form\",onSubmit:handleSubmit,style:{position:\"relative\",display:\"flex\",flexDirection:\"column\",gap:gap,width:\"100%\",...style},children:[/*#__PURE__*/_jsx(\"style\",{children:`.kf-form input:focus-visible, .kf-form button:focus-visible { outline: 2px solid ${buttonColor}; outline-offset: 2px; }`}),showFirstName&&/*#__PURE__*/_jsx(\"input\",{type:\"text\",name:\"fields[first_name]\",placeholder:firstNamePlaceholder,\"aria-label\":\"First name\",required:true,style:inputStyle}),showLastName&&/*#__PURE__*/_jsx(\"input\",{type:\"text\",name:\"fields[last_name]\",placeholder:lastNamePlaceholder,\"aria-label\":\"Last name\",style:inputStyle}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email_address\",placeholder:emailPlaceholder,\"aria-label\":\"Email address\",required:true,style:inputStyle}),showExtra&&/*#__PURE__*/_jsx(\"input\",{type:extraType===\"url\"?\"url\":\"text\",name:\"fields[\"+extraFieldKey+\"]\",placeholder:extraPlaceholder,\"aria-label\":extraPlaceholder,required:extraRequired,inputMode:extraType===\"url\"?\"url\":\"text\",style:inputStyle}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:status===\"loading\",style:{width:\"100%\",height:47,padding:\"0 24px\",background:buttonColor,color:buttonTextColor,border:\"none\",borderRadius:buttonRadius,cursor:\"pointer\",opacity:status===\"loading\"?.7:1,fontWeight:600,...font},children:status===\"loading\"?\"Sending…\":buttonLabel}),status===\"success\"&&/*#__PURE__*/_jsx(\"div\",{role:\"status\",style:{color:\"#1B7F4B\",...font},children:message}),status===\"error\"&&/*#__PURE__*/_jsx(\"div\",{role:\"alert\",style:{color:\"#A61D01\",...font},children:message})]});}addPropertyControls(KitForm,{formId:{type:ControlType.String,title:\"Kit Form ID\",defaultValue:\"9775600\"},showFirstName:{type:ControlType.Boolean,title:\"First name\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},firstNamePlaceholder:{type:ControlType.String,title:\"Name text\",defaultValue:\"First Name\",hidden:p=>!p.showFirstName},showLastName:{type:ControlType.Boolean,title:\"Last name\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},lastNamePlaceholder:{type:ControlType.String,title:\"Last name text\",defaultValue:\"Last Name\",hidden:p=>!p.showLastName},emailPlaceholder:{type:ControlType.String,title:\"Email text\",defaultValue:\"Email Address\"},showExtra:{type:ControlType.Boolean,title:\"Extra field\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},extraFieldKey:{type:ControlType.String,title:\"Extra key\",defaultValue:\"linkedin\",placeholder:\"Kit custom field key\",hidden:p=>!p.showExtra},extraPlaceholder:{type:ControlType.String,title:\"Extra text\",defaultValue:\"LinkedIn profile URL\",hidden:p=>!p.showExtra},extraRequired:{type:ControlType.Boolean,title:\"Extra required\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\",hidden:p=>!p.showExtra},extraType:{type:ControlType.Enum,title:\"Extra type\",options:[\"url\",\"text\"],optionTitles:[\"URL\",\"Text\"],defaultValue:\"url\",hidden:p=>!p.showExtra},buttonLabel:{type:ControlType.String,title:\"Button label\",defaultValue:\"Continue\"},redirect:{type:ControlType.String,title:\"Redirect to\",defaultValue:\"/ty/email-course\",placeholder:\"/thank-you or https://…\"},successMessage:{type:ControlType.String,title:\"Success text\",defaultValue:\"Done — check your inbox.\",hidden:p=>!!(p.redirect&&String(p.redirect).trim())},sendTracking:{type:ControlType.Boolean,title:\"UTM tracking\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},buttonColor:{type:ControlType.Color,title:\"Button\",defaultValue:\"#A71D02\"},buttonTextColor:{type:ControlType.Color,title:\"Button text\",defaultValue:\"#FFFFFF\"},inputBackground:{type:ControlType.Color,title:\"Input bg\",defaultValue:\"#FFFFFF\"},inputTextColor:{type:ControlType.Color,title:\"Input text\",defaultValue:\"#111111\"},inputBorderColor:{type:ControlType.Color,title:\"Input border\",defaultValue:\"#E2E2E2\"},radius:{type:ControlType.Number,title:\"Input radius\",defaultValue:4,min:0,max:40,step:1},buttonRadius:{type:ControlType.Number,title:\"Button radius\",defaultValue:5,min:0,max:40,step:1},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:12,min:0,max:48,step:1},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"KitForm\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"480\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\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