PageSourceSearch

https://joinoriginhouse.com/assets/prefs._token-rkAZkmxs.js

js joinoriginhouse.com collected 2026-10-04 20:23:58 UTC 5,401 bytes, 1 lines download raw bytes

1import{be as O,b as g,Y as T,r as o,j as e,_ as y,L as j,t as C}from"./index-BuCKDUqr.js";import{u as I}from"./useMutation-CFzAp9Yr.js";import{g as L,s as R}from"./subscribers.functions-DmF_N1e3.js";const v=[{id:"founder",label:"Founder or building something"},{id:"investor",label:"Investor"},{id:"operator",label:"Operator or builder"},{id:"community",label:"Community member"},{id:"partner",label:"Partner or sponsor"},{id:"student",label:"Student"},{id:"press",label:"Press or media"}],N=[{id:"newsletter",label:"The newsletter",blurb:"The monthly note about what the house is up to."},{id:"events",label:"Events and invites",blurb:"Dinners, T16, the summit, open houses."},{id:"programs",label:"Programs and deadlines",blurb:"Origin Pitch, Entrepreneur of the Year, Originals."},{id:"product",label:"The O",blurb:"Product news for the member portal."},{id:"investor",label:"Investor and partner notes",blurb:"Less frequent, more strategic."}],Y=N.map(t=>t.id);v.map(t=>t.id);const q=t=>C().uuid().safeParse(t).success;function B(){const{token:t}=O.useParams(),m=q(t),k=g(L),w=g(R),r=T({queryKey:["prefs",t],queryFn:()=>k({data:{token:t}}),enabled:m}),[l,x]=o.useState([]),[i,h]=o.useState([]),[b,S]=o.useState(!1),[p,P]=o.useState(!1);o.useEffect(()=>{r.data?.found&&!b&&(x(r.data.roles),h(r.data.optOuts),S(!0))},[r.data,b]);const a=I({mutationFn:()=>w({data:{token:t,roles:l,optOuts:i,resubscribe:p}})}),f=(s,n,u)=>n(s.includes(u)?s.filter(E=>E!==u):[...s,u]),c=Y.every(s=>i.includes(s));return!m||r.isError||r.data&&!r.data.found?e.jsx(d,{children:e.jsx("p",{className:"mt-4 text-sm text-foreground/60",children:"This link is no longer valid."})}):r.isLoading||!r.data?e.jsx(d,{children:e.jsxs("div",{"aria-busy":"true",className:"mt-8 space-y-3",children:[e.jsx("span",{className:"sr-only",children:"Loading"}),e.jsx(y,{size:"body",w:"100%"}),e.jsx(y,{size:"body",w:"70%"})]})}):a.isSuccess?e.jsxs(d,{children:[e.jsx("p",{className:"mt-4 text-sm text-foreground/70",children:a.data?.status==="bounced"||a.data?.status==="complained"?"Your interests are saved. Emails to this address stay paused, so nothing will be sent.":a.data?.unsubscribed?"Saved. You are unsubscribed, so we will not email you.":"Saved. This takes effect on the next send."}),e.jsx(j,{to:"/",className:"mt-8 inline-flex text-sm underline underline-offset-4 hover:opacity-70",children:"Back to Origin House"})]}):e.jsxs(d,{children:[e.jsx("p",{className:"mt-3 text-sm text-foreground/60",children:r.data.email}),e.jsx("p",{className:"mt-6 text-sm leading-relaxed text-foreground/70",children:"Tell us who you are and what is worth your inbox. We would rather send you less of the right thing than lose you entirely."}),e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{className:"text-sm font-medium tracking-tight",children:"I am"}),e.jsx("p",{className:"mt-1 text-xs text-foreground/55",children:"Pick any that fit."}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:v.map(s=>{const n=l.includes(s.id);return e.jsx("button",{type:"button","aria-pressed":n,onClick:()=>f(l,x,s.id),className:`rounded-full border px-3.5 py-1.5 text-sm transition-colors ${n?"border-foreground bg-foreground text-background":"border-foreground
1/20 hover:bg-foreground/5"}`,children:s.label},s.id)})})]}),e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{className:"text-sm font-medium tracking-tight",children:"Send me"}),e.jsx("div",{className:"mt-4 divide-y divide-foreground/10 border-y border-foreground/10",children:N.map(s=>{const n=!i.includes(s.id);return e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 py-4 text-sm",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:()=>f(i,h,s.id),className:"mt-0.5 h-4 w-4 accent-foreground"}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:s.label}),e.jsx("span",{className:"mt-0.5 block text-foreground/55",children:s.blurb})]})]},s.id)})}),r.data.status==="unsubscribed"&&!c&&e.jsxs("label",{className:"mt-4 flex cursor-pointer items-start gap-3 text-sm",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:s=>P(s.target.checked),className:"mt-0.5 h-4 w-4 accent-foreground"}),e.jsx("span",{children:"You are currently unsubscribed. Resubscribe me to the topics above."})]}),(r.data.status==="bounced"||r.data.status==="complained")&&e.jsx("p",{className:"mt-3 text-xs text-foreground/55",children:"Emails to this address are paused. Saving your interests will not restart them."}),c&&e.jsx("p",{className:"mt-3 text-xs text-foreground/55",children:"Everything is switched off, so saving will unsubscribe you completely."})]}),e.jsxs("div",{className:"mt-8 flex flex-wrap items-center gap-4",children:[e.jsx("button",{type:"button",disabled:a.isPending,onClick:()=>a.mutate(),className:"rounded-md bg-foreground px-5 py-2.5 text-sm text-background transition-opacity hover:opacity-90 disabled:opacity-50",children:a.isPending?"Saving.":c?"Unsubscribe from everything":"Save preferences"}),e.jsx(j,{to:"/u/$token",params:{token:t},className:"text-sm text-foreground/60 underline underline-offset-4 hover:text-foreground",children:"Unsubscribe from everything"})]})]})}function d({children:t}){return e.jsxs("main",{className:"mx-auto min-h-screen max-w-lg px-6 py-20",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Email preferences"}),t]})}export{B as component};

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.