@abtnode/blocklet-services 1.16.44-beta-20250523-232943-369d21c5 → 1.16.44-beta-20250526-130644-5e05dc90
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/util/index.js +6 -0
- package/dist/assets/{AdapterDayjs-DnsMePpQ.js → AdapterDayjs-Bs_Q9JXL.js} +1 -1
- package/dist/assets/{ArrowDropDown-Dzy2X1bv.js → ArrowDropDown-DUn14Acv.js} +1 -1
- package/dist/assets/{CheckCircle-DA1-Q3VQ.js → CheckCircle-DsdIIzds.js} +1 -1
- package/dist/assets/{ChevronLeft-C7-bj_BM.js → ChevronLeft-BXDIS6AE.js} +1 -1
- package/dist/assets/{ChevronRight-CA18V4hg.js → ChevronRight-BfSAowju.js} +1 -1
- package/dist/assets/{DeleteOutline-DIXSGJ49.js → DeleteOutline-lCPjjhKz.js} +1 -1
- package/dist/assets/{Done-BHbsILFJ.js → Done-BoNuG9Iy.js} +1 -1
- package/dist/assets/{Download-CmhNaqwS.js → Download-4NCgy4QK.js} +1 -1
- package/dist/assets/{Edit-CNRD5aKM.js → Edit-BqpcPg9o.js} +1 -1
- package/dist/assets/{Error-DDQf7Wzw.js → Error-B7SzGNr8.js} +1 -1
- package/dist/assets/{ExpandLess-D15nWpBQ.js → ExpandLess-EFI-Ij5Y.js} +1 -1
- package/dist/assets/{Google-BEEvQjkX.js → Google-DYpd3dQM.js} +1 -1
- package/dist/assets/{Home-C8za96Ud.js → Home-Ccm-s4KT.js} +1 -1
- package/dist/assets/{InfoOutlined-Cxpk0UTX.js → InfoOutlined-Duq1UDPu.js} +1 -1
- package/dist/assets/{Launch-CKr_eo1b.js → Launch-ipC6Ic2p.js} +1 -1
- package/dist/assets/{LaunchOutlined-Drryv7vp.js → LaunchOutlined-C-M166rt.js} +1 -1
- package/dist/assets/{MoreHoriz-CKCGMlB8.js → MoreHoriz-jwSUI8G2.js} +1 -1
- package/dist/assets/{PlayArrow-CrmMAssx.js → PlayArrow-Cv1uXXJt.js} +1 -1
- package/dist/assets/{TuneOutlined-Dp4gMD_8.js → TuneOutlined-BvxrpP1M.js} +1 -1
- package/dist/assets/{ViewList-ByzGtByR.js → ViewList-PrXAmQts.js} +1 -1
- package/dist/assets/{access-control-EYKfTdyZ.js → access-control-Dvlg7x0h.js} +1 -1
- package/dist/assets/{actions-XNIU_ion.js → actions-BA8hCarh.js} +1 -1
- package/dist/assets/{add-component-core-CKSc86QZ.js → add-component-core-RTpy3oS3.js} +31 -31
- package/dist/assets/{add-resource-DFFU3s6r.js → add-resource-DKnJ3N_A.js} +1 -1
- package/dist/assets/{addon-DGwzoD-f.js → addon-DmglQWiB.js} +1 -1
- package/dist/assets/{advanced-dEhSilIC.js → advanced-CzssFl-I.js} +1 -1
- package/dist/assets/{appearance-fl_Qmz60.js → appearance-DIaCQMdO.js} +1 -1
- package/dist/assets/{audit-logs-T_rQofLT.js → audit-logs-BwUEGKxZ.js} +1 -1
- package/dist/assets/{authorize-BAWXv5fL.js → authorize-DqVeyhPc.js} +1 -1
- package/dist/assets/{base32-DEQDAhbh.js → base32-D35YSxth.js} +1 -1
- package/dist/assets/{branding-BaN8vHON.js → branding-D9cgoVZN.js} +2 -2
- package/dist/assets/{branding-BTvktwMq.js → branding-yRBlkhNg.js} +1 -1
- package/dist/assets/{bundle-avatar-Bn82ny8E.js → bundle-avatar-BP8xFngr.js} +1 -1
- package/dist/assets/{button-D7WVH4Bm.js → button-Da_a32NC.js} +1 -1
- package/dist/assets/{click-to-copy-DsH0RQVg.js → click-to-copy-B26zKr7i.js} +1 -1
- package/dist/assets/{collapse-DRHShQoZ.js → collapse-BF9pIOsL.js} +1 -1
- package/dist/assets/{complete-B3gpz2H0.js → complete-BFgID4Zc.js} +1 -1
- package/dist/assets/{component-CxESL3Iu.js → component-ESUBkOno.js} +1 -1
- package/dist/assets/{config-CKVskCpr.js → config-Bt_JcEZR.js} +1 -1
- package/dist/assets/config-navigation-Dyu8rgOf.js +26 -0
- package/dist/assets/{config-C77UXU2G.js → config-rMbgmGkF.js} +1 -1
- package/dist/assets/{config-space-CPPhaFPB.js → config-space-D2Cjeyk0.js} +1 -1
- package/dist/assets/{confirm-Dg7hYCJT.js → confirm-CiiHIA-a.js} +1 -1
- package/dist/assets/{connect-Ctst7unk.js → connect-Druwkt_h.js} +1 -1
- package/dist/assets/{connect-C3we9ebX.js → connect-QKA3Mcyx.js} +1 -1
- package/dist/assets/{connect-to-DOaPjxw6.js → connect-to-BLuNgRR8.js} +1 -1
- package/dist/assets/{dashboard-i-yx5Pql.js → dashboard-vkFEu-wZ.js} +13 -13
- package/dist/assets/{delete-confirm-BvvDet1u.js → delete-confirm-BPtFZ4JP.js} +1 -1
- package/dist/assets/{did-address-2a_50VlM.js → did-address-BtAnHi7m.js} +1 -1
- package/dist/assets/{domain-CuSKFz52.js → domain-CSsoH0JI.js} +1 -1
- package/dist/assets/{domain-action-card-DRQUwMj6.js → domain-action-card-CEIB4y6O.js} +1 -1
- package/dist/assets/domains-DySxSy7r.js +1 -0
- package/dist/assets/{email-B00NK4Kp.js → email-D6f0kuZJ.js} +1 -1
- package/dist/assets/{exchange-passport-DZ1Omnfv.js → exchange-passport-CyZiYD_w.js} +1 -1
- package/dist/assets/{fuel-DkJB9TXk.js → fuel-BzVicj7n.js} +1 -1
- package/dist/assets/{gen-access-key-DME0XOB3.js → gen-access-key-DiLTrx9k.js} +1 -1
- package/dist/assets/{get-safe-url-BdFxF8pA.js → get-safe-url-CiQ8_q49.js} +1 -1
- package/dist/assets/{get-safe-url-DfW-qoLB.js → get-safe-url-DSt3eVbO.js} +1 -1
- package/dist/assets/{home-DtVAZY8s.js → home-AVCu7DmN.js} +1 -1
- package/dist/assets/{iframe-dmrNn49R.js → iframe-CJ1Wo1WH.js} +1 -1
- package/dist/assets/{index-BGbF_TCU.js → index-8lA5-nM7.js} +3 -3
- package/dist/assets/{index-Ddqbpb3u.js → index-99E5Ux4J.js} +1 -1
- package/dist/assets/{index-Diy9mBRc.js → index-B7Ih-tce.js} +1 -1
- package/dist/assets/{index-BnFkiSCK.js → index-BDhncHq5.js} +1 -1
- package/dist/assets/{index-C5N0NjEs.js → index-BhMu-yLO.js} +1 -1
- package/dist/assets/{index-C2FIN4Ee.js → index-Biu0_3VS.js} +1 -1
- package/dist/assets/{index-DWV8Jczt.js → index-CCsDojsm.js} +1 -1
- package/dist/assets/index-CG5aY0sO.js +6 -0
- package/dist/assets/{index-Dmcajroh.js → index-CVeug3aj.js} +1 -1
- package/dist/assets/{index-CBALX7k4.js → index-Cj_-M8SX.js} +1 -1
- package/dist/assets/{index-AMPo4oen.js → index-CkuD5Vfn.js} +1 -1
- package/dist/assets/{index-BOrnIOJA.js → index-CpRFDVw4.js} +1 -1
- package/dist/assets/{index-Ck-L27nB.js → index-DJzuhKQh.js} +4 -4
- package/dist/assets/{index-BAVIVYtT.js → index-D_aS7-BV.js} +1 -1
- package/dist/assets/{index-Cf3pTZQS.js → index-DeD4o13y.js} +1 -1
- package/dist/assets/{index-C2wxmxz2.js → index-IuBCAZn2.js} +1 -1
- package/dist/assets/{index-D669bu3T.js → index-Jryn5flm.js} +4 -4
- package/dist/assets/{index-CXjHuFcg.js → index-XdA5ax9j.js} +1 -1
- package/dist/assets/{index-C9-sIzmv.js → index-hO3Mo-qi.js} +1 -1
- package/dist/assets/{index-iphP5FWX.js → index-nhpGyAFA.js} +1 -1
- package/dist/assets/{invitation-DgyvRGj7.js → invitation-CbZcjplG.js} +1 -1
- package/dist/assets/{invite-CpiILEDC.js → invite-CG68Mxoz.js} +1 -1
- package/dist/assets/{issue-passport-BtYhvb89.js → issue-passport-3aP4u6AF.js} +1 -1
- package/dist/assets/{item-JiENn3N2.js → item-DLwktWNI.js} +1 -1
- package/dist/assets/{landing-page-DErP-951.js → landing-page-B3KyXZXw.js} +1 -1
- package/dist/assets/{layout-D40Fy8O5.js → layout-BzSCNNrb.js} +1 -1
- package/dist/assets/{list-vUoPUWDO.js → list-D29W3nMj.js} +1 -1
- package/dist/assets/{list-Dm4NCtd2.js → list-y33VQBpr.js} +2 -2
- package/dist/assets/localization-Y6Zfd1Kb.js +1 -0
- package/dist/assets/{log-B2MHND50.js → log-D5wtGlYv.js} +1 -1
- package/dist/assets/{logger-DRlJhYNs.js → logger-DTzDRWqY.js} +1 -1
- package/dist/assets/{login-CGPNIfmK.js → login-Bq9K3qHu.js} +1 -1
- package/dist/assets/{login-oauth-callback-T6cLlJXo.js → login-oauth-callback-DjqRVYt8.js} +1 -1
- package/dist/assets/{logo-uploader-PUDZmwys.js → logo-uploader-B-RJuXxH.js} +3 -3
- package/dist/assets/{lost-passport-CPgs6iwG.js → lost-passport-n3UXYXA8.js} +1 -1
- package/dist/assets/{open-window-xER4N-kf.js → open-window-Dyr68wBS.js} +1 -1
- package/dist/assets/{overview-DnOgyK55.js → overview-C2L5ReTa.js} +1 -1
- package/dist/assets/{page-header-IRqa6Qvs.js → page-header-BS-digIw.js} +1 -1
- package/dist/assets/{passport-item-BugDNovJ.js → passport-item-B9iOvD4Y.js} +1 -1
- package/dist/assets/{permission-BkpeOUF9.js → permission-CbTKdC7W.js} +1 -1
- package/dist/assets/{preferences-CaXn4vHX.js → preferences-DETzTJeF.js} +1 -1
- package/dist/assets/{profile-embed-DP-NpR-H.js → profile-embed-7uAZGWnU.js} +1 -1
- package/dist/assets/{publish-resource-3814heud.js → publish-resource-Bk1sOsMC.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-CXMxXaUW.js → react-beautiful-dnd.esm-WW1RMrIr.js} +1 -1
- package/dist/assets/{runtime-DiYnPWFr.js → runtime-CA329eRU.js} +1 -1
- package/dist/assets/sdk-Bxy9kDUo.js +1 -0
- package/dist/assets/{security-B9_Hq9IS.js → security-BYPCwU9I.js} +1 -1
- package/dist/assets/{session-E0e-X6-a.js → session-ugMCR4Iu.js} +1 -1
- package/dist/assets/{setup-BaybnOtz.js → setup-BuHGJK0U.js} +3 -3
- package/dist/assets/{spaces-BKlIkPYo.js → spaces-CTEbtAyX.js} +1 -1
- package/dist/assets/{start-CGbnYNse.js → start-Df7Wiv2W.js} +1 -1
- package/dist/assets/{starting-progress-CyKicFZc.js → starting-progress-Dvw39Hou.js} +1 -1
- package/dist/assets/{status-Bcm8tb3P.js → status-CH0vjcu4.js} +1 -1
- package/dist/assets/{step-actions-Cg48h78A.js → step-actions-QyMIKyQA.js} +1 -1
- package/dist/assets/{studio-BSiEg8xP.js → studio-B1PGcNac.js} +1 -1
- package/dist/assets/{switch-control-DzZXz9Ks.js → switch-control-D5eJVUaV.js} +1 -1
- package/dist/assets/{table-tips-BP0JTpDH.js → table-tips-biAHyN1z.js} +1 -1
- package/dist/assets/{traffic-B6tOFf5s.js → traffic-DVUW14yF.js} +1 -1
- package/dist/assets/{transfer-DgLkTH8K.js → transfer-CsdMd63R.js} +1 -1
- package/dist/assets/{unsubscribe-BqDBVi9S.js → unsubscribe-1jeXeeTi.js} +1 -1
- package/dist/assets/{use-blocklet-logo-7IVWq7WH.js → use-blocklet-logo-a8QJI4r-.js} +1 -1
- package/dist/assets/{useLocalStorage-DvcK7KsP.js → useLocalStorage-BDA4jbwL.js} +1 -1
- package/dist/assets/{user-center-Sntfjt65.js → user-center-BQcfE646.js} +3 -3
- package/dist/assets/{util-D9dsxEYk.js → util-BwAoiA7E.js} +1 -1
- package/dist/assets/{util-IzAdTupy.js → util-D-q3oYk9.js} +1 -1
- package/dist/assets/{vendor-arcblock-CUb0jDdY.js → vendor-arcblock-5qqHEVGo.js} +4 -4
- package/dist/assets/{vendor-ux-did-connect-DprdyYny.js → vendor-ux-did-connect-DROQhYpS.js} +92 -92
- package/dist/assets/{wrap-locale-Q616uqhq.js → wrap-locale-CvN5krOj.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +31 -31
- package/dist/assets/config-navigation-C40INCPl.js +0 -26
- package/dist/assets/domains-QTRMAE0S.js +0 -1
- package/dist/assets/index-v_V1vBsu.js +0 -6
- package/dist/assets/localization-Dale72UG.js +0 -1
- package/dist/assets/sdk-DeUOtvaE.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,T as w,be as y,e as P,v as z,aa as n,H as t}from"./vendor-mui-core-BV2FUxWJ.js";import{h as A,bf as C,bg as E,Y as j,bh as L}from"./vendor-ux-did-connect-
|
|
1
|
+
import{j as e,T as w,be as y,e as P,v as z,aa as n,H as t}from"./vendor-mui-core-BV2FUxWJ.js";import{h as A,bf as C,bg as E,Y as j,bh as L}from"./vendor-ux-did-connect-DROQhYpS.js";import{s as M}from"./vendor-arcblock-5qqHEVGo.js";import{f as R}from"./vendor-hooks-BgUTpb6X.js";function H({linkProps:r,showExtra:o,...a}){return e.jsxs(w,{...a,children:["Powered by"," ",e.jsx(y,{href:"https://www.arcblock.io",target:"_blank",...r,children:"ArcBlock"}),"'s"," ",e.jsx(y,{href:"https://www.blocklet.io",target:"_blank",...r,children:"Blocklet Technology"}),o?", the decentralized web engine.":null]})}function k({did:r,children:o,title:a,description:d,actions:u,logo:i,logoSize:c,poweredBy:x,termsOfUse:m,standalone:v}){const s=(globalThis==null?void 0:globalThis.blocklet)||(globalThis==null?void 0:globalThis.env)||{},{palette:g}=P(),f=z(l=>l.breakpoints.down("lg")),I=M({meta:s}),T=R(()=>{const l=s.appPid,b=A.isEthereumDid(l),D=b?void 0:C(l);return b?E(l):D.color},[s==null?void 0:s.appPid]);if(!r)return o;a===void 0&&(a=s.appName),d===void 0&&(d=s.appDescription),i===void 0&&(i=I||""),typeof i=="string"&&(i?i=e.jsx(n,{sx:{height:c,maxHeight:c,objectFit:"contain"},component:"img",src:i,alt:`${s.appName}'s logo`}):i=e.jsx(j,{size:c,did:r,src:i,variant:"rounded"})),x===void 0&&(x=e.jsx(H,{linkProps:{color:g.text.secondary,sx:{"&:hover":{textDecoration:"underline"}}},showExtra:!f,sx:{textAlign:"center",fontSize:"12px",color:"text.secondary"}}));let p=o;!o&&!f&&(p=e.jsx(n,{sx:{filter:"blur(180px)",display:"flex"},children:e.jsx(j,{size:210,did:r,variant:"rounded"})}));const B=!!o;let h=!v;return f&&(h=!B),e.jsxs(n,{sx:{width:"100vw",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",px:{xs:2,sm:4,md:8},pt:{xs:2,sm:4,md:6},pb:{xs:5,md:8},background:`radial-gradient(circle at bottom right, ${L(T,.3)} 10%, ${g.background.default} 50%)`,position:"relative"},children:[e.jsxs(n,{sx:{maxWidth:1200,display:"flex",alignItems:"center",justifyContent:[h,p].filter(Boolean).length>1?"space-between":"center",width:"100%",margin:"auto"},children:[h?e.jsxs(n,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(n,{sx:{display:"flex",alignItems:"center"},children:i}),e.jsx(w,{variant:"h2",sx:{fontWeight:"bold",fontSize:{sm:"2.25rem",md:"2.75rem",xl:"3.5rem"}},children:a}),d?e.jsx(n,{variant:"h5",sx:{mb:2,color:"text.secondary"},children:d}):null,u?e.jsx(n,{sx:{mt:8},children:u}):null,m?e.jsx(n,{sx:{mt:-1,color:"grey"},children:m}):null]}):null,p]}),e.jsx(n,{sx:{position:"absolute",zIndex:10,bottom:10,left:10,right:10,textAlign:"center"},children:x})]})}k.propTypes={did:t.string.isRequired,children:t.any.isRequired,title:t.any,description:t.any,logo:t.any,logoSize:t.number,actions:t.any,poweredBy:t.any,termsOfUse:t.any,standalone:t.bool};k.defaultProps={title:void 0,description:void 0,logo:void 0,logoSize:50,standalone:!1};export{k as L};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r,ah as m}from"./vendor-mui-core-BV2FUxWJ.js";import{C as c}from"./content-layout-fV4nyVb5.js";import{a as p,Z as s}from"./vendor-ux-did-connect-
|
|
1
|
+
import{j as r,ah as m}from"./vendor-mui-core-BV2FUxWJ.js";import{C as c}from"./content-layout-fV4nyVb5.js";import{a as p,Z as s}from"./vendor-ux-did-connect-DROQhYpS.js";import{c as i}from"./vendor-arcblock-5qqHEVGo.js";import{L as u}from"./index-DJzuhKQh.js";const d=m(c)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,bc as ee,e as M,be as ae,aa as h,ah as L,T as S,v as W,X as le,bK as Me,ad as tt,bL as rt,aq as nt,ai as st,a9 as $e,m as it,bY as ot,y as at,s as lt,I as ct}from"./vendor-mui-core-BV2FUxWJ.js";import{f as z,u as se,m as dt}from"./vendor-hooks-BgUTpb6X.js";import{a as ce,W as ut,h as pt,aJ as ht,j as Pe,y as B,X as de,b2 as ue,b6 as ft,r as Ae,I as Ne,bi as mt}from"./vendor-ux-did-connect-
|
|
1
|
+
import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,bc as ee,e as M,be as ae,aa as h,ah as L,T as S,v as W,X as le,bK as Me,ad as tt,bL as rt,aq as nt,ai as st,a9 as $e,m as it,bY as ot,y as at,s as lt,I as ct}from"./vendor-mui-core-BV2FUxWJ.js";import{f as z,u as se,m as dt}from"./vendor-hooks-BgUTpb6X.js";import{a as ce,W as ut,h as pt,aJ as ht,j as Pe,y as B,X as de,b2 as ue,b6 as ft,r as Ae,I as Ne,bi as mt}from"./vendor-ux-did-connect-DROQhYpS.js";import{S as gt}from"./index-D2uDBC1o.js";import{B as xt}from"./bundle-avatar-BP8xFngr.js";import{a as yt,g as pe,b as he,c as U,s as Q,H as vt,u as ze,M as Le,d as X,e as bt,m as jt,i as wt}from"./use-blocklet-logo-a8QJI4r-.js";import{A as O,ag as kt,z as De,b as D,a0 as Rt}from"./vendor-utils-rHXShPKm.js";import{u as Y,p as Tt,h as J,f as Ee,w as It}from"./vendor-arcblock-5qqHEVGo.js";import{d as Ct}from"./InfoOutlined-Duq1UDPu.js";import{d as St}from"./CheckCircle-DsdIIzds.js";import{U as Mt,C as $t,I as Pt}from"./index-nhpGyAFA.js";import{p as At}from"./util-D-q3oYk9.js";import{D as Nt}from"./index-DJzuhKQh.js";function fe({blocklet:e,style:t,size:s,...n}){const a=yt({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}})})}fe.propTypes={blocklet:o.object.isRequired,style:o.object,size:o.oneOfType([o.number,o.string])};fe.defaultProps={style:{},size:40};function zt(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function te({value:e,shouldUpdate:t=!1,...s}){const{locale:n}=ce(),[a,c]=p.useState(0);if(p.useEffect(()=>{let l;if(t){const u=new Date(e).getTime(),y=Date.now(),m=Math.abs(Math.floor((u-y)/1e3)),b=()=>{c(j=>{const k=Math.random()*1e3;return parseFloat((j+k).toFixed(4))})};m<60?l=setInterval(b,1e3):m<60*60?l=setInterval(b,6e4):l=setInterval(b,36e5)}return()=>{clearInterval(l)}},[e,a,t]),!e)return"-";const i=zt(e);return r.jsx(ut,{value:i,locale:n,...s})}te.propTypes={value:o.any,shouldUpdate:o.bool};te.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=>kt(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(Pe.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},Ut=(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=pe(e.activity),n=(s==null?void 0:s.metaLink)||(s==null?void 0:s.targetLink);if(n)return he(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},ie=e=>{const{receivers:t=[]}=e;return t.length?t.every(s=>s.read):!0};function Bt(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(Bt(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=>{ie(n)||t.push(n)}):ie(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):`/.well-known/service/proxy?url=${e}`}catch(t){return console.warn("Invalid image URL format:",e,t),null}};function He({attachment:e}){const{data:t}=e,s=M();let n="";try{n=new URL(t.url).host}catch{n=t.url}return r.jsxs(ae,{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(h,{className:"title",style:{whiteSpace:"unset"},children:t.title}),!!t.description&&r.jsx(h,{className:"description",style:{whiteSpace:"unset",color:s.palette.text.secondary},children:t.description}),!!t.image&&r.jsx(B,{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(B,{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;
|
|
@@ -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 ve}from"./vendor-react-DEoibe3W.js";import{a as F,d as H,j as K,Z as M,_ as ye,Y as ne,W as $,b4 as Ce,a7 as we,a0 as Te}from"./vendor-ux-did-connect-DprdyYny.js";import{H as n,j as e,D as G,aj as Q,I as X,t as Y,al as D,T as I,aa as p,O as T,bq as y,bK as ke,bQ as oe,bs as se,bR as ae,X as Z,ak as ce,z as ue,y as E,ab as J,ad as Se}from"./vendor-mui-core-BV2FUxWJ.js";import{O as de}from"./vendor-arcblock-CUb0jDdY.js";import{d as Ie}from"./Edit-CNRD5aKM.js";import{_ as Re}from"./dot-DX56IFTM.js";import{l as pe}from"./index-C5N0NjEs.js";import{D as B,aA as he,aB as S,G as qe}from"./index-Ck-L27nB.js";import{u as _}from"./dashboard-i-yx5Pql.js";import{o as Ae,c as Oe,A as re}from"./vendor-utils-rHXShPKm.js";import{E as Pe}from"./empty-spinner-BdaCO6xq.js";import{C as v}from"./click-to-copy-DsH0RQVg.js";import{D as Ne}from"./delete-confirm-BvvDet1u.js";import{b as We}from"./passport-item-BugDNovJ.js";import{A as De}from"./actions-XNIU_ion.js";import{T as le}from"./table-tips-BP0JTpDH.js";import{u as ze}from"./use-mobile-BAa0wi8o.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-Dv214fz8.js";import"./useLocalStorage-DvcK7KsP.js";import"./index-8eXqqyHQ.js";import"./confirm-Dg7hYCJT.js";import"./PlayArrow-CrmMAssx.js";import"./get-safe-url-BdFxF8pA.js";import"./session-E0e-X6-a.js";import"./use-blocklet-logo-7IVWq7WH.js";import"./InfoOutlined-Cxpk0UTX.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./index-iphP5FWX.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./did-address-2a_50VlM.js";import"./util-IzAdTupy.js";import"./base32-DEQDAhbh.js";import"./MoreHoriz-CKCGMlB8.js";const Le={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:d}){const[t,m]=b.useState(!1),{t:l,locale:s}=F(),{api:g}=B(),{teamDid:h}=_(),{control:f,handleSubmit:A,formState:{errors:a},watch:k,setValue:x}=he({defaultValues:Le,mode:"onChange"}),w=k("scope"),R=c=>{c!=="profile:read"&&x("scope",w.includes(c)?w.filter(u=>u!==c):[...w,c])},N=async c=>{m(!0);try{const u={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(O=>O.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ae(u,Oe)}}),r(u)}catch(u){M.error(u.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(G,{open:!0,onClose:d,maxWidth:"md",fullWidth:!0,children:[e.jsxs(Q,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsxs(D,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(u=a.clientName)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(u=a.clientUri)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(u=a.redirectUris)==null?void 0:u.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(y,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(y,{children:l("oauth.client.helperText.read")}),e.jsx(y,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(y,{children:l("oauth.client.helperText.more")})]})]})}})}),e.jsxs(ke,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(K.OAUTH_SCOPES).map(([c,u])=>e.jsx(se,{control:e.jsx(ae,{checked:w.includes(c),onChange:()=>R(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:u})})},c))})})]}),e.jsx(Z,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(D,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(u=a.contacts)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.contacts")})]})}})}),e.jsxs(D,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(u=a.tosUri)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(u=a.policyUri)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(ue,{children:[e.jsx(E,{onClick:d,children:l("common.cancel")}),e.jsxs(E,{onClick:A(N),disabled:t,variant:"contained",color:"primary",children:[t?e.jsx(J,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function V({scope:r,...d}){if(!r)return null;const t=r.split(" ").filter(Boolean);return e.jsx(D,{direction:"row",flexWrap:"wrap",gap:1,...d,children:t.map(m=>e.jsx(ve.Fragment,{children:e.jsx(Se,{title:K.OAUTH_SCOPES[m],children:e.jsx(v,{children:m})})},m))})}V.propTypes={scope:n.string};V.defaultProps={scope:""};const ee=r=>{const{prefix:d}=B(),{blocklet:t}=qe(),m=re(d,"/api/media/upload",t.appPid),l=b.useCallback(g=>g?g.startsWith("http")?g:`${re(d,"/api/media/upload",t.appPid)}/${g}`:"",[d,t.appPid]);return{clientLogoUrl:b.useMemo(()=>l(r),[r,l]),apiPath:m,getClientLogoUrl:l}},Ee=b.lazy(()=>ye(()=>import("./index-BGbF_TCU.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:d,onClose:t}){const[m,l]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=B(),{teamDid:A}=_(),{control:a,handleSubmit:k,formState:{errors:x},watch:w,setValue:R,getValues:N}=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||""},mode:"onChange"}),c=w("scope"),u=w("logoUri"),{clientLogoUrl:O,apiPath:W}=ee(u),q=o=>{o!=="profile:read"&&R("scope",c.includes(o)?c.filter(i=>i!==o):[...c,o])},z=async o=>{const i={clientId:r.clientId,clientName:o.clientName.trim(),clientUri:o.clientUri,redirectUris:o.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:o.contacts?o.contacts.split(",").map(C=>C.trim()):[],scope:o.scope.join(" "),tosUri:o.tosUri,policyUri:o.policyUri,logoUri:o.logoUri};await f.updateOAuthClient({input:{teamDid:A,input:i}})},L=async o=>{l(!0);try{await z(o),d(),t()}catch(i){M.error(i.message||s("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(G,{open:!0,onClose:t,maxWidth:"md",fullWidth:!0,children:[e.jsxs(Q,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:t,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsxs(D,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(I,{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:O?e.jsx(p,{children:e.jsx("img",{src:O,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var o;(o=h.current)==null||o.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(de,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(E,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var o;(o=h.current)==null||o.open()},children:s(O?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Pe,{}),children:e.jsx(Ee,{ref:h,locale:g,popup:!0,onUploadFinish:o=>{R("logoUri",o.data.filename),z(N()).then(()=>{d()}).catch(i=>{M.error(i.message||s("oauth.client.updateFailed"))}).finally(()=>{var i;(i=h.current)==null||i.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:W,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(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(T,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(i=x.clientName)==null?void 0:i.message}),e.jsx(y,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(i=x.clientUri)==null?void 0:i.message}),e.jsx(y,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(i=x.redirectUris)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(I,{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(K.OAUTH_SCOPES).map(([o,i])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(o),onChange:()=>q(o),disabled:o==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:i})})},o))})})]}),e.jsx(Z,{}),e.jsx(I,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(i=x.contacts)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(D,{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:o})=>{var i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...o,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(i=x.tosUri)==null?void 0:i.message}),e.jsx(y,{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:o})=>{var i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...o,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(i=x.policyUri)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(ue,{children:[e.jsx(E,{onClick:t,children:s("common.cancel")}),e.jsx(E,{onClick:k(L),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(J,{size:16}):s("common.update")})]})]})}xe.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function je({client:r,onUpdate:d,onClose:t}){return e.jsx(xe,{client:r,onUpdate:m=>d(m),onClose:t})}je.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function te(r){const{t:d}=F(),{api:t}=B(),{teamDid:m}=_(),{clientId:l,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},A=async()=>{try{await t.deleteOAuthClient({input:{teamDid:m,clientId:l}}),g()}catch(k){M.error(k==null?void 0:k.message)}finally{f()}},a={keyName:s,title:d("oauth.client.delete.title"),description:d("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:d("oauth.client.delete.description",{name:s}),confirm:d("common.delConfirm"),cancel:d("common.cancel"),onConfirm:A,onCancel:f};return e.jsx(Ne,{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:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:d}){return e.jsxs(p,{mb:3,children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(D,{spacing:1.5,children:d.map(({label:t,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:t}),e.jsx(I,{sx:{wordBreak:"break-all"},children:m||"-"})]},t))})]})}ge.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function fe({client:r,onClose:d}){const{t,locale:m}=F(),{teamDid:l}=_(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:A,clientUri:a,logoUri:k,contacts:x,tosUri:w,policyUri:R,jwksUri:N,jwks:c,softwareId:u,softwareVersion:O,clientIdIssuedAt:W,clientSecretExpiresAt:q,updatedAt:z,createUser:L}=r,{clientLogoUrl:o}=ee(k),i=j=>{try{const P=new URL(window.blocklet.appUrl);return P.pathname=j,P.toString()}catch{return"-"}},C=pe.fromAppDid(g,l),U=[{title:t("common.baseInfo"),items:[{label:t("oauth.client.name"),value:s},{label:t("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:o,did:C.address,size:64})},{label:t("oauth.client.clientUri"),value:a?e.jsx(v,{children:a}):"-"},{label:t("oauth.client.clientId"),value:e.jsx(v,{children:g})},{label:t("oauth.client.clientSecret"),value:e.jsx(v,{children:h})},{label:t("oauth.client.redirectUris"),value:e.jsx(v,{children:(f||[]).join(", ")})},{label:t("oauth.client.scope"),value:e.jsx(V,{scope:A})},{label:t("oauth.client.createUser"),value:L?We(L,!0):t("oauth.client.openRegistration")}]},{title:t("oauth.client.oauthEndpoints"),items:[{label:t("oauth.client.openidConfiguration"),value:e.jsx(v,{children:i("/.well-known/openid-configuration")})},{label:t("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/authorize")})},{label:t("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/token")})},{label:t("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/userinfo")})},{label:t("oauth.client.jwksUri"),value:e.jsx(v,{children:i("/.well-known/service/oauth/jwks")})},{label:t("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/register")})},{label:t("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/logout")})}]},{title:t("oauth.client.metaContact"),items:[{label:t("oauth.client.contacts"),value:x.length?e.jsx(v,{children:(x||[]).join(", ")}):"-"},{label:t("oauth.client.tosUri"),value:w?e.jsx(v,{children:w}):"-"},{label:t("oauth.client.policyUri"),value:R?e.jsx(v,{children:R}):"-"},{label:t("oauth.client.jwksUri"),value:N},{label:t("oauth.client.jwks"),value:c},{label:t("oauth.client.softwareId"),value:u},{label:t("oauth.client.softwareVersion"),value:O}]},{title:t("common.timeInfo"),items:[{label:t("oauth.client.clientIdIssuedAt"),value:W?e.jsx($,{value:W*1e3,type:"all",locale:m}):"-"},{label:t("oauth.client.clientSecretExpiresAt"),value:q?e.jsx($,{value:q*1e3,type:"all",locale:m}):"-"},{label:t("common.updatedAt"),value:z?e.jsx($,{value:z,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(G,{open:!0,onClose:d,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(Q,{children:[t("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsx(p,{mt:1,children:U.map((j,P)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),P!==U.length-1&&e.jsx(Z,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Fe(r){return e.jsx($,{value:r*1e3})}function ie({selected:r,onClose:d}){return r?e.jsx(fe,{client:r,onClose:d}):null}ie.propTypes={selected:n.object,onClose:n.func.isRequired};ie.defaultProps={selected:null};function Ue({open:r,onCreated:d,onClose:t}){return r?e.jsx(me,{onCreated:d,onClose:t}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function kt(){var o;const[r,d]=b.useState({searchText:"",pageSize:10,page:1}),[t,m]=b.useState(null),[l,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:A}=B(),{teamDid:a}=_(),[k,x]=b.useState(null),[w,R]=b.useState(null),N=ze(),{getClientLogoUrl:c}=ee(),u=Re(async()=>await A.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:O}=u,W=b.useMemo(()=>{var i;return((i=u.value)==null?void 0:i.list)||[]},[(o=u.value)==null?void 0:o.list]),q=b.useMemo(()=>r.searchText?W.filter(i=>i.clientName.toLowerCase().includes(r.searchText.toLowerCase())||i.clientId.toLowerCase().includes(r.searchText.toLowerCase())||i.scope.toLowerCase().includes(r.searchText.toLowerCase())):W,[r.searchText,W]),z=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(i,{rowIndex:C})=>{const U=q[C],j=c(U.logoUri),P=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"},onClick:be=>{be.stopPropagation(),window.open(U.clientUri,"_blank")},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:P.address,src:j,size:48}),e.jsxs(D,{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:i=>e.jsx(V,{scope:i})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Fe}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(i,{rowIndex:C})=>{const U=q[C];return e.jsx(De,{actions:[{icon:e.jsx(Ie,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(Ce,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),R(U)}}]})}}}],[q,h,c,a,x,R]),L=({page:i,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?d(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==i+1?d(j=>({...j,searchText:"",page:i+1})):r.searchText!==U&&d(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:[N?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(we,{data:q,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:q.length,searchDebounceTime:400,onRowClick(i,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const P=q[C];m(P)}}},onChange:L,title:N?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(E,{variant:"contained",size:"small",onClick:()=>s(!0),children:[O?e.jsx(J,{size:16}):e.jsx(de,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Te,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:t,onClose:()=>m(null)}),e.jsx(Ue,{open:l,onCreated:()=>{s(!1),u.retry()},onClose:()=>s(!1)}),k&&e.jsx(je,{client:k,onUpdate:u.retry,onClose:()=>x(null)}),w&&e.jsx(te,{...w,onDelete:u.retry,onClose:()=>R(null)})]})}export{kt as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-8lA5-nM7.js","assets/vendor-ux-did-connect-DROQhYpS.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-BV2FUxWJ.js","assets/vendor-hooks-BgUTpb6X.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-5qqHEVGo.js","assets/index-Bs1kxR8_.js","assets/index-DJzuhKQh.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 ve}from"./vendor-react-DEoibe3W.js";import{a as F,d as H,j as K,Z as M,_ as ye,Y as ne,W as $,b4 as Ce,a7 as we,a0 as Te}from"./vendor-ux-did-connect-DROQhYpS.js";import{H as n,j as e,D as G,aj as Q,I as X,t as Y,al as D,T as I,aa as p,O as T,bq as y,bK as ke,bQ as oe,bs as se,bR as ae,X as Z,ak as ce,z as ue,y as E,ab as J,ad as Se}from"./vendor-mui-core-BV2FUxWJ.js";import{O as de}from"./vendor-arcblock-5qqHEVGo.js";import{d as Ie}from"./Edit-BqpcPg9o.js";import{_ as Re}from"./dot-DX56IFTM.js";import{l as pe}from"./index-BhMu-yLO.js";import{D as B,aA as he,aB as S,G as qe}from"./index-DJzuhKQh.js";import{u as _}from"./dashboard-vkFEu-wZ.js";import{o as Ae,c as Oe,A as re}from"./vendor-utils-rHXShPKm.js";import{E as Pe}from"./empty-spinner-BdaCO6xq.js";import{C as v}from"./click-to-copy-B26zKr7i.js";import{D as Ne}from"./delete-confirm-BPtFZ4JP.js";import{b as We}from"./passport-item-B9iOvD4Y.js";import{A as De}from"./actions-BA8hCarh.js";import{T as le}from"./table-tips-biAHyN1z.js";import{u as ze}from"./use-mobile-BAa0wi8o.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-Dv214fz8.js";import"./useLocalStorage-BDA4jbwL.js";import"./index-8eXqqyHQ.js";import"./confirm-CiiHIA-a.js";import"./PlayArrow-Cv1uXXJt.js";import"./get-safe-url-CiQ8_q49.js";import"./session-ugMCR4Iu.js";import"./use-blocklet-logo-a8QJI4r-.js";import"./InfoOutlined-Duq1UDPu.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./index-nhpGyAFA.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./did-address-BtAnHi7m.js";import"./util-D-q3oYk9.js";import"./base32-D35YSxth.js";import"./MoreHoriz-jwSUI8G2.js";const Le={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:d}){const[t,m]=b.useState(!1),{t:l,locale:s}=F(),{api:g}=B(),{teamDid:h}=_(),{control:f,handleSubmit:A,formState:{errors:a},watch:k,setValue:x}=he({defaultValues:Le,mode:"onChange"}),w=k("scope"),R=c=>{c!=="profile:read"&&x("scope",w.includes(c)?w.filter(u=>u!==c):[...w,c])},N=async c=>{m(!0);try{const u={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(O=>O.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ae(u,Oe)}}),r(u)}catch(u){M.error(u.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(G,{open:!0,onClose:d,maxWidth:"md",fullWidth:!0,children:[e.jsxs(Q,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsxs(D,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(u=a.clientName)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(u=a.clientUri)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(u=a.redirectUris)==null?void 0:u.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(y,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(y,{children:l("oauth.client.helperText.read")}),e.jsx(y,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(y,{children:l("oauth.client.helperText.more")})]})]})}})}),e.jsxs(ke,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(K.OAUTH_SCOPES).map(([c,u])=>e.jsx(se,{control:e.jsx(ae,{checked:w.includes(c),onChange:()=>R(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:u})})},c))})})]}),e.jsx(Z,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(D,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(u=a.contacts)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.contacts")})]})}})}),e.jsxs(D,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(u=a.tosUri)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(u=a.policyUri)==null?void 0:u.message}),e.jsx(y,{children:l("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(ue,{children:[e.jsx(E,{onClick:d,children:l("common.cancel")}),e.jsxs(E,{onClick:A(N),disabled:t,variant:"contained",color:"primary",children:[t?e.jsx(J,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function V({scope:r,...d}){if(!r)return null;const t=r.split(" ").filter(Boolean);return e.jsx(D,{direction:"row",flexWrap:"wrap",gap:1,...d,children:t.map(m=>e.jsx(ve.Fragment,{children:e.jsx(Se,{title:K.OAUTH_SCOPES[m],children:e.jsx(v,{children:m})})},m))})}V.propTypes={scope:n.string};V.defaultProps={scope:""};const ee=r=>{const{prefix:d}=B(),{blocklet:t}=qe(),m=re(d,"/api/media/upload",t.appPid),l=b.useCallback(g=>g?g.startsWith("http")?g:`${re(d,"/api/media/upload",t.appPid)}/${g}`:"",[d,t.appPid]);return{clientLogoUrl:b.useMemo(()=>l(r),[r,l]),apiPath:m,getClientLogoUrl:l}},Ee=b.lazy(()=>ye(()=>import("./index-8lA5-nM7.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:d,onClose:t}){const[m,l]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=B(),{teamDid:A}=_(),{control:a,handleSubmit:k,formState:{errors:x},watch:w,setValue:R,getValues:N}=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||""},mode:"onChange"}),c=w("scope"),u=w("logoUri"),{clientLogoUrl:O,apiPath:W}=ee(u),q=o=>{o!=="profile:read"&&R("scope",c.includes(o)?c.filter(i=>i!==o):[...c,o])},z=async o=>{const i={clientId:r.clientId,clientName:o.clientName.trim(),clientUri:o.clientUri,redirectUris:o.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:o.contacts?o.contacts.split(",").map(C=>C.trim()):[],scope:o.scope.join(" "),tosUri:o.tosUri,policyUri:o.policyUri,logoUri:o.logoUri};await f.updateOAuthClient({input:{teamDid:A,input:i}})},L=async o=>{l(!0);try{await z(o),d(),t()}catch(i){M.error(i.message||s("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(G,{open:!0,onClose:t,maxWidth:"md",fullWidth:!0,children:[e.jsxs(Q,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:t,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsxs(D,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(I,{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:O?e.jsx(p,{children:e.jsx("img",{src:O,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var o;(o=h.current)==null||o.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(de,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(E,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var o;(o=h.current)==null||o.open()},children:s(O?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Pe,{}),children:e.jsx(Ee,{ref:h,locale:g,popup:!0,onUploadFinish:o=>{R("logoUri",o.data.filename),z(N()).then(()=>{d()}).catch(i=>{M.error(i.message||s("oauth.client.updateFailed"))}).finally(()=>{var i;(i=h.current)==null||i.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:W,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(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(T,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(i=x.clientName)==null?void 0:i.message}),e.jsx(y,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(i=x.clientUri)==null?void 0:i.message}),e.jsx(y,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(i=x.redirectUris)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(I,{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(K.OAUTH_SCOPES).map(([o,i])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(o),onChange:()=>q(o),disabled:o==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:i})})},o))})})]}),e.jsx(Z,{}),e.jsx(I,{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:o})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...o,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(i=x.contacts)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(D,{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:o})=>{var i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...o,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(i=x.tosUri)==null?void 0:i.message}),e.jsx(y,{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:o})=>{var i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...o,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(i=x.policyUri)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(ue,{children:[e.jsx(E,{onClick:t,children:s("common.cancel")}),e.jsx(E,{onClick:k(L),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(J,{size:16}):s("common.update")})]})]})}xe.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function je({client:r,onUpdate:d,onClose:t}){return e.jsx(xe,{client:r,onUpdate:m=>d(m),onClose:t})}je.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function te(r){const{t:d}=F(),{api:t}=B(),{teamDid:m}=_(),{clientId:l,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},A=async()=>{try{await t.deleteOAuthClient({input:{teamDid:m,clientId:l}}),g()}catch(k){M.error(k==null?void 0:k.message)}finally{f()}},a={keyName:s,title:d("oauth.client.delete.title"),description:d("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:d("oauth.client.delete.description",{name:s}),confirm:d("common.delConfirm"),cancel:d("common.cancel"),onConfirm:A,onCancel:f};return e.jsx(Ne,{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:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:d}){return e.jsxs(p,{mb:3,children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(D,{spacing:1.5,children:d.map(({label:t,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:t}),e.jsx(I,{sx:{wordBreak:"break-all"},children:m||"-"})]},t))})]})}ge.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function fe({client:r,onClose:d}){const{t,locale:m}=F(),{teamDid:l}=_(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:A,clientUri:a,logoUri:k,contacts:x,tosUri:w,policyUri:R,jwksUri:N,jwks:c,softwareId:u,softwareVersion:O,clientIdIssuedAt:W,clientSecretExpiresAt:q,updatedAt:z,createUser:L}=r,{clientLogoUrl:o}=ee(k),i=j=>{try{const P=new URL(window.blocklet.appUrl);return P.pathname=j,P.toString()}catch{return"-"}},C=pe.fromAppDid(g,l),U=[{title:t("common.baseInfo"),items:[{label:t("oauth.client.name"),value:s},{label:t("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:o,did:C.address,size:64})},{label:t("oauth.client.clientUri"),value:a?e.jsx(v,{children:a}):"-"},{label:t("oauth.client.clientId"),value:e.jsx(v,{children:g})},{label:t("oauth.client.clientSecret"),value:e.jsx(v,{children:h})},{label:t("oauth.client.redirectUris"),value:e.jsx(v,{children:(f||[]).join(", ")})},{label:t("oauth.client.scope"),value:e.jsx(V,{scope:A})},{label:t("oauth.client.createUser"),value:L?We(L,!0):t("oauth.client.openRegistration")}]},{title:t("oauth.client.oauthEndpoints"),items:[{label:t("oauth.client.openidConfiguration"),value:e.jsx(v,{children:i("/.well-known/openid-configuration")})},{label:t("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/authorize")})},{label:t("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/token")})},{label:t("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/userinfo")})},{label:t("oauth.client.jwksUri"),value:e.jsx(v,{children:i("/.well-known/service/oauth/jwks")})},{label:t("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/register")})},{label:t("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/logout")})}]},{title:t("oauth.client.metaContact"),items:[{label:t("oauth.client.contacts"),value:x.length?e.jsx(v,{children:(x||[]).join(", ")}):"-"},{label:t("oauth.client.tosUri"),value:w?e.jsx(v,{children:w}):"-"},{label:t("oauth.client.policyUri"),value:R?e.jsx(v,{children:R}):"-"},{label:t("oauth.client.jwksUri"),value:N},{label:t("oauth.client.jwks"),value:c},{label:t("oauth.client.softwareId"),value:u},{label:t("oauth.client.softwareVersion"),value:O}]},{title:t("common.timeInfo"),items:[{label:t("oauth.client.clientIdIssuedAt"),value:W?e.jsx($,{value:W*1e3,type:"all",locale:m}):"-"},{label:t("oauth.client.clientSecretExpiresAt"),value:q?e.jsx($,{value:q*1e3,type:"all",locale:m}):"-"},{label:t("common.updatedAt"),value:z?e.jsx($,{value:z,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(G,{open:!0,onClose:d,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(Q,{children:[t("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsx(p,{mt:1,children:U.map((j,P)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),P!==U.length-1&&e.jsx(Z,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Fe(r){return e.jsx($,{value:r*1e3})}function ie({selected:r,onClose:d}){return r?e.jsx(fe,{client:r,onClose:d}):null}ie.propTypes={selected:n.object,onClose:n.func.isRequired};ie.defaultProps={selected:null};function Ue({open:r,onCreated:d,onClose:t}){return r?e.jsx(me,{onCreated:d,onClose:t}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function kt(){var o;const[r,d]=b.useState({searchText:"",pageSize:10,page:1}),[t,m]=b.useState(null),[l,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:A}=B(),{teamDid:a}=_(),[k,x]=b.useState(null),[w,R]=b.useState(null),N=ze(),{getClientLogoUrl:c}=ee(),u=Re(async()=>await A.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:O}=u,W=b.useMemo(()=>{var i;return((i=u.value)==null?void 0:i.list)||[]},[(o=u.value)==null?void 0:o.list]),q=b.useMemo(()=>r.searchText?W.filter(i=>i.clientName.toLowerCase().includes(r.searchText.toLowerCase())||i.clientId.toLowerCase().includes(r.searchText.toLowerCase())||i.scope.toLowerCase().includes(r.searchText.toLowerCase())):W,[r.searchText,W]),z=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(i,{rowIndex:C})=>{const U=q[C],j=c(U.logoUri),P=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"},onClick:be=>{be.stopPropagation(),window.open(U.clientUri,"_blank")},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:P.address,src:j,size:48}),e.jsxs(D,{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:i=>e.jsx(V,{scope:i})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Fe}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(i,{rowIndex:C})=>{const U=q[C];return e.jsx(De,{actions:[{icon:e.jsx(Ie,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(Ce,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),R(U)}}]})}}}],[q,h,c,a,x,R]),L=({page:i,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?d(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==i+1?d(j=>({...j,searchText:"",page:i+1})):r.searchText!==U&&d(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:[N?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(we,{data:q,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:q.length,searchDebounceTime:400,onRowClick(i,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const P=q[C];m(P)}}},onChange:L,title:N?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(E,{variant:"contained",size:"small",onClick:()=>s(!0),children:[O?e.jsx(J,{size:16}):e.jsx(de,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Te,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:t,onClose:()=>m(null)}),e.jsx(Ue,{open:l,onCreated:()=>{s(!1),u.retry()},onClose:()=>s(!1)}),k&&e.jsx(je,{client:k,onUpdate:u.retry,onClose:()=>x(null)}),w&&e.jsx(te,{...w,onDelete:u.retry,onClose:()=>R(null)})]})}export{kt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./vendor-mui-core-BV2FUxWJ.js";import"./vendor-react-DEoibe3W.js";import{S as t}from"./studio-B1PGcNac.js";import"./vendor-ux-did-connect-DROQhYpS.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-5qqHEVGo.js";import"./TuneOutlined-BvxrpP1M.js";function d(){return o.jsx(t,{children:"Coming soon..."})}export{d as default};
|