%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/public_html/startup-life/assets/
Upload File :
Create Path :
Current File : /home/opti/public_html/startup-life/assets/index-bdffed3f.js

import{am as Z,d as $,e as q,j as e,u as O,C as Q,Q as g,r as T}from"./index-5492fbe1.js";import{C as m}from"./index-2c4b8b3c.js";import{h as z}from"./moment-a9aaa855.js";import{u as V}from"./index-9f8785a2.js";import{u as Y}from"./useQuery-0abbcf43.js";import{u as G}from"./post-notification.api-d7cee9b0.js";import{u as B}from"./get-all-startuplife-users.api-644aad92.js";import{u as K}from"./get-all-notifications-8280d5e9.js";import"./isNativeReflectConstruct-061ae640.js";import"./setPrototypeOf-0bb37fbe.js";import"./assertThisInitialized-081f9914.js";const X=n=>{const s=async()=>{var r;try{return(await q.post(`/notification/${n}`)).data}catch(l){return(r=l.response)==null?void 0:r.data}},t=Z();return $({mutationFn:s,onSuccess:()=>{t.invalidateQueries(["get_all_nots"])}})},H=n=>{const s=async()=>{var r;try{return(await q.post(`/notification/unread/${n}`)).data}catch(l){return(r=l.response)==null?void 0:r.data}},t=Z();return $({mutationFn:s,onSuccess:()=>{t.invalidateQueries(["get_all_nots"])}})},J=()=>e.jsxs("svg",{width:"57",height:"57",viewBox:"0 0 57 57",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"28.2471",cy:"28.4219",r:"28",fill:"#EE6D00"}),e.jsx("path",{d:"M29.6477 38.3156C28.9277 38.3156 28.1677 38.2489 27.341 38.1156L21.0877 37.1289C19.1144 36.8223 17.5944 36.2756 16.461 35.4756C13.541 33.4489 13.7144 29.9689 14.0877 27.5289L15.0744 21.2756C15.981 15.5423 18.941 13.3956 24.6744 14.2889L30.9277 15.2756C33.8744 15.7423 37.8344 16.9289 38.0877 21.9023C38.141 22.7556 38.0877 23.7289 37.901 24.8756L36.9277 31.1289C36.1544 36.0223 33.8744 38.3156 29.6477 38.3156ZM22.2877 16.0889C19.1144 16.0889 17.6744 17.7023 17.0477 21.5956L16.061 27.8489C15.4477 31.7823 16.5677 33.1156 17.6077 33.8489C18.4877 34.4756 19.7277 34.9023 21.3944 35.1556L27.6477 36.1423C32.301 36.8756 34.221 35.4756 34.9544 30.8089L35.9277 24.5556C36.0877 23.5556 36.141 22.7156 36.0877 22.0089V21.9956C35.941 19.1956 34.3544 17.8223 30.6077 17.2356L24.3677 16.2623C23.5944 16.1423 22.9144 16.0889 22.2877 16.0889Z",fill:"white"}),e.jsx("path",{d:"M31.8207 42.7558C30.6874 42.7558 29.4074 42.5158 27.9274 42.0225L21.9141 40.0225C18.4874 38.8891 16.6341 37.2625 16.0741 34.8891C15.9807 34.4891 16.1407 34.0625 16.4874 33.8358C16.8341 33.6091 17.2874 33.6091 17.6207 33.8491C18.5007 34.4758 19.7274 34.9025 21.3941 35.1558L27.6474 36.1425C32.3007 36.8758 34.2207 35.4758 34.9541 30.8091L35.9274 24.5558C36.0874 23.5558 36.1407 22.7158 36.0874 22.0091C36.0741 21.6625 36.2474 21.3158 36.5541 21.1158C36.8607 20.9158 37.2474 20.9025 37.5674 21.0758C41.1407 22.9825 42.0874 26.0358 40.5407 30.7025L38.5407 36.7158C37.5941 39.5425 36.3541 41.2758 34.6207 42.1425C33.7807 42.5558 32.8607 42.7558 31.8207 42.7558ZM19.8874 36.9025C20.5274 37.3291 21.3807 37.7425 22.5407 38.1291L28.5541 40.1291C30.8474 40.8891 32.4874 40.9558 33.7141 40.3558C34.9407 39.7425 35.8741 38.3825 36.6341 36.0891L38.6341 30.0758C39.7274 26.7691 39.3007 25.0091 38.0341 23.8225C38.0074 24.1558 37.9541 24.5025 37.9007 24.8758L36.9274 31.1291C36.0207 36.8625 33.0607 39.0091 27.3274 38.1291L21.0741 37.1425C20.6607 37.0625 20.2607 36.9825 19.8874 36.9025Z",fill:"white"}),e.jsx("path",{d:"M23.2337 25.3822C21.4071 25.3822 19.9137 23.8889 19.9137 22.0622C19.9137 20.2355 21.4071 18.7422 23.2337 18.7422C25.0604 18.7422 26.5537 20.2355 26.5537 22.0622C26.5537 23.8889 25.0604 25.3822 23.2337 25.3822ZM23.2337 20.7555C22.5137 20.7555 21.9137 21.3422 21.9137 22.0755C21.9137 22.8089 22.5004 23.3955 23.2337 23.3955C23.9537 23.3955 24.5537 22.8089 24.5537 22.0755C24.5537 21.3422 23.9537 20.7555 23.2337 20.7555Z",fill:"white"})]}),W=({title:n,setClick:s,createdAt:t,isRead:i,notificationId:r})=>{const{mutateAsync:l}=X(r),{mutateAsync:c,isPending:o}=H(r);return e.jsxs("div",{className:"relative p-5 flex items-center justify-between rounded-xl border cursor-pointer w-[598px] h-[86px]",children:[e.jsxs("div",{onClick:()=>{l().then(a=>{o||(console.log(a),s(!0))})},className:`flex ${i?"text-gray-400":"text text-black"} w-full space-x-5 items-center justify-start`,children:[e.jsx(J,{}),e.jsx("div",{className:"items-center flex justify-between w-full",children:e.jsxs("div",{children:[e.jsx("p",{children:n}),e.jsx("p",{className:"text-sm",children:z(t).fromNow()})]})})]}),e.jsx(m,{appear:!!i,children:e.jsx("div",{children:e.jsx("button",{className:"!text-black",onClick:()=>{c().then(a=>{console.log(a)})},type:"button",children:o?"unreading...":"unread"})})})]})},ee=({setClick:n,showNot:s})=>{var R;const{client:t,decoded:i}=V(),r=O(),{mutateAsync:l}=G(),{data:c}=B();async function o(){var x;try{const d={type:"messaging",members:{$in:[i.user_id]}},f=[{last_message_at:-1}],p=(await t.queryChannels(d,f,{watch:!0,state:!0,limit:30})).filter(h=>h.id===(s==null?void 0:s.channelId));return p.length>0?(console.log(p[0]),p[0]):[]}catch(d){return console.log(d),(x=d.response)==null?void 0:x.data}}const{data:a,isPending:S,isError:A,isLoading:M}=Y({queryFn:o,queryKey:["fetch_channel",s==null?void 0:s.channelId],enabled:!!t&&!!i&&!!c}),P=async()=>{var x,d,f,b,p,h,N,_,L,E,u;try{const v=await(await t.channel("messaging",(x=a==null?void 0:a.data)==null?void 0:x.id,{name:(d=a==null?void 0:a.data)==null?void 0:d.name})).queryMembers({},{created_at:-1},{});if(!v)return[];const w=v.members;console.log(t.user.id),console.log(w);const I=w.filter(y=>y.user_id===t.user.id);if(console.log(I),I[0].status!=="pending"){g.error("you are already a member of this channel");return}const C=await a.acceptInvite({message:{text:`${(f=t==null?void 0:t.user)==null?void 0:f.name} joined this channel!`}});if(C){const y=(b=c==null?void 0:c.data)==null?void 0:b.filter(k=>{var U,F;return k.id.toString()===((F=(U=C==null?void 0:C.channel)==null?void 0:U.created_by)==null?void 0:F.id)});console.log(y),l({message:`${(p=t==null?void 0:t.user)==null?void 0:p.name} accepted the invite to join your channel ${(h=C==null?void 0:C.channel)==null?void 0:h.name}.`,email:[(N=y[0])==null?void 0:N.email],to:[(_=y[0])==null?void 0:_.id],fullName:[`${(L=y[0])==null?void 0:L.firstName} ${(E=y[0])==null?void 0:E.lastName}`],channelId:(u=a==null?void 0:a.data)==null?void 0:u.id}).then(()=>{g.success("Invite accepted. You will be added to the channel"),r("/dashboard")}).catch(k=>{console.log(k),g.error("error while creating notification")})}}catch(j){console.log(j),g.error("couldn't accept invite")}},D=async()=>{var x,d,f,b,p,h,N,_,L;try{if(await a.rejectInvite()){const u=await a.removeMembers([(x=t==null?void 0:t.user)==null?void 0:x.id]);if(u){const j=(d=c==null?void 0:c.data)==null?void 0:d.filter(v=>{var w,I;return v.id.toString()===((I=(w=u==null?void 0:u.channel)==null?void 0:w.created_by)==null?void 0:I.id)});l({message:`${(f=t==null?void 0:t.user)==null?void 0:f.name} rejected the invite to join your channel ${(b=u==null?void 0:u.channel)==null?void 0:b.name}.`,email:[(p=j[0])==null?void 0:p.email],to:[(h=j[0])==null?void 0:h.id],fullName:[`${(N=j[0])==null?void 0:N.firstName} ${(_=j[0])==null?void 0:_.lastName}`],channelId:(L=a==null?void 0:a.data)==null?void 0:L.id}).then(()=>{g.success("You rejected this invite. You will be removed from this channel"),r("/dashboard")}).catch(v=>{console.log(v),g.error("error while creating notification")})}}}catch(E){console.log(E),g.error("couldn't reject invite. you already rejected this invite")}};return e.jsxs("div",{className:"flex flex-col items-center w-[410px] h-[258px] bg-white border rounded-xl shadow-t-xl z-10000 shadow-b",children:[e.jsx(m,{appear:M,children:e.jsx(Q,{})}),e.jsxs(m,{appear:S&&!M,children:[e.jsx(Q,{})," Resolving..."]}),e.jsx(m,{appear:A,children:e.jsx("div",{className:"px-[40px]",children:"ERR_INTERNET_CONNECTION_REFUSED"})}),e.jsxs(m,{appear:!M&&!A&&!S&&a,children:[e.jsx("div",{className:"flex items-center justify-between p-4 w-full",children:e.jsx("div",{className:"cursor-pointer",onClick:()=>n(!1),children:"X"})}),e.jsx("hr",{className:"border w-full"}),e.jsxs("div",{className:"flex flex-col items-start justify-start rounded-b-xl p-5 bg-white z-10000",children:[e.jsx("p",{className:"font-bold text-start",children:s==null?void 0:s.title}),e.jsx("p",{className:"mt-12 text-sm",children:s==null?void 0:s.message}),e.jsx("p",{className:"text-sm text-gray-400 mt-3 ",children:z(s==null?void 0:s.createdAt).fromNow()}),e.jsx(m,{appear:(R=s==null?void 0:s.message)==null?void 0:R.includes("invited"),children:e.jsxs("div",{className:"button mt-[20px] flex gap-[40px]",children:[e.jsx("button",{type:"button",onClick:P,className:"bg-[#A8CF45] capitalize font-[500] px-[20px] py-[10px] text-[#fff]",children:"accept invite"}),e.jsx("button",{type:"button",onClick:D,className:"bg-gray-400 capitalize font-[500] px-[20px] py-[10px] text-[#000]",children:"reject invite"})]})})]})]})]})},te=()=>$({mutationFn:async()=>{var t;try{return(await q.post("/notification/read-all")).data}catch(i){return(t=i.response)==null?void 0:t.data}}}),se=({notifications:n})=>{const[s,t]=T.useState(!1),[i,r]=T.useState(!0),{mutateAsync:l}=te(),c=O();return console.log(n),e.jsxs("div",{className:"relative flex items-center py-16 px-12 ",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>l().then(o=>{console.log(o),c(-1)}),type:"button",className:"",children:"Mark all as read"})}),n.map((o,a)=>e.jsx(W,{title:o.title,createdAt:o.createdAt,icon:o.icon,isRead:o.isRead,notificationId:o.id,setClick:()=>{t(!0),r(o)}},a))]}),s&&e.jsx("div",{className:"absolute top-8 right-48",children:e.jsx(ee,{showNot:i,setClick:t})})]})},ne="/assets/empty-2edcadd8.png",ae=()=>e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsxs("div",{className:"flex flex-col space-y-6 items-center justify-center m-auto pt-36",children:[e.jsx("img",{src:ne,alt:"alt img"}),e.jsx("p",{className:"text-center",children:"View your dashboard reports here"})]})}),he=()=>{var i,r;const{data:n,isLoading:s,isError:t}=K();return console.log(n),e.jsxs("div",{className:"flex flex-col relative h-full w-full",children:[e.jsx(m,{appear:s,children:"Loading notifications..."}),e.jsx(m,{appear:t,children:"Error: INTERNET_CONNECTION_REFUSED"}),e.jsx(m,{appear:!s&&!t&&((i=n==null?void 0:n.data)==null?void 0:i.length)===0,children:e.jsx(ae,{})}),e.jsx(m,{appear:!s&&!t&&((r=n==null?void 0:n.data)==null?void 0:r.length)>0,children:e.jsx(se,{notifications:n==null?void 0:n.data})})]})};export{he as default};

Zerion Mini Shell 1.0