1import{t as f,x as n,j as e,h as y,a6 as j,a7 as N,i as k,z as v,ae as C,B as m,L as b}from"./index-DI1iMexg.js";import{C as w}from"./circle-pause-nFpBIgOt.js";import{C as S}from"./calendar-check-B0ZO_UCK.js";const T="https://bkyqhwhldvwzghjghcgs.supabase.co/functions/v1/provider-availability-confirm",E=()=>{const[a]=f(),t=a.get("t")??a.get("token")??"",i=a.get("a")??a.get("action")??"",[o,r]=n.useState("idle"),[h,c]=n.useState(""),[l,x]=n.useState(""),d=async u=>{r("sending"),x(u);try{const p=await fetch(`${T}?token=${encodeURIComponent(t)}&action=${u}&format=json`,{method:"POST",headers:{"Content-Type":"application/json"}}),s=await p.json().catch(()=>({}));if(!p.ok){r("error"),c((s==null?void 0:s.message)||"We couldn't record that. Please update your availability from your dashboard.");return}r("done"),c((s==null?void 0:s.message)||"")}catch{r("error"),c("Network error â please try again from your provider dashboard.")}};n.useEffect(()=>{t&&(i==="accepting"||i==="paused")&&d(i)},[t,i]);const g=!t;return e.jsx("main",{className:"min-h-screen bg-muted/30 px-4 py-16",children:e.jsxs(y,{className:"mx-auto max-w-lg",children:[e.jsx(j,{children:e.jsx(N,{className:"text-2xl",children:"Availability check-in"})}),e.jsxs(k,{className:"space-y-6",children:[g?e.jsx("p",{className:"text-muted-foreground",children:"This link is missing its check-in code â it may have been shortened by your email app. You can set your availability in one click on your talent profile instead."}):o==="sending"?e.jsxs("p",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin","aria-hidden":"true"})," Saving your answerâ¦"]}):o==="done"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"flex items-center gap-2 font-semibold text-foreground",children:[l==="paused"?e.jsx(w,{className:"h-5 w-5 text-primary","aria-hidden":"true"}):e.jsx(S,{className:"h-5 w-5 text-primary","aria-hidden":"true"}),l==="paused"?"Enjoy the break":"You're marked as accepting families"]}),e.jsx("p",{className:"text-muted-foreground",children:h||(l==="paused"?"We've paused new family recommendations. Your listing stays exactly where it is.":"Families searching GentleBirth will keep seeing you as an active provider.")})]}):o==="error"?e.jsxs("p",{className:"flex items-start gap-2 text-muted-foreground",children:[e.jsx(C,{className:"mt-0.5 h-4 w-4 text-destructive","aria-hidden":"true"}),h]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground",children:"Are you still accepting GentleBirth families? Nothing changes on your listing either way â this just keeps your profile current."}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsx(m,{className:"flex-1",onClick:()=>d("accepting"),children:"Yes, I'm accepting families"}),e.jsx(m,{variant:"outline",className:"flex-1",onClick:()=>d("paused"),children:"I'm taking a break"})]})]}),e.jsx(m,{asChild:!0,variant:"secondary",className:"w-full",children:e.jsx(b,{to:"/provider/profile#availability",children:"Open my talent profile"})})]})]})})};export{E 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.