{"version":3,"file":"NewsletterSubscribe.MC2-kVCg.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/zV6cH27smMTyXGi3MEAx/j2glXtjZZ3FOUeFXr0RR/NewsletterSubscribe.js"],"sourcesContent":["// Newsletter Input Button Demo - Interactive component that transforms from action button to email input form\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Email Subscription Button\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function InputButton(props){const{actionLabel,submitLabel,placeholder,background,inputBackground,inputTextColor,buttonBackground,buttonTextColor,borderRadius,font,buttonFont,arrowColor,arrowBackground,border,successColor,link,style,tinesWebhookUrl}=props;const[value,setValue]=useState(\"\");const[submitted,setSubmitted]=useState(false);const[showInput,setShowInput]=useState(false);const containerRef=useRef(null);useEffect(()=>{function handleClickOutside(event){if(containerRef.current&&!containerRef.current.contains(event.target)){startTransition(()=>setShowInput(false));}}if(showInput&&typeof document!==\"undefined\"){document.addEventListener(\"mousedown\",handleClickOutside);}return()=>{if(typeof document!==\"undefined\"){document.removeEventListener(\"mousedown\",handleClickOutside);}};},[showInput]);function handleInput(e){setValue(e.target.value);}async function handleSubmit(e){e.preventDefault();if(!value.trim())return;if(!tinesWebhookUrl){console.error(\"Tines Webhook URL is missing.\");alert(\"Configuration Error: Missing Webhook URL.\");return;}try{// Using \"no-cors\" and \"text/plain\" bypasses the preflight roadblock completely\nawait fetch(tinesWebhookUrl,{method:\"POST\",mode:\"no-cors\",headers:{\"Content-Type\":\"text/plain\"},body:JSON.stringify({email:value.trim()})});// Because mode is \"no-cors\", the response is opaque and we can't read response.ok status.\n// However, the browser successfully blasts the data directly out to your Tines endpoint.\nsetSubmitted(true);setTimeout(()=>{setSubmitted(false);setValue(\"\");setShowInput(false);},2e3);}catch(error){console.error(\"Failed to submit to Tines:\",error);alert(\"Something went wrong. Please try again.\");}}function handleKeyDown(e){if(e.key===\"Escape\"&&showInput){setShowInput(false);}}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,width:\"100%\",height:\"100%\",background,borderRadius,display:\"flex\",alignItems:\"center\",justifyContent:!showInput?\"center\":\"space-between\",padding:showInput?8:0,boxSizing:\"border-box\",position:\"relative\",overflow:\"hidden\",boxShadow:showInput?\"0 4px 20px rgba(0,0,0,0.12)\":\"0 2px 12px rgba(0,0,0,0.07)\",transition:\"box-shadow 0.15s ease, background 0.1s ease\",cursor:!showInput?\"pointer\":\"default\",...border},\"aria-label\":\"Newsletter signup\",onClick:()=>{if(!showInput){setShowInput(true);}},children:/*#__PURE__*/_jsx(AnimatePresence,{initial:false,mode:\"wait\",children:!showInput?/*#__PURE__*/_jsxs(motion.div,{initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1,ease:\"easeOut\"},style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\",height:\"100%\",padding:\"0 20px\",...font,color:font?.color||\"#222\",fontSize:font?.fontSize||16,fontWeight:font?.fontWeight||500,whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\"},\"aria-label\":actionLabel,children:[actionLabel,/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-flex\",alignItems:\"center\",marginLeft:12,background:arrowBackground,borderRadius:Math.min(borderRadius,6),padding:\"6px 10px\",transition:\"all 0.2s ease\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 18 18\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M6 4.5L11.25 9L6 13.5\",stroke:arrowColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})})]},\"action\"):/*#__PURE__*/_jsxs(motion.form,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1,ease:\"easeOut\"},onSubmit:handleSubmit,style:{display:\"flex\",alignItems:\"center\",width:\"100%\",gap:8},children:[/*#__PURE__*/_jsx(motion.input,{type:\"email\",id:\"email\",autoComplete:\"email\",value:value,onChange:handleInput,placeholder:placeholder,required:true,autoFocus:true,style:{flex:1,minWidth:0,border:\"none\",outline:\"none\",background:inputBackground,color:inputTextColor,padding:\"14px 16px\",borderRadius:Math.min(borderRadius,8),fontSize:font?.fontSize||16,fontFamily:font?.fontFamily||\"inherit\",fontWeight:font?.fontWeight||400,transition:\"box-shadow 0.2s ease\"},\"aria-label\":\"Email address\",initial:{opacity:1,x:0},animate:{opacity:1,x:0},transition:{duration:.05,ease:\"easeOut\"}}),/*#__PURE__*/_jsx(motion.button,{type:\"submit\",disabled:submitted||!value.trim(),style:{background:submitted?successColor:!value.trim()?\"#9CA3AF\":buttonBackground,color:buttonTextColor,border:\"none\",borderRadius:Math.min(borderRadius,8),padding:props.buttonPadding||\"14px 20px\",cursor:submitted||!value.trim()?\"not-allowed\":\"pointer\",fontFamily:buttonFont?.fontFamily||font?.fontFamily||\"inherit\",fontSize:buttonFont?.fontSize||16,fontWeight:buttonFont?.fontWeight||600,transition:\"all 0.2s ease\",boxShadow:\"0 2px 8px rgba(0,0,0,0.1)\",minWidth:80,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},\"aria-label\":submitted?\"Subscribed successfully\":submitLabel,initial:{opacity:1,x:0},animate:{opacity:1,x:0},transition:{duration:.05,ease:\"easeOut\"},whileHover:!submitted&&value.trim()?{scale:1.02,boxShadow:\"0 4px 12px rgba(0,0,0,0.15)\"}:{},whileTap:!submitted&&value.trim()?{scale:.98}:{},children:submitted?/*#__PURE__*/_jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:{type:\"tween\",duration:.1,ease:\"easeOut\"},children:\"✓\"}):submitLabel})]},\"input\")})});}addPropertyControls(InputButton,{tinesWebhookUrl:{type:ControlType.String,title:\"Tines Webhook URL\",placeholder:\"https://your-tenant.tines.com/webhook/...\"},actionLabel:{type:ControlType.String,title:\"Action Label\",defaultValue:\"Join our newsletter\"},submitLabel:{type:ControlType.String,title:\"Submit Label\",defaultValue:\"Subscribe\"},placeholder:{type:ControlType.String,title:\"Email Placeholder\",defaultValue:\"Enter your email\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},inputBackground:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F8F9FA\"},inputTextColor:{type:ControlType.Color,title:\"Input Text Color\",defaultValue:\"#1F2937\"},buttonBackground:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"#3B82F6\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#FFFFFF\"},border:{type:ControlType.Border,title:\"Border\",defaultValue:{borderWidth:1,borderStyle:\"solid\",borderColor:\"rgba(0, 0, 0, 0.1)\"}},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:12,min:0,max:32,step:1,displayStepper:true},font:{type:ControlType.Font,title:\"Main Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},buttonPadding:{type:ControlType.String,title:\"Button Padding\",defaultValue:\"14px 20px\",placeholder:\"e.g. 14px 20px\"},arrowColor:{type:ControlType.Color,title:\"Arrow Color\",defaultValue:\"#FFFFFF\"},arrowBackground:{type:ControlType.Color,title:\"Arrow Background\",defaultValue:\"#1F2937\"},successColor:{type:ControlType.Color,title:\"Success Color\",defaultValue:\"#10B981\"},link:{type:ControlType.Link,title:\"Submit Link\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InputButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"60\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NewsletterSubscribe.map"],"mappings":"8PASG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,cAAY,cAAY,cAAY,aAAW,kBAAgB,iBAAe,mBAAiB,kBAAgB,eAAa,OAAK,aAAW,aAAW,kBAAgB,SAAO,eAAa,OAAK,QAAM,mBAAiB,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAaC,EAAO,KAAK,CAAC,MAAc,CAAC,SAAS,EAAmB,EAAM,CAAI,EAAa,SAAS,CAAC,EAAa,QAAQ,SAAS,EAAM,OAAO,EAAE,MAAoB,EAAa,GAAM,CAAC,CAA2G,OAArG,GAAW,OAAO,SAAW,KAAa,SAAS,iBAAiB,YAAY,EAAmB,KAAY,CAAI,OAAO,SAAW,KAAa,SAAS,oBAAoB,YAAY,EAAmB,GAAM,CAAC,EAAU,CAAC,CAAC,SAAS,EAAY,EAAE,CAAC,EAAS,EAAE,OAAO,MAAM,CAAE,eAAe,EAAa,EAAE,CAAC,KAAE,gBAAgB,CAAK,EAAM,MAAM,CAAQ,IAAG,CAAC,EAAgB,CAAC,QAAQ,MAAM,gCAAgC,CAAC,MAAM,4CAA4C,CAAC,OAAQ,GAAG,CACtjC,MAAM,MAAM,EAAgB,CAAC,OAAO,OAAO,KAAK,UAAU,QAAQ,CAAC,eAAe,aAAa,CAAC,KAAK,KAAK,UAAU,CAAC,MAAM,EAAM,MAAM,CAAC,CAAC,CAAC,CAAC,CAE3I,EAAa,GAAK,CAAC,eAA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