{"version":3,"file":"ConvertKitForm.B2FZnifN.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/F4HQmFci5gNOvZGUd2gJ/tBVufYIyiYLLwwJ9EpGc/ConvertKitForm.js"],"sourcesContent":["// ConvertKitForm subscription form with API integration and success message\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * ConvertKitForm subscription form with API integration\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ConvertKitForm(props){const{apiKey,formId,placeholder,buttonText,successMessage,backgroundColor,inputBackgroundColor,inputBorderColor,buttonColor,buttonTextColor,shadowColor,shadowX,shadowY,shadowBlur,textColor,borderRadius,font,buttonFont,layout}=props;const[email,setEmail]=useState(\"\");const[isLoading,setIsLoading]=useState(false);const[showSuccess,setShowSuccess]=useState(false);const[error,setError]=useState(\"\");const handleSubmit=async e=>{e.preventDefault();if(!email||!email.includes(\"@\")){startTransition(()=>setError(\"Please enter a valid email address\"));return;}if(!apiKey||!formId){startTransition(()=>setError(\"API key and Form ID are required\"));return;}startTransition(()=>{setIsLoading(true);setError(\"\");});try{const response=await fetch(`https://api.convertkit.com/v3/forms/${formId}/subscribe`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({api_key:apiKey,email:email})});if(response.ok){startTransition(()=>{setShowSuccess(true);setEmail(\"\");setIsLoading(false);});// Hide success message after 5 seconds\nsetTimeout(()=>{startTransition(()=>setShowSuccess(false));},5e3);}else{throw new Error(\"Subscription failed\");}}catch(err){startTransition(()=>{setError(\"Something went wrong. Please try again.\");setIsLoading(false);});}};const isFixedWidth=props?.style&&props.style.width===\"100%\";if(showSuccess){return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,...isFixedWidth?{...props?.style}:{minWidth:\"max-content\"},backgroundColor:\"#131313\",border:\"2px solid #22CC66\",borderRadius,padding:32,textAlign:\"center\",color:textColor,...font},children:/*#__PURE__*/_jsx(\"div\",{style:{color:\"#fff\",fontWeight:600,lineHeight:\"1.4em\"},children:successMessage})});}return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,...isFixedWidth?{...props?.style}:{minWidth:\"max-content\"},backgroundColor,borderRadius,padding:24,position:\"relative\"},children:/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:layout===\"vertical\"?\"column\":\"row\",gap:16},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>setEmail(e.target.value),placeholder:placeholder,disabled:isLoading,style:{padding:\"12px 16px\",borderRadius:borderRadius*.75,border:`1px solid ${inputBorderColor}`,backgroundColor:inputBackgroundColor,color:textColor,fontSize:\"16px\",outline:\"none\",flex:layout===\"horizontal\"?1:\"none\",...font},onFocus:e=>{e.target.style.borderColor=\"#1A65D5\";},onBlur:e=>{e.target.style.borderColor=inputBorderColor;}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isLoading,style:{padding:\"12px 24px\",borderRadius:borderRadius*.75,border:\"none\",backgroundColor:buttonColor,color:buttonTextColor,cursor:isLoading?\"not-allowed\":\"pointer\",opacity:isLoading?.7:1,transition:\"opacity 0.2s ease\",flexShrink:0,boxShadow:`${shadowX}px ${shadowY}px ${shadowBlur}px ${shadowColor}`,...buttonFont},children:isLoading?\"Subscribing...\":buttonText}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#FF5555\",fontSize:\"14px\",textAlign:\"center\",...font},children:error})]})});}addPropertyControls(ConvertKitForm,{layout:{type:ControlType.Enum,title:\"Layout\",options:[\"vertical\",\"horizontal\"],optionTitles:[\"Vertical\",\"Horizontal\"],defaultValue:\"vertical\",displaySegmentedControl:true},apiKey:{type:ControlType.String,title:\"API Key\",defaultValue:\"\",placeholder:\"Enter your ConvertKitForm API key\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\",placeholder:\"Enter your ConvertKitForm form ID\"},placeholder:{type:ControlType.String,title:\"Email Placeholder\",defaultValue:\"Enter your email address\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Subscribe\"},successMessage:{type:ControlType.String,title:\"Success Message\",defaultValue:\"Thanks for subscribing. You're one step closer to being a master of AI.\",displayTextArea:true},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#FFFFFF\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F5F5F5\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border Color\",defaultValue:\"#E5E5E5\"},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#FFFFFF\"},shadowColor:{type:ControlType.Color,title:\"Shadow Color\",defaultValue:\"rgba(0, 0, 0, 0.15)\"},shadowX:{type:ControlType.Number,title:\"Shadow X\",defaultValue:0,min:-20,max:20,step:1,unit:\"px\"},shadowY:{type:ControlType.Number,title:\"Shadow Y\",defaultValue:2,min:-20,max:20,step:1,unit:\"px\"},shadowBlur:{type:ControlType.Number,title:\"Shadow Blur\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ConvertKitForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\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