PageSourceSearch

https://www.asgardhire.ai/assets/notification-preferences.lazy-BYhJ_yoV.js

js asgardhire.ai collected 2026-09-24 14:29:33 UTC 8,994 bytes, 6 lines download raw bytes

1import{m as w,r as p,j as e,T as k,at as C,L as S,a6 as _,_ as d,B as P,S as z,bf as B,c as E}from"./index-BsFCnAyK.js";import{c as $,d as L,C as T}from"./CandidateNavbar-DafeAjAM.js";import{P as A}from"./PublicFooter-CmBMeQSX.js";import{S as I}from"./skeleton-DOGRXAmf.js";import{S as M}from"./shield-check-uI1TIxUm.js";import{B as R}from"./bell-D5Dez9VA.js";import{B as U}from"./bell-ring-Vp4UnJRz.js";import"./formatDistanceToNow-CDssafZe.js";import"./en-US-BZ0UpF_e.js";import"./exploreJobsEntry-CCJglOjx.js";/**
2 * @license lucide-react v0.344.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const q=w("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);function F(t){if(t.category)return t.category;const r=`${t.campaign} ${t.label} ${t.description}`.toLowerCase();return/interview|screening|assessment/.test(r)?"interviews":/application|auto.?apply|applied|shortlist|recruiter/.test(r)?"applications":/job|search|match|recommend|role|vacancy/.test(r)?"job_discovery":"career_support"}const V={interviews:{title:"Interviews",description:"Reminders and updates that help you attend and complete interviews.",icon:U,tone:"bg-accent text-primary"}
6,applications:{title:"Applications and auto-apply",description:"Immediate in-app progress updates and one activity-only daily email summary.",icon:P,tone:"bg-info/20 text-info"},job_discovery:{title:"Jobs and search alerts",description:"New matches and recommendations based on your job-search activity.",icon:z,tone:"bg-success/20 text-success"},career_support:{title:"CV and career support",description:"Useful product guidance, CV support and optional career tips.",icon:B,tone:"bg-warning/20 text-warning"}};function D({pref:t,onToggle:r,isPending:l}){return e.jsxs("div",{className:"flex items-start justify-between gap-4 py-4 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:t.label}),t.subscribed&&e.jsx("span",{className:"rounded-full bg-success/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-success",children:"On"})]}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t.description}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[t.channels?.map(o=>e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-bold text-muted-foreground",children:o==="in_app"?"In-app":"Email"},o)),t.frequency&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-bold capitalize text-muted-foreground",children:t.frequency==="per_search"?"Daily or weekly per search":t.frequency}),t.essential&&e.jsx("span",{className:"rounded-full bg-info/10 px-2 py-0.5 text-[10px] font-bold text-info",children:"Essential"})]})]}),t.can_disable!==!1&&!t.essential?e.jsx(_,{checked:t.subscribed,onCheckedChange:o=>r(t,o),disabled:l,"aria-label":`Toggle ${t.label}`}):e.jsx("span",{className:"shrink-0 rounded-lg bg-muted px-2.5 py-1.5 text-[10px] font-bold text-muted-foreground",children:"Always on"})]})}function O(){const{data:t,isLoading:r,isError:l,refetch:o}=$(),u=L(),[y,h]=p.useState(()=>new Set),[m,f]=p.useState(!1),j=p.useMemo(()=>{const s=new Map;return t?.forEach(n=>{const a=F(n);s.set(a,[...s.get(a)??[],n])}),s},[t]),c=t?.filter(s=>s.can_disable!==!1&&!s.essential)??[],b=c.filter(s=>s.subscribed).length,g=!!c.length&&b===c.length,N=async(s,n)=>{h(a=>new Set(a).add(s.campaign));try{await u.mutateAsync({campaign:s.campaign,subscribed:n}),d.success(n?`${s.label} enabled`:`${s.label} paused`)}catch{d.error("Couldn't update your preference. Please try again.")}finally{h(a=>{const i=new Set(a);return i.delete(s.campaign),i})}},v=async s=>{const n=c.filter(i=>i.subscribed!==s);if(!n.length)return;f(!0);let a=0;for(const i of n)try{await u.mutateAsync({campaign:i.campaign,subscribed:s})}catch{a+=1}f(!1),a?d.error(`${a} preference${a===1?"":"s"} could not be updated.`):d.success(s?"All optional notifications enabled":"Optional notifications paused")};return e.jsxs("div",{className:"min-h-screen flex flex-col bg-muted/50 font-funnel",children:[e.jsx(T,{}),e.jsxs("main",{className:"mx-auto w-full max-w-4xl flex-1 px-4 py-6 sm:px-6 sm:py-8 lg:px-8",children:[e.jsxs("header",{className:"flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.16em] text-primary",children:"Stay informed, not overwhelmed"}),e.jsx("h1",{className:"mt-1 text-2xl font-medium tracking-[-0.045em] text-foreground sm:text-3xl",children:"Notification preferences"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm text-muted-foreground",children:"Choose which optional emails and in-app alerts you receive. Changes save immediately."})]}),!r&&!l&&t&&t.length>0&&e.jsxs("button",{type:"button",onClick:()=>v(!g),disabled:m,className:"inline-flex w-fit items-center gap-2 rounded-xl border border-muted-foreground/40 bg-card px-4 py-2.5 text-xs font-bold text-muted-foreground hover:border-primary/30 hover:text-primary disabled:opacity-50",children:[m?e.jsx(k,{size:16,variant:"current",spin:!0,title:""}):e.jsx(q,{size:14}),g?"Pause optional notifications":"Enable all optional notifications"]})]}),e.jsxs("section",{className:"mt-6 flex items-start gap-3 rounded-2xl border border-success/40 bg-success/10 p-5",children:[e.jsx(M,{size:21,className:"mt-0.5 shrink-0 text-success"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold text-success",children:"Essential messages always reach you"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-success",children:"Security, privacy and critical account emails are not controlled here. Interview and application emails below can be adju
6sted individually."})]})]}),r?e.jsx("div",{className:"mt-6 space-y-4",children:Array.from({length:3}).map((s,n)=>e.jsx(I,{className:"h-40 w-full rounded-2xl"},n))}):l?e.jsxs("div",{className:"mt-6 rounded-2xl border border-destructive/40 bg-card px-6 py-12 text-center shadow-sm",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"We couldn't load your notification preferences"}),e.jsx("button",{type:"button",onClick:()=>o(),className:"mt-3 text-xs font-bold text-primary hover:underline",children:"Try again"})]}):t?.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-6 flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3",children:[e.jsxs("p",{className:"text-xs font-semibold text-muted-foreground",children:[e.jsx("span",{className:"font-bold text-foreground",children:b})," of ",c.length," optional notification types enabled"]}),e.jsx(C,{size:17,className:"text-success"})]}),e.jsx("div",{className:"mt-4 space-y-4",children:["interviews","applications","job_discovery","career_support"].map(s=>{const n=j.get(s);if(!n?.length)return null;const a=V[s],i=a.icon;return e.jsxs("section",{className:"rounded-2xl border border-border bg-card p-5 shadow-sm sm:p-6",children:[e.jsxs("div",{className:"flex items-start gap-3 border-b border-border/50 pb-4",children:[e.jsx("span",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl ${a.tone}`,children:e.jsx(i,{size:19})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-foreground",children:a.title}),e.jsx("p",{className:"mt-0.5 text-xs leading-5 text-muted-foreground",children:a.description})]})]}),e.jsx("div",{className:"divide-y divide-border/50 pt-4",children:n.map(x=>e.jsx(D,{pref:x,onToggle:N,isPending:m||y.has(x.campaign)},x.campaign))})]},s)})})]}):e.jsxs("div",{className:"mt-6 rounded-2xl border border-border bg-card px-6 py-12 text-center shadow-sm",children:[e.jsx(R,{size:25,className:"mx-auto text-muted-foreground/60"}),e.jsx("p",{className:"mt-3 text-sm font-bold text-foreground",children:"No optional notification preferences yet"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Your essential account emails will continue normally."})]}),e.jsxs("section",{className:"mt-6 flex flex-col gap-3 rounded-2xl border border-primary/40 bg-accent/60 p-5 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold text-foreground",children:"Control alerts for each saved search"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"Choose exactly which searches should email you when matching jobs appear."})]}),e.jsx(S,{to:"/saved-searches",className:"shrink-0 text-xs font-bold text-primary hover:underline",children:"Manage saved-search alerts"})]})]}),e.jsx(A,{})]})}const te=E("/_candidate/notification-preferences")({component:O});export{te as Route};

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.