1import{u as D,y as A,r as m,A as I,ak as i,n as L,o as e,a4 as T,a5 as M,a6 as R,a7 as S,ab as F,ai as u,a8 as N,a9 as _,x as y}from"./index-BjePuzSC.js";function w({open:b,onOpenChange:s,clientOrgId:v,clientOrgName:p}){const{t}=D("client-portal"),h=A(),[x,o]=m.useState(""),[C,r]=m.useState(""),[l,c]=m.useState("CLIENT_MANAGER"),d=I({mutationFn:async a=>(await L.post(`/client-portal/organizations/${v}/invite-contact`,a)).data.data,onSuccess:()=>{h.invalidateQueries({queryKey:["client-partnerships"]}),h.invalidateQueries({queryKey:["client-detail",v]}),s(!1),o(""),r(""),c("CLIENT_MANAGER"),i({title:t("inviteContact.invitationSent"),description:t("inviteContact.invitationSentDesc",{name:p}),variant:"success"})},onError:a=>{var n,j,g;i({title:"Error",description:((g=(j=(n=a.response)==null?void 0:n.data)==null?void 0:j.error)==null?void 0:g.message)||t("inviteContact.failedToSend"),variant:"destructive"})}}),E=()=>{const a=x.trim(),n=C.trim();if(!a){i({title:"Error",description:t("common:validation.enterEmailAddress"),variant:"destructive"});return}if(!n){i({title:"Error",description:t("common:validation.enterName"),variant:"destructive"});return}d.mutate({email:a,name:n,role:l})},f=()=>{o(""),r(""),c("CLIENT_MANAGER")};return e.jsx(T,{open:b,onOpenChange:a=>{s(a),a||f()},children:e.jsxs(M,{children:[e.jsxs(R,{children:[e.jsx(S,{children:t("inviteContact.title")}),e.jsx(F,{children:t("inviteContact.subtitle",{name:p})})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"contact-name",children:t("inviteContact.nameLabel")}),e.jsx(N,{id:"contact-name",value:C,onChange:a=>r(a.target.value),placeholder:t("inviteContact.namePlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"contact-email",children:t("inviteContact.emailLabel")}),e.jsx(N,{id:"contact-email",type:"email",value:x,onChange:a=>o(a.target.value),placeholder:t("inviteContact.emailPlaceholder"),onKeyDown:a=>{a.key==="Enter"&&E()}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"contact-role",children:t("inviteContact.roleLabel")}),e.jsxs("select",{id:"contact-role",value:l,onChange:a=>c(a.target.value),className:"w-full h-10 px-3 rounded-md border border-input bg-background text-sm",children:[e.jsx("option",{value:"CLIENT_MANAGER",children:t("inviteContact.roles.clientManager")}),e.jsx("option",{value:"CLIENT_VIEWER",children:t("inviteContact.roles.clientViewer")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(l==="CLIENT_VIEWER"?"inviteContact.roleDescriptions.clientViewer":"inviteContact.roleDescriptions.clientManager")})]})]}),e.jsxs(_,{children:[e.jsx(y,{variant:"outline",onClick:()=>s(!1),children:t("common:buttons.cancel")}),e.jsx(y,{onClick:E,disabled:d.isPending,children:d.isPending?t("common:buttons.sending"):t("common:buttons.sendInvitation")})]})]})})}export{w as InviteContactDialog,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.