PageSourceSearch

https://careerplatform.io/assets/account.email-preferences-BOiFuYUX.js

js careerplatform.io collected 2026-10-02 02:00:45 UTC 7,119 bytes, 1 lines download raw bytes

1import{p as _,ac as C,q as P,r as c,a0 as E,U as O,j as e,Y as R,Z as z,_ as H,P as k,a as j,bd as G,e as Q,f as D,t as N,b as J,L as S}from"./index-P6gp-aZt.js";import{u as W}from"./index-BiqmPxq4.js";import{u as Y}from"./index-m4kp8mBg.js";import{S as K}from"./separator-_vEU4aB-.js";import{M as X}from"./mail-CHAWCWCR.js";const Z=_({method:"GET"}).middleware([C]).handler(P("64fc878680597dde3e06107a0edc260e0bdaa000a24ebd8156844a42c764c504")),$=_({method:"POST"}).middleware([C]).handler(P("8d63c4585de86053eb1ccee991b7c4a2cddf9bcbb901fb664c418564f9f95294"));var g="Switch",[V]=H(g),[ee,se]=V(g),T=c.forwardRef((i,l)=>{const{__scopeSwitch:a,name:r,checked:d,defaultChecked:t,required:n,disabled:o,value:p="on",onCheckedChange:b,form:s,...m}=i,[u,f]=c.useState(null),y=E(l,x=>f(x)),w=c.useRef(!1),v=u?s||!!u.closest("form"):!0,[h,q]=O({prop:d,defaultProp:t??!1,onChange:b,caller:g});return e.jsxs(ee,{scope:a,checked:h,disabled:o,children:[e.jsx(R.button,{type:"button",role:"switch","aria-checked":h,"aria-required":n,"data-state":I(h),"data-disabled":o?"":void 0,disabled:o,value:p,...m,ref:y,onClick:z(i.onClick,x=>{q(B=>!B),v&&(w.current=x.isPropagationStopped(),w.current||x.stopPropagation())})}),v&&e.jsx(A,{control:u,bubbles:!w.current,name:r,value:p,checked:h,required:n,disabled:o,form:s,style:{transform:"translateX(-100%)"}})]})});T.displayName=g;var M="SwitchThumb",F=c.forwardRef((i,l)=>{const{__scopeSwitch:a,...r}=i,d=se(M,a);return e.jsx(R.span,{"data-state":I(d.checked),"data-disabled":d.disabled?"":void 0,...r,ref:l})});F.displayName=M;var te="SwitchBubbleInput",A=c.forwardRef(({__scopeSwitch:i,control:l,checked:a,bubbles:r=!0,...d},t)=>{const n=c.useRef(null),o=E(n,t),p=W(a),b=Y(l);return c.useEffect(()=>{const s=n.current;if(!s)return;const m=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(m,"checked").set;if(p!==a&&f){const y=new Event("click",{bubbles:r});f.call(s,a),s.dispatchEvent(y)}},[p,a,r]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...d,tabIndex:-1,ref:o,style:{...d.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});A.displayName=te;function I(i){return i?"checked":"unchecked"}var L=T,ae=F;const U=c.forwardRef(({className:i,...l},a)=>e.jsx(L,{className:k("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",i),...l,ref:a,children:e.jsx(ae,{className:k("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));U.displayName=L.displayName;const re=[{key:"product_updates",label:"Product updates",description:"Occasional news about new features and improvements."},{key:"re_engagement",label:"Re-engagement",description:"Friendly nudges when you haven't used the app in a while."},{key:"tips_and_guidance",label:"Tips and guidance",description:"Job search tips and best practices for using each tool."},{key:"followup_nudges",label:"Follow-up reminders",description:"Email reminders 2 days before a scheduled follow-up date for your Tracker contacts."},{key:"job_nudges",label:"Job application nudges",description:"Reminders about jobs sitting in your Saved column so you don't lose track of them."},{key:"credit_alerts",label:"Credit and plan alerts",description:"Reminders when your credits are expiring. We recommend keeping these on."}];function de(){const i=j(Z),l=j($),a=G(),{data:r,isLoading:d}=Q({queryKey:["email-preferences"],queryFn:()=>i()}),[t,n]=c.useState(null);c.useEffect(()=>{r&&n(r)},[r]);const o=D({mutationFn:s=>l({data:s}),onSuccess:s=>{n(s),a.setQueryData(["email-preferences"],s)},onError:s=>{N.error(s instanceof Error?s.message:"Failed to update preferences"),r&&n(r)}}),p=(s,m)=>{if(!t)return;const u={...t,[s]:m};n(u),o.mutate({[s]:m})},b=()=>{if(!t)return;const s={product_updates:!1,re_engagement:!1,tips_and_guidance:!1,credit_alerts:!1,followup_nudges:!1,job_nudges:!1,unsubscribed_all:!0};n(s),o.mutate(s),N.success("Unsubscribed from all marketing emails")};return e.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 pt-4 pb-10 max-w-3xl mx-auto",children:[e.jsxs("header",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-muted-foreground text-sm",children:[e.jsx(X,{className:"size-4"}),e.jsx("span",{children:"Account"})]}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold tracking-tight text-foreground",style:{fontFamily:"'Space Grotesk', Inter, sans-serif",letterSpacing:"-0.02em"},children:"Email preferences"}),e.jsx("p",{className:"mt-2 text-sm md:text-base text-muted-foreground max-w-2xl",children:"Choose which emails you'd like to receive from CareerPlatform. You can change these at any time. Account and security emails (sign-in codes, receipts, password resets) are always sent."})]}),d||!t?e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-card p-6 flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(J,{className:"size-4 animate-spin"})," Loading your preferences…"]}):e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-card p-2 sm:p-4",children:[e.jsx("ul",{className:"divide-y divide-slate-200",children:re.map(s=>{const m=!t.unsubscribed_all&&t[s.key];return e.jsxs("li",{className:"flex items-start justify-between gap-4 p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description})]}),e.jsx(U,{checked:m,disabled:o.isPending,onCheckedChange:u=>{if(t.unsubscribed_all&&u){const f={...t,unsubscribed_all:!1,[s.
1key]:!0};n(f),o.mutate({unsubscribed_all:!1,[s.key]:!0})}else p(s.key,u)},"aria-label":s.label})]},s.key)})}),e.jsx(K,{className:"my-2"}),e.jsxs("div",{className:"p-4 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Unsubscribe from all marketing emails"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Turns off every category above. Account and security emails will still be sent."})]}),e.jsx("button",{type:"button",onClick:b,disabled:o.isPending||t.unsubscribed_all,className:"text-sm font-semibold text-destructive hover:underline disabled:opacity-50 disabled:no-underline whitespace-nowrap",children:t.unsubscribed_all?"Unsubscribed":"Unsubscribe all"})]})]}),e.jsxs("p",{className:"mt-6 text-xs text-muted-foreground",children:["Need to update something else?"," ",e.jsx(S,{to:"/profile",className:"text-primary hover:underline",children:"Manage your profile"})," · ",e.jsx(S,{to:"/privacy",className:"text-primary hover:underline",children:"Read our privacy policy"})]})]})}export{de 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.