@abtnode/blocklet-services 1.16.15-beta-12f50442 → 1.16.15-beta-d649cecc
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.
- package/api/libs/open-graph/template.js +2 -8
- package/api/middlewares/check-federated-cors-call.js +9 -10
- package/api/routes/federated.js +11 -0
- package/build/asset-manifest.json +7 -7
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/2653.b9c51282.chunk.js +2 -0
- package/build/static/js/{4802.4e44fe6c.chunk.js → 4802.af6f7b74.chunk.js} +2 -2
- package/build/static/js/main.95c13005.js +3 -0
- package/package.json +18 -18
- package/build/static/js/2653.892d84ff.chunk.js +0 -2
- package/build/static/js/main.da61bea1.js +0 -3
- /package/build/static/js/{main.da61bea1.js.LICENSE.txt → main.95c13005.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.15-beta-
|
|
6
|
+
"version": "1.16.15-beta-d649cecc",
|
|
7
7
|
"description": "Provide unified services for every blocklet",
|
|
8
8
|
"main": "api/index.js",
|
|
9
9
|
"files": [
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@abtnode/analytics": "1.16.15-beta-
|
|
37
|
-
"@abtnode/auth": "1.16.15-beta-
|
|
38
|
-
"@abtnode/client": "1.16.15-beta-
|
|
39
|
-
"@abtnode/connect-storage": "1.16.15-beta-
|
|
40
|
-
"@abtnode/constant": "1.16.15-beta-
|
|
41
|
-
"@abtnode/core": "1.16.15-beta-
|
|
42
|
-
"@abtnode/cron": "1.16.15-beta-
|
|
43
|
-
"@abtnode/logger": "1.16.15-beta-
|
|
44
|
-
"@abtnode/models": "1.16.15-beta-
|
|
45
|
-
"@abtnode/router-templates": "1.16.15-beta-
|
|
46
|
-
"@abtnode/util": "1.16.15-beta-
|
|
36
|
+
"@abtnode/analytics": "1.16.15-beta-d649cecc",
|
|
37
|
+
"@abtnode/auth": "1.16.15-beta-d649cecc",
|
|
38
|
+
"@abtnode/client": "1.16.15-beta-d649cecc",
|
|
39
|
+
"@abtnode/connect-storage": "1.16.15-beta-d649cecc",
|
|
40
|
+
"@abtnode/constant": "1.16.15-beta-d649cecc",
|
|
41
|
+
"@abtnode/core": "1.16.15-beta-d649cecc",
|
|
42
|
+
"@abtnode/cron": "1.16.15-beta-d649cecc",
|
|
43
|
+
"@abtnode/logger": "1.16.15-beta-d649cecc",
|
|
44
|
+
"@abtnode/models": "1.16.15-beta-d649cecc",
|
|
45
|
+
"@abtnode/router-templates": "1.16.15-beta-d649cecc",
|
|
46
|
+
"@abtnode/util": "1.16.15-beta-d649cecc",
|
|
47
47
|
"@arcblock/did": "^1.18.89",
|
|
48
48
|
"@arcblock/did-auth": "1.18.89",
|
|
49
49
|
"@arcblock/did-ext": "^1.18.89",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@arcblock/jwt": "1.18.89",
|
|
53
53
|
"@arcblock/validator": "^1.18.89",
|
|
54
54
|
"@arcblock/ws": "1.18.89",
|
|
55
|
-
"@blocklet/constant": "1.16.15-beta-
|
|
55
|
+
"@blocklet/constant": "1.16.15-beta-d649cecc",
|
|
56
56
|
"@blocklet/form-builder": "^0.1.11",
|
|
57
57
|
"@blocklet/form-collector": "^0.1.6",
|
|
58
|
-
"@blocklet/meta": "1.16.15-beta-
|
|
59
|
-
"@blocklet/sdk": "1.16.15-beta-
|
|
58
|
+
"@blocklet/meta": "1.16.15-beta-d649cecc",
|
|
59
|
+
"@blocklet/sdk": "1.16.15-beta-d649cecc",
|
|
60
60
|
"@did-connect/authenticator": "^2.2.0",
|
|
61
61
|
"@did-connect/relay-adapter-express": "^2.2.0",
|
|
62
62
|
"@did-connect/storage-nedb": "^2.2.0",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"@nedb/core": "^2.1.2"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
|
-
"@abtnode/ux": "1.16.15-beta-
|
|
100
|
+
"@abtnode/ux": "1.16.15-beta-d649cecc",
|
|
101
101
|
"@arcblock/did-connect": "^2.7.9",
|
|
102
102
|
"@arcblock/icons": "^2.7.9",
|
|
103
103
|
"@arcblock/ux": "^2.7.9",
|
|
104
104
|
"@blocklet/launcher-layout": "2.1.101",
|
|
105
|
-
"@blocklet/tracker": "1.16.15-beta-
|
|
105
|
+
"@blocklet/tracker": "1.16.15-beta-d649cecc",
|
|
106
106
|
"@blocklet/ui-react": "^2.7.9",
|
|
107
107
|
"@emotion/react": "^11.10.4",
|
|
108
108
|
"@emotion/styled": "^11.10.4",
|
|
@@ -173,5 +173,5 @@
|
|
|
173
173
|
"url": "https://github.com/ArcBlock/blocklet-server/issues",
|
|
174
174
|
"email": "shijun@arcblock.io"
|
|
175
175
|
},
|
|
176
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "56941d1056a9e5f189992ace6e93971aa4226d07"
|
|
177
177
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[2653],{86384:function(e,n,t){n.h1=void 0;var r=t(59505);function i(e){return(null===e||void 0===e?void 0:e.connectedAccounts)||[]}function o(e){return i(e).find((function(e){return e.provider===r.LOGIN_PROVIDER.WALLET}))}n.h1=function(e){var n=o(e);return null===n||void 0===n?void 0:n.did}},80714:function(e,n,t){t.d(n,{Z:function(){return k}});var r,i=t(71171),o=t(32723),a=t(34795),s=t(33028),c=t(96234),l=t(59740),u=t(30969),d=t(24974),p=t.n(d),m=t(16380),f=t(94551),h=t(48082),v=t(2689),x=t(28722),g=t(93310),Z=t(86008),b=t(37574),j=["actions","size"],y=["icon","text","onClick","disabled"];function k(e){var n=e.actions,t=e.size,r=(0,l.Z)(e,j),i=(0,u.useState)(null),d=(0,c.Z)(i,2),p=d[0],m=d[1],k=Boolean(p),D=function(e){try{e.stopPropagation(),e.preventDefault()}catch(n){}m(null)};return(0,b.jsxs)(C,(0,s.Z)((0,s.Z)({},r),{},{children:[(0,b.jsx)(f.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:function(e){try{e.stopPropagation(),e.preventDefault()}catch(n){}m(e.currentTarget)},size:t,children:(0,b.jsx)(x.Z,{})}),(0,b.jsx)(h.Z,{id:"actions-menu","data-cy":"actions-menu",anchorEl:p,keepMounted:!0,open:k,onClose:D,PaperProps:{},children:n.map((function(e,n){if("function"===typeof e)return e({close:D});var t=e.icon,r=e.text,i=e.onClick,c=e.disabled,d=void 0!==c&&c,p=(0,l.Z)(e,y);return(0,u.createElement)(v.Z,(0,s.Z)((0,s.Z)({},p),{},{disabled:d,dense:!0,onClick:function(){var e=(0,a.Z)((0,o.Z)().mark((function e(n){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i(n);case 2:D();case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),key:n,"data-cy":"actions-menu-".concat(n)}),(0,b.jsx)(g.Z,{style:{minWidth:24,marginRight:8},children:t}),(0,b.jsx)(Z.Z,{primary:r}))}))})]}))}k.propTypes={actions:p().array,size:p().oneOf(["small","medium","large"])},k.defaultProps={actions:[],size:"small"};var C=m.default.div(r||(r=(0,i.Z)([""])))},73820:function(e,n,t){t.d(n,{Z:function(){return p}});var r=t(33028),i=t(59740),o=t(30969),a=t(24974),s=t.n(a),c=t(99631),l=t(47333),u=t(37574),d=["children"];function p(e){var n=e.children,t=(0,i.Z)(e,d),a=(0,o.useContext)(l.RD).t;return(0,u.jsx)(c.Z,(0,r.Z)((0,r.Z)({tip:a("common.copyTip"),copiedTip:a("common.copiedTip")},t),{},{children:n}))}p.propTypes={children:s().any.isRequired}},36558:function(e,n,t){var r=t(33028),i=t(59740),o=t(24974),a=t.n(o),s=t(86822),c=t(19638),l=t(23586),u=t(37574),d=["did","href","external","avatarProps"];function p(e){var n=e.did,t=e.href,o=e.external,a=(e.avatarProps,(0,i.Z)(e,d)),p=(0,u.jsx)(l.Z,(0,r.Z)({did:n},a));return t?o?(0,u.jsx)(c.Z,{target:"_blank",href:t,underline:"hover",children:p}):(0,u.jsx)(s.rU,{to:t,children:p}):p}p.propTypes={did:a().string.isRequired,to:a().string,href:a().string,avatarProps:a().object,external:a().bool},p.defaultProps={to:"",href:"",avatarProps:{},external:!1},n.Z=p},22572:function(e,n,t){t.d(n,{V:function(){return l},Z:function(){return c}});var r=t(33028),i=t(24974),o=t.n(i),a=t(77370),s=t(37574);function c(e){var n=e.permission,t=e.role,r=e.component,i=e.children,o=(0,a.T)().session,s=!0,c=[].concat(n).filter(Boolean),l=[].concat(t).filter(Boolean);if(c.length){var u=o.user&&o.user.permissions||[];s=c.some((function(e){return u.includes(e)}))}return s&&l.length&&(s=l.includes(o.user.role)),"function"===typeof r?r(s):"function"===typeof i?i(s):s&&(r||i)||null}function l(e,n,t){return function(i){return(0,s.jsx)(c,{permission:n,role:t,children:function(n){return(0,s.jsx)(e,(0,r.Z)((0,r.Z)({},i),{},{hasPermission:n}))}})}}c.propTypes={permission:o().oneOfType([o().string,o().arrayOf(o().string)]),role:o().oneOfType([o().string,o().arrayOf(o().string)]),component:o().oneOfType([o().func,o().node]),children:o().oneOfType([o().func,o().node])},c.defaultProps={permission:"",role:"",component:null,children:null}},92653:function(e,n,t){t.r(n),t.d(n,{default:function(){return hn}});var r,i=t(71171),o=t(33028),a=t(32723),s=t(34795),c=t(96234),l=t(30969),u=t(16380),d=t(76032),p=t.n(d),m=t(24974),f=t.n(m),h=t(65667),v=t.n(h),x=t(50496),g=t(6779),Z=t(38361),b=t(49884),j=t(88876),y=t(3715),k=t(13134),C=t(62399),D=t(47333),w=t(29996),S=t(90954),P=t(15378),R=t(2291),T=t(16438),I=t(20244),E=t(35470),N=t(49476),z=t(94984),A=t(36558),B=t(41395),_=t(80670),L=t(45008),O=t(22572),U=t(24891),W=t(94308),q=t(43207),F=t(33359),M=t(2689),V=t(39130),K=t(87006),J=t(51385),H=t(87535),X=t(23299),$=t(73820),G=t(37574);function Y(e){var n=e.teamDid,t=e.roles,r=e.onCancel,i=e.onSuccess,o=e.onError,u=e.endpoint,d=(0,B.h6)().api,p=(0,l.useState)(!1),m=(0,c.Z)(p,2),f=m[0],h=m[1],v=(0,l.useState)(""),g=(0,c.Z)(v,2),Z=g[0],b=g[1],j=(0,D.PE)(),y=j.t,k=j.locale,C=(0,l.useState)(0),S=(0,c.Z)(C,2),P=S[0],R=S[1],T=(0,l.useState)(""),I=(0,c.Z)(T,2),E=I[0],N=I[1],z=(0,l.useState)(""),A=(0,c.Z)(z,2),_=A[0],L=A[1],O=(0,l.useState)(""),Y=(0,c.Z)(O,2),Q=Y[0],ne=Y[1],te=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(){var t,r,i,s;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_){e.next=3;break}return b(y("team.member.error.passportEmpty")),e.abrupt("return");case 3:return t=Q.trim(),b(null),h(!0),e.prev=6,e.next=9,d.createMemberInvitation({input:{teamDid:n,role:_,remark:t}});case 9:r=e.sent,i=r.inviteInfo,N(i),R(1),e.next=20;break;case 15:e.prev=15,e.t0=e.catch(6),s=(0,U.Z)(e.t0),b(s),o(e.t0);case 20:return e.prev=20,h(!1),e.finish(20);case 23:case"end":return e.stop()}}),e,null,[[6,15,20,23]])})));return function(){return e.apply(this,arguments)}}(),re=[{body:(0,G.jsxs)(F.Z,{component:"div",children:[(0,G.jsxs)(H.Z,{style:{width:"100%"},variant:"outlined",children:[(0,G.jsx)(J.Z,{children:y("common.passport")}),(0,G.jsx)(V.Z,{"data-cy":"invite-member-select-role",value:_,onChange:function(e){b(null),L(e.target.value)},fullWidth:!0,label:y("common.passport"),disabled:f,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),te())},children:t.filter((function(e){return"owner"!==e.name})).map((function(e){return(0,G.jsx)(M.Z,{value:e.name,"data-cy":"invite-member-select-option-".concat(e.name),children:(0,G.jsx)("span",{children:e.title||e.name})},e.name)}))})]}),(0,G.jsx)("div",{style:{marginTop:20,marginBottom:10}}),(0,G.jsx)(K.Z,{label:y("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:Q,onChange:function(e){b(null),ne(e.target.value)},disabled:f,"data-cy":"invite-member-input-remark"}),(0,G.jsx)("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:y("common.cancel"),confirm:y("team.member.inviteDialog.createInviteLink"),onCancel:r,onConfirm:te},{body:function(){var e=(0,U.ly)({inviteId:E.inviteId,endpoint:u});return(0,G.jsxs)("div",{children:[(0,G.jsx)(ee,{children:y("team.member.inviteDialog.createSuccessTip",{expireDate:(0,U.B2)(E.expireDate,k)})}),(0,G.jsx)("div",{style:{marginTop:"40px"}}),(0,G.jsx)($.Z,{children:e})]})},confirm:y("common.confirm"),onConfirm:i}][P];return(0,G.jsxs)(x.Z,{title:y("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,G.jsxs)(G.Fragment,{children:[re.cancel&&(0,G.jsx)(w.Z,{onClick:re.onCancel,color:"inherit",children:re.cancel}),(0,G.jsxs)(w.Z,{onClick:re.onConfirm,color:"primary",disabled:f||!_,variant:"contained",autoFocus:!0,children:[f&&(0,G.jsx)(W.Z,{size:16}),re.confirm]})]}),children:[(0,G.jsx)(q.Z,{component:"div",children:"function"===typeof re.body?re.body():re.body}),!!Z&&(0,G.jsx)(X.Z,{type:"error",variant:"icon",children:Z})]})}Y.propTypes={teamDid:f().string.isRequired,onCancel:f().func.isRequired,onSuccess:f().func.isRequired,onError:f().func,roles:f().array,endpoint:f().string},Y.defaultProps={onError:function(){},roles:[],endpoint:""};var Q,ee=u.default.div(r||(r=(0,i.Z)(["\n font-size: 16px;\n font-weight: bold;\n"]))),ne=t(17660),te=t(46292),re=t.n(te),ie=t(22100),oe=t(77370);function ae(e){var n=e.teamDid,t=e.onCancel,r=e.onSuccess,i=e.onError,o=e.endpoint,u=(0,B.h6)(),d=u.api,p=u.info,m=(0,l.useContext)(oe.B).api,f=(0,l.useState)(!1),h=(0,c.Z)(f,2),v=h[0],g=h[1],Z=(0,D.PE)(),b=Z.t,j=Z.locale,y=(0,l.useState)(""),k=(0,c.Z)(y,2),C=k[0],S=k[1],P=(0,l.useState)(!1),R=(0,c.Z)(P,2),T=R[0],I=R[1],E=(0,l.useState)(0),N=(0,c.Z)(E,2),z=N[0],A=N[1],_=(0,l.useState)(""),L=(0,c.Z)(_,2),O=L[0],M=L[1],V=(0,l.useState)(""),J=(0,c.Z)(V,2),H=J[0],Y=J[1],Q=!!re()(p,"ownerNft.did"),ee=(0,ne.default)((0,s.Z)((0,a.Z)().mark((function e(){var n,t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Q){e.next=6;break}return e.next=3,d.getDelegationState();case 3:return n=e.sent,t=n.state,e.abrupt("return",t);case 6:return e.abrupt("return",{delegated:!0});case 7:case"end":return e.stop()}}),e)}))));if(ee.loading)return(0,G.jsx)(x.Z,{title:b("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:(0,G.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,G.jsx)(W.Z,{})})});if(ee.error)return(0,G.jsx)(x.Z,{title:b("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:(0,G.jsx)(X.Z,{type:"error",variant:"icon",children:(0,U.Z)(ee.error)})});var te=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(){var t,r,o;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(null),g(!0),e.prev=2,e.next=5,d.createTransferInvitation({input:{teamDid:n,role:"owner",remark:H.trim()}});case 5:t=e.sent,r=t.inviteInfo,M(r),A(se.length-1),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),o=(0,U.Z)(e.t0),S(o),i(e.t0);case 16:return e.prev=16,g(!1),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[2,11,16,19]])})));return function(){return e.apply(this,arguments)}}(),ae=function(){I(!1),A(0)},se=[{body:(0,G.jsxs)(F.Z,{component:"div",children:[(0,G.jsxs)(X.Z,{type:"warning",children:[(0,G.jsx)(F.Z,{children:b("team.transferNode.inviteDialog.tips.progress")}),(0,G.jsx)(F.Z,{children:b("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),(0,G.jsx)(X.Z,{type:"warning",children:(0,G.jsx)(F.Z,{children:b("team.transferNode.inviteDialog.tips.revoke")})}),(0,G.jsx)("div",{style:{marginTop:20,marginBottom:10}}),(0,G.jsx)(K.Z,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:H,onChange:function(e){S(null),Y(e.target.value)},disabled:v,"data-cy":"transfer-node-input-remark"}),(0,G.jsx)("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:b("common.cancel"),confirm:b("team.transferNode.inviteDialog.createInviteLink"),onCancel:t,onConfirm:Q&&!re()(ee,"value.delegated")?function(){I(!0),A(1)}:te},{body:function(){return(0,G.jsx)(ie.default,{action:"delegate-transfer-nft",open:T,locale:j,checkFn:m.get,onClose:ae,onSuccess:te,checkTimeout:3e5,webWalletUrl:(0,U.yP)(p),extraParams:{targetDID:p.did},messages:{title:b("team.transferNode.delegateDialog.title"),scan:b("team.transferNode.delegateDialog.scan"),confirm:b("team.transferNode.delegateDialog.confirm"),success:b("team.transferNode.delegateDialog.success")},popup:!0})}},{body:function(){var e=(0,U.ly)({inviteId:O.inviteId,endpoint:o});return(0,G.jsxs)("div",{children:[(0,G.jsx)(ce,{children:b("team.transferNode.inviteDialog.createSuccessTip",{expireDate:(0,U.B2)(O.expireDate,j)})}),(0,G.jsx)("div",{style:{marginTop:"40px"}}),(0,G.jsx)($.Z,{children:e})]})},confirm:b("common.confirm"),onConfirm:r}],le=se[z];return(0,G.jsxs)(x.Z,{title:b("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,G.jsxs)(G.Fragment,{children:[le.cancel&&(0,G.jsx)(w.Z,{onClick:le.onCancel,color:"inherit",children:le.cancel}),(0,G.jsxs)(w.Z,{onClick:le.onConfirm,color:"primary",disabled:v,variant:"contained",autoFocus:!0,children:[v&&(0,G.jsx)(W.Z,{size:16}),le.confirm]})]}),children:[(0,G.jsx)(q.Z,{component:"div",children:"function"===typeof le.body?le.body():le.body}),!!C&&(0,G.jsx)(X.Z,{type:"error",variant:"icon",children:C})]})}ae.propTypes={teamDid:f().string.isRequired,onCancel:f().func.isRequired,onSuccess:f().func.isRequired,onError:f().func,endpoint:f().string},ae.defaultProps={onError:function(){},endpoint:""};var se,ce=u.default.div(Q||(Q=(0,i.Z)(["\n font-size: 16px;\n font-weight: bold;\n"]))),le=t(59740),ue=t(59467),de=t(19865),pe=t(70177),me=t(48401),fe=t(83486),he=t(28595),ve=t(59505),xe=t(8479),ge=t(88581),Ze=["passport","onDelete"];function be(e){var n=e.passport,t=e.onDelete,r=(0,le.Z)(e,Ze);return(0,G.jsxs)(ye,(0,o.Z)((0,o.Z)({},r),{},{children:[n.title||n.name," ",!!t&&(0,G.jsx)(ge.default,{"data-cy":"delete-issuance",className:"delete",onClick:t})]}))}be.propTypes={passport:f().object.isRequired,onDelete:f().func},be.defaultProps={onDelete:null};var je,ye=u.default.span(se||(se=(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"])),(function(e){return e.theme.palette.primary.main}));function ke(e){var n=e.issuances,t=e.teamDid,r=e.onRefresh,i=(0,B.h6)(),o=i.api,u=i.inService,d=(0,l.useContext)(D.RD),p=d.t,m=d.locale,f=(0,l.useState)(null),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,l.useState)(!1),b=(0,c.Z)(g,2),j=b[0],y=b[1],k=(0,_.DJ)().endpoint,C=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(n){var i;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.id,!j){e.next=3;break}return e.abrupt("return");case 3:return y(!0),e.prev=4,e.next=7,o.deletePassportIssuance({input:{teamDid:t,sessionId:i}});case 7:r(),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),z.Z.error(e.t0.message);case 13:return e.prev=13,y(!1),x(null),e.finish(13);case 17:case"end":return e.stop()}}),e,null,[[4,10,13,17]])})));return function(n){return e.apply(this,arguments)}}(),w=function(){y(!1),x(null)},S=function(e){return k?(0,U._)({id:e.id,endpoint:k}):""};function P(e){var n=e.data;return(0,G.jsxs)("div",{className:"issuance",children:[(0,G.jsxs)(Z.Z,{display:"flex",justifyContent:"space-between",children:[(0,G.jsx)(O.Z,{permission:u?"":"mutate_team",role:u?U.Wf:[],children:function(e){return e?(0,G.jsx)(be,{passport:{title:n.title,name:n.name},onDelete:function(){return x({title:p("team.passport.issuance.delete.title"),description:p("team.passport.issuance.delete.description",{link:S(n)}),confirm:p("common.delConfirm"),cancel:p("common.cancel"),onConfirm:function(){C(n)},onCancel:w})}}):(0,G.jsx)(be,{passport:{title:n.title,name:n.name}})}}),(0,G.jsxs)("div",{style:{color:"#999"},children:[p("common.expires"),":\xa0",(0,U.B2)(n.expireDate,m)]})]}),(0,G.jsx)(Z.Z,{mt:2,children:(0,G.jsx)($.Z,{children:S(n)})})]})}return(0,G.jsxs)(Ce,{children:[n.map((function(e){return(0,G.jsx)(P,{data:e})})),v&&(0,G.jsx)(xe.Z,{title:v.title,description:v.description,confirm:v.confirm,cancel:v.cancel,params:v.params,onConfirm:v.onConfirm,onCancel:v.onCancel})]})}var Ce=u.default.div(je||(je=(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"])));ke.propTypes={teamDid:f().string.isRequired,issuances:f().array,onRefresh:f().func},ke.defaultProps={issuances:[],onRefresh:function(){}};var De,we=t(68079),Se=t(70093),Pe=t.n(Se),Re=t(25177),Te=t(86384),Ie=t(69936),Ee=t(78789),Ne=t(83683),ze=t(36568);function Ae(e){var n=e.teamDid,t=e.ownerDid,r=e.needReceive,i=e.roles,o=e.onCancel,u=e.onSuccess,d=e.onError,p=e.showOwnerPassport,m=(0,B.h6)().api,f=(0,l.useState)(!1),h=(0,c.Z)(f,2),v=h[0],g=h[1],Z=(0,l.useState)(""),b=(0,c.Z)(Z,2),j=b[0],y=b[1],k=(0,D.PE)().t,C=(0,l.useState)(""),S=(0,c.Z)(C,2),P=S[0],R=S[1],T=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(){var r;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(P){e.next=3;break}return y(k("team.member.error.passportEmpty")),e.abrupt("return");case 3:return y(null),g(!0),e.prev=5,e.next=8,m.createPassportIssuance({input:{teamDid:n,name:P,ownerDid:t}});case 8:u(),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(5),r=(0,U.Z)(e.t0),y(r),d(e.t0);case 16:return e.prev=16,g(!1),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[5,11,16,19]])})));return function(){return e.apply(this,arguments)}}();return(0,G.jsxs)(x.Z,{title:k("team.passport.issue"),fullWidth:!0,open:!0,onClick:function(e){return e.stopPropagation()},onClose:o,disableEscapeKeyDown:!0,PaperProps:{style:{minHeight:"auto"}},actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(w.Z,{onClick:o,color:"inherit",size:"small",children:k("common.cancel")}),(0,G.jsxs)(w.Z,{onClick:T,color:"primary",size:"small",disabled:v||!P,variant:"contained",autoFocus:!0,"data-cy":"issue-passport-create-btn",children:[v&&(0,G.jsx)(W.Z,{size:16}),k(r?"team.passport.issuance.create.title":"oauth.issued")]})]}),children:[(0,G.jsx)(q.Z,{component:"div",children:(0,G.jsx)(F.Z,{component:"div",children:(0,G.jsxs)(H.Z,{style:{width:"100%"},variant:"outlined",children:[(0,G.jsx)(J.Z,{children:k("common.passport")}),(0,G.jsx)(V.Z,{"data-cy":"issue-passport-select-passport",value:P,onChange:function(e){y(null),R(e.target.value)},fullWidth:!0,label:k("common.passport"),disabled:v,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),T())},children:i.filter((function(e){return p||"owner"!==e.name})).map((function(e){return(0,G.jsx)(M.Z,{value:e.name,"data-cy":"issue-passport-select-option-".concat(e.name),children:(0,G.jsx)("span",{children:e.title||e.name})},e.name)}))})]})})}),!!j&&(0,G.jsx)(X.Z,{type:"error",variant:"icon",children:j})]})}function Be(e){var n=e.action,t=e.passport,r=(0,D.PE)().t,i=(0,_.DJ)().roles.find((function(e){return e.name===t.role}));return(0,G.jsxs)("div",{children:[(0,G.jsx)("div",{children:r("enable"===n?"team.member.enablePassportDescription":"team.member.revokePassportDescription")}),i&&(0,G.jsx)(Z.Z,{mt:3,fontWeight:"bold",children:r("team.member.passportPermissionTitle")}),i&&(0,G.jsx)(Z.Z,{mt:1,children:i.description})]})}function _e(e){var n,t=e.user,r=e.onCreate,i=e.createPassportSvg,u=(0,D.PE)().t,d=(0,oe.T)().session,p=(0,_.DJ)(),m=p.roles,f=p.teamDid,h=p.teamIssuerDid,v=p.refresh,x=p.enablePassportIssuance,b=p.trustedPassports,j=p.passportColor,k=p.blocklet,C=(0,L.y0)().appIdList,S=(0,B.h6)(),R=S.api,T=S.inService,E=(0,l.useState)(!1),N=(0,c.Z)(E,2),A=N[0],W=N[1],q=(0,l.useState)(null),F=(0,c.Z)(q,2),M=F[0],V=F[1],K=(0,l.useState)(!1),J=(0,c.Z)(K,2),H=J[0],X=J[1],$=(0,l.useState)(""),Y=(0,c.Z)($,2),Q=Y[0],ee=Y[1],ne=[h].concat((0,we.Z)(C||[])).filter(Boolean),te=(re()(t,"passports")||[]).map((function(e){return(0,o.Z)((0,o.Z)({},e),{},{revoked:e.status===I.PASSPORT_STATUS.REVOKED})})),ie=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(n){var r;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!A){e.next=2;break}return e.abrupt("return");case 2:return W(!0),e.prev=3,r=n.status===I.PASSPORT_STATUS.REVOKED?"enableUserPassport":"revokeUserPassport",e.next=7,R[r]({input:{teamDid:f,userDid:t.did,passportId:n.id}});case 7:v(),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),z.Z.error((0,U.Z)(e.t0));case 13:return e.prev=13,W(!1),V(null),e.finish(13);case 17:case"end":return e.stop()}}),e,null,[[3,10,13,17]])})));return function(n){return e.apply(this,arguments)}}(),ae=function(e,n){return t.did===d.user.did&&d.user.passportId&&d.user.passportId===n.id?{revokable:!1,message:u("team.passport.shouldNotDeleteCurrent")}:e?f===n.issuer.id&&"owner"===n.name?{revokable:!1,message:u("team.passport.noPermission")}:{revokable:!0}:{revokable:!1,message:u("team.passport.noPermission")}},se=te.filter((function(e){return!Q||e.title.includes(Q)||e.name.includes(Q)}));return(0,G.jsxs)(Le,{children:[(0,G.jsxs)(ze.Z,{children:[(0,G.jsx)("div",{className:"left",children:(0,G.jsx)(Ne.Z,{placeholder:u("team.passport.search"),value:Q,onChange:function(e){return ee(e.target.value)}})}),(0,G.jsx)("div",{className:"right",children:x&&!!t.approved&&(0,G.jsx)(O.Z,{permission:T?"":"mutate_team",role:T?U.Wf:[],children:(0,G.jsxs)(w.Z,{variant:"contained",color:"primary","data-cy":"issue-passport",onClick:function(){return X(!0)},children:[(0,G.jsx)(y.Z,{style:{fontSize:16,marginRight:4}}),u("team.passport.issue")]})})})]}),(0,G.jsxs)(Z.Z,{children:[se.map((function(e){return(0,G.jsx)(O.Z,{permission:T?"":"mutate_team",role:T?U.Wf:[],children:function(n){return(0,G.jsxs)(Z.Z,{className:"passport-item",display:"flex",justifyContent:"space-between",alignItems:"center",mt:3,children:[(0,G.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[(0,G.jsx)("div",{dangerouslySetInnerHTML:{__html:i({title:e.title||e.name,issuer:e.issuer&&e.issuer.name,issuerDid:e.issuer&&e.issuer.id,ownerName:t.fullName,ownerDid:t.did,ownerAvatarUrl:t.avatar,revoked:e.revoked,preferredColor:j,width:"150px"})}}),(0,G.jsxs)("div",{className:"body",children:[(0,G.jsxs)(Z.Z,{className:"title",display:"flex",alignItems:"center",children:[Pe()(e.title),(0,G.jsxs)("div",{className:"status-icons",children:[!!ne.length&&!ne.includes(e.issuer.id)&&(0,G.jsx)(P.Z,{}),e.revoked&&(0,G.jsx)(Ie.Z,{})]})]}),e.expirationDate&&(0,G.jsx)(Z.Z,{className:"title",display:"flex",alignItems:"center",children:u("team.passport.validUntil",{date:e.expirationDate})}),!!ne.length&&!ne.includes(e.issuer.id)&&(0,G.jsxs)("div",{className:"tip",children:[e.issuer.id!==h&&!b.some((function(n){return n.issuerDid===e.issuer.id}))&&(0,G.jsx)(g.Z,{title:u("team.passport.notTrustedIssuerTip"),children:(0,G.jsx)(Z.Z,{component:Re.Z,style:{fontSize:"1.3em"},color:"error.main",mr:.5})}),(0,G.jsx)("span",{children:u("team.passport.issueBy",{name:e.issuer.name})})]})]})]}),(0,G.jsx)(Z.Z,{children:ae(n,e).revokable?(0,G.jsxs)(w.Z,{variant:"outlined",color:e.revoked?"primary":"secondary",onClick:function(){return(n=e).status===I.PASSPORT_STATUS.REVOKED?V({title:u("team.member.enablePassport"),description:(0,G.jsx)(Be,{action:"enable",passport:n}),confirm:u("common.enable"),cancel:u("common.cancel"),onConfirm:function(){ie(n)},onCancel:function(){W(!1),V(null)},color:"primary"}):V({title:u("team.member.revokePassport"),description:(0,G.jsx)(Be,{action:"revoke",passport:n}),confirm:u("common.revoke"),cancel:u("common.cancel"),onConfirm:function(){ie(n)},onCancel:function(){W(!1),V(null)}});var n},children:[e.revoked?(0,G.jsx)(y.Z,{style:{fontSize:16,marginRight:4}}):(0,G.jsx)(Ie.Z,{style:{height:16,marginRight:4}}),e.revoked?u("common.enable"):u("common.revoke")]}):(0,G.jsx)(g.Z,{title:ae(n,e).message,children:(0,G.jsx)(Re.Z,{style:{color:"#ddd"}})})})]})}},e.id)})),!se.length&&(0,G.jsx)(Ee.Z,{children:u("common.empty")})]}),H&&(0,G.jsx)(Ae,{teamDid:f,ownerDid:t.did,needReceive:(0,Te.h1)(t)===t.did,roles:m,onCancel:function(){return X(!1)},onSuccess:function(){r(),X(!1)},showOwnerPassport:k&&!(null!==(n=k.settings)&&void 0!==n&&n.owner)}),M&&(0,G.jsx)(xe.Z,{title:M.title,description:M.description,confirm:M.confirm,cancel:M.cancel,params:M.params,onConfirm:M.onConfirm,onCancel:M.onCancel,color:M.color})]})}Ae.propTypes={teamDid:f().string.isRequired,ownerDid:f().string.isRequired,needReceive:f().bool,onCancel:f().func.isRequired,onSuccess:f().func.isRequired,onError:f().func,roles:f().array,showOwnerPassport:f().bool},Ae.defaultProps={onError:function(){},roles:[],showOwnerPassport:!1,needReceive:!0},Be.propTypes={action:f().string.isRequired,passport:f().object.isRequired},Be.defaultProps={},_e.propTypes={user:f().object.isRequired,createPassportSvg:f().func.isRequired,onCreate:f().func},_e.defaultProps={onCreate:function(){}};var Le=u.default.div(De||(De=(0,i.Z)(["\n .passport-item {\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 .MuiButton-outlinedSecondary {\n color: #f16e6e;\n fill: #f16e6e;\n background: #fcf3f3;\n border: 0;\n &:hover {\n border: 0;\n }\n }\n }\n"]))),Oe=function(e,n){return e.nodeOwner&&e.nodeOwner.did===n},Ue=function(e,n){return e&&e.did===n};function We(e){var n,t=e.user,r=e.onCancel,i=e.onSuccess,o=e.onError,u=e.children,d=(0,B.h6)(),p=d.api,m=d.info,f=d.inService,h=(0,oe.T)().session,v=(0,_.DJ)(),x=v.teamDid,g=v.refresh,Z=(0,D.PE)().t,b=(0,l.useState)(!1),j=(0,c.Z)(b,2),y=j[0],k=j[1],C=(0,l.useState)(!1),w=(0,c.Z)(C,2),S=w[0],P=w[1],R=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(n){var t,r;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.did,r=n.approved,!y){e.next=3;break}return e.abrupt("return");case 3:return k(!0),e.prev=4,e.next=7,p.updateUserApproval({input:{teamDid:x,user:{did:t,approved:!r}}});case 7:P(!1),i(),g(),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(4),z.Z.error((0,U.Z)(e.t0)),o();case 16:return e.prev=16,k(!1),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[4,12,16,19]])})));return function(n){return e.apply(this,arguments)}}(),T={title:t.approved?Z("team.member.forbidLogin"):Z("team.member.allowLogin"),description:t.approved?Z("team.member.forbidLoginDescription"):Z("team.member.allowLoginDescription"),confirm:Z("common.confirm"),cancel:Z("common.cancel"),onConfirm:function(){R(t)},onCancel:function(){k(!1),P(!1),r()},color:t.approved?"error":"primary"};return(n=(f||m.nodeOwner&&!Oe(m,t.did))&&!Ue(h.user,t.did))?(0,G.jsxs)(G.Fragment,{children:["function"===typeof u?u({can:n,open:function(){return P(!0)}}):u,S?(0,G.jsx)(xe.Z,{title:T.title,description:T.description,confirm:T.confirm,cancel:T.cancel,params:T.params,onConfirm:T.onConfirm,onCancel:T.onCancel,color:T.color}):null]}):null}We.propTypes={user:f().object,onSuccess:f().func,onCancel:f().func,onError:f().func,children:f().oneOfType([f().object,f().func])},We.defaultProps={user:{},onSuccess:function(){},onCancel:function(){},onError:function(){},children:null};var qe,Fe,Me,Ve=t(19611),Ke=t.n(Ve);function Je(e,n,t){if(e&&e.startsWith(I.USER_AVATAR_URL_PREFIX)){var r=window.env.apiPrefix||"/";return t?Ke()(r,I.USER_AVATAR_PATH_PREFIX,e.replace(I.USER_AVATAR_URL_PREFIX,"")):Ke()(r,I.USER_AVATAR_PATH_PREFIX,n,e.replace(I.USER_AVATAR_URL_PREFIX,""))}return e}function He(e){return(e.user.connectedAccounts||[]).map((function(e){return(0,G.jsx)(pe.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.provider,children:(0,G.jsx)(A.Z,{did:e.did})},e.did)}))}f().string.isRequired,He.propTypes={user:f().object.isRequired,onChangeUser:f().func},He.defaultProps={onChangeUser:function(){}};var Xe="info";function $e(e){var n=e.userDid,t=e.onCancel,r=e.initTab,i=e.createPassportSvg,o=(0,B.h6)(),c=o.api,u=o.ws.useSubscription,d=o.inService,p=(0,_.DJ)(),m=p.roles,f=p.teamDid,h=p.enablePassportIssuance,v=(0,D.PE)(),g=v.t,b=v.locale,j=(0,he.Z)({user:null,issuances:null,tab:r||Xe}),y=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(n,t){var r;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c.doBatchQuery({getUser:{input:{teamDid:n,user:{did:t}}},getPassportIssuances:{input:{teamDid:n,ownerDid:t}}});case 3:(r=e.sent).getUser.user&&(r.getUser.user.avatar=Je(r.getUser.user.avatar,n,d),r.getUser.user.passports=(r.getUser.user.passports||[]).filter((function(e){return e.issuer}))),j.user=r.getUser.user||{},j.issuances=r.getPassportIssuances.list||[],e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),z.Z.error((0,U.Z)(e.t0));case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(n,t){return e.apply(this,arguments)}}();(0,l.useEffect)((function(){f&&y(f,n)}),[n,f]);u(I.EVENTS.USER_UPDATED,(function(e){e.teamDid===f&&e.user&&e.user.did===n&&y(f,n)}),[n,f]),(0,l.useEffect)((function(){j.issuances&&!j.issuances.length&&"issuances"===j.tab&&(j.tab=Xe)}),[j.issuances]);var k=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(n){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y(f,n.did);case 2:j.tab=Xe;case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),C={auth0:"Auth0",wallet:"DID wallet",federated:"Federated"},w={info:{label:g("common.basicInfo"),value:Xe,component:function(){var e,n;return(j.user?[{name:g("team.member.name"),value:j.user.fullName},{name:g("common.email"),value:j.user.email},{name:g("team.member.source"),value:(0,G.jsx)(Z.Z,{display:"flex",alignItems:"center",children:C[(null===(e=j.user)||void 0===e?void 0:e.sourceProvider)||I.USER_TYPE.WALLET]||(null===(n=j.user)||void 0===n?void 0:n.sourceProvider)})},{name:g("team.member.allowLogin"),value:j.user.approved?g("common.yes"):g("common.no")},{name:g("team.member.lastLogin"),value:(0,U.B2)(j.user.lastLoginAt,b)},{name:g("team.member.lastLoginIp"),value:j.user.lastLoginIp||""},{name:g("common.createdAt"),value:(0,U.B2)(j.user.createdAt,b)},{name:g("common.remark"),value:j.user.remark||"--"}].filter(Boolean):[]).map((function(e){return e.name===g("common.did")?(0,G.jsx)(pe.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:function(){return g("common.did")},children:e.value},e.name):(0,G.jsx)(pe.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)}))}},oauth:{label:g("team.member.connectedAccounts"),value:"oauth",component:function(){return(0,G.jsx)(He,{user:j.user,onChangeUser:k})}},passports:{label:g("common.passport"),value:"passports",component:function(){return(0,G.jsx)(_e,{user:j.user,teamDid:f,roles:m,createPassportSvg:i,onCreate:function(){y(f,n).then((function(){h&&j.issuances&&j.issuances.length&&(j.tab="issuances")}))},onRefresh:function(){y(f,n)}})}},issuances:{label:g("team.passport.issuance.pending"),value:"issuances",component:function(){return(0,G.jsx)(ke,{issuances:j.issuances||[],teamDid:f,onRefresh:function(){return y(f,n)}})}}},S=Object.values(w).map((function(e){return{label:e.label,value:e.value}})).filter((function(e){return"issuances"===e.value?h&&j.issuances&&!!j.issuances.length:"oauth"!==e.value||((null===(n=j.user)||void 0===n?void 0:n.connectedAccounts)||[]).find((function(e){var n;return e.provider!==((null===(n=j.user)||void 0===n?void 0:n.sourceProvider)||ve.LOGIN_PROVIDER.WALLET)}));var n})),P=w[j.tab]||w.info;return(0,G.jsx)(x.Z,{title:g("common.member"),onClose:t,open:!0,PaperProps:{style:{maxWidth:632,minHeight:"80vh"}},fullWidth:!0,actions:j.user&&(0,G.jsx)(O.Z,{permission:d?"":"mutate_team",role:d?U.Wf:[],children:(0,G.jsx)(We,{user:j.user,children:function(e){var n=e.open;return(0,G.jsxs)(en,{onClick:n,children:[j.user.approved?(0,G.jsx)(me.Z,{style:{fontSize:"1.2em",marginRight:"0.4em"}}):(0,G.jsx)(fe.Z,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),j.user.approved?g("team.member.forbidLogin"):g("team.member.allowLogin")]})}})}),children:(0,G.jsxs)(Ye,{children:[!j.user&&(0,G.jsx)(Qe,{children:(0,G.jsx)(W.Z,{})}),j.user&&(0,G.jsxs)("div",{children:[(0,G.jsxs)(Z.Z,{display:"flex",alignItems:"center",className:"info",children:[(0,G.jsx)(ue.Z,{src:j.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),(0,G.jsxs)(Z.Z,{children:[(0,G.jsx)(Z.Z,{className:"name",children:j.user.fullName}),(0,G.jsx)(Z.Z,{className:"did",mt:1,children:(0,G.jsx)(A.Z,{did:j.user.did})})]})]}),(0,G.jsx)(Z.Z,{mx:3,className:"tabs",children:(0,G.jsx)(de.Z,{tabs:S,current:j.tab,onChange:function(e){j.tab=e},scrollButtons:"auto"})}),(0,G.jsx)("div",{className:"body",children:(0,G.jsx)(P.component,{})})]})]})})}$e.propTypes={userDid:f().string.isRequired,onCancel:f().func.isRequired,createPassportSvg:f().func.isRequired,initTab:f().string},$e.defaultProps={initTab:Xe};var Ge,Ye=u.default.div(qe||(qe=(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"]))),Qe=u.default.div(Fe||(Fe=(0,i.Z)(["\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 200px;\n"]))),en=u.default.div(Me||(Me=(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"]))),nn=t(10814);function tn(){var e=(0,B.h6)(),n=e.api,t=e.inService,r=(0,l.useContext)(D.RD),i=r.t,o=r.locale,u=(0,_.DJ)(),d=u.teamDid,p=u.invitations,m=u.refresh,f=u.endpoint,h=(0,l.useState)(null),v=(0,c.Z)(h,2),x=v[0],g=v[1],Z=(0,l.useState)(!1),b=(0,c.Z)(Z,2),j=b[0],y=b[1],k=function(){var e=(0,s.Z)((0,a.Z)().mark((function e(t){var r;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.inviteId,!j){e.next=3;break}return e.abrupt("return");case 3:return y(!0),e.prev=4,e.next=7,n.deleteInvitation({input:{teamDid:d,inviteId:r}});case 7:return m(),e.next=10,(0,U._v)(800);case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error(e.t0);case 15:return e.prev=15,y(!1),g(null),e.finish(15);case 19:case"end":return e.stop()}}),e,null,[[4,12,15,19]])})));return function(n){return e.apply(this,arguments)}}(),C=function(){y(!1),g(null)},S=function(e){return f?(0,U.ly)({inviteId:e.inviteId,endpoint:f}):""},P=[{label:i("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:function(e){var n=p[e];return f?(0,G.jsx)($.Z,{children:S(n)}):(0,G.jsx)(W.Z,{size:16})}}},{label:i("common.role"),name:"role",widtn:70},{label:i("common.remark"),name:"remark",options:{customBodyRender:function(e){return e||"--"}}},{label:i("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:function(e,n){var t,r=n.rowIndex,i=p[r];return null===i||void 0===i||null===(t=i.inviter)||void 0===t?void 0:t.fullName}}},{label:i("common.expires"),name:"expireDate",options:{customBodyRender:function(e){return(0,G.jsx)(T.Z,{value:e,locale:o})}}},{label:i("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:function(e){var n=p[e];return(0,G.jsx)(O.Z,{permission:t?"":"mutate_team",role:t?U.Wf:[],children:(0,G.jsxs)(w.Z,{onClick:function(){return g({title:i("team.inviting.delete.title"),description:i("team.inviting.delete.description",{link:S(n)}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:function(){return k(n)},onCancel:C})},size:"small",color:"error",variant:"text",children:[(0,G.jsx)(nn.default,{style:{fontSize:"1.2em"}}),i("common.delete")]})})}}}];return(0,G.jsxs)(rn,{children:[p.length?(0,G.jsx)(R.Z,{locale:o,data:(0,we.Z)(p),columns:P,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1}}):(0,G.jsx)(Ee.Z,{children:i("common.empty")}),x&&(0,G.jsx)(xe.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}var rn=u.default.div(Ge||(Ge=(0,i.Z)(["\n margin-top: -20px;\n"])));tn.propTypes={},tn.defaultProps={};var on,an=t(93310),sn=t(86008),cn=t(80714);function ln(e){var n=e.user,t=e.onIssuePassport,r=(0,_.DJ)(),i=r.teamDid,o=r.roles,a=(0,l.useContext)(D.RD).t,s=(0,l.useState)(!1),u=(0,c.Z)(s,2),d=u[0],p=u[1];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(cn.Z,{"data-cy":"member-actions",actions:[{icon:(0,G.jsx)(y.Z,{fontSize:"small"}),text:a("team.passport.issue"),"data-cy":"action-issue-passport",onClick:function(e){e.stopPropagation(),p(!0)}},function(e){var t=e.close;return(0,G.jsx)(We,{user:n,children:function(e){var r=e.open;return(0,G.jsxs)(M.Z,{dense:!0,onClick:function(e){e.stopPropagation(),t(),r(e)},"data-cy":"action-toggle-block",children:[(0,G.jsx)(an.Z,{style:{minWidth:24,marginRight:8},children:n.approved?(0,G.jsx)(me.Z,{}):(0,G.jsx)(fe.Z,{})}),(0,G.jsx)(sn.Z,{primary:n.approved?a("team.member.forbidLogin"):a("team.member.allowLogin")})]})}},"toggle-approval")}]}),d&&(0,G.jsx)(Ae,{teamDid:i,ownerDid:n.did,needReceive:(0,Te.h1)(n)===n.did,roles:o,onCancel:function(){return p(!1)},onSuccess:function(){t(),p(!1)}})]})}ln.propTypes={user:f().object.isRequired,onIssuePassport:f().func},ln.defaultProps={onIssuePassport:function(){}};var un="$all",dn="$none",pn=function(e,n){var t=e.find((function(e){return e.key===n}));return(null===t||void 0===t?void 0:t.value)||0},mn=function(e,n){var t=e.passports||[];return!!t.length&&!t.some((function(e){var t;return n.includes(null===(t=e.issuer)||void 0===t?void 0:t.id)}))};function fn(e){var n=e.user,t=(0,l.useContext)(D.RD).t,r=(0,G.jsxs)("div",{className:"member-block",children:[(0,G.jsxs)("div",{className:"member-avatar",children:[(0,G.jsx)(C.Z,{src:"".concat(n.avatar,"?imageFilter=resize&w=48&h=48"),size:24,did:n.did,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),!n.approved&&(0,G.jsx)("did",{className:"badge-block"}),n.isFromExternal&&(0,G.jsx)(g.Z,{title:t("team.passport.externalPassport"),children:(0,G.jsx)(Z.Z,{ml:1,className:"icon",children:(0,G.jsx)(P.Z,{})})})]}),(0,G.jsx)("div",{className:"member-text",children:n.fullName})]});return n.approved?r:(0,G.jsx)(Z.Z,{display:"flex",alignItems:"center",children:(0,G.jsx)(g.Z,{title:t("team.member.forbidLoginDescription"),children:r})})}function hn(e){var n=e.type,t=e.createPassportSvg,r=(0,L.y0)().appIdList,i=void 0===r?[]:r,u=(0,_.DJ)(),d=u.teamDid,m=u.invitations,f=u.teamIssuerDid,h=u.roles,g=u.refresh,C=u.enablePassportIssuance,P=u.endpoint,W=u.api,q=(0,B.h6)(),F=q.inService,M=q.ws.useSubscription,V=(0,l.useContext)(D.RD),K=V.t,J=V.locale,H=(0,l.useState)(!1),X=(0,c.Z)(H,2),$=X[0],Q=X[1],ee=(0,l.useState)(!1),ne=(0,c.Z)(ee,2),te=ne[0],re=ne[1],ie=(0,l.useState)(!1),oe=(0,c.Z)(ie,2),se=oe[0],ce=oe[1],le=(0,l.useState)(!1),ue=(0,c.Z)(le,2),de=ue[0],pe=ue[1],me=(0,l.useState)(!1),fe=(0,c.Z)(me,2),he=fe[0],ve=fe[1],xe=(0,l.useState)([]),ge=(0,c.Z)(xe,2),Ze=ge[0],be=ge[1],je=(0,l.useState)(),ye=(0,c.Z)(je,2),ke=ye[0],Ce=ye[1],De=(0,l.useState)([]),we=(0,c.Z)(De,2),Se=we[0],Pe=we[1],Re=(0,E.Z)({did:void 0}),Te=(0,c.Z)(Re,1)[0],Ie="members-".concat(d),Ee=(0,R.$)(Ie),Ne=(0,l.useState)({role:un,searchText:Ee.searchText||"",hideBlocked:!1,pageSize:Ee.rowsPerPage||10,page:Ee.page?Ee.page+1:1}),ze=(0,c.Z)(Ne,2),Ae=ze[0],Be=ze[1];(0,N.Z)((0,s.Z)((0,a.Z)().mark((function e(){var n,t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Te.did){e.next=6;break}return e.next=3,W.getUser({did:Te.did});case 3:n=e.sent,(t=n.user)&&pe(t);case 6:case"end":return e.stop()}}),e)}))));var _e=(h||[]).map((function(e){return{name:e.name,title:e.title,num:pn(Se,e.name)}}));_e.unshift({name:un,title:"All Members",num:pn(Se,un)}),_e.push({name:dn,title:"Other",num:pn(Se,dn)});var Le=function(){var e={};Ae.hideBlocked&&(e.approved=!0),e.role=Ae.role,Ae.searchText&&(e.search=Ae.searchText),ve(!0),W.getUsers({query:e,paging:{page:Ae.page,pageSize:Ae.pageSize}}).then((function(e){ve(!1),(e.users||[]).forEach((function(e){e.isFromExternal=mn(e,p()(i)?[f]:i),e.avatar=Je(e.avatar,d,F),e.passports=(e.passports||[]).filter((function(e){return e.issuer}))})),be(e.users||[]),Ce(e.paging.total)})).catch((function(e){ve(!1),z.Z.error(e.message)}))},Oe=function(){W.getUsersCountPerRole().then((function(e){Pe(e.counts||[])})).catch((function(e){z.Z.error(e.message)}))},Ue=function(e){e.teamDid===d&&(Le(),Oe())};(0,l.useEffect)((function(){Le()}),["".concat(Ae.hideBlocked,"-").concat(Ae.role,"-").concat(Ae.page,"-").concat(Ae.pageSize,"-").concat(Ae.searchText)]),(0,l.useEffect)((function(){Oe()}),[]),M(I.EVENTS.USER_UPDATED,Ue,[Ae]),M(I.EVENTS.USER_ADDED,Ue,[Ae]);var We=C,qe=[{label:K("common.name"),name:"fullName",options:{customBodyRenderLite:function(e){var n=Ze[e];return(0,G.jsx)("div",{"data-cy":"member-name-".concat(n.fullName),children:(0,G.jsx)(fn,{user:n})},n.did)}}},{label:K("common.address"),name:"did",options:{customBodyRender:function(e){return(0,G.jsx)(A.Z,{size:14,responsive:!0,copyable:!1,did:e})}}},{label:K("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:function(e){return(0,G.jsx)(T.Z,{value:e,locale:J})}}},{label:K("team.member.lastLoginIp"),name:"lastLoginIp",options:{customBodyRender:function(e){return e||"-"}}},{label:K("team.member.source"),name:"sourceProvider",options:{customBodyRender:function(e){var n=e||I.USER_TYPE.WALLET;return{auth0:"Auth0",wallet:"DID wallet",federated:"Federated"}[n]||n}}},{label:K("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:function(e){var n=Ze[e];return(0,G.jsx)(O.Z,{permission:F?"":"mutate_team",role:F?U.Wf:[],children:(0,G.jsx)(ln,{user:n,onIssuePassport:function(){return pe((0,o.Z)((0,o.Z)({},n),{},{initTab:"issuances"}))}})})}}}],Fe=[];We&&(Fe.push((0,G.jsxs)(w.Z,{variant:"outlined",style:{flexShrink:0,marginRight:16},color:"primary",size:"small",onClick:function(){ce(!0)},children:[(0,G.jsx)(S.Z,{style:{height:"1em",marginRight:4}}),K("common.inviting"),m.length?" (".concat(m.length,")"):""]}),(0,G.jsx)(O.Z,{permission:F?"":"mutate_team",role:F?U.Wf:[],children:(0,G.jsxs)(w.Z,{style:{flexShrink:0,marginRight:16},variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"invite-member",onClick:function(){return Q(!0)},children:[(0,G.jsx)(y.Z,{style:{fontSize:"1.3em",marginRight:4}}),K("team.invite")]})})),"server"===n&&Fe.push((0,G.jsx)(O.Z,{role:"owner",children:(0,G.jsxs)(w.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"invite-member",onClick:function(){return re(!0)},children:[(0,G.jsx)(k.Z,{style:{fontSize:"1.3em",marginRight:4}}),K("team.transferNode.name")]})})));var Me={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick:function(e,n){var t=n.dataIndex,r=Ze[t];pe(r)},page:Ae.page-1,rowsPerPage:Ae.pageSize,count:ke,searchDebounceTime:600};return(0,G.jsxs)(vn,{children:[(0,G.jsxs)(Z.Z,{className:"main",display:"flex",children:[(0,G.jsx)("div",{className:"left",children:(0,G.jsx)("div",{className:"tabs",children:_e.map((function(e){return(0,G.jsxs)("div",{className:"tab ".concat(Ae.role===e.name?"active":""),onClick:function(){return n=e.name,void(he||Be((function(e){return(0,o.Z)((0,o.Z)({},e),{},{role:n,hideBlocked:!1,searchText:"",page:1})})));var n},children:[(0,G.jsx)("span",{className:"text",children:e.title}),(0,G.jsx)("span",{className:v()("badge",{"is-rect":e.num>999}),children:e.num})]},e.name)}))})}),(0,G.jsx)("div",{className:"right",children:(0,G.jsx)(R.Z,{className:"main-table",verticalKeyWidth:100,locale:J,durable:Ie,durableKeys:["page","rowsPerPage"],title:(0,G.jsx)("div",{className:"table-toolbar-left",children:(0,G.jsx)(b.Z,{control:(0,G.jsx)(j.Z,{sx:{display:"flex !important"},disabled:he,color:"primary",checked:Ae.hideBlocked,onChange:function(e){return n=e.target.checked,void Be((function(e){return(0,o.Z)((0,o.Z)({},e),{},{hideBlocked:n,page:1})}));var n}}),label:K("team.member.hideBlockedMember")})}),data:Ze,columns:qe,customButtons:Fe,options:Me,loading:he,onChange:function(e){var n=e.page,t=e.rowsPerPage,r=e.searchText;Ae.pageSize!==t?Be((function(e){return(0,o.Z)((0,o.Z)({},e),{},{pageSize:t,page:1})})):Ae.page!==n+1?Be((function(e){return(0,o.Z)((0,o.Z)({},e),{},{page:n+1})})):Ae.searchText!==r&&Be((function(e){return(0,o.Z)((0,o.Z)({},e),{},{searchText:r,page:1})}))}})})]}),(0,G.jsx)(x.Z,{title:K("common.inviting"),onClose:function(){return ce(!1)},open:se,maxWidth:"lg",fullWidth:!0,children:(0,G.jsx)(tn,{})}),de&&(0,G.jsx)($e,{onCancel:function(){return pe(null)},userDid:de.did,createPassportSvg:t,initTab:de.initTab}),$&&(0,G.jsx)(Y,{teamDid:d,endpoint:P,roles:h,onCancel:function(){return Q(!1)},onSuccess:function(){g(),Q(!1)}}),te&&(0,G.jsx)(ae,{teamDid:d,endpoint:P,roles:h,onCancel:function(){return re(!1)},onSuccess:function(){g(),re(!1)}})]})}fn.propTypes={user:f().object.isRequired};var vn=u.default.div(on||(on=(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-text {\n margin-left: 10px;\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"])),(function(e){return e.theme.breakpoints.values.md}));hn.propTypes={type:f().oneOf(["server","blocklet"]).isRequired,createPassportSvg:f().func.isRequired}},83683:function(e,n,t){var r,i=t(33028),o=t(59740),a=t(71171),s=t(16380),c=t(87006),l=t(90713),u=t(37574),d=["children"],p=(0,s.default)((function(e){var n=e.children,t=(0,o.Z)(e,d);return(0,u.jsx)(c.Z,(0,i.Z)((0,i.Z)({},t),{},{id:"outlined-basic",variant:"outlined",InputProps:{startAdornment:(0,u.jsx)(l.default,{})},size:"small",children:n}))}))(r||(r=(0,a.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"])));n.Z=p},36568:function(e,n,t){var r,i=t(71171),o=t(16380).default.div(r||(r=(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"])));n.Z=o}}]);
|
|
2
|
-
//# sourceMappingURL=2653.892d84ff.chunk.js.map
|