PageSourceSearch

https://www.instamed.fr/v2/assets/Discussions-IT3IVu8g.js

js instamed.fr collected 2026-09-25 18:21:09 UTC 15,894 bytes, 14 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NewDiscussion-BreDx6RO.js","assets/index-D4ZV_K8b.js","assets/index-CfmiW6Z-.css","assets/DrawerManager-BTAIt4rj.js","assets/DrawerManager-DKhd1xmN.css","assets/NewDiscussionBase-Bp6LcnJV.js","assets/DiscussionTour-D2xwyV4k.js","assets/Discussion-Ca8zyRK2.js","assets/UserTag-Dniwev5x.js","assets/AppRoot-CIRwzTHj.js","assets/routes-fb2OaPHG.js","assets/PageTitle-CORj4igL.js","assets/PhoneInput-BCVSfwc7.js","assets/PhoneInput-DpsRipQV.css","assets/useBadge-CXrRArG9.js","assets/Tabs-vLdiUv9z.js","assets/EntityTableHeader-D_Vnkgm3.js","assets/ticket-XK8gGFxp.js","assets/AppRoot-Cyr51h-r.css","assets/DiscussionsContainer-BuGCkASE.js","assets/SendFileForm-VOKs8Va9.js"])))=>i.map(i=>d[i]);
2import{j as e,r as i,_ as K,u as me}from"./index-D4ZV_K8b.js";import{ar as C,bd as y,aa as F,ah as H,bG as we,aO as je,j2 as _e,f7 as ve,ao as X,fa as Ne,i$ as De,Z as oe,a0 as ce,bq as ke,aP as z,af as Se,aM as Ce,cW as Ee,ai as le,bo as Z,aQ as Me,h8 as re,b$ as de,cC as Te,bE as Fe,cX as Le,ba as Ae,bi as Ie,Y as Oe,ak as Re,by as ye,an as ie,gn as ne,bF as Ue,j3 as He,cG as $e,bf as ae,a8 as Be,ac as Ve,bH as ze,ax as Ge,bO as We}from"./DrawerManager-BTAIt4rj.js";import{u as ue,a as Ye,M as Je,b as Ke,A as Xe,c as Ze,R as Qe,D as Pe}from"./DiscussionsContainer-BuGCkASE.js";import{u as fe}from"./useBadge-CXrRArG9.js";import{P as qe}from"./PageTitle-CORj4igL.js";import{D as es,A as ss}from"./DiscussionTour-D2xwyV4k.js";import{S as ts}from"./SendFileForm-VOKs8Va9.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};l.SENTRY_RELEASE={id:"2d6c35713634c8052e41534f4a9f7d04cf04849f"};var a=new l.Error().stack;a&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[a]="2ae65904-92b5-4792-846e-b4df4badf3a3",l._sentryDebugIdIdentifier="sentry-dbid-2ae65904-92b5-4792-846e-b4df4badf3a3")}catch{}})();const ls=()=>e.jsxs("div",{className:"flex flex-col gap-1 py-2 px-3 border-b border-border-default",children:[e.jsxs("div",{className:"flex flex-row gap-3 justify-between",children:[e.jsx(C,{className:"flex flex-shrink-0 w-4 h-4"}),e.jsxs("div",{className:"flex gap-2 w-full",children:[e.jsx(C,{className:"flex flex-shrink-0 w-10 h-10 !rounded-full"}),e.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[e.jsx(C,{className:"w-full h-[20px]"}),e.jsx(C,{className:" mt-2 w-full h-[10px]"})]})]})]}),e.jsx(C,{className:" mt-2 w-full h-[10px]"})]}),is=()=>{const l=Array.from(Array(10).keys());return e.jsx("div",{className:"w-full",children:l.map(a=>e.jsx(ls,{},`${a}-discussions-row-loader`))})},ns=()=>e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(C,{className:"mb-1 w-2/6 h-[24px]"}),e.jsx(C,{className:"mb-1 w-3/6 h-[21px]"})]}),as=()=>e.jsxs("div",{"data-testid":"loading_discussion",className:"flex flex-col p-3 w-full",children:[e.jsx(ns,{}),e.jsx(C,{className:"w-full h-full"})]}),os=({discussion:l,isMultipleEdit:a})=>{const{selectedDiscussion:t}=y(),{t:s}=F("chat"),{update:x,loading:N}=ue({discussion:l||t,isMultipleEdit:a});return e.jsx(H,{color:"transparent",icon:"readNotification",iconHoverColor:"#072337",iconColor:we.colors.text.secondary,saving:N,title:s("header_right.read_for_team"),onClick:()=>x({readForMedicalTeam:!0},"toasts.discussion_read_for_team")})},T={trash:null,archived:null,_read:null,participant_type:null,inbox:null,users:null,my_patients:null,my_team:null},cs=({setQueryParams:l,queryParams:a})=>{const{t}=F("chat"),{setLoadingDiscussions:s,setDiscussions:x}=y(),N=i.useCallback(o=>{s(!0),l(o),x([])},[x,s,l]),{getConstant:k}=je(),b=i.useCallback(o=>{const r=_e(o,k);return r.group&&!r.group.endsWith("s")?{...r,group:`${r.group}s`}:r},[k]),h=i.useMemo(()=>({_read:a._read===!1?"true":null,users:a.users}),[a]),E=ve({url:X("users",void 0,{context:"discussion"}),property:"users",label:t("filter_drawer.by_user_placeholder"),inMoreFilter:!0,multiple:!0,buildOption:b,componentProps:{showSelectAll:!1,
2className:"min-w-[110px]",paperClassName:"min-w-[250px]"}}),L=i.useMemo(()=>{const o=[];return o.push({name:"_read",label:t("filters.not_read"),type:Ne.toggle,inMoreFilter:!0,attributes:{withNull:!0}}),o.push(E),o},[t,E]);return e.jsx(De,{hideFilterLabel:!0,values:h,filters:L,onFilter:o=>{const r={_read:null},d=o.users;d!=null&&d.length&&(r.users=d.map(({value:A})=>A)),o._read&&(r._read=!1),N({...T,...r})}})};Z(Me)`
3  border: 0;
4  span {
5    padding: 0;
6  }
7  svg {
8    width: 20px;
9    height: 20px;
10    path {
11      fill: #9ca7af;
12    }
13  }
14`;function rs({tabsElement:l,refresh:a,onPaginate:t,queryParams:s,setQueryParams:x,page:N,closeDrawer:k,loading:b}){const{discussions:h,setDiscussions:E,setLoadingDiscussions:L,selectedDiscussion:o,loadingDiscussions:r}=y(),{t:d}=F("chat"),{user:A}=oe(ce),{discussions:{total:w}}=fe(),{update:G,loading:u}=ue({discussion:o,isMultipleEdit:!0,updateAll:!0}),[n,S]=i.useState(!1),[D,$]=i.useState(!1),[p,U]=i.useState(!1),B=i.useCallback(c=>{c&&c.length>3?x({search:c}):x({search:null}),setTimeout(()=>{U(!0)})},[x]);i.useEffect(()=>{b||U(!1)},[p,b]);const M=()=>{const c=!D,j=h.map(m=>({...m,selected:c}));E(j)};i.useEffect(()=>{n&&L(u)},[u,n,L]);const W=i.useMemo(()=>{var m;if(!r&&!(h!=null&&h.length))return!!(s!=null&&s.search)||(s==null?void 0:s._read)===!1||((m=s==null?void 0:s.users)==null?void 0:m.length)||!!(s!=null&&s.participant_type)?e.jsx("div",{className:"flex justify-center m-3",children:e.jsx(ke,{color:"warning",size:"small",children:d("no_discussions_found")})}):s!=null&&s.participant?e.jsx("p",{className:"m-3",children:d("no_discussions_with_user")}):e.jsxs("div",{className:"flex flex-col gap-1 m-3",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary",children:d("no_discussions")}),e.jsx("p",{className:"text-sm text-text-secondary",children:d("no_discussions_subtitle")})]});let c=!1;const j=h.map((_,g)=>(_.selected&&(c=!0),e.jsx("div",{className:z("w-full border-l-[3px]",(o==null?void 0:o.id)===_.id?"border-l-[#6179D9]":"border-l-transparent",g<h.length?"border-t border-border-default":""),children:e.jsx(Ye,{isFocused:(o==null?void 0:o.id)===_.id,discussion:_,search:s==null?void 0:s.search,isTrash:s==null?void 0:s.trash,closeDrawer:k})},`${_.id}-discussion-row`)));return $(c),j},[k,h,r,o==null?void 0:o.id,s,d]),Y=c=>{const j=c==null?void 0:c.target;j.scrollHeight<=j.scrollTop+j.offsetHeight+1&&t()},I=()=>{S(!0),G({read:!0},"toasts.marked_discussions_as_read")};return e.jsx("div",{className:z("flex flex-col w-full lg:w-1/4 lg:min-w-[280px] xl:min-w-[400px] overflow-hidden","max-h-full lg:border-r border-border-default"),"data-testid":"discussion_header_left",children:e.jsxs("div",{className:"flex overflow-hidden flex-col h-full bg-white rounded-lg",children:[e.jsx("div",{className:"block lg:hidden px-4 pt-4",children:l}),e.jsxs("div",{className:"flex flex-row gap-2 items-center py-2 px-4",children:[e.jsxs("div",{className:`flex flex-row items-center sm:gap-x-1 xl:gap-x-2 ${D?"w-full justify-between overflow-y-auto":""}`,children:[e.jsx(Se,{containerClassName:"block",className:"!flex pr-1",name:"select-all-discussions-checkbox",checked:D,onChange:()=>{$(!D),M()}}),D&&e.jsxs("div",{className:"flex flex-row gap-2 self-end",children:[Ce(A)&&e.jsx(os,{isMultipleEdit:!0}),(s==null?void 0:s._read)!==!1&&e.jsx(Je,{isMultipleEdit:!0}),(s==null?void 0:s._read)==!1&&e.jsx(Ke,{isMultipleEdit:!0}),e.jsx(Xe,{refresh:a,isMultipleEdit:!0,archived:!!(s!=null&&s.archived)}),e.jsx(Ze,{isMultipleEdit:!0}),(s==null?void 0:s.trash)&&e.jsx(Qe,{isMultipleEdit:!0})]})]}),!D&&e.jsxs("div",{className:"flex flex-1 gap-2 items-center min-w-0 text-text-secondary",children:[e.jsx(H,{color:"secondary",icon:"refresh",iconSize:16,onClick:a,tooltip:d("refresh")}),e.jsx(Ee,{className:"flex-1 min-w-0",name:"search",defaultValue:s.search??null,placeholder:d("search_placeholder"),onSearch:B}),e.jsx(cs,{queryParams:s,setQueryParams:x})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1 py-0.5",onScroll:Y,children:p||r&&!h.length?e.jsx(is,{}):W}),u&&e.jsx("p",{className:"flex gap-2 justify-center p-2 text-sm text-center border-t border-border-default",children:e.jsx(le,{})}),w>0&&!u&&s._read!==!1&&h.filter(c=>c.selected).length>1&&e.jsx("button",{onClick:I,children:e.jsx("p",{className:"flex gap-2 justify-center p-2 text-sm text-center border-t border-border-default",children:e.jsx("p",{className:"items-center p-2 text-sm font-semibold text-center text-primary-500 bg-white",children:d("mark_all_as_read",{discussionsNbr:w})})})}),N>1&&r?e.jsxs("p",{className:"flex gap-2 justify-center p-2 text-sm text-center border-t border-border-default",children:[e.jsx(le,{}),e.jsx("span",{children:d("loading_messages")})]}):e.jsx(e.Fragment,{})]})})}const ds=i.lazy(()=>K(()=>import("./NewDiscussion-BreDx6RO.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),us=({queryParams:l,setQueryParams:a})=>{const{t}=F("chat"),{newDiscussion:s,setNewDiscussion:x}=y();return e.jsx("div",{className:"p-3 w-full h-full",children:e.jsxs("div",{className:"flex flex-col gap-6 justify-center items-center w-full h-full bg-background-primary rounded-xl",children:[e.jsx(re,{}),e.jsx("h2",{className:"text-xl font-semibold text-center text-text-secondary whitespace-pre-wrap",children:t("no_discussion_found_title")}),e.jsx("h3",{className:"text-center text-text-secondary whitespace-pre-wrap",children:t("no_discussion_found",{filter:"_read"in l&&!l._read?t("filters.not_read"):l.archived?t("filters.archived"):t("filters.all")})}),e.jsx(xe,{icon:"add",color:"primary",onClick:()=>x({selected:!0}),children:t("new_message")}),s&&e.jsx(i.Suspense,{fallback:e.jsx(de,{}),children:e.jsx(ds,{setQueryParams:a})})]})})},xe=Z(H)``,fs=()=>{const{t:l}=F("chat"),{setNewDiscussion:a}=y();return e.jsx("div",{className:"p-3 w-full h-full",children:e.jsxs("div",{className:"flex flex-col gap-6 justify-center items-center p-8 w-full h-full bg-background-primary rounded-xl",children:[e.jsx(re,{}),e.jsx(xs,{icon:"add",color:"primary",onClick:()=>a({selected:!0}),children:l("new_message")})]})})},xs=Z(H)``,hs=({onClose:l})=>{const{t:a}=F("chat");return e.jsx(Te,{title:a("send_file"),onClose:l,children:e.jsx("div",{className:"p-4 bg-white rounded-md border border-border-default",children:e.jsx(ts,{onComplete:l})})})},ps=()=>{const{openDrawer:l,closeDrawer:a}=Fe(),t=i.useCallback(()=>{a()},[a]);return{onOpen:i.useCallback(()=>
14{l({content:e.jsx(hs,{onClose:t}),size:"medium"})},[t,l]),onClose:t}},bs=i.lazy(()=>K(()=>import("./Discussion-Ca8zyRK2.js"),__vite__mapDeps([7,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19,5,6,20]))),gs=i.lazy(()=>K(()=>import("./NewDiscussion-BreDx6RO.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),ms=["search","_read","participant","archived","participant_type"],ws={archived:!1},he=l=>X("discussions",Le(l),{include:"owner,participants,lastMessage,CC,patientsTagged,patientsTagged.user"});function js(){var ee,se,te;const{user:l}=oe(ce),a=((ee=l==null?void 0:l.attributes)==null?void 0:ee.role)===Ae.PATIENT,{t}=F("chat"),{minLg:s,md:x}=Ie(),N=Oe(),k=Re(),b=ye(),[h,E]=i.useState(!1),{tab:L,setTab:o,setDiscussions:r,newDiscussion:d,setNewDiscussion:A,setSelectedDiscussion:w,loadingDiscussions:G,discussions:u,selectedDiscussion:n,setLoadingDiscussions:S,setSettingsDiscussions:D}=y(),{addToast:$}=me(),{discussions:p}=fe(),{fetchData:U,loading:B}=ie({url:ne(),skip:!0,method:"get"}),{data:M}=ie({method:"get",skip:a,url:X("settings/discussions")}),{onOpen:W}=ps(),{currentPage:Y,loading:I,data:c,called:j,queryParams:m,setData:_,setQueryParams:g,onPaginate:pe}=Ue(ne(),ws,void 0,{},ms),be=i.useCallback(async f=>{const O=He(u,f,"updatedDate","desc");r(O),_(O),(n==null?void 0:n.id)===f.id&&w(f)},[n==null?void 0:n.id,w,u,r,_]);$e("discussions",be);const v=s,[V,Q]=i.useState(!1);i.useEffect(()=>{D(M)},[M,D]),i.useEffect(()=>{c&&c.length&&(async()=>{let f=N.hash.replace("#","");b!=null&&b.discussion&&(f=b.discussion);const O=c.find(R=>`${R.attributes._id}`===f);let J;if(f&&!O)try{J=await U(void 0,{url:he(f),throw:!0})}catch{}J?(w(J.data),r(c.map(R=>({...R,selected:!1})))):(w(v?O??null:O??c[0]),r(c.map(R=>({...R,selected:!1})))),m.archived!==!1&&E(!0),S(!1)})(),m.participant&&A({selected:!0})},[c,b==null?void 0:b.discussion,U,t,$]),i.useEffect(()=>{n&&k.push(`/v2/discussions${N.search}#${n.attributes._id}`)},[n,k,N.search]),i.useEffect(()=>{window.history.replaceState(null,"",window.location.origin+window.location.pathname+window.location.search),E(!1),w(null)},[m,w,h]);const ge=i.useMemo(()=>a?[{key:"all",label:t("tabs.all"),icon:"messageNav",count:p.total},{key:"sent_messages",label:t("tabs.sent_messages"),icon:"send",count:p.inbox},{key:"archived",label:t("tabs.archived"),icon:"archive",count:p.archived}]:[{key:"all",label:t("tabs.all"),icon:"messageNav",count:p.total},{key:"my_team",label:t("tabs.my_team"),icon:"userTeam",count:p.team},{key:"my_patients",label:t("tabs.my_patients"),icon:"users",count:p.patient},{key:"sent_messages",label:t("tabs.sent_messages"),icon:"send",count:p.inbox},{key:"archived",label:t("tabs.archived"),icon:"archive",count:p.archived},{key:"trash",label:t("tabs.trash"),icon:"delete",count:p.trash}],[p,a,t]);i.useEffect(()=>{!I&&j&&!B&&!c.length&&S(!1)},[I,j,B,S]),i.useEffect(()=>{Q(!n)},[n]);const P=e.jsx(We,{className:"overflow-auto flex-nowrap max-w-full",tabs:ge,selectedTab:L,onTabChange:f=>{S(!0),r([]),o(f),g(f==="archived"?{...T,archived:!0}:f==="my_team"?{...T,my_team:!0}:f==="my_patients"?{...T,my_patients:!0}:f==="trash"?{...T,trash:!0}:f==="sent_messages"?{...T,inbox:!0}:{...T,archived:!1})}}),q=e.jsx(rs,{loading:I,refresh:()=>{S(!0),g({page:1}),_([]),r([])},tabsElement:P,queryParams:m,setQueryParams:g,onPaginate:()=>{pe()&&S(!0)},page:Y});return e.jsxs(Pe,{className:z("flex flex-col mb-0 lg:mb-2 w-full",!v&&V&&"mx-[-15px] w-[calc(100%+30px)] bg-white"),lg:v,md:x,children:[e.jsx(qe,{value:((se=n==null?void 0:n.attributes)==null?void 0:se.title)??t("discussions_title"),options:(te=n==null?void 0:n.attributes)!=null&&te.title?{title:n.attributes.title}:void 0}),e.jsx(es,{target:"page"}),e.jsxs(ae,{discussionId:n==null?void 0:n.id,children:[(v||V)&&e.jsxs("div",{className:"flex flex-row flex-shrink-0 justify-between items-center px-4 sm:px-0 pt-4 pb-4 bg-body",children:[e.jsx("div",{className:"flex flex-row gap-3",children:e.jsxs(Be,{className:"flex gap-4 items-center",children:[e.jsx("span",{children:t("discussions_title")}),!a&&!!(M!=null&&M.disablePatientMessaging)&&e.jsx("span",{title:t("discussions_disabled"),children:e.jsx(Ve,{icon:"personOffOutline"})})]})}),e.jsxs("div",{className:"flex gap-4",children:[ze(l)&&e.jsx(H,{onClick:W,children:t("send_file")}),e.jsx(xe,{breakpoint:!1,icon:"add",id:ss,color:"primary","data-testid":"new_message_button",onClick:()=>A({selected:!0}),children:t(v?"new_message":"message")})]})]}),!v&&V&&q,e.jsx(Ge,{className:z("overflow-hidden h-full rounded-xl",V&&"hidden lg:flex"),contentClassName:"overflow-hidden h-full",headerClassName:"overflow-hidden max-w-full",headerTitleClassName:"max-w-full",containerClassName:"overflow-hidden h-full !p-0",hideHeader:!v,scrollable:!1,title:v?P:null,children:e.jsxs("div",{className:"flex overflow-hidden flex-col lg:flex-row flex-1 w-full h-full border-t border-border-default",children:[v&&q,e.jsx("div",{className:"flex overflow-hidden w-full h-full",children:I||G&&!(u!=null&&u.length)?e.jsx(as,{}):u!=null&&u.length&&n?e.jsx(i.Suspense,{fallback:e.jsx(de,{}),children:e.jsx(bs,{onClickBack:v?void 0:()=>Q(!0)})}):u!=null&&u.length?e.jsx(fs,{}):e.jsx(us,{setQueryParams:g,queryParams:m})})]})})]}),d&&e.jsx(i.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(ae,{discussionId:n==null?void 0:n.id,children:e.jsx(gs,{setQueryParams:g})})})]})}const Es=Object.freeze(Object.defineProperty({__proto__:null,DISCUSSION_URL:he,default:js},Symbol.toStringTag,{value:"Module"}));
14export{Es as D,ns as H,os as M};

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.