1import{r as x,j as e}from"../chunks/vendor-react-DdEP1kCQ.js";import{D as g}from"../chunks/DefaultLayout-B4mESSua.js";import{v as f,j as m,k as y}from"../chunks/core-Bpuic6mr.js";import{s as b}from"../chunks/style.module-CJb7qyJt.js";import"../chunks/Header-DuP3RNUx.js";import"../chunks/sciam-B_IQ-Vo8.js";import"../chunks/sciam-CvuG93yt.js";import"../chunks/vendor-shared-ShLQKC4n.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new r.Error().stack;l&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[l]="23b220f8-ffa4-4dac-9bbc-2b19fe227aef",r._sentryDebugIdIdentifier="sentry-dbid-23b220f8-ffa4-4dac-9bbc-2b19fe227aef")}catch{}})();function w(){const r=x.useRef(null),{refetch:l,data:s,loading:n,error:o}=f("/api/email-collector/",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},authMode:"prefer",csrf:!0}),{deliverability:j,...i}=s||{},d=m();x.useEffect(()=>{console.log("cmp",d)},[d]);const{isLoggedIn:c,user:h,register:u}=y();return e.jsxs("form",{style:{display:"flex",flexFlow:"column",gap:"0.5rem",maxWidth:480,margin:"auto"},onSubmit:t=>{t.preventDefault();const p=new URLSearchParams(new FormData(t.target));l({body:p})},children:[e.jsx("h2",{children:"Newsletter Signup"}),e.jsx("input",{ref:r,style:{padding:"0.5rem",border:"1px solid #ccc",borderRadius:4},name:"email",type:"email",placeholder:"Enter your email","data-1p-ignore":!0}),e.jsx("button",{type:"submit",disabled:n,children:n?"Submitting...":"Subscribe"}),!n&&(!!o||i&&"error"in i)&&e.jsxs("small",{style:{color:"var(--color-red)"},children:["Something went wrong, please try again.",e.jsx("br",{}),"Error: ",o?.message||i?.error||"¯\\_(ã)_/¯"]}),s?.action==="suggest"&&e.jsxs("small",{style:{color:"var(--color-red)"},children:["Did you mean:"," ",e.jsx("a",{href:"#",onClick:t=>{t.preventDefault(),r.current.value=s.suggestion,l({body:new URLSearchParams({email:s.suggestion})})},children:s.suggestion}),"?",e.jsx("br",{}),e.jsx("a",{href:"#",onClick:t=>{t.preventDefault(),l({body:new URLSearchParams({email:r.current.value,ignore_suggestion:"1"})})},children:"Ignore suggestion"})]}),s?.action==="soft-reject"&&e.jsxs(e.Fragment,{children:[e.jsxs("small",{style:{color:"var(--color-gold-dark-2)"},children:["We couldn't verify your email address.",c&&e.jsxs(e.Fragment,{children:["Try signing up with"," ",e.jsx("a",{href:"#",onClick:t=>{t.preventDefault(),r.current.value=h.email,l({body:new URLSearchParams({email:h.email})})},children:"your account's email instead"}),"?"]}),!c&&e.jsxs(e.Fragment,{children:[" ","You may still sign up for newsletters by"," ",e.jsx("a",{href:"/register/?returnTo=/newsletters/",onClick:t=>{t.preventDefault(),u()},children:"registering a new account"}),"."]})]}),e.jsxs("p",{children:[e.jsx("strong",{children:"NOTE:"})," In an article, we'd pull the paywall down for the user. On the homepage, we'd show a warning like this."]})]}),s?.action==="reject"&&e.jsx("small",{style:{color:"var(--color-red)"},children:s.message}),s?.action==="success"&&e.jsx("small",{style:{color:"var(--color-green)"},children:s.message}),e.jsx("hr",{style:{margin:"1rem 0"}}),e.jsx("h3",{children:"Examples"}),e.jsxs("div",{style:{fontSize:"0.8rem",color:"#666",textAlign:"left"},children:[e.jsxs("details",{children:[e.jsx("summary",{style:{cursor:"pointer"},children:"Short circuit test cases"}),e.jsx("p",{style:{margin:"0.25rem 0"},children:"These patterns don't call Emailable or push to Klaviyo"}),e.jsxs("table",{style:{width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Email"}),e.jsx("th",{children:"Description"}),e.jsx("th",{children:"Expected behavior"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"****@beep.boop"}),e.jsx("td",{children:"Bot/spam"}),e.jsx("td",{children:"Pretend to succeed"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"****@woof.woof"}),e.jsx("td",{children:"Risky/suspicious"}),e.jsx("td",{children:"Force registration flow"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"****@meow.meow"}),e.jsx("td",{children:"Likely valid"}),e.jsx("td",{children:"Success"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"****@sciam.co"}),e.jsx("td",{children:"Common typo"}),e.jsx("td",{children:"Suggest a correction"})]})]})]})]}),e.jsx("br",{}),e.jsxs("details",{children:[e.jsx("summary",{style:{cursor:"pointer"},children:"Emailable integration test cases"}),e.jsxs("p",{style:{margin:"0.25rem 0"},children:["These are"," ",e.jsx("a",{href:"https://emailable.com/docs/api/#test-email-addresses",rel:"noopener noreferrer",target:"_blank",children:"official Emailable test addresses"}),". They will not push to Klaviyo."]}),e.jsxs("table",{style:{width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Email"}),e.jsx("th",{children:"Description"}),e.jsx("th",{children:"Expected behavior"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Deliverable"}),e.jsx("td",{children:"Successful signup"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Undeliverable"}),e.jsx("td",{children:"Pretend to succeed"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Risky"}),e.jsx("td",{children:"Force registration flow"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Unknown verification state"}),e.jsx("td",{children:"tbd - currently reg flow"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Role or group email"}),e.jsx("td",{children:"Random"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Free email service"}),e.jsx("td",{children:"Random"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Mail server accepts all emails"}),e.jsx("td",{children:"Random"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Disposable email address"}),e.jsx("td",{children:"Force registration flow"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"[email protected]"}),e.jsx("td",{children:"Force a 249 status code"}),e.jsx("td",{children:"Try again message"})]})]})]})]})]}),e.jsx("hr",{style:{margin:"1rem 0"}}),e.jsx("h3",{children:"Email Collector Output"}),e.jsx(a,{data:{apiLoading:n,responseData:i}}),e.jsx("h4",{children:"Deliverability Output"}),e.jsx(a,{data:j}),e.jsx("hr",{style:{margin:"1rem 0"}}),e.jsx("h3",{children:"Consent State"}),e.jsx(a,{data:d}),e.jsx(v,{})]})}function v({}){const{consentError:r,showConsentUi:l}=m();return e.jsx("button",{type:"button",onClick:l,disabled:!!r,children:r?"Cannot manage consent":"Manage consent"})}const a=({data:r})=>e.jsx("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word",textAlign:"left"},children:JSON.stringify(r,null,2)});function I({body:r=""}){return e.jsx(g,{children:e.jsx("div",{className:b.playground,children:e.jsx("div",{style:{width:"100%",maxWidth:"none",minHeight:"500px",textAlign:"center"},children:e.jsx(w,{})})})})}export{I as default};
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.