PageSourceSearch

https://savvskout.com/assets/Settings-CS5Y7mNl.js

js savvskout.com collected 2026-10-02 01:42:55 UTC 35,338 bytes, 6 lines download raw bytes

1import{k as Ge,r as i,d,j as e,C as _,o as w,p as k,w as ge,a as S,b as p,g as Ae,M as je,x as Me,l as ze,y as Be,z as Oe,G as qe,H as be,c as v,I as L,T as ye,F as O,J as q,K as Ve,B as Ke,S as $e,L as ve,s as Ne,E as He,X as Je}from"./index-BupwEmgm.js";import{u as Ye}from"./useMutation-Bor7Z28h.js";import"./textarea-CvCGmzu-.js";import{S as V}from"./switch-BsgPceIy.js";import{B as G}from"./badge-BQIsryWh.js";import{C as K}from"./checkbox-D4YEYpY7.js";import{S as _e,a as we,b as ke,c as Se,d as C}from"./select-BE_BfE1n.js";import{toast as c}from"./index-DWSsIHDv.js";import{L as I}from"./loader-circle-bywfJt-C.js";import{C as J}from"./circle-check-big-DHNhhlYj.js";import{C as Te}from"./circle-x-rZJzd96T.js";import{T as $}from"./trash-2-CTaWXsz3.js";import{D as Qe}from"./download-D8TQR5Hi.js";import{S as H}from"./shield-check-FEBvo8yg.js";import{S as Xe}from"./save-DoMXXR-V.js";import"./index-BP4mGZh_.js";import"./index-DZZvDXV_.js";import"./index-DtqUbmXC.js";import"./check-CfJfwHKK.js";import"./index-CWzdr2iF.js";import"./index-5VGl---o.js";import"./index-z7BTQWyD.js";import"./index-Dcum08s_.js";import"./chevron-down-CZP-y2fV.js";import"./chevron-up-Cw-759n5.js";/**
2 * @license lucide-react v0.475.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 We=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Ze=Ge("Camera",We),Ce="6a0de0ad77009fd6efcd96d7";function es(){const[o,a]=i.useState(!1),[t,h]=i.useState(!0),[n,m]=i.useState(!1),f=async()=>{var x;try{const g=await d.functions.invoke("syncTaskToCalendar",{task_id:"__probe__"});a(!((x=g.data)!=null&&x.not_connected))}catch{a(!1)}h(!1)};i.useEffect(()=>{d.auth.isAuthenticated().then(x=>{x?f():h(!1)})},[]);const b=async()=>{const x=await d.connectors.connectAppUser(Ce),g=window.open(x,"_blank"),E=setInterval(()=>{(!g||g.closed)&&(clearInterval(E),h(!0),f())},500)},l=async()=>{m(!0);try{await d.connectors.disconnectAppUser(Ce),a(!1),c.success("Google Calendar disconnected.")}catch{c.error("Failed to disconnect. Please try again.")}m(!1)};return e.jsxs(_,{className:"border-0 shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4 text-secondary"})," Google Calendar Sync"]})}),e.jsxs(S,{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Automatically sync your SavvSkout tasks, application deadlines, and ",e.jsx("strong",{children:"Interviewing stage milestones"})," to Google Calendar so you never miss a meeting or assessment."]}),t?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(I,{className:"w-4 h-4 animate-spin"})," Checking connection..."]}):o?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800",children:[e.jsx(J,{className:"w-5 h-5 text-green-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-green-700 dark:text-green-400",children:"Google Calendar connected"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Tasks, interview stages, and application deadlines will automatically appear in your calendar."})]})]}),e.jsxs(p,{variant:"outline",size:"sm",className:"text-destructive border-destructive/30 hover:bg-destructive/5",onClick:l,disabled:n,children:[n?e.jsx(I,{className:"w-3 h-3 animate-spin mr-1"}):e.jsx(Te,{className:"w-3 h-3 mr-1"}),"Disconnect"]})]}):e.jsxs(p,{className:"bg-secondary text-secondary-foreground hover:bg-secondary/90",onClick:b,children:[e.jsx(ge,{className:"w-4 h-4 mr-2"})," Connect Google Calendar"]})]})]})}const De="6a0de03fc53c032f96ce02db";function ss(){const[o,a]=i.useState(!1),[t,h]=i.useState(!0),[n,m]=i.useState(!1),[f,b]=i.useState(null),l=Ae(),x=async()=>{var j;try{const N=await d.functions.invoke("checkGmailConnection",{});a(!!((j=N.data)!=null&&j.connected))}catch{a(!1)}h(!1)};i.useEffect(()=>{d.auth.isAuthenticated().then(j=>
6{j?x():h(!1)})},[]);const g=async()=>{const j=await d.connectors.connectAppUser(De),N=window.open(j,"_blank"),D=setInterval(()=>{(!N||N.closed)&&(clearInterval(D),h(!0),x())},500)},E=async()=>{try{await d.connectors.disconnectAppUser(De),a(!1),b(null),c.success("Gmail disconnected.")}catch{c.error("Failed to disconnect. Please try again.")}},U=async()=>{var j,N;m(!0),b(null);try{const P=(await d.functions.invoke("scanGmailConfirmations",{})).data||{};b(P),P.applications_updated>0?(c.success(`Found ${P.applications_updated} new confirmation${P.applications_updated>1?"s":""}!`),l.invalidateQueries({queryKey:["apps-for-unread"]})):c.info("Scan complete — no new confirmations found.")}catch(D){c.error(((N=(j=D.response)==null?void 0:j.data)==null?void 0:N.error)||"Scan failed. Is Gmail connected?")}m(!1)};return e.jsxs(_,{className:"border-0 shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-secondary"})," Gmail Confirmation Sync"]})}),e.jsxs(S,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect Gmail so SavvSkout can detect ATS application confirmations (Greenhouse, Lever, SmartRecruiters, and more) directly from your inbox — proving your submissions landed, even when you applied with your personal email."}),t?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(I,{className:"w-4 h-4 animate-spin"})," Checking connection..."]}):o?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800",children:[e.jsx(J,{className:"w-5 h-5 text-green-600 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-green-700 dark:text-green-400",children:"Gmail connected"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Scan your inbox for application confirmations from the last 7 days."})]})]}),f&&e.jsxs("div",{className:"text-xs text-muted-foreground p-3 rounded-lg bg-muted/40 border border-border",children:["Scanned ",f.scanned," email(s) · ",f.confirmations_found," confirmation(s) · ",f.applications_updated," application(s) updated",f.llm_fallbacks?` · ${f.llm_fallbacks} LLM fallback`:""]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(p,{size:"sm",className:"bg-secondary text-secondary-foreground hover:bg-secondary/90",onClick:U,disabled:n,children:[n?e.jsx(I,{className:"w-3 h-3 animate-spin mr-1"}):e.jsx(Me,{className:"w-3 h-3 mr-1"}),n?"Scanning...":"Scan Now"]}),e.jsxs(p,{variant:"outline",size:"sm",className:"text-destructive border-destructive/30 hover:bg-destructive/5",onClick:E,children:[e.jsx(Te,{className:"w-3 h-3 mr-1"})," Disconnect"]})]})]}):e.jsxs(p,{className:"bg-secondary text-secondary-foreground hover:bg-secondary/90",onClick:g,children:[e.jsx(je,{className:"w-4 h-4 mr-2"})," Connect Gmail"]})]})]})}function as({keywords:o,onChange:a}){const[t,h]=i.useState(""),n=l=>{const x=l.trim();x.length>=2&&!o.includes(x)&&a([...o,x]),h("")},m=l=>{l.key==="Enter"||l.key===","?(l.preventDefault(),n(t)):l.key==="Backspace"&&t===""&&o.length>0&&a(o.slice(0,-1))},f=()=>{t.trim().length>=2&&n(t)},b=l=>a(o.filter((x,g)=>g!==l));return e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5 p-2 min-h-[42px] border border-input rounded-md bg-background focus-within:ring-1 focus-within:ring-ring",children:[o.map((l,x)=>e.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-secondary/20 border border-secondary/30 text-xs font-medium text-foreground",children:[l,e.jsx("button",{type:"button",onClick:()=>b(x),className:"text-muted-foreground hover:text-foreground",children:e.jsx(Je,{className:"w-3 h-3"})})]},x)),e.jsx("input",{type:"text",value:t,onChange:l=>h(l.target.value),onKeyDown:m,onBlur:f,placeholder:o.length===0?"e.g. Social Media Manager, Content Creator…":"Add keyword…",className:"flex-1 min-w-[140px] bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]})}const ts=["full_time","part_time","contract","freelance"],rs=["Greenhouse","Lever","Ashby","Workable","Recruitee","Adzuna","Reed","JSearch","USAJobs","Careerjet","TheirStack"];function Ls(){var re,ne,oe,ce,ie,le;const{user:o,settings:a}=ze(),{t}=Be(),h=Ae(),[n,m]=i.useState({}),[f,b]=i.useState(""),[l,x]=i.useState(null),[g,E]=i.useState([]),[U,j]=i.useState([]),[N,D]=i.useState(""),[P,M]=i.useState(!1),[Y,Le]=i.useState(!1),[ns,Q]=i.useState(!1),[A,Ee]=i.useState(null),[X,W]=i.useState(!1),[Pe,Z]=i.useState(!1),[Ie,ee]=i.useState(!1),[se,ae]=i.useState(!1);i.useEffect(()=>{new URLSearchParams(window.location.search).get("stripe_connected")==="1"&&(a!=null&&a.stripe_account_id)&&!(a!=null&&a.stripe_onboarding_complete)&&(Q(!0),d.functions.invoke("stripeConnectReturn",{}).then(r=>{var y;(y=r.data)!=null&&y.complete?(h.invalidateQueries({queryKey:["user-settings"]}),c.success("Stripe payout account connected successfully!")):c.error("Stripe onboarding incomplete. Please finish all required steps.");const u=new URL(window.location.href);u.searchParams.delete("stripe_connected"),window.history.replaceState({},"",u.toString())}).catch(()=>{c.error("Could not verify Stripe account status.")}).finally(()=>Q(!1)))},[a==null?void 0:a.stripe_account_id]);const Re=["display_name","ai_mode","kill_switch","scan_cadence","app_limit_per_hour","tone_learning_enabled","include_ai_research","resume_url","avatar_url","description","payment_method","job_preferences","language_preference"];i.useEffect(()=>{var s,r,u;if(a!=null&&a.id&&!Y){const y=Re.reduce((B,R)=>(B[R]=a[R],B),{});m({...y,display_name:y.display_name??(o==null?void 0:o.full_name)??""}),b(((s=a.skills)==null?void 0:s.join(", "))||""),E(((r=a.job_preferences)==null?void 0:r.job_types)||[]),j(((u=a.job_preferences)==null?void 0:u.preferred_platforms)||[]),Le(!0)}},[a==null?void 0:a.id,a==null?void 0:a.updated_date,Y]);const z=Ye({mutationFn:async s=>{var de,me,ue;if(!(a!=null&&a.id))throw new Error("Settings record not found. Please refresh and try again.");let r=s.resume_url||"",u=f;if(l){c.info("Uploading and parsing resume...");const{file_url:F}=await d.integrations.Core.UploadFile({file:l});r=F;try{const T=await d.integrations.Core.ExtractDataFromUploadedFile({file_url:F,json_schema:{type:"object",properties:{professional_skills:{type:"array",items:{type:"string"},description:'The last 3 jobs only. For each, return a single str
6ing in the format "Job Title - Industry" (e.g. "Marketing Manager - Retail", "Software Engineer - Tech"). Return maximum 3 items ordered from most recent to oldest. Do NOT include soft skills, tools, languages, or certifications here.'},languages:{type:"array",items:{type:"string"},description:"Languages the person speaks, including proficiency level if mentioned (e.g. English - Fluent, Romanian - Native)"},other_skills:{type:"array",items:{type:"string"},description:"Certifications, tools, software, driving licenses, volunteer work, or any other relevant aptitudes not covered above"}}}});if((T==null?void 0:T.status)==="success"&&T.output){const{professional_skills:xe=[],languages:pe=[],other_skills:he=[]}=T.output,fe=[...xe,...pe,...he];fe.length&&(u=fe.join(", "),b(u),Ee({professional_skills:xe,languages:pe,other_skills:he}),c.success("Resume parsed — skills auto-filled!"))}}catch(T){console.warn("Resume parsing failed (non-critical):",T.message)}}const y={...s,display_name:s.display_name,resume_url:r,skills:u.split(",").map(F=>F.trim()).filter(Boolean),job_preferences:{...s.job_preferences||{},job_types:g,preferred_platforms:U,min_pay:(de=s.job_preferences)==null?void 0:de.min_pay,max_pay:(me=s.job_preferences)==null?void 0:me.max_pay,search_keywords:((ue=s.job_preferences)==null?void 0:ue.search_keywords)||[]}};let R=await d.entities.UserSettings.update(a.id,y);return s.display_name!==void 0&&(R=await d.entities.UserSettings.update(a.id,{display_name:s.display_name})),{result:R,resumeUrl:r}},onSuccess:({result:s,resumeUrl:r})=>{m(u=>({...u,resume_url:r,display_name:(s==null?void 0:s.display_name)??u.display_name})),x(null),h.invalidateQueries({queryKey:["user-settings",o==null?void 0:o.email]}),c.success("Settings saved successfully")},onError:s=>{console.error("Save settings error:",s),c.error(s.message||"Failed to save settings. Please try again.")}}),Ue=async s=>{if(!(!s||!(a!=null&&a.id))){ae(!0);try{const{file_url:r}=await d.integrations.Core.UploadFile({file:s});await d.entities.UserSettings.update(a.id,{avatar_url:r}),m(u=>({...u,avatar_url:r})),h.invalidateQueries({queryKey:["user-settings",o==null?void 0:o.email]}),c.success("Profile photo updated!")}catch{c.error("Failed to upload photo. Please try again.")}ae(!1)}},te=s=>{E(r=>r.includes(s)?r.filter(u=>u!==s):[...r,s])},Fe=s=>{j(r=>r.includes(s)?r.filter(u=>u!==s):[...r,s])};return a===void 0?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx("p",{className:"text-muted-foreground text-sm",children:t("loadingSettings")})}):a?e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6 pb-10",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-3xl font-bold text-foreground",children:t("settingsTitle")}),e.jsx("p",{className:"text-sm text-foreground/70 font-medium mt-1",children:t("settingsSubtitle")})]}),e.jsxs(_,{className:"border-2 border-secondary/20 bg-gradient-to-br from-secondary/5 to-transparent shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(Oe,{className:"w-5 h-5 text-secondary"})," ",t("profileAccount")]})}),e.jsxs(S,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(qe,{avatarUrl:n.avatar_url,name:be(o,a),size:"lg"}),e.jsxs("label",{className:`absolute -bottom-1 -right-1 w-7 h-7 rounded-full bg-secondary border-2 border-card flex items-center justify-center cursor-pointer hover:bg-secondary/80 transition-colors ${se?"opacity-50 pointer-events-none":""}`,children:[se?e.jsx(I,{className:"w-3 h-3 text-secondary-foreground animate-spin"}):e.jsx(Ze,{className:"w-3 h-3 text-secondary-foreground"}),e.jsx("input",{type:"file",accept:"image/*",className:"sr-only",onChange:s=>Ue(s.target.files[0])})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:be(o,a)||"Your Name"}),e.jsx("p",{className:"text-xs text-foreground/70",children:o==null?void 0:o.email}),e.jsx("p",{className:"text-xs text-foreground/70 mt-1 font-medium",children:"Tap the camera icon to change your photo"})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(v,{className:"font-bold text-foreground",children:t("fullName")}
6),e.jsx(L,{value:n.display_name??"",onChange:s=>m({...n,display_name:s.target.value}),className:"mt-2",placeholder:"Enter your full name"}),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-1",children:"Your preferred display name"})]}),e.jsxs("div",{children:[e.jsx(v,{className:"font-bold text-foreground",children:t("email")}),e.jsx(L,{value:(o==null?void 0:o.email)||"",disabled:!0,className:"mt-2 bg-muted"})]})]}),e.jsxs("div",{children:[e.jsx(v,{className:"font-bold text-foreground",children:"Skills"}),e.jsx(L,{className:"mt-2",placeholder:"e.g. React, Project Management, Copywriting",value:f,onChange:s=>b(s.target.value)}),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-1",children:"Comma-separated. Auto-filled when you upload a resume."})]}),A&&e.jsxs("div",{className:"mt-4 space-y-4 rounded-lg border-2 border-secondary/20 bg-secondary/8 p-4",children:[e.jsx("p",{className:"text-xs font-bold text-foreground uppercase tracking-wide",children:t("parsedFromResume")}),((re=A.professional_skills)==null?void 0:re.length)>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-bold text-foreground",children:t("professionalExperience")}),e.jsx("div",{className:"flex flex-col gap-1.5",children:A.professional_skills.slice(0,3).map((s,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-secondary shrink-0"}),e.jsx("span",{children:s})]},r))})]}),((ne=A.languages)==null?void 0:ne.length)>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-bold text-foreground",children:t("languages")}),e.jsx("div",{className:"flex flex-col gap-1.5",children:A.languages.map((s,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-secondary shrink-0"}),e.jsx("span",{children:s})]},r))})]}),((oe=A.other_skills)==null?void 0:oe.length)>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-bold text-foreground",children:t("otherSkills")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:A.other_skills.map((s,r)=>e.jsx(G,{variant:"outline",className:"text-xs text-foreground border-border",children:s},r))})]})]}),!n.resume_url&&!l&&e.jsxs("div",{className:"flex items-start gap-2.5 p-3.5 rounded-lg bg-amber-50 dark:bg-amber-950/30 border-2 border-amber-300/60 dark:border-amber-700/50",children:[e.jsx(ye,{className:"w-4 h-4 text-amber-700 dark:text-amber-400 shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-amber-800 dark:text-amber-300 leading-relaxed font-medium",children:[e.jsx("span",{className:"font-bold",children:"Resume required for automated submissions."})," Without a resume, Greenhouse and Lever applications will fail. Upload your CV to enable automated job applications."]})]}),e.jsxs("div",{children:[e.jsx(v,{className:"font-bold text-foreground",children:t("resumeCV")}),n.resume_url&&!l&&e.jsxs("div",{className:"flex items-center gap-3 mt-2 p-3 rounded-lg border border-secondary/20 bg-secondary/5",children:[e.jsx(O,{className:"w-4 h-4 text-secondary shrink-0"}),e.jsx("span",{className:"text-sm text-foreground/70 font-medium flex-1",children:"Current resume on file"}),e.jsxs(p,{variant:"outline",size:"sm",className:"border-destructive/40 text-destructive hover:bg-destructive hover:text-destructive-foreground shrink-0 h-8",onClick:()=>{q(10),m(s=>({...s,resume_url:""})),c.info("Old resume discarded. Upload a new one below and save.")},children:[e.jsx($,{className:"w-3.5 h-3.5 mr-1"})," Discard"]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[e.jsx(L,{type:"file",accept:".pdf,.doc,.docx",onChange:s=>x(s.target.files[0]),className:"flex-1"},n.resume_url||"empty"),l&&e.jsx(G,{variant:"outline",className:"text-xs text-accent-foreground border-accent/40 shrink-0",children:t("readyToSave")})]}),l&&e.jsxs("p",{className:"text-xs text-accent font-medium mt-1.5 truncate",children:["Selected: ",l.name]}
6),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-2",children:"PDF, DOC, or DOCX. Used by Scouting Agent for skill vectorization."})]})]})]}),e.jsxs(_,{className:"border-2 border-secondary/20 bg-gradient-to-br from-secondary/5 to-transparent shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(Ve,{className:"w-5 h-5 text-secondary"})," ",t("jobPreferences")]})}),e.jsxs(S,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(v,{className:"mb-3 block font-bold text-foreground",children:t("preferredJobTypes")}),e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[ts.map(s=>e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer p-2.5 rounded-lg hover:bg-secondary/10 transition-colors",children:[e.jsx(K,{checked:g.includes(s),onCheckedChange:()=>te(s)}),e.jsx("span",{className:"text-sm font-medium capitalize text-foreground",children:s.replace("_"," ")})]},s)),e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer p-2.5 rounded-lg hover:bg-secondary/10 transition-colors",children:[e.jsx(K,{checked:g.includes("remote"),onCheckedChange:()=>te("remote")}),e.jsx("span",{className:"text-sm font-medium capitalize text-foreground",children:"Remote"})]})]})]}),e.jsxs("div",{children:[e.jsx(v,{className:"mb-3 block font-bold text-foreground",children:t("preferredPlatforms")}),e.jsx("div",{className:"flex flex-wrap gap-2.5",children:rs.map(s=>e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer p-2.5 rounded-lg hover:bg-secondary/10 transition-colors",children:[e.jsx(K,{checked:U.includes(s),onCheckedChange:()=>Fe(s)}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(v,{className:"font-bold text-foreground",children:t("jobSearchKeywords")}),e.jsx(as,{keywords:((ce=n.job_preferences)==null?void 0:ce.search_keywords)||[],onChange:s=>m({...n,job_preferences:{...n.job_preferences||{},search_keywords:s}})}),e.jsxs("p",{className:"text-xs text-foreground/70 font-medium mt-2",children:["Press ",e.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-secondary/15 border border-secondary/30 text-xs font-medium text-secondary",children:"Enter"}),' or comma to add. Each keyword can be multiple words, e.g. "Social Media Manager".']})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-2",children:[e.jsxs("div",{children:[e.jsx(v,{className:"text-foreground font-bold",children:t("minPay")}),e.jsx(L,{type:"number",value:((ie=n.job_preferences)==null?void 0:ie.min_pay)||"",onChange:s=>m({...n,job_preferences:{...n.job_preferences||{},min_pay:parseFloat(s.target.value)}}),className:"mt-2",placeholder:"e.g. 25"})]}),e.jsxs("div",{children:[e.jsx(v,{className:"text-foreground font-bold",children:t("maxPay")}),e.jsx(L,{type:"number",value:((le=n.job_preferences)==null?void 0:le.max_pay)||"",onChange:s=>m({...n,job_preferences:{...n.job_preferences||{},max_pay:parseFloat(s.target.value)}}),className:"mt-2",placeholder:"e.g. 150"})]})]})]})]}),e.jsxs(_,{className:"border-2 border-secondary/20 bg-gradient-to-br from-secondary/5 to-transparent shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(Ke,{className:"w-5 h-5 text-secondary"})," ",t("aiAgentConfig")]})}),e.jsxs(S,{className:"space-y-5",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-secondary/8 border-2 border-secondary/20",children:[e.jsx(v,{className:"text-foreground font-bold block mb-2",children:t("aiMode")}),e.jsxs(_e,{value:n.ai_mode||"manual",onValueChange:s=>m({...n,ai_mode:s}),children:[e.jsx(we,{className:"mt-2",children:e.jsx(ke,{})}),e.jsxs(Se,{children:[e.jsx(C,{value:"manual",children:"Manual — You approve every agent action (HITL)"}),e.jsx(C,{value:"semi_auto",children:"Semi-Autonomous — AI drafts, you always have the final say"}),e.jsx(C,{value:"autonomous",children:"Semi-Autonomous (Advanced) — AI acts on high-confidence matches, you monitor & can override at any time"})]})]}
6),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-2",children:t("aiModeHint")})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border-2 border-destructive/30 bg-destructive/8",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-destructive/15 flex items-center justify-center",children:e.jsx(ye,{className:"w-5 h-5 text-destructive"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-destructive",children:t("killSwitch")}),e.jsx("p",{className:"text-xs text-foreground/70 font-medium",children:t("killSwitchHint")})]})]}),e.jsx(V,{checked:n.kill_switch||!1,onCheckedChange:s=>m({...n,kill_switch:s})})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border-2 border-secondary/30 bg-secondary/8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:t("toneLearning")}),e.jsxs("p",{className:"text-xs text-foreground/70 font-medium",children:[t("toneLearningHint"),!["premium_ultra","vip"].includes(a==null?void 0:a.subscription_tier)&&e.jsx("span",{className:"block text-secondary font-bold mt-0.5",children:t("premiumOnly")})]})]}),e.jsx(V,{checked:n.tone_learning_enabled||!1,onCheckedChange:async s=>{if(m({...n,tone_learning_enabled:s}),s&&["premium_ultra","vip"].includes(a==null?void 0:a.subscription_tier)){ee(!0);try{await d.functions.invoke("learnUserTone",{messages:[],force_rebuild:!1}),c.success("Tone Learning activated — AI will now learn your writing style.")}catch{c.error("Tone Learning failed to initialise. It will retry on next interaction.")}ee(!1)}},disabled:!["premium_ultra","vip"].includes(a==null?void 0:a.subscription_tier)||Ie})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-secondary/8 border-2 border-secondary/20",children:[e.jsx(v,{className:"text-foreground font-bold",children:"Email Language Preference"}),e.jsxs(_e,{value:n.language_preference||"en",onValueChange:s=>m({...n,language_preference:s}),children:[e.jsx(we,{className:"mt-2",children:e.jsx(ke,{})}),e.jsxs(Se,{children:[e.jsx(C,{value:"en",children:"English"}),e.jsx(C,{value:"es",children:"Español"}),e.jsx(C,{value:"fr",children:"Français"}),e.jsx(C,{value:"de",children:"Deutsch"}),e.jsx(C,{value:"it",children:"Italiano"}),e.jsx(C,{value:"pt",children:"Português"})]})]}),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-2",children:"Language used for outgoing application emails to employers."})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border-2 border-secondary/30 bg-secondary/8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Include AI Research in Cover Letters"}),e.jsx("p",{className:"text-xs text-foreground/70 font-medium",children:"Enable web search and AI research when drafting cover letters and proposals. Provides relevant talking points and stronger context for each application."})]}),e.jsx(V,{checked:n.include_ai_research||!1,onCheckedChange:s=>m({...n,include_ai_research:s})})]})]})]}),e.jsxs(_,{className:"border-2 border-secondary/10 shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx($e,{className:"w-4 h-4 text-secondary"})," ",t("security")]})}),e.jsxs(S,{className:"space-y-3",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2 text-sm",children:[{label:"GDPR Accepted",value:a.gdpr_accepted,at:a.gdpr_accepted_at},{label:"Terms of Service",value:a.tos_accepted,at:a.tos_accepted_at,version:a.tos_version},{label:"AI Responsibility",value:a.ai_responsibility_acknowledged,at:a.ai_responsibility_acknowledged_at}].map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-secondary/8 border border-secondary/10",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-foreground font-medium",children:s.label}),s.at&&e.jsxs("p",{className:"text-xs text-foreground/70 font-medium mt-0.5",children:[new Date(s.at).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}),s.version?` · v${s.version}`:""]})]}),e.jsx(G,{className:s.value?"bg-secondary/20 text-foreground border-secondary/30":"bg-destructive/10 text-destructive",children:s.value?"Agreed":"Not agreed"})]},s.label))}
6),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-1",children:"Acceptance timestamps are stored for legal compliance."}),e.jsxs(p,{variant:"outline",size:"sm",disabled:X,onClick:async()=>{W(!0);try{const s=await d.functions.invoke("exportUserData",{}),r=new Blob([JSON.stringify(s.data,null,2)],{type:"application/json"}),u=URL.createObjectURL(r),y=document.createElement("a");y.href=u,y.download=`savvskout-data-export-${o==null?void 0:o.email}-${new Date().toISOString().split("T")[0]}.json`,y.click(),URL.revokeObjectURL(u),c.success("Data export downloaded.")}catch{c.error("Export failed. Please try again.")}W(!1)},children:[X?e.jsx(I,{className:"w-3 h-3 animate-spin mr-1"}):e.jsx(Qe,{className:"w-3 h-3 mr-1"}),"Export My Data (GDPR)"]})]})]}),e.jsxs(_,{className:"border-2 border-secondary/10 shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-secondary"})," Identity Verification"]})}),e.jsx(S,{className:"space-y-3",children:a!=null&&a.verification_badge_unlocked&&(!(a!=null&&a.verification_badge_expires_at)||new Date(a.verification_badge_expires_at)>new Date)?e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-secondary/8 border border-secondary/20",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-foreground font-medium flex items-center gap-1.5",children:[e.jsx(H,{className:"w-4 h-4 text-secondary"})," SavvSkout Verified"]}),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-0.5",children:a!=null&&a.verification_badge_expires_at?`Expires ${new Date(a.verification_badge_expires_at).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"})}`:"Active"})]}),e.jsx(G,{className:"bg-secondary/20 text-secondary border-secondary/30",children:"Active"})]}):e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/40 border border-border",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-foreground font-medium",children:"Not Verified"}),e.jsx("p",{className:"text-xs text-foreground/70 font-medium mt-0.5",children:"Build trust with employers — get verified through Didit."})]}),e.jsx(p,{asChild:!0,size:"sm",className:"bg-secondary hover:bg-secondary/90",children:e.jsxs(ve,{to:"/verification",children:[e.jsx(H,{className:"w-3.5 h-3.5 mr-1"})," Get Verified"]})})]})})]}),e.jsxs(p,{onClick:()=>{q(10),z.mutate(n)},disabled:z.isPending,className:"w-full bg-secondary text-secondary-foreground hover:bg-secondary/90 min-h-[44px]",children:[e.jsx(Xe,{className:"w-4 h-4 mr-2"}),z.isPending?t("saving"):t("saveSettings")]}),e.jsxs(_,{className:"border-2 border-secondary/10 shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4 text-secondary"})," Cover Letter Templates"]})}),e.jsxs(S,{children:[e.jsx("p",{className:"text-sm text-foreground/70 font-medium mb-3",children:"Save reusable cover letter templates. The AI adapts them to each specific job when you apply."}),e.jsx(ve,{to:"/cover-letter-templates",children:e.jsxs(p,{variant:"outline",className:"gap-2",children:[e.jsx(O,{className:"w-4 h-4"})," Manage Templates"]})})]})]}),e.jsx(es,{}),e.jsx(ss,{}),e.jsxs(_,{className:"border-2 border-secondary/10 shadow-sm",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2",children:[e.jsx(Ne,{className:"w-4 h-4 text-secondary"})," Payout Account"]})}),e.jsxs(S,{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-foreground/70 font-medium",children:["Connect your Stripe account to receive payouts when employers pay your invoices. SavvSkout retains a ",e.jsx("span",{className:"font-bold text-foreground",children:"7% flat platform fee"})," on each invoice. The remaining 93% is transferred to your bank account within 2–7 business days."]}),a!=null&&a.stripe_onboarding_complete?e.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800",children:[e.jsx(J,{className:"w-5 h-5 text-green-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-green-700 dark:text-green-400",children:"Stripe payout account connected"}
6),e.jsxs("p",{className:"text-xs text-foreground/70 font-medium",children:["Account: ",a.stripe_account_id]})]}),e.jsxs(p,{variant:"outline",size:"sm",className:"ml-auto text-xs",onClick:async()=>{var s;try{const r=await d.functions.invoke("connectStripeAccount",{return_url:window.location.href,refresh_url:window.location.href});(s=r.data)!=null&&s.url&&window.open(r.data.url,"_blank")}catch{c.error("Failed to open Stripe dashboard.")}},children:[e.jsx(He,{className:"w-3 h-3 mr-1"})," Manage"]})]}):e.jsxs(p,{className:"bg-secondary text-secondary-foreground hover:bg-secondary/90",onClick:async()=>{var s;try{const r=await d.functions.invoke("connectStripeAccount",{return_url:window.location.href+"?stripe_connected=1",refresh_url:window.location.href});(s=r.data)!=null&&s.url?window.location.href=r.data.url:c.error("Failed to start Stripe onboarding.")}catch(r){c.error(r.message||"Failed to connect Stripe account.")}},children:[e.jsx(Ne,{className:"w-4 h-4 mr-2"})," Connect Stripe Payout Account"]}),!(a!=null&&a.stripe_onboarding_complete)&&e.jsxs("p",{className:"text-xs text-foreground/70 font-medium",children:["You'll be redirected to Stripe to verify your identity and add a bank account. Only needed when you have paid work to receive. ",e.jsx("span",{className:"font-bold text-foreground",children:"Payouts can be held manually until you're ready to connect."})]})]})]}),e.jsxs(_,{className:"border-2 border-destructive/40 shadow-sm bg-gradient-to-br from-destructive/5 to-transparent",children:[e.jsx(w,{children:e.jsxs(k,{className:"font-heading text-base flex items-center gap-2 text-destructive",children:[e.jsx($,{className:"w-4 h-4"})," ",t("deleteAccount")]})}),e.jsxs(S,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-foreground/70 font-medium",children:t("deleteAccountDesc")}),P?e.jsxs("div",{className:"space-y-3 p-4 rounded-lg bg-destructive/8 border-2 border-destructive/40",children:[e.jsx("p",{className:"text-sm font-bold text-destructive",children:t("typeDelete")}),e.jsx(L,{value:N,onChange:s=>D(s.target.value),placeholder:"Type DELETE",className:"border-destructive/50 focus-visible:ring-destructive"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{variant:"outline",className:"flex-1 min-h-[44px]",onClick:()=>{M(!1),D("")},children:t("cancel")}),e.jsx(p,{className:"flex-1 bg-destructive text-destructive-foreground hover:bg-destructive/90 min-h-[44px]",disabled:N!=="DELETE"||Pe,onClick:async()=>{q(20),Z(!0);try{await d.functions.invoke("requestAccountDeletion",{}),c.success("Deletion request submitted. Your account has been deactivated. You will be logged out."),setTimeout(()=>d.auth.logout("/"),2500)}catch(s){console.error("Failed to submit deletion request:",s),c.error("Failed to submit deletion request. Please contact support directly."),Z(!1)}M(!1),D("")},children:t("confirmDelete")})]})]}):e.jsxs(p,{variant:"outline",className:"border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground min-h-[44px]",onClick:()=>M(!0),children:[e.jsx($,{className:"w-4 h-4 mr-2"})," ",t("requestDeletion")]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"No settings found. Please complete onboarding first."})})}export{Ls 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.