{"version":3,"file":"GoogleSheetWaitlistForm.DUtbeRKW.mjs","names":["React.useState","React.useCallback","React.useMemo","React.startTransition"],"sources":["https:/framerusercontent.com/modules/QcsktCQC5K138gHeng5E/uQQYdADiktZ5z9kmbuFy/GoogleSheetWaitlistForm.js"],"sourcesContent":["// Create a compact waitlist signup form for editorial beige/monochrome pages that submits at runtime to a user-provided endpoint URL (e.g., Google Apps Script), exposes controls for endpointUrl/emailFieldName/nameFieldName/buttonText/successText/errorText/placeholderEmail/placeholderName/accentColor/textColor/borderColor/backgroundColor/radius/fontFamily/showNameField, includes optional name + email fields, blocks submission with “Add endpoint URL” when missing, uses no hardcoded spreadsheet URL, and supports loading/success/error states with accessible labels and clean Framer canvas render.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function GoogleSheetWaitlistForm(props){const{endpointUrl,emailFieldName,nameFieldName,buttonText,successText,errorText,placeholderEmail,placeholderName,accentColor,textColor,borderColor,backgroundColor,radius,fontFamily,showNameField}=props;const isStaticRenderer=useIsStaticRenderer();const[email,setEmail]=React.useState(\"\");const[name,setName]=React.useState(\"\");const[status,setStatus]=React.useState(\"idle\");const[message,setMessage]=React.useState(\"\");const hasEndpoint=endpointUrl.trim().length>0;const onSubmit=React.useCallback(async event=>{event.preventDefault();if(!hasEndpoint){React.startTransition(()=>{setStatus(\"error\");setMessage(\"Add endpoint URL in properties to enable submissions.\");});return;}if(isStaticRenderer)return;React.startTransition(()=>{setStatus(\"loading\");setMessage(\"\");});const payload={[emailFieldName]:email.trim()};if(showNameField){payload[nameFieldName]=name.trim();}try{const formBody=new URLSearchParams;Object.entries(payload).forEach(([key,value])=>{formBody.append(key,value);});const response=await fetch(endpointUrl,{method:\"POST\",body:formBody});if(!response.ok){throw new Error(\"Network response was not ok\");}React.startTransition(()=>{setStatus(\"success\");setMessage(successText);setEmail(\"\");setName(\"\");});}catch(_error){React.startTransition(()=>{setStatus(\"error\");setMessage(`${errorText} Check endpoint URL, Google Apps Script deployment access, and CORS settings.`);});}},[email,emailFieldName,endpointUrl,errorText,hasEndpoint,isStaticRenderer,name,nameFieldName,showNameField,successText]);const statusColor=React.useMemo(()=>{if(status===\"success\")return accentColor;if(status===\"error\")return\"#B00020\";return textColor;},[status,accentColor,textColor]);const inputStyle=React.useMemo(()=>({width:\"100%\",boxSizing:\"border-box\",border:`1px solid ${borderColor}`,background:backgroundColor,color:textColor,borderRadius:radius,padding:\"10px 12px\",fontSize:14,lineHeight:\"20px\",fontFamily,outline:\"none\"}),[backgroundColor,borderColor,fontFamily,radius,textColor]);const buttonDisabled=status===\"loading\"||!hasEndpoint;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",minWidth:220,boxSizing:\"border-box\",background:backgroundColor,border:`1px solid ${borderColor}`,borderRadius:radius,padding:10,fontFamily,color:textColor},children:[/*#__PURE__*/_jsx(\"form\",{onSubmit:onSubmit,\"aria-label\":\"Waitlist signup form\",children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"grid\",gap:8},children:[showNameField&&/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"label\",{htmlFor:\"waitlist-name\",style:{position:\"absolute\",left:-9999},children:\"Name\"}),/*#__PURE__*/_jsx(\"input\",{id:\"waitlist-name\",name:nameFieldName,type:\"text\",autoComplete:\"name\",placeholder:placeholderName,value:name,onChange:e=>React.startTransition(()=>{setName(e.target.value);}),style:inputStyle})]}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"label\",{htmlFor:\"waitlist-email\",style:{position:\"absolute\",left:-9999},children:\"Email\"}),/*#__PURE__*/_jsx(\"input\",{id:\"waitlist-email\",name:emailFieldName,type:\"email\",autoComplete:\"email\",required:true,placeholder:placeholderEmail,value:email,onChange:e=>React.startTransition(()=>{setEmail(e.target.value);}),style:inputStyle})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:buttonDisabled,\"aria-busy\":status===\"loading\",style:{width:\"100%\",border:`1px solid ${accentColor}`,background:buttonDisabled?\"#EAEAEA\":accentColor,color:\"#FFFFFF\",borderRadius:radius,padding:\"10px 12px\",fontSize:14,lineHeight:\"20px\",fontFamily,cursor:buttonDisabled?\"not-allowed\":\"pointer\",opacity:status===\"loading\"?.8:1},children:status===\"loading\"?\"Submitting...\":buttonText})]})}),(message||!hasEndpoint)&&/*#__PURE__*/_jsx(\"p\",{role:\"status\",\"aria-live\":\"polite\",style:{margin:\"8px 2px 0\",fontSize:12,lineHeight:\"16px\",color:!hasEndpoint?\"#8A6D3B\":statusColor},children:!hasEndpoint?\"Add endpoint URL in properties to enable submissions.\":message})]});}addPropertyControls(GoogleSheetWaitlistForm,{endpointUrl:{type:ControlType.String,title:\"Endpoint URL\",defaultValue:\"\",placeholder:\"https://script.google.com/...\"},emailFieldName:{type:ControlType.String,title:\"Email Key\",defaultValue:\"email\"},nameFieldName:{type:ControlType.String,title:\"Name Key\",defaultValue:\"name\",hidden:props=>!props.showNameField},buttonText:{type:ControlType.String,title:\"Button\",defaultValue:\"Join Waitlist\"},successText:{type:ControlType.String,title:\"Success Text\",defaultValue:\"Thanks! You’re on the list.\"},errorText:{type:ControlType.String,title:\"Error Text\",defaultValue:\"Something went wrong. Please try again.\"},placeholderEmail:{type:ControlType.String,title:\"Email Placeholder\",defaultValue:\"Email address\"},placeholderName:{type:ControlType.String,title:\"Name Placeholder\",defaultValue:\"Name\",hidden:props=>!props.showNameField},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#EEEEEE\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:10,min:0,max:40,step:1},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Inter, sans-serif\"},showNameField:{type:ControlType.Boolean,title:\"Show Name\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GoogleSheetWaitlistForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GoogleSheetWaitlistForm.map"],"mappings":"8MAIG,SAAwB,EAAwB,EAAM,CAAC,GAAK,CAAC,cAAY,iBAAe,gBAAc,aAAW,cAAY,YAAU,mBAAiB,kBAAgB,cAAY,YAAU,cAAY,kBAAgB,SAAO,aAAW,iBAAe,EAAY,EAAiB,EAAoB,EAAO,CAAC,EAAM,GAAUA,EAAe,EAAE,EAAO,CAAC,EAAK,GAASA,EAAe,EAAE,EAAO,CAAC,EAAO,GAAWA,EAAe,MAAM,EAAO,CAAC,EAAQ,GAAYA,EAAe,EAAE,EAAQ,EAAY,EAAY,KAAK,CAAC,CAAC,OAAO,EAAQ,EAASC,EAAkB,KAAM,IAAO,CAAwB,GAAvB,EAAM,eAAe,EAAK,CAAC,EAAY,CAAC,MAA0B,CAAC,EAAU,OAAO,EAAE,EAAW,uDAAuD,CAAE,CAAC,EAAE,MAAO,CAAC,GAAG,EAAiB,OAAO,MAA0B,CAAC,EAAU,SAAS,EAAE,EAAW,EAAE,CAAE,CAAC,EAAE,IAAM,EAAQ,EAAE,GAAgB,EAAM,KAAK,CAAC,EAAK,IAAe,EAAQ,GAAe,EAAK,KAAK,GAAG,GAAG,CAAC,IAAM,EAAS,IAAI,gBAAoK,GAApJ,OAAO,QAAQ,CAAO,CAAC,CAAC,SAAS,CAAC,EAAI,KAAS,CAAC,EAAS,OAAO,EAAI,CA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