@abtnode/blocklet-services 1.16.45-beta-20250614-101901-d1700f8d → 1.16.45-beta-20250620-082630-c0c76051
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/index.js +11 -5
- package/api/routes/csp-proxy.js +13 -14
- package/dist/assets/{AdapterDayjs-Cnt9tqu2.js → AdapterDayjs-T0keO70D.js} +1 -1
- package/dist/assets/{ArrowDropDown-BMwBndHf.js → ArrowDropDown-DKq28w-B.js} +1 -1
- package/dist/assets/{CheckCircle-41Yqmlux.js → CheckCircle-DYKWpCjc.js} +1 -1
- package/dist/assets/{ChevronLeft-CLsrCaxE.js → ChevronLeft-C5ZElVOZ.js} +1 -1
- package/dist/assets/{ChevronRight-BVlAyY8t.js → ChevronRight-BDtG7F9C.js} +1 -1
- package/dist/assets/{DeleteOutline-5003D11l.js → DeleteOutline-CYuYysba.js} +1 -1
- package/dist/assets/{Done-LE-14AsK.js → Done-C4iTqhTW.js} +1 -1
- package/dist/assets/{Download-BGEarAho.js → Download-CkjiFBw2.js} +1 -1
- package/dist/assets/{Edit-CrL54Zhc.js → Edit-D-oqMZ6h.js} +1 -1
- package/dist/assets/{Error-quFZHb54.js → Error-Dt1QvSlR.js} +1 -1
- package/dist/assets/{ExpandLess-DJGiqXwX.js → ExpandLess-CRv5O8qM.js} +1 -1
- package/dist/assets/{Google-woDe3URG.js → Google-DboCD85r.js} +1 -1
- package/dist/assets/{Home-C0Jy-iyL.js → Home-CROW9qUz.js} +1 -1
- package/dist/assets/{InfoOutlined-3bCMdMdL.js → InfoOutlined-B5f3YRb4.js} +1 -1
- package/dist/assets/{Launch-DrVQ-_LF.js → Launch-Cy-UlooC.js} +1 -1
- package/dist/assets/{LaunchOutlined-DCRD1Xd5.js → LaunchOutlined-Bcn_86ca.js} +1 -1
- package/dist/assets/{MoreHoriz-CCqkD-2X.js → MoreHoriz-H_VQNQ9b.js} +1 -1
- package/dist/assets/{PlayArrow-b0SwYNYM.js → PlayArrow-DZsdEeq_.js} +1 -1
- package/dist/assets/{TuneOutlined-CfZi6Ajz.js → TuneOutlined-GyTVf3HU.js} +1 -1
- package/dist/assets/{ViewList-DHazaGfw.js → ViewList-D0tVfaVX.js} +1 -1
- package/dist/assets/{access-control-CrHHfd-3.js → access-control-C9hWo6TU.js} +1 -1
- package/dist/assets/{actions-DP5QUAr6.js → actions-BgkGoToI.js} +1 -1
- package/dist/assets/add-component-core-CpBArNQj.js +768 -0
- package/dist/assets/{add-resource-BTg7Qs0I.js → add-resource-YRx2pKzx.js} +1 -1
- package/dist/assets/{addon-BKkiKK74.js → addon-DZBLWIf7.js} +1 -1
- package/dist/assets/{advanced-BaQVvy3K.js → advanced-C9eBqn30.js} +1 -1
- package/dist/assets/api-C1S8LUld.js +1 -0
- package/dist/assets/{appearance-CuPgS_bN.js → appearance-DzftIlmu.js} +1 -1
- package/dist/assets/{ar-C_PbiO-w.js → ar-DLXKKOGO.js} +1 -1
- package/dist/assets/{audit-logs-CUC_aqut.js → audit-logs-Cljb9yLV.js} +1 -1
- package/dist/assets/{authorize-DCQNYqJl.js → authorize-BS4vDs5i.js} +1 -1
- package/dist/assets/{base-chart-C2FJuVG1.js → base-chart-CoApVzod.js} +1 -1
- package/dist/assets/{base32-CRxHrKOV.js → base32-Cbt7-U8e.js} +1 -1
- package/dist/assets/{branding-DrCX9AmH.js → branding-BuuaXyqZ.js} +1 -1
- package/dist/assets/{branding-Di3by3dx.js → branding-uCV5ZREf.js} +2 -2
- package/dist/assets/{bundle-avatar-hjU0GiOA.js → bundle-avatar-CH2OoDP-.js} +1 -1
- package/dist/assets/{button-BWISngjs.js → button-ogiWKbo_.js} +1 -1
- package/dist/assets/{click-to-copy-DoEzJWuJ.js → click-to-copy-D0HginOX.js} +1 -1
- package/dist/assets/{cloneDeep-Jl_OPbSo.js → cloneDeep-CDl5kZTY.js} +1 -1
- package/dist/assets/{collapse-QPZHNi8E.js → collapse-D4xd-ptF.js} +1 -1
- package/dist/assets/{complete-EC4tK63r.js → complete-D2In_TeH.js} +1 -1
- package/dist/assets/{component-D9Dwvz3W.js → component-DN1QsNYm.js} +72 -72
- package/dist/assets/{config-BMkCrsxC.js → config-DEbtcbH9.js} +1 -1
- package/dist/assets/{config-OasAWfj3.js → config-DS_kGhWk.js} +1 -1
- package/dist/assets/{config-navigation-BRSxDGox.js → config-navigation-BB2LlxWl.js} +3 -3
- package/dist/assets/{config-space-DlI-IdsO.js → config-space-DlQnLPiY.js} +1 -1
- package/dist/assets/{confirm-C3U-iZgd.js → confirm-Bbp7EOHO.js} +1 -1
- package/dist/assets/{connect-CJtKCJvL.js → connect-CtbQgg8c.js} +1 -1
- package/dist/assets/{connect-2DXv3-VS.js → connect-hUOpYByL.js} +1 -1
- package/dist/assets/{connect-to-DJWMCDWB.js → connect-to-EzXJLWP1.js} +1 -1
- package/dist/assets/{dashboard-Dswj6QO1.js → dashboard-CpxtvWAW.js} +3 -3
- package/dist/assets/{de-m_nuB8Qa.js → de-CnbmrteH.js} +1 -1
- package/dist/assets/{delete-confirm-BPN0b1Ew.js → delete-confirm-BdthpUzC.js} +1 -1
- package/dist/assets/{did-address-BW7HQteV.js → did-address-DFiM35OM.js} +1 -1
- package/dist/assets/{domain-i1NE8m1K.js → domain-C7iO-bfS.js} +1 -1
- package/dist/assets/{domain-action-card-DK0_bx6-.js → domain-action-card-CqcqlPAn.js} +1 -1
- package/dist/assets/domains-z_Wu9ucc.js +1 -0
- package/dist/assets/{dot-iw3hN9HL.js → dot-4jhL56kz.js} +1 -1
- package/dist/assets/{email-DLukryRf.js → email-CH6lvIGE.js} +1 -1
- package/dist/assets/{es-BrT673RG.js → es-C7oXJBWv.js} +1 -1
- package/dist/assets/{exchange-passport-CtBW8-z_.js → exchange-passport-F8-Xn3rX.js} +1 -1
- package/dist/assets/{fr-BmbyLkZB.js → fr-DzleTcLj.js} +1 -1
- package/dist/assets/{fuel-TZdSL_3D.js → fuel-BRI4NZNF.js} +1 -1
- package/dist/assets/{gen-access-key-CqRouazq.js → gen-access-key-CjcE_UoL.js} +1 -1
- package/dist/assets/{get-safe-url-CROWoUui.js → get-safe-url-BS4IIyYC.js} +1 -1
- package/dist/assets/{get-safe-url-DPUvqYEg.js → get-safe-url-CuT70yLx.js} +1 -1
- package/dist/assets/{hi-CL8_a9An.js → hi-B24wH0bs.js} +1 -1
- package/dist/assets/{home-hnxCx6H0.js → home-B7IeN8M_.js} +1 -1
- package/dist/assets/{id-DkcL27A7.js → id-BIjW1vW9.js} +1 -1
- package/dist/assets/{iframe-BB2MTAjn.js → iframe-DYXqfKJj.js} +1 -1
- package/dist/assets/{index-CnSfgOR1.js → index-0KJGv8YB.js} +1 -1
- package/dist/assets/{index-B6fg0S6c.js → index-BAtw7eB6.js} +1 -1
- package/dist/assets/{index-vo14BOSK.js → index-BEyvIdTp.js} +1 -1
- package/dist/assets/{index-gRIImn2q.js → index-BMCGWiyM.js} +43 -43
- package/dist/assets/{index-C5pIrCeP.js → index-BW2DapLf.js} +3 -3
- package/dist/assets/{index-BCtTVvHw.js → index-BxJZWVOT.js} +1 -1
- package/dist/assets/{index-CcRZdZB8.js → index-ClFIRXfV.js} +1 -1
- package/dist/assets/{index-CIN38Uuw.js → index-CqrC0g0e.js} +1 -1
- package/dist/assets/{index-ClKx_csi.js → index-D6ye_M7F.js} +1 -1
- package/dist/assets/{index-BVBJxqPd.js → index-D7U3pqVe.js} +3 -3
- package/dist/assets/{index-zlAFuATT.js → index-DDI23z2P.js} +1 -1
- package/dist/assets/{index-OIQ3e2Ld.js → index-DECQi8Vb.js} +1 -1
- package/dist/assets/{index-CsA1GkvG.js → index-DeekZg9t.js} +1 -1
- package/dist/assets/{index-C_MX-sJs.js → index-DhXQuL-K.js} +1 -1
- package/dist/assets/{index-BXRM3Fxt.js → index-Dj3HMPh8.js} +1 -1
- package/dist/assets/{index-BdgSI0pZ.js → index-Dl0q_c7r.js} +1 -1
- package/dist/assets/{index-S_bysQ3H.js → index-DyCrJT9-.js} +1 -1
- package/dist/assets/{index-C-reBQ41.js → index-WjR0qttM.js} +1 -1
- package/dist/assets/index-ZdwmM3LS.js +284 -0
- package/dist/assets/{index-BAbxWghb.js → index-mitJwLHE.js} +4 -4
- package/dist/assets/{index-CKY4HT0P.js → index-w4f-mlFt.js} +1 -1
- package/dist/assets/{invitation-BvT07MYl.js → invitation-D7jOoJzU.js} +1 -1
- package/dist/assets/{invite-rbOwUpQz.js → invite-BiE9G1lr.js} +1 -1
- package/dist/assets/{issue-passport-DqDO2lOV.js → issue-passport-BxmBoE32.js} +1 -1
- package/dist/assets/{item-Kx7a4SrL.js → item-BuWWRgL8.js} +1 -1
- package/dist/assets/{ja-BVJLb0qY.js → ja-mu0bc5Fx.js} +1 -1
- package/dist/assets/{ko-Dd2Xcc8p.js → ko-CSWdQF8q.js} +1 -1
- package/dist/assets/{layout-veO5MoKq.js → layout-Balq-c2F.js} +1 -1
- package/dist/assets/{list-CzMORzTV.js → list-C4l_W2F_.js} +8 -8
- package/dist/assets/{list-fB7PuMGP.js → list-DBhbLnjZ.js} +2 -2
- package/dist/assets/localization-crkTHEvo.js +1 -0
- package/dist/assets/{log-DFvq1Ya8.js → log-CcBqhBEJ.js} +1 -1
- package/dist/assets/{logger-Ch0sfkGE.js → logger-tBhN561y.js} +1 -1
- package/dist/assets/{login-Cc4U4UbE.js → login-BF1AdZ-L.js} +1 -1
- package/dist/assets/{login-oauth-callback-BH3tsO_b.js → login-oauth-callback-Cv5MlgIc.js} +1 -1
- package/dist/assets/{logo-uploader-BfnTtNB4.js → logo-uploader-C1N-bsM2.js} +3 -3
- package/dist/assets/{lost-passport-CEk2gBj4.js → lost-passport-C2Km75Ka.js} +1 -1
- package/dist/assets/{omit-BlzmxIB5.js → omit-Cao4GLS7.js} +1 -1
- package/dist/assets/{open-window-DNB3B3k8.js → open-window-uY95lBbB.js} +1 -1
- package/dist/assets/{overview-DqaHfHTX.js → overview-BgK_P3ko.js} +1 -1
- package/dist/assets/{page-header-DmVEhivC.js → page-header-CiTTXRdM.js} +1 -1
- package/dist/assets/{passport-item-Dw5vAzG8.js → passport-item-fJ88Wv4t.js} +1 -1
- package/dist/assets/{permission-CmSuLv3N.js → permission-CQWJVo4a.js} +1 -1
- package/dist/assets/{preferences-DoIPeyXx.js → preferences-Uz2t9auQ.js} +1 -1
- package/dist/assets/{profile-embed-BzGFlRQR.js → profile-embed-C7ypVv2q.js} +1 -1
- package/dist/assets/{pt-BfbUt_Nx.js → pt-Odg8daEV.js} +1 -1
- package/dist/assets/publish-resource-DLqFuWGv.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-B9_jlyiB.js → react-beautiful-dnd.esm-DMJVQVbv.js} +1 -1
- package/dist/assets/{ru-uXrAFAz0.js → ru-OkiNIvy3.js} +1 -1
- package/dist/assets/{runtime-D90jDC3r.js → runtime-XL6C0WHV.js} +1 -1
- package/dist/assets/{sanitize-B18rcrOf.js → sanitize-e0A8A-yt.js} +1 -1
- package/dist/assets/sdk-D3QR4FNa.js +1 -0
- package/dist/assets/{security-D8kq04bN.js → security-C5-rO801.js} +1 -1
- package/dist/assets/{session-igceijP1.js → session-BDyIB4uh.js} +1 -1
- package/dist/assets/{setup-n8Ikg3vS.js → setup-Dpq6lpy4.js} +4 -4
- package/dist/assets/{spaces-DVZd70Fi.js → spaces-BR4I2U0t.js} +1 -1
- package/dist/assets/{start-YvnbU7Eo.js → start-BTmB0MgK.js} +1 -1
- package/dist/assets/{starting-progress-BOsNmsFB.js → starting-progress-BsYL_5xB.js} +1 -1
- package/dist/assets/{status-BGmXEfM-.js → status-D8GKQyA3.js} +1 -1
- package/dist/assets/{step-actions-_L8XSfG4.js → step-actions-njetG0Iy.js} +1 -1
- package/dist/assets/{studio-BImlv1KI.js → studio-DSEHQtAw.js} +1 -1
- package/dist/assets/{switch-control-CGm8CkkK.js → switch-control-BCB3_Ctk.js} +1 -1
- package/dist/assets/{table-tips-C8uXQ5tF.js → table-tips-Cjv8HIcF.js} +1 -1
- package/dist/assets/{th-BnT_StPj.js → th-esLoaeiE.js} +1 -1
- package/dist/assets/{traffic-NFBtntJ-.js → traffic-DAzuj4ZR.js} +1 -1
- package/dist/assets/{transfer-CJjNcsEy.js → transfer-NRpeYO3B.js} +1 -1
- package/dist/assets/{unsubscribe-Co6pOu2N.js → unsubscribe-CBvTeTZf.js} +1 -1
- package/dist/assets/{use-blocklet-logo-BUV6ER3X.js → use-blocklet-logo-DwwmdicD.js} +1 -1
- package/dist/assets/{useAsync-DVHp96Uu.js → useAsync-C62uE2pS.js} +1 -1
- package/dist/assets/{useLocalStorage-Cw7tZL-P.js → useLocalStorage-iQ2AmaOA.js} +1 -1
- package/dist/assets/{user-center-CHyAfsyF.js → user-center-CCOO4S3Y.js} +3 -3
- package/dist/assets/{util-BfQiNudG.js → util-BK7oThoq.js} +1 -1
- package/dist/assets/{util-BKry4J3y.js → util-paKPrRHx.js} +1 -1
- package/dist/assets/{vendor-arcblock-Cspz6Fmz.js → vendor-arcblock-f1tICt1E.js} +59 -59
- package/dist/assets/{vendor-hooks-BFlOfe0M.js → vendor-hooks-DqdmWCmo.js} +1 -1
- package/dist/assets/{vendor-utils-BotmZdBm.js → vendor-utils-BfZ4tlod.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-ETVwYaIV.js → vendor-ux-did-connect-BbCim3WZ.js} +3 -3
- package/dist/assets/{vi-DmitUjjk.js → vi-BF6u6-98.js} +1 -1
- package/dist/assets/wrap-locale-BLcZ6jMd.js +1 -0
- package/dist/assets/{zh-syG1cNt6.js → zh-DJTjvgj8.js} +1 -1
- package/dist/assets/{zh-tw-DnHJQaoN.js → zh-tw-B7cFexwg.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/service-worker.js +1 -1
- package/package.json +31 -31
- package/dist/assets/add-component-core-8M0C-Kp3.js +0 -768
- package/dist/assets/api-87p2GGd0.js +0 -1
- package/dist/assets/domains-CDhyGAuz.js +0 -1
- package/dist/assets/index-D3Sj3zCK.js +0 -284
- package/dist/assets/localization-CWcvfX_h.js +0 -1
- package/dist/assets/publish-resource-Dbw9ICt4.js +0 -1
- package/dist/assets/sdk-DDQwgEwY.js +0 -1
- package/dist/assets/wrap-locale-ugI1o5oc.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
import{r as h}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e as $,ap as le,aa as f,ah as L,T as S,v as W,X as ce,bK as Me,ad as tt,bL as rt,au as nt,ai as st,a9 as Pe,m as it,bX as ot,y as at,s as lt,I as ct}from"./vendor-mui-core-Bq8gXTan.js";import{b as z,u as ie,m as dt}from"./vendor-hooks-DqdmWCmo.js";import{a as te,$ as ut,i as pt,aR as ht,k as de,D as U,a1 as ue,bb as pe,bf as ft,r as Ne,I as Ae,br as mt,bs as gt,bt as xt,bu as yt}from"./vendor-ux-did-connect-BbCim3WZ.js";import{S as vt}from"./index-DEZojGsm.js";import{B as bt}from"./bundle-avatar-CH2OoDP-.js";import{a as jt,g as he,b as fe,c as B,s as X,H as wt,u as ze,M as Le,d as Q,e as kt,m as Rt,i as Tt}from"./use-blocklet-logo-DwwmdicD.js";import{A as O,ah as It,z as De,b as D,a1 as Ct}from"./vendor-utils-BfZ4tlod.js";import{u as Y,p as St,h as J,f as Ee,l as $t}from"./vendor-arcblock-f1tICt1E.js";import{d as Mt}from"./InfoOutlined-B5f3YRb4.js";import{d as Pt}from"./CheckCircle-DYKWpCjc.js";import{p as Nt}from"./util-paKPrRHx.js";import{D as At}from"./index-BMCGWiyM.js";function me({blocklet:e,style:t,size:s,...n}){const a=jt({blocklet:e,square:!0}),{variant:c}=n;return r.jsx(ee,{variant:c||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},t),...n,children:r.jsx("img",{src:a,alt:"",style:{width:s}})})}me.propTypes={blocklet:o.object.isRequired,style:o.object,size:o.oneOfType([o.number,o.string])};me.defaultProps={style:{},size:40};function zt(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function re({value:e,shouldUpdate:t=!1,...s}){const{locale:n}=te(),[a,c]=h.useState(0);if(h.useEffect(()=>{let l;if(t){const u=new Date(e).getTime(),y=Date.now(),m=Math.abs(Math.floor((u-y)/1e3)),v=()=>{c(b=>{const w=Math.random()*1e3;return parseFloat((b+w).toFixed(4))})};m<60?l=setInterval(v,1e3):m<60*60?l=setInterval(v,6e4):l=setInterval(v,36e5)}return()=>{clearInterval(l)}},[e,a,t]),!e)return"-";const i=zt(e);return r.jsx(ut,{value:i,locale:n,...s})}re.propTypes={value:o.any,shouldUpdate:o.bool};re.defaultProps={value:"",shouldUpdate:!1};const Lt=e=>{let t="rgba(0, 0, 0, 0.12)";return e==="warning"?t="#DE9E37":e==="error"?t="#F16E6E":t="rgba(0, 0, 0, 0.12)",t},Dt=e=>e.every(t=>t.type==="text"),Et=e=>e.every(t=>t.type==="image"),_t=e=>It(e,2).map(t=>({type:"combined",items:t})).filter(t=>(t.items||[]).every(s=>{var n,a,c;return(c=(a=(n=s==null?void 0:s.data)==null?void 0:n.text)==null?void 0:a.trim)==null?void 0:c.call(a)})),Ht=e=>{if(!e.length||e.length<=1)return!1;const t=e[0].type;return e.every(s=>s.type===t)},qt=(e,t)=>{try{const s=pt.toTypeInfo(e);if(!(s.role!==void 0&&s.role!==ht.types.RoleType.ACCOUNT))return;const a=O(de.WELLKNOWN_SERVICE_PATH_PREFIX,"user");return De(a,{did:e,locale:t})}catch(s){console.error(s);return}},Wt=(e,t)=>{var n;const s=(n=t==null?void 0:t.componentMountPoints)==null?void 0:n.find(a=>a.did===e);return s==null?void 0:s.mountPoint},Bt=(e,t)=>{var a,c,i;if(!e)return null;if(((a=e.actions)==null?void 0:a.length)===1)return e.actions[0].link||null;const s=he(e.activity),n=(s==null?void 0:s.metaLink)||(s==null?void 0:s.targetLink);if(n)return fe(n)?n:O(t,n);if(((c=e.attachments)==null?void 0:c.length)===1){const l=e.attachments[0];if(l.type==="link")return((i=l.data)==null?void 0:i.url)||null}return null},oe=e=>{const{receivers:t=[]}=e;return t.length?t.every(s=>s.read):!0};function Ut(e){const t=e.getBoundingClientRect(),s=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,a=t.height,c=t.width;let i=0;t.top>=0&&t.bottom<=n?i=a:t.top<0&&t.bottom>0&&t.bottom<=n?i=t.bottom:t.top>=0&&t.top<n&&t.bottom>n?i=n-t.top:t.top<0&&t.bottom>n&&(i=n);let l=0;return t.left>=0&&t.right<=s?l=c:t.left<0&&t.right>0&&t.right<=s?l=t.right:t.left>=0&&t.left<s&&t.right>s?l=s-t.left:t.left<0&&t.right>s&&(l=s),i*l/(a*c)>=.5}const Ot=e=>{if(!e)return[];const t=[],s=5,n=Array.from(e.querySelectorAll(".notification-row")),a=n.length;for(let c=0;c<a;c+=s){const i=n.slice(c,c+s);let l=!0;for(const u of i){const y=u.id;if(Ut(u))t.push(y);else{l=!1;break}}if(!l)break}return t},_e=e=>{var s;const t=[];return e&&((s=e.items)!=null&&s.length?e.items.forEach(n=>{oe(n)||t.push(n)}):oe(e)||t.push(e)),t},Ft=(e,t)=>{let s=[];return t.length&&t.forEach(n=>{const a=e.get(n);a&&(s=s.concat(_e(a)))}),s},E=(e,t)=>({...e,...t?{filter:"invert(1)"}:{}}),F=e=>{if(!e)return null;try{return new URL(e).protocol!=="https:"?(console.warn("Image URL must use HTTPS protocol:",e),null):`${de.WELLKNOWN_SERVICE_PATH_PREFIX}/proxy?url=${e}`}catch(t){return console.warn("Invalid image URL format:",e,t),null}};function He({attachment:e}){const{data:t}=e,s=$();let n="";try{n=new URL(t.url).host}catch{n=t.url}return r.jsxs(le,{target:"_blank",rel:"noopener noreferrer",href:t.url,className:"link",style:{wordBreak:"break-all"},onClick:a=>{a.customPreventRedirect=!0},children:[!!n&&r.jsx("span",{className:"url",children:n}),!!t.title&&r.jsx(f,{className:"title",style:{whiteSpace:"unset"},children:t.title}),!!t.description&&r.jsx(f,{className:"description",style:{whiteSpace:"unset",color:s.palette.text.secondary},children:t.description}),!!t.image&&r.jsx(U,{src:Y.getImagePath(t.image),alt:t.title||"",height:128,style:{borderRadius:"8px",maxWidth:"256px",objectFit:"cover"},fallback:F(Y.getImagePath(t.image))})]})}He.propTypes={attachment:o.object.isRequired};function qe({attachment:e}){const{data:t}=e;return r.jsx(U,{src:Y.getImagePath(t.url),alt:t.title||"",height:128,style:{borderRadius:"8px",maxWidth:"256px",objectFit:"cover"},fallback:F(Y.getImagePath(t.url))})}qe.propTypes={attachment:o.object.isRequired};function We({attachment:e,...t}){var l;const{data:s}=e,n=((l=s.color)==null?void 0:l.toLowerCase())||t.color,a=s.size||t.size,c=s.fontWeight||t.fontWeight||400;let i="14px";return a==="small"?i="12px":a==="normal"?i="14px":a==="big"?i="16px":a==="large"&&(i="18px"),r.jsx(Vt,{className:"title",style:{fontSize:i,color:n,whiteSpace:"unset",fontWeight:c},children:s.text})}We.propTypes={attachment:o.object.isRequired};const Vt=L.span`
|
|
2
2
|
width: 100%;
|
|
3
3
|
display: -webkit-box;
|
|
4
4
|
-webkit-box-orient: vertical;
|
|
@@ -7,7 +7,7 @@ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e a
|
|
|
7
7
|
text-overflow: ellipsis;
|
|
8
8
|
white-space: normal;
|
|
9
9
|
word-break: break-word;
|
|
10
|
-
`;ge.propTypes={locale:o.string,data:o.object.isRequired};ge.defaultProps={locale:"en"};function ge({locale:e="en",data:t}){const s={zh:"来自",en:"from"}[e]||"from",n={zh:"接收",en:"Received"}[e]||"Received",c=`https://${B.getUrlHost(t.chainHost)||B.getChainHost(t.chainId)}/explorer/tokens/${t.address}/tx`,i=$(),l=i.palette.mode==="dark";let u=t.amount;t.decimal&&(u=t.amount/10**t.decimal);const y=z(()=>({display:"flex",alignItems:"center",rowGap:2,columnGap:4,justifyContent:"space-between",flexWrap:"wrap"}));return r.jsx("a",{href:c,target:"_blank",rel:"noreferrer",onClick:m=>{m.customPreventRedirect=!0},children:r.jsxs(
|
|
10
|
+
`;ge.propTypes={locale:o.string,data:o.object.isRequired};ge.defaultProps={locale:"en"};function ge({locale:e="en",data:t}){const s={zh:"来自",en:"from"}[e]||"from",n={zh:"接收",en:"Received"}[e]||"Received",c=`https://${B.getUrlHost(t.chainHost)||B.getChainHost(t.chainId)}/explorer/tokens/${t.address}/tx`,i=$(),l=i.palette.mode==="dark";let u=t.amount;t.decimal&&(u=t.amount/10**t.decimal);const y=z(()=>({display:"flex",alignItems:"center",rowGap:2,columnGap:4,justifyContent:"space-between",flexWrap:"wrap"}));return r.jsx("a",{href:c,target:"_blank",rel:"noreferrer",onClick:m=>{m.customPreventRedirect=!0},children:r.jsxs(f,{display:"flex",flexDirection:"column",children:[r.jsxs(f,{sx:y,children:[r.jsx(S,{component:"div",sx:{fontWeight:700,color:i.palette.text.primary},children:n}),r.jsxs(S,{component:"div",align:"right",style:E(X.summaryStyle,l),flex:1,children:["+",u," ",t.symbol]})]}),r.jsxs(f,{sx:y,children:[r.jsx(S,{component:"div",style:E({...X.remarkStyle,fontSize:14},l),children:s}),r.jsx(f,{maxWidth:260,fontSize:14,children:r.jsx(ue,{did:t.address,showQrcode:!0,copyable:!0,compact:!0,responsive:!0,locale:e})})]})]})})}xe.propTypes={locale:o.string,data:o.object.isRequired};xe.defaultProps={locale:"en"};function xe({locale:e,data:t}){var m,v;const s={zh:"接收",en:"Received"}[e]||"Received",n={zh:"来自",en:"from"}[e]||"from",a=B.getUrlHost(t.chainHost)||B.getChainHost(t.chainId),c=t.did||((v=(m=t==null?void 0:t.credential)==null?void 0:m.issuer)==null?void 0:v.id)||"",i=`https://${a}/explorer/assets/${c}`,u=$().palette.mode==="dark",y=z(()=>({display:"flex",alignItems:"center",rowGap:2,columnGap:4,justifyContent:"space-between",flexWrap:"wrap"}));return r.jsx(f,{sx:{pr:1},children:r.jsx("a",{href:i,target:"_blank",style:{textDecoration:"none",color:"initial",display:"block"},onClick:b=>{b.customPreventRedirect=!0},rel:"noreferrer",children:r.jsxs(f,{display:"flex",flexDirection:"column",children:[r.jsxs(f,{sx:y,children:[r.jsx(S,{component:"div",sx:{fontWeight:700,color:"text.primary"},children:s}),r.jsx(S,{component:"div",align:"right",style:E(X.summaryStyle,u),children:"+1 Asset"})]}),c?r.jsxs(f,{sx:y,children:[r.jsx(S,{component:"div",style:E({...X.remarkStyle,fontSize:14},u),children:n}),r.jsx(f,{maxWidth:260,fontSize:14,children:r.jsx(ue,{did:c,showQrcode:!0,copyable:!0,compact:!0,responsive:!0,locale:e})})]}):null]})})})}Be.propTypes={data:o.object.isRequired,locale:o.string};function Be({data:e,locale:t="en"}){const n=$().palette.mode==="dark";return r.jsxs("a",{href:e.url,target:"_blank",style:{display:"flex",textDecoration:"none",color:"initial"},onClick:a=>{a.customPreventRedirect=!0},rel:"noreferrer",children:[r.jsx(U,{className:"image",src:e.logo,width:50,height:50,alt:"",fallback:F(e.logo)}),r.jsxs("div",{style:{flex:1,marginLeft:"10px"},children:[r.jsx("div",{style:E({marginBottom:"6px"},n),children:e.title}),r.jsx(f,{maxWidth:260,fontSize:10,children:r.jsx(ue,{did:e.appDID,showQrcode:!0,copyable:!0,compact:!0,responsive:!0,locale:t})})]})]})}ye.propTypes={locale:o.string,data:o.object.isRequired};ye.defaultProps={locale:"en"};function ye({locale:e,data:t}){const s=B.getChainHost(t.chainId),n=`https://${s}/explorer/txs/${t.hash}`,a={zh:"交易详情",en:"Transaction Details"}[e]||"Transaction Details",c={zh:"交易哈希",en:"Transaction Hash"}[e]||"Transaction Hash",i=$(),l=i.palette.mode==="dark";return r.jsxs("a",{href:n,target:"_blank",style:E({textDecoration:"none",color:"initial",display:"block",fontSize:14},l),onClick:u=>{u.customPreventRedirect=!0},rel:"noreferrer",children:[r.jsx("h6",{style:{color:i.palette.text.secondary,margin:0},children:s}),r.jsx("p",{style:{color:i.palette.warning.main,margin:0},children:a}),r.jsxs("div",{style:{wordBreak:"break-all"},children:[c,": ",t.hash]})]})}function Ue({attachment:e,...t}){const{local:s}=h.useContext(pe),n=W(c=>c.breakpoints.down("md")),a=$();return r.jsxs(Gt,{...t,isMd:n,children:[e.type==="link"&&r.jsx(He,{attachment:e,...t,isMd:n}),e.type==="image"&&r.jsx(qe,{attachment:e,isMd:n}),e.type==="text"&&r.jsx(We,{attachment:e,isMd:n}),e.type==="token"&&r.jsx(ge,{data:e.data,local:s,isMd:n}),e.type==="asset"||e.type==="vc"?r.jsx(xe,{data:e.data,local:s,isMd:n}):null,e.type==="dapp"&&r.jsx(Be,{data:e.data,local:s,isMd:n}),e.type==="transaction"&&r.jsx(ye,{data:e.data,local:s,...t,isMd:n}),e.type==="divider"&&r.jsx(ce,{sx:{mb:1,mt:1},style:{color:a.palette.divider}})]})}const Gt=L.div`
|
|
11
11
|
display: ${({sx:e={}})=>e.display||"flex"};
|
|
12
12
|
flex-direction: ${({sx:e={}})=>e.flexDirection||"column"};
|
|
13
13
|
gap: ${({sx:e={}})=>e.gap||1};
|
|
@@ -15,7 +15,7 @@ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e a
|
|
|
15
15
|
&:last-child {
|
|
16
16
|
margin-bottom: 0;
|
|
17
17
|
}
|
|
18
|
-
`;Ue.propTypes={attachment:o.object.isRequired};function Oe({data:e,...t}){const{items:s}=e;return r.jsx(Kt,{...t,children:s.map(n=>r.jsxs(Me,{variant:"outlined",sx:{p:2,borderRadius:"8px",minWidth:128},children:[r.jsxs(
|
|
18
|
+
`;Ue.propTypes={attachment:o.object.isRequired};function Oe({data:e,...t}){const{items:s}=e;return r.jsx(Kt,{...t,children:s.map(n=>r.jsxs(Me,{variant:"outlined",sx:{p:2,borderRadius:"8px",minWidth:128},children:[r.jsxs(f,{display:"flex",alignItems:"center",gap:1,children:[n.icon?r.jsx(U,{src:n.icon,alt:n.title,style:{width:16,height:16},fallback:F(n.icon)}):null,r.jsxs(f,{className:"metric-name",display:"flex",alignItems:"center",children:[n.title,n.subtitle?r.jsx(tt,{title:n.subtitle,arrow:!0,placement:"top",children:r.jsx(Mt,{fontSize:"small",sx:{fontSize:14,ml:.5}})}):null]})]}),r.jsxs(f,{className:"metric-number",sx:{color:n.content_color||"rgba(3, 7, 18, 1)"},children:[n.content,n.sub_content?r.jsxs("span",{className:"sub-content",style:{color:n.sub_content_color||"rgba(156, 163, 175, 1)"},children:["(",n.sub_content,")"]}):null]})]},n.title))})}const Kt=L(f)`
|
|
19
19
|
display: flex;
|
|
20
20
|
justify-content: flex-start;
|
|
21
21
|
flex-wrap: wrap;
|
|
@@ -54,7 +54,7 @@ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e a
|
|
|
54
54
|
.value-col {
|
|
55
55
|
flex: 1;
|
|
56
56
|
}
|
|
57
|
-
`;function be({notification:e,severity:t,showSke:s=!0}){const{attachments:n,data:a,...c}=e,i=W(m=>m.breakpoints.down("md"));if((!n||!n.length)&&D(a))return null;const l=Lt(t),u=(m,
|
|
57
|
+
`;function be({notification:e,severity:t,showSke:s=!0}){const{attachments:n,data:a,...c}=e,i=W(m=>m.breakpoints.down("md"));if((!n||!n.length)&&D(a))return null;const l=Lt(t),u=(m,v=!1)=>{if(!m&&!Array.isArray(m))return null;let b=m,w={},T="horizontal";v&&Dt(m)&&(b=_t(m),T="vertical",w={display:"flex",gap:8,flexDirection:"row",justifyContent:"flex-start",flexWrap:"wrap",height:"100%",width:i||b.length===1?"100%":"28%"});const k=Ht(b);return r.jsx(f,{sx:{width:"100%",display:"flex",gap:1,flexDirection:v?"row":"column",justifyContent:"flex-start",alignItems:v?"center":"unset",flexWrap:"wrap"},children:b.map((d,p)=>d.type==="section"?r.jsx(Ve,{data:d.fields},p):r.jsxs(h.Fragment,{children:[r.jsx(Ue,{attachment:d,style:w,...c}),!(i&&T==="vertical")&&k&&b.length>1&&p!==b.length-1?r.jsx(ce,{orientation:T,style:{color:ft.dividerColor},sx:T==="vertical"?{ml:2,mr:2,height:32}:{}}):null]},p))})},y=Et(n);return r.jsx(Qt,{children:r.jsxs("div",{className:"message-in-list",children:[n.length>0&&r.jsx("div",{className:"message-container",style:i?{width:"100%"}:{},children:y?u(n):r.jsx(Me,{variant:"outlined",sx:{p:i?1:2,borderRadius:"8px",minWidth:128,borderColor:l},children:u(n)})}),!D(a)&&r.jsx("div",{className:"message-container",children:r.jsx("div",{className:"data-container",children:r.jsx(ve,{data:a,feedType:e.feedType})})}),n.length===0&&D(a)&&s&&r.jsx(st,{className:"attach-ske",style:{marginTop:10},variant:"rectangular",height:150})]})})}const Qt=L.div`
|
|
58
58
|
display: flex;
|
|
59
59
|
flex-direction: column;
|
|
60
60
|
.message-in-list {
|
|
@@ -106,7 +106,7 @@ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e a
|
|
|
106
106
|
margin-right: 8px;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
`;be.propTypes={severity:o.string.isRequired,notification:o.object.isRequired,showSke:o.bool};be.defaultProps={showSke:!0};const
|
|
109
|
+
`;be.propTypes={severity:o.string.isRequired,notification:o.object.isRequired,showSke:o.bool};be.defaultProps={showSke:!0};const se=e=>St.sanitize(e,{ALLOWED_ATTR:["href","target","rel","class","id","style"]}),Yt=async(e,t)=>{const{type:s,did:n}=e;return Ee.isSameAddr(s,"did")?await qt(n,t)||J.getLink(e):J.getLink(e)};function Jt(e){return new TextEncoder().encode(e).length>=1e4}const Zt=async(e,t,s=!0)=>{let n=e;Jt(e)&&(n=e.slice(0,1e4));const a=J.toTextList(n);return await Promise.all(a.map(async i=>{if(i instanceof J.Link){if(s){const l=await Yt(i,t),{type:u,chainId:y,did:m}=i;return Ee.isSameAddr(u,"dapp")?`<em style="font-weight:bold;" data-type="${u}" data-chain-id="${y}" data-did="${m}">${i.text}</em>`:l?`<a target="_blank" rel="noopener noreferrer" style="color:#4598fa;font-weight:bold;" href="${l}">${i.text}</a>`:`<em style="font-weight:bold;" data-type="${u}" data-chain-id="${y}" data-did="${m}">${i.text}</em>`}return i.text}return i})).then(i=>i.join(""))};Ge.propTypes={notification:o.object,rows:o.number,minimal:o.bool};function Ge({notification:e,rows:t=2,minimal:s=!1}){const[n,a]=h.useState(!1),[c,i]=h.useState(""),{t:l,locale:u}=te(),{palette:y}=$(),m=h.useMemo(()=>{const{attachments:p}=e||{};if(!p)return!1;try{return p.length>0}catch{return!1}},[e]),v=h.useMemo(()=>{const{blocks:p}=e||{};if(!p)return!1;try{return p.length>0}catch{return!1}},[e]),b=h.useMemo(()=>{const{description:p}=e||{};return!!p},[e]),w=h.useMemo(()=>{const{data:p}=e||{};return!D(p)},[e]),T=h.useMemo(()=>m||v||b||w,[m,v,b,w]);if(h.useEffect(()=>{Zt((e==null?void 0:e.description)??"",u).then(p=>{i(p)})},[e==null?void 0:e.description,u]),!T)return null;const k=()=>t===0?"":n?`<span class='toggle-btn' data-name='toggle-expanded'>${l("common.collapse")}</span>`:`...<span class='toggle-btn' data-name='toggle-expanded'>${l("common.expand")}</span>`,d=p=>{const{target:x}=p;x.getAttribute("data-name")==="toggle-expanded"&&(a(!n),p.customPreventRedirect=!0)};return r.jsxs(er,{color:s?y.primary.contrastText:"",children:[r.jsx(f,{className:"text-container",component:"div",onClick:d,children:c&&(!n&&t>0?r.jsx(wt,{basedOn:"letters",unsafeHTML:se(c),maxLine:t,ellipsisHTML:se(k())}):r.jsx(S,{component:"div",className:`content ${t===0?"ellipsis":""}`,style:{whiteSpace:"pre-line!important"},dangerouslySetInnerHTML:{__html:se(`${c}${k()}`)}}))}),!s&&(m||w)?r.jsx(be,{severity:e.severity,notification:e}):null]})}const er=L(f)`
|
|
110
110
|
width: 100%;
|
|
111
111
|
color: ${e=>e.color?e.color:e.theme.palette.text.secondary};
|
|
112
112
|
.text-container {
|
|
@@ -131,7 +131,7 @@ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e a
|
|
|
131
131
|
line-height: 1.25;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
`,tr=
|
|
134
|
+
`,tr=h.memo(Ge);var je={},rr=Pe;Object.defineProperty(je,"__esModule",{value:!0});var Ke=je.default=void 0,nr=rr(Ne()),sr=r;Ke=je.default=(0,nr.default)((0,sr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z"}),"Cancel");var we={},ir=Pe;Object.defineProperty(we,"__esModule",{value:!0});var Xe=we.default=void 0,or=ir(Ne()),ar=r;Xe=we.default=(0,or.default)((0,ar.jsx)("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}),"Warning");const lr={error:Ke,warning:Xe,info:$t,success:Pt};ke.propTypes={severity:o.oneOf(["error","warning","info","success"]).isRequired,size:o.number};ke.defaultProps={size:32};function ke({severity:e="info",size:t=32}){const s=$(),a=z(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],c=lr[e],i=it(a,.1);return r.jsx(ee,{sx:{width:t,height:t,bgcolor:i,color:a},children:r.jsx(c,{fontSize:"small"})})}const cr={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},dr={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},ur={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},pr={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},hr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Se={comment:{icon:cr,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:dr,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:ur,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:pr,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:hr,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};Re.propTypes={activity:o.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:o.number};Re.defaultProps={size:32};function Re({activity:e,size:t=32}){const s=Se[e]||Se.comment,n=s.icon;return r.jsx(ee,{sx:{bgcolor:s.bgColor,color:s.color,width:t,height:t},children:s.renderType==="emoji"?r.jsx("span",{style:{fontSize:"14px"},children:n}):r.jsx(Ae,{icon:n})})}const ae={avatar:o.string,fullName:o.string,did:o.string};function Z({actor:e,size:t,teamDid:s,inService:n,showName:a}){const c=z(()=>({...e,avatar:e!=null&&e.avatar?Nt(e.avatar,s,n):null}),[e,s,n]),i=l=>{e&&(l.stopPropagation(),window.open(De(O(de.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),l.customPreventRedirect=!0)};return r.jsxs(f,{display:"flex",alignItems:"center",gap:1,onClick:i,role:"button",style:{cursor:"pointer"},title:(e==null?void 0:e.fullName)||"",children:[c.avatar?r.jsx(mt,{user:c,showDid:!0,cardType:gt.AvatarOnly,infoType:xt.Minimal,avatarSize:t,shape:"circle",sx:{width:t,height:t,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):r.jsx(ee,{sx:{width:t,height:t}}),a&&r.jsx("span",{children:e==null?void 0:e.fullName})]})}Z.propTypes={actor:o.shape(ae).isRequired,size:o.number.isRequired,teamDid:o.string,inService:o.bool,showName:o.bool};Z.defaultProps={teamDid:"",inService:!1,showName:!1};ne.propTypes={actors:o.oneOfType([o.shape(ae),o.arrayOf(o.shape(ae))]).isRequired,size:o.number,maxDisplay:o.number,teamDid:o.string,inService:o.bool,showName:o.bool,avatarFallback:o.node};ne.defaultProps={size:32,maxDisplay:9,teamDid:"",inService:!0,showName:!1,avatarFallback:null};function ne({actors:e,size:t=32,maxDisplay:s=9,teamDid:n="",inService:a=!0,showName:c=!1,avatarFallback:i=null}){const l=z(()=>{const u=Array.isArray(e)?e:[e];return Ct(u,"did").filter(Boolean)},[e]);return l.length===1||!l.length?r.jsx(Z,{actor:l[0],size:t,teamDid:n,inService:a,showName:c}):r.jsx(ot,{total:l.length,renderSurplus:u=>u<100?r.jsxs("span",{children:["+",u]}):r.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${t}px`,".MuiAvatar-root":{width:`${t}px`,height:`${t}px`,fontSize:`${t/2.5}px`,border:0,zIndex:2}},children:l.map((u,y)=>u!=null&&u.avatar?r.jsx(Z,{actor:u,size:t,teamDid:n,inService:a},(u==null?void 0:u.did)||y):i)})}const $e=3;Je.propTypes={notification:o.object.isRequired,isMultiple:o.bool,blocklet:o.object,mountPoint:o.string,avatarFallback:o.node};Qe.propTypes={notification:o.object.isRequired,mountPoint:o.string};Ye.propTypes={items:o.array.isRequired,activity:o.object.isRequired,blocklet:o.object,mountPoint:o.string,viewMoreLink:o.string,avatarFallback:o.node};function Qe({notification:e,mountPoint:t=""}){var i;const{activity:s}=e,{type:n,meta:a={}}=s||{},c=ze({activity:s,users:[e==null?void 0:e.actorInfo],actors:[(i=e==null?void 0:e.activity)==null?void 0:i.actor],mountPoint:t});return D(s)||!s.type||!s.actor||D(s.target)?null:r.jsxs(f,{children:[r.jsx(S,{variant:"body1",color:"text.secondary",sx:{mb:.5},children:c}),a?r.jsx(Le,{meta:a,type:n}):null]})}function Ye({items:e,activity:t,blocklet:s,mountPoint:n="",viewMoreLink:a="",avatarFallback:c=null}){const i=$(),{t:l}=te(),u=z(()=>{var d;return(s==null?void 0:s.did)||((d=s==null?void 0:s.meta)==null?void 0:d.did)||""},[s]),{locale:y}=h.useContext(pe),m=z(()=>!D(t.meta)&&Object.values(t.meta).some(d=>d!=null),[t]),v=ze({activity:t,users:e.map(d=>d==null?void 0:d.actorInfo),actors:e.map(d=>{var p;return(p=d==null?void 0:d.activity)==null?void 0:p.actor}),mountPoint:n}),b=ie(d=>{if(!d.activity)return null;const p=he(d.activity);return p!=null&&p.metaLink?fe(p==null?void 0:p.metaLink)?p==null?void 0:p.metaLink:O(n,p.metaLink):null}),w=ie((d,p)=>{if(!p)return;const x=b(p);x&&(window.open(x,"_blank"),d.customPreventRedirect=!0)}),T=e.length>$e,k=e.slice(0,$e);return r.jsxs(f,{sx:{width:"100%"},children:[r.jsx(S,{variant:"body1",color:"text.secondary",sx:{mb:3},children:v}),m?r.jsxs(f,{className:"sub-content",display:"flex",flexDirection:"column",gap:3,children:[k.map(d=>{var p;return r.jsxs(f,{display:"flex",flexDirection:"column",gap:1,onClick:x=>w(x,d),children:[r.jsxs(f,{display:"flex",alignItems:"center",gap:1,children:[Q(d)?r.jsx(ne,{actors:d.actorInfo,size:32,teamDid:u}):c,r.jsx(S,{variant:"subtitle1",color:"text.primary",children:Q(d)?(p=d==null?void 0:d.actorInfo)==null?void 0:p.fullName:"System"})," ","·",r.jsx(re,{value:d.createdAt,locale:y,shouldUpdate:!0,style:{color:i.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),d.activity.meta?r.jsx(f,{pl:5,children:r.jsx(Le,{meta:d.activity.meta,type:d.activity.type})}):null]},d.id)}),T&&a?r.jsx(f,{mt:1,display:"flex",justifyContent:"center",children:r.jsxs(at,{size:"large",variant:"text",component:le,href:a,target:"_blank",rel:"noopener noreferrer",onClick:d=>{d.customPreventRedirect=!0},children:[l("notification.viewMore")," ",r.jsx(Ae,{icon:kt,style:{marginLeft:4}})]})}):null]}):null]})}function Je({notification:e,isMultiple:t=!1,blocklet:s,mountPoint:n="",avatarFallback:a}){const c=z(()=>{if(!e.activity)return null;const i=he(e.activity);return i!=null&&i.targetLink?fe(i==null?void 0:i.targetLink)?i==null?void 0:i.targetLink:O(n,i.targetLink):null},[e.activity,n]);return t?r.jsx(Ye,{items:e.items,activity:e.activity,blocklet:s,mountPoint:n,viewMoreLink:c,avatarFallback:a}):r.jsx(Qe,{notification:e,mountPoint:n})}function Ze({notification:e}){const t=h.useMemo(()=>{const{actions:s,action:n}=e;let a=s??[];return!a.length&&n&&(a=[{name:"Visit",link:n}]),a},[e]);return t.length?r.jsx(f,{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1,mt:1.5,children:t.map((s,n)=>r.jsxs(h.Fragment,{children:[r.jsx(le,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:a=>{a.customPreventRedirect=!0},children:s.name},s.link),n<t.length-1?r.jsx(ce,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}Ze.propTypes={notification:o.object.isRequired};const fr=lt(f)`
|
|
135
135
|
display: flex;
|
|
136
136
|
justify-content: center;
|
|
137
137
|
align-items: center;
|
|
@@ -142,7 +142,7 @@ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e a
|
|
|
142
142
|
.empty-icon {
|
|
143
143
|
margin: 10px 0;
|
|
144
144
|
}
|
|
145
|
-
`;function Te({color:e,children:t,...s}){const n=At(),c=$().palette.mode==="dark";return r.jsxs(fr,{...s,children:[r.jsx("img",{src:`${n.imgPrefix}/${c?"all-done-dark":"all-done-light"}.svg`,alt:"All Done",width:120,height:120,style:{maxHeight:"100%",maxWidth:"100%"},onError:i=>{i.target.style.display="none"}}),r.jsx(
|
|
145
|
+
`;function Te({color:e,children:t,...s}){const n=At(),c=$().palette.mode==="dark";return r.jsxs(fr,{...s,children:[r.jsx("img",{src:`${n.imgPrefix}/${c?"all-done-dark":"all-done-light"}.svg`,alt:"All Done",width:120,height:120,style:{maxHeight:"100%",maxWidth:"100%"},onError:i=>{i.target.style.display="none"}}),r.jsx(f,{className:"empty-content",children:t})]})}Te.propTypes={color:o.string,children:o.any};Te.defaultProps={color:"inherit",children:null};mr.propTypes={data:o.array,blockletMap:o.object,onReadBatch:o.func,inDialog:o.bool,highlightId:o.string,highlight:o.bool,type:o.oneOf(["server","service"])};et.propTypes={notification:o.object,blocklet:o.object,onReadBatch:o.func,inDialog:o.bool,highlight:o.bool};K.propTypes={blocklet:o.object,size:o.number,showName:o.bool,hideDot:o.bool};function K({blocklet:e,size:t=40,showName:s=!1,hideDot:n=!1}){var i,l;const a=(e==null?void 0:e.did)||((i=e==null?void 0:e.meta)==null?void 0:i.did)||"",c=((e==null?void 0:e.alsoKnownAs)||[]).concat((e==null?void 0:e.appId)||(e==null?void 0:e.appDid)||(e==null?void 0:e.appPid)||"");return r.jsxs(f,{className:"component-avatar",display:"flex",alignItems:"center",sx:{gap:n?"8px":"4px"},children:[!n&&r.jsx("span",{className:"dot"}),e?r.jsx(f,{children:c.includes(a)?r.jsx(me,{blocklet:e,size:t,style:{borderRadius:8}}):r.jsx(bt,{blocklet:e,ancestors:e.ancestors??[],size:t,style:{borderRadius:8}})}):r.jsx(vt,{width:t,height:t}),s&&r.jsx("span",{className:"component-name",children:(l=e==null?void 0:e.meta)==null?void 0:l.title})]})}function et({notification:e,blocklet:t,onReadBatch:s=()=>{},inDialog:n=!1,highlight:a}){const{locale:c}=h.useContext(pe),i=$(),l=W(x=>x.breakpoints.down("md")),u=h.useRef(null),y=h.useMemo(()=>oe(e),[e]),m=h.useMemo(()=>Tt(e),[e]),v=h.useMemo(()=>Q(e),[e]),b=h.useMemo(()=>e.items||[],[e]),w=h.useMemo(()=>b.length>0,[b]),T=h.useMemo(()=>m?w?b.map(x=>{var P;return Q(x)?x.actorInfo:{did:(P=x.activity)==null?void 0:P.actor}}).filter(Boolean):e.actorInfo??[]:[],[b,e.actorInfo,w,m]),k=h.useMemo(()=>{var x;return(t==null?void 0:t.did)||((x=t==null?void 0:t.meta)==null?void 0:x.did)||""},[t]),d=h.useMemo(()=>Wt(k,window.blocklet),[k]),p=ie((x,P)=>{const _=_e(x);if(_.length&&s(_.map(R=>R.id)),P&&!P.customPreventRedirect){const R=Bt(x,d);R&&typeof R=="string"&&window.open(R,"_blank","noopener,noreferrer")}});return r.jsxs(gr,{ref:u,className:"notification-row",id:e.id,isRead:y,inDialog:n,highlight:a,isMd:l,onClick:x=>p(e,x),children:[m?r.jsx(Re,{activity:e.activity.type,size:l?24:32}):r.jsx(ke,{severity:e.severity,size:l?24:32}),r.jsxs(f,{className:"notification",display:"flex",flexDirection:"column",alignItems:"start",children:[r.jsxs(f,{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,className:"header",mb:1.5,children:[m&&v?r.jsx(ne,{actors:T,teamDid:k,size:l?24:32,avatarFallback:r.jsx(K,{blocklet:t,hideDot:!0,size:l?24:32})}):r.jsx(K,{blocklet:t,hideDot:!0,size:l?24:32}),r.jsx(re,{value:e.createdAt,locale:c,shouldUpdate:!0,style:{color:i.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),m?r.jsx(Je,{notification:e,isMultiple:w,blocklet:t,mountPoint:d,avatarFallback:r.jsx(K,{blocklet:t,hideDot:!0,size:l?24:32})}):r.jsxs(r.Fragment,{children:[r.jsx(S,{variant:"body1",className:"title",color:"rgba(24, 24, 27, 1)",style:{marginTop:0},sx:{mb:.5},children:e.title}),r.jsx(tr,{notification:e,rows:n?0:2})]}),r.jsx(Ze,{notification:e})]}),(e==null?void 0:e.description)&&e.severity==="error"&&r.jsx(f,{className:"copy-button",children:r.jsx(ct,{size:"small",children:r.jsx(yt,{sx:{fontSize:22},content:(e==null?void 0:e.description)||""})})})]})}function mr({data:e,blockletMap:t,onReadBatch:s=()=>{},inDialog:n=!1,highlightId:a,highlight:c=!1,type:i="service"}){const{t:l}=te(),u=h.useRef(null),[y,m]=h.useState(!1),[v,b]=h.useState(!0),[w,T]=h.useState(!1),k=h.useRef(new Set),d=h.useRef(new Set),p=h.useRef(null),x=h.useRef(null),P=h.useRef(!1),_=h.useMemo(()=>n?e==null?void 0:e.slice(0,5):e,[n,e]),R=h.useMemo(()=>Rt(_),[_]),H=h.useMemo(()=>{const g=new Map;return R&&R.length&&R.forEach(j=>{g.set(j.id,j)}),g},[R]);h.useEffect(()=>{const g=()=>{b(document.visibilityState==="visible")};return document.addEventListener("visibilitychange",g),()=>{document.removeEventListener("visibilitychange",g)}},[]);const V=h.useCallback(()=>{if(!n&&k.current.size>0){const g=[];k.current.forEach(j=>{if(d.current.has(j))return;const I=H.get(j);if(I){const{receivers:N=[],items:A=[]}=I;if(N.length&&!N[0].read&&(g.push(j),d.current.add(j),A.length>0&&A.forEach(C=>{const M=C.id;M&&!d.current.has(M)&&(g.push(M),d.current.add(M))}),x.current)){const C=document.getElementById(j);C&&x.current.unobserve(C)}}}),g.length>0&&(s(g),setTimeout(()=>{m(!1)},300)),k.current.clear()}},[n,H,s]),q=h.useCallback(()=>{if(n||!u.current||!v)return;x.current&&x.current.disconnect();const g={root:null,rootMargin:"0px",threshold:.5},j=new IntersectionObserver(N=>{y&&N.forEach(A=>{const C=A.target.id;if(d.current.has(C))return;const M=H.get(C);if(M){const{receivers:Ie=[]}=M;Ie.length&&!Ie[0].read&&(A.isIntersecting?(k.current.add(C),w||V()):k.current.delete(C))}})},g);x.current=j,Array.from(u.current.querySelectorAll(".notification-row")).filter(N=>{const A=N.id;if(d.current.has(A))return!1;const C=H.get(A);if(C){const{receivers:M=[]}=C;return M.length&&!M[0].read}return!1}).forEach(N=>{j.observe(N)}),P.current=!1},[y,n,w,v,H,V]);return h.useEffect(()=>{n||(P.current=!0,x.current&&v&&y&&setTimeout(()=>{q()},0))},[_,y,v,q,n]),h.useEffect(()=>{if(n||!u.current||!v)return;let g=window;if(i==="server"&&(g=document.getElementById("arc__dashboard-main")),!g){const I=document.getElementsByClassName("dashboard-main")[0];I&&(g=I)}if(!g)return;const j=I=>{I.isTrusted&&(y||m(!0),T(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{T(!1),V(),P.current&&q()},300))};return g.addEventListener("scroll",j,{passive:!0}),()=>{g.removeEventListener("scroll",j),p.current&&clearTimeout(p.current)}},[n,y,v,V,q,i]),h.useEffect(()=>(n||q(),()=>{x.current&&x.current.disconnect()}),[q,n]),dt(()=>{setTimeout(()=>{const g=Ot(u.current),j=Ft(H,g);s(j.map(I=>I.id))},2e3)}),R!=null&&R.length?r.jsx(f,{ref:u,display:"flex",flexDirection:"column",sx:{...n?{maxHeight:"calc(-200px + 100vh)",overflow:"auto"}:{}},children:R==null?void 0:R.map(g=>{var I;const j=g.source==="system"?t.get(g.entityId||g.sender):t.get(g.componentDid||g.sender);return((I=g==null?void 0:g.type)==null?void 0:I.toLowerCase())==="passthrough"?null:r.jsx(et,{highlight:c&&a===g.id,inDialog:n,notification:g,blocklet:j,onReadBatch:s},g.id)})}):r.jsx(Te,{children:l("notification.allDone")})}const gr=L("div")`
|
|
146
146
|
@keyframes flash-bg {
|
|
147
147
|
0% {
|
|
148
148
|
background-color: ${e=>e.theme.palette.warning.light};
|
|
@@ -233,4 +233,4 @@ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e a
|
|
|
233
233
|
text-decoration: none;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
`;export{
|
|
236
|
+
`;export{ne as A,me as B,mr as N,re as R,K as S,Je as a,tr as b,oe as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as b,b as Ue}from"./vendor-react-DEoibe3W.js";import{a as F,d as K,k as W,a3 as H,_ as ye,a2 as ne,$ as V,br as ve,bs as Ce,bt as Te,bd as we,ac as Se,a5 as Ie}from"./vendor-ux-did-connect-ETVwYaIV.js";import{H as o,j as e,D as X,aj as G,I as Q,t as J,al as L,T as R,aa as p,O as w,bq as v,bK as Re,bQ as oe,bs as se,bR as ae,X as Y,ak as ce,z as de,y as z,ab as Z,ad as Ee}from"./vendor-mui-core-Bq8gXTan.js";import{v as ue}from"./vendor-arcblock-Cspz6Fmz.js";import{d as Ae}from"./Edit-CrL54Zhc.js";import{_ as ke}from"./dot-iw3hN9HL.js";import{l as pe}from"./index-OIQ3e2Ld.js";import{D as $,aC as he,aD as S,G as Pe}from"./index-gRIImn2q.js";import{u as B}from"./dashboard-Dswj6QO1.js";import{o as Ne,c as We,A as re}from"./vendor-utils-BotmZdBm.js";import{T as qe}from"./index-C-reBQ41.js";import{E as Oe}from"./empty-spinner-BHwHZpq-.js";import{C as y}from"./click-to-copy-DoEzJWuJ.js";import{D as Le}from"./delete-confirm-BPN0b1Ew.js";import{b as _e}from"./passport-item-Dw5vAzG8.js";import{A as De}from"./actions-DP5QUAr6.js";import{T as le}from"./table-tips-C8uXQ5tF.js";import{u as ze}from"./use-mobile-DwzRjjku.js";import"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-DVHp96Uu.js";import"./useLocalStorage-Cw7tZL-P.js";import"./index-8eXqqyHQ.js";import"./confirm-C3U-iZgd.js";import"./PlayArrow-b0SwYNYM.js";import"./get-safe-url-DPUvqYEg.js";import"./session-igceijP1.js";import"./use-blocklet-logo-BUV6ER3X.js";import"./InfoOutlined-3bCMdMdL.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-Cnt9tqu2.js";import"./did-address-BW7HQteV.js";import"./util-BKry4J3y.js";import"./base32-CRxHrKOV.js";import"./MoreHoriz-CCqkD-2X.js";const Fe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:u}){const[i,m]=b.useState(!1),{t:n,locale:s}=F(),{api:g}=$(),{teamDid:h}=B(),{control:f,handleSubmit:k,formState:{errors:a},watch:I,setValue:x}=he({defaultValues:Fe,mode:"onChange"}),T=I("scope"),E=c=>{c!=="profile:read"&&x("scope",T.includes(c)?T.filter(d=>d!==c):[...T,c])},q=async c=>{m(!0);try{const d={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(P=>P.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ne(d,We)}}),r(d)}catch(d){H.error(d.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(X,{open:!0,onClose:u,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[n("oauth.client.register")," ",e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:4,sx:{mt:2},children:[e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:n("oauth.client.validate.clientName"),minLength:{value:3,message:n("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(d=a.clientName)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:n("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(d=a.clientUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:n("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(d=a.redirectUris)==null?void 0:d.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:n("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:n("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:n("oauth.client.helperText.document")}),e.jsx(v,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Re,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(R,{variant:"subtitle2",gutterBottom:!0,children:n("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([c,d])=>e.jsx(se,{control:e.jsx(ae,{checked:T.includes(c),onChange:()=>E(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:d})})},c))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(L,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:n("oauth.client.validate.contacts")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(d=a.contacts)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(d=a.tosUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(d=a.policyUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:u,children:n("common.cancel")}),e.jsxs(z,{onClick:k(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function M({scope:r,...u}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(L,{direction:"row",flexWrap:"wrap",gap:1,...u,children:i.map(m=>e.jsx(Ue.Fragment,{children:e.jsx(Ee,{title:W.OAUTH_SCOPES[m],children:e.jsx(y,{children:m})})},m))})}M.propTypes={scope:o.string};M.defaultProps={scope:""};const ee=r=>{const{prefix:u}=$(),{blocklet:i}=Pe(),m=re(u,"/api/media/upload",i.appPid),n=b.useCallback(g=>g?g.startsWith("http")?g:`${re(u,"/api/media/upload",i.appPid)}/${g}`:"",[u,i.appPid]);return{clientLogoUrl:b.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},$e=b.lazy(()=>ye(()=>import("./index-C5pIrCeP.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function xe({client:r,onUpdate:u,onClose:i}){const[m,n]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=$(),{teamDid:k}=B(),{control:a,handleSubmit:I,formState:{errors:x},watch:T,setValue:E,getValues:q}=he({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),c=T("scope"),d=T("logoUri"),{clientLogoUrl:P,apiPath:O}=ee(d),A=l=>{l!=="profile:read"&&E("scope",c.includes(l)?c.filter(t=>t!==l):[...c,l])},_=async l=>{const t={clientId:r.clientId,clientName:l.clientName.trim(),clientUri:l.clientUri,redirectUris:l.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:l.contacts?l.contacts.split(",").map(C=>C.trim()):[],scope:l.scope.join(" "),tosUri:l.tosUri,policyUri:l.policyUri,logoUri:l.logoUri,clientSecretExpiresAt:l.clientSecretExpiresAt?parseInt(l.clientSecretExpiresAt/1e3,10):null};await f.updateOAuthClient({input:{teamDid:k,input:t}})},D=async l=>{n(!0);try{await _(l),u(),i()}catch(t){H.error(t.message||s("oauth.client.updateFailed"))}finally{n(!1)}};return e.jsxs(X,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(Q,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(p,{children:[e.jsx(p,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:P?e.jsx(p,{children:e.jsx("img",{src:P,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var l;(l=h.current)==null||l.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(P?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Oe,{}),children:e.jsx($e,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{E("logoUri",l.data.filename),_(q()).then(()=>{u()}).catch(t=>{H.error(t.message||s("oauth.client.updateFailed"))}).finally(()=>{var t;(t=h.current)==null||t.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:O,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:a,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(t=x.clientName)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:a,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(t=x.clientUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:a,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(t=x.redirectUris)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(qe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:t=>{l.onChange(t)}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(R,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([l,t])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>A(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:t})})},l))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(p,{children:e.jsx(S,{name:"contacts",control:a,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(t=x.contacts)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(t=x.tosUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(t=x.policyUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:i,children:s("common.cancel")}),e.jsx(z,{onClick:I(D),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(Z,{size:16}):s("common.update")})]})]})}xe.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function je({client:r,onUpdate:u,onClose:i}){return e.jsx(xe,{client:r,onUpdate:m=>u(m),onClose:i})}je.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function te(r){const{t:u}=F(),{api:i}=$(),{teamDid:m}=B(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},k=async()=>{try{await i.deleteOAuthClient({input:{teamDid:m,clientId:n}}),g()}catch(I){H.error(I==null?void 0:I.message)}finally{f()}},a={keyName:s,title:u("oauth.client.delete.title"),description:u("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:u("oauth.client.delete.description",{name:s}),confirm:u("common.delConfirm"),cancel:u("common.cancel"),onConfirm:k,onCancel:f};return e.jsx(Le,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})}te.propTypes={clientId:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:u}){return e.jsxs(p,{mb:3,children:[e.jsx(R,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(L,{spacing:1.5,children:u.map(({label:i,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(R,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(R,{sx:{wordBreak:"break-all"},children:m||"-"})]},i))})]})}ge.propTypes={title:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:u}){const{t:i,locale:m}=F(),{teamDid:n}=B(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:k,clientUri:a,logoUri:I,contacts:x,tosUri:T,policyUri:E,jwksUri:q,jwks:c,softwareId:d,softwareVersion:P,clientIdIssuedAt:O,clientSecretExpiresAt:A,updatedAt:_,createUser:D}=r,{clientLogoUrl:l}=ee(I),t=j=>{try{const N=new URL(window.blocklet.appUrl);return N.pathname=j,N.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:l,did:C.address,size:64})},{label:i("oauth.client.clientUri"),value:a?e.jsx(y,{children:a}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(y,{children:g})},{label:i("oauth.client.clientSecret"),value:e.jsx(y,{children:h})},{label:i("oauth.client.redirectUris"),value:e.jsx(y,{children:(f||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:k})},{label:i("oauth.client.createUser"),value:D?_e(D,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(y,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:x.length?e.jsx(y,{children:(x||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(y,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:E?e.jsx(y,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:c},{label:i("oauth.client.softwareId"),value:d},{label:i("oauth.client.softwareVersion"),value:P}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:O?e.jsx(V,{value:O*1e3,type:"all",locale:m}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:m}):"-"},{label:i("common.updatedAt"),value:_?e.jsx(V,{value:_,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(X,{open:!0,onClose:u,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsx(p,{mt:1,children:U.map((j,N)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),N!==U.length-1&&e.jsx(Y,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.func.isRequired};function Be(r){return e.jsx(V,{value:r*1e3})}function ie({selected:r,onClose:u}){return r?e.jsx(fe,{client:r,onClose:u}):null}ie.propTypes={selected:o.object,onClose:o.func.isRequired};ie.defaultProps={selected:null};function be({open:r,onCreated:u,onClose:i}){return r?e.jsx(me,{onCreated:u,onClose:i}):null}be.propTypes={open:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function It(){var l;const[r,u]=b.useState({searchText:"",pageSize:10,page:1}),[i,m]=b.useState(null),[n,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:k}=$(),{teamDid:a}=B(),[I,x]=b.useState(null),[T,E]=b.useState(null),q=ze(),{getClientLogoUrl:c}=ee(),d=ke(async()=>await k.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:P}=d,O=b.useMemo(()=>{var t;return((t=d.value)==null?void 0:t.list)||[]},[(l=d.value)==null?void 0:l.list]),A=b.useMemo(()=>r.searchText?O.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):O,[r.searchText,O]),_=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C],j=c(U.logoUri),N=pe.fromAppDid(U.clientId,a);return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(p,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:N.address,src:j,size:48}),e.jsxs(L,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:U.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:U.clientUri})]})]})})}}},{label:h("oauth.client.clientId"),name:"clientId"},{label:h("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(M,{scope:t})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Be}},{label:h("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ve,{showDid:!0,did:t,cardType:Ce.Detailed,infoType:Te.Minimal,sx:{border:0,padding:0}}):h("oauth.client.openRegistration")}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C];return e.jsx(De,{actions:[{icon:e.jsx(Ae,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(we,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),E(U)}}]})}}}],[A,h,c,a,x,E]),D=({page:t,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?u(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==t+1?u(j=>({...j,searchText:"",page:t+1})):r.searchText!==U&&u(j=>({...j,searchText:U,page:1}))};return e.jsxs(p,{ref:g,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[q?e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}):null,e.jsx(Se,{data:A,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const N=A[C];m(N)}}},onChange:D,title:q?null:e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>s(!0),children:[P?e.jsx(Z,{size:16}):e.jsx(ue,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Ie,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:i,onClose:()=>m(null)}),e.jsx(be,{open:n,onCreated:()=>{s(!1),d.retry()},onClose:()=>s(!1)}),I&&e.jsx(je,{client:I,onUpdate:d.retry,onClose:()=>x(null)}),T&&e.jsx(te,{...T,onDelete:d.retry,onClose:()=>E(null)})]})}export{It as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BW2DapLf.js","assets/vendor-ux-did-connect-BbCim3WZ.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BfZ4tlod.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-hooks-DqdmWCmo.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-f1tICt1E.js","assets/index-BxJZWVOT.js","assets/index-BMCGWiyM.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as b,b as Ue}from"./vendor-react-DEoibe3W.js";import{a as F,d as K,k as W,a3 as H,_ as ye,a2 as ne,$ as V,br as ve,bs as Ce,bt as Te,bd as we,ac as Se,a5 as Ie}from"./vendor-ux-did-connect-BbCim3WZ.js";import{H as o,j as e,D as X,aj as G,I as Q,t as J,al as L,T as R,aa as p,O as w,bq as v,bK as Re,bQ as oe,bs as se,bR as ae,X as Y,ak as ce,z as de,y as z,ab as Z,ad as Ee}from"./vendor-mui-core-Bq8gXTan.js";import{v as ue}from"./vendor-arcblock-f1tICt1E.js";import{d as Ae}from"./Edit-D-oqMZ6h.js";import{_ as ke}from"./dot-4jhL56kz.js";import{l as pe}from"./index-DECQi8Vb.js";import{D as $,aC as he,aD as S,G as Pe}from"./index-BMCGWiyM.js";import{u as B}from"./dashboard-CpxtvWAW.js";import{o as Ne,c as We,A as re}from"./vendor-utils-BfZ4tlod.js";import{T as qe}from"./index-WjR0qttM.js";import{E as Oe}from"./empty-spinner-BHwHZpq-.js";import{C as y}from"./click-to-copy-D0HginOX.js";import{D as Le}from"./delete-confirm-BdthpUzC.js";import{b as _e}from"./passport-item-fJ88Wv4t.js";import{A as De}from"./actions-BgkGoToI.js";import{T as le}from"./table-tips-Cjv8HIcF.js";import{u as ze}from"./use-mobile-DwzRjjku.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-C62uE2pS.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-T0keO70D.js";import"./did-address-DFiM35OM.js";import"./util-paKPrRHx.js";import"./base32-Cbt7-U8e.js";import"./MoreHoriz-H_VQNQ9b.js";const Fe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:u}){const[i,m]=b.useState(!1),{t:n,locale:s}=F(),{api:g}=$(),{teamDid:h}=B(),{control:f,handleSubmit:k,formState:{errors:a},watch:I,setValue:x}=he({defaultValues:Fe,mode:"onChange"}),T=I("scope"),E=c=>{c!=="profile:read"&&x("scope",T.includes(c)?T.filter(d=>d!==c):[...T,c])},q=async c=>{m(!0);try{const d={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(P=>P.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ne(d,We)}}),r(d)}catch(d){H.error(d.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(X,{open:!0,onClose:u,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[n("oauth.client.register")," ",e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:4,sx:{mt:2},children:[e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:n("oauth.client.validate.clientName"),minLength:{value:3,message:n("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(d=a.clientName)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:n("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(d=a.clientUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:n("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(d=a.redirectUris)==null?void 0:d.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:n("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:n("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:n("oauth.client.helperText.document")}),e.jsx(v,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Re,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(R,{variant:"subtitle2",gutterBottom:!0,children:n("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([c,d])=>e.jsx(se,{control:e.jsx(ae,{checked:T.includes(c),onChange:()=>E(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:d})})},c))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(L,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:n("oauth.client.validate.contacts")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(d=a.contacts)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(d=a.tosUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(d=a.policyUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:u,children:n("common.cancel")}),e.jsxs(z,{onClick:k(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function M({scope:r,...u}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(L,{direction:"row",flexWrap:"wrap",gap:1,...u,children:i.map(m=>e.jsx(Ue.Fragment,{children:e.jsx(Ee,{title:W.OAUTH_SCOPES[m],children:e.jsx(y,{children:m})})},m))})}M.propTypes={scope:o.string};M.defaultProps={scope:""};const ee=r=>{const{prefix:u}=$(),{blocklet:i}=Pe(),m=re(u,"/api/media/upload",i.appPid),n=b.useCallback(g=>g?g.startsWith("http")?g:`${re(u,"/api/media/upload",i.appPid)}/${g}`:"",[u,i.appPid]);return{clientLogoUrl:b.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},$e=b.lazy(()=>ye(()=>import("./index-BW2DapLf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function xe({client:r,onUpdate:u,onClose:i}){const[m,n]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=$(),{teamDid:k}=B(),{control:a,handleSubmit:I,formState:{errors:x},watch:T,setValue:E,getValues:q}=he({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),c=T("scope"),d=T("logoUri"),{clientLogoUrl:P,apiPath:O}=ee(d),A=l=>{l!=="profile:read"&&E("scope",c.includes(l)?c.filter(t=>t!==l):[...c,l])},_=async l=>{const t={clientId:r.clientId,clientName:l.clientName.trim(),clientUri:l.clientUri,redirectUris:l.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:l.contacts?l.contacts.split(",").map(C=>C.trim()):[],scope:l.scope.join(" "),tosUri:l.tosUri,policyUri:l.policyUri,logoUri:l.logoUri,clientSecretExpiresAt:l.clientSecretExpiresAt?parseInt(l.clientSecretExpiresAt/1e3,10):null};await f.updateOAuthClient({input:{teamDid:k,input:t}})},D=async l=>{n(!0);try{await _(l),u(),i()}catch(t){H.error(t.message||s("oauth.client.updateFailed"))}finally{n(!1)}};return e.jsxs(X,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(Q,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(p,{children:[e.jsx(p,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:P?e.jsx(p,{children:e.jsx("img",{src:P,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var l;(l=h.current)==null||l.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(P?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Oe,{}),children:e.jsx($e,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{E("logoUri",l.data.filename),_(q()).then(()=>{u()}).catch(t=>{H.error(t.message||s("oauth.client.updateFailed"))}).finally(()=>{var t;(t=h.current)==null||t.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:O,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:a,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(t=x.clientName)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:a,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(t=x.clientUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:a,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(t=x.redirectUris)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(qe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:t=>{l.onChange(t)}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(R,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([l,t])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>A(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:t})})},l))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(p,{children:e.jsx(S,{name:"contacts",control:a,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(t=x.contacts)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(t=x.tosUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(t=x.policyUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:i,children:s("common.cancel")}),e.jsx(z,{onClick:I(D),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(Z,{size:16}):s("common.update")})]})]})}xe.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function je({client:r,onUpdate:u,onClose:i}){return e.jsx(xe,{client:r,onUpdate:m=>u(m),onClose:i})}je.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function te(r){const{t:u}=F(),{api:i}=$(),{teamDid:m}=B(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},k=async()=>{try{await i.deleteOAuthClient({input:{teamDid:m,clientId:n}}),g()}catch(I){H.error(I==null?void 0:I.message)}finally{f()}},a={keyName:s,title:u("oauth.client.delete.title"),description:u("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:u("oauth.client.delete.description",{name:s}),confirm:u("common.delConfirm"),cancel:u("common.cancel"),onConfirm:k,onCancel:f};return e.jsx(Le,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})}te.propTypes={clientId:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:u}){return e.jsxs(p,{mb:3,children:[e.jsx(R,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(L,{spacing:1.5,children:u.map(({label:i,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(R,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(R,{sx:{wordBreak:"break-all"},children:m||"-"})]},i))})]})}ge.propTypes={title:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:u}){const{t:i,locale:m}=F(),{teamDid:n}=B(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:k,clientUri:a,logoUri:I,contacts:x,tosUri:T,policyUri:E,jwksUri:q,jwks:c,softwareId:d,softwareVersion:P,clientIdIssuedAt:O,clientSecretExpiresAt:A,updatedAt:_,createUser:D}=r,{clientLogoUrl:l}=ee(I),t=j=>{try{const N=new URL(window.blocklet.appUrl);return N.pathname=j,N.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:l,did:C.address,size:64})},{label:i("oauth.client.clientUri"),value:a?e.jsx(y,{children:a}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(y,{children:g})},{label:i("oauth.client.clientSecret"),value:e.jsx(y,{children:h})},{label:i("oauth.client.redirectUris"),value:e.jsx(y,{children:(f||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:k})},{label:i("oauth.client.createUser"),value:D?_e(D,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(y,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:x.length?e.jsx(y,{children:(x||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(y,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:E?e.jsx(y,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:c},{label:i("oauth.client.softwareId"),value:d},{label:i("oauth.client.softwareVersion"),value:P}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:O?e.jsx(V,{value:O*1e3,type:"all",locale:m}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:m}):"-"},{label:i("common.updatedAt"),value:_?e.jsx(V,{value:_,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(X,{open:!0,onClose:u,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsx(p,{mt:1,children:U.map((j,N)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),N!==U.length-1&&e.jsx(Y,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.func.isRequired};function Be(r){return e.jsx(V,{value:r*1e3})}function ie({selected:r,onClose:u}){return r?e.jsx(fe,{client:r,onClose:u}):null}ie.propTypes={selected:o.object,onClose:o.func.isRequired};ie.defaultProps={selected:null};function be({open:r,onCreated:u,onClose:i}){return r?e.jsx(me,{onCreated:u,onClose:i}):null}be.propTypes={open:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function It(){var l;const[r,u]=b.useState({searchText:"",pageSize:10,page:1}),[i,m]=b.useState(null),[n,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:k}=$(),{teamDid:a}=B(),[I,x]=b.useState(null),[T,E]=b.useState(null),q=ze(),{getClientLogoUrl:c}=ee(),d=ke(async()=>await k.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:P}=d,O=b.useMemo(()=>{var t;return((t=d.value)==null?void 0:t.list)||[]},[(l=d.value)==null?void 0:l.list]),A=b.useMemo(()=>r.searchText?O.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):O,[r.searchText,O]),_=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C],j=c(U.logoUri),N=pe.fromAppDid(U.clientId,a);return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(p,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:N.address,src:j,size:48}),e.jsxs(L,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:U.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:U.clientUri})]})]})})}}},{label:h("oauth.client.clientId"),name:"clientId"},{label:h("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(M,{scope:t})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Be}},{label:h("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ve,{showDid:!0,did:t,cardType:Ce.Detailed,infoType:Te.Minimal,sx:{border:0,padding:0}}):h("oauth.client.openRegistration")}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C];return e.jsx(De,{actions:[{icon:e.jsx(Ae,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(we,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),E(U)}}]})}}}],[A,h,c,a,x,E]),D=({page:t,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?u(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==t+1?u(j=>({...j,searchText:"",page:t+1})):r.searchText!==U&&u(j=>({...j,searchText:U,page:1}))};return e.jsxs(p,{ref:g,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[q?e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}):null,e.jsx(Se,{data:A,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const N=A[C];m(N)}}},onChange:D,title:q?null:e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>s(!0),children:[P?e.jsx(Z,{size:16}):e.jsx(ue,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Ie,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:i,onClose:()=>m(null)}),e.jsx(be,{open:n,onCreated:()=>{s(!1),d.retry()},onClose:()=>s(!1)}),I&&e.jsx(je,{client:I,onUpdate:d.retry,onClose:()=>x(null)}),T&&e.jsx(te,{...T,onDelete:d.retry,onClose:()=>E(null)})]})}export{It as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./vendor-mui-core-Bq8gXTan.js";import"./vendor-react-DEoibe3W.js";import{S as t}from"./studio-DSEHQtAw.js";import"./vendor-ux-did-connect-BbCim3WZ.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-f1tICt1E.js";import"./TuneOutlined-GyTVf3HU.js";function d(){return o.jsx(t,{children:"Coming soon..."})}export{d as default};
|