{"version":3,"file":"N8N_Form.CSSiENSP.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/nmysjjsYO0QNsvPu6vep/RRBUNcUTh28uQdEckKTh/N8N_Form.js"],"sourcesContent":["// FRAMER CODE COMPONENT - N8NForm\n// Replaces the ConvertKit form on all free resource pages\n// Add to: Assets → Code → New File → Name it \"N8NForm\"\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const WEBHOOKS={backtest:\"https://n8n.srv1104529.hstgr.cloud/webhook/backtest-freebie\",findmyedge:\"https://n8n.srv1104529.hstgr.cloud/webhook/findmyedge\",tradeplan:\"https://n8n.srv1104529.hstgr.cloud/webhook/tradeplan\",thirtyday:\"https://n8n.srv1104529.hstgr.cloud/webhook/30day-plan\"};export default function N8NForm({webhookType,buttonText,resourceName,buttonColor}){const[firstName,setFirstName]=useState(\"\");const[lastName,setLastName]=useState(\"\");const[email,setEmail]=useState(\"\");const[phone,setPhone]=useState(\"\");const[consent,setConsent]=useState(false);const[status,setStatus]=useState(\"idle\");const[errorMsg,setErrorMsg]=useState(\"\");const webhookUrl=WEBHOOKS[webhookType]||WEBHOOKS.freebie;const themeColor=buttonColor||\"#00B03B\";async function handleSubmit(){if(!firstName.trim()){setErrorMsg(\"Please enter your first name.\");setStatus(\"error\");return;}if(!lastName.trim()){setErrorMsg(\"Please enter your last name.\");setStatus(\"error\");return;}if(!email||!email.includes(\"@\")){setErrorMsg(\"Please enter a valid email address.\");setStatus(\"error\");return;}if(!consent){setErrorMsg(\"Please agree to the terms before continuing.\");setStatus(\"error\");return;}setStatus(\"loading\");setErrorMsg(\"\");try{await fetch(webhookUrl,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({firstName:firstName.trim(),lastName:lastName.trim(),email,phone:phone.trim()||null,resource:resourceName,source:\"framer_website\",timestamp:new Date().toISOString()})});setStatus(\"success\");setFirstName(\"\");setLastName(\"\");setEmail(\"\");setPhone(\"\");setConsent(false);}catch(e){setErrorMsg(\"Something went wrong. Please try again.\");setStatus(\"error\");}}if(status===\"success\"){return /*#__PURE__*/_jsxs(\"div\",{style:styles.successBox,children:[/*#__PURE__*/_jsx(\"div\",{style:{...styles.successIcon,backgroundColor:themeColor+\"20\",color:themeColor},children:\"✓\"}),/*#__PURE__*/_jsx(\"p\",{style:styles.successTitle,children:\"Check your inbox!\"}),/*#__PURE__*/_jsxs(\"p\",{style:styles.successSub,children:[\"We've sent \",/*#__PURE__*/_jsx(\"strong\",{children:resourceName}),\" to your email.\"]})]});}return /*#__PURE__*/_jsxs(\"div\",{style:styles.wrapper,children:[/*#__PURE__*/_jsxs(\"div\",{style:styles.nameRow,children:[/*#__PURE__*/_jsx(\"input\",{style:styles.input,type:\"text\",placeholder:\"First Name\",value:firstName,onChange:e=>setFirstName(e.target.value)}),/*#__PURE__*/_jsx(\"input\",{style:styles.input,type:\"text\",placeholder:\"Last Name\",value:lastName,onChange:e=>setLastName(e.target.value)})]}),/*#__PURE__*/_jsx(\"input\",{style:styles.input,type:\"email\",placeholder:\"Your Email Address\",value:email,onChange:e=>setEmail(e.target.value)}),/*#__PURE__*/_jsxs(\"div\",{style:styles.phoneBlock,children:[/*#__PURE__*/_jsx(\"input\",{style:styles.input,type:\"tel\",placeholder:\"Phone Number (Optional)\",value:phone,onChange:e=>setPhone(e.target.value),onKeyDown:e=>e.key===\"Enter\"&&handleSubmit()}),/*#__PURE__*/_jsx(\"p\",{style:styles.phoneHint,children:\"Share your number to get exclusive trade alerts, flash deals & priority access to live sessions — straight to your phone before anyone else.\"})]}),/*#__PURE__*/_jsxs(\"label\",{style:styles.checkboxLabel,onClick:()=>setConsent(!consent),children:[/*#__PURE__*/_jsx(\"div\",{style:{...styles.checkbox,backgroundColor:consent?themeColor:\"transparent\",borderColor:consent?themeColor:\"#444\"},children:consent&&/*#__PURE__*/_jsx(\"span\",{style:styles.checkmark,children:\"✓\"})}),/*#__PURE__*/_jsx(\"span\",{style:styles.checkboxText,children:\"I agree to receive educational content, updates & occasional promotions from TWS. You can unsubscribe anytime.\"})]}),/*#__PURE__*/_jsx(\"button\",{style:{...styles.button,backgroundColor:themeColor,opacity:status===\"loading\"?.7:1},onClick:handleSubmit,disabled:status===\"loading\",children:status===\"loading\"?\"Sending...\":buttonText||\"Download Now\"}),status===\"error\"&&/*#__PURE__*/_jsx(\"p\",{style:styles.errorText,children:errorMsg}),/*#__PURE__*/_jsx(\"p\",{style:styles.disclaimer,children:\"We respect your privacy. No spam, ever.\"})]});}// ─── PROPERTY CONTROLS ───────────────────────────────────────────────────────\naddPropertyControls(N8NForm,{webhookType:{type:ControlType.Enum,title:\"Which Resource\",options:[\"backtest\",\"freebie\",\"findmyedge\",\"tradeplan\",\"thirtyday\"],optionTitles:[\"Backtest Freebie\",\"Free-Bie Welcome\",\"Find My Edge\",\"Trade Plan & Rules\",\"30 Day Trading Plan\"],defaultValue:\"freebie\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Download Now\"},resourceName:{type:ControlType.String,title:\"Resource Name\",defaultValue:\"Free Resource\"},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#00B03B\"}});// ─── STYLES ──────────────────────────────────────────────────────────────────\nconst styles={wrapper:{display:\"flex\",flexDirection:\"column\",gap:\"10px\",width:\"100%\"},nameRow:{display:\"flex\",gap:\"10px\",width:\"100%\"},input:{backgroundColor:\"#1a1a1a\",border:\"1px solid #2e2e2e\",borderRadius:\"8px\",color:\"#fff\",fontSize:\"15px\",padding:\"14px 16px\",outline:\"none\",width:\"100%\",boxSizing:\"border-box\",flex:1},phoneBlock:{display:\"flex\",flexDirection:\"column\",gap:\"6px\"},phoneHint:{color:\"#666\",fontSize:\"12px\",lineHeight:\"1.4\",margin:0,paddingLeft:\"4px\"},checkboxLabel:{display:\"flex\",alignItems:\"flex-start\",gap:\"10px\",cursor:\"pointer\",padding:\"6px 0\",userSelect:\"none\"},checkbox:{width:\"18px\",height:\"18px\",minWidth:\"18px\",borderRadius:\"4px\",border:\"1.5px solid #444\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",marginTop:\"1px\",transition:\"all 0.15s ease\"},checkmark:{color:\"#000\",fontSize:\"12px\",fontWeight:\"700\",lineHeight:1},checkboxText:{color:\"#888\",fontSize:\"12px\",lineHeight:\"1.4\"},button:{color:\"#000\",border:\"none\",borderRadius:\"8px\",padding:\"14px\",fontSize:\"15px\",fontWeight:\"700\",cursor:\"pointer\",width:\"100%\",marginTop:\"4px\"},errorText:{color:\"#ff4d4d\",fontSize:\"13px\",margin:0,textAlign:\"center\"},disclaimer:{color:\"#555\",fontSize:\"11px\",textAlign:\"center\",margin:0,marginTop:\"2px\"},successBox:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:\"12px\",padding:\"30px 20px\",textAlign:\"center\",width:\"100%\",boxSizing:\"border-box\"},successIcon:{width:\"56px\",height:\"56px\",borderRadius:\"50%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:\"24px\",fontWeight:\"700\"},successTitle:{color:\"#fff\",fontSize:\"20px\",fontWeight:\"700\",margin:0},successSub:{color:\"#888\",fontSize:\"14px\",margin:0}};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"N8NForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./N8N_Form.map"],"mappings":"iLAGua,SAAwB,EAAQ,CAAC,cAAY,aAAW,eAAa,eAAa,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,GAAG,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAO,GAAWA,EAAS,OAAO,CAAM,CAAC,EAAS,GAAa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