{"version":3,"file":"BlogNewsletter_Customer_io.CYuZI8PQ.mjs","names":["React","_Fragment"],"sources":["https:/framerusercontent.com/modules/7SjvEZ6iQBsXlxMTKc3F/0dIMUoXUFJg1Bpr4qgS7/BlogNewsletter_Customer_io.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import React from\"react\";export function CIONewsletterForm(props){const{placeholder=\"Enter your email\",buttonLabel=\"Subscribe\",formId=\"01km08p0rx8zwg8xvzv0kpj58t\",siteId=\"9d5b628673c367ff7eef\",// Layout\nlayout=\"inline\",// Button styling\nbuttonBg=\"#111827\",buttonTextColor=\"#ffffff\",buttonFontSize=14,buttonFontWeight=\"600\",buttonWidth=130,// Input styling\ninputBg=\"#ffffff\",inputTextColor=\"#111827\",inputBorderColor=\"#d1d5db\",inputFontSize=14,inputHeight=44,// Shared\nborderRadius=8,gap=8,// Success state\nsuccessBg=\"#f0fdf4\",successBorderColor=\"#86efac\",successTextColor=\"#166534\"}=props;const[email,setEmail]=React.useState(\"\");const[status,setStatus]=React.useState(\"idle\")// idle | loading | success | error\n;const[errorMsg,setErrorMsg]=React.useState(\"\");const fontFamily=\"system-ui, -apple-system, sans-serif\";// ── Submit logic ─────────────────────────────────────────────────────────\nconst submit=async()=>{if(!email||!email.includes(\"@\")){setStatus(\"error\");setErrorMsg(\"Please enter a valid email.\");return;}setStatus(\"loading\");setErrorMsg(\"\");try{const formUrl=typeof window!==\"undefined\"&&window.location?window.location.href:\"\";const params=new URLSearchParams;params.append(\"email\",email);params.append(\"_cio_html_form_id\",formId);params.append(\"_cio_html_form_name\",\"Blog Newsletter\");params.append(\"_cio_html_form_url\",formUrl);params.append(\"_cio_html_form_inputs\",\"email\");params.append(\"_cio_site_id\",siteId);const response=await fetch(\"https://eu.customerioforms.com/custom_forms/submit_snippet\",{method:\"POST\",headers:{\"Content-Type\":\"application/x-www-form-urlencoded\"},body:params.toString()});const body=await response.text();if(response.ok){setStatus(\"success\");setEmail(\"\");}else{setStatus(\"error\");setErrorMsg(`Error ${response.status}: ${body.slice(0,100)}`);}}catch(e){setStatus(\"error\");setErrorMsg(`Network error: ${e.message}`);}};// ─────────────────────────────────────────────────────────────────────────\nif(status===\"success\"){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",minHeight:inputHeight,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:successBg,border:`1px solid ${successBorderColor}`,borderRadius:borderRadius,fontFamily:fontFamily,fontSize:14,color:successTextColor,boxSizing:\"border-box\",padding:\"12px 16px\",textAlign:\"center\"},children:\"You are subscribed! Check your inbox.\"});}const isInline=layout===\"inline\";const inputEl=/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,placeholder:placeholder,onChange:e=>{setEmail(e.target.value);setStatus(\"idle\");setErrorMsg(\"\");},onKeyDown:e=>{if(e.key===\"Enter\")submit();},style:{// In inline mode: grow to fill remaining space. In stacked: full width.\nflex:isInline?\"1 1 0\":undefined,width:isInline?undefined:\"100%\",height:inputHeight,padding:\"0 14px\",fontSize:inputFontSize,fontFamily:fontFamily,color:inputTextColor,backgroundColor:inputBg,border:status===\"error\"?\"1.5px solid #ef4444\":`1.5px solid ${inputBorderColor}`,borderRadius:borderRadius,outline:\"none\",boxSizing:\"border-box\"}});const buttonEl=/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .cio-btn {\n                    background-color: ${status===\"loading\"?\"#374151\":buttonBg} !important;\n                }\n                .cio-btn-label {\n                    color: ${buttonTextColor} !important;\n                    font-size: ${buttonFontSize}px !important;\n                    font-weight: ${buttonFontWeight} !important;\n                    font-family: ${fontFamily} !important;\n                    line-height: 1 !important;\n                    pointer-events: none;\n                    white-space: nowrap;\n                }\n            `}),/*#__PURE__*/_jsx(\"div\",{className:\"cio-btn\",onClick:submit,style:{// In inline mode: fixed width. In stacked: full width.\nwidth:isInline?buttonWidth:\"100%\",flexShrink:0,height:inputHeight,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius:borderRadius,cursor:\"pointer\",boxSizing:\"border-box\"},children:/*#__PURE__*/_jsx(\"span\",{className:\"cio-btn-label\",children:status===\"loading\"?\"Subscribing...\":buttonLabel})})]});return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",display:\"flex\",flexDirection:isInline?\"row\":\"column\",alignItems:isInline?\"flex-start\":undefined,gap:gap,boxSizing:\"border-box\"},children:[inputEl,!isInline&&status===\"error\"&&/*#__PURE__*/_jsx(\"span\",{style:{fontSize:12,color:\"#ef4444\",fontFamily:fontFamily},children:errorMsg}),buttonEl,isInline&&status===\"error\"&&/*#__PURE__*/_jsx(\"span\",{style:{fontSize:12,color:\"#ef4444\",fontFamily:fontFamily,width:\"100%\",// Force it onto its own line within the flex row\nflexBasis:\"100%\"},children:errorMsg})]});}CIONewsletterForm.displayName=\"CIONewsletterForm\";addPropertyControls(CIONewsletterForm,{// ── Content ──────────────────────────────────────────────────────────────\nplaceholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your email\"},buttonLabel:{type:ControlType.String,title:\"Button Label\",defaultValue:\"Subscribe\"},// ── Integration ───────────────────────────────────────────────────────────\nformId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"01km08p0rx8zwg8xvzv0kpj58t\"},siteId:{type:ControlType.String,title:\"Site ID\",defaultValue:\"9d5b628673c367ff7eef\"},// ── Layout ───────────────────────────────────────────────────────────────\nlayout:{type:ControlType.Enum,title:\"Layout\",options:[\"inline\",\"stacked\"],optionTitles:[\"Inline (side by side)\",\"Stacked\"],defaultValue:\"inline\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:48,step:1,displayStepper:true},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:999,displayStepper:true},// ── Input ─────────────────────────────────────────────────────────────────\ninputHeight:{type:ControlType.Number,title:\"Height\",defaultValue:44,min:32,max:80,displayStepper:true},inputBg:{type:ControlType.Color,title:\"Input BG\",defaultValue:\"#ffffff\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#111827\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"#d1d5db\"},inputFontSize:{type:ControlType.Number,title:\"Input Font Size\",defaultValue:14,min:10,max:24,displayStepper:true},// ── Button ────────────────────────────────────────────────────────────────\nbuttonBg:{type:ControlType.Color,title:\"Button BG\",defaultValue:\"#111827\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#ffffff\"},buttonFontSize:{type:ControlType.Number,title:\"Button Font Size\",defaultValue:14,min:10,max:24,displayStepper:true},buttonFontWeight:{type:ControlType.Enum,title:\"Button Weight\",options:[\"400\",\"500\",\"600\",\"700\",\"800\"],optionTitles:[\"Regular\",\"Medium\",\"Semi Bold\",\"Bold\",\"Extra Bold\"],defaultValue:\"600\"},buttonWidth:{type:ControlType.Number,title:\"Button Width\",defaultValue:130,min:60,max:400,displayStepper:true,hidden:props=>props.layout!==\"inline\"},// ── Success State ─────────────────────────────────────────────────────────\nsuccessBg:{type:ControlType.Color,title:\"Success BG\",defaultValue:\"#f0fdf4\"},successBorderColor:{type:ControlType.Color,title:\"Success Border\",defaultValue:\"#86efac\"},successTextColor:{type:ControlType.Color,title:\"Success Text\",defaultValue:\"#166534\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"CIONewsletterForm\":{\"type\":\"reactComponent\",\"name\":\"CIONewsletterForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BlogNewsletter_Customer_io.map"],"mappings":"kMAA4J,SAAgB,EAAkB,EAAM,CAAC,GAAK,CAAC,cAAY,mBAAmB,cAAY,YAAY,SAAO,6BAA6B,SAAO,uBAC7S,SAAO,SACP,WAAS,UAAU,kBAAgB,UAAU,iBAAe,GAAG,mBAAiB,MAAM,cAAY,IAClG,U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