PageSourceSearch

https://mustwants.com/assets/ApproveInfoSharingPage-BpqsOZRe.js

js mustwants.com collected 2026-10-08 04:41:19 UTC 4,240 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-ui-BMsACof5.js";import{k as C,u as S,r as i}from"./vendor-react-ZBg-rrvt.js";import{u as R,bE as k,H as h,ae as x,az as g,_ as j,aA as v,af as y,a as l,aO as E,X as L,t as m,aw as c,v as P}from"./main-Cfd-xnR3.js";import"./vendor-mapbox-BrTTDEGO.js";import"./vendor-data-B6iiC3HR.js";import"./vendor-charts-CryiiMi0.js";import"./vendor-date-BbiQzRnW.js";const q={agent:"Real Estate Agent",attorney:"Attorney",home_inspector:"Home Inspector",insurance_agent:"Insurance Agent",lender:"Lender",title_insurance_agent:"Title Insurance Agent",property_manager:"Property Manager",business_owner:"Business Partner"};function W(){const{connectionId:r}=C(),o=S(),{user:s}=R(),[_,p]=i.useState(!0),[u,f]=i.useState(!1),[n,N]=i.useState(null);i.useEffect(()=>{if(!(s!=null&&s.id)||!r)return;(async()=>{p(!0);try{const{data:a,error:w}=await m.from("connections").select("pro_id, pro_role, info_sharing_approved").eq("id",r).eq("buyer_id",s.id).single();if(w||!a){c.error("Connection not found"),o("/dashboard");return}const{data:d}=await m.from("profiles").select("first_name, last_name").eq("user_id",a.pro_id).single(),A=d&&[d.first_name,d.last_name].filter(Boolean).join(" ")||"Professional";N({proName:A,proRole:a.pro_role,proId:a.pro_id,alreadyApproved:a.info_sharing_approved})}catch{c.error("Failed to load connection info"),o("/dashboard")}finally{p(!1)}})()},[s==null?void 0:s.id,r,o]);const b=async()=>{if(!(!r||!n||!(s!=null&&s.id))){f(!0);try{const{error:t}=await m.from("connections").update({info_sharing_approved:!0,info_sharing_approved_at:new Date().toISOString()}).eq("id",r).eq("buyer_id",s.id);if(t)throw t;await P("notify-info-sharing-approved",{body:{proId:n.proId,buyerId:s.id,proRole:n.proRole,connectionId:r}}),c.success("Info sharing approved!"),o("/dashboard?tab=connections")}catch(t){const a=t instanceof Error?t.message:"Failed to approve";c.error(a)}finally{f(!1)}}};if(_)return e.jsx("div",{className:"container py-8 max-w-md mx-auto",children:e.jsx(k,{className:"h-64 w-full"})});if(!n)return null;if(n.alreadyApproved)return e.jsxs(e.Fragment,{children:[e.jsx(h,{title:"Info Sharing",noIndex:!0}),e.jsx("div",{className:"container py-8 max-w-md mx-auto",children:e.jsxs(x,{children:[e.jsxs(g,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-icon-background flex items-center justify-center",children:e.jsx(j,{className:"h-6 w-6 text-icon-accent"})}),e.jsx(v,{children:"Already Approved"})]}),e.jsxs(y,{className:"text-center space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You've already approved sharing your information with ",n.proName,"."]}),e.jsx(l,{onClick:()=>o("/dashboard?tab=connections"),children:"Go to Connections"})]})]})})]});const I=q[n.proRole]||n.proRole;return e.jsxs(e.Fragment,{children:[e.jsx(h,{title:"Approve Info Sharing",noIndex:!0}),e.jsx("div",{className:"container py-8 max-w-md mx-auto",children:e.jsxs(x,{children:[e.jsxs(g,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-100 flex items-center justify-center",children:e.jsx(E,{className:"h-6 w-6 text-amber-600"})}),e.jsx(v,{children:"Information Sharing Request"})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:[e.jsx("strong",{children:n.proName})," (",I,") is requesting access to your profile information on MustWants."]}),e.jsxs("div",{className:"bg-muted rounded-lg p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"This includes:"}),e.jsxs("ul",{className:"list-disc list-inside text-muted-foreground space-y-1",children:[e.jsx("li",{children:"Your contact information (email, phone)"}),e.jsx("li",{children:"Your home-buying priorities"}),e.jsx("li",{children:"Your saved/favorited homes"})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(l,{variant:"outline",className:"flex-1",onClick:()=>o("/dashboard?tab=connections"),children:[e.jsx(L,{className:"h-4 w-4 mr-1"}),"Not Now"]}),e.jsxs(l,{className:"flex-1",onClick:b,disabled:u,children:[e.jsx(j,{className:"h-4 w-4 mr-1"}),u?"Approving...":"Approve"]})]})]})]})})]})}export{W 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.