PageSourceSearch

https://www.scientificamerican.com/static/entry/reconsent.DXMOA4md.js

js scientificamerican.com collected 2026-10-01 07:49:50 UTC 4,556 bytes, 1 lines download raw bytes

1import{r as y,j as e}from"../chunks/vendor-react-DdEP1kCQ.js";import{D as j}from"../chunks/DefaultLayout-n0x-WG_8.js";import{v as x,d as l,x as v}from"../chunks/core-DTFOJR-b.js";import"../chunks/vendor-shared-ShLQKC4n.js";import"../chunks/Header-CvZfB-VC.js";import"../chunks/sciam-BnjwuU5W.js";import"../chunks/sciam-DxVNerXk.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new n.Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="86ae59be-e47b-4761-a6e4-7cc2638ceb72",n._sentryDebugIdIdentifier="sentry-dbid-86ae59be-e47b-4761-a6e4-7cc2638ceb72")}catch{}})();const N="page-FLgIM",w="heading-k-lC8",D="intro-ftBVI",B="footnote-LaMO7",C="form-iVnjR",L="choices-ZFdXA",k="choiceButton-EM29M",I="submitButton-iEll8",S="subject-R0Nnr",T="field-OlXPs",E="label-NpjUp",F="legend-2xEUq",R="input-AQFAo",M="fieldset-XTq1D",A="radioLabel-FP5R8",P="success--LKTY",q="error-I0jJs",s={page:N,heading:w,intro:D,footnote:B,form:C,choices:L,choiceButton:k,submitButton:I,subject:S,field:T,label:E,legend:F,input:R,fieldset:M,radioLabel:A,success:P,error:q};function U({email:n,onSuccess:o,className:a}){const[h,p]=y.useState(null),t=x("/platform/api/v2/newsletter/consent/",{method:"POST",headers:{"Content-Type":"application/json"},authMode:"none",immediate:!1,csrf:!0}),u=t.status===200,b=!!t.error||t.status!==null&&t.status!==200,c=i=>{if(t.loading||u)return;const r=i.consent===!0||i.consent==="true";p(r),t.refetch({body:JSON.stringify({email:i.email,consent:r})}).then(()=>o?.(r)).catch(()=>{})},g=i=>{i.preventDefault();const r=new FormData(i.currentTarget),m=String(r.get("email")||"").trim(),f=r.get("consent");!m||!f||c({email:m,consent:f})};if(u)return e.jsx("div",{className:l(s.form,a),role:"status",children:e.jsx("p",{className:s.success,children:h?"Thank you. Your preference has been saved and you will continue receiving emails from us.":"Thank you. Your preference has been saved and you've been unsubscribed from all email."})});const d=b?e.jsxs("p",{className:s.error,role:"alert",children:["We couldn’t save your preference. Please try again, or contact us at"," ",e.jsx("a",{href:"mailto:[email protected]",children:"[email protected]"}),"."]}):null;return n?e.jsxs("div",{className:l(s.form,a),children:[e.jsxs("div",{className:s.choices,children:[e.jsx("button",{type:"button",className:s.choiceButton,disabled:t.loading,onClick:()=>c({email:n,consent:!0}),children:"Continue receiving emails"}),e.jsx("button",{type:"button",className:s.choiceButton,disabled:t.loading,onClick:()=>c({email:n,consent:!1}),children:"Unsubscribe from all emails"})]}),e.jsxs("p",{className:s.subject,children:["Managing preferences for ",n]}),d]}):e.jsxs("form",{className:l(s.form,a),onSubmit:g,children:[e.jsxs("div",{className:s.field,children:[e.jsx("label",{className:s.label,htmlFor:"reconsent-email",children:"Email address"}),e.jsx("input",{className:s.input,type:"email",id:"reconsent-email",name:"email",autoComplete:"email",placeholder:"[email protected]",required:!0})]}),e.jsxs("fieldset",{className:s.fieldset,children:[e.jsx("legend",{className:s.legend,children:"What would you like to do?"}),e.jsxs("label",{className:s.radioLabel,children:[e.jsx("input",{type:"radio",name:"consent",value:"true",required:!0}),"Continue receiving emails"]}),e.jsxs("label",{className:s.radioLabel,children:[e.jsx("input",{type:"radio",name:"consent",value:"false"}),"Unsubscribe from all emails"]})]}),e.jsx("button",{type:"submit",className:s.submitButton,disabled:t.loading,children:t.loading?"Saving…":"Save my preference"}),d]})}function O({email:n=""}){const o=v(),a=n||o.email||null;return e.jsxs("div",{className:s.page,children:[e.jsx("h1",{className:s.heading,children:"Confirm your email preferences"}),e.jsx("p",{className:s.intro,children:"Due to a bunch of legal jargon and a series of funky acronyms, Scientific American needs your confirmation to keep sending you newsletters and other email, we need you to confirm that you still want to hear from us."}),e.jsx("p",{className:s.intro,children:"If you do nothing, we’ll stop emailing you. You can change your mind at any time."}),e.jsx(U,{email:a}),e.jsxs("p",{className:s.footnote,children:["Read our ",e.jsx("a",{href:"/privacy-policy/",children:"privacy policy"})," or contact us at"," ",e.jsx("a",{href:"mailto:[email protected]",children:"[email protected]"})," if you have questions."]})]})}function Q({email:n}){return e.jsx(j,{children:e.jsx(O,{email:n})})}export{Q 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.