{"version":3,"file":"DemoCarrier.DCl7c5Me.mjs","names":["emailEl","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/8XlvfxfK22xeZ240RVhm/DDDZaLdfO1aA0b2ArtHh/DemoCarrier.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";const WEBHOOK_URL=\"https://services.leadconnectorhq.com/hooks/EWHW6Jc98KikZNSyRfFV/webhook-trigger/20bf4c5f-3b67-454f-8d4a-7b7f3b66dbd1\";function getStr(fd,key){const v=fd.get(key);return v==null?\"\":String(v).trim();}function getRaw(fd,key){const v=fd.get(key);return v==null?\"\":String(v);}export function BookDemoWebhookForm(){return{onSubmitCapture:e=>{const form=e?.currentTarget;if(!form)return;const fd=new FormData(form);const email=getStr(fd,\"Email\");// ✅ Email обязателен\nif(!email){e.preventDefault();e.stopPropagation();e?.nativeEvent?.stopImmediatePropagation?.();const emailEl=form.elements.namedItem(\"Email\");if(emailEl){emailEl.setCustomValidity(\"Email is required.\");emailEl.reportValidity();emailEl.focus();}return;}const emailEl=form.elements.namedItem(\"Email\");if(emailEl)emailEl.setCustomValidity(\"\");const payload={type:\"carrier\",mcNumber:getStr(fd,\"MC number\"),phone:getStr(fd,\"Phone\"),email,name:getStr(fd,\"Name\"),marketingAgree:getRaw(fd,\"Agree to Emails\"),utmSource:localStorage.getItem(\"utm_source\")||\"\",_meta:{ts:new Date().toISOString(),page:window.location.href}};// ✅ улетает с первого раза даже если форма сразу показывает Thank you\nfetch(WEBHOOK_URL,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(payload),keepalive:true}).catch(err=>console.error(\"[Webhook] error:\",err));}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withBookDemoWebhookForm(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...BookDemoWebhookForm(props)});};}withBookDemoWebhookForm.displayName=\"BookDemoWebhookForm\";\nexport const __FramerMetadata__ = {\"exports\":{\"withBookDemoWebhookForm\":{\"type\":\"reactHoc\",\"name\":\"withBookDemoWebhookForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BookDemoWebhookForm\":{\"type\":\"override\",\"name\":\"BookDemoWebhookForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DemoCarrier.map"],"mappings":"4KAAoL,SAAS,EAAO,EAAG,EAAI,CAAC,IAAM,EAAE,EAAG,IAAI,EAAI,CAAC,OAAO,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC,MAAM,CAAE,SAAS,EAAO,EAAG,EAAI,CAAC,IAAM,EAAE,EAAG,IAAI,EAAI,CAAC,OAAO,GAAG,KAAK,GAAG,OAAO,EAAE,CAAE,SAAgB,GAAqB,CAAC,MAAM,CAAC,gBAAgB,GAAG,CAAC,IAAM,EAAK,GAAG,cAAc,GAAG,CAAC,EAAK,OAAO,IAAM,EAAG,IAAI,SAAS,EAAK,CAAO,EAAM,EAAO,EAAG,QAAQ,CACpf,GAAG,CAAC,EAAM,CAAC,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,GAAG,aAAa,4BAA4B,CAAC,IAAMA,EAAQ,EAAK,SAAS,UAAU,QAAQ,CAAIA,IAAS,EAAQ,kBAAkB,qBAAqB,CAAC,EAAQ,gBAAgB,CAAC,EAAQ,OAAO,EAAE,OAAQ,IAAM,EAAQ,EAAK,SAAS,UAAU,QAAQ,CAAI,GAAQ,EAAQ,kBAAkB,GAAG,CAAC,IAAM,EAAQ,CAAC,KAAK,UAAU,SAAS,EAAO,EAAG,YAAY,CAAC,MAAM,EAAO,EAAG,QAAQ,CAAC,QAAM,KAAK,EAAO,EAAG,OAAO,CAAC,eAAe,EAAO,EAAG,kBAAkB,CAAC,UAAU,aAAa,QAAQ,aAAa,EAAE,GAAG,MAAM,CAAC,GA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