PageSourceSearch

https://motion.dev/assets/NewsletterForm-CEaUXySA.js

js motion.dev collected 2026-09-24 17:12:47 UTC 2,522 bytes, 1 lines download raw bytes

1import{r as l,j as s}from"./chunk-6CSD65Y2-C0TiM0T8.js";import{m as p}from"./react-Dja6yQfE.js";import{t as u}from"./analytics-JRE8brIE.js";import{A as d}from"./index-D8fEzXeu.js";const g={duration:.45,ease:[.25,0,0,1]};function v({endpoint:f="https://api.motion.dev/waitlist",source:i,placeholder:b="[email protected]"}){const[n,h]=l.useState(""),[e,r]=l.useState("idle"),[x,o]=l.useState("");async function j(c){if(c.preventDefault(),!(!n||e==="submitting"||e==="success")){r("submitting"),o("");try{const a=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i?{email:n,source:i}:{email:n})});if(!a.ok){const N=await a.json().catch(()=>({}));throw new Error(N.error||"Something went wrong")}r("success"),u("Newsletter Subscribe"),i&&u(`Newsletter Subscribe: ${i}`)}catch(a){r("error"),o(a instanceof Error?a.message:"Something went wrong")}}}const t=e==="submitting",y=e==="idle"||e==="error",m=e==="success"?"success":t?"submitting":"idle";return s.jsxs(s.Fragment,{children:[s.jsxs("form",{className:"fnl-form",onSubmit:j,children:[s.jsx(d,{mode:"popLayout",initial:!1,children:y&&s.jsx(p.label,{className:"fnl-input-wrap",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:s.jsx("input",{type:"email",name:"email",required:!0,placeholder:b,"aria-label":"Email address",value:n,onChange:c=>h(c.target.value),className:"fnl-input",disabled:t})},"input")}),s.jsxs("button",{type:"submit",className:`btn-caps-stripe btn-caps-stripe-primary fnl-submit${t?" is-busy":""}${e==="success"?" is-success":""}`,disabled:t||e==="success",children:[s.jsx("span",{className:"fnl-cap fnl-cap-tl"}),s.jsx("span",{className:"fnl-cap fnl-cap-tr"}),s.jsx("span",{className:"fnl-cap fnl-cap-bl"}),s.jsx("span",{className:"fnl-cap fnl-cap-br"}),s.jsx("span",{className:"fnl-submit-text-wrap",children:s.jsx(d,{mode:"popLayout",initial:!1,children:s.jsx(p.span,{layout:"position",layoutDependency:m,className:"fnl-submit-text",initial:{clipPath:"inset(0 100% 0 0)"},animate:{clipPath:"inset(0 0% 0 0%)"},exit:{clipPath:"inset(0 0 0 100%)"},transition:g,children:e==="success"?s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:"fnl-tick",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M20 6 9 17l-5-5"})}),"Subscribed"]}):t?"Subscribing":"Subscribe"},m)})})]})]}),e==="error"&&s.jsx("p",{className:"fnl-error",children:x})]})}export{v as N};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.