@abtnode/blocklet-services 1.16.43 → 1.16.44-beta-20250512-155818-937e465d
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/emails/_components/activity.js +2 -1
- package/api/index.js +5 -1
- package/api/libs/email.js +1 -1
- package/dist/assets/{AdapterDayjs-BiPHzcUP.js → AdapterDayjs-BD9H1lZ-.js} +1 -1
- package/dist/assets/{ArrowDropDown-Dghek9CI.js → ArrowDropDown-BrO-zDlb.js} +1 -1
- package/dist/assets/{CheckCircle-Dvhgeo9j.js → CheckCircle-Ds4QI0ey.js} +1 -1
- package/dist/assets/{ChevronLeft-DE33N57i.js → ChevronLeft-CnQaQ-rc.js} +1 -1
- package/dist/assets/{ChevronRight-BfbPIE2b.js → ChevronRight-a_2_x6Ew.js} +1 -1
- package/dist/assets/{Community-2MKVAbIk.js → Community-DW6DJTIs.js} +1 -1
- package/dist/assets/{DeleteOutline-B6efX_Fy.js → DeleteOutline-CFN4r-OG.js} +1 -1
- package/dist/assets/{Done-Ct5slWpT.js → Done-DqSE6KPe.js} +1 -1
- package/dist/assets/{Download-DKQGRFHf.js → Download-C_LRKzbG.js} +1 -1
- package/dist/assets/{Edit-BLsIdIOp.js → Edit-CbR4eoK8.js} +1 -1
- package/dist/assets/{EditIcon-CwTCQzs9.js → EditIcon-DxUWMw59.js} +1 -1
- package/dist/assets/{Email-DOy8vL0N.js → Email-DWueGk7t.js} +1 -1
- package/dist/assets/{Error-wpqrAfUT.js → Error-jEHdDLNk.js} +1 -1
- package/dist/assets/{ExpandLess-CJXkgMMr.js → ExpandLess-CkoEHpgk.js} +1 -1
- package/dist/assets/{Google-BbAgcDQ_.js → Google-DHEolkW-.js} +1 -1
- package/dist/assets/{Holiday-DT-VjgQP.js → Holiday-Dwvo6QkZ.js} +1 -1
- package/dist/assets/{InfoOutlined-Dy7jTc7H.js → InfoOutlined-DkG0jjos.js} +1 -1
- package/dist/assets/{Launch-DBKe0gh0.js → Launch-B-2Jomi6.js} +1 -1
- package/dist/assets/{LaunchOutlined-BIq6YUU8.js → LaunchOutlined-CXNijfqX.js} +1 -1
- package/dist/assets/{Location-C__VfR4D.js → Location-DUEOr9J2.js} +1 -1
- package/dist/assets/{LockIcon-DIGiHKHl.js → LockIcon-Cjg8jV1E.js} +1 -1
- package/dist/assets/{Meeting-Cn2X2Ix7.js → Meeting-CJaI_cKm.js} +1 -1
- package/dist/assets/{MoreHoriz-BxJelL2A.js → MoreHoriz-B6KdR0Y8.js} +1 -1
- package/dist/assets/{OffSick-Cnicwu8x.js → OffSick-C9VqqjrN.js} +1 -1
- package/dist/assets/{Phone-CoX1qzAs.js → Phone-DcHUzCa-.js} +1 -1
- package/dist/assets/{PlayArrow-C9IFmc-j.js → PlayArrow-BToG9L6q.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-DCM9zW3a.js → QuestionMarkCircle-BPVDAm8U.js} +1 -1
- package/dist/assets/{ServerLogo-CfbYjQbP.js → ServerLogo-s6cfhx92.js} +1 -1
- package/dist/assets/{Timezone-CCdgxxpv.js → Timezone-B-Ho_Uno.js} +1 -1
- package/dist/assets/{TuneOutlined-CB7t_nGq.js → TuneOutlined-BR2H7Mxj.js} +1 -1
- package/dist/assets/{ViewList-B4hmqizo.js → ViewList-D8vtMKQz.js} +1 -1
- package/dist/assets/{WorkingRemotely-DWT54kH1.js → WorkingRemotely-lJ6DUMCR.js} +1 -1
- package/dist/assets/{access-control-RJu7xYI3.js → access-control-CCSlKYYz.js} +1 -1
- package/dist/assets/{actions-BCWb2ez1.js → actions-BjTeIzgS.js} +1 -1
- package/dist/assets/{add-component-core-DRAzXCeg.js → add-component-core-C7-Epxoj.js} +15 -15
- package/dist/assets/{add-resource-BDJuVU8K.js → add-resource-CJHw7ea0.js} +1 -1
- package/dist/assets/{addon-ygDS7Fug.js → addon--u4EErgw.js} +1 -1
- package/dist/assets/{advanced-CFME3Vrl.js → advanced-tG5IRVhQ.js} +1 -1
- package/dist/assets/{appearance-BqJwEmtt.js → appearance-bRLsRDs2.js} +1 -1
- package/dist/assets/audit-logs-B3-Fo3nR.js +35 -0
- package/dist/assets/{authorize-WekjQ3_M.js → authorize-DNTNbUhI.js} +1 -1
- package/dist/assets/{base32-BbrXtXL6.js → base32-_zEVBJUg.js} +1 -1
- package/dist/assets/{branding-CS-f1gMT.js → branding-By8KDk5Q.js} +6 -6
- package/dist/assets/{branding-BTfb8_b4.js → branding-hDeNkLC2.js} +2 -2
- package/dist/assets/{bundle-avatar-Db5l8MQ4.js → bundle-avatar-DYTLzqlT.js} +1 -1
- package/dist/assets/button-D8hoY4xw.js +1 -0
- package/dist/assets/click-to-copy-CFiGx48J.js +1 -0
- package/dist/assets/{collapse-Bn_BDlF9.js → collapse-QV_2gdtM.js} +1 -1
- package/dist/assets/{complete-BRApuFsV.js → complete-6R-n_Ra9.js} +2 -2
- package/dist/assets/{component-C7g4FGFm.js → component-Blsql2u0.js} +2 -2
- package/dist/assets/{config-C8AXD1JH.js → config-D6r2ZAFY.js} +2 -2
- package/dist/assets/{config-qG8JCIJ_.js → config-LE_EJolF.js} +1 -1
- package/dist/assets/{config-navigation-B7r4dV5S.js → config-navigation-B0nu0al4.js} +4 -4
- package/dist/assets/{config-space-CSKkMgqX.js → config-space-d34Deg7R.js} +1 -1
- package/dist/assets/{confirm-BvUfAlkx.js → confirm-DjTZImyg.js} +1 -1
- package/dist/assets/{connect-B2HOOYzS.js → connect-Cu2Ssv5A.js} +1 -1
- package/dist/assets/connect-K4ZmMu4L.js +5 -0
- package/dist/assets/{connect-to-BBtnljQ-.js → connect-to-BG15Vnyg.js} +1 -1
- package/dist/assets/{content-layout-DzqMXifY.js → content-layout-BzF-fNQz.js} +1 -1
- package/dist/assets/dashboard-BIOpvfj3.js +239 -0
- package/dist/assets/{delete-confirm-BBaXcAXg.js → delete-confirm-BzuBR6TW.js} +1 -1
- package/dist/assets/{did-address-BKBBjFqv.js → did-address-DjwPl1uy.js} +1 -1
- package/dist/assets/{domain-action-card-D-WETV-f.js → domain-action-card-Bcs_GWxq.js} +1 -1
- package/dist/assets/domain-wh85yL2O.js +9 -0
- package/dist/assets/domains-bzKFbARj.js +1 -0
- package/dist/assets/dot-C4hULxc0.js +7 -0
- package/dist/assets/{email-Bc5KLu5Q.js → email-BZVu6WP-.js} +1 -1
- package/dist/assets/{empty-spinner-BZlBh4vA.js → empty-spinner-n0_Ehns5.js} +1 -1
- package/dist/assets/{exchange-passport-DbNEDTaa.js → exchange-passport-8jdiPDph.js} +1 -1
- package/dist/assets/{fuel-DzWcrU-I.js → fuel-Dx_cnsCl.js} +1 -1
- package/dist/assets/{gen-access-key-D-ftFU9F.js → gen-access-key-CqKmmKML.js} +1 -1
- package/dist/assets/get-safe-url-B5RJTMjC.js +1 -0
- package/dist/assets/get-safe-url-Bk6PlU7n.js +1 -0
- package/dist/assets/{home-DXj5oFeO.js → home-DzCwBE8F.js} +1 -1
- package/dist/assets/{iframe-CIVgAJuH.js → iframe-DW7zzzTG.js} +1 -1
- package/dist/assets/{index-BemEiFHE.js → index-8CHxrfFP.js} +1 -1
- package/dist/assets/{index-CKheO_aT.js → index-B8r-LrrM.js} +1 -1
- package/dist/assets/{index-BMPpz8ni.js → index-B9nvthxv.js} +1 -1
- package/dist/assets/{index-BMD-pSqT.js → index-BDYaw77z.js} +1 -1
- package/dist/assets/{index-Ce2NSVmU.js → index-BIPRCLBG.js} +1 -1
- package/dist/assets/{index-DjLLC6N3.js → index-BYCeMwoO.js} +1 -1
- package/dist/assets/{index-D09AfnR1.js → index-Bju4sfVL.js} +1 -1
- package/dist/assets/{index-BVU8_1Ed.js → index-Btl_rz0J.js} +3 -3
- package/dist/assets/index-C-A13dEh.js +141 -0
- package/dist/assets/{index-g0L_1foA.js → index-C5SsKJ2n.js} +11 -11
- package/dist/assets/{index-CHDiquXf.js → index-CPfvVvHv.js} +11 -11
- package/dist/assets/{index-CUfP1M2j.js → index-Cc-e6lxg.js} +1 -1
- package/dist/assets/{index-wXCx8TFU.js → index-DcUhenm6.js} +1 -1
- package/dist/assets/{index-u-w3iMC9.js → index-DefO2n6z.js} +4 -4
- package/dist/assets/{index--HbH1n1_.js → index-DjEDWgGs.js} +1 -1
- package/dist/assets/{index-DF3gHUuW.js → index-Du38Vjy4.js} +4 -4
- package/dist/assets/{index-D64RNKdt.js → index-Dyl-XQ73.js} +6 -6
- package/dist/assets/{index-BmWVfEGP.js → index-HU4yqI-9.js} +1 -1
- package/dist/assets/index-Jnk92KZC.js +284 -0
- package/dist/assets/{index-Bxd86KLJ.js → index-SzdSxpkq.js} +4 -4
- package/dist/assets/index-USO5zFMh.js +55 -0
- package/dist/assets/{index-C0SLCehH.js → index-enM9Y412.js} +1 -1
- package/dist/assets/index-ioZVVJtg.js +113 -0
- package/dist/assets/{invitation-CKfllvl5.js → invitation-1bsb30Yz.js} +1 -1
- package/dist/assets/{invite-CCCSmPiy.js → invite-CALl83Zc.js} +1 -1
- package/dist/assets/{issue-passport-C3zUptls.js → issue-passport-BcStTsbv.js} +1 -1
- package/dist/assets/{item-CkcpHBHM.js → item-Bk_1JLeG.js} +1 -1
- package/dist/assets/{landing-page-q-KgqE9Q.js → landing-page-Due4o1uF.js} +1 -1
- package/dist/assets/{launch-result-message-BaU6oEsi.js → launch-result-message-DIYoykBK.js} +1 -1
- package/dist/assets/{layout-CyCulQBn.js → layout-D93HKT6w.js} +1 -1
- package/dist/assets/list-D96_O-GY.js +2 -0
- package/dist/assets/{list-header-CU9W30JD.js → list-header-HqBQs1yn.js} +1 -1
- package/dist/assets/list-rt6nku1-.js +236 -0
- package/dist/assets/localization-BUDtnbyU.js +1 -0
- package/dist/assets/{log-DNpJdgp3.js → log--AX8zo75.js} +1 -1
- package/dist/assets/{logger-CQ50TnpL.js → logger-BLZgTs_U.js} +1 -1
- package/dist/assets/{login-BKaJnfFX.js → login-WRcteY7r.js} +1 -1
- package/dist/assets/{login-oauth-callback-LJsgXC8E.js → login-oauth-callback-DZaPZfnA.js} +1 -1
- package/dist/assets/{logo-uploader-BYnd80uu.js → logo-uploader-CQCy6MG3.js} +3 -3
- package/dist/assets/{lost-passport-Bk0k4I4s.js → lost-passport-kJX7pEJj.js} +1 -1
- package/dist/assets/{open-window-DV0D-Mov.js → open-window--2G6Qjbq.js} +1 -1
- package/dist/assets/overview-CpKMiGEK.js +85 -0
- package/dist/assets/{page-header-CpNMTtn_.js → page-header-xyZktwBS.js} +1 -1
- package/dist/assets/{passport-item-BxfGrDcE.js → passport-item-CIvCqz_R.js} +1 -1
- package/dist/assets/{permission-BkNXA8B5.js → permission-BH1TY_tz.js} +1 -1
- package/dist/assets/{preferences-_jTjKHvU.js → preferences-CfmnTXfl.js} +1 -1
- package/dist/assets/{profile-embed-8w4_vg5a.js → profile-embed-ZtzRYgXv.js} +1 -1
- package/dist/assets/publish-resource-CCa5xfwz.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-Cq_dOQ2z.js → react-beautiful-dnd.esm-7PS2VwOi.js} +1 -1
- package/dist/assets/runtime-eXYlg9Cz.js +1 -0
- package/dist/assets/sdk-9eXJSWHG.js +1 -0
- package/dist/assets/section-Cv4udilp.js +41 -0
- package/dist/assets/{security-BQbSLSOe.js → security-DM8MeY05.js} +3 -3
- package/dist/assets/{session-6XaVDQaE.js → session-CHdTc1We.js} +1 -1
- package/dist/assets/setup-BEsU41BB.js +30 -0
- package/dist/assets/{shorten-label-Dq7bVuNa.js → shorten-label-Cng55547.js} +1 -1
- package/dist/assets/{simple-select-C-wGUGQR.js → simple-select-CP_Svi_D.js} +1 -1
- package/dist/assets/{slicedToArray-vWe02CJE.js → slicedToArray-C7EPqaHf.js} +1 -1
- package/dist/assets/{spaces-Cp7TgoZP.js → spaces-BVG-t3ND.js} +1 -1
- package/dist/assets/{start-CHmWCQE9.js → start-CIjuDAiX.js} +1 -1
- package/dist/assets/{starting-progress-CdpkXOrK.js → starting-progress-CiLZpNpg.js} +1 -1
- package/dist/assets/{status-46dMQnxA.js → status-CUMJd-nJ.js} +1 -1
- package/dist/assets/{step-actions-Bu3Q5M4V.js → step-actions-CeJCmiCS.js} +1 -1
- package/dist/assets/{studio-BbeHx14I.js → studio-DikseKRr.js} +1 -1
- package/dist/assets/{switch-control-D6CqAlDY.js → switch-control-C5i52ixk.js} +1 -1
- package/dist/assets/{traffic-CY9Vj6w7.js → traffic-B5x_6GvF.js} +2 -2
- package/dist/assets/{transfer-CSeo2FaW.js → transfer-CTEHVklh.js} +1 -1
- package/dist/assets/{unsubscribe-BLaMmgbM.js → unsubscribe-Bi2IV-2n.js} +1 -1
- package/dist/assets/{use-blocklet-logo-sEJnYyNL.js → use-blocklet-logo-BEy8Tnso.js} +2 -2
- package/dist/assets/{use-mobile-BAjFH6d8.js → use-mobile-Boa_xu9A.js} +1 -1
- package/dist/assets/{use-mobile-Bh8CHBbH.js → use-mobile-DyX6Fl8Z.js} +1 -1
- package/dist/assets/useAsync-C8ydfEEr.js +1 -0
- package/dist/assets/useAsync-CMWsznMW.js +1 -0
- package/dist/assets/{useLocalStorage-C6U1Aqya.js → useLocalStorage-DVnkpneF.js} +1 -1
- package/dist/assets/user-center-DcXdjtRX.js +76 -0
- package/dist/assets/{util-Bg0WSJ-t.js → util-CEAObyfj.js} +1 -1
- package/dist/assets/{util-RWes6RwK.js → util-MKllNgBs.js} +1 -1
- package/dist/assets/{vendor-arcblock-CN2B_oTr.js → vendor-arcblock-uz9DVywv.js} +45 -45
- package/dist/assets/{vendor-mui-core-UZpb7wT7.js → vendor-mui-core-D_bnq77o.js} +1 -1
- package/dist/assets/{vendor-mui-x-whuSO90H.js → vendor-mui-x-R-0SFz4c.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-TEE6cGq6.js → vendor-ux-did-connect-DHrruicZ.js} +136 -136
- package/dist/assets/{wrap-locale-DZ79GW_G.js → wrap-locale-B9TkXFQe.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/dist/share/shared-bridge.html +4 -4
- package/package.json +32 -32
- package/dist/assets/audit-logs-CtFZQHby.js +0 -35
- package/dist/assets/button-DotKXyjc.js +0 -1
- package/dist/assets/click-to-copy-BxhgzyYL.js +0 -1
- package/dist/assets/connect-DGPdKMcu.js +0 -5
- package/dist/assets/dashboard-C124DXmc.js +0 -279
- package/dist/assets/domain-DTrwCkop.js +0 -9
- package/dist/assets/domains-BxkmGeZE.js +0 -1
- package/dist/assets/dot-C05enzim.js +0 -7
- package/dist/assets/get-safe-url-2RcRY8gU.js +0 -1
- package/dist/assets/get-safe-url-CEvgWyL5.js +0 -1
- package/dist/assets/index-9ixwCOkw.js +0 -113
- package/dist/assets/index-B_fwtN9z.js +0 -55
- package/dist/assets/index-CyUXddLG.js +0 -284
- package/dist/assets/index-DsT9i24r.js +0 -141
- package/dist/assets/list-D1dIr8Je.js +0 -2
- package/dist/assets/list-TP-VNuzL.js +0 -236
- package/dist/assets/localization-BXLZxF1J.js +0 -1
- package/dist/assets/overview-UIMGVO1S.js +0 -85
- package/dist/assets/publish-resource-CcM3RwPR.js +0 -1
- package/dist/assets/relative-time-Cl7lOTkO.js +0 -1
- package/dist/assets/runtime-BVDdcpyT.js +0 -1
- package/dist/assets/sdk-7yPC_DtN.js +0 -1
- package/dist/assets/setup-CifjXQIf.js +0 -30
- package/dist/assets/useAsync-DV3NyLhI.js +0 -1
- package/dist/assets/user-center-BHyd-rRF.js +0 -76
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import{u as q,_ as $,bN as U,I as be,bO as fe,a0 as ge,a7 as je,bu as ye}from"./vendor-ux-did-connect-DHrruicZ.js";import{t as we,m as de,j as ke}from"./vendor-hooks-rDgu5KV9.js";import{r as C,b as G}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-DkG0jjos.js";import{j as ve,M as Ee}from"./vendor-arcblock-uz9DVywv.js";import{z as F,au as Ce,av as K,C as ce,t as Te}from"./index-DefO2n6z.js";import{u as _}from"./dashboard-BIOpvfj3.js";import{H as o,j as e,D as Se,aj as Re,t as Ie,aa as f,O as ie,T as S,ab as B,ak as Z,z as Me,y as H,bt as le,bS as Y,ad as W,L as J,A as Q,bd as Pe,E as O,I as ee,C as ze,br as De,al as P,ch as $e,X as We,bc as V,bq as Oe,b5 as Ae,ci as qe,cj as Le,b6 as Be,an as He,c1 as Ne,s as pe,v as Fe,ck as _e,cl as Ue,cm as Ke,cn as Ye}from"./vendor-mui-core-D_bnq77o.js";import{d as Ve}from"./ExpandLess-CkoEHpgk.js";import{b as ue,z as Je,A as Qe}from"./vendor-utils-rHXShPKm.js";import{C as Ge}from"./confirm-DjTZImyg.js";import{A as Xe}from"./actions-BjTeIzgS.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DVnkpneF.js";import"./PlayArrow-BToG9L6q.js";import"./get-safe-url-Bk6PlU7n.js";import"./format-error-BrmqJs5a.js";import"./session-CHdTc1We.js";import"./use-blocklet-logo-BEy8Tnso.js";import"./dot-C4hULxc0.js";import"./useAsync-CMWsznMW.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DyX6Fl8Z.js";import"./MoreHoriz-B6KdR0Y8.js";const Ze=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=ce(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const x={};return d&&(d.sources.forEach(r=>{x[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{x[r.source]&&(x[r.source].events.push(r),x[r.source].count+=1)})),x},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(x){p(x instanceof Error?x:new Error(String(x)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:a,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=q(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:j}])=>{const E=j.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},x=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:x,checked:l>0&&l===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(W,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const M=s[r]>0,i=s[r]===j.length&&j.length>0,h=R[r];return e.jsxs(G.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:i,indeterminate:M&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Pe,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(ee,{size:"small",edge:"end",children:h?e.jsx(Ve,{}):e.jsx(ve,{})})]})]})}),j.length>0&&e.jsx(ze,{in:h,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,k=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:k,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(De,{error:!0,sx:{mt:1},children:a})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=q(),[s,l]=C.useState({}),{teamDid:v}=_(),{api:T}=F(),{loading:g,error:y,eventsBySource:x}=Ze(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:M}=Ce({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[s,u,M]);const i=()=>{l({}),E(),R()},h=async m=>{const k=Object.keys(s).filter(I=>s[I]),z={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[A,L]=I.split("-");return!A||!L?null:{type:A,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:z}});$.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:z}});$.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){$.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(Se,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(h),children:[e.jsx(Re,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ie,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!j.url,helperText:(k=j.url)==null?void 0:k.message})}}),e.jsx(K,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!j.description,helperText:(k=j.description)==null?void 0:k.message})}}),e.jsx(K,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&x&&Object.keys(x).length>0&&e.jsx(te,{eventsBySource:x,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!x||Object.keys(x).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(B,{size:20})}),y&&e.jsx(Z,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Me,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:i,children:p("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const et=(t="en")=>t==="tw"?"zh":t;function N(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Te(t).locale(et(c)).format(d):"-"}function tt(t){return typeof t=="number"?!1:ue(t)}function ot(t){return t>=200&&t<300}function D(t){const d=tt(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(W,{title:t.tip,children:e.jsx($e,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(We,{orientation:"vertical",flexItem:!0})]})}D.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};D.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const nt=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=F(),{t:b}=q(),{teamDid:R}=_(),{blocklet:p}=ce(),{data:s,loadMore:l,loadingMore:v,loading:T}=we(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),g=(s==null?void 0:s.list)||[],[y,x]=C.useState(null),r=nt(g);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&x(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{x(u)};if(T)return e.jsx(B,{});const j=s&&s.list.length<s.paging.total,E=u=>{var M,i,h,n,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((h=u.responseBody)!=null&&h.agentId)){const k=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,z=(p.children||[]).find(A=>{var L;return((L=A==null?void 0:A.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Qe(`https://${k}`,(z==null?void 0:z.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(G.Fragment,{children:[e.jsx(Oe,{children:u}),M.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:N(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ae,{sx:{minWidth:0,mr:1.5},children:ot(i.responseStatus)===!1?e.jsx(qe,{color:"error"}):e.jsx(Le,{color:"success"})}),e.jsx(Be,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function he({id:t,onClose:d}){var v,T,g,y;const{t:c}=q(),{api:a}=F(),{teamDid:b}=_(),{loading:R,error:p,data:s}=de(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(Z,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(B,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(W,{title:l.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Ne,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(P,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(D,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.listen"),value:e.jsx(W,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(x=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:x==null?void 0:x.type},x))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:N(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:N(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx(W,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx(W,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:l.id})})]})]})}he.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx(He,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(he,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function ae(){return null}const re=G.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=q(),l=Fe(g=>g.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=ae),a||(T.TableFooter=ae),e.jsx(rt,{locale:s,options:{...v,...t},columns:(d||[]).map(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(ge,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(je)`
|
|
2
|
+
.custom-toobar-btns {
|
|
3
|
+
gap: 8px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.MuiPaper-root {
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
table.MuiTable-root {
|
|
11
|
+
outline: 1px solid ${({theme:t})=>t.palette.divider};
|
|
12
|
+
border-radius: var(--radius-m, 8px);
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
15
|
+
[class*='MUIDataTable-responsiveBase'] {
|
|
16
|
+
outline: 1px solid ${({theme:t})=>t.palette.divider};
|
|
17
|
+
border-radius: var(--radius-m, 8px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
th.MuiTableCell-head {
|
|
21
|
+
padding: 8px 16px 8px 16px;
|
|
22
|
+
text-transform: inherit;
|
|
23
|
+
border-bottom: none;
|
|
24
|
+
&:first-of-type {
|
|
25
|
+
border-top-left-radius: 8px;
|
|
26
|
+
padding-left: 20px;
|
|
27
|
+
}
|
|
28
|
+
&:last-of-type {
|
|
29
|
+
border-top-right-radius: 8px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
tr.MuiTableRow-root:not(.MuiTableRow-footer):hover {
|
|
34
|
+
background: ${({theme:t})=>t.palette.grey[100]};
|
|
35
|
+
}
|
|
36
|
+
tr.MuiTableRow-root:last-of-type td:first-of-type {
|
|
37
|
+
border-bottom-left-radius: 8px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
tr.MuiTableRow-root:last-of-type td:last-of-type {
|
|
41
|
+
border-bottom-right-radius: 8px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
tr.MuiTableRow-root:nth-of-type(even) {
|
|
45
|
+
background: ${({theme:t})=>t.palette.grey[50]};
|
|
46
|
+
}
|
|
47
|
+
td.MuiTableCell-root {
|
|
48
|
+
border-bottom: none;
|
|
49
|
+
padding-top: 12px;
|
|
50
|
+
padding-bottom: 12px;
|
|
51
|
+
padding-left: 16px;
|
|
52
|
+
padding-right: 16px;
|
|
53
|
+
&:first-of-type {
|
|
54
|
+
padding-left: 20px;
|
|
55
|
+
}
|
|
56
|
+
&.MuiTableCell-footer {
|
|
57
|
+
border: none;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.datatable-footer {
|
|
62
|
+
.MuiTableRow-root.MuiTableRow-footer {
|
|
63
|
+
border: none;
|
|
64
|
+
}
|
|
65
|
+
table.MuiTable-root {
|
|
66
|
+
outline: none;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
}
|
|
69
|
+
.MuiTablePagination-input {
|
|
70
|
+
background: none;
|
|
71
|
+
}
|
|
72
|
+
div.MuiSelect-select {
|
|
73
|
+
padding: 0 24px 0 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
th a,
|
|
78
|
+
td a {
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
display: block;
|
|
81
|
+
color: inherit;
|
|
82
|
+
&:first-of-type {
|
|
83
|
+
padding-left: 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
> div {
|
|
88
|
+
overflow: auto;
|
|
89
|
+
}
|
|
90
|
+
.custom-toobar-title-inner {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
}
|
|
94
|
+
@media (max-width: ${({theme:t})=>t.breakpoints.values.md}px) {
|
|
95
|
+
th a,
|
|
96
|
+
td a {
|
|
97
|
+
text-decoration: none;
|
|
98
|
+
display: block;
|
|
99
|
+
color: inherit;
|
|
100
|
+
padding-top: 0;
|
|
101
|
+
padding-bottom: 0;
|
|
102
|
+
padding-right: 0;
|
|
103
|
+
}
|
|
104
|
+
tr.MuiTableRow-root {
|
|
105
|
+
border: none;
|
|
106
|
+
padding: 20px;
|
|
107
|
+
display: block;
|
|
108
|
+
}
|
|
109
|
+
td.MuiTableCell-root:first-of-type {
|
|
110
|
+
padding-left: 0;
|
|
111
|
+
margin-top: 0;
|
|
112
|
+
}
|
|
113
|
+
td.MuiTableCell-root {
|
|
114
|
+
margin: 0;
|
|
115
|
+
margin-top: 8px;
|
|
116
|
+
align-items: center;
|
|
117
|
+
padding: 0;
|
|
118
|
+
flex-wrap: wrap;
|
|
119
|
+
flex-direction: ${({mobileTDFlexDirection:t="column"})=>t||"row"};
|
|
120
|
+
align-items: ${({mobileTDFlexDirection:t="column"})=>t==="column"?"flex-start":"center"};
|
|
121
|
+
justify-content: ${({mobileTDFlexDirection:t="column"})=>t==="column"?"flex-start":"space-between"};
|
|
122
|
+
}
|
|
123
|
+
td.MuiTableCell-root > div {
|
|
124
|
+
margin-bottom: 4px;
|
|
125
|
+
}
|
|
126
|
+
.MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: ${({mobileTDFlexDirection:t="column"})=>t||"row"};
|
|
129
|
+
align-items: flex-start;
|
|
130
|
+
justify-content: ${({mobileTDFlexDirection:t="column"})=>t==="row"?"space-between":"flex-start"};
|
|
131
|
+
flex-wrap: ${({mobileTDFlexDirection:t="column"})=>t==="row"?"nowrap":"wrap"};
|
|
132
|
+
word-break: break-all;
|
|
133
|
+
&.datatables-noprint {
|
|
134
|
+
justify-content: center;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
[class*='MUIDataTable-responsiveBase'] tr:not([class*='responsiveSimple']) td.MuiTableCell-body > div {
|
|
138
|
+
width: inherit;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`,it=re;function Pt(){const{teamDid:t}=_(),d=`webhook-endpoints-${t}`,c=ye(d),{t:a}=q(),{api:b}=F(),[R,p]=C.useState(""),[s,l]=C.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[v,T]=ke(d,{defaultValue:{pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1}}),{loading:g,error:y,data:x,refresh:r}=de(()=>b.getWebhookEndpoints({input:{teamDid:t,paging:{page:v.page,pageSize:v.pageSize}}}));C.useEffect(()=>{r()},[v,r]);const w=C.useCallback(async(i,h)=>{try{await b.updateWebhookEndpoint({input:{teamDid:t,id:i.id,data:{status:h?"disabled":"enabled"}}}),r(),$.success(`${a(h?"webhookEndpoint.disable":"webhookEndpoint.enable")}${a("webhookEndpoint.success")}`)}catch(n){$.error(n==null?void 0:n.message)}},[b,t,r,a]),j=C.useCallback(async i=>{try{await b.deleteWebhookEndpoint({input:{teamDid:t,id:i}}),r(),l(h=>({...h,deleteConfirm:null})),$.success(`${a("common.delete")}${a("webhookEndpoint.success")}`)}catch(h){$.error(h==null?void 0:h.message)}},[b,t,r,a]),E=(i,h)=>{let n=i.page+1;const m=i.searchText||"";if(m!==R){p(m);return}if(h==="changePage"||h==="changeRowsPerPage"){h!=="changePage"&&(n=1);const k={page:n,pageSize:i.rowsPerPage};p(""),T(k)}};if(y)return e.jsx(Z,{severity:"error",children:y.message});if(g||!x)return e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(B,{})});const u=((x==null?void 0:x.list)||[]).filter(i=>{if(!R)return!0;const h=R.toLowerCase();return i.description.toLowerCase().includes(h)||i.url.toLowerCase().includes(h)}),M=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,h)=>{const n=u[h];return e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(S,{variant:"body2",children:n.description}),e.jsx(f,{sx:{display:"flex"},onClick:m=>{m.stopPropagation()},children:e.jsx(W,{title:n.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,h)=>{const n=u[h];return e.jsx(f,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(m=>e.jsx(O,{size:"small",variant:"filled",label:m.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${m.type}`))})}}},{label:a("common.status"),name:"status",options:{customBodyRenderLite:(i,h)=>{const n=u[h];return e.jsx(O,{size:"small",variant:"filled",label:a(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:a("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>N(i)}},{label:a("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,h)=>{const n=u[h],m=(n==null?void 0:n.status)==="enabled";return e.jsx(Xe,{actions:[{icon:m?e.jsx(_e,{}):e.jsx(Ue,{}),text:a(m?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:k=>{k.stopPropagation(),w(n,m)}},{icon:e.jsx(Ke,{}),text:a("common.edit"),onClick:k=>{k.stopPropagation(),l(z=>({...z,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Ye,{}),text:a("common.delete"),onClick:k=>{k.stopPropagation(),l(z=>({...z,deleteConfirm:{title:a("webhookEndpoint.deleteWebhook.title"),description:a("webhookEndpoint.deleteWebhook.description"),confirm:a("common.confirm"),cancel:a("common.cancel"),onConfirm:()=>j(n.id),onCancel:()=>l(I=>({...I,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(e.Fragment,{children:[e.jsx(it,{durable:d,durableKeys:["page","rowsPerPage"],data:u,columns:M,options:{count:x.count,page:v.page-1,rowsPerPage:v.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:h})=>{const n=x.list[h];l(m=>({...m,webhookDetail:{open:!0,id:n.id}}))}},loading:g,onChange:E,title:e.jsx(S,{variant:"h6",children:a("webhookEndpoint.title")}),emptyNodeText:e.jsxs(P,{gap:1,children:[a("webhookEndpoint.noWebhooksAdded"),e.jsx(H,{variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),children:a("webhookEndpoint.createWebhook")})]}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[g?e.jsx(B,{size:16}):e.jsx(Ee,{style:{fontSize:16}}),a("common.create")]},"add")]}),s.webhookDetail.open&&e.jsx(me,{open:!0,onClose:()=>l(i=>({...i,webhookDetail:{open:!1,id:null}})),id:s.webhookDetail.id}),s.createEdit.open&&e.jsx(oe,{onSubmit:r,...s.createEdit,onClose:()=>l(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),s.deleteConfirm&&e.jsx(Ge,{title:s.deleteConfirm.title,description:s.deleteConfirm.description,confirm:s.deleteConfirm.confirm,cancel:s.deleteConfirm.cancel,params:s.deleteConfirm.params,onConfirm:s.deleteConfirm.onConfirm,onCancel:s.deleteConfirm.onCancel})]})}export{Pt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m as
|
|
1
|
+
import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m as ne}from"./vendor-hooks-rDgu5KV9.js";import{j as e,aa as g,H as w,ah as H,E as pt,T as E,X as ut,al as te,ad as Y,ab as M,ak as Me,a9 as mt,I as q,O as W,q as oe,N as ft,bs as $e,co as Oe,cp as ee,bV as We,br as qe,by as ht,bt as xt,bS as gt,v as yt,y as jt,bo as vt,s as bt}from"./vendor-mui-core-D_bnq77o.js";import{u as L,am as U,as as Ct,X as fe,_ as F,a7 as xe,j as G,aN as St,B as _,r as Tt,a0 as ge,bv as He,h as wt,b7 as Pt,bP as Fe,bi as It,bu as Rt}from"./vendor-ux-did-connect-DHrruicZ.js";import{z as A,t as Ue,l as Dt,R as X,C as kt,aa as Ft,f as At,b as re,aw as Nt,M as Ge}from"./index-DefO2n6z.js";import{w as Lt,c as Bt,M as ye,$ as Q}from"./vendor-arcblock-uz9DVywv.js";import{W as je}from"./did-address-DjwPl1uy.js";import{u as $}from"./dashboard-BIOpvfj3.js";import{r as ve,a as be,b as Ce,c as ie,d as zt,e as Ve,u as _t,f as Et}from"./passport-item-CIvCqz_R.js";import{p as Ke}from"./util-CEAObyfj.js";import{w as V,P as Ye}from"./permission-BH1TY_tz.js";import{C as Mt}from"./Google-DHEolkW-.js";import{M as Z,aA as $t,K as Ot}from"./vendor-utils-rHXShPKm.js";import{E as le}from"./EditIcon-DxUWMw59.js";import{C as Se}from"./confirm-DjTZImyg.js";import{L as Ze}from"./list-header-HqBQs1yn.js";import{f as se}from"./format-error-BrmqJs5a.js";import{_ as Wt}from"./useSetState-CWq0AVWn.js";import{L as qt}from"./LockIcon-Cjg8jV1E.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DVnkpneF.js";import"./PlayArrow-BToG9L6q.js";import"./get-safe-url-Bk6PlU7n.js";import"./session-CHdTc1We.js";import"./use-blocklet-logo-BEy8Tnso.js";import"./InfoOutlined-DkG0jjos.js";import"./dot-C4hULxc0.js";import"./useAsync-CMWsznMW.js";import"./use-mobile-DyX6Fl8Z.js";import"./index-BIPRCLBG.js";import"./Phone-DcHUzCa-.js";import"./Location-DUEOr9J2.js";import"./Email-DWueGk7t.js";import"./Timezone-B-Ho_Uno.js";import"./base32-_zEVBJUg.js";import"./cloneDeep-UpFQ2VNg.js";const Ae="info";function Te({createPassportSvg:c,passport:o,onCancel:d,onSwitchPassport:f}){const{t:u}=L(),l=dt({tab:Ae}),h={info:{label:u("common.basicInfo"),value:Ae,component:()=>e.jsx(Xe,{passport:o,createPassportSvg:c})},logs:{label:u("common.logs"),value:"logs",component:()=>e.jsx(et,{passport:o})},related:{label:u("team.passport.related"),value:"related",component:()=>e.jsx(tt,{passport:o,onSwitchPassport:f})}},s=Object.values(h).map(({label:n,value:t})=>({label:n,value:t})).filter(n=>n.value==="related"?o.parentDid:!0),m=h[l.tab]||h.info,a=n=>{l.tab=n};return e.jsx(U,{title:u("common.passport"),onClose:d,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ht,{children:[e.jsx(g,{className:"tabs",children:e.jsx(Ct,{tabs:s,current:l.tab,onChange:a,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(m.component,{})})]})})}Te.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};Te.defaultProps={onSwitchPassport:()=>{}};const Ht=H(g)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -9,7 +9,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
9
9
|
.body {
|
|
10
10
|
margin-top: 24px;
|
|
11
11
|
}
|
|
12
|
-
`;function
|
|
12
|
+
`;function Xe({createPassportSvg:c,passport:o}){var m,a,n,t;const{t:d,locale:f}=L(),{teamDid:u}=$(),{inService:l}=A(),h=[{items:[{label:d("common.role"),content:ve(o.title)},{label:d("common.did"),content:e.jsx(je,{did:o.id})},{label:d("team.passport.status"),content:be(o.status)},{label:d("common.type"),content:e.jsx(g,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(o.type||[]).map(r=>e.jsx(pt,{label:r,variant:"outlined",size:"small",sx:{borderRadius:1}},r))})}]}],s=[{title:d("team.passport.owner"),items:[{label:d("team.passport.owner"),content:e.jsx(g,{children:Ce(o.user,l)})}]},{title:d("common.timeInfo"),items:[{label:d("team.passport.issuanceTime"),content:o.issuanceDate?e.jsx(fe,{value:o.issuanceDate,type:"all",locale:f}):"-"},{label:d("team.member.lastLogin"),content:o.lastLoginAt?e.jsx(fe,{value:o.lastLoginAt,type:"all",locale:f}):"-"},{label:d("common.expires"),content:o.expirationDate?e.jsx(fe,{value:o.expirationDate,type:"all",locale:f}):"-"}]},{title:d("blocklet.overview.source"),items:[{label:d("blocklet.overview.source"),content:ie(o.source)}]}];return e.jsxs(Ut,{gap:3,children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",width:"100%",overflow:"hidden",gap:5},children:[e.jsx(g,{sx:{display:"flex",p:1},className:"passport-image",dangerouslySetInnerHTML:{__html:c({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:(m=o.user)==null?void 0:m.fullName,ownerDid:(a=o.user)==null?void 0:a.did,ownerAvatarUrl:(n=o.user)!=null&&n.avatar?Ke((t=o.user)==null?void 0:t.avatar,u,l):"",revoked:o.revoked,width:"200px",extra:o!=null&&o.expirationDate?{key:"Exp",value:Ue(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(g,{className:"info-area",children:h.map(r=>e.jsxs(g,{children:[r.title&&e.jsx(E,{variant:"h6",sx:{mb:2},children:r.title}),e.jsx(g,{className:"info-grid",sx:{gap:"12px !important"},children:r.items.map(i=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",sx:{maxWidth:40},children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:i.label})}),e.jsx(g,{children:i.content})]},i.label))})]},r.title))})]}),e.jsx(ut,{}),e.jsx(g,{className:"info-area",children:s.map(r=>e.jsxs(g,{children:[e.jsx(E,{variant:"h6",sx:{mb:1.5},children:r.title}),e.jsx(g,{className:"info-grid",children:r.items.map(i=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:i.label})}),e.jsx(g,{children:i.content})]},i.label))})]},r.title))})]})}Xe.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired};const Ut=H(te)`
|
|
13
13
|
.info-card {
|
|
14
14
|
margin-bottom: 24px;
|
|
15
15
|
overflow: hidden;
|
|
@@ -83,7 +83,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
83
83
|
margin: 0;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
`,Je=10,Xe=1;function et({passport:c}){const{api:o}=A(),{teamDid:d}=$(),{t:f,locale:u}=L(),[l,h]=S.useState({pageSize:Je,page:Xe}),{data:s,loading:m}=oe(async()=>{const y={teamDid:d,query:{passportId:c.id},paging:{page:l.page,pageSize:l.pageSize}},x=await o.getPassportLogs({input:y});return{logs:x.passportLogs||[],total:x.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:y=>F.error(y.message)}),a=S.useMemo(()=>(s==null?void 0:s.logs)||[],[s==null?void 0:s.logs]),n=y=>{var x,p,v,j,T,C,I,D,N;return y.action===G.PASSPORT_LOG_ACTION.APPROVE||y.action===G.PASSPORT_LOG_ACTION.REVOKE?(p=(x=y==null?void 0:y.metadata)==null?void 0:x.operator)!=null&&p.fullName?`${f("common.operator")}: ${(j=(v=y==null?void 0:y.metadata)==null?void 0:v.operator)==null?void 0:j.fullName}`:null:y.action===G.PASSPORT_LOG_ACTION.ISSUE&&((T=y.metadata)==null?void 0:T.action)===G.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?(I=(C=y==null?void 0:y.metadata)==null?void 0:C.inviter)!=null&&I.fullName?`${f("common.inviter")}: ${(N=(D=y==null?void 0:y.metadata)==null?void 0:D.inviter)==null?void 0:N.fullName}`:null:`passportId: ${y.passportId}`},t=S.useMemo(()=>[{label:f("common.action"),name:"action",options:{customBodyRender:(y,{rowIndex:x})=>{var v;const p=a[x];return e.jsx(Y,{title:n(p),children:`${y} ${(v=p.metadata)!=null&&v.action?`(${p.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:y=>e.jsx(g,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:y||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(y,{rowIndex:x})=>{const p=a[x];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.operatorUa&&e.jsx(g,{children:Bt(p.operatorUa)}),p.operatorUa&&e.jsx(Y,{title:p.operatorUa,children:e.jsx(Nt,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:f("common.createdAt"),name:"createdAt",options:{customBodyRender:y=>ne(y,u)}}],[f,u,a]),r=({page:y,rowsPerPage:x})=>{l.pageSize!==x?h(p=>({...p,pageSize:x,page:1})):l.page!==y+1&&h(p=>({...p,page:y+1}))},i={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:(s==null?void 0:s.total)||0};return m?e.jsx(g,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsx(g,{children:e.jsx(xe,{className:"logs-table",verticalKeyWidth:100,locale:u,data:a,columns:t,options:i,loading:m,onChange:r})})}et.propTypes={passport:w.object.isRequired};function tt({passport:c,onSwitchPassport:o}){const{api:d}=A(),{teamDid:f}=$(),{t:u,locale:l}=L(),[h,s]=S.useState({pageSize:Je,page:Xe}),{data:m,loading:a}=oe(async()=>{const x={teamDid:f,passportId:c.parentDid,paging:{page:h.page,pageSize:h.pageSize}},p=await d.getRelatedPassports({input:x});return{passports:p.passports||[],total:p.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:x=>F.error(x.message)}),n=S.useMemo(()=>(m==null?void 0:m.passports)||[],[m==null?void 0:m.passports]),t=S.useMemo(()=>[{label:u("team.passport.role"),name:"role",options:{customBodyRender:ve}},{label:u("team.passport.owner"),name:"user",options:{customBodyRender:Ce}},{label:u("team.passport.status"),name:"status",options:{customBodyRender:be}},{label:u("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:x=>Ve(x,l)}},{label:u("blocklet.overview.source"),name:"source",options:{customBodyRender:le}}],[u,l]),r=({page:x,rowsPerPage:p})=>{h.pageSize!==p?s(v=>({...v,pageSize:p,page:1})):h.page!==x+1&&s(v=>({...v,page:x+1}))},i=S.useRef(null),y={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:(m==null?void 0:m.total)||0,onRowClick(x,{dataIndex:p},v){var j;if((j=i.current)!=null&&j.contains(v.target)){const T=n[p];o(T)}}};return a?e.jsx(g,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(te,{spacing:1,children:[e.jsx(Me,{severity:"warning",children:u("team.passport.relatedDescription")}),e.jsx(g,{ref:i,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(xe,{className:"related-table",verticalKeyWidth:100,locale:l,data:n.filter(x=>x.id!==c.id),columns:t,options:y,loading:a,onChange:r})})]})}tt.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function de({onCancel:c,onSuccess:o}){const{api:d}=A(),{blocklet:f}=Dt(),{t:u}=L(),[l,h]=S.useState(!1),s=(f.environments.find(r=>r.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",m=s==="auto"?St.getPassportColorFromDid(f.appDid):s,[a,n]=S.useState(m),t=async()=>{const r=[{key:Lt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:a}];try{h(!0),await d.configBlocklet({input:{did:f.meta.did,configs:r}}),o()}catch(i){F.error(i.message)}finally{h(!1)}};return e.jsx(U,{title:u("team.passport.color"),onClose:c,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:u("common.cancel")}),e.jsxs(_,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx(M,{size:16}),u("common.save")]})]}),children:e.jsxs(g,{display:"flex",justifyContent:"center",alignItems:"center",className:"dialog-content",children:[e.jsx(Et,{disableAlpha:!0,color:a,onChange:r=>n(r.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:kt({scope:"passport",role:"owner",title:"Owner",issuer:Ft.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:a})}})]})})}const Ut=V(de,"mutate_team"),Gt=V(de,"",Q);function Vt(c){const{inService:o}=A();return o?e.jsx(Gt,{...c}):e.jsx(Ut,{...c})}de.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};de.defaultProps={};var J=function(c){return e.jsx("svg",{...c,children:e.jsx("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})})};J.defaultProps={width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};J.displayName="delete";var we={},Kt=mt;Object.defineProperty(we,"__esModule",{value:!0});var Pe=we.default=void 0,Yt=Kt(Tt()),Zt=e;Pe=we.default=(0,Yt.default)((0,Zt.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack");var st=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};st.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Qt=(c,o)=>c?!o.some(d=>!d.from.passport||!d.to.role):!1;function Ie({onCancel:c,onSuccess:o,data:d,trustedPassports:f}){const{api:u}=A(),{roles:l,teamDid:h}=$(),{t:s}=L(),[m,a]=S.useState(!1),[n,t]=S.useState(d.issuerDid||""),[r,i]=S.useState(d.remark||""),[y,x]=S.useState(Z(d.mappings)||[]),p=f.findIndex(j=>j.issuerDid===d.issuerDid),v=async()=>{if(m)return;const j={issuerDid:n,remark:r,mappings:y.map(C=>({...C,to:{...C.to,ttl:C.to.ttl||0}}))},T=[...f];p===-1?T.unshift(j):T[p]=j;try{a(!0),await u.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await re(800),a(!1),F.success(s("common.saveSuccess")),o()}catch(C){a(!1),F.error(se(C))}};return e.jsx(U,{title:s("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:c,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx(Pe,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:s("common.cancel")}),e.jsxs(_,{onClick:()=>v(),color:"primary",disabled:!Qt(n,y)||!r||m,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[m&&e.jsx(M,{size:16}),s("common.save")]})]}),children:e.jsx(Jt,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(W,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:s("team.passport.issuerDid"),value:n,onChange:j=>{t(j.target.value)}}),e.jsx(W,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:s("common.remark"),value:r,onChange:j=>{i(j.target.value)}}),e.jsxs(g,{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(g,{className:"dialog-h1",children:s("team.passport.mappingRule")}),e.jsx(g,{children:e.jsx(_,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{x(j=>{const T=[...j];return T.unshift({from:{passport:""},to:{role:G.ROLES.GUEST}}),T})},children:s("team.add")})})]}),e.jsxs(g,{className:"list",mt:-.5,children:[y.map((j,T)=>e.jsxs(g,{display:"flex",alignItems:"center",justifyContent:"space-between",my:3,children:[e.jsxs(g,{display:"flex",alignItems:"center",flexGrow:1,children:[e.jsx(g,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID",value:j.from.passport,onChange:C=>{const{value:I}=C.target;x(D=>{const N=[...D];return N[T].from.passport=I,N})}})}),e.jsx(g,{flexShrink:0,mx:4,children:e.jsx(st,{})}),e.jsx(g,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small",select:!0,value:j.to.role,onChange:C=>{x(I=>{const D=[...I];return D[T].to.role=C.target.value,D})},variant:"outlined",children:l.filter(C=>C.name!=="owner").map(C=>e.jsx(ie,{value:C.name,"data-cy":`passport-mapping-select-option-${C.name}`,children:e.jsx("span",{children:C.title||C.name})},C.name))})})]}),e.jsx(g,{flexShrink:0,ml:4,children:e.jsx(q,{onClick:()=>{x(C=>{const I=[...C];return I.splice(T,1),I})},size:"large",children:e.jsx(J,{})})})]},`mapping-${T}`)),!y.length&&e.jsx(g,{my:2,color:"text.secondary",fontSize:"16px",children:e.jsx(ge,{children:s("common.empty")})})]})]})})})}Ie.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};Ie.defaultProps={data:{},trustedPassports:[]};const Jt=H.div`
|
|
86
|
+
`,Je=10,Qe=1;function et({passport:c}){const{api:o}=A(),{teamDid:d}=$(),{t:f,locale:u}=L(),[l,h]=S.useState({pageSize:Je,page:Qe}),{data:s,loading:m}=ne(async()=>{const y={teamDid:d,query:{passportId:c.id},paging:{page:l.page,pageSize:l.pageSize}},x=await o.getPassportLogs({input:y});return{logs:x.passportLogs||[],total:x.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:y=>F.error(y.message)}),a=S.useMemo(()=>(s==null?void 0:s.logs)||[],[s==null?void 0:s.logs]),n=y=>{var x,p,v,j,T,C,I,D,N;return y.action===G.PASSPORT_LOG_ACTION.APPROVE||y.action===G.PASSPORT_LOG_ACTION.REVOKE?(p=(x=y==null?void 0:y.metadata)==null?void 0:x.operator)!=null&&p.fullName?`${f("common.operator")}: ${(j=(v=y==null?void 0:y.metadata)==null?void 0:v.operator)==null?void 0:j.fullName}`:null:y.action===G.PASSPORT_LOG_ACTION.ISSUE&&((T=y.metadata)==null?void 0:T.action)===G.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?(I=(C=y==null?void 0:y.metadata)==null?void 0:C.inviter)!=null&&I.fullName?`${f("common.inviter")}: ${(N=(D=y==null?void 0:y.metadata)==null?void 0:D.inviter)==null?void 0:N.fullName}`:null:`passportId: ${y.passportId}`},t=S.useMemo(()=>[{label:f("common.action"),name:"action",options:{customBodyRender:(y,{rowIndex:x})=>{var v;const p=a[x];return e.jsx(Y,{title:n(p),children:`${y} ${(v=p.metadata)!=null&&v.action?`(${p.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:y=>e.jsx(g,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:y||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(y,{rowIndex:x})=>{const p=a[x];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.operatorUa&&e.jsx(g,{children:zt(p.operatorUa)}),p.operatorUa&&e.jsx(Y,{title:p.operatorUa,children:e.jsx(Lt,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:f("common.createdAt"),name:"createdAt",options:{customBodyRender:y=>Dt(y,u)}}],[f,u,a]),r=({page:y,rowsPerPage:x})=>{l.pageSize!==x?h(p=>({...p,pageSize:x,page:1})):l.page!==y+1&&h(p=>({...p,page:y+1}))},i={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:(s==null?void 0:s.total)||0};return m?e.jsx(g,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsx(g,{children:e.jsx(xe,{className:"logs-table",verticalKeyWidth:100,locale:u,data:a,columns:t,options:i,loading:m,onChange:r})})}et.propTypes={passport:w.object.isRequired};function tt({passport:c,onSwitchPassport:o}){const{api:d}=A(),{teamDid:f}=$(),{t:u,locale:l}=L(),[h,s]=S.useState({pageSize:Je,page:Qe}),{data:m,loading:a}=ne(async()=>{const x={teamDid:f,passportId:c.parentDid,paging:{page:h.page,pageSize:h.pageSize}},p=await d.getRelatedPassports({input:x});return{passports:p.passports||[],total:p.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:x=>F.error(x.message)}),n=S.useMemo(()=>(m==null?void 0:m.passports)||[],[m==null?void 0:m.passports]),t=S.useMemo(()=>[{label:u("team.passport.role"),name:"role",options:{customBodyRender:ve}},{label:u("team.passport.owner"),name:"user",options:{customBodyRender:Ce}},{label:u("team.passport.status"),name:"status",options:{customBodyRender:be}},{label:u("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:x=>Ve(x,l)}},{label:u("blocklet.overview.source"),name:"source",options:{customBodyRender:ie}}],[u,l]),r=({page:x,rowsPerPage:p})=>{h.pageSize!==p?s(v=>({...v,pageSize:p,page:1})):h.page!==x+1&&s(v=>({...v,page:x+1}))},i=S.useRef(null),y={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:(m==null?void 0:m.total)||0,onRowClick(x,{dataIndex:p},v){var j;if((j=i.current)!=null&&j.contains(v.target)){const T=n[p];o(T)}}};return a?e.jsx(g,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(te,{spacing:1,children:[e.jsx(Me,{severity:"warning",children:u("team.passport.relatedDescription")}),e.jsx(g,{ref:i,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(xe,{className:"related-table",verticalKeyWidth:100,locale:l,data:n.filter(x=>x.id!==c.id),columns:t,options:y,loading:a,onChange:r})})]})}tt.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function ce({onCancel:c,onSuccess:o}){const{api:d}=A(),{blocklet:f}=kt(),{t:u}=L(),[l,h]=S.useState(!1),s=(f.environments.find(r=>r.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",m=s==="auto"?St.getPassportColorFromDid(f.appDid):s,[a,n]=S.useState(m),t=async()=>{const r=[{key:Bt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:a}];try{h(!0),await d.configBlocklet({input:{did:f.meta.did,configs:r}}),o()}catch(i){F.error(i.message)}finally{h(!1)}};return e.jsx(U,{title:u("team.passport.color"),onClose:c,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:u("common.cancel")}),e.jsxs(_,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx(M,{size:16}),u("common.save")]})]}),children:e.jsxs(g,{display:"flex",justifyContent:"center",alignItems:"center",className:"dialog-content",children:[e.jsx(Mt,{disableAlpha:!0,color:a,onChange:r=>n(r.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:Ft({scope:"passport",role:"owner",title:"Owner",issuer:At.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:a})}})]})})}const Gt=V(ce,"mutate_team"),Vt=V(ce,"",X);function Kt(c){const{inService:o}=A();return o?e.jsx(Vt,{...c}):e.jsx(Gt,{...c})}ce.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};ce.defaultProps={};var J=function(c){return e.jsx("svg",{...c,children:e.jsx("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})})};J.defaultProps={width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};J.displayName="delete";var we={},Yt=mt;Object.defineProperty(we,"__esModule",{value:!0});var Pe=we.default=void 0,Zt=Yt(Tt()),Xt=e;Pe=we.default=(0,Zt.default)((0,Xt.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack");var st=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};st.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Jt=(c,o)=>c?!o.some(d=>!d.from.passport||!d.to.role):!1;function Ie({onCancel:c,onSuccess:o,data:d,trustedPassports:f}){const{api:u}=A(),{roles:l,teamDid:h}=$(),{t:s}=L(),[m,a]=S.useState(!1),[n,t]=S.useState(d.issuerDid||""),[r,i]=S.useState(d.remark||""),[y,x]=S.useState(Z(d.mappings)||[]),p=f.findIndex(j=>j.issuerDid===d.issuerDid),v=async()=>{if(m)return;const j={issuerDid:n,remark:r,mappings:y.map(C=>({...C,to:{...C.to,ttl:C.to.ttl||0}}))},T=[...f];p===-1?T.unshift(j):T[p]=j;try{a(!0),await u.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await re(800),a(!1),F.success(s("common.saveSuccess")),o()}catch(C){a(!1),F.error(se(C))}};return e.jsx(U,{title:s("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:c,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx(Pe,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:s("common.cancel")}),e.jsxs(_,{onClick:()=>v(),color:"primary",disabled:!Jt(n,y)||!r||m,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[m&&e.jsx(M,{size:16}),s("common.save")]})]}),children:e.jsx(Qt,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(W,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:s("team.passport.issuerDid"),value:n,onChange:j=>{t(j.target.value)}}),e.jsx(W,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:s("common.remark"),value:r,onChange:j=>{i(j.target.value)}}),e.jsxs(g,{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(g,{className:"dialog-h1",children:s("team.passport.mappingRule")}),e.jsx(g,{children:e.jsx(_,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{x(j=>{const T=[...j];return T.unshift({from:{passport:""},to:{role:G.ROLES.GUEST}}),T})},children:s("team.add")})})]}),e.jsxs(g,{className:"list",mt:-.5,children:[y.map((j,T)=>e.jsxs(g,{display:"flex",alignItems:"center",justifyContent:"space-between",my:3,children:[e.jsxs(g,{display:"flex",alignItems:"center",flexGrow:1,children:[e.jsx(g,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID",value:j.from.passport,onChange:C=>{const{value:I}=C.target;x(D=>{const N=[...D];return N[T].from.passport=I,N})}})}),e.jsx(g,{flexShrink:0,mx:4,children:e.jsx(st,{})}),e.jsx(g,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small",select:!0,value:j.to.role,onChange:C=>{x(I=>{const D=[...I];return D[T].to.role=C.target.value,D})},variant:"outlined",children:l.filter(C=>C.name!=="owner").map(C=>e.jsx(oe,{value:C.name,"data-cy":`passport-mapping-select-option-${C.name}`,children:e.jsx("span",{children:C.title||C.name})},C.name))})})]}),e.jsx(g,{flexShrink:0,ml:4,children:e.jsx(q,{onClick:()=>{x(C=>{const I=[...C];return I.splice(T,1),I})},size:"large",children:e.jsx(J,{})})})]},`mapping-${T}`)),!y.length&&e.jsx(g,{my:2,color:"text.secondary",fontSize:"16px",children:e.jsx(ge,{children:s("common.empty")})})]})]})})})}Ie.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};Ie.defaultProps={data:{},trustedPassports:[]};const Qt=H.div`
|
|
87
87
|
.dialog-h1 {
|
|
88
88
|
font-size: 18px;
|
|
89
89
|
}
|
|
@@ -95,7 +95,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
`;function
|
|
98
|
+
`;function de({onCancel:c,hasPermission:o}){const{api:d}=A(),{teamDid:f,trustedPassports:u}=$(),{t:l}=L(),[h,s]=S.useState(null),[m,a]=S.useState(!1),[n,t]=S.useState(!1),[r,i]=S.useState(""),y=async p=>{if(m)return;const v=u.findIndex(T=>T.issuerDid===p);v===-1&&F.error("Cannot find passports");const j=[...u];j.splice(v,1);try{a(!0),await d.configTrustedPassports({input:{teamDid:f,trustedPassports:j}}),await re(800),a(!1),F.success(l("common.saveSuccess")),s(!1)}catch(T){a(!1),F.error(T.message)}},x=u.filter(p=>!r||p.issuerDid.toLowerCase().includes(r.toLowerCase()));return e.jsxs(U,{title:l("team.passport.trustedIssuers"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(rs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedPassportIssuers")}),e.jsx(Ze,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(He,{options:{searchPlaceholder:l("team.passport.searchIssuerDid"),searchDebounceTime:600},search:r,searchText:r,searchTextUpdate:i,searchClose:()=>i(""),onSearchOpen:()=>{}}),o&&e.jsxs(_,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>t({mode:"add"}),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(p=>e.jsxs(g,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px",children:[e.jsxs(g,{flexShrink:0,children:[e.jsx(je,{copyable:!1,size:16,did:p.issuerDid,showDidLogo:!1}),!!p.remark&&e.jsx(g,{pl:3.5,fontSize:12,maxWidth:"300px",children:p.remark})]}),e.jsx(g,{color:"gray",ml:"28px",flexGrow:1,children:p.mappings&&p.mappings.length?`${p.mappings.length} ${l("team.passport.mappingRule")}`:l("team.passport.defaultRule")}),e.jsxs(g,{flexShrink:0,display:"flex",alignItems:"center",children:[e.jsx(q,{onClick:()=>t({mode:"update",data:Z(p)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(le,{})}),e.jsx(q,{"data-cy":"delete-mapping-rule",onClick:()=>s({title:l("common.delete"),description:l("common.delConfirmDescription",{data:p.issuerDid}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(p.issuerDid),onCancel:()=>{a(!1),s(null)}}),size:"large",children:e.jsx(J,{})})]})]},p.issuerDid)),!u.length&&e.jsx(ge,{children:l("common.empty")})]})]})}),n&&e.jsx(Ie,{mode:n.mode,data:n.data,trustedPassports:Z(u),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(Se,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}de.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};de.defaultProps={hasPermission:!1};const es=V(de,"mutate_team"),ts=V(de,"",X);function ss(c){const{inService:o}=A();return o?e.jsx(ts,{...c}):e.jsx(es,{...c})}const rs=H.div`
|
|
99
99
|
.list {
|
|
100
100
|
.MuiIconButton-root {
|
|
101
101
|
svg {
|
|
@@ -103,7 +103,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
`;var
|
|
106
|
+
`;var as=$t();const Ne=Ee(as);function Re({onCancel:c,onSuccess:o,data:d,trustedFactories:f}){var x,p,v;const{api:u}=A(),{roles:l,teamDid:h}=$(),{t:s}=L(),[m,a]=Wt({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:d.factoryAddress||"",remark:d.remark||"",role:((x=d.passport)==null?void 0:x.role)||"member",ttlPolicy:((p=d.passport)==null?void 0:p.ttlPolicy)||"never",ttl:Ne(+((v=d.passport)==null?void 0:v.ttl)||365*24*60*60*1e3),error:""}),n=f.findIndex(j=>j.factoryAddress===d.factoryAddress),t=async()=>{if(m.loading)return;const{factoryAddress:j,remark:T,role:C,ttlPolicy:I,ttl:D}=m,N={factoryAddress:j,remark:T,passport:{role:C,ttlPolicy:I,ttl:I==="never"?0:Ne(D)}},k=[...f];n===-1?k.unshift(N):k[n]=N;try{a({loading:!0}),await u.configTrustedFactories({input:{teamDid:h,trustedFactories:k}}),await re(800),F.success(s("common.saveSuccess")),o()}catch(B){console.error(B),F.error(se(B))}finally{a({loading:!1})}};S.useEffect(()=>{const j=m.fetched.find(C=>C.address===m.factoryAddress),T=m.errored.find(C=>C.address===m.factoryAddress);wt.isValid(m.factoryAddress)&&!m.fetching&&!j&&!T&&(a({fetching:!0}),Nt(G.MAIN_CHAIN_ENDPOINT).getFactoryState({address:m.factoryAddress}).then(I=>{I.state?a({fetching:!1,fetched:[...m.fetched.filter(D=>D.address!==m.factoryAddress),I.state],remark:I.state.name}):a({fetching:!1,errored:[...m.errored.filter(D=>D.address!==m.factoryAddress),{address:m.factoryAddress}],error:s("team.passport.factory404",m)})}).catch(I=>{console.error(I),a({fetching:!1,error:se(I)})}))},[m.factoryAddress,m.fetching]);let r=m.error;const i=m.factoryAddress?m.errored.find(j=>j.address===m.factoryAddress):null;!r&&i&&(r=s("team.passport.factory404",m));const y=m.factoryAddress?m.fetched.find(j=>j.address===m.factoryAddress):null;return!r&&y&&(r=y.description),r||(r=s("team.passport.factoryAddressTip")),e.jsx(U,{title:s("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:c,"data-cy":"close-trusted-factory",size:"large",children:e.jsx(Pe,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:s("common.cancel")}),e.jsxs(_,{onClick:()=>t(),color:"primary",disabled:!m.factoryAddress||!m.remark||!m.role||m.loading||m.error||i,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[m.loading&&e.jsx(M,{size:16}),s("common.save")]})]}),children:e.jsx(ns,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(W,{fullWidth:!0,error:!!m.error||!!i,"data-cy":"input-factory-address",label:s("team.passport.factoryAddress"),helperText:r,value:m.factoryAddress,InputProps:{endAdornment:m.fetching?e.jsx(ft,{position:"end",children:e.jsx(M,{size:16})}):null},onChange:j=>{a({factoryAddress:j.target.value,error:""})}}),e.jsx(W,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:s("common.remark"),value:m.remark,onChange:j=>{a({remark:j.target.value})}}),e.jsx(W,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:s("team.passport.role"),select:!0,value:m.role,onChange:j=>{a({role:j.target.value})},variant:"outlined",children:l.filter(j=>j.name!=="owner").map(j=>e.jsx(oe,{value:j.name,"data-cy":`passport-role-select-option-${j.name}`,children:e.jsx("span",{children:j.title||j.name})},j.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx($e,{children:s("team.passport.ttl")}),e.jsxs(Oe,{color:"primary",size:"small",value:m.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(j,T)=>a({ttlPolicy:T}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(ee,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(Y,{title:s("team.passport.ttlNeverTip"),children:e.jsx(E,{children:s("team.passport.ttlNever")})})}),e.jsx(ee,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(Y,{title:s("team.passport.ttlMintTip"),children:e.jsx(E,{children:s("team.passport.ttlMint")})})}),e.jsx(ee,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(Y,{title:s("team.passport.ttlExchangeTip"),children:e.jsx(E,{children:s("team.passport.ttlExchange")})})})]}),m.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:m.ttl,onChange:j=>{a({ttl:j.target.value})}}),e.jsx(qe,{children:s("team.passport.ttlTip")})]})]})]})})})}Re.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedFactories:w.array,data:w.object};Re.defaultProps={data:{},trustedFactories:[]};const ns=H.div`
|
|
107
107
|
.dialog-h1 {
|
|
108
108
|
font-size: 18px;
|
|
109
109
|
}
|
|
@@ -115,7 +115,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
`;function
|
|
118
|
+
`;function pe({onCancel:c,hasPermission:o}){const{api:d}=A(),{teamDid:f,trustedFactories:u}=$(),{t:l}=L(),[h,s]=S.useState(null),[m,a]=S.useState(!1),[n,t]=S.useState(null),[r,i]=S.useState(""),y=async p=>{if(!m)try{a(!0),await d.configTrustedFactories({input:{teamDid:f,trustedFactories:u.filter(v=>v.factoryAddress!==p)}}),await re(800),a(!1),F.success(l("common.saveSuccess")),s(null)}catch(v){a(!1),F.error(v.message)}},x=u.filter(p=>!r||p.factoryAddress.toLowerCase().includes(r.toLowerCase()));return e.jsxs(U,{title:l("team.passport.trustedFactories"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(cs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedFactoriesTip")}),e.jsx(Ze,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(He,{options:{searchPlaceholder:l("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:r,searchText:r,searchTextUpdate:i,searchClose:()=>i(""),onSearchOpen:()=>{}}),o&&e.jsxs(_,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>t({mode:"add"}),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(p=>e.jsxs(g,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px",children:[e.jsxs(g,{flexGrow:1,children:[e.jsx(je,{copyable:!1,did:p.factoryAddress,size:16,showDidLogo:!1}),!!p.remark&&e.jsx(g,{fontSize:12,maxWidth:"300px",children:p.remark})]}),e.jsx(g,{color:"gray",mr:"24px",children:e.jsx(Pt,{type:"success",children:p.passport.role})}),e.jsxs(g,{flexShrink:0,display:"flex",alignItems:"center",children:[e.jsx(q,{onClick:()=>t({mode:"update",data:Z(p)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(le,{})}),e.jsx(q,{"data-cy":"delete-trusted-factory",onClick:()=>s({title:l("common.delete"),description:l("common.delConfirmDescription",{data:p.factoryAddress}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(p.factoryAddress),onCancel:()=>{a(!1),s(null)}}),size:"large",children:e.jsx(J,{})})]})]},p.factoryAddress)),!u.length&&e.jsx(ge,{children:l("common.empty")})]})]})}),n&&e.jsx(Re,{data:n.data,trustedFactories:Z(u),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(Se,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}pe.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};pe.defaultProps={hasPermission:!1};const os=V(pe,"mutate_team"),is=V(pe,"",X);function ls(c){const{inService:o}=A();return o?e.jsx(is,{...c}):e.jsx(os,{...c})}const cs=H.div`
|
|
119
119
|
.list {
|
|
120
120
|
.MuiIconButton-root {
|
|
121
121
|
svg {
|
|
@@ -123,12 +123,12 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
`;var rt={exports:{}},at={exports:{}};(function(){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o={rotl:function(d,f){return d<<f|d>>>32-f},rotr:function(d,f){return d<<32-f|d>>>f},endian:function(d){if(d.constructor==Number)return o.rotl(d,8)&16711935|o.rotl(d,24)&4278255360;for(var f=0;f<d.length;f++)d[f]=o.endian(d[f]);return d},randomBytes:function(d){for(var f=[];d>0;d--)f.push(Math.floor(Math.random()*256));return f},bytesToWords:function(d){for(var f=[],u=0,l=0;u<d.length;u++,l+=8)f[l>>>5]|=d[u]<<24-l%32;return f},wordsToBytes:function(d){for(var f=[],u=0;u<d.length*32;u+=8)f.push(d[u>>>5]>>>24-u%32&255);return f},bytesToHex:function(d){for(var f=[],u=0;u<d.length;u++)f.push((d[u]>>>4).toString(16)),f.push((d[u]&15).toString(16));return f.join("")},hexToBytes:function(d){for(var f=[],u=0;u<d.length;u+=2)f.push(parseInt(d.substr(u,2),16));return f},bytesToBase64:function(d){for(var f=[],u=0;u<d.length;u+=3)for(var l=d[u]<<16|d[u+1]<<8|d[u+2],h=0;h<4;h++)u*8+h*6<=d.length*8?f.push(c.charAt(l>>>6*(3-h)&63)):f.push("=");return f.join("")},base64ToBytes:function(d){d=d.replace(/[^A-Z0-9+\/]/ig,"");for(var f=[],u=0,l=0;u<d.length;l=++u%4)l!=0&&f.push((c.indexOf(d.charAt(u-1))&Math.pow(2,-2*l+8)-1)<<l*2|c.indexOf(d.charAt(u))>>>6-l*2);return f}};at.exports=o})();var
|
|
126
|
+
`;var rt={exports:{}},at={exports:{}};(function(){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o={rotl:function(d,f){return d<<f|d>>>32-f},rotr:function(d,f){return d<<32-f|d>>>f},endian:function(d){if(d.constructor==Number)return o.rotl(d,8)&16711935|o.rotl(d,24)&4278255360;for(var f=0;f<d.length;f++)d[f]=o.endian(d[f]);return d},randomBytes:function(d){for(var f=[];d>0;d--)f.push(Math.floor(Math.random()*256));return f},bytesToWords:function(d){for(var f=[],u=0,l=0;u<d.length;u++,l+=8)f[l>>>5]|=d[u]<<24-l%32;return f},wordsToBytes:function(d){for(var f=[],u=0;u<d.length*32;u+=8)f.push(d[u>>>5]>>>24-u%32&255);return f},bytesToHex:function(d){for(var f=[],u=0;u<d.length;u++)f.push((d[u]>>>4).toString(16)),f.push((d[u]&15).toString(16));return f.join("")},hexToBytes:function(d){for(var f=[],u=0;u<d.length;u+=2)f.push(parseInt(d.substr(u,2),16));return f},bytesToBase64:function(d){for(var f=[],u=0;u<d.length;u+=3)for(var l=d[u]<<16|d[u+1]<<8|d[u+2],h=0;h<4;h++)u*8+h*6<=d.length*8?f.push(c.charAt(l>>>6*(3-h)&63)):f.push("=");return f.join("")},base64ToBytes:function(d){d=d.replace(/[^A-Z0-9+\/]/ig,"");for(var f=[],u=0,l=0;u<d.length;l=++u%4)l!=0&&f.push((c.indexOf(d.charAt(u-1))&Math.pow(2,-2*l+8)-1)<<l*2|c.indexOf(d.charAt(u))>>>6-l*2);return f}};at.exports=o})();var ds=at.exports,he={utf8:{stringToBytes:function(c){return he.bin.stringToBytes(unescape(encodeURIComponent(c)))},bytesToString:function(c){return decodeURIComponent(escape(he.bin.bytesToString(c)))}},bin:{stringToBytes:function(c){for(var o=[],d=0;d<c.length;d++)o.push(c.charCodeAt(d)&255);return o},bytesToString:function(c){for(var o=[],d=0;d<c.length;d++)o.push(String.fromCharCode(c[d]));return o.join("")}}},Le=he;/*!
|
|
127
127
|
* Determine if an object is a Buffer
|
|
128
128
|
*
|
|
129
129
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
130
130
|
* @license MIT
|
|
131
|
-
*/var ds=function(c){return c!=null&&(nt(c)||ps(c)||!!c._isBuffer)};function nt(c){return!!c.constructor&&typeof c.constructor.isBuffer=="function"&&c.constructor.isBuffer(c)}function ps(c){return typeof c.readFloatLE=="function"&&typeof c.slice=="function"&&nt(c.slice(0,0))}(function(){var c=cs,o=Le.utf8,d=ds,f=Le.bin,u=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=f.stringToBytes(l):l=o.stringToBytes(l):d(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var s=c.bytesToWords(l),m=l.length*8,a=1732584193,n=-271733879,t=-1732584194,r=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[m>>>5]|=128<<m%32,s[(m+64>>>9<<4)+14]=m;for(var y=u._ff,x=u._gg,p=u._hh,v=u._ii,i=0;i<s.length;i+=16){var j=a,T=n,C=t,I=r;a=y(a,n,t,r,s[i+0],7,-680876936),r=y(r,a,n,t,s[i+1],12,-389564586),t=y(t,r,a,n,s[i+2],17,606105819),n=y(n,t,r,a,s[i+3],22,-1044525330),a=y(a,n,t,r,s[i+4],7,-176418897),r=y(r,a,n,t,s[i+5],12,1200080426),t=y(t,r,a,n,s[i+6],17,-1473231341),n=y(n,t,r,a,s[i+7],22,-45705983),a=y(a,n,t,r,s[i+8],7,1770035416),r=y(r,a,n,t,s[i+9],12,-1958414417),t=y(t,r,a,n,s[i+10],17,-42063),n=y(n,t,r,a,s[i+11],22,-1990404162),a=y(a,n,t,r,s[i+12],7,1804603682),r=y(r,a,n,t,s[i+13],12,-40341101),t=y(t,r,a,n,s[i+14],17,-1502002290),n=y(n,t,r,a,s[i+15],22,1236535329),a=x(a,n,t,r,s[i+1],5,-165796510),r=x(r,a,n,t,s[i+6],9,-1069501632),t=x(t,r,a,n,s[i+11],14,643717713),n=x(n,t,r,a,s[i+0],20,-373897302),a=x(a,n,t,r,s[i+5],5,-701558691),r=x(r,a,n,t,s[i+10],9,38016083),t=x(t,r,a,n,s[i+15],14,-660478335),n=x(n,t,r,a,s[i+4],20,-405537848),a=x(a,n,t,r,s[i+9],5,568446438),r=x(r,a,n,t,s[i+14],9,-1019803690),t=x(t,r,a,n,s[i+3],14,-187363961),n=x(n,t,r,a,s[i+8],20,1163531501),a=x(a,n,t,r,s[i+13],5,-1444681467),r=x(r,a,n,t,s[i+2],9,-51403784),t=x(t,r,a,n,s[i+7],14,1735328473),n=x(n,t,r,a,s[i+12],20,-1926607734),a=p(a,n,t,r,s[i+5],4,-378558),r=p(r,a,n,t,s[i+8],11,-2022574463),t=p(t,r,a,n,s[i+11],16,1839030562),n=p(n,t,r,a,s[i+14],23,-35309556),a=p(a,n,t,r,s[i+1],4,-1530992060),r=p(r,a,n,t,s[i+4],11,1272893353),t=p(t,r,a,n,s[i+7],16,-155497632),n=p(n,t,r,a,s[i+10],23,-1094730640),a=p(a,n,t,r,s[i+13],4,681279174),r=p(r,a,n,t,s[i+0],11,-358537222),t=p(t,r,a,n,s[i+3],16,-722521979),n=p(n,t,r,a,s[i+6],23,76029189),a=p(a,n,t,r,s[i+9],4,-640364487),r=p(r,a,n,t,s[i+12],11,-421815835),t=p(t,r,a,n,s[i+15],16,530742520),n=p(n,t,r,a,s[i+2],23,-995338651),a=v(a,n,t,r,s[i+0],6,-198630844),r=v(r,a,n,t,s[i+7],10,1126891415),t=v(t,r,a,n,s[i+14],15,-1416354905),n=v(n,t,r,a,s[i+5],21,-57434055),a=v(a,n,t,r,s[i+12],6,1700485571),r=v(r,a,n,t,s[i+3],10,-1894986606),t=v(t,r,a,n,s[i+10],15,-1051523),n=v(n,t,r,a,s[i+1],21,-2054922799),a=v(a,n,t,r,s[i+8],6,1873313359),r=v(r,a,n,t,s[i+15],10,-30611744),t=v(t,r,a,n,s[i+6],15,-1560198380),n=v(n,t,r,a,s[i+13],21,1309151649),a=v(a,n,t,r,s[i+4],6,-145523070),r=v(r,a,n,t,s[i+11],10,-1120210379),t=v(t,r,a,n,s[i+2],15,718787259),n=v(n,t,r,a,s[i+9],21,-343485551),a=a+j>>>0,n=n+T>>>0,t=t+C>>>0,r=r+I>>>0}return c.endian([a,n,t,r])};u._ff=function(l,h,s,m,a,n,t){var r=l+(h&s|~h&m)+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._gg=function(l,h,s,m,a,n,t){var r=l+(h&m|s&~m)+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._hh=function(l,h,s,m,a,n,t){var r=l+(h^s^m)+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._ii=function(l,h,s,m,a,n,t){var r=l+(s^(h|~m))+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._blocksize=16,u._digestsize=16,rt.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var s=c.wordsToBytes(u(l,h));return h&&h.asBytes?s:h&&h.asString?f.bytesToString(s):c.bytesToHex(s)}})();var us=rt.exports;const ms=Ee(us);function me({teamDid:c,onCancel:o,onSuccess:d,onError:f,mode:u,item:l}){var D,N;const{api:h}=A(),[s,m]=S.useState(!1),[a,n]=S.useState(""),{t}=L(),[r,i]=S.useState(l.title||""),[y,x]=S.useState(l.description||""),[p,v]=S.useState(((D=l==null?void 0:l.extra)==null?void 0:D.display)||"builtin"),[j,T]=S.useState((N=l==null?void 0:l.extra)!=null&&N.types?l.extra.types.join(","):""),C=async()=>{const k=r.trim();if(!k){n(t("team.passport.error.titleEmpty"));return}if(k.length>64){n(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){n(t("team.passport.error.descriptionEmpty"));return}const K=u==="create"?ms(k):l.name;n(null),m(!0);try{if(u==="create"){const R={teamDid:c,name:K,title:k,description:B};p==="custom"&&(R.extra=JSON.stringify({display:"custom",types:j.split(",")})),await h.createRole({input:R})}else{const R={teamDid:c,role:{name:K,title:k,description:B}};await h.updateRole({input:R})}d()}catch(R){const b=se(R);n(b),f(R)}finally{m(!1)}},I=e.jsxs("div",{children:[u==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx(W,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx(W,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:r,onChange:k=>{n(null),i(k.target.value)},disabled:u==="update"||s,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx(W,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:k=>{n(null),x(k.target.value)},disabled:s,multiline:!0,rows:3})}),u==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx($e,{children:t("common.display")}),e.jsxs(Oe,{color:"primary",size:"small",value:p,exclusive:!0,style:{marginTop:16},disabled:s,onChange:(k,B)=>v(B),"data-cy":"input-role-display",children:[e.jsx(ee,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(ee,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),p==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:j,disabled:s,onChange:k=>{T(k.target.value)}}),e.jsx(qe,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(U,{title:u==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{"data-cy":"mutate-role-confirm",onClick:C,color:"primary",disabled:s,variant:"contained",autoFocus:!0,children:[s&&e.jsx(M,{size:16}),t(u==="create"?"common.create":"common.update")]})]}),children:[e.jsx(ht,{component:"div",children:I}),!!a&&e.jsx(Me,{severity:"error",variant:"icon",style:{width:"100%",margin:0},children:a})]})}me.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};me.defaultProps={onError:()=>{},mode:"create",item:{}};function fe({onCancel:c,onSuccess:o,onDelete:d,roleName:f,hasPermission:u}){const{api:l}=A(),{roles:h,permissions:s,teamDid:m,refresh:a,isNodeTeam:n}=$(),{t}=L(),[r,i]=S.useState([]),[y,x]=S.useState(!1),[p,v]=S.useState(null),[j,T]=S.useState(!1),C=Z(h.find(R=>R.name===f)),I=Ge(f),D=async R=>{if(!j)try{T(!0),await l.deleteRole({input:{teamDid:m,name:R}}),d()}catch(b){F.error(b.message)}finally{T(!1),v(null)}},N=async(R,b)=>{const z=(await l.getPermissionsByRole({input:{teamDid:R,role:{name:b}}})).permissions||[],O=s.map(ae=>({...ae,bind:z.some(lt=>lt.name===ae.name)}));i(O)},k=async()=>{T(!0);const R=r.filter(b=>b.bind).map(b=>b.name);try{await l.updatePermissionsForRole({input:{teamDid:m,roleName:C.name,grantNames:R}}),F.success(t("common.saveSuccess")),o()}catch(b){F.error(se(b))}finally{T(!1)}};S.useEffect(()=>{m&&f&&N(m,f)},[m,f]);const B=n||!u;let K=null;return n&&(K=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:r.filter(R=>B?R.bind:!0).map(R=>e.jsx("div",{className:"item",children:e.jsx(xt,{control:e.jsx(gt,{disabled:B,checked:R.bind,onChange:()=>{i(b=>b.map(P=>(P.name===R.name&&(P.bind=!P.bind),P)))},name:R.name}),label:R.description})}))})]})),e.jsxs(U,{title:t("common.passport"),onClose:c,open:!0,fullWidth:!0,toolbar:u&&!I&&e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:()=>x(C),"data-cy":`edit-passport-${C.name}`,size:"large",children:e.jsx(ce,{fill:"#bfbfbf"})}),e.jsx(q,{onClick:()=>v({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:C.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(C.name)},onCancel:()=>{T(!1),v(null)}}),"data-cy":`delete-passport-${C.name}`,size:"large",children:e.jsx(J,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:n&&!B&&e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{onClick:k,color:"primary",disabled:j||!C,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[j&&e.jsx(M,{size:16}),t("common.save")]})]}),children:[e.jsxs(gs,{children:[!C&&e.jsx(ys,{children:e.jsx(M,{})}),C&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:C.title}),e.jsx("div",{className:"description",style:{marginTop:n?16:48},children:C.description})]}),K]})]}),y&&e.jsx(me,{teamDid:m,onCancel:()=>x(null),onSuccess:()=>{x(null),a()},mode:"update",roleName:y.name,item:y}),p&&e.jsx(Se,{title:p.title,description:p.description,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}const fs=V(fe,"mutate_team"),hs=V(fe,"",Q);function xs(c){const{inService:o}=A();return o?e.jsx(hs,{...c}):e.jsx(fs,{...c})}fe.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};fe.defaultProps={hasPermission:!1};const gs=H.div`
|
|
131
|
+
*/var ps=function(c){return c!=null&&(nt(c)||us(c)||!!c._isBuffer)};function nt(c){return!!c.constructor&&typeof c.constructor.isBuffer=="function"&&c.constructor.isBuffer(c)}function us(c){return typeof c.readFloatLE=="function"&&typeof c.slice=="function"&&nt(c.slice(0,0))}(function(){var c=ds,o=Le.utf8,d=ps,f=Le.bin,u=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=f.stringToBytes(l):l=o.stringToBytes(l):d(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var s=c.bytesToWords(l),m=l.length*8,a=1732584193,n=-271733879,t=-1732584194,r=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[m>>>5]|=128<<m%32,s[(m+64>>>9<<4)+14]=m;for(var y=u._ff,x=u._gg,p=u._hh,v=u._ii,i=0;i<s.length;i+=16){var j=a,T=n,C=t,I=r;a=y(a,n,t,r,s[i+0],7,-680876936),r=y(r,a,n,t,s[i+1],12,-389564586),t=y(t,r,a,n,s[i+2],17,606105819),n=y(n,t,r,a,s[i+3],22,-1044525330),a=y(a,n,t,r,s[i+4],7,-176418897),r=y(r,a,n,t,s[i+5],12,1200080426),t=y(t,r,a,n,s[i+6],17,-1473231341),n=y(n,t,r,a,s[i+7],22,-45705983),a=y(a,n,t,r,s[i+8],7,1770035416),r=y(r,a,n,t,s[i+9],12,-1958414417),t=y(t,r,a,n,s[i+10],17,-42063),n=y(n,t,r,a,s[i+11],22,-1990404162),a=y(a,n,t,r,s[i+12],7,1804603682),r=y(r,a,n,t,s[i+13],12,-40341101),t=y(t,r,a,n,s[i+14],17,-1502002290),n=y(n,t,r,a,s[i+15],22,1236535329),a=x(a,n,t,r,s[i+1],5,-165796510),r=x(r,a,n,t,s[i+6],9,-1069501632),t=x(t,r,a,n,s[i+11],14,643717713),n=x(n,t,r,a,s[i+0],20,-373897302),a=x(a,n,t,r,s[i+5],5,-701558691),r=x(r,a,n,t,s[i+10],9,38016083),t=x(t,r,a,n,s[i+15],14,-660478335),n=x(n,t,r,a,s[i+4],20,-405537848),a=x(a,n,t,r,s[i+9],5,568446438),r=x(r,a,n,t,s[i+14],9,-1019803690),t=x(t,r,a,n,s[i+3],14,-187363961),n=x(n,t,r,a,s[i+8],20,1163531501),a=x(a,n,t,r,s[i+13],5,-1444681467),r=x(r,a,n,t,s[i+2],9,-51403784),t=x(t,r,a,n,s[i+7],14,1735328473),n=x(n,t,r,a,s[i+12],20,-1926607734),a=p(a,n,t,r,s[i+5],4,-378558),r=p(r,a,n,t,s[i+8],11,-2022574463),t=p(t,r,a,n,s[i+11],16,1839030562),n=p(n,t,r,a,s[i+14],23,-35309556),a=p(a,n,t,r,s[i+1],4,-1530992060),r=p(r,a,n,t,s[i+4],11,1272893353),t=p(t,r,a,n,s[i+7],16,-155497632),n=p(n,t,r,a,s[i+10],23,-1094730640),a=p(a,n,t,r,s[i+13],4,681279174),r=p(r,a,n,t,s[i+0],11,-358537222),t=p(t,r,a,n,s[i+3],16,-722521979),n=p(n,t,r,a,s[i+6],23,76029189),a=p(a,n,t,r,s[i+9],4,-640364487),r=p(r,a,n,t,s[i+12],11,-421815835),t=p(t,r,a,n,s[i+15],16,530742520),n=p(n,t,r,a,s[i+2],23,-995338651),a=v(a,n,t,r,s[i+0],6,-198630844),r=v(r,a,n,t,s[i+7],10,1126891415),t=v(t,r,a,n,s[i+14],15,-1416354905),n=v(n,t,r,a,s[i+5],21,-57434055),a=v(a,n,t,r,s[i+12],6,1700485571),r=v(r,a,n,t,s[i+3],10,-1894986606),t=v(t,r,a,n,s[i+10],15,-1051523),n=v(n,t,r,a,s[i+1],21,-2054922799),a=v(a,n,t,r,s[i+8],6,1873313359),r=v(r,a,n,t,s[i+15],10,-30611744),t=v(t,r,a,n,s[i+6],15,-1560198380),n=v(n,t,r,a,s[i+13],21,1309151649),a=v(a,n,t,r,s[i+4],6,-145523070),r=v(r,a,n,t,s[i+11],10,-1120210379),t=v(t,r,a,n,s[i+2],15,718787259),n=v(n,t,r,a,s[i+9],21,-343485551),a=a+j>>>0,n=n+T>>>0,t=t+C>>>0,r=r+I>>>0}return c.endian([a,n,t,r])};u._ff=function(l,h,s,m,a,n,t){var r=l+(h&s|~h&m)+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._gg=function(l,h,s,m,a,n,t){var r=l+(h&m|s&~m)+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._hh=function(l,h,s,m,a,n,t){var r=l+(h^s^m)+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._ii=function(l,h,s,m,a,n,t){var r=l+(s^(h|~m))+(a>>>0)+t;return(r<<n|r>>>32-n)+h},u._blocksize=16,u._digestsize=16,rt.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var s=c.wordsToBytes(u(l,h));return h&&h.asBytes?s:h&&h.asString?f.bytesToString(s):c.bytesToHex(s)}})();var ms=rt.exports;const fs=Ee(ms);function ue({teamDid:c,onCancel:o,onSuccess:d,onError:f,mode:u,item:l}){var D,N;const{api:h}=A(),[s,m]=S.useState(!1),[a,n]=S.useState(""),{t}=L(),[r,i]=S.useState(l.title||""),[y,x]=S.useState(l.description||""),[p,v]=S.useState(((D=l==null?void 0:l.extra)==null?void 0:D.display)||"builtin"),[j,T]=S.useState((N=l==null?void 0:l.extra)!=null&&N.types?l.extra.types.join(","):""),C=async()=>{const k=r.trim();if(!k){n(t("team.passport.error.titleEmpty"));return}if(k.length>64){n(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){n(t("team.passport.error.descriptionEmpty"));return}const K=u==="create"?fs(k):l.name;n(null),m(!0);try{if(u==="create"){const R={teamDid:c,name:K,title:k,description:B};p==="custom"&&(R.extra=JSON.stringify({display:"custom",types:j.split(",")})),await h.createRole({input:R})}else{const R={teamDid:c,role:{name:K,title:k,description:B}};await h.updateRole({input:R})}d()}catch(R){const b=se(R);n(b),f(R)}finally{m(!1)}},I=e.jsxs("div",{children:[u==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx(W,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx(W,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:r,onChange:k=>{n(null),i(k.target.value)},disabled:u==="update"||s,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx(W,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:k=>{n(null),x(k.target.value)},disabled:s,multiline:!0,rows:3})}),u==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx($e,{children:t("common.display")}),e.jsxs(Oe,{color:"primary",size:"small",value:p,exclusive:!0,style:{marginTop:16},disabled:s,onChange:(k,B)=>v(B),"data-cy":"input-role-display",children:[e.jsx(ee,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(ee,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),p==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:j,disabled:s,onChange:k=>{T(k.target.value)}}),e.jsx(qe,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(U,{title:u==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{"data-cy":"mutate-role-confirm",onClick:C,color:"primary",disabled:s,variant:"contained",autoFocus:!0,children:[s&&e.jsx(M,{size:16}),t(u==="create"?"common.create":"common.update")]})]}),children:[e.jsx(ht,{component:"div",children:I}),!!a&&e.jsx(Me,{severity:"error",variant:"icon",style:{width:"100%",margin:0},children:a})]})}ue.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};ue.defaultProps={onError:()=>{},mode:"create",item:{}};function me({onCancel:c,onSuccess:o,onDelete:d,roleName:f,hasPermission:u}){const{api:l}=A(),{roles:h,permissions:s,teamDid:m,refresh:a,isNodeTeam:n}=$(),{t}=L(),[r,i]=S.useState([]),[y,x]=S.useState(!1),[p,v]=S.useState(null),[j,T]=S.useState(!1),C=Z(h.find(R=>R.name===f)),I=Ge(f),D=async R=>{if(!j)try{T(!0),await l.deleteRole({input:{teamDid:m,name:R}}),d()}catch(b){F.error(b.message)}finally{T(!1),v(null)}},N=async(R,b)=>{const z=(await l.getPermissionsByRole({input:{teamDid:R,role:{name:b}}})).permissions||[],O=s.map(ae=>({...ae,bind:z.some(lt=>lt.name===ae.name)}));i(O)},k=async()=>{T(!0);const R=r.filter(b=>b.bind).map(b=>b.name);try{await l.updatePermissionsForRole({input:{teamDid:m,roleName:C.name,grantNames:R}}),F.success(t("common.saveSuccess")),o()}catch(b){F.error(se(b))}finally{T(!1)}};S.useEffect(()=>{m&&f&&N(m,f)},[m,f]);const B=n||!u;let K=null;return n&&(K=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:r.filter(R=>B?R.bind:!0).map(R=>e.jsx("div",{className:"item",children:e.jsx(xt,{control:e.jsx(gt,{disabled:B,checked:R.bind,onChange:()=>{i(b=>b.map(P=>(P.name===R.name&&(P.bind=!P.bind),P)))},name:R.name}),label:R.description})}))})]})),e.jsxs(U,{title:t("common.passport"),onClose:c,open:!0,fullWidth:!0,toolbar:u&&!I&&e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:()=>x(C),"data-cy":`edit-passport-${C.name}`,size:"large",children:e.jsx(le,{fill:"#bfbfbf"})}),e.jsx(q,{onClick:()=>v({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:C.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(C.name)},onCancel:()=>{T(!1),v(null)}}),"data-cy":`delete-passport-${C.name}`,size:"large",children:e.jsx(J,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:n&&!B&&e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{onClick:k,color:"primary",disabled:j||!C,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[j&&e.jsx(M,{size:16}),t("common.save")]})]}),children:[e.jsxs(ys,{children:[!C&&e.jsx(js,{children:e.jsx(M,{})}),C&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:C.title}),e.jsx("div",{className:"description",style:{marginTop:n?16:48},children:C.description})]}),K]})]}),y&&e.jsx(ue,{teamDid:m,onCancel:()=>x(null),onSuccess:()=>{x(null),a()},mode:"update",roleName:y.name,item:y}),p&&e.jsx(Se,{title:p.title,description:p.description,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}const hs=V(me,"mutate_team"),xs=V(me,"",X);function gs(c){const{inService:o}=A();return o?e.jsx(xs,{...c}):e.jsx(hs,{...c})}me.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};me.defaultProps={hasPermission:!1};const ys=H.div`
|
|
132
132
|
.header {
|
|
133
133
|
.title {
|
|
134
134
|
font-weight: 400;
|
|
@@ -171,13 +171,13 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
171
171
|
padding-right: 12px;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
`,
|
|
174
|
+
`,js=H.div`
|
|
175
175
|
flex: 1;
|
|
176
176
|
display: flex;
|
|
177
177
|
justify-content: center;
|
|
178
178
|
align-items: center;
|
|
179
179
|
height: 200px;
|
|
180
|
-
`,Be=S.memo(({field:c,value:o,copyable:d})=>{const{local:f}=L();return o?e.jsxs(g,{display:"flex",alignItems:"center",gap:1,onClick:u=>u.stopPropagation(),children:[c?e.jsxs(Fe,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[c,":"]}):null,e.jsx(Fe,{variant:"body1",children:e.jsxs(g,{display:"flex",alignItems:"center",children:[e.jsx(Y,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),d?e.jsx(It,{content
|
|
180
|
+
`,Be=S.memo(({field:c,value:o,copyable:d})=>{const{local:f}=L();return o?e.jsxs(g,{display:"flex",alignItems:"center",gap:1,onClick:u=>u.stopPropagation(),children:[c?e.jsxs(Fe,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[c,":"]}):null,e.jsx(Fe,{variant:"body1",children:e.jsxs(g,{display:"flex",alignItems:"center",children:[e.jsx(Y,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),d?e.jsx(It,{content:Ot(o),locale:f,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null});function De({createPassportSvg:c}){const{inService:o}=A(),{roles:d,teamIssuerDid:f,teamName:u,refresh:l,passportColor:h,teamDid:s,isNodeTeam:m}=$(),{t:a}=L(),[n,t]=S.useState(!1),[r,i]=S.useState(!1),y=yt(p=>p.breakpoints.down("md")),x=S.useCallback(p=>p&&!G.ROLES[p.toUpperCase()],[]);return e.jsxs(vs,{sx:{mt:0},children:[e.jsx(g,{display:"flex",justifyContent:"flex-end",children:!m&&e.jsxs(jt,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),a("team.passport.create.title")]})}),e.jsx(g,{className:"list",children:d.map(p=>e.jsxs(g,{"data-cy":`passport-${p.name}`,sx:{display:"flex",justifyContent:"space-between"},className:"item",display:"flex",alignItems:"center",onClick:()=>i(p),children:[e.jsxs(g,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:c({title:p.title,issuer:u,issuerDid:f,ownerName:"Your Name",ownerDid:f,preferredColor:h,width:"150px"})}}),e.jsxs(g,{ml:3,className:"title",children:[e.jsx(Be,{value:p.title}),x(p.name)?e.jsx(Be,{value:p.name,copyable:!0}):null]})]}),!y&&e.jsx(g,{className:"description",children:p.description}),e.jsx(Ye,{permission:o?"":"mutate_team",role:o?X:[],children:e.jsx("div",{className:"action",children:Ge(p.name)?e.jsx(qt,{}):e.jsx(le,{})})})]},p.name))}),r&&e.jsx(gs,{onCancel:()=>i(!1),onSuccess:()=>{i(!1),l()},onDelete:()=>{i(!1),l()},mode:"update",roleName:r.name,item:r}),n&&e.jsx(ue,{teamDid:s,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const vs=H(g)`
|
|
181
181
|
.list {
|
|
182
182
|
.item {
|
|
183
183
|
padding: 12px;
|
|
@@ -215,7 +215,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m
|
|
|
215
215
|
fill: ${({theme:c})=>c.palette.text.secondary};
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
`;De.propTypes={createPassportSvg:w.func.isRequired};De.defaultProps={};function ke({createPassportSvg:c}){const{t:o}=L(),{api:d,inService:f}=A(),{teamDid:u,refresh:l,enablePassportIssuance:h,isNodeTeam:s}=$(),[m,a]=S.useState(!1),[n,t]=S.useState(!1),[r,i]=S.useState(!1),[y,x]=S.useState(!1),[p,v]=S.useState(!1),j=async T=>{if(T.stopPropagation(),!y){x(!0);try{await d.configPassportIssuance({input:{teamDid:u,enable:!h}}),l(),await re(800),F.success(o("common.configSuccess"))}catch(C){F.error(C.message)}finally{x(!1)}}};return e.jsxs(g,{display:"flex",alignItems:"center",gap:1,sx:{ml:1},children:[e.jsx(Ye,{permission:f?"":"mutate_team",role:f?
|
|
218
|
+
`;De.propTypes={createPassportSvg:w.func.isRequired};De.defaultProps={};function ke({createPassportSvg:c}){const{t:o}=L(),{api:d,inService:f}=A(),{teamDid:u,refresh:l,enablePassportIssuance:h,isNodeTeam:s}=$(),[m,a]=S.useState(!1),[n,t]=S.useState(!1),[r,i]=S.useState(!1),[y,x]=S.useState(!1),[p,v]=S.useState(!1),j=async T=>{if(T.stopPropagation(),!y){x(!0);try{await d.configPassportIssuance({input:{teamDid:u,enable:!h}}),l(),await re(800),F.success(o("common.configSuccess"))}catch(C){F.error(C.message)}finally{x(!1)}}};return e.jsxs(g,{display:"flex",alignItems:"center",gap:1,sx:{ml:1},children:[e.jsx(Ye,{permission:f?"":"mutate_team",role:f?X:[],children:e.jsx(Q,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(Q.Item,{onClick:()=>t(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(g,{children:[o("team.passport.trustedPassportIssuers"),e.jsx(g,{fontSize:12,color:"#888",children:o("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(Q.Item,{onClick:()=>i(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(g,{children:[o("team.passport.configFactories"),e.jsx(g,{fontSize:12,color:"#888",children:o("team.passport.configFactoriesTip")})]})}),e.jsx(Q.Item,{"data-cy":"config-show-issue-passport",onClick:j,children:e.jsxs(g,{display:"flex",alignItems:"center",children:[y&&e.jsx(M,{size:16,style:{marginRight:8}}),e.jsxs(g,{children:[o(h?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(g,{fontSize:12,color:"#888",children:o(h?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!s&&e.jsx(Q.Item,{onClick:()=>a(!0),"data-cy":"config-passport-color",children:e.jsxs(g,{children:[o("team.passport.configColor"),e.jsx(g,{fontSize:12,color:"#888",children:o("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(_,{variant:"outlined",onClick:()=>{v(!0)},children:o("team.passport.view")})})}),n&&e.jsx(ss,{onCancel:()=>t(!1)}),r&&e.jsx(ls,{onCancel:()=>i(!1)}),m&&e.jsx(Kt,{onCancel:()=>a(!1),onSuccess:()=>a(!1)}),p&&e.jsx(U,{open:!0,maxWidth:"lg",onClose:()=>v(!1),onBackdropClick:()=>v(!1),onEscapeKeyDown:()=>v(!1),title:o("team.passport.view"),children:e.jsx(De,{createPassportSvg:c,onCancel:()=>v(!1)})})]})}ke.propTypes={createPassportSvg:w.func.isRequired};ke.defaultProps={};const ze="$all",_e="",ot=ct.memo(({createPassportSvg:c,passport:o,teamDid:d,inService:f})=>{var u,l,h,s;return e.jsx(g,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:c({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:(u=o.user)==null?void 0:u.fullName,ownerDid:(l=o.user)==null?void 0:l.did,ownerAvatarUrl:(h=o.user)!=null&&h.avatar?Ke((s=o.user)==null?void 0:s.avatar,d,f):"",revoked:o.revoked,width:"36px",extra:o!=null&&o.expirationDate?{key:"Exp",value:Ue(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}})});ot.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired,teamDid:w.string.isRequired,inService:w.bool.isRequired};function it({createPassportSvg:c}){const{api:o}=A(),{teamDid:d}=$(),{t:f,locale:u}=L(),{SYSTEM_ROLES:l}=_t(),{inService:h}=A(),[s,m]=S.useState(!1),a=`passports-${d}`,n=Rt(a),[t,r]=S.useState({role:ze,status:_e,searchText:n.searchText||"",pageSize:n.rowsPerPage||10,page:n.page?n.page+1:1}),{data:i,loading:y}=ne(async()=>(await o.getPassportRoleCounts({input:{teamDid:d}})).counts||[],{refreshDeps:[d]}),{data:x,loading:p}=ne(async()=>{const b={};t.role!==ze&&(b.role=t.role),t.status&&(b.status=t.status);const P=await o.getPassportsByRole({input:{teamDid:d,query:b,paging:{page:t.page,pageSize:t.pageSize}}});return{passports:P.passports||[],total:P.paging.total}},{refreshDeps:[t.role,t.status,t.page,t.pageSize],onError:b=>F.error(b.message)}),v=b=>{const P=i==null?void 0:i.find(z=>z.key===b);return(P==null?void 0:P.value)||0},j=S.useMemo(()=>Object.keys(l).map(b=>({name:b,title:l[b],num:v(b)})),[i,v]),T=S.useMemo(()=>[{label:f("team.passport.role"),name:"role",options:{customBodyRender:(b,{rowIndex:P})=>{const z=x==null?void 0:x.passports[P];return e.jsxs(g,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ot,{createPassportSvg:c,passport:z,teamDid:d}),e.jsx(g,{children:ve(z.title)})]})}}},{label:f("team.passport.owner"),name:"user",options:{customBodyRender:b=>Ce(b,h)}},{label:f("team.passport.status"),name:"status",options:{customBodyRender:be}},{label:f("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:b=>Ve(b,u)}},{label:f("common.address"),name:"id",options:{customBodyRender:Et}},{label:f("blocklet.overview.source"),name:"source",options:{customBodyRender:(b,{rowIndex:P})=>{const z=x==null?void 0:x.passports[P];return z.parentDid?ie("recover"):ie(z.source)}}}],[f,u,x==null?void 0:x.passports,d,c,h]),C=b=>{r(P=>({...P,role:b,page:1}))},I=({page:b,rowsPerPage:P,searchText:z})=>{t.pageSize!==P?r(O=>({...O,searchText:"",pageSize:P,page:1})):t.page!==b+1?r(O=>({...O,searchText:"",page:b+1})):t.searchText!==z&&r(O=>({...O,searchText:z,page:1}))},D=S.useRef(null),N=(x==null?void 0:x.passports)||[],k=t.searchText?N.filter(b=>{var P;return b.id.includes(t.searchText)||(((P=b==null?void 0:b.user)==null?void 0:P.fullName)||"").includes(t.searchText)}):N,B={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(b,{dataIndex:P},z){var O;if((O=D.current)!=null&&O.contains(z.target)){const ae=x==null?void 0:x.passports[P];m(ae)}},page:t.page-1,rowsPerPage:t.pageSize,count:(x==null?void 0:x.total)||0,searchDebounceTime:600},K=b=>{r(P=>({...P,status:b.target.value,page:1}))},R=e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(g,{sx:{fontSize:16,fontWeight:400},children:[f("team.passport.status"),":"]}),e.jsxs(vt,{size:"small",value:t.status,onChange:K,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(oe,{value:_e,children:f("common.all")}),Object.values(G.PASSPORT_STATUS).map(b=>e.jsx(oe,{value:b,sx:{py:1},children:f(`team.passport.statusMap.${b}`)},b))]})]});return y?e.jsx(g,{py:2,children:e.jsx(te,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(bs,{children:[e.jsxs(g,{className:"main",display:"flex",sx:{mt:0,gap:3},children:[e.jsx(g,{className:"left",children:e.jsx(g,{className:"tabs",children:j.map(b=>e.jsxs(g,{className:`tab ${t.role===b.name?"active":""}`,onClick:()=>C(b.name),children:[e.jsx("span",{className:"text",children:b.title}),e.jsx(g,{sx:{color:"text.secondary"},children:b.num})]},b.name))})}),e.jsx(g,{ref:D,className:"right",children:e.jsx(xe,{className:"main-table",verticalKeyWidth:100,locale:u,durable:a,durableKeys:["page","rowsPerPage"],data:k,columns:T,options:B,loading:p,onChange:I,customButtons:[e.jsx(ke,{createPassportSvg:c})],title:R})})]}),s&&e.jsx(Te,{createPassportSvg:c,onCancel:()=>m(null),passport:s,onSwitchPassport:m})]})}it.propTypes={createPassportSvg:w.func.isRequired};it.defaultProps={};const bs=bt(g)`
|
|
219
219
|
.main {
|
|
220
220
|
.left {
|
|
221
221
|
width: 256px;
|