PageSourceSearch

https://blisstherapy.ai/assets/welcome.profile-BJfUGh47.js

js blisstherapy.ai collected 2026-10-05 11:52:30 UTC 9,422 bytes, 1 lines download raw bytes

1import{u as W,f as $,r,b as q,ax as G,aD as X,g as A,aA as L,t as m,aE as Y,j as e,a9 as z,L as w,e as v,I as D,T as _,ai as J}from"./index-CwxMVMRT.js";import{F as V,s as Z}from"./funnel-shell-Dc5QMNgv.js";const B=5,Q=5;function ee(){const x=W(),h=$(),[u,b]=r.useState(""),[N,H]=r.useState(!1),[i,g]=r.useState(""),[p,k]=r.useState(""),[l,P]=r.useState(!1),[y,M]=r.useState(""),[j,S]=r.useState(!1),C=r.useRef(null),[E,K]=r.useState(!1),F=q({queryKey:["t-profile"],queryFn:()=>G(),staleTime:3e4});r.useEffect(()=>{if(E)return;const t=F.data;t&&(g(t.profilePictureUrl??""),k(t.hourlyRateEur!=null?String(t.hourlyRateEur):""),P(t.offersIntroSession??!1),K(!0))},[F.data,E]);const n=q({queryKey:["funnel-bio-draft"],queryFn:()=>X(),staleTime:1/0,refetchOnWindowFocus:!1,retry:!1});r.useEffect(()=>{if(N)return;const t=n.data;t&&t.ok&&(b(t.bio),H(!0))},[n.data,N]);const c=A({mutationFn:t=>L({data:t}),onSuccess:()=>{h.invalidateQueries({queryKey:["t-profile"]})},onError:()=>{}}),f=A({mutationFn:async t=>{const s=await Y({data:{bio:t}});if(!s.ok)return{stage:"bio",error:s.error};const a={},d=i.trim();d.length>0&&(a.profilePictureUrl=d);const o=Number(p);p.trim().length>0&&Number.isFinite(o)&&o>0&&(a.hourlyRateEur=o),a.offersIntroSession=l;try{await L({data:a})}catch(U){return{stage:"profile",error:U instanceof Error?U.message:"Profile update failed."}}return{stage:"done"}},onSuccess:t=>{if("error"in t){const s=t.stage==="bio"?t.error==="empty_bio"?"Write a couple of sentences first.":"Couldn't save your bio — try again?":t.stage==="profile"?`Profile didn't save: ${t.error}`:"Couldn't finish — try again?";m.error(s);return}h.invalidateQueries({queryKey:["t-profile"]}),h.invalidateQueries({queryKey:["t-kreu"]}),m.success("Profile saved."),x({to:"/welcome/activate",replace:!0})},onError:()=>m.error("Couldn't save your bio — try again?")}),O=()=>{Z(),x({to:"/dashboard/t"})},T=n.isPending||!n.data&&n.isFetching,R=n.data&&!n.data.ok?n.data.error:n.error?"generation_failed":null,I=r.useMemo(()=>{if(y)return y;if(i)try{return new URL(i).pathname.split("/").filter(Boolean).pop()??i}catch{return i}return""},[i,y]);return e.jsx(V,{progress:Q/B,progressLabel:`Step ${Q} of ${B} · Profile`,children:e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsxs("header",{className:"max-w-3xl",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-white px-3 py-1 text-[10.5px] font-semibold uppercase tracking-[0.18em] text-bliss-primary ring-1 ring-bliss-stone/55",children:[e.jsx(z,{className:"h-3 w-3"}),"Drafted from your answers"]}),e.jsx("h1",{className:"mt-3 font-serif text-[36px] leading-[1.08] tracking-[-0.01em] text-bliss-ink md:text-[44px]",children:"Here's a draft, in your voice."}),e.jsxs("p",{className:"mt-3 text-[15.5px] leading-relaxed text-bliss-ink-muted md:text-[16.5px]",children:["Add a photo, set your fee, edit anything that doesn't sound like you.",e.jsx("br",{}),e.jsx("span",{className:"text-bliss-ink-soft",children:"This is what clients will see on your directory page."})]})]}),e.jsxs("div",{className:"mt-8 flex flex-1 flex-col gap-6",children:[e.jsxs("section",{className:"rounded-[24px] bg-white p-6 ring-1 ring-bliss-stone/45",children:[e.jsx("p",{className:"text-[10.5px] font-semibold uppercase tracking-[0.18em] text-bliss-ink-soft",children:"Profile photo"}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-4",children:[i?e.jsx("img",{src:i,alt:"Profile preview",className:"h-16 w-16 rounded-full object-cover ring-2 ring-bliss-stone/60",onError:t=>{t.target.style.display="none"}}):e.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-bliss-frost text-[10.5px] uppercase tracking-[0.16em] text-bliss-ink-soft ring-2 ring-bliss-stone/40",children:"Photo"}),e.jsx("input",{ref:C,type:"file",accept:"image/*",className:"hidden",disabled:j,onChange:async t=>{const s=t.target.files?.[0];if(!s)return;S(!0);const a=new FormData;a.append("file",s);try{const d=await fetch("/api/uploads",{method:"POST",body:a});if(!d.ok)throw new Error("upload_failed");const o=await d.json();o.url&&(g(o.url),M(s.name),c.mutate({profilePictureUrl:o.url}))}catch{m.error("Couldn't upload that photo — try a smaller file?")}finally{S(!1),t.target.value=""}}}),e.jsx("button",{type:"button",onClick:()=>C.current?.click(),disabled:j,className:v("inline-flex cursor-pointer items-center rounded-full bg-bliss-primary px-4 py-2 text-[13px] font-medium text-white shadow-sm transition-colors hover:bg-bliss-primary-strong disabled:cursor-progress disabled:opacity-70"),children:j?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"Uploading"]}):"Choose photo"}),I?e.jsx("span",{className:"max-w-[260px] truncate text-[12.5px] text-bliss-ink-soft",children:I}):null]}),e.jsx("div",{className:"mt-3",children:e.jsx(D,{type:"url",value:i,onChange:t=>g(t.target.value),onBlur:()=>{const t=i.trim();c.mutate({profilePictureUrl:t.length>0?t:null})},placeholder:"…or paste a photo URL",className:"h-9 max-w-[420px] rounded-full bg-bliss-frost text-[13px]"})})]}
1),e.jsxs("section",{className:"grid gap-4 rounded-[24px] bg-white p-6 ring-1 ring-bliss-stone/45 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10.5px] font-semibold uppercase tracking-[0.18em] text-bliss-ink-soft",children:"Session fee (EUR)"}),e.jsx("p",{className:"mt-1 text-[12px] text-bliss-ink-soft",children:"Per 50-minute session. You can change this anytime."}),e.jsx(D,{type:"number",inputMode:"decimal",min:0,max:500,value:p,onChange:t=>k(t.target.value),onBlur:()=>{const t=p.trim();if(t.length===0){c.mutate({hourlyRateEur:null});return}const s=Number(t);c.mutate({hourlyRateEur:Number.isFinite(s)&&s>0?s:null})},placeholder:"50",className:"mt-3 h-10 max-w-[10rem] rounded-full"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10.5px] font-semibold uppercase tracking-[0.18em] text-bliss-ink-soft",children:"Free intro session?"}),e.jsx("p",{className:"mt-1 text-[12px] text-bliss-ink-soft",children:"A short 15–20 min session to get acquainted."}),e.jsx("button",{type:"button",onClick:()=>{const t=!l;P(t),c.mutate({offersIntroSession:t})},"aria-pressed":l,className:v("mt-4 inline-flex h-7 w-12 items-center rounded-full transition-colors",l?"bg-bliss-primary":"bg-bliss-stone/60"),children:e.jsx("span",{className:v("h-5 w-5 transform rounded-full bg-white shadow transition-transform",l?"translate-x-6":"translate-x-1")})})]})]}),T?e.jsx("div",{className:"flex min-h-[280px] items-center justify-center rounded-[24px] bg-white px-6 py-16 ring-1 ring-bliss-stone/45",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-bliss-ink-muted",children:[e.jsx(w,{className:"h-6 w-6 animate-spin"}),e.jsx("p",{className:"text-[13.5px]",children:"Drafting your bio…"}),e.jsx("p",{className:"text-[12px] text-bliss-ink-soft",children:"This takes about 10 seconds."})]})}):R?e.jsxs("div",{className:"rounded-[24px] bg-white p-6 ring-1 ring-bliss-stone/45",children:[e.jsx("p",{className:"text-[14px] text-bliss-bloom",children:"Couldn't draft a bio just now."}),e.jsx("p",{className:"mt-2 text-[13px] text-bliss-ink-muted",children:R==="ai_not_configured"?"Our AI provider isn't configured yet — write a bio later from your profile.":"The model didn't return a usable draft. Try again, or write one yourself below."}),e.jsx(_,{value:u,onChange:t=>b(t.target.value),rows:12,placeholder:"Write a short bio for your directory page…",className:"mt-4 rounded-2xl"}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>n.refetch(),className:"rounded-full bg-bliss-primary/10 px-4 py-2 text-[13px] font-medium text-bliss-primary transition-colors hover:bg-bliss-primary/20",children:"Try again"}),e.jsx("button",{type:"button",onClick:O,className:"text-[13px] text-bliss-ink-soft underline-offset-2 hover:text-bliss-ink hover:underline",children:"Skip and write later"})]})]}):e.jsx(_,{value:u,onChange:t=>b(t.target.value),rows:14,placeholder:"Write a short bio for your directory page…",className:"min-h-[360px] rounded-2xl bg-white p-6 text-[15px] leading-relaxed shadow-sm ring-1 ring-bliss-stone/45 focus-visible:ring-bliss-primary/40"})]}),e.jsxs("footer",{className:"mt-10 flex items-center justify-between border-t border-bliss-stone/40 pt-6",children:[e.jsxs("button",{type:"button",onClick:()=>x({to:"/welcome/knowledge"}),className:"inline-flex items-center gap-2 rounded-full px-4 py-2 text-[13.5px] font-medium text-bliss-ink-muted transition-colors hover:bg-white hover:text-bliss-ink",disabled:f.isPending,children:[e.jsx(J,{className:"h-3.5 w-3.5"}),"Back"]}),e.jsx("button",{type:"button",onClick:()=>f.mutate(u),disabled:f.isPending||T||u.trim().length===0,className:"inline-flex items-center gap-2 rounded-full bg-bliss-primary px-6 py-2.5 text-[14px] font-medium text-white shadow-sm transition-colors hover:bg-bliss-primary-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-bliss-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-bliss-frost disabled:cursor-not-allowed disabled:bg-bliss-stone disabled:text-bliss-ink-soft",children:f.isPending?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"h-3.5 w-3.5 animate-spin"}),"Activating"]}):e.jsx(e.Fragment,{children:"Save & continue →"})})]})]})})}const ie=ee;export{ie 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.