@abtnode/webapp 1.16.20 → 1.16.21-beta-edf184e1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/build/asset-manifest.json +27 -26
  4. package/build/index.html +1 -1
  5. package/build/service-worker.js +1 -1
  6. package/build/static/js/1294.5b08d5e3.chunk.js +1 -0
  7. package/build/static/js/{1667.3001639f.chunk.js → 1667.488a600b.chunk.js} +1 -1
  8. package/build/static/js/2183.e57ce8a2.chunk.js +1 -0
  9. package/build/static/js/2435.88762f30.chunk.js +1 -0
  10. package/build/static/js/2443.00426c01.chunk.js +1 -0
  11. package/build/static/js/{3389.72b7e591.chunk.js → 3389.282a0683.chunk.js} +1 -1
  12. package/build/static/js/4382.bd7f7f72.chunk.js +2 -0
  13. package/build/static/js/4471.a41284d9.chunk.js +1 -0
  14. package/build/static/js/{6490.8f3553c2.chunk.js → 4509.231da63f.chunk.js} +2 -2
  15. package/build/static/js/4549.5fda7728.chunk.js +1 -0
  16. package/build/static/js/{4775.b0cede7b.chunk.js → 4775.19ec4c25.chunk.js} +1 -1
  17. package/build/static/js/4906.aced1b76.chunk.js +1 -0
  18. package/build/static/js/5059.b85795c1.chunk.js +1 -0
  19. package/build/static/js/{5672.b32c024f.chunk.js → 5672.19e3e3e6.chunk.js} +1 -1
  20. package/build/static/js/{5804.996e83bb.chunk.js → 5804.c02bc104.chunk.js} +2 -2
  21. package/build/static/js/{5979.bd3d3c0f.chunk.js → 5979.4e4ebbf1.chunk.js} +1 -1
  22. package/build/static/js/6230.b1753197.chunk.js +1 -0
  23. package/build/static/js/6511.623f368a.chunk.js +1 -0
  24. package/build/static/js/{6580.8cdb4aa4.chunk.js → 6580.fc3c74eb.chunk.js} +1 -1
  25. package/build/static/js/{6931.e9297d29.chunk.js → 6931.a2586ea5.chunk.js} +1 -1
  26. package/build/static/js/{7022.02d74e90.chunk.js → 7022.9d96c66f.chunk.js} +1 -1
  27. package/build/static/js/7706.74e51876.chunk.js +2 -0
  28. package/build/static/js/{9552.82c09530.chunk.js → 9552.3effa95b.chunk.js} +1 -1
  29. package/build/static/js/main.e3082f6b.js +2 -0
  30. package/package.json +1 -1
  31. package/build/static/js/1294.8ccea539.chunk.js +0 -1
  32. package/build/static/js/1633.5c43bf43.chunk.js +0 -2
  33. package/build/static/js/3826.d40f6fa7.chunk.js +0 -2
  34. package/build/static/js/4435.5212440d.chunk.js +0 -1
  35. package/build/static/js/4448.d67840f3.chunk.js +0 -1
  36. package/build/static/js/4471.c2380391.chunk.js +0 -1
  37. package/build/static/js/4906.b8af826c.chunk.js +0 -1
  38. package/build/static/js/6511.978080d1.chunk.js +0 -1
  39. package/build/static/js/8382.e1c429ed.chunk.js +0 -1
  40. package/build/static/js/8973.639c0cf3.chunk.js +0 -1
  41. package/build/static/js/9277.babc5673.chunk.js +0 -1
  42. package/build/static/js/main.c88b220e.js +0 -2
  43. /package/build/static/css/{3826.a5e3e6d6.chunk.css → 4382.a5e3e6d6.chunk.css} +0 -0
  44. /package/build/static/css/{8973.9cab926a.chunk.css → 6230.9cab926a.chunk.css} +0 -0
  45. /package/build/static/js/{3826.d40f6fa7.chunk.js.LICENSE.txt → 4382.bd7f7f72.chunk.js.LICENSE.txt} +0 -0
  46. /package/build/static/js/{5804.996e83bb.chunk.js.LICENSE.txt → 4509.231da63f.chunk.js.LICENSE.txt} +0 -0
  47. /package/build/static/js/{6490.8f3553c2.chunk.js.LICENSE.txt → 5804.c02bc104.chunk.js.LICENSE.txt} +0 -0
  48. /package/build/static/js/{1633.5c43bf43.chunk.js.LICENSE.txt → 7706.74e51876.chunk.js.LICENSE.txt} +0 -0
  49. /package/build/static/js/{main.c88b220e.js.LICENSE.txt → main.e3082f6b.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[5672],{32322:(e,n,t)=>{"use strict";n.h1=void 0;const s=t(76811);function i(e){return(null===e||void 0===e?void 0:e.connectedAccounts)||[]}function r(e){return i(e).find((e=>e.provider===s.LOGIN_PROVIDER.WALLET))}n.h1=function(e){const n=r(e);return null===n||void 0===n?void 0:n.did}},15098:(e,n,t)=>{const{ROLES:s,PASSPORT_STATUS:i}=t(35432);e.exports={hasActiveOwnerPassport:e=>((null===e||void 0===e?void 0:e.passports)||[]).some((e=>e.role===s.OWNER&&e.status===i.VALID))}},92726:(e,n,t)=>{"use strict";t.d(n,{Z:()=>x});var s,i=t(71171),r=t(5057),a=t(55898),o=t.n(a),l=t(33518),c=t(67680),d=t(61533),m=t(74490),p=t(45267),u=t(46954),h=t(44067),f=t(96266);function x(e){let{actions:n,size:t,...s}=e;const[i,a]=(0,r.useState)(null),o=Boolean(i),l=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(null)};return(0,f.jsxs)(g,{...s,children:[(0,f.jsx)(c.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(e.currentTarget)},size:t,children:(0,f.jsx)(p.Z,{})}),(0,f.jsx)(d.Z,{id:"actions-menu","data-cy":"actions-menu",anchorEl:i,keepMounted:!0,open:o,onClose:l,PaperProps:{},children:n.map(((e,n)=>{if("function"===typeof e)return e({close:l});const{icon:t,text:s,onClick:i,disabled:a=!1,...o}=e;return(0,r.createElement)(m.Z,{...o,disabled:a,dense:!0,onClick:async e=>{await i(e),l()},key:n,"data-cy":"actions-menu-".concat(n)},(0,f.jsx)(u.Z,{style:{minWidth:24,marginRight:8},children:t}),(0,f.jsx)(h.Z,{primary:s}))}))})]})}x.propTypes={actions:o().array,size:o().oneOf(["small","medium","large"])},x.defaultProps={actions:[],size:"small"};const g=l.Z.div(s||(s=(0,i.Z)([""])))},50185:(e,n,t)=>{"use strict";t.d(n,{Z:()=>c});var s=t(5057),i=t(55898),r=t.n(i),a=t(12937),o=t(68420),l=t(96266);function c(e){let{children:n,...t}=e;const{t:i}=(0,s.useContext)(o.RD);return(0,l.jsx)(a.Z,{tip:i("common.copyTip"),copiedTip:i("common.copiedTip"),...t,children:n})}c.propTypes={children:r().any.isRequired}},9729:(e,n,t)=>{"use strict";t.d(n,{Z:()=>d});var s,i=t(71171),r=t(55898),a=t.n(r),o=t(33518),l=t(13727),c=t(96266);function d(e){const{passport:n,onDelete:t,...s}=e;return(0,c.jsxs)(m,{...s,children:[n.title||n.name," ",!!t&&(0,c.jsx)(l.default,{"data-cy":"delete-issuance",className:"delete",onClick:t})]})}d.propTypes={passport:a().object.isRequired,onDelete:a().func},d.defaultProps={onDelete:null};const m=o.Z.span(s||(s=(0,i.Z)(["\n display: inline-flex;\n padding: 2px 8px;\n background: ",";\n border-radius: 100vw;\n font-weight: 400;\n font-size: 12px;\n line-height: 22px;\n color: #fff;\n align-items: center;\n .delete {\n font-size: 1em;\n margin-left: 6px;\n cursor: pointer;\n }\n"])),(e=>e.theme.palette.primary.main))},75672:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>mn});var s,i=t(71171),r=t(5057),a=t(33518),o=t(75506),l=t.n(o),c=t(55898),d=t.n(c),m=t(52277),p=t.n(m),u=t(13128),h=t(75239),f=t(39948),x=t(26174),g=t(88092),v=t(44919),b=t(80578),y=t(72333),j=t(68420),Z=t(28726),S=t(68051),C=t(18945),P=t(49777),D=t(75760),w=t(49384),R=t(35432),k=t(10381),T=t(42061),E=t(86229),I=t(22228),N=t(17450),A=t(58238),z=t(17425),L=t(29054),B=t(63406),_=t(14491),O=t(44846),U=t(55372),W=t(11750),q=t(74490),F=t(51177),M=t(47020),V=t(6041),K=t(80576),J=t(88574),H=t(50185),X=t(96266);function $(e){let{teamDid:n,roles:t,onCancel:s,onSuccess:i,onError:a,endpoint:o}=e;const{api:l}=(0,A.h6)(),[c,d]=(0,r.useState)(!1),[m,p]=(0,r.useState)(""),{t:h,locale:f}=(0,j.PE)(),[x,g]=(0,r.useState)(0),[v,b]=(0,r.useState)(""),[y,S]=(0,r.useState)(""),[C,P]=(0,r.useState)(""),D=async()=>{if(!y)return void p(h("team.member.error.passportEmpty"));const e=C.trim();p(null),d(!0);try{const{inviteInfo:t}=await l.createMemberInvitation({input:{teamDid:n,role:y,remark:e}});b(t),g(1)}catch(t){const e=(0,_.Z)(t);p(e),a(t)}finally{d(!1)}},w=[{body:(0,X.jsxs)(W.Z,{component:"div",children:[(0,X.jsxs)(K.Z,{style:{width:"100%"},variant:"outlined",children:[(0,X.jsx)(V.Z,{children:h("common.passport")}),(0,X.jsx)(F.Z,{"data-cy":"invite-member-select-role",value:y,onChange:e=>{p(null),S(e.target.value)},fullWidth:!0,label:h("common.passport"),disabled:c,onKeyPress:e=>{"Enter"===e.key&&(e.preventDefault(),D())},children:t.filter((e=>"owner"!==e.name)).map((e=>(0,X.jsx)(q.Z,{value:e.name,"data-cy":"invite-member-select-option-".concat(e.name),children:(0,X.jsx)("span",{children:e.title||e.name})},e.name)))})]}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}}),(0,X.jsx)(M.Z,{label:h("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:C,onChange:e=>{p(null),P(e.target.value)},disabled:c,"data-cy":"invite-member-input-remark"}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:h("common.cancel"),confirm:h("team.member.inviteDialog.createInviteLink"),onCancel:s,onConfirm:D},{body:()=>{const e=(0,_.ly)({inviteId:v.inviteId,endpoint:o});return(0,X.jsxs)("div",{children:[(0,X.jsx)(G,{children:h("team.member.inviteDialog.createSuccessTip",{expireDate:(0,_.B2)(v.expireDate,f)})}),(0,X.jsx)("div",{style:{marginTop:"40px"}}),(0,X.jsx)(H.Z,{children:e})]})},confirm:h("common.confirm"),onConfirm:i}][x];return(0,X.jsxs)(u.ZP,{title:h("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[w.cancel&&(0,X.jsx)(Z.Z,{onClick:w.onCancel,color:"inherit",children:w.cancel}),(0,X.jsxs)(Z.Z,{onClick:w.onConfirm,color:"primary",disabled:c||!y,variant:"contained",autoFocus:!0,children:[c&&(0,X.jsx)(O.Z,{size:16}),w.confirm]})]}),children:[(0,X.jsx)(U.Z,{component:"div",children:"function"===typeof w.body?w.body():w.body}),!!m&&(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:m})]})}$.propTypes={teamDid:d().string.isRequired,onCancel:d().func.isRequired,onSuccess:d().func.isRequired,onError:d().func,roles:d().array,endpoint:d().string},$.defaultProps={onError:()=>{},roles:[],endpoint:""};const G=a.Z.div(s||(s=(0,i.Z)(["\n font-size: 16px;\n font-weight: bold;\n"])));var Y,Q=t(26796),ee=t(43681),ne=t.n(ee),te=t(49983),se=t(73545);function ie(e){let{teamDid:n,onCancel:t,onSuccess:s,onError:i,endpoint:a}=e;const{api:o,info:l}=(0,A.h6)(),{api:c}=(0,r.useContext)(se.B),[d,m]=(0,r.useState)(!1),{t:p,locale:h}=(0,j.PE)(),[f,x]=(0,r.useState)(""),[g,v]=(0,r.useState)(!1),[b,y]=(0,r.useState)(0),[S,C]=(0,r.useState)(""),[P,D]=(0,r.useState)(""),w=!!ne()(l,"ownerNft.did"),R=(0,Q.default)((async()=>{if(w){const{state:e}=await o.getDelegationState();return e}return{delegated:!0}}));if(R.loading)return(0,X.jsx)(u.ZP,{title:p("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:(0,X.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,X.jsx)(O.Z,{})})});if(R.error)return(0,X.jsx)(u.ZP,{title:p("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:(0,_.Z)(R.error)})});const k=async()=>{x(null),m(!0);try{const{inviteInfo:e}=await o.createTransferInvitation({input:{teamDid:n,role:"owner",remark:P.trim()}});C(e),y(E.length-1)}catch(e){const n=(0,_.Z)(e);x(n),i(e)}finally{m(!1)}},T=()=>{v(!1),y(0)},E=[{body:(0,X.jsxs)(W.Z,{component:"div",children:[(0,X.jsxs)(J.Z,{type:"warning",children:[(0,X.jsx)(W.Z,{children:p("team.transferNode.inviteDialog.tips.progress")}),(0,X.jsx)(W.Z,{children:p("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),(0,X.jsx)(J.Z,{type:"warning",children:(0,X.jsx)(W.Z,{children:p("team.transferNode.inviteDialog.tips.revoke")})}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}}),(0,X.jsx)(M.Z,{label:p("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:P,onChange:e=>{x(null),D(e.target.value)},disabled:d,"data-cy":"transfer-node-input-remark"}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:p("common.cancel"),confirm:p("team.transferNode.inviteDialog.createInviteLink"),onCancel:t,onConfirm:w&&!ne()(R,"value.delegated")?()=>{v(!0),y(1)}:k},{body:()=>(0,X.jsx)(te.Z,{action:"delegate-transfer-nft",open:g,locale:h,checkFn:c.get,onClose:T,onSuccess:k,checkTimeout:3e5,webWalletUrl:(0,_.yP)(l),extraParams:{targetDID:l.did},messages:{title:p("team.transferNode.delegateDialog.title"),scan:p("team.transferNode.delegateDialog.scan"),confirm:p("team.transferNode.delegateDialog.confirm"),success:p("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const e=(0,_.ly)({inviteId:S.inviteId,endpoint:a});return(0,X.jsxs)("div",{children:[(0,X.jsx)(re,{children:p("team.transferNode.inviteDialog.createSuccessTip",{expireDate:(0,_.B2)(S.expireDate,h)})}),(0,X.jsx)("div",{style:{marginTop:"40px"}}),(0,X.jsx)(H.Z,{children:e})]})},confirm:p("common.confirm"),onConfirm:s}],I=E[b];return(0,X.jsxs)(u.ZP,{title:p("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[I.cancel&&(0,X.jsx)(Z.Z,{onClick:I.onCancel,color:"inherit",children:I.cancel}),(0,X.jsxs)(Z.Z,{onClick:I.onConfirm,color:"primary",disabled:d,variant:"contained",autoFocus:!0,children:[d&&(0,X.jsx)(O.Z,{size:16}),I.confirm]})]}),children:[(0,X.jsx)(U.Z,{component:"div",children:"function"===typeof I.body?I.body():I.body}),!!f&&(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:f})]})}ie.propTypes={teamDid:d().string.isRequired,onCancel:d().func.isRequired,onSuccess:d().func.isRequired,onError:d().func,endpoint:d().string},ie.defaultProps={onError:()=>{},endpoint:""};const re=a.Z.div(Y||(Y=(0,i.Z)(["\n font-size: 16px;\n font-weight: bold;\n"])));var ae,oe=t(62681),le=t(94464),ce=t(64886),de=t(12987),me=t(71246),pe=t(12673),ue=t(76811),he=t(70461),fe=t(9729);function xe(e){let{issuances:n,teamDid:t,onRefresh:s}=e;const{api:i,inService:a}=(0,A.h6)(),{t:o,locale:l}=(0,r.useContext)(j.RD),[c,d]=(0,r.useState)(null),[m,p]=(0,r.useState)(!1),{endpoint:u}=(0,z.DJ)(),h=()=>{p(!1),d(null)},x=e=>u?(0,_._)({id:e.id,endpoint:u}):"";function g(e){let{data:n}=e;return(0,X.jsxs)("div",{className:"issuance",children:[(0,X.jsxs)(f.Z,{display:"flex",justifyContent:"space-between",children:[(0,X.jsx)(B.Z,{permission:a?"":"mutate_team",role:a?_.Wf:[],children:e=>e?(0,X.jsx)(fe.Z,{passport:{title:n.title,name:n.name},onDelete:()=>d({title:o("team.passport.issuance.delete.title"),description:o("team.passport.issuance.delete.description",{link:x(n)}),confirm:o("common.delConfirm"),cancel:o("common.cancel"),onConfirm:()=>{(async e=>{let{id:n}=e;if(!m){p(!0);try{await i.deletePassportIssuance({input:{teamDid:t,sessionId:n}}),s()}catch(r){E.Z.error(r.message)}finally{p(!1),d(null)}}})(n)},onCancel:h})}):(0,X.jsx)(fe.Z,{passport:{title:n.title,name:n.name}})}),(0,X.jsxs)("div",{style:{color:"#999"},children:[o("common.expires"),":\xa0",(0,_.B2)(n.expireDate,l)]})]}),(0,X.jsx)(f.Z,{mt:2,children:(0,X.jsx)(H.Z,{children:x(n)})})]})}return(0,X.jsxs)(ge,{children:[n.map((e=>(0,X.jsx)(g,{data:e}))),c&&(0,X.jsx)(he.Z,{title:c.title,description:c.description,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}const ge=a.Z.div(ae||(ae=(0,i.Z)(["\n .MuiTableHead-root {\n display: none;\n }\n .issuance {\n padding: 16px 0;\n border-bottom: 1px solid #f0f0f0;\n .MuiTypography-root {\n display: inline-block;\n width: 100%;\n background: #f3f3f3;\n border-radius: 4px;\n padding-top: 6px;\n padding-bottom: 6px;\n }\n }\n"])));xe.propTypes={teamDid:d().string.isRequired,issuances:d().array,onRefresh:d().func},xe.defaultProps={issuances:[],onRefresh:()=>{}};var ve=t(5178),be=t(32322),ye=t(87806),je=t(25710),Ze=t(82638),Se=t(18901);function Ce(e){let{teamDid:n,ownerDid:t,needReceive:s,roles:i,onCancel:a,onSuccess:o,onError:l,showOwnerPassport:c}=e;const{api:d}=(0,A.h6)(),[m,p]=(0,r.useState)(!1),[h,f]=(0,r.useState)(""),{t:x}=(0,j.PE)(),[g,v]=(0,r.useState)(""),b=async()=>{if(g){f(null),p(!0);try{await d.createPassportIssuance({input:{teamDid:n,name:g,ownerDid:t}}),o()}catch(e){const n=(0,_.Z)(e);f(n),l(e)}finally{p(!1)}}else f(x("team.member.error.passportEmpty"))};return(0,X.jsxs)(u.ZP,{title:x("team.passport.issue"),fullWidth:!0,open:!0,onClick:e=>e.stopPropagation(),onClose:a,disableEscapeKeyDown:!0,PaperProps:{style:{minHeight:"auto"}},actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Z.Z,{onClick:a,color:"inherit",size:"small",children:x("common.cancel")}),(0,X.jsxs)(Z.Z,{onClick:b,color:"primary",size:"small",disabled:m||!g,variant:"contained",autoFocus:!0,"data-cy":"issue-passport-create-btn",children:[m&&(0,X.jsx)(O.Z,{size:16}),x(s?"team.passport.issuance.create.title":"oauth.issued")]})]}),children:[(0,X.jsx)(U.Z,{component:"div",children:(0,X.jsx)(W.Z,{component:"div",children:(0,X.jsxs)(K.Z,{style:{width:"100%"},variant:"outlined",children:[(0,X.jsx)(V.Z,{children:x("common.passport")}),(0,X.jsx)(F.Z,{"data-cy":"issue-passport-select-passport",value:g,onChange:e=>{f(null),v(e.target.value)},fullWidth:!0,label:x("common.passport"),disabled:m,onKeyPress:e=>{"Enter"===e.key&&(e.preventDefault(),b())},children:i.filter((e=>c||"owner"!==e.name)).map((e=>(0,X.jsx)(q.Z,{value:e.name,"data-cy":"issue-passport-select-option-".concat(e.name),children:(0,X.jsx)("span",{children:e.title||e.name})},e.name)))})]})})}),!!h&&(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:h})]})}Ce.propTypes={teamDid:d().string.isRequired,ownerDid:d().string.isRequired,needReceive:d().bool,onCancel:d().func.isRequired,onSuccess:d().func.isRequired,onError:d().func,roles:d().array,showOwnerPassport:d().bool},Ce.defaultProps={onError:()=>{},roles:[],showOwnerPassport:!1,needReceive:!0};var Pe,De=t(26538),we=t.n(De);function Re(e){let{passport:n,user:t,color:s,width:i,icon:r,children:a,createPassportSvg:o,...l}=e;const{t:c}=(0,j.PE)();return(0,X.jsxs)(ke,{display:"flex",alignItems:"center",...l,children:[(0,X.jsx)("div",{dangerouslySetInnerHTML:{__html:o({title:n.title||n.name,issuer:n.issuer&&n.issuer.name,issuerDid:n.issuer&&n.issuer.id,ownerName:t.fullName,ownerDid:t.did,ownerAvatarUrl:t.avatar,revoked:n.revoked,preferredColor:s,width:i})}}),(0,X.jsxs)("div",{className:"body",children:[(0,X.jsxs)(f.Z,{className:"title",display:"flex",alignItems:"center",children:[we()(n.title),(0,X.jsxs)("div",{className:"status-icons",children:[r,n.revoked&&(0,X.jsx)(ye.Z,{})]})]}),n.expirationDate&&(0,X.jsx)(f.Z,{className:"title",display:"flex",alignItems:"center",children:c("team.passport.validUntil",{date:n.expirationDate})}),a]})]})}Re.propTypes={passport:d().any.isRequired,user:d().any.isRequired,color:d().string.isRequired,createPassportSvg:d().func.isRequired,icon:d().any,children:d().any,width:d().number},Re.defaultProps={icon:null,children:null,width:150};const ke=(0,a.Z)(f.Z)(Pe||(Pe=(0,i.Z)(["\n .body {\n padding: 0;\n margin-left: 24px;\n margin-top: 0;\n }\n .title {\n font-weight: 400;\n font-size: 16px;\n line-height: 19px;\n color: #222222;\n }\n .tip {\n display: flex;\n align-items: center;\n font-size: 14px;\n margin-top: 6px;\n color: #bbb;\n }\n .status-icons {\n svg {\n fill: #bfbfbf;\n height: 1.2em;\n margin-left: 0.4em;\n }\n }\n"])));var Te;function Ee(e){let{action:n,passport:t}=e;const{t:s}=(0,j.PE)(),{roles:i}=(0,z.DJ)(),r=i.find((e=>e.name===t.role));return(0,X.jsxs)("div",{children:[(0,X.jsx)("div",{children:s("enable"===n?"team.member.enablePassportDescription":"team.member.revokePassportDescription")}),r&&(0,X.jsx)(f.Z,{mt:3,fontWeight:"bold",children:s("team.member.passportPermissionTitle")}),r&&(0,X.jsx)(f.Z,{mt:1,children:r.description})]})}function Ie(e){var n;let{user:t,onCreate:s,createPassportSvg:i}=e;const{t:a}=(0,j.PE)(),{session:o}=(0,se.T)(),{roles:l,teamDid:c,teamIssuerDid:d,refresh:m,enablePassportIssuance:p,trustedPassports:u,passportColor:x,blocklet:g}=(0,z.DJ)(),{appIdList:b}=(0,L.y0)(),{api:y,inService:S}=(0,A.h6)(),[P,D]=(0,r.useState)(!1),[w,k]=(0,r.useState)(null),[T,I]=(0,r.useState)(!1),[N,O]=(0,r.useState)(""),U=[d,...b||[]].filter(Boolean),W=(ne()(t,"passports")||[]).map((e=>({...e,revoked:e.status===R.PASSPORT_STATUS.REVOKED}))),q=async e=>{if(!P){D(!0);try{const n=e.status===R.PASSPORT_STATUS.REVOKED?"enableUserPassport":"revokeUserPassport";await y[n]({input:{teamDid:c,userDid:t.did,passportId:e.id}}),m()}catch(n){E.Z.error((0,_.Z)(n))}finally{D(!1),k(null)}}},F=(e,n)=>t.did===o.user.did&&o.user.passportId&&o.user.passportId===n.id?{revokable:!1,message:a("team.passport.shouldNotDeleteCurrent")}:e?c===n.issuer.id&&"owner"===n.name?{revokable:!1,message:a("team.passport.noPermission")}:{revokable:!0}:{revokable:!1,message:a("team.passport.noPermission")},M=W.filter((e=>!N||e.title.includes(N)||e.name.includes(N)));return(0,X.jsxs)(Ne,{children:[(0,X.jsxs)(Se.Z,{children:[(0,X.jsx)("div",{className:"left",children:(0,X.jsx)(Ze.Z,{placeholder:a("team.passport.search"),value:N,onChange:e=>O(e.target.value)})}),(0,X.jsx)("div",{className:"right",children:p&&!!t.approved&&(0,X.jsx)(B.Z,{permission:S?"":"mutate_team",role:S?_.Wf:[],children:(0,X.jsxs)(Z.Z,{variant:"contained",color:"primary","data-cy":"issue-passport",onClick:()=>I(!0),children:[(0,X.jsx)(v.Z,{style:{fontSize:16,marginRight:4}}),a("team.passport.issue")]})})})]}),(0,X.jsxs)(f.Z,{children:[M.map((e=>(0,X.jsx)(B.Z,{permission:S?"":"mutate_team",role:S?_.Wf:[],children:n=>(0,X.jsxs)(f.Z,{className:"passport-item",display:"flex",justifyContent:"space-between",alignItems:"center",mt:3,children:[(0,X.jsx)(Re,{passport:e,user:t,color:x,createPassportSvg:i,icon:U.length&&!U.includes(e.issuer.id)?(0,X.jsx)(C.Z,{}):null,children:!!U.length&&!U.includes(e.issuer.id)&&(0,X.jsxs)("div",{className:"tip",children:[e.issuer.id!==d&&!u.some((n=>n.issuerDid===e.issuer.id))&&(0,X.jsx)(h.Z,{title:a("team.passport.notTrustedIssuerTip"),children:(0,X.jsx)(f.Z,{component:ve.Z,style:{fontSize:"1.3em"},color:"error.main",mr:.5})}),(0,X.jsx)("span",{children:a("team.passport.issueBy",{name:e.issuer.name})})]})}),(0,X.jsx)(f.Z,{children:F(n,e).revokable?(0,X.jsxs)(Z.Z,{variant:"outlined",color:e.revoked?"primary":"secondary",onClick:()=>{return(n=e).status===R.PASSPORT_STATUS.REVOKED?k({title:a("team.member.enablePassport"),description:(0,X.jsx)(Ee,{action:"enable",passport:n}),confirm:a("common.enable"),cancel:a("common.cancel"),onConfirm:()=>{q(n)},onCancel:()=>{D(!1),k(null)},color:"primary"}):k({title:a("team.member.revokePassport"),description:(0,X.jsx)(Ee,{action:"revoke",passport:n}),confirm:a("common.revoke"),cancel:a("common.cancel"),onConfirm:()=>{q(n)},onCancel:()=>{D(!1),k(null)}});var n},children:[e.revoked?(0,X.jsx)(v.Z,{style:{fontSize:16,marginRight:4}}):(0,X.jsx)(ye.Z,{style:{height:16,marginRight:4}}),e.revoked?a("common.enable"):a("common.revoke")]}):(0,X.jsx)(h.Z,{title:F(n,e).message,children:(0,X.jsx)(ve.Z,{style:{color:"#ddd"}})})})]})},e.id))),!M.length&&(0,X.jsx)(je.Z,{children:a("common.empty")})]}),T&&(0,X.jsx)(Ce,{teamDid:c,ownerDid:t.did,needReceive:(0,be.h1)(t)===t.did,roles:l,onCancel:()=>I(!1),onSuccess:()=>{s(),I(!1)},showOwnerPassport:g&&!(null!==(n=g.settings)&&void 0!==n&&n.owner)}),w&&(0,X.jsx)(he.Z,{title:w.title,description:w.description,confirm:w.confirm,cancel:w.cancel,params:w.params,onConfirm:w.onConfirm,onCancel:w.onCancel,color:w.color})]})}Ee.propTypes={action:d().string.isRequired,passport:d().object.isRequired},Ee.defaultProps={},Ie.propTypes={user:d().object.isRequired,createPassportSvg:d().func.isRequired,onCreate:d().func},Ie.defaultProps={onCreate:()=>{}};const Ne=a.Z.div(Te||(Te=(0,i.Z)(["\n .passport-item {\n .MuiButton-outlinedSecondary {\n color: #f16e6e;\n fill: #f16e6e;\n background: #fcf3f3;\n border: 0;\n &:hover {\n border: 0;\n }\n }\n }\n"])));var Ae=t(15098);const ze=(e,n)=>e.nodeOwner&&e.nodeOwner.did===n,Le=(e,n)=>e&&e.did===n;function Be(e){let{user:n,onCancel:t,onSuccess:s,onError:i,children:a}=e;const{api:o,info:l,inService:c}=(0,A.h6)(),{session:d}=(0,se.T)(),{teamDid:m,refresh:p}=(0,z.DJ)(),{t:u}=(0,j.PE)(),[h,f]=(0,r.useState)(!1),[x,g]=(0,r.useState)(!1),v={title:n.approved?u("team.member.forbidLogin"):u("team.member.allowLogin"),description:n.approved?u("team.member.forbidLoginDescription"):u("team.member.allowLoginDescription"),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:()=>{(async e=>{const{did:n,approved:t}=e;if(!h){f(!0);try{await o.updateUserApproval({input:{teamDid:m,user:{did:n,approved:!t}}}),g(!1),s(),p()}catch(r){E.Z.error((0,_.Z)(r)),i()}finally{f(!1)}}})(n)},onCancel:()=>{f(!1),g(!1),t()},color:n.approved?"error":"primary"};let b;return b=!(0,Ae.hasActiveOwnerPassport)(n)&&((c||l.nodeOwner&&!ze(l,n.did))&&!Le(d.user,n.did)),b?(0,X.jsxs)(X.Fragment,{children:["function"===typeof a?a({can:b,open:()=>g(!0)}):a,x?(0,X.jsx)(he.Z,{title:v.title,description:v.description,confirm:v.confirm,cancel:v.cancel,params:v.params,onConfirm:v.onConfirm,onCancel:v.onCancel,color:v.color}):null]}):null}Be.propTypes={user:d().object,onSuccess:d().func,onCancel:d().func,onError:d().func,children:d().oneOfType([d().object,d().func])},Be.defaultProps={user:{},onSuccess:()=>{},onCancel:()=>{},onError:()=>{},children:null};var _e,Oe,Ue,We=t(6352),qe=t.n(We);function Fe(e,n,t){if(e&&e.startsWith(R.USER_AVATAR_URL_PREFIX)){const s=window.env.apiPrefix||"/";return t?qe()(s,R.USER_AVATAR_PATH_PREFIX,e.replace(R.USER_AVATAR_URL_PREFIX,"")):qe()(s,R.USER_AVATAR_PATH_PREFIX,n,e.replace(R.USER_AVATAR_URL_PREFIX,""))}return e}function Me(e){let{user:n}=e;return(n.connectedAccounts||[]).map((e=>(0,X.jsx)(ce.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.provider,children:(0,X.jsx)(N.Z,{did:e.did})},e.did)))}Me.propTypes={user:d().object.isRequired},Me.defaultProps={},d().string.isRequired;const Ve="info";function Ke(e){let{userDid:n,onCancel:t,initTab:s,createPassportSvg:i}=e;const{api:a,ws:{useSubscription:o},inService:l}=(0,A.h6)(),{roles:c,teamDid:d,enablePassportIssuance:m}=(0,z.DJ)(),{t:p,locale:h}=(0,j.PE)(),x=(0,pe.Z)({user:null,issuances:null,tab:s||Ve}),g=async(e,n)=>{try{const t=await a.doBatchQuery({getUser:{input:{teamDid:e,user:{did:n},options:{includeTags:!0}}},getPassportIssuances:{input:{teamDid:e,ownerDid:n}}});t.getUser.user&&(t.getUser.user.avatar=Fe(t.getUser.user.avatar,e,l),t.getUser.user.passports=(t.getUser.user.passports||[]).filter((e=>e.issuer))),x.user=t.getUser.user||{},x.issuances=t.getPassportIssuances.list||[]}catch(t){E.Z.error((0,_.Z)(t))}};(0,r.useEffect)((()=>{d&&g(d,n)}),[n,d]);o(R.EVENTS.USER_UPDATED,(e=>{e.teamDid===d&&e.user&&e.user.did===n&&g(d,n)}),[n,d]),(0,r.useEffect)((()=>{x.issuances&&!x.issuances.length&&"issuances"===x.tab&&(x.tab=Ve)}),[x.issuances]);const v=async e=>{await g(d,e.did),x.tab=Ve},b={auth0:"Auth0",wallet:"DID wallet",federated:"Federated"},y={info:{label:p("common.basicInfo"),value:Ve,component:()=>{var e,n;return(x.user?[{name:p("team.member.name"),value:x.user.fullName},{name:p("common.email"),value:x.user.email},{name:p("team.member.source"),value:(0,X.jsx)(f.Z,{display:"flex",alignItems:"center",children:b[(null===(e=x.user)||void 0===e?void 0:e.sourceProvider)||R.USER_TYPE.WALLET]||(null===(n=x.user)||void 0===n?void 0:n.sourceProvider)})},{name:p("team.member.allowLogin"),value:x.user.approved?p("common.yes"):p("common.no")},{name:p("team.member.lastLogin"),value:(0,_.B2)(x.user.lastLoginAt,h)},{name:p("team.member.lastLoginIp"),value:x.user.lastLoginIp||""},{name:p("common.createdAt"),value:(0,_.B2)(x.user.createdAt,h)},{name:p("common.remark"),value:x.user.remark||"--"},Array.isArray(x.user.tags)&&x.user.tags.length>0?{name:p("common.tags"),value:x.user.tags.map((e=>(0,X.jsx)(I.Z,{style:{background:e.color,color:(0,P.getTextColor)(e.color),marginRight:4},children:e.title},e.id)))}:null].filter(Boolean):[]).map((e=>e.name===p("common.did")?(0,X.jsx)(ce.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:()=>p("common.did"),children:e.value},e.name):(0,X.jsx)(ce.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)))}},oauth:{label:p("team.member.connectedAccounts"),value:"oauth",component:()=>(0,X.jsx)(Me,{user:x.user,onChangeUser:v})},passports:{label:p("common.passport"),value:"passports",component:()=>(0,X.jsx)(Ie,{user:x.user,teamDid:d,roles:c,createPassportSvg:i,onCreate:()=>{g(d,n).then((()=>{m&&x.issuances&&x.issuances.length&&(x.tab="issuances")}))},onRefresh:()=>{g(d,n)}})},issuances:{label:p("team.passport.issuance.pending"),value:"issuances",component:()=>(0,X.jsx)(xe,{issuances:x.issuances||[],teamDid:d,onRefresh:()=>g(d,n)})}},Z=Object.values(y).map((e=>{let{label:n,value:t}=e;return{label:n,value:t}})).filter((e=>{if("issuances"===e.value)return m&&x.issuances&&!!x.issuances.length;if("oauth"===e.value){var n;return((null===(n=x.user)||void 0===n?void 0:n.connectedAccounts)||[]).find((e=>{var n;return e.provider!==((null===(n=x.user)||void 0===n?void 0:n.sourceProvider)||ue.LOGIN_PROVIDER.WALLET)}))}return!0})),S=y[x.tab]||y.info;return(0,X.jsx)(u.ZP,{title:p("common.member"),onClose:t,open:!0,PaperProps:{style:{maxWidth:632,minHeight:"80vh"}},fullWidth:!0,actions:x.user&&(0,X.jsx)(B.Z,{permission:l?"":"mutate_team",role:l?_.Wf:[],children:(0,X.jsx)(Be,{user:x.user,children:e=>{let{open:n}=e;return(0,X.jsxs)(Xe,{onClick:n,children:[x.user.approved?(0,X.jsx)(de.Z,{style:{fontSize:"1.2em",marginRight:"0.4em"}}):(0,X.jsx)(me.Z,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),x.user.approved?p("team.member.forbidLogin"):p("team.member.allowLogin")]})}})}),children:(0,X.jsxs)(Je,{children:[!x.user&&(0,X.jsx)(He,{children:(0,X.jsx)(O.Z,{})}),x.user&&(0,X.jsxs)("div",{children:[(0,X.jsxs)(f.Z,{display:"flex",alignItems:"center",className:"info",children:[(0,X.jsx)(oe.Z,{src:x.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),(0,X.jsxs)(f.Z,{children:[(0,X.jsx)(f.Z,{className:"name",children:x.user.fullName}),(0,X.jsx)(f.Z,{className:"did",mt:1,children:(0,X.jsx)(N.Z,{did:x.user.did})})]})]}),(0,X.jsx)(f.Z,{mx:3,className:"tabs",children:(0,X.jsx)(le.Z,{tabs:Z,current:x.tab,onChange:e=>{x.tab=e},scrollButtons:"auto"})}),(0,X.jsx)("div",{className:"body",children:(0,X.jsx)(S.component,{})})]})]})})}Ke.propTypes={userDid:d().string.isRequired,onCancel:d().func.isRequired,createPassportSvg:d().func.isRequired,initTab:d().string},Ke.defaultProps={initTab:Ve};const Je=a.Z.div(_e||(_e=(0,i.Z)(["\n .info {\n .name {\n font-weight: 400;\n font-size: 18px;\n line-height: 25px;\n color: #222222;\n }\n }\n\n .tabs {\n margin-top: 24px;\n margin-left: 0;\n margin-right: 0;\n }\n\n .body {\n margin-top: 24px;\n }\n"]))),He=a.Z.div(Oe||(Oe=(0,i.Z)(["\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 200px;\n"]))),Xe=a.Z.div(Ue||(Ue=(0,i.Z)(["\n flex-shrink: 0;\n width: 100%;\n height: 64px;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n color: #999;\n fill: #999;\n font-size: 16px;\n border-top: 1px solid #f0f0f0;\n position: sticky;\n bottom: 0;\n background: #fff;\n z-index: 10;\n"])));var $e,Ge=t(27773);function Ye(){const{api:e,inService:n}=(0,A.h6)(),{t:t,locale:s}=(0,r.useContext)(j.RD),{teamDid:i,invitations:a,refresh:o,endpoint:l}=(0,z.DJ)(),[c,d]=(0,r.useState)(null),[m,p]=(0,r.useState)(!1),u=()=>{p(!1),d(null)},h=e=>l?(0,_.ly)({inviteId:e.inviteId,endpoint:l}):"",f=[{label:t("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:e=>{const n=a[e];return l?(0,X.jsx)(H.Z,{children:h(n)}):(0,X.jsx)(O.Z,{size:16})}}},{label:t("common.role"),name:"role",widtn:70},{label:t("common.remark"),name:"remark",options:{customBodyRender:e=>e||"--"}},{label:t("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:(e,n)=>{var t;let{rowIndex:s}=n;const i=a[s];return null===i||void 0===i||null===(t=i.inviter)||void 0===t?void 0:t.fullName}}},{label:t("common.expires"),name:"expireDate",options:{customBodyRender:e=>(0,X.jsx)(w.Z,{value:e,locale:s})}},{label:t("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:s=>{const r=a[s];return(0,X.jsx)(B.Z,{permission:n?"":"mutate_team",role:n?_.Wf:[],children:(0,X.jsxs)(Z.Z,{onClick:()=>d({title:t("team.inviting.delete.title"),description:t("team.inviting.delete.description",{link:h(r)}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>(async n=>{let{inviteId:t}=n;if(!m){p(!0);try{await e.deleteInvitation({input:{teamDid:i,inviteId:t}}),o(),await(0,_._v)(800)}catch(s){console.error(s)}finally{p(!1),d(null)}}})(r),onCancel:u}),size:"small",color:"error",variant:"text",children:[(0,X.jsx)(Ge.default,{style:{fontSize:"1.2em"}}),t("common.delete")]})})}}}];return(0,X.jsxs)(Qe,{children:[a.length?(0,X.jsx)(D.Z,{locale:s,data:[...a],columns:f,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1}}):(0,X.jsx)(je.Z,{children:t("common.empty")}),c&&(0,X.jsx)(he.Z,{title:c.title,description:c.description,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}const Qe=a.Z.div($e||($e=(0,i.Z)(["\n margin-top: -20px;\n"])));Ye.propTypes={},Ye.defaultProps={};var en,nn=t(46954),tn=t(44067),sn=t(92726);function rn(e){let{user:n,onIssuePassport:t}=e;const{teamDid:s,roles:i}=(0,z.DJ)(),{t:a}=(0,r.useContext)(j.RD),[o,l]=(0,r.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(sn.Z,{"data-cy":"member-actions",actions:[{icon:(0,X.jsx)(v.Z,{fontSize:"small"}),text:a("team.passport.issue"),"data-cy":"action-issue-passport",onClick:e=>{e.stopPropagation(),l(!0)}},e=>{let{close:t}=e;return(0,X.jsx)(Be,{user:n,children:e=>{let{open:s}=e;return(0,X.jsxs)(q.Z,{dense:!0,onClick:e=>{e.stopPropagation(),t(),s(e)},"data-cy":"action-toggle-block",children:[(0,X.jsx)(nn.Z,{style:{minWidth:24,marginRight:8},children:n.approved?(0,X.jsx)(de.Z,{}):(0,X.jsx)(me.Z,{})}),(0,X.jsx)(tn.Z,{primary:n.approved?a("team.member.forbidLogin"):a("team.member.allowLogin")})]})}},"toggle-approval")}]}),o&&(0,X.jsx)(Ce,{teamDid:s,ownerDid:n.did,needReceive:(0,be.h1)(n)===n.did,roles:i,onCancel:()=>l(!1),onSuccess:()=>{t(),l(!1)}})]})}rn.propTypes={user:d().object.isRequired,onIssuePassport:d().func},rn.defaultProps={onIssuePassport:()=>{}};const an="$all",on="$none",ln=(e,n)=>{const t=e.find((e=>e.key===n));return(null===t||void 0===t?void 0:t.value)||0},cn=(e,n)=>{const t=e.passports||[];return!!t.length&&!t.some((e=>{var t;return n.includes(null===(t=e.issuer)||void 0===t?void 0:t.id)}))};function dn(e){let{user:n}=e;const{t:t}=(0,r.useContext)(j.RD),s=(0,X.jsxs)("div",{className:"member-block",children:[(0,X.jsxs)("div",{className:"member-avatar",children:[(0,X.jsx)(y.Z,{src:"".concat(n.avatar,"?imageFilter=resize&w=48&h=48"),size:32,did:n.did,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),!n.approved&&(0,X.jsx)("did",{className:"badge-block"}),n.isFromExternal&&(0,X.jsx)(h.Z,{title:t("team.passport.externalPassport"),children:(0,X.jsx)(f.Z,{ml:1,className:"icon",children:(0,X.jsx)(C.Z,{})})})]}),(0,X.jsxs)("div",{className:"member-meta",children:[(0,X.jsx)("div",{className:"member-text",children:n.fullName}),Array.isArray(n.tags)&&n.tags.length>0&&(0,X.jsx)("div",{className:"member-tags",children:n.tags.map((e=>(0,X.jsx)(I.Z,{style:{background:e.color,color:(0,P.getTextColor)(e.color),marginRight:4},children:e.title},e.id)))})]})]});return n.approved?s:(0,X.jsx)(f.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(h.Z,{title:t("team.member.forbidLoginDescription"),children:s})})}function mn(e){let{type:n,createPassportSvg:t}=e;const{appIdList:s=[]}=(0,L.y0)(),{teamDid:i,invitations:a,teamIssuerDid:o,roles:c,refresh:d,enablePassportIssuance:m,endpoint:h,api:y}=(0,z.DJ)(),{inService:C,ws:{useSubscription:P}}=(0,A.h6)(),{t:I,locale:O}=(0,r.useContext)(j.RD),[U,W]=(0,r.useState)(!1),[q,F]=(0,r.useState)(!1),[M,V]=(0,r.useState)(!1),[K,J]=(0,r.useState)(!1),[H,G]=(0,r.useState)(!1),[Y,Q]=(0,r.useState)([]),[ee,ne]=(0,r.useState)(),[te,se]=(0,r.useState)([]),[re]=(0,k.Z)({did:void 0}),ae="members-".concat(i),oe=(0,D.$)(ae),[le,ce]=(0,r.useState)({role:an,searchText:oe.searchText||"",hideBlocked:!1,pageSize:oe.rowsPerPage||10,page:oe.page?oe.page+1:1});(0,T.Z)((async()=>{if(re.did){const{user:e}=await y.getUser({did:re.did});e&&J(e)}}));const de=(c||[]).map((e=>({name:e.name,title:e.title,num:ln(te,e.name)})));de.unshift({name:an,title:"All Members",num:ln(te,an)}),de.push({name:on,title:"Other",num:ln(te,on)});const me=()=>{const e={includeTags:!0};le.hideBlocked&&(e.approved=!0),e.role=le.role,le.searchText&&(e.search=le.searchText),G(!0),y.getUsers({query:e,paging:{page:le.page,pageSize:le.pageSize}}).then((e=>{G(!1),(e.users||[]).forEach((e=>{e.isFromExternal=cn(e,l()(s)?[o]:s),e.avatar=Fe(e.avatar,i,C),e.passports=(e.passports||[]).filter((e=>e.issuer))})),Q(e.users||[]),ne(e.paging.total)})).catch((e=>{G(!1),E.Z.error(e.message)}))},pe=()=>{y.getUsersCountPerRole().then((e=>{se(e.counts||[])})).catch((e=>{E.Z.error(e.message)}))},ue=e=>{e.teamDid===i&&(me(),pe())};(0,r.useEffect)((()=>{me()}),["".concat(le.hideBlocked,"-").concat(le.role,"-").concat(le.page,"-").concat(le.pageSize,"-").concat(le.searchText)]),(0,r.useEffect)((()=>{pe()}),[]),P(R.EVENTS.USER_UPDATED,ue,[le]),P(R.EVENTS.USER_ADDED,ue,[le]);const he=m,fe=[{label:I("common.name"),name:"fullName",options:{customBodyRenderLite:e=>{const n=Y[e];return(0,X.jsx)("div",{"data-cy":"member-name-".concat(n.fullName),children:(0,X.jsx)(dn,{user:n})},n.did)}}},{label:I("common.address"),name:"did",options:{customBodyRender:e=>(0,X.jsx)(N.Z,{size:14,responsive:!0,copyable:!1,did:e})}},{label:I("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:e=>(0,X.jsx)(w.Z,{value:e,locale:O})}},{label:I("team.member.lastLoginIp"),name:"lastLoginIp",options:{customBodyRender:e=>e||"-"}},{label:I("team.member.source"),name:"sourceProvider",options:{customBodyRenderLite:e=>{const n=Y[e],t=n.sourceProvider||R.USER_TYPE.WALLET,s={auth0:"Auth0",wallet:"DID wallet",federated:"Federated"}[t]||t;return n.sourceAppPid?"".concat(s," (").concat(I("team.member.federated"),")"):s}}},{label:I("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:e=>{const n=Y[e];return(0,X.jsx)(B.Z,{permission:C?"":"mutate_team",role:C?_.Wf:[],children:(0,X.jsx)(rn,{user:n,onIssuePassport:()=>J({...n,initTab:"issuances"})})})}}}],xe=[];he&&(xe.push((0,X.jsxs)(Z.Z,{variant:"outlined",style:{flexShrink:0,marginRight:16},color:"primary",size:"small",onClick:()=>{V(!0)},children:[(0,X.jsx)(S.Z,{style:{height:"1em",marginRight:4}}),I("common.inviting"),a.length?" (".concat(a.length,")"):""]}),(0,X.jsx)(B.Z,{permission:C?"":"mutate_team",role:C?_.Wf:[],children:(0,X.jsxs)(Z.Z,{style:{flexShrink:0,marginRight:16},variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"invite-member",onClick:()=>W(!0),children:[(0,X.jsx)(v.Z,{style:{fontSize:"1.3em",marginRight:4}}),I("team.invite")]})})),"server"===n&&xe.push((0,X.jsx)(B.Z,{role:"owner",children:(0,X.jsxs)(Z.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"invite-member",onClick:()=>F(!0),children:[(0,X.jsx)(b.Z,{style:{fontSize:"1.3em",marginRight:4}}),I("team.transferNode.name")]})})));const ge={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const s=Y[t];J(s)},page:le.page-1,rowsPerPage:le.pageSize,count:ee,searchDebounceTime:600};return(0,X.jsxs)(pn,{children:[(0,X.jsxs)(f.Z,{className:"main",display:"flex",sx:{mt:C?4:0},children:[(0,X.jsx)("div",{className:"left",children:(0,X.jsx)("div",{className:"tabs",children:de.map((e=>(0,X.jsxs)("div",{className:"tab ".concat(le.role===e.name?"active":""),onClick:()=>{return n=e.name,void(H||ce((e=>({...e,role:n,hideBlocked:!1,searchText:"",page:1}))));var n},children:[(0,X.jsx)("span",{className:"text",children:e.title}),(0,X.jsx)("span",{className:p()("badge",{"is-rect":e.num>999}),children:e.num})]},e.name)))})}),(0,X.jsx)("div",{className:"right",children:(0,X.jsx)(D.Z,{className:"main-table",verticalKeyWidth:100,locale:O,durable:ae,durableKeys:["page","rowsPerPage"],title:(0,X.jsx)("div",{className:"table-toolbar-left",children:(0,X.jsx)(x.Z,{control:(0,X.jsx)(g.Z,{sx:{display:"flex !important"},disabled:H,color:"primary",checked:le.hideBlocked,onChange:e=>{return n=e.target.checked,void ce((e=>({...e,hideBlocked:n,page:1})));var n}}),label:I("team.member.hideBlockedMember")})}),data:Y,columns:fe,customButtons:xe,options:ge,loading:H,onChange:e=>{let{page:n,rowsPerPage:t,searchText:s}=e;le.pageSize!==t?ce((e=>({...e,pageSize:t,page:1}))):le.page!==n+1?ce((e=>({...e,page:n+1}))):le.searchText!==s&&ce((e=>({...e,searchText:s,page:1})))}})})]}),(0,X.jsx)(u.ZP,{title:I("common.inviting"),onClose:()=>V(!1),open:M,maxWidth:"lg",fullWidth:!0,children:(0,X.jsx)(Ye,{})}),K&&(0,X.jsx)(Ke,{onCancel:()=>J(null),userDid:K.did,createPassportSvg:t,initTab:K.initTab}),U&&(0,X.jsx)($,{teamDid:i,endpoint:h,roles:c,onCancel:()=>W(!1),onSuccess:()=>{d(),W(!1)}}),q&&(0,X.jsx)(ie,{teamDid:i,endpoint:h,roles:c,onCancel:()=>F(!1),onSuccess:()=>{d(),F(!1)}})]})}dn.propTypes={user:d().object.isRequired};const pn=a.Z.div(en||(en=(0,i.Z)(["\n .main {\n .left {\n width: 168px;\n flex-shrink: 0;\n margin-right: 65px;\n .tabs {\n padding-top: 16px;\n .tab {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 16px;\n transition: background 0.4s;\n\n width: 168px;\n height: 36px;\n border-radius: 8px;\n\n cursor: pointer;\n user-select: none;\n\n &:nth-child(n + 2) {\n margin-top: 24px;\n }\n\n &.active {\n background: #f2f2f2;\n }\n\n &:hover {\n background: #f2f2f2;\n }\n\n .text {\n font-weight: 400;\n font-size: 16px;\n line-height: 19px;\n\n color: #222222;\n }\n\n .badge {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 20px;\n height: 20px;\n border-radius: 100%;\n color: #fff;\n background: #666666;\n font-size: 10px;\n font-weight: 400;\n &.is-rect {\n width: auto;\n border-radius: 8px;\n padding: 0 4px;\n }\n }\n }\n }\n @media (max-width: ","px) {\n display: none;\n }\n }\n .right {\n flex-grow: 1;\n }\n }\n\n .member-block {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n .member-avatar {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .member-meta {\n margin-left: 10px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n }\n .badge-block {\n width: 14px;\n height: 14px;\n position: absolute;\n right: -4px;\n top: -4px;\n background: #ff5757;\n border-radius: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n &::after {\n content: '';\n width: 6px;\n height: 2px;\n background: #fefefe;\n }\n }\n }\n\n .table-toolbar-left {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 7px 0;\n }\n"])),(e=>e.theme.breakpoints.values.md));mn.propTypes={type:d().oneOf(["server","blocklet"]).isRequired,createPassportSvg:d().func.isRequired}},82638:(e,n,t)=>{"use strict";t.d(n,{Z:()=>c});var s,i=t(71171),r=t(33518),a=t(47020),o=t(57201),l=t(96266);const c=(0,r.Z)((e=>{let{children:n,...t}=e;return(0,l.jsx)(a.Z,{...t,id:"outlined-basic",variant:"outlined",InputProps:{startAdornment:(0,l.jsx)(o.default,{})},size:"small",children:n})}))(s||(s=(0,i.Z)(["\n .MuiOutlinedInput-root {\n color: #999;\n &.MuiInputBase-adornedStart .MuiSvgIcon-root {\n color: #bfbfbf;\n }\n opacity: 1;\n border-radius: 36px;\n background: #f8f8f8;\n padding-left: 16px;\n input {\n padding-left: 8px;\n font-weight: bold;\n &::placeholder {\n opacity: 1;\n color: #bfbfbf;\n }\n padding-top: 8.5px;\n padding-bottom: 8.5px;\n }\n }\n\n .MuiOutlinedInput-notchedOutline,\n .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline,\n .Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: #eee;\n border-width: 1px;\n }\n"])))},18901:(e,n,t)=>{"use strict";t.d(n,{Z:()=>r});var s,i=t(71171);const r=t(33518).Z.div(s||(s=(0,i.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 14px;\n .left,\n .right {\n }\n .right {\n display: flex;\n align-items: center;\n }\n .tabs {\n .MuiButton-root {\n border: none;\n color: #999;\n &.active {\n color: #222;\n }\n }\n }\n\n @media (max-width: 600px) {\n display: block;\n .right {\n margin-top: 12px;\n }\n }\n"])))}}]);
1
+ (self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[5672],{32322:(e,n,t)=>{"use strict";n.h1=void 0;const s=t(77277);function i(e){return(null===e||void 0===e?void 0:e.connectedAccounts)||[]}function r(e){return i(e).find((e=>e.provider===s.LOGIN_PROVIDER.WALLET))}n.h1=function(e){const n=r(e);return null===n||void 0===n?void 0:n.did}},15098:(e,n,t)=>{const{ROLES:s,PASSPORT_STATUS:i}=t(35432);e.exports={hasActiveOwnerPassport:e=>((null===e||void 0===e?void 0:e.passports)||[]).some((e=>e.role===s.OWNER&&e.status===i.VALID))}},92726:(e,n,t)=>{"use strict";t.d(n,{Z:()=>x});var s,i=t(71171),r=t(5057),a=t(55898),o=t.n(a),l=t(33518),c=t(67680),d=t(61533),m=t(74490),p=t(45267),u=t(46954),h=t(44067),f=t(96266);function x(e){let{actions:n,size:t,...s}=e;const[i,a]=(0,r.useState)(null),o=Boolean(i),l=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(null)};return(0,f.jsxs)(g,{...s,children:[(0,f.jsx)(c.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(e.currentTarget)},size:t,children:(0,f.jsx)(p.Z,{})}),(0,f.jsx)(d.Z,{id:"actions-menu","data-cy":"actions-menu",anchorEl:i,keepMounted:!0,open:o,onClose:l,PaperProps:{},children:n.map(((e,n)=>{if("function"===typeof e)return e({close:l});const{icon:t,text:s,onClick:i,disabled:a=!1,...o}=e;return(0,r.createElement)(m.Z,{...o,disabled:a,dense:!0,onClick:async e=>{await i(e),l()},key:n,"data-cy":"actions-menu-".concat(n)},(0,f.jsx)(u.Z,{style:{minWidth:24,marginRight:8},children:t}),(0,f.jsx)(h.Z,{primary:s}))}))})]})}x.propTypes={actions:o().array,size:o().oneOf(["small","medium","large"])},x.defaultProps={actions:[],size:"small"};const g=l.Z.div(s||(s=(0,i.Z)([""])))},50185:(e,n,t)=>{"use strict";t.d(n,{Z:()=>c});var s=t(5057),i=t(55898),r=t.n(i),a=t(12937),o=t(68420),l=t(96266);function c(e){let{children:n,...t}=e;const{t:i}=(0,s.useContext)(o.RD);return(0,l.jsx)(a.Z,{tip:i("common.copyTip"),copiedTip:i("common.copiedTip"),...t,children:n})}c.propTypes={children:r().any.isRequired}},9729:(e,n,t)=>{"use strict";t.d(n,{Z:()=>d});var s,i=t(71171),r=t(55898),a=t.n(r),o=t(33518),l=t(13727),c=t(96266);function d(e){const{passport:n,onDelete:t,...s}=e;return(0,c.jsxs)(m,{...s,children:[n.title||n.name," ",!!t&&(0,c.jsx)(l.default,{"data-cy":"delete-issuance",className:"delete",onClick:t})]})}d.propTypes={passport:a().object.isRequired,onDelete:a().func},d.defaultProps={onDelete:null};const m=o.Z.span(s||(s=(0,i.Z)(["\n display: inline-flex;\n padding: 2px 8px;\n background: ",";\n border-radius: 100vw;\n font-weight: 400;\n font-size: 12px;\n line-height: 22px;\n color: #fff;\n align-items: center;\n .delete {\n font-size: 1em;\n margin-left: 6px;\n cursor: pointer;\n }\n"])),(e=>e.theme.palette.primary.main))},75672:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>mn});var s,i=t(71171),r=t(5057),a=t(33518),o=t(75506),l=t.n(o),c=t(55898),d=t.n(c),m=t(52277),p=t.n(m),u=t(13128),h=t(75239),f=t(39948),x=t(26174),g=t(88092),v=t(44919),b=t(80578),y=t(72333),j=t(68420),Z=t(28726),S=t(68051),C=t(18945),P=t(49777),D=t(75760),w=t(49384),R=t(35432),k=t(10381),T=t(42061),E=t(86229),I=t(22228),N=t(17450),A=t(58238),z=t(17425),L=t(29054),B=t(63406),_=t(14491),O=t(44846),U=t(55372),W=t(11750),q=t(74490),F=t(51177),M=t(47020),V=t(6041),K=t(80576),J=t(88574),H=t(50185),X=t(96266);function $(e){let{teamDid:n,roles:t,onCancel:s,onSuccess:i,onError:a,endpoint:o}=e;const{api:l}=(0,A.h6)(),[c,d]=(0,r.useState)(!1),[m,p]=(0,r.useState)(""),{t:h,locale:f}=(0,j.PE)(),[x,g]=(0,r.useState)(0),[v,b]=(0,r.useState)(""),[y,S]=(0,r.useState)(""),[C,P]=(0,r.useState)(""),D=async()=>{if(!y)return void p(h("team.member.error.passportEmpty"));const e=C.trim();p(null),d(!0);try{const{inviteInfo:t}=await l.createMemberInvitation({input:{teamDid:n,role:y,remark:e}});b(t),g(1)}catch(t){const e=(0,_.Z)(t);p(e),a(t)}finally{d(!1)}},w=[{body:(0,X.jsxs)(W.Z,{component:"div",children:[(0,X.jsxs)(K.Z,{style:{width:"100%"},variant:"outlined",children:[(0,X.jsx)(V.Z,{children:h("common.passport")}),(0,X.jsx)(F.Z,{"data-cy":"invite-member-select-role",value:y,onChange:e=>{p(null),S(e.target.value)},fullWidth:!0,label:h("common.passport"),disabled:c,onKeyPress:e=>{"Enter"===e.key&&(e.preventDefault(),D())},children:t.filter((e=>"owner"!==e.name)).map((e=>(0,X.jsx)(q.Z,{value:e.name,"data-cy":"invite-member-select-option-".concat(e.name),children:(0,X.jsx)("span",{children:e.title||e.name})},e.name)))})]}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}}),(0,X.jsx)(M.Z,{label:h("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:C,onChange:e=>{p(null),P(e.target.value)},disabled:c,"data-cy":"invite-member-input-remark"}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:h("common.cancel"),confirm:h("team.member.inviteDialog.createInviteLink"),onCancel:s,onConfirm:D},{body:()=>{const e=(0,_.ly)({inviteId:v.inviteId,endpoint:o});return(0,X.jsxs)("div",{children:[(0,X.jsx)(G,{children:h("team.member.inviteDialog.createSuccessTip",{expireDate:(0,_.B2)(v.expireDate,f)})}),(0,X.jsx)("div",{style:{marginTop:"40px"}}),(0,X.jsx)(H.Z,{children:e})]})},confirm:h("common.confirm"),onConfirm:i}][x];return(0,X.jsxs)(u.ZP,{title:h("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[w.cancel&&(0,X.jsx)(Z.Z,{onClick:w.onCancel,color:"inherit",children:w.cancel}),(0,X.jsxs)(Z.Z,{onClick:w.onConfirm,color:"primary",disabled:c||!y,variant:"contained",autoFocus:!0,children:[c&&(0,X.jsx)(O.Z,{size:16}),w.confirm]})]}),children:[(0,X.jsx)(U.Z,{component:"div",children:"function"===typeof w.body?w.body():w.body}),!!m&&(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:m})]})}$.propTypes={teamDid:d().string.isRequired,onCancel:d().func.isRequired,onSuccess:d().func.isRequired,onError:d().func,roles:d().array,endpoint:d().string},$.defaultProps={onError:()=>{},roles:[],endpoint:""};const G=a.Z.div(s||(s=(0,i.Z)(["\n font-size: 16px;\n font-weight: bold;\n"])));var Y,Q=t(26796),ee=t(43681),ne=t.n(ee),te=t(49983),se=t(73545);function ie(e){let{teamDid:n,onCancel:t,onSuccess:s,onError:i,endpoint:a}=e;const{api:o,info:l}=(0,A.h6)(),{api:c}=(0,r.useContext)(se.B),[d,m]=(0,r.useState)(!1),{t:p,locale:h}=(0,j.PE)(),[f,x]=(0,r.useState)(""),[g,v]=(0,r.useState)(!1),[b,y]=(0,r.useState)(0),[S,C]=(0,r.useState)(""),[P,D]=(0,r.useState)(""),w=!!ne()(l,"ownerNft.did"),R=(0,Q.default)((async()=>{if(w){const{state:e}=await o.getDelegationState();return e}return{delegated:!0}}));if(R.loading)return(0,X.jsx)(u.ZP,{title:p("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:(0,X.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,X.jsx)(O.Z,{})})});if(R.error)return(0,X.jsx)(u.ZP,{title:p("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:(0,_.Z)(R.error)})});const k=async()=>{x(null),m(!0);try{const{inviteInfo:e}=await o.createTransferInvitation({input:{teamDid:n,role:"owner",remark:P.trim()}});C(e),y(E.length-1)}catch(e){const n=(0,_.Z)(e);x(n),i(e)}finally{m(!1)}},T=()=>{v(!1),y(0)},E=[{body:(0,X.jsxs)(W.Z,{component:"div",children:[(0,X.jsxs)(J.Z,{type:"warning",children:[(0,X.jsx)(W.Z,{children:p("team.transferNode.inviteDialog.tips.progress")}),(0,X.jsx)(W.Z,{children:p("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),(0,X.jsx)(J.Z,{type:"warning",children:(0,X.jsx)(W.Z,{children:p("team.transferNode.inviteDialog.tips.revoke")})}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}}),(0,X.jsx)(M.Z,{label:p("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:P,onChange:e=>{x(null),D(e.target.value)},disabled:d,"data-cy":"transfer-node-input-remark"}),(0,X.jsx)("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:p("common.cancel"),confirm:p("team.transferNode.inviteDialog.createInviteLink"),onCancel:t,onConfirm:w&&!ne()(R,"value.delegated")?()=>{v(!0),y(1)}:k},{body:()=>(0,X.jsx)(te.Z,{action:"delegate-transfer-nft",open:g,locale:h,checkFn:c.get,onClose:T,onSuccess:k,checkTimeout:3e5,webWalletUrl:(0,_.yP)(l),extraParams:{targetDID:l.did},messages:{title:p("team.transferNode.delegateDialog.title"),scan:p("team.transferNode.delegateDialog.scan"),confirm:p("team.transferNode.delegateDialog.confirm"),success:p("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const e=(0,_.ly)({inviteId:S.inviteId,endpoint:a});return(0,X.jsxs)("div",{children:[(0,X.jsx)(re,{children:p("team.transferNode.inviteDialog.createSuccessTip",{expireDate:(0,_.B2)(S.expireDate,h)})}),(0,X.jsx)("div",{style:{marginTop:"40px"}}),(0,X.jsx)(H.Z,{children:e})]})},confirm:p("common.confirm"),onConfirm:s}],I=E[b];return(0,X.jsxs)(u.ZP,{title:p("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[I.cancel&&(0,X.jsx)(Z.Z,{onClick:I.onCancel,color:"inherit",children:I.cancel}),(0,X.jsxs)(Z.Z,{onClick:I.onConfirm,color:"primary",disabled:d,variant:"contained",autoFocus:!0,children:[d&&(0,X.jsx)(O.Z,{size:16}),I.confirm]})]}),children:[(0,X.jsx)(U.Z,{component:"div",children:"function"===typeof I.body?I.body():I.body}),!!f&&(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:f})]})}ie.propTypes={teamDid:d().string.isRequired,onCancel:d().func.isRequired,onSuccess:d().func.isRequired,onError:d().func,endpoint:d().string},ie.defaultProps={onError:()=>{},endpoint:""};const re=a.Z.div(Y||(Y=(0,i.Z)(["\n font-size: 16px;\n font-weight: bold;\n"])));var ae,oe=t(62681),le=t(94464),ce=t(64886),de=t(12987),me=t(71246),pe=t(12673),ue=t(77277),he=t(70461),fe=t(9729);function xe(e){let{issuances:n,teamDid:t,onRefresh:s}=e;const{api:i,inService:a}=(0,A.h6)(),{t:o,locale:l}=(0,r.useContext)(j.RD),[c,d]=(0,r.useState)(null),[m,p]=(0,r.useState)(!1),{endpoint:u}=(0,z.DJ)(),h=()=>{p(!1),d(null)},x=e=>u?(0,_._)({id:e.id,endpoint:u}):"";function g(e){let{data:n}=e;return(0,X.jsxs)("div",{className:"issuance",children:[(0,X.jsxs)(f.Z,{display:"flex",justifyContent:"space-between",children:[(0,X.jsx)(B.Z,{permission:a?"":"mutate_team",role:a?_.Wf:[],children:e=>e?(0,X.jsx)(fe.Z,{passport:{title:n.title,name:n.name},onDelete:()=>d({title:o("team.passport.issuance.delete.title"),description:o("team.passport.issuance.delete.description",{link:x(n)}),confirm:o("common.delConfirm"),cancel:o("common.cancel"),onConfirm:()=>{(async e=>{let{id:n}=e;if(!m){p(!0);try{await i.deletePassportIssuance({input:{teamDid:t,sessionId:n}}),s()}catch(r){E.Z.error(r.message)}finally{p(!1),d(null)}}})(n)},onCancel:h})}):(0,X.jsx)(fe.Z,{passport:{title:n.title,name:n.name}})}),(0,X.jsxs)("div",{style:{color:"#999"},children:[o("common.expires"),":\xa0",(0,_.B2)(n.expireDate,l)]})]}),(0,X.jsx)(f.Z,{mt:2,children:(0,X.jsx)(H.Z,{children:x(n)})})]})}return(0,X.jsxs)(ge,{children:[n.map((e=>(0,X.jsx)(g,{data:e}))),c&&(0,X.jsx)(he.Z,{title:c.title,description:c.description,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}const ge=a.Z.div(ae||(ae=(0,i.Z)(["\n .MuiTableHead-root {\n display: none;\n }\n .issuance {\n padding: 16px 0;\n border-bottom: 1px solid #f0f0f0;\n .MuiTypography-root {\n display: inline-block;\n width: 100%;\n background: #f3f3f3;\n border-radius: 4px;\n padding-top: 6px;\n padding-bottom: 6px;\n }\n }\n"])));xe.propTypes={teamDid:d().string.isRequired,issuances:d().array,onRefresh:d().func},xe.defaultProps={issuances:[],onRefresh:()=>{}};var ve=t(5178),be=t(32322),ye=t(87806),je=t(25710),Ze=t(82638),Se=t(18901);function Ce(e){let{teamDid:n,ownerDid:t,needReceive:s,roles:i,onCancel:a,onSuccess:o,onError:l,showOwnerPassport:c}=e;const{api:d}=(0,A.h6)(),[m,p]=(0,r.useState)(!1),[h,f]=(0,r.useState)(""),{t:x}=(0,j.PE)(),[g,v]=(0,r.useState)(""),b=async()=>{if(g){f(null),p(!0);try{await d.createPassportIssuance({input:{teamDid:n,name:g,ownerDid:t}}),o()}catch(e){const n=(0,_.Z)(e);f(n),l(e)}finally{p(!1)}}else f(x("team.member.error.passportEmpty"))};return(0,X.jsxs)(u.ZP,{title:x("team.passport.issue"),fullWidth:!0,open:!0,onClick:e=>e.stopPropagation(),onClose:a,disableEscapeKeyDown:!0,PaperProps:{style:{minHeight:"auto"}},actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Z.Z,{onClick:a,color:"inherit",size:"small",children:x("common.cancel")}),(0,X.jsxs)(Z.Z,{onClick:b,color:"primary",size:"small",disabled:m||!g,variant:"contained",autoFocus:!0,"data-cy":"issue-passport-create-btn",children:[m&&(0,X.jsx)(O.Z,{size:16}),x(s?"team.passport.issuance.create.title":"oauth.issued")]})]}),children:[(0,X.jsx)(U.Z,{component:"div",children:(0,X.jsx)(W.Z,{component:"div",children:(0,X.jsxs)(K.Z,{style:{width:"100%"},variant:"outlined",children:[(0,X.jsx)(V.Z,{children:x("common.passport")}),(0,X.jsx)(F.Z,{"data-cy":"issue-passport-select-passport",value:g,onChange:e=>{f(null),v(e.target.value)},fullWidth:!0,label:x("common.passport"),disabled:m,onKeyPress:e=>{"Enter"===e.key&&(e.preventDefault(),b())},children:i.filter((e=>c||"owner"!==e.name)).map((e=>(0,X.jsx)(q.Z,{value:e.name,"data-cy":"issue-passport-select-option-".concat(e.name),children:(0,X.jsx)("span",{children:e.title||e.name})},e.name)))})]})})}),!!h&&(0,X.jsx)(J.Z,{type:"error",variant:"icon",children:h})]})}Ce.propTypes={teamDid:d().string.isRequired,ownerDid:d().string.isRequired,needReceive:d().bool,onCancel:d().func.isRequired,onSuccess:d().func.isRequired,onError:d().func,roles:d().array,showOwnerPassport:d().bool},Ce.defaultProps={onError:()=>{},roles:[],showOwnerPassport:!1,needReceive:!0};var Pe,De=t(26538),we=t.n(De);function Re(e){let{passport:n,user:t,color:s,width:i,icon:r,children:a,createPassportSvg:o,...l}=e;const{t:c}=(0,j.PE)();return(0,X.jsxs)(ke,{display:"flex",alignItems:"center",...l,children:[(0,X.jsx)("div",{dangerouslySetInnerHTML:{__html:o({title:n.title||n.name,issuer:n.issuer&&n.issuer.name,issuerDid:n.issuer&&n.issuer.id,ownerName:t.fullName,ownerDid:t.did,ownerAvatarUrl:t.avatar,revoked:n.revoked,preferredColor:s,width:i})}}),(0,X.jsxs)("div",{className:"body",children:[(0,X.jsxs)(f.Z,{className:"title",display:"flex",alignItems:"center",children:[we()(n.title),(0,X.jsxs)("div",{className:"status-icons",children:[r,n.revoked&&(0,X.jsx)(ye.Z,{})]})]}),n.expirationDate&&(0,X.jsx)(f.Z,{className:"title",display:"flex",alignItems:"center",children:c("team.passport.validUntil",{date:n.expirationDate})}),a]})]})}Re.propTypes={passport:d().any.isRequired,user:d().any.isRequired,color:d().string.isRequired,createPassportSvg:d().func.isRequired,icon:d().any,children:d().any,width:d().number},Re.defaultProps={icon:null,children:null,width:150};const ke=(0,a.Z)(f.Z)(Pe||(Pe=(0,i.Z)(["\n .body {\n padding: 0;\n margin-left: 24px;\n margin-top: 0;\n }\n .title {\n font-weight: 400;\n font-size: 16px;\n line-height: 19px;\n color: #222222;\n }\n .tip {\n display: flex;\n align-items: center;\n font-size: 14px;\n margin-top: 6px;\n color: #bbb;\n }\n .status-icons {\n svg {\n fill: #bfbfbf;\n height: 1.2em;\n margin-left: 0.4em;\n }\n }\n"])));var Te;function Ee(e){let{action:n,passport:t}=e;const{t:s}=(0,j.PE)(),{roles:i}=(0,z.DJ)(),r=i.find((e=>e.name===t.role));return(0,X.jsxs)("div",{children:[(0,X.jsx)("div",{children:s("enable"===n?"team.member.enablePassportDescription":"team.member.revokePassportDescription")}),r&&(0,X.jsx)(f.Z,{mt:3,fontWeight:"bold",children:s("team.member.passportPermissionTitle")}),r&&(0,X.jsx)(f.Z,{mt:1,children:r.description})]})}function Ie(e){var n;let{user:t,onCreate:s,createPassportSvg:i}=e;const{t:a}=(0,j.PE)(),{session:o}=(0,se.T)(),{roles:l,teamDid:c,teamIssuerDid:d,refresh:m,enablePassportIssuance:p,trustedPassports:u,passportColor:x,blocklet:g}=(0,z.DJ)(),{appIdList:b}=(0,L.y0)(),{api:y,inService:S}=(0,A.h6)(),[P,D]=(0,r.useState)(!1),[w,k]=(0,r.useState)(null),[T,I]=(0,r.useState)(!1),[N,O]=(0,r.useState)(""),U=[d,...b||[]].filter(Boolean),W=(ne()(t,"passports")||[]).map((e=>({...e,revoked:e.status===R.PASSPORT_STATUS.REVOKED}))),q=async e=>{if(!P){D(!0);try{const n=e.status===R.PASSPORT_STATUS.REVOKED?"enableUserPassport":"revokeUserPassport";await y[n]({input:{teamDid:c,userDid:t.did,passportId:e.id}}),m()}catch(n){E.Z.error((0,_.Z)(n))}finally{D(!1),k(null)}}},F=(e,n)=>t.did===o.user.did&&o.user.passportId&&o.user.passportId===n.id?{revokable:!1,message:a("team.passport.shouldNotDeleteCurrent")}:e?c===n.issuer.id&&"owner"===n.name?{revokable:!1,message:a("team.passport.noPermission")}:{revokable:!0}:{revokable:!1,message:a("team.passport.noPermission")},M=W.filter((e=>!N||e.title.includes(N)||e.name.includes(N)));return(0,X.jsxs)(Ne,{children:[(0,X.jsxs)(Se.Z,{children:[(0,X.jsx)("div",{className:"left",children:(0,X.jsx)(Ze.Z,{placeholder:a("team.passport.search"),value:N,onChange:e=>O(e.target.value)})}),(0,X.jsx)("div",{className:"right",children:p&&!!t.approved&&(0,X.jsx)(B.Z,{permission:S?"":"mutate_team",role:S?_.Wf:[],children:(0,X.jsxs)(Z.Z,{variant:"contained",color:"primary","data-cy":"issue-passport",onClick:()=>I(!0),children:[(0,X.jsx)(v.Z,{style:{fontSize:16,marginRight:4}}),a("team.passport.issue")]})})})]}),(0,X.jsxs)(f.Z,{children:[M.map((e=>(0,X.jsx)(B.Z,{permission:S?"":"mutate_team",role:S?_.Wf:[],children:n=>(0,X.jsxs)(f.Z,{className:"passport-item",display:"flex",justifyContent:"space-between",alignItems:"center",mt:3,children:[(0,X.jsx)(Re,{passport:e,user:t,color:x,createPassportSvg:i,icon:U.length&&!U.includes(e.issuer.id)?(0,X.jsx)(C.Z,{}):null,children:!!U.length&&!U.includes(e.issuer.id)&&(0,X.jsxs)("div",{className:"tip",children:[e.issuer.id!==d&&!u.some((n=>n.issuerDid===e.issuer.id))&&(0,X.jsx)(h.Z,{title:a("team.passport.notTrustedIssuerTip"),children:(0,X.jsx)(f.Z,{component:ve.Z,style:{fontSize:"1.3em"},color:"error.main",mr:.5})}),(0,X.jsx)("span",{children:a("team.passport.issueBy",{name:e.issuer.name})})]})}),(0,X.jsx)(f.Z,{children:F(n,e).revokable?(0,X.jsxs)(Z.Z,{variant:"outlined",color:e.revoked?"primary":"secondary",onClick:()=>{return(n=e).status===R.PASSPORT_STATUS.REVOKED?k({title:a("team.member.enablePassport"),description:(0,X.jsx)(Ee,{action:"enable",passport:n}),confirm:a("common.enable"),cancel:a("common.cancel"),onConfirm:()=>{q(n)},onCancel:()=>{D(!1),k(null)},color:"primary"}):k({title:a("team.member.revokePassport"),description:(0,X.jsx)(Ee,{action:"revoke",passport:n}),confirm:a("common.revoke"),cancel:a("common.cancel"),onConfirm:()=>{q(n)},onCancel:()=>{D(!1),k(null)}});var n},children:[e.revoked?(0,X.jsx)(v.Z,{style:{fontSize:16,marginRight:4}}):(0,X.jsx)(ye.Z,{style:{height:16,marginRight:4}}),e.revoked?a("common.enable"):a("common.revoke")]}):(0,X.jsx)(h.Z,{title:F(n,e).message,children:(0,X.jsx)(ve.Z,{style:{color:"#ddd"}})})})]})},e.id))),!M.length&&(0,X.jsx)(je.Z,{children:a("common.empty")})]}),T&&(0,X.jsx)(Ce,{teamDid:c,ownerDid:t.did,needReceive:(0,be.h1)(t)===t.did,roles:l,onCancel:()=>I(!1),onSuccess:()=>{s(),I(!1)},showOwnerPassport:g&&!(null!==(n=g.settings)&&void 0!==n&&n.owner)}),w&&(0,X.jsx)(he.Z,{title:w.title,description:w.description,confirm:w.confirm,cancel:w.cancel,params:w.params,onConfirm:w.onConfirm,onCancel:w.onCancel,color:w.color})]})}Ee.propTypes={action:d().string.isRequired,passport:d().object.isRequired},Ee.defaultProps={},Ie.propTypes={user:d().object.isRequired,createPassportSvg:d().func.isRequired,onCreate:d().func},Ie.defaultProps={onCreate:()=>{}};const Ne=a.Z.div(Te||(Te=(0,i.Z)(["\n .passport-item {\n .MuiButton-outlinedSecondary {\n color: #f16e6e;\n fill: #f16e6e;\n background: #fcf3f3;\n border: 0;\n &:hover {\n border: 0;\n }\n }\n }\n"])));var Ae=t(15098);const ze=(e,n)=>e.nodeOwner&&e.nodeOwner.did===n,Le=(e,n)=>e&&e.did===n;function Be(e){let{user:n,onCancel:t,onSuccess:s,onError:i,children:a}=e;const{api:o,info:l,inService:c}=(0,A.h6)(),{session:d}=(0,se.T)(),{teamDid:m,refresh:p}=(0,z.DJ)(),{t:u}=(0,j.PE)(),[h,f]=(0,r.useState)(!1),[x,g]=(0,r.useState)(!1),v={title:n.approved?u("team.member.forbidLogin"):u("team.member.allowLogin"),description:n.approved?u("team.member.forbidLoginDescription"):u("team.member.allowLoginDescription"),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:()=>{(async e=>{const{did:n,approved:t}=e;if(!h){f(!0);try{await o.updateUserApproval({input:{teamDid:m,user:{did:n,approved:!t}}}),g(!1),s(),p()}catch(r){E.Z.error((0,_.Z)(r)),i()}finally{f(!1)}}})(n)},onCancel:()=>{f(!1),g(!1),t()},color:n.approved?"error":"primary"};let b;return b=!(0,Ae.hasActiveOwnerPassport)(n)&&((c||l.nodeOwner&&!ze(l,n.did))&&!Le(d.user,n.did)),b?(0,X.jsxs)(X.Fragment,{children:["function"===typeof a?a({can:b,open:()=>g(!0)}):a,x?(0,X.jsx)(he.Z,{title:v.title,description:v.description,confirm:v.confirm,cancel:v.cancel,params:v.params,onConfirm:v.onConfirm,onCancel:v.onCancel,color:v.color}):null]}):null}Be.propTypes={user:d().object,onSuccess:d().func,onCancel:d().func,onError:d().func,children:d().oneOfType([d().object,d().func])},Be.defaultProps={user:{},onSuccess:()=>{},onCancel:()=>{},onError:()=>{},children:null};var _e,Oe,Ue,We=t(6352),qe=t.n(We);function Fe(e,n,t){if(e&&e.startsWith(R.USER_AVATAR_URL_PREFIX)){const s=window.env.apiPrefix||"/";return t?qe()(s,R.USER_AVATAR_PATH_PREFIX,e.replace(R.USER_AVATAR_URL_PREFIX,"")):qe()(s,R.USER_AVATAR_PATH_PREFIX,n,e.replace(R.USER_AVATAR_URL_PREFIX,""))}return e}function Me(e){let{user:n}=e;return(n.connectedAccounts||[]).map((e=>(0,X.jsx)(ce.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.provider,children:(0,X.jsx)(N.Z,{did:e.did})},e.did)))}Me.propTypes={user:d().object.isRequired},Me.defaultProps={},d().string.isRequired;const Ve="info";function Ke(e){let{userDid:n,onCancel:t,initTab:s,createPassportSvg:i}=e;const{api:a,ws:{useSubscription:o},inService:l}=(0,A.h6)(),{roles:c,teamDid:d,enablePassportIssuance:m}=(0,z.DJ)(),{t:p,locale:h}=(0,j.PE)(),x=(0,pe.Z)({user:null,issuances:null,tab:s||Ve}),g=async(e,n)=>{try{const t=await a.doBatchQuery({getUser:{input:{teamDid:e,user:{did:n},options:{includeTags:!0}}},getPassportIssuances:{input:{teamDid:e,ownerDid:n}}});t.getUser.user&&(t.getUser.user.avatar=Fe(t.getUser.user.avatar,e,l),t.getUser.user.passports=(t.getUser.user.passports||[]).filter((e=>e.issuer))),x.user=t.getUser.user||{},x.issuances=t.getPassportIssuances.list||[]}catch(t){E.Z.error((0,_.Z)(t))}};(0,r.useEffect)((()=>{d&&g(d,n)}),[n,d]);o(R.EVENTS.USER_UPDATED,(e=>{e.teamDid===d&&e.user&&e.user.did===n&&g(d,n)}),[n,d]),(0,r.useEffect)((()=>{x.issuances&&!x.issuances.length&&"issuances"===x.tab&&(x.tab=Ve)}),[x.issuances]);const v=async e=>{await g(d,e.did),x.tab=Ve},b={auth0:"Auth0",wallet:"DID wallet",federated:"Federated"},y={info:{label:p("common.basicInfo"),value:Ve,component:()=>{var e,n;return(x.user?[{name:p("team.member.name"),value:x.user.fullName},{name:p("common.email"),value:x.user.email},{name:p("team.member.source"),value:(0,X.jsx)(f.Z,{display:"flex",alignItems:"center",children:b[(null===(e=x.user)||void 0===e?void 0:e.sourceProvider)||R.USER_TYPE.WALLET]||(null===(n=x.user)||void 0===n?void 0:n.sourceProvider)})},{name:p("team.member.allowLogin"),value:x.user.approved?p("common.yes"):p("common.no")},{name:p("team.member.lastLogin"),value:(0,_.B2)(x.user.lastLoginAt,h)},{name:p("team.member.lastLoginIp"),value:x.user.lastLoginIp||""},{name:p("common.createdAt"),value:(0,_.B2)(x.user.createdAt,h)},{name:p("common.remark"),value:x.user.remark||"--"},Array.isArray(x.user.tags)&&x.user.tags.length>0?{name:p("common.tags"),value:x.user.tags.map((e=>(0,X.jsx)(I.Z,{style:{background:e.color,color:(0,P.getTextColor)(e.color),marginRight:4},children:e.title},e.id)))}:null].filter(Boolean):[]).map((e=>e.name===p("common.did")?(0,X.jsx)(ce.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:()=>p("common.did"),children:e.value},e.name):(0,X.jsx)(ce.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)))}},oauth:{label:p("team.member.connectedAccounts"),value:"oauth",component:()=>(0,X.jsx)(Me,{user:x.user,onChangeUser:v})},passports:{label:p("common.passport"),value:"passports",component:()=>(0,X.jsx)(Ie,{user:x.user,teamDid:d,roles:c,createPassportSvg:i,onCreate:()=>{g(d,n).then((()=>{m&&x.issuances&&x.issuances.length&&(x.tab="issuances")}))},onRefresh:()=>{g(d,n)}})},issuances:{label:p("team.passport.issuance.pending"),value:"issuances",component:()=>(0,X.jsx)(xe,{issuances:x.issuances||[],teamDid:d,onRefresh:()=>g(d,n)})}},Z=Object.values(y).map((e=>{let{label:n,value:t}=e;return{label:n,value:t}})).filter((e=>{if("issuances"===e.value)return m&&x.issuances&&!!x.issuances.length;if("oauth"===e.value){var n;return((null===(n=x.user)||void 0===n?void 0:n.connectedAccounts)||[]).find((e=>{var n;return e.provider!==((null===(n=x.user)||void 0===n?void 0:n.sourceProvider)||ue.LOGIN_PROVIDER.WALLET)}))}return!0})),S=y[x.tab]||y.info;return(0,X.jsx)(u.ZP,{title:p("common.member"),onClose:t,open:!0,PaperProps:{style:{maxWidth:632,minHeight:"80vh"}},fullWidth:!0,actions:x.user&&(0,X.jsx)(B.Z,{permission:l?"":"mutate_team",role:l?_.Wf:[],children:(0,X.jsx)(Be,{user:x.user,children:e=>{let{open:n}=e;return(0,X.jsxs)(Xe,{onClick:n,children:[x.user.approved?(0,X.jsx)(de.Z,{style:{fontSize:"1.2em",marginRight:"0.4em"}}):(0,X.jsx)(me.Z,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),x.user.approved?p("team.member.forbidLogin"):p("team.member.allowLogin")]})}})}),children:(0,X.jsxs)(Je,{children:[!x.user&&(0,X.jsx)(He,{children:(0,X.jsx)(O.Z,{})}),x.user&&(0,X.jsxs)("div",{children:[(0,X.jsxs)(f.Z,{display:"flex",alignItems:"center",className:"info",children:[(0,X.jsx)(oe.Z,{src:x.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),(0,X.jsxs)(f.Z,{children:[(0,X.jsx)(f.Z,{className:"name",children:x.user.fullName}),(0,X.jsx)(f.Z,{className:"did",mt:1,children:(0,X.jsx)(N.Z,{did:x.user.did})})]})]}),(0,X.jsx)(f.Z,{mx:3,className:"tabs",children:(0,X.jsx)(le.Z,{tabs:Z,current:x.tab,onChange:e=>{x.tab=e},scrollButtons:"auto"})}),(0,X.jsx)("div",{className:"body",children:(0,X.jsx)(S.component,{})})]})]})})}Ke.propTypes={userDid:d().string.isRequired,onCancel:d().func.isRequired,createPassportSvg:d().func.isRequired,initTab:d().string},Ke.defaultProps={initTab:Ve};const Je=a.Z.div(_e||(_e=(0,i.Z)(["\n .info {\n .name {\n font-weight: 400;\n font-size: 18px;\n line-height: 25px;\n color: #222222;\n }\n }\n\n .tabs {\n margin-top: 24px;\n margin-left: 0;\n margin-right: 0;\n }\n\n .body {\n margin-top: 24px;\n }\n"]))),He=a.Z.div(Oe||(Oe=(0,i.Z)(["\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 200px;\n"]))),Xe=a.Z.div(Ue||(Ue=(0,i.Z)(["\n flex-shrink: 0;\n width: 100%;\n height: 64px;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n color: #999;\n fill: #999;\n font-size: 16px;\n border-top: 1px solid #f0f0f0;\n position: sticky;\n bottom: 0;\n background: #fff;\n z-index: 10;\n"])));var $e,Ge=t(27773);function Ye(){const{api:e,inService:n}=(0,A.h6)(),{t:t,locale:s}=(0,r.useContext)(j.RD),{teamDid:i,invitations:a,refresh:o,endpoint:l}=(0,z.DJ)(),[c,d]=(0,r.useState)(null),[m,p]=(0,r.useState)(!1),u=()=>{p(!1),d(null)},h=e=>l?(0,_.ly)({inviteId:e.inviteId,endpoint:l}):"",f=[{label:t("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:e=>{const n=a[e];return l?(0,X.jsx)(H.Z,{children:h(n)}):(0,X.jsx)(O.Z,{size:16})}}},{label:t("common.role"),name:"role",widtn:70},{label:t("common.remark"),name:"remark",options:{customBodyRender:e=>e||"--"}},{label:t("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:(e,n)=>{var t;let{rowIndex:s}=n;const i=a[s];return null===i||void 0===i||null===(t=i.inviter)||void 0===t?void 0:t.fullName}}},{label:t("common.expires"),name:"expireDate",options:{customBodyRender:e=>(0,X.jsx)(w.Z,{value:e,locale:s})}},{label:t("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:s=>{const r=a[s];return(0,X.jsx)(B.Z,{permission:n?"":"mutate_team",role:n?_.Wf:[],children:(0,X.jsxs)(Z.Z,{onClick:()=>d({title:t("team.inviting.delete.title"),description:t("team.inviting.delete.description",{link:h(r)}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>(async n=>{let{inviteId:t}=n;if(!m){p(!0);try{await e.deleteInvitation({input:{teamDid:i,inviteId:t}}),o(),await(0,_._v)(800)}catch(s){console.error(s)}finally{p(!1),d(null)}}})(r),onCancel:u}),size:"small",color:"error",variant:"text",children:[(0,X.jsx)(Ge.default,{style:{fontSize:"1.2em"}}),t("common.delete")]})})}}}];return(0,X.jsxs)(Qe,{children:[a.length?(0,X.jsx)(D.Z,{locale:s,data:[...a],columns:f,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1}}):(0,X.jsx)(je.Z,{children:t("common.empty")}),c&&(0,X.jsx)(he.Z,{title:c.title,description:c.description,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}const Qe=a.Z.div($e||($e=(0,i.Z)(["\n margin-top: -20px;\n"])));Ye.propTypes={},Ye.defaultProps={};var en,nn=t(46954),tn=t(44067),sn=t(92726);function rn(e){let{user:n,onIssuePassport:t}=e;const{teamDid:s,roles:i}=(0,z.DJ)(),{t:a}=(0,r.useContext)(j.RD),[o,l]=(0,r.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(sn.Z,{"data-cy":"member-actions",actions:[{icon:(0,X.jsx)(v.Z,{fontSize:"small"}),text:a("team.passport.issue"),"data-cy":"action-issue-passport",onClick:e=>{e.stopPropagation(),l(!0)}},e=>{let{close:t}=e;return(0,X.jsx)(Be,{user:n,children:e=>{let{open:s}=e;return(0,X.jsxs)(q.Z,{dense:!0,onClick:e=>{e.stopPropagation(),t(),s(e)},"data-cy":"action-toggle-block",children:[(0,X.jsx)(nn.Z,{style:{minWidth:24,marginRight:8},children:n.approved?(0,X.jsx)(de.Z,{}):(0,X.jsx)(me.Z,{})}),(0,X.jsx)(tn.Z,{primary:n.approved?a("team.member.forbidLogin"):a("team.member.allowLogin")})]})}},"toggle-approval")}]}),o&&(0,X.jsx)(Ce,{teamDid:s,ownerDid:n.did,needReceive:(0,be.h1)(n)===n.did,roles:i,onCancel:()=>l(!1),onSuccess:()=>{t(),l(!1)}})]})}rn.propTypes={user:d().object.isRequired,onIssuePassport:d().func},rn.defaultProps={onIssuePassport:()=>{}};const an="$all",on="$none",ln=(e,n)=>{const t=e.find((e=>e.key===n));return(null===t||void 0===t?void 0:t.value)||0},cn=(e,n)=>{const t=e.passports||[];return!!t.length&&!t.some((e=>{var t;return n.includes(null===(t=e.issuer)||void 0===t?void 0:t.id)}))};function dn(e){let{user:n}=e;const{t:t}=(0,r.useContext)(j.RD),s=(0,X.jsxs)("div",{className:"member-block",children:[(0,X.jsxs)("div",{className:"member-avatar",children:[(0,X.jsx)(y.Z,{src:"".concat(n.avatar,"?imageFilter=resize&w=48&h=48"),size:32,did:n.did,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),!n.approved&&(0,X.jsx)("did",{className:"badge-block"}),n.isFromExternal&&(0,X.jsx)(h.Z,{title:t("team.passport.externalPassport"),children:(0,X.jsx)(f.Z,{ml:1,className:"icon",children:(0,X.jsx)(C.Z,{})})})]}),(0,X.jsxs)("div",{className:"member-meta",children:[(0,X.jsx)("div",{className:"member-text",children:n.fullName}),Array.isArray(n.tags)&&n.tags.length>0&&(0,X.jsx)("div",{className:"member-tags",children:n.tags.map((e=>(0,X.jsx)(I.Z,{style:{background:e.color,color:(0,P.getTextColor)(e.color),marginRight:4},children:e.title},e.id)))})]})]});return n.approved?s:(0,X.jsx)(f.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(h.Z,{title:t("team.member.forbidLoginDescription"),children:s})})}function mn(e){let{type:n,createPassportSvg:t}=e;const{appIdList:s=[]}=(0,L.y0)(),{teamDid:i,invitations:a,teamIssuerDid:o,roles:c,refresh:d,enablePassportIssuance:m,endpoint:h,api:y}=(0,z.DJ)(),{inService:C,ws:{useSubscription:P}}=(0,A.h6)(),{t:I,locale:O}=(0,r.useContext)(j.RD),[U,W]=(0,r.useState)(!1),[q,F]=(0,r.useState)(!1),[M,V]=(0,r.useState)(!1),[K,J]=(0,r.useState)(!1),[H,G]=(0,r.useState)(!1),[Y,Q]=(0,r.useState)([]),[ee,ne]=(0,r.useState)(),[te,se]=(0,r.useState)([]),[re]=(0,k.Z)({did:void 0}),ae="members-".concat(i),oe=(0,D.$)(ae),[le,ce]=(0,r.useState)({role:an,searchText:oe.searchText||"",hideBlocked:!1,pageSize:oe.rowsPerPage||10,page:oe.page?oe.page+1:1});(0,T.Z)((async()=>{if(re.did){const{user:e}=await y.getUser({did:re.did});e&&J(e)}}));const de=(c||[]).map((e=>({name:e.name,title:e.title,num:ln(te,e.name)})));de.unshift({name:an,title:"All Members",num:ln(te,an)}),de.push({name:on,title:"Other",num:ln(te,on)});const me=()=>{const e={includeTags:!0};le.hideBlocked&&(e.approved=!0),e.role=le.role,le.searchText&&(e.search=le.searchText),G(!0),y.getUsers({query:e,paging:{page:le.page,pageSize:le.pageSize}}).then((e=>{G(!1),(e.users||[]).forEach((e=>{e.isFromExternal=cn(e,l()(s)?[o]:s),e.avatar=Fe(e.avatar,i,C),e.passports=(e.passports||[]).filter((e=>e.issuer))})),Q(e.users||[]),ne(e.paging.total)})).catch((e=>{G(!1),E.Z.error(e.message)}))},pe=()=>{y.getUsersCountPerRole().then((e=>{se(e.counts||[])})).catch((e=>{E.Z.error(e.message)}))},ue=e=>{e.teamDid===i&&(me(),pe())};(0,r.useEffect)((()=>{me()}),["".concat(le.hideBlocked,"-").concat(le.role,"-").concat(le.page,"-").concat(le.pageSize,"-").concat(le.searchText)]),(0,r.useEffect)((()=>{pe()}),[]),P(R.EVENTS.USER_UPDATED,ue,[le]),P(R.EVENTS.USER_ADDED,ue,[le]);const he=m,fe=[{label:I("common.name"),name:"fullName",options:{customBodyRenderLite:e=>{const n=Y[e];return(0,X.jsx)("div",{"data-cy":"member-name-".concat(n.fullName),children:(0,X.jsx)(dn,{user:n})},n.did)}}},{label:I("common.address"),name:"did",options:{customBodyRender:e=>(0,X.jsx)(N.Z,{size:14,responsive:!0,copyable:!1,did:e})}},{label:I("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:e=>(0,X.jsx)(w.Z,{value:e,locale:O})}},{label:I("team.member.lastLoginIp"),name:"lastLoginIp",options:{customBodyRender:e=>e||"-"}},{label:I("team.member.source"),name:"sourceProvider",options:{customBodyRenderLite:e=>{const n=Y[e],t=n.sourceProvider||R.USER_TYPE.WALLET,s={auth0:"Auth0",wallet:"DID wallet",federated:"Federated"}[t]||t;return n.sourceAppPid?"".concat(s," (").concat(I("team.member.federated"),")"):s}}},{label:I("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:e=>{const n=Y[e];return(0,X.jsx)(B.Z,{permission:C?"":"mutate_team",role:C?_.Wf:[],children:(0,X.jsx)(rn,{user:n,onIssuePassport:()=>J({...n,initTab:"issuances"})})})}}}],xe=[];he&&(xe.push((0,X.jsxs)(Z.Z,{variant:"outlined",style:{flexShrink:0,marginRight:16},color:"primary",size:"small",onClick:()=>{V(!0)},children:[(0,X.jsx)(S.Z,{style:{height:"1em",marginRight:4}}),I("common.inviting"),a.length?" (".concat(a.length,")"):""]}),(0,X.jsx)(B.Z,{permission:C?"":"mutate_team",role:C?_.Wf:[],children:(0,X.jsxs)(Z.Z,{style:{flexShrink:0,marginRight:16},variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"invite-member",onClick:()=>W(!0),children:[(0,X.jsx)(v.Z,{style:{fontSize:"1.3em",marginRight:4}}),I("team.invite")]})})),"server"===n&&xe.push((0,X.jsx)(B.Z,{role:"owner",children:(0,X.jsxs)(Z.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"invite-member",onClick:()=>F(!0),children:[(0,X.jsx)(b.Z,{style:{fontSize:"1.3em",marginRight:4}}),I("team.transferNode.name")]})})));const ge={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const s=Y[t];J(s)},page:le.page-1,rowsPerPage:le.pageSize,count:ee,searchDebounceTime:600};return(0,X.jsxs)(pn,{children:[(0,X.jsxs)(f.Z,{className:"main",display:"flex",sx:{mt:C?4:0},children:[(0,X.jsx)("div",{className:"left",children:(0,X.jsx)("div",{className:"tabs",children:de.map((e=>(0,X.jsxs)("div",{className:"tab ".concat(le.role===e.name?"active":""),onClick:()=>{return n=e.name,void(H||ce((e=>({...e,role:n,hideBlocked:!1,searchText:"",page:1}))));var n},children:[(0,X.jsx)("span",{className:"text",children:e.title}),(0,X.jsx)("span",{className:p()("badge",{"is-rect":e.num>999}),children:e.num})]},e.name)))})}),(0,X.jsx)("div",{className:"right",children:(0,X.jsx)(D.Z,{className:"main-table",verticalKeyWidth:100,locale:O,durable:ae,durableKeys:["page","rowsPerPage"],title:(0,X.jsx)("div",{className:"table-toolbar-left",children:(0,X.jsx)(x.Z,{control:(0,X.jsx)(g.Z,{sx:{display:"flex !important"},disabled:H,color:"primary",checked:le.hideBlocked,onChange:e=>{return n=e.target.checked,void ce((e=>({...e,hideBlocked:n,page:1})));var n}}),label:I("team.member.hideBlockedMember")})}),data:Y,columns:fe,customButtons:xe,options:ge,loading:H,onChange:e=>{let{page:n,rowsPerPage:t,searchText:s}=e;le.pageSize!==t?ce((e=>({...e,pageSize:t,page:1}))):le.page!==n+1?ce((e=>({...e,page:n+1}))):le.searchText!==s&&ce((e=>({...e,searchText:s,page:1})))}})})]}),(0,X.jsx)(u.ZP,{title:I("common.inviting"),onClose:()=>V(!1),open:M,maxWidth:"lg",fullWidth:!0,children:(0,X.jsx)(Ye,{})}),K&&(0,X.jsx)(Ke,{onCancel:()=>J(null),userDid:K.did,createPassportSvg:t,initTab:K.initTab}),U&&(0,X.jsx)($,{teamDid:i,endpoint:h,roles:c,onCancel:()=>W(!1),onSuccess:()=>{d(),W(!1)}}),q&&(0,X.jsx)(ie,{teamDid:i,endpoint:h,roles:c,onCancel:()=>F(!1),onSuccess:()=>{d(),F(!1)}})]})}dn.propTypes={user:d().object.isRequired};const pn=a.Z.div(en||(en=(0,i.Z)(["\n .main {\n .left {\n width: 168px;\n flex-shrink: 0;\n margin-right: 65px;\n .tabs {\n padding-top: 16px;\n .tab {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 16px;\n transition: background 0.4s;\n\n width: 168px;\n height: 36px;\n border-radius: 8px;\n\n cursor: pointer;\n user-select: none;\n\n &:nth-child(n + 2) {\n margin-top: 24px;\n }\n\n &.active {\n background: #f2f2f2;\n }\n\n &:hover {\n background: #f2f2f2;\n }\n\n .text {\n font-weight: 400;\n font-size: 16px;\n line-height: 19px;\n\n color: #222222;\n }\n\n .badge {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 20px;\n height: 20px;\n border-radius: 100%;\n color: #fff;\n background: #666666;\n font-size: 10px;\n font-weight: 400;\n &.is-rect {\n width: auto;\n border-radius: 8px;\n padding: 0 4px;\n }\n }\n }\n }\n @media (max-width: ","px) {\n display: none;\n }\n }\n .right {\n flex-grow: 1;\n }\n }\n\n .member-block {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n .member-avatar {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .member-meta {\n margin-left: 10px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n }\n .badge-block {\n width: 14px;\n height: 14px;\n position: absolute;\n right: -4px;\n top: -4px;\n background: #ff5757;\n border-radius: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n &::after {\n content: '';\n width: 6px;\n height: 2px;\n background: #fefefe;\n }\n }\n }\n\n .table-toolbar-left {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 7px 0;\n }\n"])),(e=>e.theme.breakpoints.values.md));mn.propTypes={type:d().oneOf(["server","blocklet"]).isRequired,createPassportSvg:d().func.isRequired}},82638:(e,n,t)=>{"use strict";t.d(n,{Z:()=>c});var s,i=t(71171),r=t(33518),a=t(47020),o=t(57201),l=t(96266);const c=(0,r.Z)((e=>{let{children:n,...t}=e;return(0,l.jsx)(a.Z,{...t,id:"outlined-basic",variant:"outlined",InputProps:{startAdornment:(0,l.jsx)(o.default,{})},size:"small",children:n})}))(s||(s=(0,i.Z)(["\n .MuiOutlinedInput-root {\n color: #999;\n &.MuiInputBase-adornedStart .MuiSvgIcon-root {\n color: #bfbfbf;\n }\n opacity: 1;\n border-radius: 36px;\n background: #f8f8f8;\n padding-left: 16px;\n input {\n padding-left: 8px;\n font-weight: bold;\n &::placeholder {\n opacity: 1;\n color: #bfbfbf;\n }\n padding-top: 8.5px;\n padding-bottom: 8.5px;\n }\n }\n\n .MuiOutlinedInput-notchedOutline,\n .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline,\n .Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: #eee;\n border-width: 1px;\n }\n"])))},18901:(e,n,t)=>{"use strict";t.d(n,{Z:()=>r});var s,i=t(71171);const r=t(33518).Z.div(s||(s=(0,i.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 14px;\n .left,\n .right {\n }\n .right {\n display: flex;\n align-items: center;\n }\n .tabs {\n .MuiButton-root {\n border: none;\n color: #999;\n &.active {\n color: #222;\n }\n }\n }\n\n @media (max-width: 600px) {\n display: block;\n .right {\n margin-top: 12px;\n }\n }\n"])))}}]);