{"version":3,"file":"SubscribeFormRedirect.CXfP8OYx.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/Zoi7B1ivdQbG6KiCTRBf/ubo9DeZPs3OtmLDiV5vF/SubscribeFormRedirect.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";/**\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function SubscribeInput(props){const{placeholderText,font,color}=props;const[email,setEmail]=useState(\"\");const[error,setError]=useState(\"\");const[isLoading,setIsLoading]=useState(false);const emailRegex=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/// basic email regex\n;// Load Default SDK\nuseEffect(()=>{const script=document.createElement(\"script\");script.src=\"https://import-cdn.default.com/sdk.js\";script.async=true;document.head.appendChild(script);return()=>{const existing=document.querySelector('script[src=\"https://import-cdn.default.com/sdk.js\"]');if(existing)existing.remove();};},[]);const handleSubscribe=()=>{if(email.trim()===\"\"){setError(\"Email is required\");return;}if(!emailRegex.test(email)){setError(\"Please enter a valid email\");return;}setError(\"\");setIsLoading(true);if(!window.DefaultSDK){console.error(\"Default SDK not loaded\");setIsLoading(false);return;}const submission={form_id:905899,team_id:193,responses:{email:email},questions:[{id:\"email\",name:\"Email\",type:\"email\"}]};// Submit email to Default SDK\nwindow.DefaultSDK.submit(submission,{onSuccess:()=>{console.log(\"Email submitted successfully\");// Redirect to schedule page with email as query param\nwindow.location.href=`/schedule-a-demo?email=${encodeURIComponent(email)}`;},onError:err=>{setIsLoading(false);console.error(\"Submission failed\",err);setError(\"Submission failed. Please try again.\");}});};const handleKeyPress=e=>{if(e.key===\"Enter\"){handleSubscribe();}};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n            .subscribe-container {\n              display: flex;\n              align-items: center;\n              border: 1px solid #ddd;\n              border-radius: 8px;\n              overflow: hidden;\n              width: 100%;\n              background: #fff;\n              position: relative;\n              height: 62px;\n              padding-right: 160px;\n            }\n\n            .subscribe-container.error {\n              border-color: red;\n            }\n\n            .subscribe-input {\n              flex: 1;\n              border: none;\n              outline: none;\n              padding: 14px 16px;\n              font-size: 16px;\n              color: ${color};\n              font-family: ${font?.fontFamily};\n              font-weight: 500;\n            }\n\n            .subscribe-input:focus {\n              outline: none;\n              background-color: transparent;\n              box-shadow: none;\n            }\n\n            .subscribe-input:-webkit-autofill {\n              -webkit-box-shadow: 0 0 0 1000px #fff inset !important;\n              -webkit-text-fill-color: #2d3e3f !important;\n              transition: background-color 5000s ease-in-out 0s;\n            }\n\n            .subscribe-button {\n              background-color: #e7fc7f;\n              border: none;\n              outline: none;\n              padding: 2px 14px;\n              cursor: pointer;\n              font-size: 16px;\n              font-weight: 600;\n              color: ${color};\n              border-radius: 10px;\n              font-family: ${font?.fontFamily};\n              position: absolute;\n              right: 12px;\n              top: 9px;\n              bottom: 9px;\n              left: auto;\n              width: fit-content;\n            }\n\n            .subscribe-button:hover {\n              opacity: 0.9;\n            }\n\n            .error-message {\n              position: absolute;\n              bottom: -20px;\n              left: 16px;\n              font-size: 12px;\n              color: red;\n            }\n\n            @media (max-width: 600px) {\n              .subscribe-container {\n                width: 100%;\n              }\n\n              .subscribe-button {\n                padding: 12px 16px;\n                font-size: 14px;\n              }\n            }\n            `}),/*#__PURE__*/_jsxs(\"div\",{className:`subscribe-container ${error?\"error\":\"\"}`,children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",placeholder:placeholderText,value:email,onChange:e=>{setEmail(e.target.value);if(error)setError(\"\");},onKeyPress:handleKeyPress,className:\"subscribe-input\",disabled:isLoading}),/*#__PURE__*/_jsx(\"button\",{onClick:handleSubscribe,className:\"subscribe-button\",disabled:isLoading,children:isLoading?\"Submitting...\":\"See a demo\"}),error&&/*#__PURE__*/_jsx(\"div\",{className:\"error-message\",children:error})]})]});}addPropertyControls(SubscribeInput,{placeholderText:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Email address\"},font:{type:ControlType.Font,controls:\"extended\"},color:{type:ControlType.Color,defaultValue:\"#000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SubscribeInput\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SubscribeFormRedirect.map"],"mappings":"6MAIG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,kBAAgB,OAAK,SAAO,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAW,6BAE9N,MAAc,CAAC,IAAM,EAAO,SAAS,cAAc,SAAS,CAAwG,MAAvG,GAAO,IAAI,wCAAwC,EAAO,MAAM,GAAK,SAAS,KAAK,YAAY,EAAO,KAAW,CAAC,IAAM,EAAS,SAAS,cAAc,sDAAsD,CAAI,GAAS,EAAS,QAAQ,GAAK,EAAE,CAAC,CAAC,IAAM,MAAoB,CAAC,GAAG,EAAM,MAAM,GAAG,GAAG,CAAC,EAAS,oBAAoB,CAAC,OAAQ,GAAG,CAAC,EAAW,KAAK,EAAM,CAAC,CAAC,EAAS,6BAA6B,CAAC,OAAwC,GAAhC,EAAS,GAAG,CAAC,EAAa,GAAK,CAAI,CAAC,EAAO,WAAW,CAAC,QAAQ,MAAM,yBAAyB,CAAC,EAAa,GAAM,CAAC,OAAQ,IAAM,EAAW,CAAC,QAAQ,OAAO,QAAQ,IAAI,UAAU,CAAO,QAAM,CAAC,UAAU,CAAC,CAAC,GAAG,QAAQ,KAAK,QAAQ,KAAK,QAAQ,CAAC,CAAC,CACvsB,EAAO,WAAW,OAAO,EAAW,CAAC,cAAc,CA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