@abtnode/blocklet-services 1.16.18 → 1.16.19-beta-e6aac665

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 (31) hide show
  1. package/api/libs/connect/session.js +17 -19
  2. package/api/libs/connect/v1.js +5 -1
  3. package/api/libs/connect/v2.js +5 -4
  4. package/api/libs/image.js +2 -2
  5. package/api/routes/federated.js +108 -19
  6. package/api/routes/oauth.js +19 -26
  7. package/api/routes/user-session.js +5 -1
  8. package/api/routes/user.js +1 -0
  9. package/api/services/auth/connect/invite.js +8 -5
  10. package/api/util/federated.js +45 -0
  11. package/api/validators/login.js +1 -1
  12. package/build/asset-manifest.json +15 -15
  13. package/build/index.html +1 -1
  14. package/build/service-worker.js +1 -1
  15. package/build/static/js/4076.8055ce74.chunk.js +2 -0
  16. package/build/static/js/4461.f9a883d3.chunk.js +2 -0
  17. package/build/static/js/5468.21a861b9.chunk.js +2 -0
  18. package/build/static/js/5547.42b98889.chunk.js +3 -0
  19. package/build/static/js/8622.6aa0a4d4.chunk.js +2 -0
  20. package/build/static/js/8944.939de854.chunk.js +2 -0
  21. package/build/static/js/main.6f748ae5.js +3 -0
  22. package/package.json +24 -27
  23. package/build/static/js/4076.f5369a1d.chunk.js +0 -2
  24. package/build/static/js/4461.3cd698bf.chunk.js +0 -2
  25. package/build/static/js/5468.b54ce65b.chunk.js +0 -2
  26. package/build/static/js/5547.570ded36.chunk.js +0 -3
  27. package/build/static/js/8622.ebd44812.chunk.js +0 -2
  28. package/build/static/js/8944.559ade67.chunk.js +0 -2
  29. package/build/static/js/main.bf370e0c.js +0 -3
  30. /package/build/static/js/{5547.570ded36.chunk.js.LICENSE.txt → 5547.42b98889.chunk.js.LICENSE.txt} +0 -0
  31. /package/build/static/js/{main.bf370e0c.js.LICENSE.txt → main.6f748ae5.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[5468],{65468:function(e,n,r){r.r(n),r.d(n,{UserPassports:function(){return le},UserProfile:function(){return ae},default:function(){return ce}});var t=r(71171),i=r(33028),o=(r(30969),r(65321)),s=r(70177),a=r(19865),l=r(78789),c=r(46292),d=r.n(c),u=r(61398),m=r.n(u),p=r(16380),h=r(29996),x=r(26022),f=r(25139),v=r(59467),Z=r(33359),g=r(38361),j=r(7173),b=r(1059),y=r(28595),w=r(20244),k=r(59505),P=r(36558),C=r(12502),I=r(75980),T=r(24891),S=r(30734),E=r(53279),z=r(4485),R=r(32723),_=r(34795),A=r(96234),L=r(62558),N=r.n(L),W=r(1986),q=r(86384),D=r(92522),O=r.n(D),U=r(63269),V=r(65453),B=r(31076),M=r(49884),Q=r(88876),F=r(39130),G=r(2689),H=r(87006),K=r(4953),J=r(94551),X=r(18877),Y=r(94308),$=r(39185),ee=r(54164),ne=r(13953),re=r(37574);function te(e){var n=e.data,r=e.user,t=(0,x.PE)().t,o=(0,z.Tt)().api,a=(0,$.Z)({editing:!1,dirty:!1}),c=(0,A.Z)(a,2),u=c[0],m=c[1],p=(0,ne.cI)({defaultValues:N()({notifications:{email:!0,wallet:!0,phone:!1},webhooks:[]},n)}),v=p.control,g=p.getValues,j=p.setValue,b=p.formState,y=p.handleSubmit,w=(0,ne.Dq)({control:v,name:"webhooks"}),k=y(function(){var e=(0,_.Z)((0,R.Z)().mark((function e(n){return(0,R.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o.post("/api/user/extra",n);case 3:W.Z.success(t("common.saveSuccess")),m({editing:!1}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),W.Z.error((0,T.Z)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(n){return e.apply(this,arguments)}}()),P=function(){var e=(0,_.Z)((0,R.Z)().mark((function e(n){return(0,R.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o.put("/api/user/extra",w.fields[n]);case 3:W.Z.success(t("team.member.settings.tested")),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),W.Z.error((0,T.Z)(e.t0));case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(n){return e.apply(this,arguments)}}();return(0,re.jsxs)(f.Z,{spacing:3,children:[(0,re.jsxs)(f.Z,{sx:{width:"100%"},children:[(0,re.jsxs)(f.Z,{direction:"row",justifyContent:"space-between",children:[(0,re.jsx)(Z.Z,{variant:"h6",gutterBottom:!0,children:t("team.member.settings.notification")}),(0,re.jsx)(h.Z,{variant:"contained",size:"small",color:"primary",style:{height:"32px"},onClick:k,disabled:b.isSubmitting,children:t("common.save")})]}),(0,re.jsx)(ne.Qr,{name:"notifications.wallet",control:v,render:function(e){var n=e.field;return(0,re.jsx)(M.Z,{control:(0,re.jsx)(Q.Z,(0,i.Z)((0,i.Z)({checked:g().notifications.wallet},n),{},{onChange:function(e,r){return j(n.name,r)}})),disableTypography:!0,label:(0,re.jsxs)(Z.Z,{color:"text.primary",children:[t("team.member.settings.wallet"),(0,re.jsx)(Z.Z,{component:"span",color:"text.secondary",ml:1,children:(0,q.h1)(r)})]})})}}),(0,re.jsx)(ne.Qr,{name:"notifications.email",control:v,render:function(e){var n=e.field;return(0,re.jsx)(M.Z,{control:(0,re.jsx)(Q.Z,(0,i.Z)((0,i.Z)({checked:g().notifications.email},n),{},{onChange:function(e,r){return j(n.name,r)}})),disableTypography:!0,label:(0,re.jsxs)(Z.Z,{color:"text.primary",children:[t("team.member.settings.email"),(0,re.jsx)(Z.Z,{component:"span",color:"text.secondary",ml:1,children:r.email||""})]})})}}),(0,re.jsx)(ne.Qr,{name:"notifications.phone",control:v,render:function(e){var n=e.field;return(0,re.jsx)(M.Z,{control:(0,re.jsx)(Q.Z,(0,i.Z)((0,i.Z)({checked:g().notifications.phone},n),{},{onChange:function(e,r){return j(n.name,r)}})),disableTypography:!0,disabled:!0,label:(0,re.jsxs)(Z.Z,{color:"text.primary",children:[t("team.member.settings.phone"),(0,re.jsx)(Z.Z,{component:"span",color:"text.secondary",ml:1,children:r.phone||""})]})})}})]}),(0,re.jsxs)(f.Z,{children:[(0,re.jsxs)(f.Z,{direction:"row",justifyContent:"space-between",children:[(0,re.jsx)(Z.Z,{variant:"h6",gutterBottom:!0,children:t("team.member.settings.webhook")}),(0,re.jsxs)(f.Z,{direction:"row",children:[u.editing&&(0,re.jsx)(h.Z,{variant:"text",size:"small",color:"primary",style:{height:"32px"},onClick:function(){return m({editing:!1})},children:t("common.cancel")}),(0,re.jsx)(h.Z,{variant:"contained",size:"small",color:"primary",style:{height:"32px"},onClick:u.editing?k:function(){return m({editing:!0})},disabled:b.isSubmitting,children:u.editing?t("common.save"):t("common.edit")})]})]}),w.fields.map((function(e,n){var r,o=null===(r=d()(b.errors,"webhooks.".concat(n,".url")))||void 0===r?void 0:r.message;return u.editing?(0,re.jsxs)(f.Z,{mt:2,spacing:2,sx:{width:"100%"},direction:"row",alignItems:"center",children:[(0,re.jsxs)(f.Z,{direction:"row",spacing:2,sx:{width:"80%"},children:[(0,re.jsx)(ne.Qr,{name:"webhooks.".concat(n,".type"),control:v,rules:{required:t("common.required")},render:function(e){var n=e.field;return(0,re.jsxs)(F.Z,(0,i.Z)((0,i.Z)({},n),{},{sx:{flex:1},fullWidth:!0,size:"small",children:[(0,re.jsx)(G.Z,{value:"api",children:t("team.member.settings.url")}),(0,re.jsx)(G.Z,{value:"slack",children:t("team.member.settings.slack")})]}))}}),(0,re.jsx)(ne.Qr,{name:"webhooks.".concat(n,".url"),control:v,rules:{required:t("common.required"),validate:function(e){return O()(e)||t("common.invalid")}},render:function(e){var n=e.field;return(0,re.jsx)(H.Z,(0,i.Z)((0,i.Z)({sx:{flex:4},fullWidth:!0,size:"small",required:!0},n),{},{error:!!o,InputProps:{endAdornment:o?(0,re.jsx)(K.Z,{position:"end",children:(0,re.jsx)(Z.Z,{component:"span",color:"error",children:o})}):null}}))}})]}),(0,re.jsxs)(f.Z,{direction:"row",spacing:1,children:[(0,re.jsx)(J.Z,{size:"small",onClick:function(){return P(n)},children:(0,re.jsx)(U.Z,{color:"primary",sx:{opacity:.75}})}),(0,re.jsx)(J.Z,{size:"small",onClick:function(){return w.remove(n)},children:(0,re.jsx)(V.Z,{color:"error",sx:{opacity:.75}})})]})]},e.id):(0,re.jsx)(s.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.type,children:e.url},e.id)})),!u.editing&&!w.fields.length&&(0,re.jsx)(l.Z,{children:t("common.empty")}),u.editing&&(0,re.jsx)(f.Z,{mt:w.fields.length?2:1,direction:"row",justifyContent:"space-between",children:(0,re.jsxs)(h.Z,{size:"small",variant:"outlined",color:"primary",onClick:function(){return w.append({type:"slack",url:""})},children:[(0,re.jsx)(B.Z,{fontSize:"small"})," ",t("team.member.settings.add")]})})]})]})}function ie(e){var n=e.user,r=(0,z.Tt)().api,t=(0,ee.Z)((function(){return r.get("/api/user/extra").then((function(e){return e.data}))})),i=t.loading,o=t.error,s=t.data;return o?(0,re.jsx)(X.Z,{severity:"error",children:o.message}):i||!s?(0,re.jsx)(Y.Z,{}):(0,re.jsx)(te,{data:s,user:n})}var oe,se=r(38507);function ae(e){var n=e.user,r=(0,x.PE)(),t=r.t,i=r.locale;return[{name:t("team.member.name"),value:n.fullName},{name:t("common.email"),value:n.email},{name:t("common.phone"),value:n.phone},{name:t("team.member.lastLogin"),value:(0,T.B2)(n.lastLoginAt,i)},{name:t("team.member.lastLoginIp"),value:n.lastLoginIp||""},{name:t("common.createdAt"),value:(0,T.B2)(n.createdAt,i)},{name:t("team.member.source"),value:{auth0:"Auth0",wallet:"DID wallet",federated:"Federated"}[(null===n||void 0===n?void 0:n.sourceProvider)||w.USER_TYPE.WALLET]||(null===n||void 0===n?void 0:n.sourceProvider)}].filter(Boolean).map((function(e){return e.name===t("common.did")?(0,re.jsx)(s.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:function(){return t("common.did")},children:e.value},e.name):(0,re.jsx)(s.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)}))}function le(e){var n=e.user,r=(0,x.PE)().t,t=(d()(n,"passports")||[]).map((function(e){return(0,i.Z)((0,i.Z)({},e),{},{revoked:e.status===w.PASSPORT_STATUS.REVOKED})}));return 0===t.length?(0,re.jsx)(l.Z,{children:r("common.empty")}):(0,re.jsx)(f.Z,{direction:"row",spacing:3,children:t.map((function(e){return(0,re.jsx)(I.Z,{passport:e,user:n,width:200,color:window.blocklet.passportColor,createPassportSvg:se.Ju,sx:{flexDirection:"column",alignItems:"center"}},e.id)}))})}function ce(){var e=(0,S.useNavigate)(),n=(0,S.useParams)(),r=(0,x.PE)().t,t=(0,z.Tt)().session,i=(0,y.Z)({user:t.user,tab:n.tab||"profile"}),s={info:{label:r("common.profile"),value:"profile",component:ae},oauth:{label:r("team.member.connections"),value:"connections",component:C.Z},passports:{label:r("team.member.passports"),value:"passports",component:le},settings:{label:r("common.setting"),value:"settings",component:ie}},l=Object.values(s).map((function(e){return{label:e.label,value:e.value}})).filter((function(e){var n;return"connections"!==e.value||((null===(n=i.user)||void 0===n?void 0:n.connectedAccounts)||[]).find((function(e){var n;return e.provider!==((null===(n=i.user)||void 0===n?void 0:n.sourceProvider)||k.LOGIN_PROVIDER.WALLET)}))})),c=s[i.tab]||s.info;return(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(o.Z,{}),(0,re.jsxs)(de,{sx:{mt:4},children:[(0,re.jsxs)(f.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,re.jsxs)(f.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,re.jsx)(v.Z,{src:i.user.avatar,variant:"rounded",style:{width:80,height:80,backgroundColor:"transparent",marginRight:8}}),(0,re.jsxs)(f.Z,{direction:"column",spacing:.5,children:[(0,re.jsx)(Z.Z,{variant:"h4",fontWeight:"bold",children:i.user.fullName}),(0,re.jsx)(g.Z,{children:(0,re.jsx)(j.Z,{label:i.user.role.toUpperCase(),size:"small",variant:"outlined",color:"success",sx:{height:"auto",fontWeight:"bold",fontSize:"12px"},icon:(0,re.jsx)(E.Z,{sx:{fontSize:"0.8em"}})})}),(0,re.jsx)(P.Z,{did:i.user.did})]})]}),(0,re.jsxs)(f.Z,{children:["profile"===i.tab&&(0,re.jsx)(h.Z,{variant:"contained",size:"small",color:"primary",onClick:function(){return t.switchProfile(m(),{})},children:r("team.member.switch.profile")}),"passports"===i.tab&&(0,re.jsx)(h.Z,{variant:"contained",size:"small",color:"primary",onClick:function(){return t.switchPassport(m(),{})},children:r("team.member.switch.passport")})]})]}),(0,re.jsx)(g.Z,{className:"tabs",sx:{my:3},children:(0,re.jsx)(a.Z,{tabs:l,current:i.tab,onChange:function(n){i.tab=n,e("".concat(w.WELLKNOWN_SERVICE_PATH_PREFIX,"/user/").concat(n))}})}),(0,re.jsx)("div",{className:"body",children:(0,re.jsx)(c.component,{user:i.user})})]})]})}var de=(0,p.Z)(b.Z)(oe||(oe=(0,t.Z)(["\n .MuiTab-root {\n padding: 0;\n margin-right: 24px;\n min-height: 32px;\n min-width: auto;\n }\n\n .MuiTabs-root {\n min-height: 32px;\n margin-bottom: 8px;\n }\n\n .MuiTabs-scroller {\n border-bottom: 1px solid #eee;\n }\n\n .MuiCheckbox-root {\n padding-top: 2px;\n padding-bottom: 2px;\n }\n"])))},86384:function(e,n,r){n.h1=void 0;var t=r(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===t.LOGIN_PROVIDER.WALLET}))}n.h1=function(e){var n=o(e);return null===n||void 0===n?void 0:n.did}},36558:function(e,n,r){var t=r(33028),i=r(59740),o=r(24974),s=r.n(o),a=r(86822),l=r(19638),c=r(23586),d=r(37574),u=["did","href","external","avatarProps"];function m(e){var n=e.did,r=e.href,o=e.external,s=(e.avatarProps,(0,i.Z)(e,u)),m=(0,d.jsx)(c.Z,(0,t.Z)({did:n},s));return r?o?(0,d.jsx)(l.Z,{target:"_blank",href:r,underline:"hover",children:m}):(0,d.jsx)(a.rU,{to:r,children:m}):m}m.propTypes={did:s().string.isRequired,to:s().string,href:s().string,avatarProps:s().object,external:s().bool},m.defaultProps={to:"",href:"",avatarProps:{},external:!1},n.Z=m},12502:function(e,n,r){r.d(n,{Z:function(){return l}});r(30969);var t=r(24974),i=r.n(t),o=r(70177),s=r(36558),a=r(37574);function l(e){return(e.user.connectedAccounts||[]).map((function(e){return(0,a.jsx)(o.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.provider,children:(0,a.jsx)(s.Z,{did:e.did})},e.did)}))}l.propTypes={user:i().object.isRequired},l.defaultProps={}},75980:function(e,n,r){r.d(n,{Z:function(){return v}});var t,i=r(71171),o=r(33028),s=r(59740),a=(r(30969),r(24974)),l=r.n(a),c=r(16380),d=r(70093),u=r.n(d),m=r(38361),p=r(26022),h=r(69936),x=r(37574),f=["passport","user","color","width","icon","children","createPassportSvg"];function v(e){var n=e.passport,r=e.user,t=e.color,i=e.width,a=e.icon,l=e.children,c=e.createPassportSvg,d=(0,s.Z)(e,f),v=(0,p.PE)().t;return(0,x.jsxs)(Z,(0,o.Z)((0,o.Z)({display:"flex",alignItems:"center"},d),{},{children:[(0,x.jsx)("div",{dangerouslySetInnerHTML:{__html:c({title:n.title||n.name,issuer:n.issuer&&n.issuer.name,issuerDid:n.issuer&&n.issuer.id,ownerName:r.fullName,ownerDid:r.did,ownerAvatarUrl:r.avatar,revoked:n.revoked,preferredColor:t,width:i})}}),(0,x.jsxs)("div",{className:"body",children:[(0,x.jsxs)(m.Z,{className:"title",display:"flex",alignItems:"center",children:[u()(n.title),(0,x.jsxs)("div",{className:"status-icons",children:[a,n.revoked&&(0,x.jsx)(h.Z,{})]})]}),n.expirationDate&&(0,x.jsx)(m.Z,{className:"title",display:"flex",alignItems:"center",children:v("team.passport.validUntil",{date:n.expirationDate})}),l]})]}))}v.propTypes={passport:l().any.isRequired,user:l().any.isRequired,color:l().string.isRequired,createPassportSvg:l().func.isRequired,icon:l().any,children:l().any,width:l().number},v.defaultProps={icon:null,children:null,width:150};var Z=(0,c.Z)(m.Z)(t||(t=(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"])))}}]);
2
- //# sourceMappingURL=5468.b54ce65b.chunk.js.map