%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/www/startup-life/assets/
Upload File :
Create Path :
Current File : /home/opti/www/startup-life/assets/add-community-members-04dde5ff.js

import{F as $,u as L,j as e,C as P,Q as b}from"./index-5492fbe1.js";import{D}from"./dashboard-footer-navigation-f658b457.js";import{P as _}from"./index-4de96b18.js";import{C as o}from"./index-2c4b8b3c.js";import{u as z}from"./index-9f8785a2.js";import{u as B}from"./update-stream-users.api-08113ef6.js";import{u as H}from"./post-notification.api-d7cee9b0.js";import{u as O}from"./get-all-users-as-vendor.api-465b5409.js";import{C as Q}from"./Checkbox-5f253e47.js";const ee=({channel:n,refetch:v,refetch_channels:y,...C})=>{const{handleSelectedMembers:E,selectedMembers:a,handleShowAddMembers:x,addMembersType:M,setSelectedMembers:U}=C,c=$(),{data:l,isLoading:p,isError:h}=O(c.id),S=L(),{client:r}=z(),m=l==null?void 0:l.data,{mutateAsync:A}=B(),{mutateAsync:w}=H(),k=async()=>{var f;if(!r){console.error("Stream Chat client is not initialized");return}const s=await r.channel("messaging",c.id,{name:(f=n==null?void 0:n.data)==null?void 0:f.name});if(!await s.watch())return;const I=a.map(t=>t.id.toString()),F=a.map(t=>t.email),T=a.map(t=>`${t.firstName} ${t.lastName}`);A({userIds:I}).then(async t=>{var g,j,N;let d=[];for(const i in t.users)d=[...d,t.users[parseInt(i)].id];const R=await n.inviteMembers([...d]);console.log(R),w({message:`You have been invited by ${(g=r==null?void 0:r.user)==null?void 0:g.name} to join ${(j=s==null?void 0:s.data)==null?void 0:j.name} channel.`,email:[...F],to:[...a.map(i=>parseInt(i.id))],fullName:[...T],channelId:(N=s==null?void 0:s.data)==null?void 0:N.id}).then(i=>{console.log(i),S(`/groups/view-community/${c.id}`),v(),y(),x(),U([]),b.success("Invite sent to the selected users successfully")}).catch(i=>{console.log(i),b.error("error while creating notification")})})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"!px-5",children:[e.jsx("div",{className:"flex justify-between items-center mt-3",children:e.jsxs("header",{className:"text-[#537473] text-lg font-semibold",children:["Add Members via ",M==="share-link"?"Slack Link":"StartUpLife"]})}),e.jsx(o,{appear:!!a.length,children:e.jsx("div",{className:"!p-5 bg-[#e3e6e9] rounded-xl !mt-5 sticky top-28 z-20",children:e.jsx("ul",{className:"text-xs font-light text-[#537473] flex gap-x-3",children:a.map(s=>e.jsxs("li",{children:["@",s.firstName]},s.id))})})}),e.jsx(o,{appear:p,children:e.jsx(P,{})}),e.jsx(o,{appear:h,children:e.jsx("h3",{children:"ERR_INTERNET_CONNECTION_REFUSED"})}),e.jsx(o,{appear:!p&&!h,children:e.jsx("ul",{className:"space-y-10 !mt-10",children:m==null?void 0:m.map(s=>e.jsxs("li",{className:"flex items-center justify-between gap-x-5 ",children:[e.jsxs("div",{className:"flex items-center gap-x-5 ",children:[e.jsx("div",{className:"h-[52px] w-[52px]  rounded-full",children:e.jsx(_,{imgUrl:s.avatarUrl,name:s.firstName})}),e.jsxs("div",{children:[e.jsx("p",{children:s.email}),e.jsx("p",{children:s.accountType})]})]}),e.jsx(Q,{sx:{color:"#A8CF45","&.Mui-checked":{color:"#A8CF45"}},checked:!!a.find(u=>u.id===s.id),onChange:()=>E(s)})]},s.id))})})]}),e.jsx(D,{backBtnText:"Back",cancelEventHandler:x,continueEventHandler:k})]})};export{ee as A};

Zerion Mini Shell 1.0