dappros/ethora

View on GitHub
client-web/build-prod/static/js/163.1ec23ead.chunk.js

Summary

Maintainability
A
0 mins
Test Coverage
"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[163],{59715:function(e,n,t){t.d(n,{A:function(){return d}});t(72791);var r=t(17205),i=t(60788),l=t(77248),a=t(8440),s=t(39571),o=t(40464),c=t(80184);function d(e){var n=e.open,t=e.onClose,d=e.onDeletePress,u=e.loading,h=e.title,x=e.description,p=e.deleteButtonTitle,f=e.cancelButtonTitle;return(0,c.jsxs)(i.Z,{open:n,onClose:t,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,c.jsx)(o.Z,{id:"alert-dialog-title",children:h}),(0,c.jsx)(a.Z,{children:(0,c.jsx)(s.Z,{id:"alert-dialog-description",children:x})}),(0,c.jsxs)(l.Z,{children:[(0,c.jsx)(r.Z,{disabled:u,onClick:t,children:f||"Cancel"}),(0,c.jsx)(r.Z,{disabled:u,onClick:d,autoFocus:!0,color:"error",children:p||"Delete"})]})]})}},84163:function(e,n,t){t.r(n),t.d(n,{default:function(){return je}});var r=t(1413),i=t(70885),l=t(72791),a=t(50228),s=t(94293),o=t(90166),c=t(4565),d=t(13811),u=t(11210),h=t(85545),x=t(19924),p=t(8343),f=t(91482),Z=t(80184),m=function(e){var n=(0,u.K)((function(e){return e.blackList})),t=function(e){console.log(e),p.Z.removeUserFromBlackList(e),p.Z.getBlackList()};return(0,Z.jsx)(a.Z,{style:{margin:"20px"},children:(0,Z.jsxs)(a.Z,{children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Users you have blocked"}),(0,Z.jsx)(c.Z,{children:"The blocked users cannot message you or view your profile. Tap the bin icon if you wish to remove the block."}),n.map((function(e){return(0,Z.jsx)(j,{handleRemove:t,userItem:e})}))]})})};function j(e){var n=e.userItem,t=e.handleRemove;return(0,Z.jsxs)(a.Z,{style:{marginTop:"20px",display:"flex",alignItems:"center",justifyContent:"space-between",maxWidth:"300px"},children:[(0,Z.jsxs)(a.Z,{style:{alignItems:"center",display:"flex",justifyContent:"space-around"},children:[(0,Z.jsx)(h.Z,{fontSize:"large"}),(0,Z.jsxs)(a.Z,{style:{marginLeft:"10px"},children:[(0,Z.jsx)(c.Z,{children:n.fullName}),(0,Z.jsx)(c.Z,{children:(0,f.Z)(new Date(1e3*n.date),"dd MMMM yyyy")})]})]}),(0,Z.jsx)(d.Z,{onClick:function(){return t(n.user)},children:(0,Z.jsx)(x.Z,{color:"error"})})]})}var g=t(74165),y=t(15861),b=t(52791),v=t(52775),k=t(47409),w=t(14250),S=t(17205),C=t(81898),D=t(40508),L=t(63381),T=t(70324),M=t(59911),z=t(80925),A=t(73763),I=t(24177),W=t(28741),N=function(e){var n=e.user,t=e.createdLink,r=e.linkType,i=function(){return"profile"===r?(0,I.nx)({firstName:n.firstName,lastName:n.lastName,walletAddress:t.walletAddress,xmppId:(0,W.I)(n.walletAddress)+A.Ts,linkToken:t.token}):"document"===r?(0,I.ME)({linkToken:t.token}):void 0};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z.Z,{size:226,style:{height:"60vh",maxWidth:"100%",width:"100%"},value:i(),viewBox:"0 0 256 256"}),(0,Z.jsxs)(b.Z,{sx:{boxShadow:"2px 0px 5px 0px rgba(0,0,0,0.75)",borderRadius:"10px",display:"flex",justifyContent:"space-between",alignItems:"center",pl:"10px",my:"10px"},children:[(0,Z.jsx)("span",{children:(0,I.aS)(i(),50)}),(0,Z.jsx)(S.Z,{variant:"contained",sx:{borderRadius:"10px"},onClick:function(){return navigator.clipboard.writeText(i())},children:"Copy"})]})]})},E=3600,O=24*E,R=7*O,P=4*R,K=function(e){var n=e.getSharedLinks,t=l.useState((-1).toString()),r=(0,i.Z)(t,2),s=r[0],o=r[1],d=l.useState(""),h=(0,i.Z)(d,2),x=h[0],p=h[1],f=l.useState(""),m=(0,i.Z)(f,2),j=m[0],b=m[1],v=l.useState(!1),w=(0,i.Z)(v,2),C=w[0],D=w[1],L=l.useState({_id:"",expiration:"",memo:"",resource:"",token:"",updatedAt:"",userId:"",walletAddress:"",createdAt:""}),T=(0,i.Z)(L,2),M=T[0],z=T[1],A=(0,u.K)((function(e){return e.user})),I=(0,u.K)((function(e){return e.documents})),W=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(){var t,r,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={expiration:(new Date).getTime()+1e3*+s,memo:x,resource:"document",documentId:j},D(!0),e.prev=2,e.next=5,(0,k.h1)(t);case 5:r=e.sent,i=r.data,console.log(i),z(i.sharelinkData),n(),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),console.log(e.t0);case 15:D(!1);case 16:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(){return e.apply(this,arguments)}}();return(0,Z.jsxs)(a.Z,{style:{display:"flex",alignItems:"flex-start",flexDirection:"column",margin:"20px"},children:[(0,Z.jsxs)(a.Z,{children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Create a Document Sharing link"}),(0,Z.jsx)(c.Z,{children:"Send this link to your trusted contact(s) so they can access your profile when you're in Restricted mode.."}),(0,Z.jsx)(c.Z,{fontWeight:"light",fontStyle:"italic",fontSize:"12px",children:"Note: you'll be able to remove this link any time if you change your mind."})]}),(0,Z.jsx)(V,{selectedValue:s,handleChange:function(e){return o(e)},description:"If you set this, this link will only be valid for the given period of time",title:"Expiration",type:"menu1"}),(0,Z.jsx)(V,{selectedValue:j,handleChange:function(e){return b(e)},description:"Choose the Document you would like to share.",title:"Document",type:"menu2",documents:I}),(0,Z.jsx)(V,{selectedValue:x,handleChange:function(e){return p(e)},description:"Add an optional note so that you remember who you shared this with.",title:"Memo",type:"input"}),(0,Z.jsxs)(a.Z,{children:[(0,Z.jsx)(c.Z,{fontSize:"15px",fontWeight:"bold",children:"Here you go!"}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:"Your unique link and QR code have been created. You can share them using buttons below."}),(0,Z.jsx)(c.Z,{fontWeight:"light",fontStyle:"italic",fontSize:"12px",children:'Note: use "Manage" tab in case you want to copy or modify your sharing link in future.'}),(0,Z.jsx)(a.Z,{style:{marginTop:"20px"},children:M.walletAddress?(0,Z.jsx)(N,{createdLink:M,user:A,linkType:"document"}):(0,Z.jsx)(S.Z,{disabled:C,onClick:W,variant:"contained",children:"Generate Link"})})]})]})};function V(e){var n=e.handleChange,t=e.selectedValue,r=e.title,i=e.description,l=e.type,s=e.documents;return(0,Z.jsxs)(a.Z,{style:{margin:"10px"},children:[(0,Z.jsx)(c.Z,{fontSize:"15px",fontWeight:"bold",children:r}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:i}),"menu1"===l?(0,Z.jsxs)(C.Z,{sx:{minWidth:120,marginTop:"20px"},children:[(0,Z.jsx)(D.Z,{id:"demo-simple-select-helper-label",children:"Expiration"}),(0,Z.jsxs)(L.Z,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:t,label:"Expiration",onChange:function(e){return n(e.target.value)},children:[(0,Z.jsx)(T.Z,{value:(-1).toString(),children:"No Expiration"}),(0,Z.jsx)(T.Z,{value:E.toString(),children:"1 hour"}),(0,Z.jsx)(T.Z,{value:O.toString(),children:"1 day"}),(0,Z.jsx)(T.Z,{value:R.toString(),children:"1 week"}),(0,Z.jsx)(T.Z,{value:P.toString(),children:"1 month"})]})]}):null,"menu2"===l?(0,Z.jsxs)(C.Z,{sx:{minWidth:120,marginTop:"20px"},children:[(0,Z.jsx)(D.Z,{id:"demo-simple-select-helper-label",children:"Choose Document"}),(0,Z.jsx)(L.Z,{size:"medium",style:{width:"120px"},labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:t,label:"Choose document",onChange:function(e){return n(e.target.value)},children:s.map((function(e){return(0,Z.jsx)(T.Z,{value:e._id,children:e.documentName})}))})]}):null,"input"===l?(0,Z.jsx)(a.Z,{style:{marginTop:"20px"},children:(0,Z.jsx)(M.Z,{onChange:function(e){return n(e.target.value)},id:"outlined-basic",label:"shared with Alice",variant:"outlined"})}):null]})}var B=t(96580),Y=t(11542),U=t(39568),_=t(27247),F=function(e){var n=e.handleChangeTab,t=e.loading,r=e.sharedLinks,i=e.handleOpenModal,l=e.deleteLink;return(0,Z.jsxs)(a.Z,{style:{margin:"10px",display:"flex",flexDirection:"column"},children:[(0,Z.jsxs)(a.Z,{style:{flexDirection:"row",display:"flex",alignItems:"center",margin:"10px",marginLeft:0},children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Current Document Shares"}),(0,Z.jsx)(S.Z,{style:{width:"150px",marginLeft:"10px"},onClick:function(e){return n(e,1)},variant:"contained",children:"+ Add a share"})]}),(0,Z.jsx)(c.Z,{children:"Listed below are your currently active document sharing links. You can share or delete them."}),t?(0,Z.jsx)(B.Z,{}):null,r.length?r.map((function(e,n){return(0,Z.jsx)(G,{handleOpenModal:i,linkItem:e,docLink:(0,I.ME)({linkToken:e.token}),deleteLink:l},e._id)})):null]})};function G(e){var n=e.linkItem,t=e.key,r=e.handleOpenModal,i=e.docLink,l=e.deleteLink;return(0,Z.jsxs)(a.Z,{style:{margin:"10px",marginTop:"40px"},children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:n.memo}),(0,Z.jsxs)(a.Z,{style:{flexDirection:"row",display:"flex",alignItems:"center"},children:[(0,Z.jsxs)(a.Z,{children:[(0,Z.jsxs)(c.Z,{children:["Created at:"," ",(0,f.Z)(new Date(n.createdAt),"MMMM dd yyyy, hh:mm")]}),(0,Z.jsxs)(c.Z,{children:["Expires:"," ",-1!==+n.expiration?(0,f.Z)(new Date(n.expiration),"MMMM dd yyyy hh:mm"):""]})]}),(0,Z.jsxs)(a.Z,{marginLeft:"50px",children:[(0,Z.jsx)(d.Z,{onClick:function(){return r(i)},color:"inherit",children:(0,Z.jsx)(Y.Z,{fontSize:"large"})}),(0,Z.jsx)(d.Z,{onClick:function(){return navigator.clipboard.writeText(i)},color:"inherit",children:(0,Z.jsx)(U.Z,{fontSize:"large"})}),(0,Z.jsx)(d.Z,{onClick:function(){return l(n.token)},color:"inherit",children:(0,Z.jsx)(_.Z,{fontSize:"large"})})]})]})]},t)}function Q(e){return{id:"simple-tab-".concat(e),"aria-controls":"simple-tabpanel-".concat(e)}}var q=function(e){var n=l.useState(0),t=(0,i.Z)(n,2),a=t[0],c=t[1],d=l.useState(!1),h=(0,i.Z)(d,2),x=h[0],p=h[1],f=l.useState(!1),m=(0,i.Z)(f,2),j=m[0],S=m[1],C=l.useState([]),D=(0,i.Z)(C,2),L=D[0],T=D[1],M=l.useState(""),z=(0,i.Z)(M,2),A=z[0],I=z[1],W=((0,u.K)((function(e){return e.user})),(0,v.D)().showSnackbar),N=function(e,n){c(n)},E=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(){var n,t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(!0),e.prev=1,e.next=4,(0,k.i8)();case 4:n=e.sent,t=n.data,T(t.items.filter((function(e){return"document"===e.resource}))),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.log(e.t0);case 12:S(!1);case 13:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(n){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,k.le)(n);case 3:return t=e.sent,t.data,e.next=7,E();case 7:W("success","Link deleted successfully"),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.log(e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}();return l.useEffect((function(){E()}),[]),(0,Z.jsxs)(b.Z,{children:[(0,Z.jsxs)(s.Z,{style:{display:"flex"},value:a,onChange:N,"aria-label":"basic tabs example",children:[(0,Z.jsx)(o.Z,(0,r.Z)({label:"Manage"},Q(0))),(0,Z.jsx)(o.Z,(0,r.Z)({label:"Add"},Q(1)))]}),0===a&&(0,Z.jsx)(F,{handleChangeTab:N,sharedLinks:L,loading:j,handleOpenModal:function(e){I(e),p(!0)},deleteLink:O}),1===a&&(0,Z.jsx)(K,{getSharedLinks:E}),(0,Z.jsx)(w.z,{open:x,link:A,onClose:function(){return p(!1)}})]})},H=t(70043),$=t(64880),J=t(59715),X=function(e){var n=l.useState(!1),t=(0,i.Z)(n,2),r=t[0],s=t[1],o=l.useState(!1),d=(0,i.Z)(o,2),h=d[0],x=d[1],f=(0,v.D)().showSnackbar,m=(0,u.K)((function(e){return e.clearUser})),j=(0,u.K)((function(e){return e.user})),b=(0,$.k6)(),w=(0,H.Ge)(),C=w.active,D=w.deactivate,L=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!0),e.prev=1,e.next=4,(0,k.Ey)();case 4:f("success","Account deleted successfully"),T(),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.log(e.t0),f("error","Something went wrong");case 12:x(!1),s(!1);case 14:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),T=function(){m(),p.Z.stop(),C&&D(),b.push("/")},M=function(e){var n="data:text/json;chatset=utf-8,".concat(encodeURIComponent(JSON.stringify(e))),t=document.createElement("a");t.href=n,t.download=j.firstName+" "+j.lastName+" personal data.json",t.click(),t.remove()},z=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(){var n,t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!0),e.prev=1,e.next=4,(0,k.Vy)().get("/users/exportData");case 4:n=e.sent,t=n.data,M(t),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.log(e.t0);case 12:x(!1);case 13:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(){return e.apply(this,arguments)}}();return(0,Z.jsxs)(a.Z,{sx:{display:"flex",alignItems:"flex-start",flexDirection:"column",margin:"20px",width:"50vw"},children:[(0,Z.jsxs)(a.Z,{sx:{width:"100%"},children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Download your data"}),(0,Z.jsx)(c.Z,{children:"You own your data. Tap the button below to download a copy of your data"}),(0,Z.jsx)(a.Z,{sx:{display:"flex",justifyContent:"center"},children:(0,Z.jsx)(S.Z,{sx:{margin:"0 auto"},disabled:h,onClick:z,variant:"contained",children:"Download my data"})})]}),(0,Z.jsxs)(a.Z,{sx:{marginTop:"20px",width:"100%"},children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Delete your account"}),(0,Z.jsx)(c.Z,{children:"Use this only if you want to permanently delete your account & data from our system."}),(0,Z.jsx)(c.Z,{fontWeight:"light",fontStyle:"italic",fontSize:"12px",children:"Note: due to the immutable nature of distributed ledger technology, network nodes operated by the community may still retain historical transactions generated by your account, however your personally identifiable information such as your name, e-mail, your key-value storage etc will be removed."}),(0,Z.jsx)(c.Z,{fontWeight:"light",fontStyle:"italic",fontSize:"12px",children:"Any of your digital assets will be lost."}),(0,Z.jsx)(a.Z,{sx:{display:"flex",justifyContent:"center"},children:(0,Z.jsx)(S.Z,{color:"error",onClick:function(){return s(!0)},variant:"contained",children:"Delete my account"})})]}),(0,Z.jsx)(J.A,{onDeletePress:L,loading:h,onClose:function(){return s(!1)},open:r,title:"Delete Account",description:"This will result in a complete deletion of your account and assets. Are you sure you want to proceed?"})]})},ee=function(e){var n=e.handleChangeTab,t=e.sharedLinks,r=e.loading,i=e.handleOpenModal,l=e.profileLink,s=e.deleteLink;return(0,Z.jsxs)(a.Z,{style:{margin:"10px",display:"flex",flexDirection:"column"},children:[(0,Z.jsxs)(a.Z,{style:{flexDirection:"row",display:"flex",alignItems:"center",margin:"10px",marginLeft:0},children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Current Profile Shares"}),(0,Z.jsx)(S.Z,{style:{width:"150px",marginLeft:"10px"},onClick:function(e){return n(e,1)},variant:"contained",children:"+ Add a share"})]}),(0,Z.jsx)(c.Z,{children:"Listed below are your currently active profile sharing links. You can share or delete them."}),r?(0,Z.jsx)(B.Z,{}):null,t.length?t.map((function(e,n){return(0,Z.jsx)(ne,{handleOpenModal:i,linkItem:e,profileLink:l,deleteLink:s},e._id)})):null]})};function ne(e){var n=e.linkItem,t=e.key,r=e.handleOpenModal,i=e.profileLink,l=e.deleteLink;return(0,Z.jsxs)(a.Z,{style:{margin:"10px",marginTop:"40px"},children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:n.memo}),(0,Z.jsxs)(a.Z,{style:{flexDirection:"row",display:"flex",alignItems:"center"},children:[(0,Z.jsxs)(a.Z,{children:[(0,Z.jsxs)(c.Z,{children:["Created at:"," ",(0,f.Z)(new Date(n.createdAt),"MMMM dd yyyy, hh:mm")]}),(0,Z.jsxs)(c.Z,{children:["Expires:"," ",-1!==+n.expiration?(0,f.Z)(new Date(n.expiration),"MMMM dd yyyy hh:mm"):""]})]}),(0,Z.jsxs)(a.Z,{marginLeft:"50px",children:[(0,Z.jsx)(d.Z,{onClick:r,color:"inherit",children:(0,Z.jsx)(Y.Z,{fontSize:"large"})}),(0,Z.jsx)(d.Z,{onClick:function(){return navigator.clipboard.writeText(i)},color:"inherit",children:(0,Z.jsx)(U.Z,{fontSize:"large"})}),(0,Z.jsx)(d.Z,{onClick:function(){return l(n.token)},color:"inherit",children:(0,Z.jsx)(_.Z,{fontSize:"large"})})]})]})]},t)}var te=3600,re=24*te,ie=7*re,le=4*ie;function ae(e){var n=e.handleChange,t=e.selectedValue,r=e.title,i=e.description,l=e.type;return(0,Z.jsxs)(a.Z,{style:{margin:"10px"},children:[(0,Z.jsx)(c.Z,{fontSize:"15px",fontWeight:"bold",children:r}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:i}),"menu"===l?(0,Z.jsxs)(C.Z,{sx:{minWidth:120,marginTop:"20px"},children:[(0,Z.jsx)(D.Z,{id:"demo-simple-select-helper-label",children:"Expiration"}),(0,Z.jsxs)(L.Z,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:t,label:"Expiration",onChange:function(e){return n(e.target.value)},children:[(0,Z.jsx)(T.Z,{value:(-1).toString(),children:"No Expiration"}),(0,Z.jsx)(T.Z,{value:te.toString(),children:"1 hour"}),(0,Z.jsx)(T.Z,{value:re.toString(),children:"1 day"}),(0,Z.jsx)(T.Z,{value:ie.toString(),children:"1 week"}),(0,Z.jsx)(T.Z,{value:le.toString(),children:"1 month"})]})]}):(0,Z.jsx)(a.Z,{style:{marginTop:"20px"},children:(0,Z.jsx)(M.Z,{onChange:function(e){return n(e.target.value)},id:"outlined-basic",label:"shared with Alice",variant:"outlined"})})]})}var se=function(e){var n=e.getSharedLinks,t=l.useState((-1).toString()),r=(0,i.Z)(t,2),s=r[0],o=r[1],d=l.useState(""),h=(0,i.Z)(d,2),x=h[0],p=h[1],f=l.useState({_id:"",expiration:"",memo:"",resource:"",token:"",updatedAt:"",userId:"",walletAddress:"",createdAt:""}),m=(0,i.Z)(f,2),j=m[0],b=m[1],v=l.useState(!1),w=(0,i.Z)(v,2),C=w[0],D=w[1],L=(0,u.K)((function(e){return e.user})),T=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(){var t,r,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={expiration:(new Date).getTime()+1e3*+s,memo:x,resource:"profile"},D(!0),e.prev=2,e.next=5,(0,k.h1)(t);case 5:r=e.sent,i=r.data,console.log(i),b(i.sharelinkData),n(),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),console.log(e.t0);case 15:D(!1);case 16:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(){return e.apply(this,arguments)}}();return(0,Z.jsxs)(a.Z,{style:{display:"flex",alignItems:"flex-start",flexDirection:"column",margin:"20px"},children:[(0,Z.jsxs)(a.Z,{children:[(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Create a Profile Sharing link"}),(0,Z.jsx)(c.Z,{children:"Send this link to your trusted contact(s) so they can access your profile when you're in Restricted mode.."}),(0,Z.jsx)(c.Z,{fontWeight:"light",fontStyle:"italic",fontSize:"12px",children:"Note: you'll be able to remove this link any time if you change your mind."})]}),(0,Z.jsx)(ae,{selectedValue:s,handleChange:function(e){return o(e)},description:"If you set this, this link will only be valid for the given period of time",title:"Expiration",type:"menu"}),(0,Z.jsx)(ae,{selectedValue:x,handleChange:function(e){return p(e)},description:"Add an optional note so that you remember who you shared this with.",title:"Memo",type:"input"}),(0,Z.jsxs)(a.Z,{children:[(0,Z.jsx)(c.Z,{fontSize:"15px",fontWeight:"bold",children:"Here you go!"}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:"Your unique link and QR code have been created. You can share them using buttons below."}),(0,Z.jsx)(c.Z,{fontWeight:"light",fontStyle:"italic",fontSize:"12px",children:'Note: use "Manage" tab in case you want to copy or modify your sharing link in future.'}),(0,Z.jsx)(a.Z,{style:{marginTop:"20px"},children:j.walletAddress?(0,Z.jsx)(N,{createdLink:j,user:L,linkType:"profile"}):(0,Z.jsx)(S.Z,{disabled:C,onClick:T,variant:"contained",children:"Generate Link"})})]})]})};function oe(e){return{id:"simple-tab-".concat(e),"aria-controls":"simple-tabpanel-".concat(e)}}var ce=function(e){var n=l.useState(0),t=(0,i.Z)(n,2),c=t[0],d=t[1],h=l.useState(!1),x=(0,i.Z)(h,2),p=x[0],f=x[1],m=l.useState([]),j=(0,i.Z)(m,2),b=j[0],v=j[1],S=l.useState(!1),C=(0,i.Z)(S,2),D=C[0],L=C[1],T=l.useState(!1),M=(0,i.Z)(T,2),z=(M[0],M[1]),N=(0,u.K)((function(e){return e.user})),E=function(e,n){d(n)},O=(0,I.nx)({firstName:N.firstName,lastName:N.lastName,walletAddress:N.walletAddress,xmppId:(0,W.I)(N.walletAddress)+A.Ts,linkToken:N.token}),R=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(){var n,t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,(0,k.i8)();case 4:n=e.sent,t=n.data,v(t.items.filter((function(e){return"profile"===e.resource}))),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.log(e.t0);case 12:f(!1);case 13:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(){return e.apply(this,arguments)}}(),P=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(n){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,k.le)(n);case 3:return t=e.sent,t.data,e.next=7,R();case 7:z(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.log(e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}();return l.useEffect((function(){R()}),[]),(0,Z.jsxs)(a.Z,{children:[(0,Z.jsxs)(s.Z,{style:{display:"flex"},value:c,onChange:E,"aria-label":"basic tabs example",children:[(0,Z.jsx)(o.Z,(0,r.Z)({label:"Manage"},oe(0))),(0,Z.jsx)(o.Z,(0,r.Z)({label:"Add"},oe(1)))]}),0===c?(0,Z.jsx)(ee,{handleChangeTab:E,sharedLinks:b,loading:p,profileLink:O,handleOpenModal:function(){return L(!0)},deleteLink:P}):null,1===c?(0,Z.jsx)(se,{getSharedLinks:R}):null,(0,Z.jsx)(w.z,{open:D,link:O,onClose:function(){return L(!1)}})]})},de=t(50120),ue=t(97265),he=t(72900),xe=t(86321),pe={open:"true",restricted:"false",full:"true",individual:"false"},fe=function(e){var n=e.handleChangeTab,t=(0,u.K)((function(e){return e.updateUserProfilePermission})),r=(0,u.K)((function(e){return e.updateUserDocumentsPermission})),a=(0,u.K)((function(e){return e.user})),s=(0,l.useState)(a.isProfileOpen?"open":"restricted"),o=(0,i.Z)(s,2),d=o[0],h=o[1],x=(0,l.useState)(a.isAssetsOpen?"full":"individual"),p=(0,i.Z)(x,2),f=p[0],m=p[1],j=(0,l.useState)(null),w=(0,i.Z)(j,2),D=w[0],L=w[1],T=(0,v.D)().showSnackbar;console.log(f);var M=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(n){var r,i,l,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="full"===n,i=pe[n],L("profile"),e.prev=3,(l=new FormData).append("isProfileOpen",i),e.next=8,(0,k.$5)(l);case 8:a=e.sent,a.data,T("success","Profile permissions updated"),t(r),h(n),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),console.log(e.t0);case 18:L(null);case 19:case"end":return e.stop()}}),e,null,[[3,15]])})));return function(n){return e.apply(this,arguments)}}(),z=function(){var e=(0,y.Z)((0,g.Z)().mark((function e(n){var t,i,l,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return L("assets"),t="full"===n,i=pe[n],e.prev=3,(l=new FormData).append("isAssetsOpen",i),e.next=8,(0,k.$5)(l);case 8:a=e.sent,a.data,T("success","Assets permissions updated"),r(t),m(n),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),console.log(e.t0);case 18:L(null);case 19:case"end":return e.stop()}}),e,null,[[3,15]])})));return function(n){return e.apply(this,arguments)}}();return(0,Z.jsxs)(b.Z,{sx:{margin:"20px",flexDirection:"column",display:"flex",alignItems:"center"},children:[(0,Z.jsxs)(C.Z,{children:[(0,Z.jsx)(de.Z,{id:"demo-radio-buttons-group-label",children:"Profile Visiblility"}),(0,Z.jsxs)(ue.Z,{"aria-labelledby":"demo-radio-buttons-group-label",value:d,name:"radio-buttons-group",onChange:function(e,n){return M(n)},children:[(0,Z.jsx)(he.Z,{value:"open",control:(0,Z.jsx)(xe.Z,{}),label:(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Open (default)"})}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:"Your profile can be viewed by anyone who follows your profile link or QR code"}),(0,Z.jsx)(he.Z,{value:"restricted",control:(0,Z.jsx)(xe.Z,{}),label:(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Restricted"})}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:"Only users with your permission or temporary secure link can see your profile"})]})]}),(0,Z.jsx)(S.Z,{sx:{marginTop:"10px",marginBottom:"20px"},disabled:"profile"===D,onClick:function(e){return n(e,1)},variant:"contained",children:"Manage profile shares"}),(0,Z.jsxs)(C.Z,{children:[(0,Z.jsx)(de.Z,{id:"demo-radio-buttons-group-label",children:"Documents Visiblility"}),(0,Z.jsxs)(ue.Z,{"aria-labelledby":"demo-radio-buttons-group-label",value:f,name:"radio-buttons-group",onChange:function(e,n){return z(n)},children:[(0,Z.jsx)(he.Z,{value:"full",control:(0,Z.jsx)(xe.Z,{}),label:(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Full (default)"})}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:"Show all Documents to those who can see your profile"}),(0,Z.jsx)(he.Z,{value:"individual",control:(0,Z.jsx)(xe.Z,{}),label:(0,Z.jsx)(c.Z,{fontWeight:"bold",children:"Individual"})}),(0,Z.jsx)(c.Z,{fontSize:"15px",children:"You need to share each document individually before others can see them"})]})]}),(0,Z.jsx)(S.Z,{sx:{marginTop:"10px",marginBottom:"20px"},disabled:"assets"===D,fullWidth:!1,onClick:function(e){return n(e,2)},variant:"contained",children:"Manage documents shares"})]})};function Ze(e){return{id:"simple-tab-".concat(e),"aria-controls":"simple-tabpanel-".concat(e)}}var me={display:"flex",justifyContent:"center"},je=function(){var e=(0,l.useState)(0),n=(0,i.Z)(e,2),t=n[0],c=n[1],d=function(e,n){c(n)};return(0,Z.jsxs)(a.Z,{sx:{borderBottom:1,borderColor:"divider"},children:[(0,Z.jsxs)(s.Z,{value:t,onChange:d,"aria-label":"basic tabs example",children:[(0,Z.jsx)(o.Z,(0,r.Z)({label:"Visibility"},Ze(0))),(0,Z.jsx)(o.Z,(0,r.Z)({label:"Profile Shares"},Ze(1))),(0,Z.jsx)(o.Z,(0,r.Z)({label:"Document Shares"},Ze(2))),(0,Z.jsx)(o.Z,(0,r.Z)({label:"Blocking"},Ze(3))),(0,Z.jsx)(o.Z,(0,r.Z)({label:"Manage Data"},Ze(4)))]}),0===t&&(0,Z.jsx)(a.Z,{sx:me,children:(0,Z.jsx)(fe,{handleChangeTab:d})}),1===t&&(0,Z.jsx)(a.Z,{sx:me,children:(0,Z.jsx)(ce,{})}),2===t&&(0,Z.jsx)(a.Z,{sx:me,children:(0,Z.jsx)(q,{})}),3===t&&(0,Z.jsx)(a.Z,{sx:me,children:(0,Z.jsx)(m,{})}),4===t&&(0,Z.jsx)(a.Z,{sx:me,children:(0,Z.jsx)(X,{})})]})}},14250:function(e,n,t){t.d(n,{z:function(){return h}});t(72791);var r=t(60788),i=t(40464),l=t(17205),a=t(13811),s=t(52791),o=t(80925),c=t(24177),d=t(29823),u=t(80184),h=function(e){var n=e.title,t=e.open,h=e.link,x=e.onClose;return(0,u.jsxs)(r.Z,{maxWidth:!1,open:t,onClose:x,children:[!!n&&(0,u.jsx)(i.Z,{sx:{padding:"0 24px",paddingTop:"20px"},children:n}),(0,u.jsxs)(s.Z,{sx:{padding:"20px"},children:[(0,u.jsx)(o.Z,{size:256,style:{height:"50vh",maxWidth:"100%",width:"100%"},value:h,viewBox:"0 0 256 256"}),(0,u.jsxs)(s.Z,{sx:{boxShadow:"0px 0px 10px -5px rgba(0,0,0,0.75)",borderRadius:"10px",display:"flex",justifyContent:"space-between",alignItems:"center",pl:"10px",my:"10px"},children:[(0,u.jsx)("span",{children:(0,c.aS)(h,50)}),(0,u.jsx)(l.Z,{variant:"contained",sx:{borderRadius:"10px",marginLeft:"5px"},onClick:function(){return navigator.clipboard.writeText(h)},children:"Copy"})]}),(0,u.jsx)(a.Z,{onClick:x,sx:{color:"black",position:"absolute",top:10,right:10,fontSize:"30px"},children:(0,u.jsx)(d.Z,{fontSize:"inherit"})})]})]})}}}]);
//# sourceMappingURL=163.1ec23ead.chunk.js.map